Skip to content
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
merged 106 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 Aug 15, 2023
b5a4fad
asset-reg: updated bonds asset registration
martinfridrich Aug 15, 2023
4639f8b
asset-registry: WIP make params optional + tests
martinfridrich Aug 23, 2023
43880b8
asset-registry: remove debug println
martinfridrich Aug 23, 2023
c2f5051
asset-registry: WIP pallet refactor
martinfridrich Aug 24, 2023
f557c86
asset-registry: added tests for update and minor fixes
martinfridrich Aug 28, 2023
9aec800
asset-registry: added register() tests
martinfridrich Aug 28, 2023
5763a85
asset-registry: fix runtime and chain spec changes
martinfridrich Aug 28, 2023
4931534
asset-registry: fixed tests in all the pallets
martinfridrich Aug 28, 2023
5c71166
asset-registry: fixed benchmarks
martinfridrich Aug 29, 2023
d786741
asset-registry: added asset_id to CreateRegistry trait
martinfridrich Aug 29, 2023
c77fc9f
asset-registry: make clippy happy
martinfridrich Aug 29, 2023
a66a3d0
review
jak-pan Aug 30, 2023
2d80b18
asset-registry: revert changes old registry trait and pallets using i…
martinfridrich Aug 31, 2023
634a330
asset-registry: fixed xcm_rate_limit update
martinfridrich Aug 31, 2023
82b0845
Merge branch 'feat/permissionless-asset-registry' of github.com:galac…
martinfridrich Sep 1, 2023
16d587f
asset-registry: fix review comments
martinfridrich Sep 1, 2023
4c9c248
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich Sep 1, 2023
7c93b90
asset-registry: integration tests
martinfridrich Sep 4, 2023
bce9bcb
asset-registry: implemented extrinsic to create external assets
martinfridrich Sep 12, 2023
ed92f48
asset-registry: added benchmarks for register_external()
martinfridrich Sep 13, 2023
797620e
asset-registry: WIP sufficiency check
martinfridrich Sep 27, 2023
49f793a
asset-registry: wip suffiency check, remove lock when all tokens shou…
martinfridrich Sep 27, 2023
faad304
asset-registry: added tests for sufficiency check
martinfridrich Sep 28, 2023
6cb9082
asset-registry: added whitelist to suffiency check + tests
martinfridrich Sep 29, 2023
985c401
asset-registry: make clippy happy
martinfridrich Sep 29, 2023
cb9d56b
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich Sep 29, 2023
1156f59
bump versions
martinfridrich Sep 29, 2023
092a829
sufficiency-check: added UnsupportedCurrency error + tests
martinfridrich Oct 9, 2023
e8d8224
asset-registry: removed BoundedString from AssetDetails
martinfridrich Oct 9, 2023
2d2ee81
asset-registry: changed hasher for Assets and AssetLocations + minor …
martinfridrich Oct 9, 2023
e1c8f12
asset-registry: fixed typos and removed unsued generics from registry…
martinfridrich Oct 10, 2023
d9bf21d
make clippy happy
martinfridrich Oct 10, 2023
46db72b
asset-registry: wip migration
martinfridrich Oct 10, 2023
780ed3e
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich Oct 11, 2023
ff33c2d
asset-registry: finished migration
martinfridrich Oct 12, 2023
013afe7
asset-registry: added post-migration assertions
martinfridrich Oct 12, 2023
cdfc19a
sufficiency check: switched to sender to pay for ED and updated tests
martinfridrich Oct 16, 2023
1db792a
asset-registry/sufficiency-check: added storage to count accounts tha…
martinfridrich Oct 18, 2023
8bf0a52
asset-registry: wip review fixex
martinfridrich Oct 18, 2023
eb801d7
asset-registry: use max stringlimit in benmarks
martinfridrich Oct 18, 2023
beb4446
asset-registry: updated call_index of registre_external()
martinfridrich Oct 18, 2023
2250a3a
sufficinecyCheck: updated docs
martinfridrich Oct 19, 2023
ca681e6
asset-registry: added test to check name and symblo length
martinfridrich Oct 19, 2023
def81db
asset-registry: fixed typos and formating
martinfridrich Oct 19, 2023
776f9cd
asset-registry: removed NativeAssetId from config + make clippy happy
martinfridrich Oct 23, 2023
3c485c4
asset-registry: regenerated default weights.rs
martinfridrich Oct 23, 2023
648523e
Added transaction layer to integration-tests and removed proptest gen…
martinfridrich Oct 27, 2023
7cccc68
assert-registry,sufficiencyCheck: fixed PR comments
martinfridrich Oct 27, 2023
178fd68
Merge branch 'refactor/move_asset_pair_to_xyk' into feat/permissionle…
martinfridrich Oct 27, 2023
2973161
fix benchmarks
martinfridrich Oct 27, 2023
e483825
pallet-xyk: fixed benchmakrks
martinfridrich Oct 31, 2023
91d0fb7
router-executor: fixed benchmarks
martinfridrich Oct 31, 2023
354768a
asset-registry: implemented new Registry traits
martinfridrich Nov 8, 2023
928b5e4
pallet-xyk: refactor to use new Registry traits
martinfridrich Nov 8, 2023
537e6f8
pallet-stableswap: refactor to use latest registry traits
martinfridrich Nov 9, 2023
a9e016f
pallet-bonds: refactor to use latest registry traits
martinfridrich Nov 9, 2023
e04940d
pallet-omnipool: refactor to use latest registry traits
martinfridrich Nov 9, 2023
c14a4e1
pallet-dca: refactor to use latest registry traits
martinfridrich Nov 9, 2023
b51cd6d
pallet-liquidity-minin: refactor to use latest registry traits
martinfridrich Nov 9, 2023
4280f1c
pallet-otc: refactor to use latest registry traits
martinfridrich Nov 9, 2023
a2f0f3f
pallet-omnipool-liquidity-mining: refactor to use latest registry traits
martinfridrich Nov 9, 2023
ff08f1d
fix integration-tests and missing AssetLocation to runtime configs
martinfridrich Nov 9, 2023
92b940f
refactor benchmarks to use use latest registry traits
martinfridrich Nov 10, 2023
85039ed
pallet-otc: fixed benchmarks
martinfridrich Nov 10, 2023
decf0a4
pallet-omnipool-liquidity-mining: fix benchmarks and make clippy happy
martinfridrich Nov 13, 2023
b4a19e3
traits: remove deprecated registry traits
martinfridrich Nov 13, 2023
3ddb972
traits: make location associated type of Inspect trait + update all n…
martinfridrich Nov 14, 2023
f0e4412
fix PR comments
martinfridrich Nov 14, 2023
aa4b6a9
fix PR comments
martinfridrich Nov 14, 2023
5a03cf0
fix PR comments
martinfridrich Nov 15, 2023
bf2e99c
Merge branch 'feat/permissionless-asset-registry' into refactor/regis…
martinfridrich Nov 22, 2023
f88cc0b
Merge pull request #701 from galacticcouncil/refactor/registry-traits
martinfridrich Nov 22, 2023
a0b3d44
fix PR comments
martinfridrich Nov 22, 2023
af4b8c1
asset-registry: disallow suff -> insuff asset sufficiency change and …
martinfridrich Dec 1, 2023
974f778
registy-registry: implemented is_blacklisted fn and block asset trans…
martinfridrich Dec 4, 2023
9b8f0b4
asset-registry: rebenchmarked weights
martinfridrich Dec 4, 2023
346e444
sufficiencyCheck: added defensive handling
martinfridrich Dec 5, 2023
e4102c3
Merge branch 'polkadot-v1.1.0' into feat/permissionless-asset-registry
martinfridrich Dec 6, 2023
7ad680d
Merge branch 'polkadot-v1.1.0' into feat/permissionless-asset-registry
martinfridrich Dec 7, 2023
7132cff
Merge branch 'polkadot-v1.1.0' into feat/permissionless-asset-registry
martinfridrich Jan 12, 2024
cfbde51
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich Jan 24, 2024
949fdb5
asset-registry: fixed PoolShare migration
martinfridrich Jan 24, 2024
31d7159
asset-registry: call correct asset registry migration
martinfridrich Jan 24, 2024
1fe9a6f
rustfmt
martinfridrich Jan 24, 2024
0fd752f
asset-registry: use BoundedVec for Name and Symbol instead of Vec
martinfridrich Jan 26, 2024
f3d7932
AssetRegistry: disallow whitespace chars in symbol
martinfridrich Jan 26, 2024
378f157
assetRegistry: renamed blacklist to banned
martinfridrich Jan 26, 2024
51b0f80
asset-registry: removed duplicate fuction
martinfridrich Jan 26, 2024
b0bc54a
asset-registry: fixed asset-registry changes in xyk, bonds, runtime a…
martinfridrich Jan 26, 2024
419db3e
asset-registry: fixed all tests after api change
martinfridrich Jan 29, 2024
1a9a429
sufficiency-check: collect little bit more than pay back on account k…
martinfridrich Jan 29, 2024
374b3ce
asset-registry: README update
martinfridrich Jan 30, 2024
50aa50e
bumb versions
martinfridrich Jan 31, 2024
c157817
orml-tokens: update benchmarks worst case, account with sufficiency c…
martinfridrich Feb 1, 2024
80261e2
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich Feb 11, 2024
1e9be74
xyk: benchmarks update
martinfridrich Feb 12, 2024
1d93711
make clippy happy
martinfridrich Feb 13, 2024
19f700f
bump versions
martinfridrich Feb 13, 2024
36079cf
router: allow to store insufficient assets route and fixed benchmarks
martinfridrich Feb 15, 2024
1b6c465
fixed broken benchmarks
martinfridrich Feb 15, 2024
a84d980
rebenchmark everything
martinfridrich Feb 15, 2024
5c41122
fixed cda integration test
martinfridrich Feb 15, 2024
77614bd
asset-registry: removed storage fees for external asset registration …
martinfridrich Feb 20, 2024
3dd8ec9
Merge branch 'master' into feat/permissionless-asset-registry
martinfridrich Feb 20, 2024
6515140
bump versions
martinfridrich Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.17.5"
version = "1.18.0"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
169 changes: 169 additions & 0 deletions integration-tests/src/asset_registry.rs
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);
Copy link
Contributor

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 assetor meta_data. A bunch of work to change, though, so understand if you're reluctant.


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());
});
}
Loading
Loading