mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Update Polkadot/Substrate (#68)
* Update Polkadot/Substrate * Update branch
This commit is contained in:
Generated
+687
-488
File diff suppressed because it is too large
Load Diff
+12
-48
@@ -30,11 +30,7 @@ use polkadot_collator::{
|
|||||||
PolkadotClient,
|
PolkadotClient,
|
||||||
};
|
};
|
||||||
use polkadot_primitives::{
|
use polkadot_primitives::{
|
||||||
parachain::{
|
parachain::{self, BlockData, Status as ParachainStatus}, Block as PBlock, Hash as PHash,
|
||||||
self, BlockData, Id as ParaId, Message, OutgoingMessages,
|
|
||||||
Status as ParachainStatus,
|
|
||||||
},
|
|
||||||
Block as PBlock, Hash as PHash,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
@@ -43,9 +39,7 @@ use log::{error, trace};
|
|||||||
|
|
||||||
use futures::{task::Spawn, Future, future};
|
use futures::{task::Spawn, Future, future};
|
||||||
|
|
||||||
use std::{
|
use std::{fmt::Debug, marker::PhantomData, sync::Arc, time::Duration, pin::Pin};
|
||||||
fmt::Debug, marker::PhantomData, sync::Arc, time::Duration, pin::Pin, collections::HashMap,
|
|
||||||
};
|
|
||||||
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
@@ -108,15 +102,14 @@ where
|
|||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
type ProduceCandidate = Pin<Box<
|
type ProduceCandidate = Pin<Box<
|
||||||
dyn Future<Output=Result<(BlockData, parachain::HeadData, OutgoingMessages), InvalidHead>>
|
dyn Future<Output=Result<(BlockData, parachain::HeadData), InvalidHead>>
|
||||||
+ Send,
|
+ Send,
|
||||||
>>;
|
>>;
|
||||||
|
|
||||||
fn produce_candidate<I: IntoIterator<Item=(ParaId, Message)>>(
|
fn produce_candidate(
|
||||||
&mut self,
|
&mut self,
|
||||||
_relay_chain_parent: PHash,
|
_relay_chain_parent: PHash,
|
||||||
status: ParachainStatus,
|
status: ParachainStatus,
|
||||||
_: I,
|
|
||||||
) -> Self::ProduceCandidate {
|
) -> Self::ProduceCandidate {
|
||||||
let factory = self.proposer_factory.clone();
|
let factory = self.proposer_factory.clone();
|
||||||
let inherent_providers = self.inherent_data_providers.clone();
|
let inherent_providers = self.inherent_data_providers.clone();
|
||||||
@@ -196,29 +189,16 @@ where
|
|||||||
|
|
||||||
// Create the parachain block data for the validators.
|
// Create the parachain block data for the validators.
|
||||||
let b = ParachainBlockData::<Block>::new(
|
let b = ParachainBlockData::<Block>::new(
|
||||||
header,
|
header.clone(),
|
||||||
extrinsics,
|
extrinsics,
|
||||||
proof.iter_nodes().collect(),
|
proof.iter_nodes().collect(),
|
||||||
parent_state_root,
|
parent_state_root,
|
||||||
);
|
);
|
||||||
|
|
||||||
let block_import_params = BlockImportParams {
|
let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, header);
|
||||||
origin: BlockOrigin::Own,
|
block_import_params.body = Some(b.extrinsics().to_vec());
|
||||||
header: b.header().clone(),
|
block_import_params.fork_choice = Some(ForkChoiceStrategy::LongestChain);
|
||||||
justification: None,
|
block_import_params.storage_changes = Some(storage_changes);
|
||||||
post_digests: vec![],
|
|
||||||
body: Some(b.extrinsics().to_vec()),
|
|
||||||
finalized: false,
|
|
||||||
intermediates: HashMap::new(),
|
|
||||||
auxiliary: vec![], // block-weight is written in block import.
|
|
||||||
// TODO: block-import handles fork choice and this shouldn't even have the
|
|
||||||
// option to specify one.
|
|
||||||
// https://github.com/paritytech/substrate/issues/3623
|
|
||||||
fork_choice: Some(ForkChoiceStrategy::LongestChain),
|
|
||||||
allow_missing_state: false,
|
|
||||||
import_existing: false,
|
|
||||||
storage_changes: Some(storage_changes),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Err(err) = block_import
|
if let Err(err) = block_import
|
||||||
.lock()
|
.lock()
|
||||||
@@ -237,14 +217,10 @@ where
|
|||||||
let head_data = HeadData::<Block> {
|
let head_data = HeadData::<Block> {
|
||||||
header: b.into_header(),
|
header: b.into_header(),
|
||||||
};
|
};
|
||||||
let messages = OutgoingMessages {
|
|
||||||
outgoing_messages: Vec::new(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let candidate = (
|
let candidate = (
|
||||||
block_data,
|
block_data,
|
||||||
parachain::HeadData(head_data.encode()),
|
parachain::HeadData(head_data.encode()),
|
||||||
messages,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
trace!(target: "cumulus-collator", "Produced candidate: {:?}", candidate);
|
trace!(target: "cumulus-collator", "Produced candidate: {:?}", candidate);
|
||||||
@@ -349,8 +325,8 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use polkadot_collator::{collate, CollatorId, PeerId, RelayChainContext, SignedStatement};
|
use polkadot_collator::{collate, CollatorId, PeerId, SignedStatement};
|
||||||
use polkadot_primitives::parachain::{ConsolidatedIngress, FeeSchedule, HeadData};
|
use polkadot_primitives::parachain::{FeeSchedule, HeadData, Id as ParaId};
|
||||||
|
|
||||||
use sp_blockchain::Result as ClientResult;
|
use sp_blockchain::Result as ClientResult;
|
||||||
use sp_inherents::InherentData;
|
use sp_inherents::InherentData;
|
||||||
@@ -437,17 +413,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DummyRelayChainContext;
|
|
||||||
|
|
||||||
impl RelayChainContext for DummyRelayChainContext {
|
|
||||||
type Error = Error;
|
|
||||||
type FutureEgress = future::Ready<Result<ConsolidatedIngress, Error>>;
|
|
||||||
|
|
||||||
fn unrouted_egress(&self, _id: ParaId) -> Self::FutureEgress {
|
|
||||||
future::ready(Ok(ConsolidatedIngress(Vec::new())))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct DummyPolkadotClient;
|
struct DummyPolkadotClient;
|
||||||
|
|
||||||
@@ -534,12 +499,11 @@ mod tests {
|
|||||||
per_byte: 1,
|
per_byte: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DummyRelayChainContext,
|
|
||||||
context,
|
context,
|
||||||
Arc::new(Sr25519Keyring::Alice.pair().into()),
|
Arc::new(Sr25519Keyring::Alice.pair().into()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let collation = futures::executor::block_on(collation).unwrap().0;
|
let collation = futures::executor::block_on(collation).unwrap();
|
||||||
|
|
||||||
let block_data = collation.pov.block_data;
|
let block_data = collation.pov.block_data;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use sc_client::Client;
|
use sc_client::Client;
|
||||||
use sc_client_api::{Backend, CallExecutor, TransactionFor};
|
use sc_client_api::{Backend, CallExecutor, TransactionFor};
|
||||||
@@ -90,20 +89,12 @@ where
|
|||||||
body = Some(inner_body);
|
body = Some(inner_body);
|
||||||
}
|
}
|
||||||
|
|
||||||
let block_import_params = BlockImportParams {
|
let post_hash = Some(header.hash());
|
||||||
origin,
|
let mut block_import_params = BlockImportParams::new(origin, header);
|
||||||
header,
|
block_import_params.body = body;
|
||||||
post_digests: Vec::new(),
|
block_import_params.justification = justification;
|
||||||
body,
|
block_import_params.fork_choice = Some(ForkChoiceStrategy::LongestChain);
|
||||||
finalized: false,
|
block_import_params.post_hash = post_hash;
|
||||||
intermediates: HashMap::new(),
|
|
||||||
justification,
|
|
||||||
auxiliary: Vec::new(),
|
|
||||||
fork_choice: Some(ForkChoiceStrategy::LongestChain),
|
|
||||||
allow_missing_state: false,
|
|
||||||
import_existing: false,
|
|
||||||
storage_changes: None,
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok((block_import_params, None))
|
Ok((block_import_params, None))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ use sp_blockchain::Error as ClientError;
|
|||||||
use sp_consensus::block_validation::{BlockAnnounceValidator, Validation};
|
use sp_consensus::block_validation::{BlockAnnounceValidator, Validation};
|
||||||
use sp_runtime::traits::Block as BlockT;
|
use sp_runtime::traits::Block as BlockT;
|
||||||
|
|
||||||
use polkadot_network::gossip::{GossipMessage, GossipStatement};
|
use polkadot_network::legacy::gossip::{GossipMessage, GossipStatement};
|
||||||
use polkadot_primitives::parachain::ValidatorId;
|
use polkadot_primitives::parachain::ValidatorId;
|
||||||
use polkadot_statement_table::{SignedStatement, Statement};
|
use polkadot_statement_table::{SignedStatement, Statement};
|
||||||
use polkadot_validation::check_statement;
|
use polkadot_validation::check_statement;
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ fn call_validate_block(
|
|||||||
let params = ValidationParams {
|
let params = ValidationParams {
|
||||||
block_data: block_data.encode(),
|
block_data: block_data.encode(),
|
||||||
parent_head: parent_head.encode(),
|
parent_head: parent_head.encode(),
|
||||||
ingress: Vec::new(),
|
|
||||||
}
|
}
|
||||||
.encode();
|
.encode();
|
||||||
|
|
||||||
|
|||||||
@@ -169,18 +169,20 @@ impl frame_system::Trait for Runtime {
|
|||||||
type Version = Version;
|
type Version = Version;
|
||||||
/// Converts a module to an index of this module in the runtime.
|
/// Converts a module to an index of this module in the runtime.
|
||||||
type ModuleToIndex = ModuleToIndex;
|
type ModuleToIndex = ModuleToIndex;
|
||||||
|
type AccountData = pallet_balances::AccountData<Balance>;
|
||||||
|
type OnNewAccount = ();
|
||||||
|
type OnReapAccount = Balances;
|
||||||
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const IndexDeposit: Balance = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_indices::Trait for Runtime {
|
impl pallet_indices::Trait for Runtime {
|
||||||
/// The type for recording indexing into the account enumeration. If this ever overflows, there
|
|
||||||
/// will be problems!
|
|
||||||
type AccountIndex = u32;
|
type AccountIndex = u32;
|
||||||
/// Use the standard means of resolving an index hint from an id.
|
|
||||||
type ResolveHint = pallet_indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
|
|
||||||
/// Determine whether an account is dead.
|
|
||||||
type IsDeadAccount = Balances;
|
|
||||||
/// The ubiquitous event type.
|
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
type Currency = Balances;
|
||||||
|
type Deposit = IndexDeposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -205,15 +207,11 @@ parameter_types! {
|
|||||||
impl pallet_balances::Trait for Runtime {
|
impl pallet_balances::Trait for Runtime {
|
||||||
/// The type for recording an account's balance.
|
/// The type for recording an account's balance.
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
/// What to do if a new account is created.
|
|
||||||
type OnNewAccount = Indices;
|
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type DustRemoval = ();
|
type DustRemoval = ();
|
||||||
type TransferPayment = ();
|
|
||||||
type ExistentialDeposit = ExistentialDeposit;
|
type ExistentialDeposit = ExistentialDeposit;
|
||||||
type CreationFee = CreationFee;
|
type AccountStore = System;
|
||||||
type OnReapAccount = System;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Trait for Runtime {
|
impl pallet_transaction_payment::Trait for Runtime {
|
||||||
@@ -226,8 +224,8 @@ impl pallet_transaction_payment::Trait for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_sudo::Trait for Runtime {
|
impl pallet_sudo::Trait for Runtime {
|
||||||
|
type Call = Call;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type Proposal = Call;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
@@ -236,11 +234,11 @@ construct_runtime! {
|
|||||||
NodeBlock = opaque::Block,
|
NodeBlock = opaque::Block,
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic
|
UncheckedExtrinsic = UncheckedExtrinsic
|
||||||
{
|
{
|
||||||
System: frame_system::{Module, Call, Storage, Config, Event},
|
System: frame_system::{Module, Call, Storage, Config, Event<T>},
|
||||||
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
||||||
Indices: pallet_indices,
|
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>},
|
||||||
Balances: pallet_balances,
|
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||||
Sudo: pallet_sudo,
|
Sudo: pallet_sudo::{Module, Call, Storage, Config<T>, Event<T>},
|
||||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,6 +303,10 @@ impl_runtime_apis! {
|
|||||||
Executive::apply_extrinsic(extrinsic)
|
Executive::apply_extrinsic(extrinsic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn apply_trusted_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
||||||
|
Executive::apply_trusted_extrinsic(extrinsic)
|
||||||
|
}
|
||||||
|
|
||||||
fn finalize_block() -> <Block as BlockT>::Header {
|
fn finalize_block() -> <Block as BlockT>::Header {
|
||||||
Executive::finalize_block()
|
Executive::finalize_block()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ fn testnet_genesis(
|
|||||||
changes_trie_config: Default::default(),
|
changes_trie_config: Default::default(),
|
||||||
}),
|
}),
|
||||||
pallet_indices: Some(IndicesConfig {
|
pallet_indices: Some(IndicesConfig {
|
||||||
ids: endowed_accounts.clone(),
|
indices: vec![],
|
||||||
}),
|
}),
|
||||||
pallet_balances: Some(BalancesConfig {
|
pallet_balances: Some(BalancesConfig {
|
||||||
balances: endowed_accounts
|
balances: endowed_accounts
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
|
|||||||
enable_mdns: false,
|
enable_mdns: false,
|
||||||
allow_private_ipv4,
|
allow_private_ipv4,
|
||||||
wasm_external_transport: None,
|
wasm_external_transport: None,
|
||||||
|
use_yamux_flow_control: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
match config.roles {
|
match config.roles {
|
||||||
|
|||||||
Reference in New Issue
Block a user