@@ -1497,7 +1497,7 @@ fn get_recorded_state_diffs(ccx: &mut CheatsCtxt) -> BTreeMap<Address, AccountSt
14971497 } ) ;
14981498 let layout = storage_layouts. get ( & storage_access. account ) ;
14991499 // Update state diff. Do not overwrite the initial value if already set.
1500- match account_diff. state_diff . entry ( storage_access. slot ) {
1500+ let entry = match account_diff. state_diff . entry ( storage_access. slot ) {
15011501 Entry :: Vacant ( slot_state_diff) => {
15021502 // Get storage layout info for this slot
15031503 // Include mapping slots if available for the account
@@ -1509,9 +1509,8 @@ fn get_recorded_state_diffs(ccx: &mut CheatsCtxt) -> BTreeMap<Address, AccountSt
15091509
15101510 let slot_info = layout. and_then ( |layout| {
15111511 let decoder = SlotIdentifier :: new ( layout. clone ( ) ) ;
1512- decoder
1513- . identify ( & storage_access. slot , mapping_slots)
1514- . or_else ( || {
1512+ decoder. identify ( & storage_access. slot , mapping_slots) . or_else (
1513+ || {
15151514 // Create a map of new values for bytes/string
15161515 // identification. These values are used to determine
15171516 // the length of the data which helps determine how many
@@ -1524,43 +1523,31 @@ fn get_recorded_state_diffs(ccx: &mut CheatsCtxt) -> BTreeMap<Address, AccountSt
15241523 & storage_access. slot ,
15251524 & current_base_slot_values,
15261525 )
1527- } )
1528- . map ( |mut info| {
1529- // Always decode values first
1530- info. decode_values (
1531- storage_access. previousValue ,
1532- storage_access. newValue ,
1533- ) ;
1534-
1535- // Then handle long bytes/strings if applicable
1536- if info. is_bytes_or_string ( ) {
1537- info. decode_bytes_or_string_values (
1538- & storage_access. slot ,
1539- & raw_changes_by_slot,
1540- ) ;
1541- }
1542-
1543- info
1544- } )
1526+ } ,
1527+ )
15451528 } ) ;
15461529
15471530 slot_state_diff. insert ( SlotStateDiff {
15481531 previous_value : storage_access. previousValue ,
15491532 new_value : storage_access. newValue ,
15501533 slot_info,
1551- } ) ;
1534+ } )
15521535 }
1553- Entry :: Occupied ( mut slot_state_diff) => {
1554- let entry = slot_state_diff. get_mut ( ) ;
1536+ Entry :: Occupied ( slot_state_diff) => {
1537+ let entry = slot_state_diff. into_mut ( ) ;
15551538 entry. new_value = storage_access. newValue ;
1556-
1557- // Update decoded values if we have slot info
1558- if let Some ( ref mut slot_info) = entry. slot_info {
1559- slot_info. decode_values (
1560- entry. previous_value ,
1561- storage_access. newValue ,
1562- ) ;
1563- }
1539+ entry
1540+ }
1541+ } ;
1542+
1543+ // Update decoded values if we have slot info
1544+ if let Some ( slot_info) = & mut entry. slot_info {
1545+ slot_info. decode_values ( entry. previous_value , storage_access. newValue ) ;
1546+ if slot_info. is_bytes_or_string ( ) {
1547+ slot_info. decode_bytes_or_string_values (
1548+ & storage_access. slot ,
1549+ & raw_changes_by_slot,
1550+ ) ;
15641551 }
15651552 }
15661553 }
0 commit comments