Complete implementation of precompiles - #3018
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🛡️ AI Review — Skeptic (security review)VERDICT: VULNERABLE VERY HIGH scrutiny: account is under 30 days old with one public repository; write permission and matching author/committer mitigate identity risk, with no known Gittensor association. Branch: feat/full-precompiles → main. Static analysis found no AI-review trust-boundary modifications or evidence of malicious intent. The previously reported runtime-version issue remains unresolved. Findings
Other findings
Prior-comment reconciliation
ConclusionThe PR changes consensus-executed runtime behavior while retaining 📜 Previous run (superseded)
# 🔍 AI Review — Auditor (domain review) has not yet run on this PR. |
|
🔄 AI review updated — Skeptic: VULNERABLE |
|
🔄 AI review updated — Skeptic: VULNERABLE |
|
🔄 AI review updated — Skeptic: VULNERABLE |
Summary
Expands typed EVM coverage for Subtensor by adding five new precompiles and 69 functions to existing precompiles. State-changing functions dispatch the highest-level pallet call as the mapped EVM signer, preserving the runtime’s existing authorization, rate limits, freeze windows, validation, weight charging, and error behavior.
No released precompile function was removed or changed. Existing ABIs only receive appended functions.
New precompiles
SchedulerPrecompile0x000000000000000000000000000000000000080fgetIncompleteSince(),getScheduledCallCount(uint64),getScheduledCall(uint64,uint32),getRetry(uint64,uint32),getTaskAddress(bytes32)DrandPrecompile0x0000000000000000000000000000000000000810getBeaconConfig(),getPulse(uint64),getStoredRoundRange(),getNextUnsignedAt(),hasMigrationRun(bytes)TimestampPrecompile0x0000000000000000000000000000000000000811getTimestamp(),wasUpdatedThisBlock()RuntimeConfigurationPrecompile0x0000000000000000000000000000000000000812getEvmChainId(),getTransactionRateLimit()PrecompileRegistry0x0000000000000000000000000000000000000813getPrecompileStatus(address,bytes4)Scheduler returns stable metadata such as call hashes, task IDs, priority, periodicity, and retry information rather than SCALE-encoded runtime calls or origins.
The registry reports reversible precompile disablement. Its lifecycle and replacement fields currently return active/default values until function lifecycle metadata is defined.
Functions added to existing precompiles
AlphaPrecompile
setRecycleOrBurn(uint16,uint8)setBurnHalfLife(uint16,uint16)setBurnIncreaseMultiplier(uint16,uint128)BalancePrecompile
burnBalance(uint256,bool)upgradeAccounts(bytes32[])upgradeAccountsis bounded to 64 accounts.BalanceTransferPrecompile
transferKeepAlive(bytes32,uint256)transferAll(bytes32,bool)These use explicit amounts and the mapped caller, independently of the legacy payable
transfer(bytes32)function.CrowdloanPrecompile
setMaxContribution(uint32,bool,uint64)The boolean distinguishes setting a limit from clearing it.
LeasingPrecompile
startCall(uint16)NeuronPrecompile
Weight operations:
setMechanismWeights(uint16,uint8,uint16[],uint16[],uint64)batchSetWeights(uint16[],uint16[][],uint16[][],uint64[])commitMechanismWeights(uint16,uint8,bytes32)batchCommitWeights(uint16[],bytes32[])revealMechanismWeights(uint16,uint8,uint16[],uint16[],uint16[],uint64)commitCrv3MechanismWeights(uint16,uint8,bytes,uint64)batchRevealWeights(uint16,uint16[][],uint16[][],uint16[][],uint64[])commitTimelockedWeights(uint16,bytes,uint64,uint16)commitTimelockedMechanismWeights(uint16,uint8,bytes,uint64,uint16)Registration, identity, and key operations:
register(uint16,uint64,uint64,bytes,bytes32,bytes32)rootRegister(bytes32)swapHotkey(bytes32,bytes32,bool,uint16)swapHotkeyV2(bytes32,bytes32,bool,uint16,bool)setChildren(bytes32,uint16,uint64[],bytes32[])setIdentity(string,string,string,string,string,string,string)tryAssociateHotkey(bytes32)associateEvmKey(uint16,address,uint64,bytes)announceColdkeySwap(bytes32)executeAnnouncedColdkeySwap(bytes32)disputeColdkeySwap()clearColdkeySwapAnnouncement()Batch calls are bounded to 16 outer items and 4,096 entries per inner weight array. Timelocked commits, registration work, child lists, identities, and signatures also have explicit bounds.
ProxyPrecompile
announce(bytes32,bytes32)removeAnnouncement(bytes32,bytes32)rejectAnnouncement(bytes32,bytes32)setRealPaysFee(bytes32,bool)StakingPrecompileV2
Delegation and unstaking:
decreaseTake(bytes32,uint16)increaseTake(bytes32,uint16)setChildkeyTake(bytes32,uint16,uint16)unstakeAll(bytes32)unstakeAllAlpha(bytes32)Stake movement and recycling:
swapStake(bytes32,uint16,uint16,uint64)swapStakeLimit(bytes32,uint16,uint16,uint64,uint64,bool)recycleAlpha(bytes32,uint64,uint16)transferStakeAndHotkey(bytes32,bytes32,bytes32,uint16,uint16,uint64)addStakeBurn(bytes32,uint16,uint64,bool,uint64)Root emission claims and account policy:
setColdkeyAutoStakeHotkey(uint16,bytes32)claimRoot(uint16[])setRootClaimType(uint8,uint16[])setRootClaimThreshold(uint16,uint64)setAutoParentDelegationEnabled(bytes32,bool)Collateral configuration:
addCollateral(uint16,bytes32,uint64,uint64)setMinCollateral(uint16,bytes32,uint64)setMinChildkeyTakePerSubnet(uint16,uint16)setCollateralLockShare(uint16,uint16)setCollateralDrainRatio(uint16,uint128)Root-claim subnet lists are bounded to five entries.
SubnetPrecompile
Subnet operations:
setSubnetIdentity(uint16,string,string,string,string,string,string,string,string)updateSubnetSymbol(uint16,string)triggerEpoch(uint16)Subnet-owner AdminUtils operations:
setBondsPenalty(uint16,uint16)setMaxAllowedUids(uint16,uint16)setMaxBurnV2(uint16,uint64)setMechanismCount(uint16,uint8)setMechanismEmissionSplit(uint16,bool,uint16[])setMinBurnV2(uint16,uint64)setOwnerCutEnabled(uint16,bool)setOwnerImmuneNeuronLimit(uint16,uint16)setTempo(uint16,uint16)trimToMaxAllowedUids(uint16,uint16)Only the signed subnet-owner path is exposed. These functions do not manufacture Root authorization.
VotingPowerPrecompile
enableVotingPowerTracking(uint16)disableVotingPowerTracking(uint16)Runtime and routing changes
Precompiles::used_addresses()and runtime routing.PrecompileEnumvariants for reversible enablement and disablement.NextUnsignedAt.ABI, Solidity, and SDK changes
Documentation
Deferred coverage
The following bulk runtime APIs remain documented proposals and receive no selectors in this change:
DelegateInfoRuntimeApi.get_delegatesNeuronInfoRuntimeApi.get_neuronsSubnetInfoRuntimeApi.get_all_metagraphsThey require a separately approved bounded, cursor-based or indexed interface.
Proxy.proxy_announcedalso remains proposed because it needs a stable, versioned EVM representation of the proxied call. This change does not introduce another SCALE-encodedRuntimeCallinterface.Root-only and
None-origin extrinsics remain unavailable through typed EVM precompiles.Validation
cargo test -p subtensor-precompiles— 108 passedcargo test -p pallet-admin-utils— 77 passedcargo check -p node-subtensor-runtime— passedThe optional no-default-features check is currently blocked by compilation errors in the upstream
cumulus-primitives-proof-size-hostfunctiondependency.