fix polkadot primitives (#908)

This commit is contained in:
Svyatoslav Nikolsky
2021-04-19 19:10:04 +03:00
committed by Bastian Köcher
parent b8e021c22c
commit f6fd87f39e
3 changed files with 32 additions and 12 deletions
+20 -10
View File
@@ -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<Block>;
pub type Balance = u128;
/// Unchecked Extrinsic type.
pub type UncheckedExtrinsic<Call> = generic::UncheckedExtrinsic<AccountId, Call, Signature, SignedExtensions<Call>>;
pub type UncheckedExtrinsic<Call> =
generic::UncheckedExtrinsic<MultiAddress<AccountId, ()>, Call, Signature, SignedExtensions<Call>>;
/// 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<Nonce>,
(),
Compact<Balance>,
);
/// 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<Call> SignedExtensions<Call> {
) -> 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,
+6 -1
View File
@@ -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,
)
}
}
+6 -1
View File
@@ -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,
)
}
}