Skip to content

Commit

Permalink
Refactor and fix for storage comparision logic
Browse files Browse the repository at this point in the history
  • Loading branch information
aamirpashaa committed Oct 22, 2024
1 parent 4b037a0 commit 48cccf2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/telos/rpc-engine-api/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,15 @@ where
}
if let Ok(revm_row) = revm_db.storage(row.address, row.key) {
// The values should match, but if it is removed, then the revm value should be zero
if !(revm_row == row.value) && !(revm_row != U256::ZERO || row.removed == true) {
maybe_panic!(panic_mode, "Difference in value on revm storage, address: {:?}, key: {:?}, revm-value: {:?}, tevm-row: {:?}", row.address, row.key, revm_row, row);
state_override.override_storage(revm_db, row.address, row.key, row.value);
if revm_row != row.value {
if revm_row != U256::ZERO && row.removed == true {
maybe_panic!(panic_mode, "Difference in value on revm storage, removed on Telos, non-ZERO on revm, address: {:?}, key: {:?}, revm-value: {:?}, tevm-row: {:?}", row.address, row.key, revm_row, row);
state_override.override_storage(revm_db, row.address, row.key, U256::ZERO);
}
if row.removed == false {
maybe_panic!(panic_mode, "Difference in value on revm storage, address: {:?}, key: {:?}, revm-value: {:?}, tevm-row: {:?}", row.address, row.key, revm_row, row);
state_override.override_storage(revm_db, row.address, row.key, row.value);
}
}
} else {
maybe_panic!(panic_mode, "Key was not found on revm storage, address: {:?}, key: {:?}",row.address,row.key);
Expand Down

0 comments on commit 48cccf2

Please sign in to comment.