Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Asset Registry #63

Merged
merged 44 commits into from
Oct 10, 2022
Merged

Asset Registry #63

merged 44 commits into from
Oct 10, 2022

Conversation

bernardoaraujor
Copy link
Contributor

@bernardoaraujor bernardoaraujor commented Oct 5, 2022

pallet asset-registry

integration tests

xcm-playground.toml

  • [BREAKING CHANGE] - requires zombienet v1.2.67 or later - hrmp channels are now defined with camel_case, using older zombienet versions will not work (Make all keys snake_case in network config zombienet#390)
  • specify node ports (for parachains-integration-tests)
  • reduce relaychain validators from 4 to 2 (to optimize resource consumption)
  • increase collators per parachain from 1 to 2 (to ensure stable block production)

Copy link
Contributor

@Wiezzel Wiezzel left a comment

Choose a reason for hiding this comment

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

A bit o nitpicking.

pallets/asset-registry/README.md Outdated Show resolved Hide resolved
pallets/asset-registry/README.md Outdated Show resolved Hide resolved
pallets/asset-registry/README.md Outdated Show resolved Hide resolved
pallets/asset-registry/README.md Outdated Show resolved Hide resolved
pallets/asset-registry/README.md Outdated Show resolved Hide resolved
pallets/asset-registry/src/tests.rs Outdated Show resolved Hide resolved
pallets/asset-registry/src/tests.rs Outdated Show resolved Hide resolved
primitives/xcm/Cargo.toml Outdated Show resolved Hide resolved
primitives/xcm/src/lib.rs Outdated Show resolved Hide resolved
primitives/xcm/src/lib.rs Outdated Show resolved Hide resolved
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
bernardoaraujor and others added 10 commits October 6, 2022 19:06
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
node/src/chain_spec.rs Outdated Show resolved Hide resolved

impl<T: Config> Pallet<T> {
fn asset_exists(asset_id: AssetIdOf<T>) -> bool {
!T::Assets::minimum_balance(asset_id).is_zero()
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree this implementation is not trivial to understand, but i don't have any problem with keeping it.

Anyway, I wonder if it would make sense to push a PR for adding the function asset_exists(id: AssetId) on the pallet_assets, with the impl we might inspect the storage . May be we can define it under the impl_fungibles.rs file because it seems this basic functionality that is missing.

pallets/asset-registry/src/lib.rs Show resolved Hide resolved
@hbulgarini
Copy link
Contributor

@bernardoaraujor : Overall this looks very very good. I love the way you have documented the pallet.
Some minor comments though.

@bernardoaraujor
Copy link
Contributor Author

@hbulgarini I created an issue to track the asset_exists feature paritytech/substrate#12444

hbulgarini
hbulgarini previously approved these changes Oct 7, 2022
Copy link
Contributor

@hbulgarini hbulgarini left a comment

Choose a reason for hiding this comment

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

This is good to go IMHO.

@bernardoaraujor
Copy link
Contributor Author

bernardoaraujor commented Oct 7, 2022

@hbulgarini sorry I had to push another commit that reversed your approval

after setting LOCAL_ASSET_ID to 10 on the testnet_genesis, that was preventing parachain-integration-tests from creating the asset (since it already existed from genesis), which actually broke the integration tests.

I could either dismiss the creation of the trappist asset on the integration test (relying on the assumption that it is created on genesis), or just switch &trappist_asset_id to some value different than 10.

I chose the later so that 0_reserve_transfer.yml remains self explanatory (without having to check chain_spec.rs for genesis).

@bernardoaraujor bernardoaraujor merged commit 9b092be into master Oct 10, 2022
@bernardoaraujor bernardoaraujor deleted the 51-asset-registry branch October 10, 2022 11:30
@stiiifff
Copy link
Contributor

Looks great, thanks @bernardoaraujor ! Adding a last comment re. a potential later improvement: it could make sense to inject the multi-location validation logic via the Config trait.

arturgontijo added a commit that referenced this pull request Nov 11, 2022
* Executing a XCM call from an ink! contract. (#60)

* First try

* Contracts extension implemented and sample contract poc added

* fmt

* Fixing license

* Change to Vec

* Removing unnecesary to_vec()

* Asset Registry (#63)

* bootstrap pallet_asset_registry

* rm change_foreign_asset fn

* fix AsAssetMultiLocation implementation

* avoid creating/destroying assets for registry

* use loose coupling with Assets pallet

* split unit tests

* bootstrap xcm-simulator unit tests

* rustfmt

* rm change_foreign_asset extrinsic

* rename Foreign Asset -> Reserve Asset

* rm xcm-simulator from unit tests

* rename ForeignFungiblesTransactor->ReservedFungiblesTransactor

* add comments to asset-registry pallet errors

* bootstrap integration-tests

* asset-registry pallet README

* zombienet with 2 collators per para

* bootstrap benchmarks

* upgrade zombienet config camel_case

* update weights with GCP c2d-highcpu-8

* integration test: rm XcmV1MultiLocation attribute from ReserveAssetRegistered event

* rm unused StatemineAssetIdInfoB

* add WeightInfo to asset-registry mock

* Run cargo fmt & clippy

* More clippy smartness

* lint pallets/asset-registry/README.md

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/README.md

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/README.md

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/README.md

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/benchmarking.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/tests.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/tests.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint primitives/xcm/Cargo.toml

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint primitives/xcm/src/lib.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint primitives/xcm/src/lib.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/benchmarking.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/lib.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/lib.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* lint pallets/asset-registry/src/tests.rs

Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* fix ReserveAssetRegistered field

* add comment explaining fn asset_exists

* fix asset-registry pallet README

* set LOCAL_ASSET_ID to 10

* change &trappist_asset_id on integration test

Co-authored-by: Steve Degosserie <steve@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>

* Revamp README to explain the purpose of the Trappist project (#64)

* Revamp README to explain the purpose of the Trappist project; remove Docker-related stuff

* Add Contracts pallet & ink! to list of technologies

Co-authored-by: Hector Bulgarini <hbulgarini@gmail.com>

* Update README.md

Co-authored-by: Hector Bulgarini <hbulgarini@gmail.com>

Co-authored-by: Hector Bulgarini <hbulgarini@gmail.com>

* Fix formatting issue in README (#65)

* fix zombienet toml (#66)

* build(deps): update dependencies to polkadot v0.9.30 (#68)

* build(deps): update dependencies to polkadot v0.9.30
* ci: install protoc
* build(deps): update substrate-dex dependency

* test: update expected polkadotXcm.attempted event value (with threshold) (#70)

* docs: correct binary name (#67)

xcm-playground.toml refers to "./bin/polkadot-parachain" rather than `polkadot-collator`, and `cumulus' build results in `polkadot-parachain` binary.

* ci: use actions-rs (#69)

Allow local workflow runs using act.

* Minor cleanups (#73)

* cargo fmt

* cargo clippy

* ci: check formatting (#74)

* [XCMv3] master + pallet-asset-registry v0931

Co-authored-by: Hector Bulgarini <hbulgarini@gmail.com>
Co-authored-by: bernardo <bernardo@parity.io>
Co-authored-by: Steve Degosserie <steve@parity.io>
Co-authored-by: Adam Wierzbicki <adam.wierzbicki@parity.io>
Co-authored-by: Frank Bell <60948618+evilrobot-01@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asset registry
4 participants