Skip to content

Conversation

@pgherveou
Copy link
Contributor

@pgherveou pgherveou commented May 16, 2025

Add ERC20 precompile for pallet-asset.

Since there can be multiple instances of pallet-assets, the Precompile is implemented for an AssetPrecompileConfig that defines both the address range to match and how to extract the asset_id from the address.

For now I have only created one AssetIdExtractor that pulls an u32 asset id encoded in the address.

Follow up PR will define stateful extractor to extract the id from storage for foreign assets.

Other solidity traits will be added in follow up PRs

@pgherveou pgherveou marked this pull request as ready for review May 16, 2025 21:31
@pgherveou pgherveou requested a review from a team as a code owner May 16, 2025 21:31
@pgherveou
Copy link
Contributor Author

/cmd prdoc --audience runtime_dev --bump patch

@pgherveou pgherveou added T7-smart_contracts This PR/Issue is related to smart contracts. R0-no-crate-publish-required The change does not require any crates to be re-published. labels May 17, 2025
@pgherveou pgherveou removed the R0-no-crate-publish-required The change does not require any crates to be re-published. label May 17, 2025
@pgherveou
Copy link
Contributor Author

/cmd bench --runtime dev --pallet pallet-assets

@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet-assets" has started 🚀 See logs here

@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet-assets" has failed ❌! See logs here

@pgherveou
Copy link
Contributor Author

/cmd bench --runtime dev --pallet pallet_assets

@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet_assets" has started 🚀 See logs here

@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet_assets" has finished ✅ See logs here

Details

Subweight results:
File Extrinsic Old New Change [%]
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/snowbridge_pallet_system_frontend.rs register_token 91.00us 470.00us +416.48
substrate/frame/assets/src/weights.rs total_issuance 33.98us Added
substrate/frame/assets/src/weights.rs balance 33.87us Added
substrate/frame/assets/src/weights.rs allowance 36.63us Added
Command output:

✅ Successful benchmarks of runtimes/pallets:
-- dev: ['pallet_assets']

@pgherveou
Copy link
Contributor Author

/cmd prdoc --audience runtime_dev --bump minor --force

@pgherveou
Copy link
Contributor Author

/cmd fmt

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/15343086379
Failed job name: test-linux-stable

@athei athei enabled auto-merge May 30, 2025 13:47
@athei athei added this pull request to the merge queue May 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 30, 2025
@pgherveou pgherveou added this pull request to the merge queue May 30, 2025
Merged via the queue into master with commit ae4a242 May 30, 2025
256 of 259 checks passed
@pgherveou pgherveou deleted the pg/assets-precompile branch May 30, 2025 18:15
ordian added a commit that referenced this pull request Jun 4, 2025
* master:
  omni-node: fix `benchmark pallet` to work with `--runtime` (#8594)
  Handle and suppress "New unknown `FromSwarm` libp2p event" warning (#8731)
  Implement detailed logging for XCM failures (#8724)
  [pallet-revive] contract's nonce starts at 1 (#8734)
  sync/fix: Clear gap sync on known imported blocks (#8445)
  [PoP] Add personhood tracking pallets (#8164)
  client/net: Use litep2p as the default network backend (#8461)
  Unflake `returns_status_for_pruned_blocks` (#8709)
  [AHM] Report the weights of epmb pallet to expose kusama and polkadot weights (#8704)
  Remove all XCM dependencies from `pallet-revive` (#8584)
  Docker master image tag fix (#8711)
  Record ed as part of the storage deposit (#8718)
  [pallet-revive] update dry-run logic (#8662)
  feat: add collator peer ID to ParachainInherentData (#8708)
  Nest errors in pallet-xcm (#7730)
  pallet-assets ERC20 precompile (#8554)
  Broker: Introduce min price + adjust renewals to lower market. (#8630)
  [AHM] Staking async fixes for XCM and election planning (#8422)
  Staking (EPMB): Add defensive error handling to voter snapshot creation and solution verification (#8687)
pgherveou added a commit that referenced this pull request Jun 11, 2025
Add ERC20 precompile for pallet-asset.

Since there can be multiple instances of `pallet-assets`, the Precompile
is implemented for an `AssetPrecompileConfig` that defines both the
address range to match and how to extract the asset_id from the address.

For now I have only created one `AssetIdExtractor` that pulls an u32
asset id encoded in the address.

Follow up PR will define stateful extractor to extract the id from
storage for foreign assets.

Other solidity traits will be added in follow up PRs

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: Alexander Theißen <[email protected]>
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this pull request Aug 7, 2025
This brings in `stable2506` Polkadot SDK, and integrates many new
features.

Integrated breaking changes to be verified by the original authors:

- [x] ~paritytech/polkadot-sdk#8127 @kianenigma
@Ank4n~
     This will come in with AHM, and not before.
- [x] paritytech/polkadot-sdk#7597 @gui1117 
- [x] paritytech/polkadot-sdk#8254 @bkchr 
- [x] paritytech/polkadot-sdk#7592 @bkontur 
- [x] paritytech/polkadot-sdk#8382
@UtkarshBhardwaj007
- [x] paritytech/polkadot-sdk#8021 @serban300 
- [x] paritytech/polkadot-sdk#8344 @serban300 
- [x] paritytech/polkadot-sdk#8262 @athei 
- [x] paritytech/polkadot-sdk#8584 @athei 
- [x] paritytech/polkadot-sdk#8299 @skunert
- [x] paritytech/polkadot-sdk#8652 @pgherveou 
- [x] paritytech/polkadot-sdk#8554 @pgherveou 
- [x] paritytech/polkadot-sdk#8281 @mrshiposha 
- [x] paritytech/polkadot-sdk#7730
@franciscoaguirre
- [x] paritytech/polkadot-sdk#8599 @yrong
@claravanstaden
- [x] paritytech/polkadot-sdk#8531 @bkontur 
- [x] paritytech/polkadot-sdk#8409 @kianenigma 
- [x] paritytech/polkadot-sdk#9137
@franciscoaguirre
- [x] paritytech/polkadot-sdk#7944 @bkontur 
- [x] paritytech/polkadot-sdk#8179 @bkontur 
- [x] paritytech/polkadot-sdk#8037 @yrong

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: claravanstaden <[email protected]>
Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Alain Brenzikofer <[email protected]>
Co-authored-by: kianenigma <[email protected]>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: ron <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Overkillus <[email protected]>
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
Add ERC20 precompile for pallet-asset.

Since there can be multiple instances of `pallet-assets`, the Precompile
is implemented for an `AssetPrecompileConfig` that defines both the
address range to match and how to extract the asset_id from the address.

For now I have only created one `AssetIdExtractor` that pulls an u32
asset id encoded in the address.

Follow up PR will define stateful extractor to extract the id from
storage for foreign assets.

Other solidity traits will be added in follow up PRs

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: Alexander Theißen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T7-smart_contracts This PR/Issue is related to smart contracts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants