Bump Substrate/Polkadot/Cumulus refs (aka Weights v1.5) (#1597)

* update Substrate + Polkadot + Cumulus refs

* Origin -> RuntimeOrigin

* weights v1.5

* update refs once again + `cargo test -p pallet-bridge-grandpa` works

* started work on `cargo test -p pallet-bridge-messages`

* cargo test -p pallet-bridge-relayers

* cargo test -p pallet-bridge-parachains

* cargo test -p millau-runtime

* cargo test -p bridge-runtime-common

* cargo test -p rialto-runtime

* cargo test -p rialto-parachain-runtime

* cargo test -p millau-bridge-node

* cargo test -p rialto-bridge-node

* cargo test -p rialto-parachain-collator

* cargo test -p messages-relay

* cargo test -p parachains-relay

* cargo test -p substrate-relay

* cargo test --all

* cargo check -p millau-runtime --locked --features runtime-benchmarks

* fix remaining test

* fmt

* try to allow clippy failure temporarily

* Revert "try to allow clippy failure temporarily"

This reverts commit d1b6593580f07e0dbeecb7ab0aa92cee98888ed3.

* use min_by

* Revert "use min_by"

This reverts commit 33042f49ed37e8dd0505370289e17f03bf1a56ee.

* Revert "Revert "use min_by""

This reverts commit 1d2204f0b14dc81e5650bb574dedb5fa78c7097d.

* trigger CI

* Revert "trigger CI"

This reverts commit 259d91b5606743bba9d043c69f07eac6c8700ef5.

* new day, new clippy warning

* more clippy issues
This commit is contained in:
Svyatoslav Nikolsky
2022-10-20 10:27:23 +03:00
committed by Bastian Köcher
parent 9e1847d12a
commit a3dc2d2748
66 changed files with 991 additions and 893 deletions
+8 -6
View File
@@ -46,7 +46,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Type of relayer reward.
type Reward: AtLeast32BitUnsigned + Copy + Parameter + MaxEncodedLen;
/// Pay rewards adapter.
@@ -113,7 +113,7 @@ pub mod pallet {
#[cfg(test)]
mod tests {
use super::*;
use mock::{Event as TestEvent, *};
use mock::{RuntimeEvent as TestEvent, *};
use crate::Event::RewardPaid;
use frame_support::{assert_noop, assert_ok, traits::fungible::Inspect};
@@ -129,7 +129,7 @@ mod tests {
fn root_cant_claim_anything() {
run_test(|| {
assert_noop!(
Pallet::<TestRuntime>::claim_rewards(Origin::root()),
Pallet::<TestRuntime>::claim_rewards(RuntimeOrigin::root()),
DispatchError::BadOrigin,
);
});
@@ -139,7 +139,7 @@ mod tests {
fn relayer_cant_claim_if_no_reward_exists() {
run_test(|| {
assert_noop!(
Pallet::<TestRuntime>::claim_rewards(Origin::signed(REGULAR_RELAYER)),
Pallet::<TestRuntime>::claim_rewards(RuntimeOrigin::signed(REGULAR_RELAYER)),
Error::<TestRuntime>::NoRewardForRelayer,
);
});
@@ -150,7 +150,7 @@ mod tests {
run_test(|| {
RelayerRewards::<TestRuntime>::insert(FAILING_RELAYER, 100);
assert_noop!(
Pallet::<TestRuntime>::claim_rewards(Origin::signed(FAILING_RELAYER)),
Pallet::<TestRuntime>::claim_rewards(RuntimeOrigin::signed(FAILING_RELAYER)),
Error::<TestRuntime>::FailedToPayReward,
);
});
@@ -162,7 +162,9 @@ mod tests {
get_ready_for_events();
RelayerRewards::<TestRuntime>::insert(REGULAR_RELAYER, 100);
assert_ok!(Pallet::<TestRuntime>::claim_rewards(Origin::signed(REGULAR_RELAYER)));
assert_ok!(Pallet::<TestRuntime>::claim_rewards(RuntimeOrigin::signed(
REGULAR_RELAYER
)));
assert_eq!(RelayerRewards::<TestRuntime>::get(REGULAR_RELAYER), None);
//Check if the `RewardPaid` event was emitted.
+6 -6
View File
@@ -51,16 +51,16 @@ parameter_types! {
}
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = SubstrateHeader;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = frame_support::traits::ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -81,7 +81,7 @@ impl pallet_balances::Config for TestRuntime {
type MaxLocks = ();
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = frame_support::traits::ConstU64<1>;
type AccountStore = frame_system::Pallet<TestRuntime>;
type WeightInfo = ();
@@ -95,7 +95,7 @@ parameter_types! {
// we're not testing messages pallet here, so values in this config might be crazy
impl pallet_bridge_messages::Config for TestRuntime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type Parameter = ();
type MaxMessagesToPruneAtOnce = frame_support::traits::ConstU64<0>;
@@ -122,7 +122,7 @@ impl pallet_bridge_messages::Config for TestRuntime {
}
impl pallet_bridge_relayers::Config for TestRuntime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Reward = Balance;
type PaymentProcedure = TestPaymentProcedure;
type WeightInfo = ();
@@ -31,7 +31,7 @@ pub struct MessageDeliveryAndDispatchPaymentAdapter<T, MessagesInstance, GetConf
);
impl<T, MessagesInstance, GetConfirmationFee>
MessageDeliveryAndDispatchPayment<T::Origin, T::AccountId, T::Reward>
MessageDeliveryAndDispatchPayment<T::RuntimeOrigin, T::AccountId, T::Reward>
for MessageDeliveryAndDispatchPaymentAdapter<T, MessagesInstance, GetConfirmationFee>
where
T: Config + pallet_bridge_messages::Config<MessagesInstance, OutboundMessageFee = T::Reward>,
@@ -41,7 +41,7 @@ where
type Error = &'static str;
fn pay_delivery_and_dispatch_fee(
_submitter: &T::Origin,
_submitter: &T::RuntimeOrigin,
_fee: &T::Reward,
) -> Result<(), Self::Error> {
// nothing shall happen here, because XCM deals with fee payment (planned to be burnt?
+6 -6
View File
@@ -59,17 +59,17 @@ pub trait WeightInfo {
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
fn claim_rewards() -> Weight {
(55_856_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(55_856_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn claim_rewards() -> Weight {
(55_856_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(55_856_000 as u64)
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(2 as u64))
}
}