Use Extensible Multiaddress in all Polkadot Runtimes (#2126)

* Use extensible multiaddress

* copy pasta
This commit is contained in:
Shawn Tabrizi
2021-01-27 04:00:33 -04:00
committed by GitHub
parent ca2fedc395
commit 884167a5e7
5 changed files with 25 additions and 17 deletions
+6 -4
View File
@@ -41,7 +41,7 @@ use sp_runtime::{
ApplyExtrinsicResult, KeyTypeId, Perbill, curve::PiecewiseLinear,
transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority},
traits::{
BlakeTwo256, Block as BlockT, OpaqueKeys, ConvertInto, IdentityLookup,
BlakeTwo256, Block as BlockT, OpaqueKeys, ConvertInto, AccountIdLookup,
Extrinsic as ExtrinsicT, SaturatedConversion, Verify,
},
};
@@ -129,7 +129,7 @@ impl frame_system::Config for Runtime {
type Hash = Hash;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Lookup = AccountIdLookup<AccountId, ()>;
type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event;
type BlockHashCount = BlockHashCount;
@@ -442,6 +442,7 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
account: AccountId,
nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
use sp_runtime::traits::StaticLookup;
// take the biggest period possible.
let period = BlockHashCount::get()
.checked_next_power_of_two()
@@ -470,7 +471,8 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
C::sign(payload, public)
})?;
let (call, extra, _) = raw_payload.deconstruct();
Some((call, (account, signature, extra)))
let address = <Runtime as frame_system::Config>::Lookup::unlookup(account);
Some((call, (address, signature, extra)))
}
}
@@ -724,7 +726,7 @@ construct_runtime! {
}
/// The address format for describing accounts.
pub type Address = AccountId;
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.