Skip to content

Commit

Permalink
feat: Upgrade to Polkadot v0.9.39 (#85)
Browse files Browse the repository at this point in the history
Co-authored-by: jasl <[email protected]>
  • Loading branch information
tolak and jasl authored Mar 29, 2023
1 parent 1590c91 commit d964bc6
Show file tree
Hide file tree
Showing 20 changed files with 1,344 additions and 864 deletions.
1,317 changes: 925 additions & 392 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions access-segregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa
scale-info = { version = "2.0", default-features = false, features = ["derive", "serde", "decode"] }

# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39", default-features = false }

[dev-dependencies]
# Substrate
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

[features]
default = ["std"]
Expand All @@ -30,3 +30,4 @@ std = [
"frame-system/std",
"sp-std/std",
]
try-runtime = ["frame-support/try-runtime"]
25 changes: 13 additions & 12 deletions basic-fee-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa
scale-info = { version = "2.0", default-features = false, features = ["derive", "serde", "decode"] }

# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39", default-features = false }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39", default-features = false }

# Local
sygma-traits = { path = "../traits", default-features = false }
sygma-access-segregator = { path = "../access-segregator", default-features = false }

[dev-dependencies]
# Substrate
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

[features]
default = ["std"]
Expand All @@ -42,4 +42,5 @@ std = [
"xcm-builder/std",
"sygma-traits/std",
"sygma-access-segregator/std",
]
]
try-runtime = ["frame-support/try-runtime"]
40 changes: 14 additions & 26 deletions basic-fee-handler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,56 +126,44 @@ pub mod pallet {
assert_ok!(BasicFeeHandler::set_fee(
Origin::root(),
dest_domain_id,
Box::new(asset_id_a.clone()),
Box::new(asset_id_a),
amount_a
));
// set fee 200 with assetId asset_id_a for another domain
assert_ok!(BasicFeeHandler::set_fee(
Origin::root(),
another_dest_domain_id,
Box::new(asset_id_a.clone()),
Box::new(asset_id_a),
amount_a * 2
));
assert_eq!(AssetFees::<Test>::get((dest_domain_id, asset_id_a)).unwrap(), amount_a);
assert_eq!(
AssetFees::<Test>::get(&(dest_domain_id, asset_id_a.clone())).unwrap(),
amount_a
);
assert_eq!(
AssetFees::<Test>::get(&(another_dest_domain_id, asset_id_a.clone())).unwrap(),
AssetFees::<Test>::get((another_dest_domain_id, asset_id_a)).unwrap(),
amount_a * 2
);

// set fee 101 with assetId asset_id_b
assert_ok!(BasicFeeHandler::set_fee(
Origin::root(),
dest_domain_id,
Box::new(asset_id_b.clone()),
Box::new(asset_id_b),
amount_b
));
assert_eq!(
AssetFees::<Test>::get(&(dest_domain_id, asset_id_b.clone())).unwrap(),
amount_b
);
assert_eq!(AssetFees::<Test>::get((dest_domain_id, asset_id_b)).unwrap(), amount_b);

// fee of asset_id_a should not be equal to amount_b
assert_ne!(
AssetFees::<Test>::get(&(dest_domain_id, asset_id_a.clone())).unwrap(),
amount_b
);
assert_ne!(AssetFees::<Test>::get((dest_domain_id, asset_id_a)).unwrap(), amount_b);

// fee of asset_id_b should not be equal to amount_a
assert_ne!(
AssetFees::<Test>::get(&(dest_domain_id, asset_id_b.clone())).unwrap(),
amount_a
);
assert_ne!(AssetFees::<Test>::get((dest_domain_id, asset_id_b)).unwrap(), amount_a);

// permission test: unauthorized account should not be able to set fee
let unauthorized_account = Origin::from(Some(ALICE));
assert_noop!(
BasicFeeHandler::set_fee(
unauthorized_account,
dest_domain_id,
Box::new(asset_id_a.clone()),
Box::new(asset_id_a),
amount_a
),
basic_fee_handler::Error::<Test>::AccessDenied
Expand All @@ -184,7 +172,7 @@ pub mod pallet {
assert_events(vec![
Event::BasicFeeHandler(BasicFeeHandlerEvent::FeeSet {
domain: dest_domain_id,
asset: asset_id_a.clone(),
asset: asset_id_a,
amount: amount_a,
}),
Event::BasicFeeHandler(BasicFeeHandlerEvent::FeeSet {
Expand All @@ -210,14 +198,14 @@ pub mod pallet {
assert_ok!(BasicFeeHandler::set_fee(
Origin::root(),
dest_domain_id,
Box::new(asset_id.clone()),
Box::new(asset_id),
100
),);
assert_noop!(
BasicFeeHandler::set_fee(
Some(ALICE).into(),
dest_domain_id,
Box::new(asset_id.clone()),
Box::new(asset_id),
200
),
basic_fee_handler::Error::<Test>::AccessDenied
Expand All @@ -243,10 +231,10 @@ pub mod pallet {
assert_ok!(BasicFeeHandler::set_fee(
Some(ALICE).into(),
dest_domain_id,
Box::new(asset_id.clone()),
Box::new(asset_id),
200
),);
assert_eq!(AssetFees::<Test>::get(&(dest_domain_id, asset_id)).unwrap(), 200);
assert_eq!(AssetFees::<Test>::get((dest_domain_id, asset_id)).unwrap(), 200);
})
}
}
Expand Down
52 changes: 26 additions & 26 deletions bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ hex = {version = "0.4.3", default-features = false, features = ["alloc"] }
fixed = {version = "1.23.0", default-features = false }

# Substrate
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false, optional = true }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false, optional = true }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39", default-features = false }

sygma-traits = { path = "../traits", default-features = false }
sygma-access-segregator = { path = "../access-segregator", default-features = false }
Expand All @@ -40,21 +40,21 @@ assert_matches = "1.4.0"
hex-literal = "0.3"

# Substrate
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37"}
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39"}
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.39" }

sygma-basic-feehandler = { path = "../basic-fee-handler" }
sygma-traits = { path = "../traits" }
Expand Down
Loading

0 comments on commit d964bc6

Please sign in to comment.