feat: ✨ Add Moonbeam EVM Precompile Registry#137
Merged
Conversation
…ry to DataHaven runtimes
Contributor
|
This PR is also upgrading polkadot-sdk from |
Contributor
Author
|
It is a good point @gonzamontiel, though it is actually more of a downgrade 😅 (if you look at the previous pinned revision of the Polkadot SDK in the Cargo.lock). The PR aligns the dependencies on the latest commit of the https://github.com/polkadot-evm/frontier/commits/stable2412/ branch (see this PR polkadot-evm/frontier#1714 specifically). |
This PR add the storagehub pallets to the `testnet` and `mainnet` runtime. The storage hub pallets are only build with the runtime if the `storage-hub` feature is activated. It is also add minor fixes to the `stagenet` runtime (fix wrong path dependencies, index collision, etc...). --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
ahmadkaouk
approved these changes
Sep 4, 2025
stiiifff
added a commit
that referenced
this pull request
Sep 5, 2025
## Summary This PR adds Moonbeam's Batch precompile to DataHaven, enabling efficient batching of multiple EVM transactions in a single call. This implementation follows Moonbeam's exact architecture and provides significant gas savings for batch operations. ## Key Features ### Batch Precompile Functions - **`batchSome(address[], uint256[], bytes[], uint64[])`**: Execute multiple calls, continuing on failures - **`batchSomeUntilFailure(address[], uint256[], bytes[], uint64[])`**: Execute calls until first failure - **`batchAll(address[], uint256[], bytes[], uint64[])`**: Execute all calls, reverting if any fail ### Technical Implementation - **Address**: `0x0808` (2056 in decimal) - **Access Control**: Restricted nesting with `SubcallWithMaxNesting<2>` - **Self-recursion**: Only the Batch precompile can call itself (`OnlyFrom<AddressU64<2056>>`) - **Gas Management**: Proper gas estimation and refund handling - **Error Handling**: Comprehensive revert reasons and event logging Depends on #137 --------- Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
stiiifff
added a commit
that referenced
this pull request
Sep 7, 2025
## Summary This PR adds Moonbeam's CallPermit precompile to DataHaven, enabling gasless meta-transactions through EIP-712 signature-based permissions. Users can sign transaction permits offline, allowing relayers to execute transactions on their behalf while maintaining full security and authentication. ## Key Features ### CallPermit Precompile Functions - **`dispatch(address from, address to, uint256 value, bytes data, uint64[] gasLimit, uint256 deadline, uint8 v, bytes32 r, bytes32 s)`**: Execute permitted calls with signature verification - **`nonces(address owner)`**: Get current nonce for permit validation ### Technical Implementation - **Address**: `0x080A` (2058 in decimal) - **EIP-712 Compliance**: Structured signature validation with proper domain separation - **Nonce Management**: Per-user nonce tracking for replay protection - **Deadline Validation**: Time-bound permits for enhanced security - **Gas Forwarding**: Proper gas limit enforcement and forwarding Depends on #137 --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
Summary
This PR implements a comprehensive EVM precompile registry system for DataHaven, following Moonbeam's exact architecture and patterns. The implementation includes:
0x0815(2069) that manages and queries available precompilesKey Features
Registry Precompile Functions
isPrecompile(address): Check if an address corresponds to any precompile (active or inactive)isActivePrecompile(address): Check if a precompile is currently active in the runtimeupdateAccountCode(address): Insert dummy EVM bytecode for Solidity compatibilityRuntime Integration
PrecompileSetBuilderpattern for composable precompile managementCallableByContractandCallableByPrecompiletraits