WIP: PolymeshRuntimeInterface - #1997
Conversation
| type T = T; | ||
| type Interface = IPolymeshRuntimeCalls; | ||
|
|
||
| const MATCHER: AddressMatcher = AddressMatcher::Fixed(NonZero::new(9).unwrap()); |
There was a problem hiding this comment.
palceholder only
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
IPolymeshRuntimeSolidity ABI + Rust bindings and a newPolymeshRuntimeInterfaceprecompile that routes calls topallet_assetandpallet_identityextrinsics. - Registers the new precompile in develop/testnet/mainnet runtimes and the runtime test harness.
- Refactors
FungibleAssetInterfaceimplementation out of a monolithic module intofungible_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.rsno 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.
changelog
new features