refactor(account-keychain): use enumerable maps for scopes#3410
Closed
legion2002 wants to merge 3 commits intomainfrom
Closed
refactor(account-keychain): use enumerable maps for scopes#3410legion2002 wants to merge 3 commits intomainfrom
legion2002 wants to merge 3 commits intomainfrom
Conversation
3a6c0bb to
f2e4a1f
Compare
Base automatically changed from
tanishk/tip-1011-rest-exact
to
tanishk/tip-1011-precompiles-exact
April 1, 2026 13:11
Base automatically changed from
tanishk/tip-1011-precompiles-exact
to
tanishk/tip-1011-primitives-exact
April 1, 2026 13:12
0xrusowsky
reviewed
Apr 1, 2026
a404ce5 to
039285a
Compare
Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>
Contributor
📊 Tempo Precompiles Coverage |
tempoxyz-bot
reviewed
Apr 2, 2026
tempoxyz-bot
left a comment
There was a problem hiding this comment.
👁️ Cyclops Review — No actionable findings.
Nine independent audit passes (3 workers × 3 iterations) confirmed that the Set + Mapping → EnumerableMap refactor is storage-layout compatible, preserves all TIP-1011 invariants, and remains unreachable on the current T1C production hardfork.
Reviewer Callouts
- ⚡ Future
EnumerableMapreuse with nested values:EnumerableMap::load()/store()intentionally returnFatal(enumerable_map.rs:L201-L210). Current code only uses handler-style access (keys(),contains(),remove(),clear(),set_with()). Re-check if whole-valueat()/set()is ever used with nested struct values. - ⚡ Keychain atomicity under T1C:
AccountKeychainperforms multi-step scope writes without astorage.checkpoint()guard. Pre-existing pattern, not introduced here, but worth revisiting if keychain mutators grow. - ⚡ T3 activation re-review: All TIP-1011 call-scope entrypoints remain T3-gated. Run upgrade-compatibility tests when T3 activates on non-dev networks.
Contributor
Author
|
we've chosen not to do this, because it does not have perf improvements over the enumerable set approach we have right now. We might reopen later, just to add an enumerable map impl to the PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This PR Does
This PR now contains only the enumerable-map refactor that remained after the TIP-1011 stack merged.
EnumerableMap<K, V>to the precompile storage types, backed by aSet<K>for authoritative key membership and aMapping<K, V>for valuesEnumerableMapfromcrates/precompiles/src/storage/types/mod.rsAccountKeychainscope storage soKeyScope.targetsbecomesEnumerableMap<Address, TargetScope>andTargetScope.selectorsbecomesEnumerableMap<FixedBytes<4>, SelectorScope>AccountKeychainread and mutation paths to use the enumerable-map API instead of parallelSet + Mappingstructures when enumerating, inserting, removing, and clearing target and selector scopesis_scopedstill distinguishes unrestricted vs scoped deny-all, and empty child sets still mean "no further restriction"This does not change the external TIP-1011 interface or validation model. It only changes how scoped target/selector state is stored and maintained internally.
Verification
cargo fmt --all --checkcargo test -p tempo-precompiles --lib