Skip to content

Commit

Permalink
feat: Upgrade to polkadot v1.0.0 (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolak authored Oct 10, 2023
1 parent 814307b commit f334bfe
Show file tree
Hide file tree
Showing 24 changed files with 924 additions and 1,511 deletions.
1,829 changes: 656 additions & 1,173 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions access-segregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ edition = "2021"
license = "LGPL-3.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde", "decode"] }

# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false, optional = true }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", default-features = false }

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

[features]
default = ["std"]
Expand Down
22 changes: 8 additions & 14 deletions access-segregator/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ use frame_support::{
pallet_prelude::ConstU32,
parameter_types,
sp_runtime::{
testing::{Header, H256},
testing::H256,
traits::{BlakeTwo256, IdentityLookup},
AccountId32, Perbill,
AccountId32, BuildStorage, Perbill,
},
};
use frame_system::{self as system, EnsureRoot};

use crate as sygma_access_segregator;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

pub(crate) type Balance = u128;
Expand All @@ -26,12 +25,8 @@ pub const BOB: AccountId32 = AccountId32::new([1u8; 32]);
pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]);

frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
pub enum Test {
System: frame_system,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
AccessSegregator: sygma_access_segregator::{Pallet, Call, Storage, Event<T>} = 2,
}
Expand All @@ -47,17 +42,16 @@ parameter_types! {

impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type Block = Block;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId32;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
Expand Down Expand Up @@ -88,7 +82,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = ();
type MaxFreezes = ();
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type MaxHolds = ();
}

Expand All @@ -111,7 +105,7 @@ impl sygma_access_segregator::Config for Test {
}

pub fn new_test_ext() -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1));
ext
Expand Down
26 changes: 13 additions & 13 deletions basic-fee-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ edition = "2021"
license = "LGPL-3.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde", "decode"] }

# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false, optional = true }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", default-features = false }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0", 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.43" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }

[features]
default = ["std"]
Expand Down
22 changes: 8 additions & 14 deletions basic-fee-handler/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,25 @@ use frame_support::{
pallet_prelude::ConstU32,
parameter_types,
sp_runtime::{
testing::{Header, H256},
testing::H256,
traits::{BlakeTwo256, IdentityLookup},
AccountId32, Perbill,
AccountId32, BuildStorage, Perbill,
},
traits::{AsEnsureOriginWithArg, ConstU128},
};
use frame_system::{self as system, EnsureRoot, EnsureSigned};

use crate as basic_fee_handler;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

pub(crate) type Balance = u128;

pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]);

frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
pub enum Test {
System: frame_system,
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
AccessSegregator: sygma_access_segregator::{Pallet, Call, Storage, Event<T>} = 3,
Expand All @@ -48,17 +43,16 @@ parameter_types! {

impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type Block = Block;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId32;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
Expand Down Expand Up @@ -89,7 +83,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = ();
type MaxFreezes = ();
type HoldIdentifier = ();
type RuntimeHoldReason = ();
type MaxHolds = ();
}

Expand Down Expand Up @@ -149,7 +143,7 @@ impl basic_fee_handler::Config for Test {
}

pub fn new_test_ext() -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1));
ext
Expand Down
53 changes: 26 additions & 27 deletions bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "LGPL-3.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive", "max-encoded-len"] }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde", "decode"] }
log = { version = "0.4.14", default-features = false }
ethabi = { version = "18.0.0", default-features = false }
Expand All @@ -18,21 +18,21 @@ bounded-collections = { version = "0.1.4", default-features = false }
hex-literal = { version = "0.3", default-features = false }

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

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

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

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

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

sygma-basic-feehandler = { path = "../basic-fee-handler" }
sygma-traits = { path = "../traits" }
Expand Down
6 changes: 3 additions & 3 deletions bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ pub mod pallet {
&Junction::AccountId32 { network: None, id: T::FeeReserveAccount::get().into() }
.into(),
// Put empty message hash here because we are not sending XCM message
&XcmContext::with_message_hash([0; 32]),
&XcmContext::with_message_id([0; 32]),
)
.map_err(|_| Error::<T>::TransactFailed)?;

Expand All @@ -487,7 +487,7 @@ pub mod pallet {
}
.into(),
// Put empty message hash here because we are not sending XCM message
&XcmContext::with_message_hash([0; 32]),
&XcmContext::with_message_id([0; 32]),
)
.map_err(|_| Error::<T>::TransactFailed)?;
}
Expand Down Expand Up @@ -902,7 +902,7 @@ pub mod pallet {
&decimal_converted_asset,
&location,
// Put empty message hash here because we are not sending XCM message
&XcmContext::with_message_hash([0; 32]),
&XcmContext::with_message_id([0; 32]),
)
.map_err(|_| Error::<T>::TransactFailed)?;

Expand Down
Loading

0 comments on commit f334bfe

Please sign in to comment.