mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(hooks): sort reverts in BundleState before comparison (#11358)
This commit is contained in:
@ -118,7 +118,7 @@ where
|
||||
db.merge_transitions(BundleRetention::Reverts);
|
||||
|
||||
// Take the bundle state
|
||||
let bundle_state = db.take_bundle();
|
||||
let mut bundle_state = db.take_bundle();
|
||||
|
||||
// Initialize a map of preimages.
|
||||
let mut state_preimages = HashMap::default();
|
||||
@ -198,6 +198,21 @@ where
|
||||
}
|
||||
|
||||
// The bundle state after re-execution should match the original one.
|
||||
//
|
||||
// NOTE: This should not be needed if `Reverts` had a comparison method that sorted first,
|
||||
// or otherwise did not care about order.
|
||||
//
|
||||
// See: https://github.com/bluealloy/revm/issues/1813
|
||||
let mut output = output.clone();
|
||||
for reverts in output.state.reverts.iter_mut() {
|
||||
reverts.sort_by(|left, right| left.0.cmp(&right.0));
|
||||
}
|
||||
|
||||
// We also have to sort the `bundle_state` reverts
|
||||
for reverts in bundle_state.reverts.iter_mut() {
|
||||
reverts.sort_by(|left, right| left.0.cmp(&right.0));
|
||||
}
|
||||
|
||||
if bundle_state != output.state {
|
||||
let original_path = self.save_file(
|
||||
format!("{}_{}.bundle_state.original.json", block.number, block.hash()),
|
||||
|
||||
Reference in New Issue
Block a user