-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(anvil
): v1.2 state load compatibility
#11179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fn try_from(legacy: LegacyBlockEnv) -> Result<Self, Self::Error> { | ||
Ok(Self { | ||
number: legacy.number.and_then(|v| v.to_u256()).unwrap_or(U256::ZERO), | ||
beneficiary: legacy.beneficiary.unwrap_or(Address::ZERO), | ||
timestamp: legacy.timestamp.and_then(|v| v.to_u256()).unwrap_or(U256::ONE), | ||
gas_limit: legacy.gas_limit.and_then(|v| v.to_u64()).unwrap_or(u64::MAX), | ||
basefee: legacy.basefee.and_then(|v| v.to_u64()).unwrap_or(0), | ||
difficulty: legacy.difficulty.and_then(|v| v.to_u256()).unwrap_or(U256::ZERO), | ||
prevrandao: legacy.prevrandao.or(Some(B256::ZERO)), | ||
blob_excess_gas_and_price: legacy | ||
.blob_excess_gas_and_price | ||
.map(|v| BlobExcessGasAndPrice::new(v.excess_blob_gas, v.blob_gasprice)) | ||
.or_else(|| { | ||
Some(BlobExcessGasAndPrice::new(0, BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE)) | ||
}), | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anvil
): v1.2 state dump compatibilityanvil
): v1.2 state load compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, no we finally have some tests to catch this
* add backwards compat for v1.2 anvil state dumps * nits * rename to _compat * nits * clean up * clean up * clean up, introduce LegacyBlockEnv * fix tests
Motivation
Optimistically closes: #11176
Implements backwards compatibility for loading Anvil state dumps generated with v1.2
Solution
Previously:
now succeeds loading
PR Checklist