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
+24 -18
View File
@@ -87,23 +87,23 @@ frame_support::construct_runtime! {
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = 1024;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 };
}
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 = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
@@ -128,7 +128,7 @@ impl pallet_balances::Config for TestRuntime {
type MaxLocks = ();
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Pallet<TestRuntime>;
type WeightInfo = ();
@@ -159,7 +159,7 @@ impl MessagesParameter for TestMessagesParameter {
}
impl Config for TestRuntime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type Parameter = TestMessagesParameter;
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
@@ -185,7 +185,7 @@ impl Config for TestRuntime {
type BridgedChainId = TestBridgedChainId;
}
impl SenderOrigin<AccountId> for Origin {
impl SenderOrigin<AccountId> for RuntimeOrigin {
fn linked_account(&self) -> Option<AccountId> {
match self.caller {
OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) =>
@@ -298,11 +298,11 @@ impl TargetHeaderChain<TestPayload, TestRelayer> for TestTargetHeaderChain {
#[derive(Debug, Default)]
pub struct TestLaneMessageVerifier;
impl LaneMessageVerifier<Origin, TestPayload, TestMessageFee> for TestLaneMessageVerifier {
impl LaneMessageVerifier<RuntimeOrigin, TestPayload, TestMessageFee> for TestLaneMessageVerifier {
type Error = &'static str;
fn verify_message(
_submitter: &Origin,
_submitter: &RuntimeOrigin,
delivery_and_dispatch_fee: &TestMessageFee,
_lane: &LaneId,
_lane_outbound_data: &OutboundLaneData,
@@ -328,7 +328,8 @@ impl TestMessageDeliveryAndDispatchPayment {
/// Returns true if given fee has been paid by given submitter.
pub fn is_fee_paid(submitter: AccountId, fee: TestMessageFee) -> bool {
let raw_origin: Result<frame_system::RawOrigin<_>, _> = Origin::signed(submitter).into();
let raw_origin: Result<frame_system::RawOrigin<_>, _> =
RuntimeOrigin::signed(submitter).into();
frame_support::storage::unhashed::get(b":message-fee:") == Some((raw_origin.unwrap(), fee))
}
@@ -340,13 +341,13 @@ impl TestMessageDeliveryAndDispatchPayment {
}
}
impl MessageDeliveryAndDispatchPayment<Origin, AccountId, TestMessageFee>
impl MessageDeliveryAndDispatchPayment<RuntimeOrigin, AccountId, TestMessageFee>
for TestMessageDeliveryAndDispatchPayment
{
type Error = &'static str;
fn pay_delivery_and_dispatch_fee(
submitter: &Origin,
submitter: &RuntimeOrigin,
fee: &TestMessageFee,
) -> Result<(), Self::Error> {
if frame_support::storage::unhashed::get(b":reject-message-fee:") == Some(true) {
@@ -451,7 +452,7 @@ impl OnDeliveryConfirmed for TestOnDeliveryConfirmed2 {
fn on_messages_delivered(lane: &LaneId, messages: &DeliveredMessages) -> Weight {
let key = (b"TestOnDeliveryConfirmed2", lane, messages).encode();
frame_support::storage::unhashed::put(&key, &true);
0
Weight::from_ref_time(0)
}
}
@@ -482,7 +483,7 @@ impl MessageDispatch<AccountId, TestMessageFee> for TestMessageDispatch {
fn dispatch_weight(message: &mut DispatchMessage<TestPayload, TestMessageFee>) -> Weight {
match message.data.payload.as_ref() {
Ok(payload) => payload.declared_weight,
Err(_) => 0,
Err(_) => Weight::from_ref_time(0),
}
}
@@ -503,8 +504,13 @@ pub fn message(nonce: MessageNonce, payload: TestPayload) -> Message<TestMessage
}
/// Constructs message payload using given arguments and zero unspent weight.
pub const fn message_payload(id: u64, declared_weight: Weight) -> TestPayload {
TestPayload { id, declared_weight, dispatch_result: dispatch_result(0), extra: Vec::new() }
pub const fn message_payload(id: u64, declared_weight: u64) -> TestPayload {
TestPayload {
id,
declared_weight: Weight::from_ref_time(declared_weight),
dispatch_result: dispatch_result(0),
extra: Vec::new(),
}
}
/// Return message data with valid fee for given payload.
@@ -513,10 +519,10 @@ pub fn message_data(payload: TestPayload) -> MessageData<TestMessageFee> {
}
/// Returns message dispatch result with given unspent weight.
pub const fn dispatch_result(unspent_weight: Weight) -> MessageDispatchResult {
pub const fn dispatch_result(unspent_weight: u64) -> MessageDispatchResult {
MessageDispatchResult {
dispatch_result: true,
unspent_weight,
unspent_weight: Weight::from_ref_time(unspent_weight),
dispatch_fee_paid_during_dispatch: true,
}
}