mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 01:18:00 +00:00
Generated
+158
-127
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@
|
||||
use std::any::{TypeId, Any};
|
||||
use crate::primitives::{ValidationParams, ValidationResult, UpwardMessage};
|
||||
use codec::{Decode, Encode};
|
||||
use sp_core::storage::{ChildStorageKey, ChildInfo};
|
||||
use sp_core::storage::ChildInfo;
|
||||
use sp_core::traits::CallInWasm;
|
||||
use sp_wasm_interface::HostFunctions as _;
|
||||
|
||||
@@ -205,15 +205,15 @@ impl sp_externalities::Externalities for ValidationExternalities {
|
||||
panic!("storage_hash: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn child_storage_hash(&self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
|
||||
fn child_storage_hash(&self, _: &ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
|
||||
panic!("child_storage_hash: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn child_storage(&self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
|
||||
fn child_storage(&self, _: &ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
|
||||
panic!("child_storage: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn kill_child_storage(&mut self, _: ChildStorageKey, _: ChildInfo) {
|
||||
fn kill_child_storage(&mut self, _: &ChildInfo) {
|
||||
panic!("kill_child_storage: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ impl sp_externalities::Externalities for ValidationExternalities {
|
||||
panic!("clear_prefix: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn clear_child_prefix(&mut self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) {
|
||||
fn clear_child_prefix(&mut self, _: &ChildInfo, _: &[u8]) {
|
||||
panic!("clear_child_prefix: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ impl sp_externalities::Externalities for ValidationExternalities {
|
||||
panic!("place_storage: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn place_child_storage(&mut self, _: ChildStorageKey, _: ChildInfo, _: Vec<u8>, _: Option<Vec<u8>>) {
|
||||
fn place_child_storage(&mut self, _: &ChildInfo, _: Vec<u8>, _: Option<Vec<u8>>) {
|
||||
panic!("place_child_storage: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ impl sp_externalities::Externalities for ValidationExternalities {
|
||||
panic!("storage_root: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn child_storage_root(&mut self, _: ChildStorageKey) -> Vec<u8> {
|
||||
fn child_storage_root(&mut self, _: &ChildInfo) -> Vec<u8> {
|
||||
panic!("child_storage_root: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ impl sp_externalities::Externalities for ValidationExternalities {
|
||||
panic!("storage_changes_root: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
fn next_child_storage_key(&self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
|
||||
fn next_child_storage_key(&self, _: &ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
|
||||
panic!("next_child_storage_key: unsupported feature for parachain validation")
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ use sp_runtime::{ModuleId,
|
||||
use crate::slots;
|
||||
use codec::{Encode, Decode};
|
||||
use sp_std::vec::Vec;
|
||||
use sp_core::storage::well_known_keys::CHILD_STORAGE_KEY_PREFIX;
|
||||
use primitives::parachain::{Id as ParaId, HeadData};
|
||||
|
||||
const MODULE_ID: ModuleId = ModuleId(*b"py/cfund");
|
||||
@@ -529,46 +528,30 @@ impl<T: Trait> Module<T> {
|
||||
MODULE_ID.into_sub_account(index)
|
||||
}
|
||||
|
||||
pub fn id_from_index(index: FundIndex) -> Vec<u8> {
|
||||
pub fn id_from_index(index: FundIndex) -> child::ChildInfo {
|
||||
let mut buf = Vec::new();
|
||||
buf.extend_from_slice(b"crowdfund");
|
||||
buf.extend_from_slice(&index.to_le_bytes()[..]);
|
||||
|
||||
CHILD_STORAGE_KEY_PREFIX.into_iter()
|
||||
.chain(b"default:")
|
||||
.chain(T::Hashing::hash(&buf[..]).as_ref().into_iter())
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Child trie unique id for a crowdfund is built from the hash part of the fund id.
|
||||
pub fn trie_unique_id(fund_id: &[u8]) -> child::ChildInfo {
|
||||
let start = CHILD_STORAGE_KEY_PREFIX.len() + b"default:".len();
|
||||
child::ChildInfo::new_default(&fund_id[start..])
|
||||
child::ChildInfo::new_default(T::Hashing::hash(&buf[..]).as_ref())
|
||||
}
|
||||
|
||||
pub fn contribution_put(index: FundIndex, who: &T::AccountId, balance: &BalanceOf<T>) {
|
||||
let id = Self::id_from_index(index);
|
||||
who.using_encoded(|b| child::put(id.as_ref(), Self::trie_unique_id(id.as_ref()), b, balance));
|
||||
who.using_encoded(|b| child::put(&Self::id_from_index(index), b, balance));
|
||||
}
|
||||
|
||||
pub fn contribution_get(index: FundIndex, who: &T::AccountId) -> BalanceOf<T> {
|
||||
let id = Self::id_from_index(index);
|
||||
who.using_encoded(|b| child::get_or_default::<BalanceOf<T>>(
|
||||
id.as_ref(),
|
||||
Self::trie_unique_id(id.as_ref()),
|
||||
&Self::id_from_index(index),
|
||||
b,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn contribution_kill(index: FundIndex, who: &T::AccountId) {
|
||||
let id = Self::id_from_index(index);
|
||||
who.using_encoded(|b| child::kill(id.as_ref(), Self::trie_unique_id(id.as_ref()), b));
|
||||
who.using_encoded(|b| child::kill(&Self::id_from_index(index), b));
|
||||
}
|
||||
|
||||
pub fn crowdfund_kill(index: FundIndex) {
|
||||
let id = Self::id_from_index(index);
|
||||
child::kill_storage(id.as_ref(), Self::trie_unique_id(id.as_ref()));
|
||||
child::kill_storage(&Self::id_from_index(index));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("kusama"),
|
||||
impl_name: create_runtime_str!("parity-kusama"),
|
||||
authoring_version: 2,
|
||||
spec_version: 1058,
|
||||
spec_version: 1059,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 1,
|
||||
|
||||
@@ -86,7 +86,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("polkadot"),
|
||||
impl_name: create_runtime_str!("parity-polkadot"),
|
||||
authoring_version: 2,
|
||||
spec_version: 1007,
|
||||
spec_version: 1008,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 1,
|
||||
|
||||
@@ -118,7 +118,7 @@ impl substrate_test_client::GenesisInit for GenesisParameters {
|
||||
|
||||
let mut storage = self.genesis_config().genesis_map();
|
||||
|
||||
let child_roots = storage.children.iter().map(|(sk, child_content)| {
|
||||
let child_roots = storage.children_default.iter().map(|(sk, child_content)| {
|
||||
let state_root = <<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
child_content.data.clone().into_iter().collect()
|
||||
);
|
||||
@@ -198,7 +198,7 @@ pub trait TestClientBuilderExt<B>: Sized {
|
||||
let key = key.into();
|
||||
assert!(!storage_key.is_empty());
|
||||
assert!(!key.is_empty());
|
||||
self.genesis_init_mut().extra_storage.children
|
||||
self.genesis_init_mut().extra_storage.children_default
|
||||
.entry(storage_key)
|
||||
.or_insert_with(|| StorageChild {
|
||||
data: Default::default(),
|
||||
|
||||
@@ -80,7 +80,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("polkadot-test-runtime"),
|
||||
impl_name: create_runtime_str!("parity-polkadot-test-runtime"),
|
||||
authoring_version: 2,
|
||||
spec_version: 1050,
|
||||
spec_version: 1051,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 1,
|
||||
|
||||
@@ -83,7 +83,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("westend"),
|
||||
impl_name: create_runtime_str!("parity-westend"),
|
||||
authoring_version: 2,
|
||||
spec_version: 3,
|
||||
spec_version: 4,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 1,
|
||||
|
||||
Reference in New Issue
Block a user