Precompile deprecation and storage read precompile#1
Open
pablo-reef wants to merge 7 commits into
Open
Conversation
Implement the Precompile Versioning & Deprecation RFC (Phases 1-3): Phase 1 — Deprecation Registry Precompile: - Add DeprecationInfo struct and DeprecationRegistryStorage (StorageDoubleMap keyed by precompile INDEX + function selector) to pallet-admin-utils - Add DeprecationRegistry variant to PrecompileEnum - Add sudo_set_deprecation_info (call_index 86) and sudo_remove_deprecation_info (call_index 87) extrinsics - Add DeprecationInfoSet and DeprecationInfoRemoved events - Create DeprecationRegistryPrecompile at INDEX 2064 (0x810) with getDeprecationInfo(address, bytes32) view function - Create deprecationRegistry.sol Solidity interface with DeprecationInfo struct - Wire precompile in lib.rs (used_addresses 26 → 27) Phase 2 — Staking V1 Soft-Deprecation: - Rename IStaking → IStakingV1, ISTAKING_ADDRESS → ISTAKING_V1_ADDRESS - Add @deprecated natspec to all V1 functions pointing to V2 at 0x805 - No Rust changes — V1 at 0x801 continues to work identically Phase 3 — Metagraph Interface Completeness: - Verified all 17 Rust functions have matching Solidity declarations
…PREFIXES pallets New precompiles: - DrandPrecompile (0x811): getLastStoredRound, getOldestStoredRound, getPulse, getCurrentRandomness - TimestampPrecompile (0x812): getNow Extended existing precompiles: - CrowdloanPrecompile: getNextCrowdloanId, getCurrentCrowdloanId - ProxyPrecompile: getLastCallResult - BalanceTransferPrecompile: getTotalIssuance, getFreeBalance - NeuronPrecompile: getUid, isHotkeyRegistered, getPrometheus, getBurnCost, getDifficulty Wiring: added pallet-drand/pallet-timestamp deps, PrecompileEnum variants, used_addresses 27->29
…ile views - Implemented explicit typed precompile views for all 10 authorized pallets (SubtensorModule, Swap, Balances, Proxy, Drand, Crowdloan, Scheduler, Sudo, Multisig, Timestamp). - Auto-generated 144+ Solidity view interfaces (e.g. `ISubtensor`, `ISwap`) to map seamlessly with Substrate EVM bindings.
fixed precompile lints and removed warnings replaced banned as_* calls with safe try_into fixed freeze_struct hashes in admin-utils fixed contract tests for subtensor, crowdloan, and drand updated balanceTransfer and timestamp test assertions
d363a2e to
b1f269c
Compare
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.
Description
Add typed storage view precompiles to replace raw
StorageQueryPrecompileaccess with compile-time safe, ABI-typed functions. This PR also introduces a deprecation registry to support structured precompile versioning.New Precompiles
0x810) — query deprecation info for any precompile function viagetDeprecationInfo(address, bytes32)0x811) —getLastStoredRound,getOldestStoredRound,getPulse,getCurrentRandomness0x812) —getNowExtended Existing Precompiles
getNextCrowdloanId,getCurrentCrowdloanIdgetLastCallResultgetTotalIssuance,getFreeBalancegetUid,isHotkeyRegistered,getPrometheus,getBurnCost,getDifficultyDeprecation Registry (pallet-admin-utils)
DeprecationInfostruct +DeprecationRegistryStorage(keyed by precompile INDEX + selector)sudo_set_deprecation_info/sudo_remove_deprecation_infoextrinsics@deprecatednatspec pointing to V2Related Issue(s)
Type of Change
Breaking Change
No breaking changes. All existing precompile addresses and function selectors remain unchanged. StakingV1 at
0x801continues to work identically — only Solidity interface annotations have changed.Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyAdditional Notes
Files changed: 21 (+593, -531 — the -531 is mostly from removing duplicated contract-tests TS bindings that were replaced)
Precompile Address Map (new entries)
0x810getDeprecationInfo0x8110x812getNow