From c7f8258e0cab013a1fc8f881d376e7085e312d08 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sat, 30 Jul 2022 18:21:20 -0400 Subject: [PATCH] Cherry-pick 28308dfe85387fe54c14076089a40c5af1f1b8f7 --- substrate/node/src/command_helper.rs | 34 +++++++++++++--------------- substrate/runtime/src/lib.rs | 27 ++++++++-------------- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/substrate/node/src/command_helper.rs b/substrate/node/src/command_helper.rs index 01c9bb38..500a7080 100644 --- a/substrate/node/src/command_helper.rs +++ b/substrate/node/src/command_helper.rs @@ -66,24 +66,22 @@ pub fn create_benchmark_extrinsic( runtime::UncheckedExtrinsic::new_signed( call.clone(), - sp_runtime::AccountId32::from(sender.public()).into(), - runtime::Signature::Sr25519( - runtime::SignedPayload::from_raw( - call, - extra.clone(), - ( - (), - runtime::VERSION.spec_version, - runtime::VERSION.transaction_version, - client.block_hash(0).ok().flatten().unwrap(), - client.chain_info().best_hash, - (), - (), - (), - ), - ) - .using_encoded(|e| sender.sign(e)), - ), + sender.public(), + runtime::SignedPayload::from_raw( + call, + extra.clone(), + ( + (), + runtime::VERSION.spec_version, + runtime::VERSION.transaction_version, + client.block_hash(0).ok().flatten().unwrap(), + client.chain_info().best_hash, + (), + (), + (), + ), + ) + .using_encoded(|e| sender.sign(e)), extra, ) } diff --git a/substrate/runtime/src/lib.rs b/substrate/runtime/src/lib.rs index bc6de59f..8b57f2d1 100644 --- a/substrate/runtime/src/lib.rs +++ b/substrate/runtime/src/lib.rs @@ -7,9 +7,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, + traits::{IdentityLookup, BlakeTwo256, Block as BlockT}, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, MultiSignature, Perbill, + ApplyExtrinsicResult, Perbill, }; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -34,12 +34,11 @@ use pallet_transaction_payment::CurrencyAdapter; /// An index to a block. pub type BlockNumber = u32; -/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. -pub type Signature = MultiSignature; +/// Signature type +pub type Signature = sp_core::sr25519::Signature; -/// Some way of identifying an account on the chain. We intentionally make it equivalent -/// to the public key of our transaction signing scheme. -pub type AccountId = <::Signer as IdentifyAccount>::AccountId; +/// Account ID type, equivalent to a public key +pub type AccountId = sp_core::sr25519::Public; /// Balance of an account. pub type Balance = u64; @@ -103,7 +102,7 @@ parameter_types! { pub const BlockHashCount: BlockNumber = 2400; pub const Version: RuntimeVersion = VERSION; - pub const SS58Prefix: u8 = 42; // TODO: Remove + pub const SS58Prefix: u8 = 42; // TODO: Remove for Bech32m // 1 MB block size limit pub BlockLength: frame_system::limits::BlockLength = @@ -132,7 +131,7 @@ impl frame_system::Config for Runtime { type BlockLength = BlockLength; type AccountId = AccountId; type RuntimeCall = RuntimeCall; - type Lookup = AccountIdLookup; + type Lookup = IdentityLookup; type Index = Index; type BlockNumber = BlockNumber; type Hash = Hash; @@ -151,7 +150,7 @@ impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; // TODO: Remove + type SS58Prefix = SS58Prefix; // TODO: Remove for Bech32m type MaxConsumers = frame_support::traits::ConstU32<16>; } @@ -193,12 +192,6 @@ impl pallet_contracts::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; - /// The safest default is to allow no calls at all. - /// - /// Runtimes should whitelist dispatchables that are allowed to be called from contracts - /// and make sure they are stable. Dispatchables exposed to contracts are not allowed to - /// change because that would break already deployed contracts. The `Call` structure itself - /// is not allowed to change the indices of existing pallets, too. type CallFilter = frame_support::traits::Nothing; type DepositPerItem = DepositPerItem; type DepositPerByte = DepositPerByte; @@ -215,7 +208,7 @@ impl pallet_contracts::Config for Runtime { type MaxStorageKeyLen = ConstU32<128>; } -pub type Address = sp_runtime::MultiAddress; +pub type Address = AccountId; pub type Header = generic::Header; pub type Block = generic::Block; pub type SignedExtra = (