From 03168a7368344bd80527f97b941329a10c11e7b2 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Mon, 19 Apr 2021 19:10:04 +0300 Subject: [PATCH] fix polkadot primitives (#908) --- primitives/polkadot-core/src/lib.rs | 30 +++++++++++++++++++---------- relays/client-rococo/src/lib.rs | 7 ++++++- relays/client-westend/src/lib.rs | 7 ++++++- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/primitives/polkadot-core/src/lib.rs b/primitives/polkadot-core/src/lib.rs index 8cf62c0030974..c9858c0820d71 100644 --- a/primitives/polkadot-core/src/lib.rs +++ b/primitives/polkadot-core/src/lib.rs @@ -28,11 +28,12 @@ use frame_support::{ Blake2_128Concat, RuntimeDebug, StorageHasher, Twox128, }; use frame_system::limits; +use parity_scale_codec::Compact; use sp_core::Hasher as HasherT; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentifyAccount, Verify}, - MultiSignature, OpaqueExtrinsic, Perbill, + MultiAddress, MultiSignature, OpaqueExtrinsic, Perbill, }; use sp_std::prelude::Vec; @@ -192,10 +193,19 @@ pub type SignedBlock = generic::SignedBlock; pub type Balance = u128; /// Unchecked Extrinsic type. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic>; +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic, Call, Signature, SignedExtensions>; /// A type of the data encoded as part of the transaction. -pub type SignedExtra = ((), (), (), sp_runtime::generic::Era, Nonce, (), Balance); +pub type SignedExtra = ( + (), + (), + (), + sp_runtime::generic::Era, + Compact, + (), + Compact, +); /// Parameters which are part of the payload used to produce transaction signature, /// but don't end up in the transaction itself (i.e. inherent part of the runtime). @@ -232,13 +242,13 @@ impl SignedExtensions { ) -> Self { Self { encode_payload: ( - (), // spec version - (), // tx version - (), // genesis - era, // era - nonce, // nonce (compact encoding) - (), // Check weight - tip, // transaction payment / tip (compact encoding) + (), // spec version + (), // tx version + (), // genesis + era, // era + nonce.into(), // nonce (compact encoding) + (), // Check weight + tip.into(), // transaction payment / tip (compact encoding) ), additional_signed: ( version.spec_version, diff --git a/relays/client-rococo/src/lib.rs b/relays/client-rococo/src/lib.rs index 1e2dd6569b48f..09d205f06e910 100644 --- a/relays/client-rococo/src/lib.rs +++ b/relays/client-rococo/src/lib.rs @@ -84,7 +84,12 @@ impl TransactionSignScheme for Rococo { let signer: sp_runtime::MultiSigner = signer.public().into(); let (call, extra, _) = raw_payload.deconstruct(); - bp_rococo::UncheckedExtrinsic::new_signed(call, signer.into_account(), signature.into(), extra) + bp_rococo::UncheckedExtrinsic::new_signed( + call, + sp_runtime::MultiAddress::Id(signer.into_account()), + signature.into(), + extra, + ) } } diff --git a/relays/client-westend/src/lib.rs b/relays/client-westend/src/lib.rs index 5ca4552bc2c2f..417938ccf5a98 100644 --- a/relays/client-westend/src/lib.rs +++ b/relays/client-westend/src/lib.rs @@ -84,7 +84,12 @@ impl TransactionSignScheme for Westend { let signer: sp_runtime::MultiSigner = signer.public().into(); let (call, extra, _) = raw_payload.deconstruct(); - bp_westend::UncheckedExtrinsic::new_signed(call, signer.into_account(), signature.into(), extra) + bp_westend::UncheckedExtrinsic::new_signed( + call, + sp_runtime::MultiAddress::Id(signer.into_account()), + signature.into(), + extra, + ) } }