mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 17:55:42 +00:00
Update to latest Substrate & Polkadot (#341)
This commit is contained in:
Generated
+382
-247
File diff suppressed because it is too large
Load Diff
@@ -106,7 +106,7 @@ pub fn import_queue<Client, Block: BlockT, I>(
|
|||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
block_import: I,
|
block_import: I,
|
||||||
inherent_data_providers: InherentDataProviders,
|
inherent_data_providers: InherentDataProviders,
|
||||||
spawner: &impl sp_core::traits::SpawnNamed,
|
spawner: &impl sp_core::traits::SpawnEssentialNamed,
|
||||||
registry: Option<&substrate_prometheus_endpoint::Registry>,
|
registry: Option<&substrate_prometheus_endpoint::Registry>,
|
||||||
) -> ClientResult<BasicQueue<Block, I::Transaction>>
|
) -> ClientResult<BasicQueue<Block, I::Transaction>>
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ async fn make_gossip_message_and_header(
|
|||||||
&alice_public.into(),
|
&alice_public.into(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
.ok()
|
||||||
|
.flatten()
|
||||||
.expect("Signing statement");
|
.expect("Signing statement");
|
||||||
|
|
||||||
(signed, header)
|
(signed, header)
|
||||||
@@ -203,7 +205,9 @@ fn check_signer_is_legit_validator() {
|
|||||||
let (mut validator, api) = make_validator_and_api();
|
let (mut validator, api) = make_validator_and_api();
|
||||||
|
|
||||||
let (signed_statement, header) = block_on(make_gossip_message_and_header_using_genesis(api, 1));
|
let (signed_statement, header) = block_on(make_gossip_message_and_header_using_genesis(api, 1));
|
||||||
let data = BlockAnnounceData::try_from(signed_statement).unwrap().encode();
|
let data = BlockAnnounceData::try_from(signed_statement)
|
||||||
|
.unwrap()
|
||||||
|
.encode();
|
||||||
|
|
||||||
let res = block_on(validator.validate(&header, &data));
|
let res = block_on(validator.validate(&header, &data));
|
||||||
assert_eq!(Validation::Failure { disconnect: true }, res.unwrap());
|
assert_eq!(Validation::Failure { disconnect: true }, res.unwrap());
|
||||||
@@ -215,7 +219,9 @@ fn check_statement_is_correctly_signed() {
|
|||||||
|
|
||||||
let (signed_statement, header) = block_on(make_gossip_message_and_header_using_genesis(api, 0));
|
let (signed_statement, header) = block_on(make_gossip_message_and_header_using_genesis(api, 0));
|
||||||
|
|
||||||
let mut data = BlockAnnounceData::try_from(signed_statement).unwrap().encode();
|
let mut data = BlockAnnounceData::try_from(signed_statement)
|
||||||
|
.unwrap()
|
||||||
|
.encode();
|
||||||
|
|
||||||
// The signature comes at the end of the type, so change a bit to make the signature invalid.
|
// The signature comes at the end of the type, so change a bit to make the signature invalid.
|
||||||
let last = data.len() - 1;
|
let last = data.len() - 1;
|
||||||
@@ -256,11 +262,15 @@ fn check_statement_seconded() {
|
|||||||
0,
|
0,
|
||||||
&alice_public.into(),
|
&alice_public.into(),
|
||||||
))
|
))
|
||||||
|
.ok()
|
||||||
|
.flatten()
|
||||||
.expect("Signs statement");
|
.expect("Signs statement");
|
||||||
|
|
||||||
let data = BlockAnnounceData {
|
let data = BlockAnnounceData {
|
||||||
receipt: Default::default(),
|
receipt: Default::default(),
|
||||||
statement: signed_statement.convert_payload(),
|
statement: signed_statement.convert_payload(),
|
||||||
}.encode();
|
}
|
||||||
|
.encode();
|
||||||
|
|
||||||
let res = block_on(validator.validate(&header, &data));
|
let res = block_on(validator.validate(&header, &data));
|
||||||
assert_eq!(Validation::Failure { disconnect: true }, res.unwrap());
|
assert_eq!(Validation::Failure { disconnect: true }, res.unwrap());
|
||||||
@@ -272,7 +282,9 @@ fn check_header_match_candidate_receipt_header() {
|
|||||||
|
|
||||||
let (signed_statement, mut header) =
|
let (signed_statement, mut header) =
|
||||||
block_on(make_gossip_message_and_header_using_genesis(api, 0));
|
block_on(make_gossip_message_and_header_using_genesis(api, 0));
|
||||||
let data = BlockAnnounceData::try_from(signed_statement).unwrap().encode();
|
let data = BlockAnnounceData::try_from(signed_statement)
|
||||||
|
.unwrap()
|
||||||
|
.encode();
|
||||||
header.number = 300;
|
header.number = 300;
|
||||||
|
|
||||||
let res = block_on(validator.validate(&header, &data));
|
let res = block_on(validator.validate(&header, &data));
|
||||||
@@ -297,7 +309,9 @@ fn relay_parent_not_imported_when_block_announce_is_processed() {
|
|||||||
|
|
||||||
let (signed_statement, header) = make_gossip_message_and_header(api, block.hash(), 0).await;
|
let (signed_statement, header) = make_gossip_message_and_header(api, block.hash(), 0).await;
|
||||||
|
|
||||||
let data = BlockAnnounceData::try_from(signed_statement).unwrap().encode();
|
let data = BlockAnnounceData::try_from(signed_statement)
|
||||||
|
.unwrap()
|
||||||
|
.encode();
|
||||||
|
|
||||||
let mut validation = validator.validate(&header, &data);
|
let mut validation = validator.validate(&header, &data);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use frame_executive::ExecuteBlock;
|
|||||||
use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT, NumberFor};
|
use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT, NumberFor};
|
||||||
|
|
||||||
use sp_std::{boxed::Box, vec::Vec};
|
use sp_std::{boxed::Box, vec::Vec};
|
||||||
|
use sp_io::KillChildStorageResult;
|
||||||
|
|
||||||
use hash_db::{HashDB, EMPTY_PREFIX};
|
use hash_db::{HashDB, EMPTY_PREFIX};
|
||||||
|
|
||||||
@@ -277,7 +278,7 @@ impl<'a, B: BlockT> Externalities for WitnessExt<'a, B> {
|
|||||||
self.inner.place_child_storage(child_info, key, value)
|
self.inner.place_child_storage(child_info, key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kill_child_storage(&mut self, child_info: &ChildInfo, limit: Option<u32>) -> bool {
|
fn kill_child_storage(&mut self, child_info: &ChildInfo, limit: Option<u32>) -> (bool, u32) {
|
||||||
self.inner.kill_child_storage(child_info, limit)
|
self.inner.kill_child_storage(child_info, limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,9 +461,18 @@ fn host_default_child_storage_clear(storage_key: &[u8], key: &[u8]) {
|
|||||||
with_externalities(|ext| ext.place_child_storage(&child_info, key.to_vec(), None))
|
with_externalities(|ext| ext.place_child_storage(&child_info, key.to_vec(), None))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn host_default_child_storage_storage_kill(storage_key: &[u8], limit: Option<u32>) -> bool {
|
fn host_default_child_storage_storage_kill(
|
||||||
|
storage_key: &[u8],
|
||||||
|
limit: Option<u32>,
|
||||||
|
) -> KillChildStorageResult {
|
||||||
let child_info = ChildInfo::new_default(storage_key);
|
let child_info = ChildInfo::new_default(storage_key);
|
||||||
with_externalities(|ext| ext.kill_child_storage(&child_info, limit))
|
with_externalities(|ext| {
|
||||||
|
let (all_removed, num_removed) = ext.kill_child_storage(&child_info, limit);
|
||||||
|
match all_removed {
|
||||||
|
true => KillChildStorageResult::AllRemoved(num_removed),
|
||||||
|
false => KillChildStorageResult::SomeRemaining(num_removed),
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn host_default_child_storage_exists(storage_key: &[u8], key: &[u8]) -> bool {
|
fn host_default_child_storage_exists(storage_key: &[u8], key: &[u8]) -> bool {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ pub fn new_partial(
|
|||||||
client.clone(),
|
client.clone(),
|
||||||
client.clone(),
|
client.clone(),
|
||||||
inherent_data_providers.clone(),
|
inherent_data_providers.clone(),
|
||||||
&task_manager.spawn_handle(),
|
&task_manager.spawn_essential_handle(),
|
||||||
registry.clone(),
|
registry.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ pub fn new_partial(
|
|||||||
client.clone(),
|
client.clone(),
|
||||||
client.clone(),
|
client.clone(),
|
||||||
inherent_data_providers.clone(),
|
inherent_data_providers.clone(),
|
||||||
&task_manager.spawn_handle(),
|
&task_manager.spawn_essential_handle(),
|
||||||
registry.clone(),
|
registry.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user