mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
Bump Substrate/Polkadot/Cumulus refs (#1295)
Substrate: 31d90c202d6df9ce3837ee55587b604619a912ba
Polkadot: 60df3c55c711c2872872d6220f98b2611340e051
Cumulus: a9630551c2
This commit is contained in:
committed by
Bastian Köcher
parent
fe34a526bb
commit
ea2d6f898d
@@ -41,6 +41,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
impl_version: 0,
|
||||
apis: sp_version::create_apis_vec![[]],
|
||||
transaction_version: 5,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
// NOTE: This needs to be kept up to date with the Kusama runtime found in the Polkadot repo.
|
||||
|
||||
@@ -30,13 +30,13 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::limits;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::Hasher as HasherT;
|
||||
use sp_core::{storage::StateVersion, Hasher as HasherT};
|
||||
use sp_runtime::{
|
||||
traits::{Convert, IdentifyAccount, Verify},
|
||||
MultiSignature, MultiSigner, Perbill,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
use sp_trie::{trie_types::Layout, TrieConfiguration};
|
||||
use sp_trie::{LayoutV0, LayoutV1, TrieConfiguration};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -206,12 +206,18 @@ impl sp_core::Hasher for BlakeTwoAndKeccak256 {
|
||||
impl sp_runtime::traits::Hash for BlakeTwoAndKeccak256 {
|
||||
type Output = MillauHash;
|
||||
|
||||
fn trie_root(input: Vec<(Vec<u8>, Vec<u8>)>) -> Self::Output {
|
||||
Layout::<BlakeTwoAndKeccak256>::trie_root(input)
|
||||
fn trie_root(input: Vec<(Vec<u8>, Vec<u8>)>, state_version: StateVersion) -> Self::Output {
|
||||
match state_version {
|
||||
StateVersion::V0 => LayoutV0::<BlakeTwoAndKeccak256>::trie_root(input),
|
||||
StateVersion::V1 => LayoutV1::<BlakeTwoAndKeccak256>::trie_root(input),
|
||||
}
|
||||
}
|
||||
|
||||
fn ordered_trie_root(input: Vec<Vec<u8>>) -> Self::Output {
|
||||
Layout::<BlakeTwoAndKeccak256>::ordered_trie_root(input)
|
||||
fn ordered_trie_root(input: Vec<Vec<u8>>, state_version: StateVersion) -> Self::Output {
|
||||
match state_version {
|
||||
StateVersion::V0 => LayoutV0::<BlakeTwoAndKeccak256>::ordered_trie_root(input),
|
||||
StateVersion::V1 => LayoutV1::<BlakeTwoAndKeccak256>::ordered_trie_root(input),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,9 +346,9 @@ mod tests {
|
||||
#[test]
|
||||
fn maximal_account_size_does_not_overflow_constant() {
|
||||
assert!(
|
||||
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::default().encode().len(),
|
||||
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::from([0u8; 32]).encode().len(),
|
||||
"Actual maximal size of encoded AccountId ({}) overflows expected ({})",
|
||||
AccountId::default().encode().len(),
|
||||
AccountId::from([0u8; 32]).encode().len(),
|
||||
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
impl_version: 0,
|
||||
apis: sp_version::create_apis_vec![[]],
|
||||
transaction_version: 7,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
// NOTE: This needs to be kept up to date with the Polkadot runtime found in the Polkadot repo.
|
||||
|
||||
@@ -312,9 +312,9 @@ mod tests {
|
||||
#[test]
|
||||
fn maximal_account_size_does_not_overflow_constant() {
|
||||
assert!(
|
||||
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::default().encode().len(),
|
||||
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize >= AccountId::from([0u8; 32]).encode().len(),
|
||||
"Actual maximal size of encoded AccountId ({}) overflows expected ({})",
|
||||
AccountId::default().encode().len(),
|
||||
AccountId::from([0u8; 32]).encode().len(),
|
||||
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
impl_version: 0,
|
||||
apis: sp_version::create_apis_vec![[]],
|
||||
transaction_version: 0,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
// NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo.
|
||||
|
||||
@@ -59,6 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
impl_version: 0,
|
||||
apis: sp_version::create_apis_vec![[]],
|
||||
transaction_version: 5,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
/// Westend Runtime `Call` enum.
|
||||
|
||||
@@ -136,7 +136,8 @@ fn justification_with_invalid_commit_rejected() {
|
||||
#[test]
|
||||
fn justification_with_invalid_authority_signature_rejected() {
|
||||
let mut justification = make_default_justification::<TestHeader>(&test_header(1));
|
||||
justification.commit.precommits[0].signature = Default::default();
|
||||
justification.commit.precommits[0].signature =
|
||||
sp_core::crypto::UncheckedFrom::unchecked_from([1u8; 64]);
|
||||
|
||||
assert_eq!(
|
||||
verify_justification::<TestHeader>(
|
||||
|
||||
@@ -33,7 +33,8 @@ use scale_info::{StaticTypeInfo, TypeInfo};
|
||||
use sp_core::Hasher as HasherT;
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, IdentifyAccount, Verify},
|
||||
traits::{BlakeTwo256, DispatchInfoOf, IdentifyAccount, Verify},
|
||||
transaction_validity::TransactionValidityError,
|
||||
MultiAddress, MultiSignature, OpaqueExtrinsic,
|
||||
};
|
||||
use sp_std::prelude::Vec;
|
||||
@@ -332,6 +333,16 @@ where
|
||||
) -> Result<Self::AdditionalSigned, frame_support::unsigned::TransactionValidityError> {
|
||||
Ok(self.additional_signed)
|
||||
}
|
||||
|
||||
fn pre_dispatch(
|
||||
self,
|
||||
who: &Self::AccountId,
|
||||
call: &Self::Call,
|
||||
info: &DispatchInfoOf<Self::Call>,
|
||||
len: usize,
|
||||
) -> Result<Self::Pre, TransactionValidityError> {
|
||||
Ok(self.validate(who, call, info, len).map(|_| ())?)
|
||||
}
|
||||
}
|
||||
|
||||
/// Polkadot-like chain.
|
||||
@@ -399,7 +410,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn maximal_encoded_account_id_size_is_correct() {
|
||||
let actual_size = AccountId::default().encode().len();
|
||||
let actual_size = AccountId::from([0u8; 32]).encode().len();
|
||||
assert!(
|
||||
actual_size <= MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize,
|
||||
"Actual size of encoded account id for Polkadot-like chains ({}) is larger than expected {}",
|
||||
|
||||
@@ -83,13 +83,7 @@ pub trait Chain: Send + Sync + 'static {
|
||||
+ MaybeSerializeDeserialize;
|
||||
|
||||
/// The user account identifier type for the runtime.
|
||||
type AccountId: Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Debug
|
||||
+ MaybeDisplay
|
||||
+ Ord
|
||||
+ Default;
|
||||
type AccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord;
|
||||
/// Balance of an account in native tokens.
|
||||
///
|
||||
/// The chain may support multiple tokens, but this particular type is for token that is used
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use hash_db::{HashDB, Hasher, EMPTY_PREFIX};
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::vec::Vec;
|
||||
use sp_trie::{read_trie_value, Layout, MemoryDB, StorageProof};
|
||||
use sp_trie::{read_trie_value, LayoutV1, MemoryDB, StorageProof};
|
||||
|
||||
/// This struct is used to read storage values from a subset of a Merklized database. The "proof"
|
||||
/// is a subset of the nodes in the Merkle structure of the database, so that it provides
|
||||
@@ -52,7 +52,8 @@ where
|
||||
/// Reads a value from the available subset of storage. If the value cannot be read due to an
|
||||
/// incomplete or otherwise invalid proof, this returns an error.
|
||||
pub fn read_value(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error> {
|
||||
read_trie_value::<Layout<H>, _>(&self.db, &self.root, key)
|
||||
// LayoutV1 or LayoutV0 is identical for proof that only read values.
|
||||
read_trie_value::<LayoutV1<H>, _>(&self.db, &self.root, key)
|
||||
.map_err(|_| Error::StorageValueUnavailable)
|
||||
}
|
||||
}
|
||||
@@ -70,15 +71,20 @@ pub enum Error {
|
||||
pub fn craft_valid_storage_proof() -> (sp_core::H256, StorageProof) {
|
||||
use sp_state_machine::{backend::Backend, prove_read, InMemoryBackend};
|
||||
|
||||
let state_version = sp_runtime::StateVersion::default();
|
||||
|
||||
// construct storage proof
|
||||
let backend = <InMemoryBackend<sp_core::Blake2Hasher>>::from(vec![
|
||||
(None, vec![(b"key1".to_vec(), Some(b"value1".to_vec()))]),
|
||||
(None, vec![(b"key2".to_vec(), Some(b"value2".to_vec()))]),
|
||||
(None, vec![(b"key3".to_vec(), Some(b"value3".to_vec()))]),
|
||||
// Value is too big to fit in a branch node
|
||||
(None, vec![(b"key11".to_vec(), Some(vec![0u8; 32]))]),
|
||||
]);
|
||||
let root = backend.storage_root(std::iter::empty()).0;
|
||||
let backend = <InMemoryBackend<sp_core::Blake2Hasher>>::from((
|
||||
vec![
|
||||
(None, vec![(b"key1".to_vec(), Some(b"value1".to_vec()))]),
|
||||
(None, vec![(b"key2".to_vec(), Some(b"value2".to_vec()))]),
|
||||
(None, vec![(b"key3".to_vec(), Some(b"value3".to_vec()))]),
|
||||
// Value is too big to fit in a branch node
|
||||
(None, vec![(b"key11".to_vec(), Some(vec![0u8; 32]))]),
|
||||
],
|
||||
state_version,
|
||||
));
|
||||
let root = backend.storage_root(std::iter::empty(), state_version).0;
|
||||
let proof = StorageProof::new(
|
||||
prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key22"[..]])
|
||||
.unwrap()
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
use codec::Encode;
|
||||
use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signature};
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use sp_application_crypto::Public;
|
||||
use sp_finality_grandpa::{AuthorityId, AuthorityList, AuthorityWeight};
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::prelude::*;
|
||||
@@ -70,7 +69,7 @@ impl Account {
|
||||
|
||||
impl From<Account> for AuthorityId {
|
||||
fn from(p: Account) -> Self {
|
||||
AuthorityId::from_slice(&p.public().to_bytes())
|
||||
sp_application_crypto::UncheckedFrom::unchecked_from(p.public().to_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user