Skip to content

[smr-moonshot#4924] Publish bindings of the Supra precompile interfaces - #104

Merged
aregng merged 1 commit into
feature/revm-43-syncfrom
task/issue-4924-v6-4
Dec 3, 2026
Merged

aregng merged 1 commit into
feature/revm-43-syncfrom
task/issue-4924-v6-4

Conversation

@aregng

@aregng aregng commented Dec 3, 2026

Copy link
Copy Markdown

Summary

Publishes Rust bindings of the four Supra precompile interfaces from revm-supra-extension, as supra_contract_bindings::precompiles:

Binding Interface Precompile
ISupraNativeCrossing ISupraNativeCrossing.sol 0x…53555002
ISupraRandomness ISupraRandomness.sol 0x…53555003
ISupraBlockTimestamp ISupraBlockTimestamp.sol 0x…53555004
ISupraEvmGasConfig ISupraEvmGasConfig.sol 0x…53555005

Each is alloy::sol! over the JSON ABI the build script already compiles from solidity/supra_contracts/src/interfaces/ (the same mechanism as SupraContractsBindings), with all_derives.

Motivation

V6-4 of Entropy-Foundation/smr-moonshot#4924. The node implements these precompiles. Until now it declared each interface again in its own sol! block, and nothing checked that declaration against the Solidity file. With these bindings, the interface a contract imports and the selectors the node answers both come from the same .sol file. The node-side change is Entropy-Foundation/smr-moonshot (stacked on smr-moonshot#5341, which moves the node to feature/revm-43-sync). It drops the node's four sol! blocks and re-exports these bindings.

Changes

  • crates/supra-extension/src/supra_contract_bindings/precompiles.rs (new): the four bindings. Its hand-written docs turn the rustdoc lints back on, which the parent module relaxes for macro output.
  • supra_contract_bindings is now pub. supra_contracts_bindings is now pub(crate); its items remain re-exported from the crate root as before.
  • crates/supra-extension/tests/precompile_bindings.rs (new), 8 tests that check:
    • every function and custom-error selector and every event topic against its solc --hashes value and against the keccak of its signature;
    • the exact set of functions and errors each interface declares, plus the events of the two interfaces that have them;
    • the indexed topic and data layout of each event;
    • the return type of each entry point.

Precompile addresses stay with the node. The table in the module doc is for reference only.

Known follow-up: feature/revm-43-sync does not yet carry crossingGasCost() (added to ISupraNativeCrossing.sol on feature/evm_automation, #101). When that reaches this branch, the exact-set test for ISupraNativeCrossing needs the new selector.

Test plan

  • cargo test --release -p revm-supra-extension --test precompile_bindings: 8/8
  • crate unit tests: 191 passed
  • cargo clippy --release -p revm-supra-extension --all-targets -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --release -p revm-supra-extension --no-deps
  • cargo +nightly fmt --check
  • All 22 selectors and 3 topics recomputed independently with cast sig / cast keccak from the .sol sources
  • CI

🤖 Generated with Claude Code

Generate alloy `sol!` bindings for ISupraBlockTimestamp, ISupraRandomness,
ISupraNativeCrossing and ISupraEvmGasConfig from the JSON ABIs the build
script compiles, and export them as
`supra_contract_bindings::precompiles`, so the node that implements the
precompiles takes their selectors and event signatures from the Solidity
interfaces instead of its own transcription of them.

Tests pin every function selector, custom-error selector and event topic
to its `solc --hashes` value, the exact set each interface declares, the
indexed layout of each event and the return type of each entry point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aregng
aregng merged commit 0cca97c into feature/revm-43-sync Dec 3, 2026
21 checks passed
@aregng

aregng commented Dec 3, 2026

Copy link
Copy Markdown
Author

Node side: Entropy-Foundation/smr-moonshot#5405 (stacked on smr-moonshot#5341) re-exports these bindings in place of the node's own sol! declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants