Skip to content

Commit

Permalink
chore(upgrade): polkadot v1.10 to v1.2.0
Browse files Browse the repository at this point in the history
issue-1718
  • Loading branch information
Enddy Dumbrique committed May 23, 2024
1 parent fc1224d commit 9663fa3
Show file tree
Hide file tree
Showing 12 changed files with 553 additions and 608 deletions.
813 changes: 367 additions & 446 deletions Cargo.lock

Large diffs are not rendered by default.

190 changes: 95 additions & 95 deletions Cargo.toml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion e2e/package-lock.json

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

6 changes: 3 additions & 3 deletions e2e/proxy-pallet/proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Proxy', function () {
ExtrinsicHelper.api.tx.proxy.proxy(
stashKeys.address,
'Any',
ExtrinsicHelper.api.tx.balances.transfer(proxyKeys.address, 1n * DOLLARS)
ExtrinsicHelper.api.tx.balances.transferAllowDeath(proxyKeys.address, 1n * DOLLARS)
),
proxyKeys,
ExtrinsicHelper.api.events.balances.Transfer
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('Proxy', function () {
ExtrinsicHelper.api.tx.proxy.proxy(
stashKeys.address,
'Any',
ExtrinsicHelper.api.tx.balances.transfer(proxyKeys.address, 1n * DOLLARS)
ExtrinsicHelper.api.tx.balances.transferAllowDeath(proxyKeys.address, 1n * DOLLARS)
),
proxyKeys,
ExtrinsicHelper.api.events.system.ExtrinsicFailed
Expand All @@ -104,7 +104,7 @@ describe('Proxy', function () {
stashKeys.address,
'Any',
ExtrinsicHelper.api.tx.utility.batch([
ExtrinsicHelper.api.tx.balances.transfer(proxyKeys.address, 1n * DOLLARS),
ExtrinsicHelper.api.tx.balances.transferAllowDeath(proxyKeys.address, 1n * DOLLARS),
])
),
proxyKeys,
Expand Down
1 change: 1 addition & 0 deletions node/service/src/block_sealing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub fn frequency_dev_sealing(
import_queue,
block_announce_validator_builder: None,
warp_sync_params: None,
block_relay: None,
})?;

// Start off-chain workers if enabled
Expand Down
5 changes: 3 additions & 2 deletions pallets/frequency-tx-payment/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,15 @@ pub struct TestCapacityCalls;
impl GetStableWeight<RuntimeCall, Weight> for TestCapacityCalls {
fn get_stable_weight(call: &RuntimeCall) -> Option<Weight> {
match call {
RuntimeCall::Balances(BalancesCall::transfer { .. }) => Some(Weight::from_parts(11, 0)),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { .. }) =>
Some(Weight::from_parts(11, 0)),
RuntimeCall::Msa(pallet_msa::Call::create { .. }) => Some(Weight::from_parts(12, 0)),
_ => None,
}
}

fn get_inner_calls(_call: &RuntimeCall) -> Option<Vec<&RuntimeCall>> {
return Some(vec![&RuntimeCall::Msa(pallet_msa::Call::create {})])
return Some(vec![&RuntimeCall::Msa(pallet_msa::Call::create {})]);
}
}

Expand Down
76 changes: 41 additions & 35 deletions pallets/frequency-tx-payment/src/tests/pallet_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn transaction_payment_validate_is_succesful() {
.execute_with(|| {
let account_id = 1u64;
let balances_call: &<Test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });
let dispatch_info =
DispatchInfo { weight: Weight::from_parts(5, 0), ..Default::default() };
let len = 10;
Expand All @@ -48,7 +48,7 @@ fn transaction_payment_validate_errors_when_balance_is_cannot_pay_for_fee() {
.execute_with(|| {
let account_id = 1u64;
let balances_call: &<Test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });
let dispatch_info =
DispatchInfo { weight: Weight::from_parts(5, 0), ..Default::default() };
let len = 10;
Expand Down Expand Up @@ -76,7 +76,7 @@ fn transaction_payment_with_token_and_no_overcharge_post_dispatch_refund_is_succ
.execute_with(|| {
let account_id = 1u64;
let balances_call: &<Test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });
let dispatch_info =
DispatchInfo { weight: Weight::from_parts(5, 0), ..Default::default() };
let len = 10;
Expand Down Expand Up @@ -119,7 +119,7 @@ fn transaction_payment_with_token_and_post_dispatch_refund_is_succesful() {
.execute_with(|| {
let account_id = 1u64;
let balances_call: &<Test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });
let dispatch_info =
DispatchInfo { weight: Weight::from_parts(5, 0), ..Default::default() };
let len = 10;
Expand Down Expand Up @@ -168,7 +168,7 @@ fn transaction_payment_with_capacity_and_no_overcharge_post_dispatch_refund_is_s
let account_id = 1u64;
let balances_call: &<Test as Config>::RuntimeCall =
&RuntimeCall::FrequencyTxPayment(Call::pay_with_capacity {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: 2,
value: 100,
})),
Expand Down Expand Up @@ -279,7 +279,7 @@ fn charge_frq_transaction_payment_withdraw_fee_for_capacity_batch_tx_returns_tup
let who = 1u64;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::FrequencyTxPayment(Call::pay_with_capacity_batch_all {
calls: vec![RuntimeCall::Balances(BalancesCall::transfer {
calls: vec![RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: 2,
value: 100,
})],
Expand Down Expand Up @@ -314,7 +314,7 @@ fn charge_frq_transaction_payment_withdraw_fee_for_capacity_tx_returns_tupple_wi
let who = 1u64;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::FrequencyTxPayment(Call::pay_with_capacity {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: 2,
value: 100,
})),
Expand Down Expand Up @@ -351,7 +351,7 @@ fn charge_frq_transaction_payment_withdraw_fee_errors_for_capacity_tx_when_user_
let who = 1u64;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::FrequencyTxPayment(Call::pay_with_capacity {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: 2,
value: 100,
})),
Expand Down Expand Up @@ -380,7 +380,7 @@ fn charge_frq_transaction_payment_withdraw_fee_errors_for_non_capacity_tx_when_u
let charge_tx_payment = ChargeFrqTransactionPayment::<Test>::from(0u64);
let who = 1u64;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let info = DispatchInfo { weight: Weight::from_parts(5, 0), ..Default::default() };
let len = 10;
Expand All @@ -402,7 +402,7 @@ fn charge_frq_transaction_payment_withdraw_fee_for_non_capacity_tx_returns_tuppl
let charge_tx_payment = ChargeFrqTransactionPayment::<Test>::from(0u64);
let who = 1u64;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let info = DispatchInfo { weight: Weight::from_parts(5, 0), ..Default::default() };
let len = 10;
Expand Down Expand Up @@ -434,7 +434,7 @@ fn charge_frq_transaction_payment_withdraw_fee_for_free_non_capacity_tx_returns_
let charge_tx_payment = ChargeFrqTransactionPayment::<Test>::from(0u64);
let who = 1u64;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let info = DispatchInfo {
weight: Weight::from_parts(5, 0),
Expand Down Expand Up @@ -463,7 +463,10 @@ fn charge_frq_transaction_payment_tip_is_zero_for_capacity_calls() {
let charge_tx_payment = ChargeFrqTransactionPayment::<Test>::from(fake_tip);
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::FrequencyTxPayment(Call::pay_with_capacity {
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 })),
call: Box::new(RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: 2,
value: 100,
})),
});

let result = charge_tx_payment.tip(call);
Expand All @@ -476,7 +479,7 @@ fn charge_frq_transaction_payment_tip_is_some_amount_for_non_capacity_calls() {
let tip = 200;
let charge_tx_payment = ChargeFrqTransactionPayment::<Test>::from(tip);
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let result = charge_tx_payment.tip(call);

Expand Down Expand Up @@ -522,7 +525,7 @@ fn withdraw_fee_allows_only_configured_capacity_calls() {
.execute_with(|| {
let account_id = 1u64;
let allowed_call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let forbidden_call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer_all { dest: 2, keep_alive: false });
Expand Down Expand Up @@ -550,7 +553,7 @@ fn withdraw_fee_returns_custom_error_when_the_account_key_does_not_have_the_requ
let _ = tests::mock::create_msa_account(account_id);

let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let expected_err = TransactionValidityError::Invalid(InvalidTransaction::Payment);
assert_withdraw_fee_result(account_id, call, Some(expected_err));
Expand All @@ -576,7 +579,7 @@ fn withdraw_fee_returns_custom_error_when_the_account_key_is_not_associated_with
));

let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let expected_err = TransactionValidityError::Invalid(InvalidTransaction::Custom(
ChargeFrqTransactionPaymentError::InvalidMsaKey as u8,
Expand Down Expand Up @@ -617,7 +620,7 @@ fn withdraw_fee_replenishes_capacity_account_on_new_epoch_before_deducting_fee()
Capacity::set_capacity_for(provider_msa_id, capacity_details);

let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

assert_withdraw_fee_result(provider_msa_id, call, None);

Expand Down Expand Up @@ -663,7 +666,7 @@ fn withdraw_fee_does_not_replenish_if_not_new_epoch() {
Capacity::set_capacity_for(provider_msa_id, capacity_details);

let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

assert_withdraw_fee_result(provider_msa_id, call, None);

Expand Down Expand Up @@ -691,7 +694,7 @@ fn compute_capacity_fee_successful() {
.build()
.execute_with(|| {
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

// fee = base_weight + extrinsic weight + len = CAPACITY_EXTRINSIC_BASE_WEIGHT + 11 + 10 = CAPACITY_EXTRINSIC_BASE_WEIGHT + 21
let fee = FrequencyTxPayment::compute_capacity_fee(
Expand All @@ -715,8 +718,8 @@ fn pay_with_capacity_batch_all_happy_path() {
let origin = 1u64;

let calls = vec![
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 10 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 10 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 10 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 10 }),
];

let token_balance_before_call = Balances::free_balance(origin);
Expand Down Expand Up @@ -745,17 +748,17 @@ fn pay_with_capacity_batch_all_errors_when_transaction_amount_exceeds_maximum()
let token_balance_before_call = Balances::free_balance(origin);

let too_many_calls = vec![
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 }),
];
assert_noop!(
FrequencyTxPayment::pay_with_capacity_batch_all(
Expand All @@ -782,10 +785,13 @@ fn pay_with_capacity_batch_all_transactions_will_all_fail_if_one_fails() {
.execute_with(|| {
let origin = 1u64;
let successful_balance_transfer_call =
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });

let balance_transfer_call_insufficient_funds =
RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100000000 });
RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: 2,
value: 100000000,
});

let token_balance_before_call = Balances::free_balance(origin);

Expand Down Expand Up @@ -816,7 +822,7 @@ fn pay_with_capacity_batch_all_transactions_will_all_fail_if_one_fails() {
fn compute_capacity_fee_returns_zero_when_call_is_not_capacity_eligible() {
let balance_factor = 10;
let call: &<Test as Config>::RuntimeCall =
&RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 100 });
&RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest: 2, value: 100 });
let origin = 111111;
let extra = ();
let xt = TestXt::new(call.clone(), Some((origin, extra)));
Expand Down
7 changes: 2 additions & 5 deletions pallets/msa/src/tests/governance_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use frame_support::{
assert_noop, assert_ok,
traits::{ChangeMembers, Hash},
};
use frame_support::{assert_noop, assert_ok, traits::ChangeMembers};

use sp_weights::Weight;

Expand Down Expand Up @@ -38,7 +35,7 @@ fn propose_to_be_provider_happy_path() {
);

// Find the Proposed event and get it's hash and index so it can be voted on
let proposed_events: Vec<(u32, Hash)> = System::events()
let proposed_events: Vec<(u32, <Test as frame_system::Config>::Hash)> = System::events()
.iter()
.filter_map(|event| match event.event {
RuntimeEvent::Council(pallet_collective::Event::Proposed {
Expand Down
9 changes: 2 additions & 7 deletions pallets/schemas/src/tests/deprecated_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ use common_primitives::{
node::AccountId,
schema::{ModelType, PayloadLocation, SchemaId, SchemaSetting},
};
use frame_support::{
assert_noop, assert_ok,
traits::{ChangeMembers, Hash},
weights::Weight,
BoundedVec,
};
use frame_support::{assert_noop, assert_ok, traits::ChangeMembers, weights::Weight, BoundedVec};
use parity_scale_codec::Encode;
use serial_test::serial;

Expand Down Expand Up @@ -95,7 +90,7 @@ fn propose_to_create_schema_happy_path() {
);

// Find the Proposed event and get it's hash and index so it can be voted on
let proposed_events: Vec<(u32, Hash)> = System::events()
let proposed_events: Vec<(u32, <Test as frame_system::Config>::Hash)> = System::events()
.iter()
.filter_map(|event| match event.event {
RuntimeEvent::Council(pallet_collective::Event::Proposed {
Expand Down
10 changes: 3 additions & 7 deletions pallets/schemas/src/tests/other_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ use common_primitives::{
},
};
use frame_support::{
assert_noop, assert_ok,
dispatch::RawOrigin,
traits::{ChangeMembers, Hash},
weights::Weight,
BoundedVec,
assert_noop, assert_ok, dispatch::RawOrigin, traits::ChangeMembers, weights::Weight, BoundedVec,
};
use parity_scale_codec::Encode;
use serial_test::serial;
Expand Down Expand Up @@ -781,7 +777,7 @@ fn propose_to_create_schema_v2_happy_path() {
);

// Find the Proposed event and get it's hash and index so it can be voted on
let proposed_events: Vec<(u32, Hash)> = System::events()
let proposed_events: Vec<(u32, <Test as frame_system::Config>::Hash)> = System::events()
.iter()
.filter_map(|event| match event.event {
RuntimeEvent::Council(pallet_collective::Event::Proposed {
Expand Down Expand Up @@ -930,7 +926,7 @@ fn propose_to_create_schema_name_happy_path() {
);

// Find the Proposed event and get it's hash and index so it can be voted on
let proposed_events: Vec<(u32, Hash)> = System::events()
let proposed_events: Vec<(u32, <Test as frame_system::Config>::Hash)> = System::events()
.iter()
.filter_map(|event| match event.event {
RuntimeEvent::Council(pallet_collective::Event::Proposed {
Expand Down
15 changes: 15 additions & 0 deletions runtime/common/src/weights/pallet_preimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ use core::marker::PhantomData;
/// Weights for `pallet_preimage` using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for SubstrateWeight<T> {
fn ensure_updated(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + n * (91 ±0)`
// Estimated: `3593 + n * (2566 ±0)`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 3593)
// Standard Error: 13_720
.saturating_add(Weight::from_parts(17_309_199, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into()))
}

/// Storage: `Preimage::StatusFor` (r:1 w:1)
/// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`)
/// Storage: `Preimage::PreimageFor` (r:0 w:1)
Expand Down
Loading

0 comments on commit 9663fa3

Please sign in to comment.