fix(precompile-storage): clear stale dynamic tail chunks after Cobalt#3987
Conversation
🟡 Heimdall Review Status
|
c9b7b7f to
c7259cc
Compare
Co-authored-by: OpenCode <opencode-noreply@coinbase.com>
c7259cc to
588372f
Compare
| precompiles, | ||
| admin_config, | ||
| observer, | ||
| StorageSemantics::Legacy, |
There was a problem hiding this comment.
install_with_observer hardcodes StorageSemantics::Legacy, unlike the other precompiles (B20Factory, PolicyRegistryPrecompile, BerylLookup) which derive semantics from the upgrade parameter. If a caller uses ActivationRegistry::install_with_observer directly at Cobalt, they'd silently get Legacy semantics.
This is safe today because the central BasePrecompiles::install_with_observer always passes the correct semantics, but consider adding an upgrade parameter (or at least a doc comment warning that this always uses Legacy) to keep the API consistent and prevent future misuse.
There was a problem hiding this comment.
Addressed in 044530b. Activation Registry convenience paths now derive StorageSemantics::Legacy vs StorageSemantics::Cobalt from ActivationAdminConfig::state_enabled, including install_with_config, install_with_observer, and precompile_with_observer. Added a focused test covering static-fallback and state-backed configurations.
Co-authored-by: OpenCode <opencode-noreply@coinbase.com>
Summary
Bytes,String, orVec<T>values overwrite longer valuesImplementation
StorageSemantics::{Legacy, Cobalt}selected byBasePrecompilesScope
This prevents new stale tails at and after Cobalt and cleans legacy tails when their metadata remains reachable. Historical orphaned slots whose old length metadata was already overwritten cannot be discovered without a separate state migration or high-water metadata.
Testing
cargo +nightly fmt --all -- --checkcargo test -p base-precompile-storage --all-featurescargo test -p base-common-precompilescargo test -p base-common-evmcargo check -p base-precompile-storage --no-default-featuresRISC0_SKIP_BUILD_KERNELS=1 BASE_SUCCINCT_ELF_STUB=1 cargo clippy -p base-precompile-storage -p base-common-precompiles -p base-common-evm --all-targets -- -D warningsReferences