revm
revm copied to clipboard
Manually impl `PartialEq` for `Reverts`
In reth's invalid block hooks, we first compare the invalid block's BundleState to a re-executed version, then use serde_json to serialize BundleState and save it as JSON. Because the reverts are unsorted, this leads to equivalent BundleStates being seen as not equal. Instead, there should be a comparison API for Reverts that returns true if the reverts have the same contents, regardless of ordering.
@Rjected like this?
/// Compares two `Reverts` for equality, sorting the internal `Vec`s in place.
pub fn unordered_eq(&mut self, other: &mut Self) -> bool {
// Sort inner vectors by Address in place
self.sort();
other.sort();
// Compare sorted structures for equality
self.0 == other.0
}
can I take this? @Rjected