-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: permissionless asset-registry #655
Merged
+12,075
−6,604
Merged
Changes from 103 commits
Commits
Show all changes
106 commits
Select commit
Hold shift + click to select a range
48fed67
asset-reg: wip merge metadata with details and make name optional
martinfridrich b5a4fad
asset-reg: updated bonds asset registration
martinfridrich 4639f8b
asset-registry: WIP make params optional + tests
martinfridrich 43880b8
asset-registry: remove debug println
martinfridrich c2f5051
asset-registry: WIP pallet refactor
martinfridrich f557c86
asset-registry: added tests for update and minor fixes
martinfridrich 9aec800
asset-registry: added register() tests
martinfridrich 5763a85
asset-registry: fix runtime and chain spec changes
martinfridrich 4931534
asset-registry: fixed tests in all the pallets
martinfridrich 5c71166
asset-registry: fixed benchmarks
martinfridrich d786741
asset-registry: added asset_id to CreateRegistry trait
martinfridrich c77fc9f
asset-registry: make clippy happy
martinfridrich a66a3d0
review
jak-pan 2d80b18
asset-registry: revert changes old registry trait and pallets using i…
martinfridrich 634a330
asset-registry: fixed xcm_rate_limit update
martinfridrich 82b0845
Merge branch 'feat/permissionless-asset-registry' of github.com:galac…
martinfridrich 16d587f
asset-registry: fix review comments
martinfridrich 4c9c248
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich 7c93b90
asset-registry: integration tests
martinfridrich bce9bcb
asset-registry: implemented extrinsic to create external assets
martinfridrich ed92f48
asset-registry: added benchmarks for register_external()
martinfridrich 797620e
asset-registry: WIP sufficiency check
martinfridrich 49f793a
asset-registry: wip suffiency check, remove lock when all tokens shou…
martinfridrich faad304
asset-registry: added tests for sufficiency check
martinfridrich 6cb9082
asset-registry: added whitelist to suffiency check + tests
martinfridrich 985c401
asset-registry: make clippy happy
martinfridrich cb9d56b
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich 1156f59
bump versions
martinfridrich 092a829
sufficiency-check: added UnsupportedCurrency error + tests
martinfridrich e8d8224
asset-registry: removed BoundedString from AssetDetails
martinfridrich 2d2ee81
asset-registry: changed hasher for Assets and AssetLocations + minor …
martinfridrich e1c8f12
asset-registry: fixed typos and removed unsued generics from registry…
martinfridrich d9bf21d
make clippy happy
martinfridrich 46db72b
asset-registry: wip migration
martinfridrich 780ed3e
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich ff33c2d
asset-registry: finished migration
martinfridrich 013afe7
asset-registry: added post-migration assertions
martinfridrich cdfc19a
sufficiency check: switched to sender to pay for ED and updated tests
martinfridrich 1db792a
asset-registry/sufficiency-check: added storage to count accounts tha…
martinfridrich 8bf0a52
asset-registry: wip review fixex
martinfridrich eb801d7
asset-registry: use max stringlimit in benmarks
martinfridrich beb4446
asset-registry: updated call_index of registre_external()
martinfridrich 2250a3a
sufficinecyCheck: updated docs
martinfridrich ca681e6
asset-registry: added test to check name and symblo length
martinfridrich def81db
asset-registry: fixed typos and formating
martinfridrich 776f9cd
asset-registry: removed NativeAssetId from config + make clippy happy
martinfridrich 3c485c4
asset-registry: regenerated default weights.rs
martinfridrich 648523e
Added transaction layer to integration-tests and removed proptest gen…
martinfridrich 7cccc68
assert-registry,sufficiencyCheck: fixed PR comments
martinfridrich 178fd68
Merge branch 'refactor/move_asset_pair_to_xyk' into feat/permissionle…
martinfridrich 2973161
fix benchmarks
martinfridrich e483825
pallet-xyk: fixed benchmakrks
martinfridrich 91d0fb7
router-executor: fixed benchmarks
martinfridrich 354768a
asset-registry: implemented new Registry traits
martinfridrich 928b5e4
pallet-xyk: refactor to use new Registry traits
martinfridrich 537e6f8
pallet-stableswap: refactor to use latest registry traits
martinfridrich a9e016f
pallet-bonds: refactor to use latest registry traits
martinfridrich e04940d
pallet-omnipool: refactor to use latest registry traits
martinfridrich c14a4e1
pallet-dca: refactor to use latest registry traits
martinfridrich b51cd6d
pallet-liquidity-minin: refactor to use latest registry traits
martinfridrich 4280f1c
pallet-otc: refactor to use latest registry traits
martinfridrich a2f0f3f
pallet-omnipool-liquidity-mining: refactor to use latest registry traits
martinfridrich ff08f1d
fix integration-tests and missing AssetLocation to runtime configs
martinfridrich 92b940f
refactor benchmarks to use use latest registry traits
martinfridrich 85039ed
pallet-otc: fixed benchmarks
martinfridrich decf0a4
pallet-omnipool-liquidity-mining: fix benchmarks and make clippy happy
martinfridrich b4a19e3
traits: remove deprecated registry traits
martinfridrich 3ddb972
traits: make location associated type of Inspect trait + update all n…
martinfridrich f0e4412
fix PR comments
martinfridrich aa4b6a9
fix PR comments
martinfridrich 5a03cf0
fix PR comments
martinfridrich bf2e99c
Merge branch 'feat/permissionless-asset-registry' into refactor/regis…
martinfridrich f88cc0b
Merge pull request #701 from galacticcouncil/refactor/registry-traits
martinfridrich a0b3d44
fix PR comments
martinfridrich af4b8c1
asset-registry: disallow suff -> insuff asset sufficiency change and …
martinfridrich 974f778
registy-registry: implemented is_blacklisted fn and block asset trans…
martinfridrich 9b8f0b4
asset-registry: rebenchmarked weights
martinfridrich 346e444
sufficiencyCheck: added defensive handling
martinfridrich e4102c3
Merge branch 'polkadot-v1.1.0' into feat/permissionless-asset-registry
martinfridrich 7ad680d
Merge branch 'polkadot-v1.1.0' into feat/permissionless-asset-registry
martinfridrich 7132cff
Merge branch 'polkadot-v1.1.0' into feat/permissionless-asset-registry
martinfridrich cfbde51
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich 949fdb5
asset-registry: fixed PoolShare migration
martinfridrich 31d7159
asset-registry: call correct asset registry migration
martinfridrich 1fe9a6f
rustfmt
martinfridrich 0fd752f
asset-registry: use BoundedVec for Name and Symbol instead of Vec
martinfridrich f3d7932
AssetRegistry: disallow whitespace chars in symbol
martinfridrich 378f157
assetRegistry: renamed blacklist to banned
martinfridrich 51b0f80
asset-registry: removed duplicate fuction
martinfridrich b0bc54a
asset-registry: fixed asset-registry changes in xyk, bonds, runtime a…
martinfridrich 419db3e
asset-registry: fixed all tests after api change
martinfridrich 1a9a429
sufficiency-check: collect little bit more than pay back on account k…
martinfridrich 374b3ce
asset-registry: README update
martinfridrich 50aa50e
bumb versions
martinfridrich c157817
orml-tokens: update benchmarks worst case, account with sufficiency c…
martinfridrich 80261e2
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich 1e9be74
xyk: benchmarks update
martinfridrich 1d93711
make clippy happy
martinfridrich 19f700f
bump versions
martinfridrich 36079cf
router: allow to store insufficient assets route and fixed benchmarks
martinfridrich 1b6c465
fixed broken benchmarks
martinfridrich a84d980
rebenchmark everything
martinfridrich 5c41122
fixed cda integration test
martinfridrich 77614bd
asset-registry: removed storage fees for external asset registration …
martinfridrich 3dd8ec9
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich 6515140
bump versions
martinfridrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
#![cfg(test)] | ||
|
||
use crate::asset_registry::Junction::GeneralIndex; | ||
use crate::polkadot_test_net::*; | ||
use frame_support::{assert_noop, assert_ok}; | ||
use frame_system::RawOrigin; | ||
use hydradx_runtime::{AssetRegistry as Registry, TechnicalCollective}; | ||
use polkadot_xcm::v3::{ | ||
Junction::{self, Parachain}, | ||
Junctions::X2, | ||
MultiLocation, | ||
}; | ||
use pretty_assertions::{assert_eq, assert_ne}; | ||
use xcm_emulator::TestExt; | ||
|
||
#[test] | ||
fn root_should_update_decimals_when_it_was_already_set() { | ||
TestNet::reset(); | ||
Hydra::execute_with(|| { | ||
let new_decimals = 53_u8; | ||
|
||
assert_ne!(Registry::assets(HDX).unwrap().decimals.unwrap(), new_decimals); | ||
|
||
assert_ok!(Registry::update( | ||
RawOrigin::Root.into(), | ||
HDX, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
Some(new_decimals), | ||
None | ||
)); | ||
|
||
assert_eq!(Registry::assets(HDX).unwrap().decimals.unwrap(), new_decimals); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn tech_comm_should_not_update_decimals_when_it_was_aleady_set() { | ||
TestNet::reset(); | ||
Hydra::execute_with(|| { | ||
let tech_comm = pallet_collective::RawOrigin::<AccountId, TechnicalCollective>::Members(1, 1); | ||
let new_decimals = 53_u8; | ||
|
||
assert_ne!(Registry::assets(HDX).unwrap().decimals.unwrap(), new_decimals); | ||
|
||
assert_noop!( | ||
Registry::update( | ||
tech_comm.into(), | ||
HDX, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
Some(new_decimals), | ||
None | ||
), | ||
pallet_asset_registry::Error::<hydradx_runtime::Runtime>::Forbidden | ||
); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn tech_comm_should_update_decimals_when_it_wasnt_set_yet() { | ||
TestNet::reset(); | ||
Hydra::execute_with(|| { | ||
let tech_comm = pallet_collective::RawOrigin::<AccountId, TechnicalCollective>::Members(1, 1); | ||
let new_decimals = 12_u8; | ||
|
||
assert!(Registry::assets(LRNA).unwrap().decimals.is_none()); | ||
|
||
assert_ok!(Registry::update( | ||
tech_comm.into(), | ||
LRNA, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
Some(new_decimals), | ||
None | ||
)); | ||
|
||
assert_eq!(Registry::assets(LRNA).unwrap().decimals.unwrap(), new_decimals); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn tech_comm_should_not_update_location_when_asset_exists() { | ||
TestNet::reset(); | ||
Hydra::execute_with(|| { | ||
let tech_comm = pallet_collective::RawOrigin::<AccountId, TechnicalCollective>::Members(1, 1); | ||
|
||
assert!(Registry::locations(LRNA).is_none()); | ||
|
||
assert_noop!( | ||
Registry::update( | ||
tech_comm.into(), | ||
LRNA, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
Some(hydradx_runtime::AssetLocation(MultiLocation::new( | ||
1, | ||
X2(Parachain(MOONBEAM_PARA_ID), GeneralIndex(0)) | ||
))), | ||
), | ||
pallet_asset_registry::Error::<hydradx_runtime::Runtime>::Forbidden | ||
); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn root_should_update_location_when_asset_exists() { | ||
jak-pan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TestNet::reset(); | ||
Hydra::execute_with(|| { | ||
assert!(Registry::locations(LRNA).is_none()); | ||
|
||
let loc_1 = | ||
hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(MOONBEAM_PARA_ID), GeneralIndex(0)))); | ||
|
||
//Set location 1-th time. | ||
assert_ok!(Registry::update( | ||
RawOrigin::Root.into(), | ||
LRNA, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
Some(loc_1.clone()) | ||
),); | ||
assert_eq!(Registry::locations(LRNA).unwrap(), loc_1); | ||
assert_eq!(Registry::location_assets(loc_1.clone()).unwrap(), LRNA); | ||
|
||
// Update location if it was previously set. | ||
let loc_2 = | ||
hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(INTERLAY_PARA_ID), GeneralIndex(0)))); | ||
|
||
assert_ok!(Registry::update( | ||
RawOrigin::Root.into(), | ||
LRNA, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
None, | ||
Some(loc_2.clone()) | ||
),); | ||
assert_eq!(Registry::locations(LRNA).unwrap(), loc_2); | ||
assert_eq!(Registry::location_assets(loc_2).unwrap(), LRNA); | ||
|
||
assert!(Registry::location_assets(loc_1).is_none()); | ||
}); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: not a fan of the naming of
assets
. Should be a name that makes sense here at the callsite, no?Sth. like
asset
ormeta_data
. A bunch of work to change, though, so understand if you're reluctant.