Skip to content

WIP: PolymeshRuntimeInterface - #1997

Draft
HenriqueNogara wants to merge 3 commits into
developfrom
polymesh-precompile
Draft

WIP: PolymeshRuntimeInterface#1997
HenriqueNogara wants to merge 3 commits into
developfrom
polymesh-precompile

Conversation

@HenriqueNogara

Copy link
Copy Markdown
Contributor

changelog

new features

@HenriqueNogara HenriqueNogara changed the title Polymesh precompile WIP: PolymeshRuntimeInterface Aug 26, 2026
type T = T;
type Interface = IPolymeshRuntimeCalls;

const MATCHER: AddressMatcher = AddressMatcher::Fixed(NonZero::new(9).unwrap());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

palceholder only

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For fixed address matchers, we should use larger values (more non-zero bytes) and the low value for prefix matcher (these addresses will have more non-zero bytes).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “general-purpose” Polymesh runtime precompile interface (in addition to the existing fungible-asset precompile) and wires it into the various runtimes, while also refactoring the existing fungible-asset precompile implementation into submodules.

Changes:

  • Introduces IPolymeshRuntime Solidity ABI + Rust bindings and a new PolymeshRuntimeInterface precompile that routes calls to pallet_asset and pallet_identity extrinsics.
  • Registers the new precompile in develop/testnet/mainnet runtimes and the runtime test harness.
  • Refactors FungibleAssetInterface implementation out of a monolithic module into fungible_asset/* submodules.

Reviewed changes

Copilot reviewed 14 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
precompiles/src/lib.rs Generates Rust bindings for the new IPolymeshRuntime Solidity interface.
precompiles/src/interfaces/PolymeshRuntime.sol New Solidity interface describing general-purpose runtime calls/events.
pallets/runtime/tests/src/storage.rs Adds PolymeshRuntimeInterface to the precompile set in runtime tests.
pallets/runtime/testnet/src/runtime.rs Adds PolymeshRuntimeInterface to the precompile set for testnet runtime.
pallets/runtime/mainnet/src/runtime.rs Adds PolymeshRuntimeInterface to the precompile set for mainnet runtime.
pallets/runtime/develop/src/runtime.rs Adds PolymeshRuntimeInterface to the precompile set for develop runtime.
pallets/precompiles/src/lib.rs Exposes PolymeshRuntimeInterface and extends Config bounds to include pallet_identity.
pallets/precompiles/src/interface/polymesh/mod.rs New precompile router for the general-purpose runtime interface at a fixed address.
pallets/precompiles/src/interface/polymesh/identity.rs Implements registerDid dispatch + event emission.
pallets/precompiles/src/interface/polymesh/asset.rs Implements createAsset / registerTicker dispatch + event emission and ABI conversions.
pallets/precompiles/src/interface/mod.rs Switches interface module to a thin re-export layer for fungible_asset and polymesh.
pallets/precompiles/src/interface/fungible_asset/mod.rs New module containing the FungibleAssetInterface precompile entrypoint after refactor.
pallets/precompiles/src/interface/fungible_asset/erc20.rs ERC20 (and stubbed permit) implementation moved into its own module.
pallets/precompiles/src/interface/fungible_asset/erc3643.rs ERC3643-related functionality moved into its own module.
pallets/precompiles/src/interface/fungible_asset/erc7943.rs ERC7943-related functionality moved into its own module.
pallets/precompiles/src/interface/fungible_asset/polymesh_specific.rs Polymesh-specific mint/burn functions moved into a dedicated module.
pallets/precompiles/src/common.rs Adds ABI-to-runtime conversions for AssetType and AssetIdentifier.
pallets/precompiles/Cargo.toml Adds pallet-identity dependency/feature flags required by the new precompile.
Cargo.lock Locks new pallet-identity dependency inclusion.
Suppressed comments (1)

pallets/precompiles/src/interface/mod.rs:6

  • interface/mod.rs no longer has the standard Polymesh GPLv3 file header / module docs that are present on other modules in this crate (e.g. pallets/precompiles/src/common.rs:1-16). Please restore the header to keep licensing and documentation consistent.
mod fungible_asset;
mod polymesh;

pub use fungible_asset::*;
pub use polymesh::*;


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants