More Extensible Multiaddress Format (#7380)

* More extensible multiaddress format

* update name

* Don't depend on indices to define multiaddress type

* Use MultiAddress in Node Template too!

* reduce traits, fix build

* support multiple `StaticLookup`

* bump tx version

* feedback
This commit is contained in:
Shawn Tabrizi
2020-11-19 12:40:12 +01:00
committed by GitHub
parent 0e9e2ed5a8
commit 4637100ac7
10 changed files with 125 additions and 177 deletions
+1 -1
View File
@@ -621,7 +621,7 @@ fn deploying_wasm_contract_should_work() {
signed: Some((charlie(), signed_extra(2, 0))),
function: Call::Contracts(
pallet_contracts::Call::call::<Runtime>(
pallet_indices::address::Address::Id(addr.clone()),
sp_runtime::MultiAddress::Id(addr.clone()),
10,
500_000_000,
vec![0x00, 0x01, 0x02, 0x03]
+2 -2
View File
@@ -111,7 +111,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 260,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
transaction_version: 2,
};
/// Native version.
@@ -931,7 +931,7 @@ construct_runtime!(
);
/// The address format for describing accounts.
pub type Address = <Indices as StaticLookup>::Source;
pub type Address = sp_runtime::MultiAddress<AccountId, AccountIndex>;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
+3 -3
View File
@@ -317,7 +317,7 @@ impl<'a> Iterator for BlockContentIterator<'a> {
BlockType::RandomTransfersKeepAlive => {
Call::Balances(
BalancesCall::transfer_keep_alive(
pallet_indices::address::Address::Id(receiver),
sp_runtime::MultiAddress::Id(receiver),
node_runtime::ExistentialDeposit::get() + 1,
)
)
@@ -325,7 +325,7 @@ impl<'a> Iterator for BlockContentIterator<'a> {
BlockType::RandomTransfersReaping => {
Call::Balances(
BalancesCall::transfer(
pallet_indices::address::Address::Id(receiver),
sp_runtime::MultiAddress::Id(receiver),
// Transfer so that ending balance would be 1 less than existential deposit
// so that we kill the sender account.
100*DOLLARS - (node_runtime::ExistentialDeposit::get() - 1),
@@ -591,7 +591,7 @@ impl BenchKeyring {
}
}).into();
UncheckedExtrinsic {
signature: Some((pallet_indices::address::Address::Id(signed), signature, extra)),
signature: Some((sp_runtime::MultiAddress::Id(signed), signature, extra)),
function: payload.0,
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ pub fn sign(xt: CheckedExtrinsic, spec_version: u32, tx_version: u32, genesis_ha
}
}).into();
UncheckedExtrinsic {
signature: Some((pallet_indices::address::Address::Id(signed), signature, extra)),
signature: Some((sp_runtime::MultiAddress::Id(signed), signature, extra)),
function: payload.0,
}
}