Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:paritytech/substrate into liam-so…
Browse files Browse the repository at this point in the history
…ciety-v2-migration
  • Loading branch information
liamaharon committed Jun 30, 2023
2 parents 54f3108 + 37e1407 commit 7ea67b3
Show file tree
Hide file tree
Showing 133 changed files with 2,219 additions and 1,094 deletions.
95 changes: 6 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions bin/node-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ sc-executor = { version = "0.10.0-dev", path = "../../../client/executor" }
sc-network = { version = "0.10.0-dev", path = "../../../client/network" }
sc-service = { version = "0.10.0-dev", path = "../../../client/service" }
sc-telemetry = { version = "4.0.0-dev", path = "../../../client/telemetry" }
sc-keystore = { version = "4.0.0-dev", path = "../../../client/keystore" }
sc-transaction-pool = { version = "4.0.0-dev", path = "../../../client/transaction-pool" }
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../../../client/transaction-pool/api" }
sc-statement-store = { version = "4.0.0-dev", path = "../../../client/statement-store" }
sc-consensus-aura = { version = "0.10.0-dev", path = "../../../client/consensus/aura" }
sp-consensus-aura = { version = "0.10.0-dev", path = "../../../primitives/consensus/aura" }
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" }
sc-consensus-grandpa = { version = "0.10.0-dev", path = "../../../client/consensus/grandpa" }
sp-consensus-grandpa = { version = "4.0.0-dev", path = "../../../primitives/consensus/grandpa" }
Expand All @@ -47,7 +44,6 @@ pallet-transaction-payment = { version = "4.0.0-dev", default-features = false,

# These dependencies are used for the node template's RPCs
jsonrpsee = { version = "0.16.2", features = ["server"] }
sc-rpc = { version = "4.0.0-dev", path = "../../../client/rpc" }
sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" }
sc-rpc-api = { version = "0.10.0-dev", path = "../../../client/rpc-api" }
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub fn run() -> sc_cli::Result<()> {
)
}

cmd.run::<Block, service::ExecutorDispatch>(config)
cmd.run::<Block, ()>(config)
},
BenchmarkCmd::Block(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
Expand Down
4 changes: 1 addition & 3 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ sp-inherents = { version = "4.0.0-dev", path = "../../../primitives/inherents" }
sp-keyring = { version = "24.0.0", path = "../../../primitives/keyring" }
sp-keystore = { version = "0.27.0", path = "../../../primitives/keystore" }
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
sp-transaction-pool = { version = "4.0.0-dev", path = "../../../primitives/transaction-pool" }
sp-transaction-storage-proof = { version = "4.0.0-dev", path = "../../../primitives/transaction-storage-proof" }
sp-io = { path = "../../../primitives/io" }
sp-statement-store = { path = "../../../primitives/statement-store" }

# client dependencies
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
Expand Down Expand Up @@ -87,8 +87,6 @@ sc-storage-monitor = { version = "0.1.0", path = "../../../client/storage-monito
# frame dependencies
frame-system = { version = "4.0.0-dev", path = "../../../frame/system" }
frame-system-rpc-runtime-api = { version = "4.0.0-dev", path = "../../../frame/system/rpc/runtime-api" }
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
pallet-asset-conversion = { version = "4.0.0-dev", path = "../../../frame/asset-conversion" }
pallet-assets = { version = "4.0.0-dev", path = "../../../frame/assets/" }
pallet-asset-conversion-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment/asset-conversion-tx-payment" }
pallet-asset-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment/asset-tx-payment" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn run() -> Result<()> {
)
}

cmd.run::<Block, ExecutorDispatch>(config)
cmd.run::<Block, sp_statement_store::runtime_api::HostFunctions>(config)
},
BenchmarkCmd::Block(cmd) => {
// ensure that we keep the task manager alive
Expand Down
1 change: 0 additions & 1 deletion bin/node/inspect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ codec = { package = "parity-scale-codec", version = "3.6.1" }
thiserror = "1.0"
sc-cli = { version = "0.10.0-dev", path = "../../../client/cli" }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
sc-executor = { version = "0.10.0-dev", path = "../../../client/executor" }
sc-service = { version = "0.10.0-dev", default-features = false, path = "../../../client/service" }
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
sp-core = { version = "21.0.0", path = "../../../primitives/core" }
Expand Down
10 changes: 0 additions & 10 deletions bin/node/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,12 @@ publish = false
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system" }
sp-application-crypto = { version = "23.0.0", default-features = false, path = "../../../primitives/application-crypto" }
sp-core = { version = "21.0.0", default-features = false, path = "../../../primitives/core" }
sp-runtime = { version = "24.0.0", default-features = false, path = "../../../primitives/runtime" }

[features]
default = ["std"]
std = [
"codec/std",
"frame-system/std",
"scale-info/std",
"sp-application-crypto/std",
"sp-core/std",
"sp-runtime/std",
]
5 changes: 3 additions & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//! The Substrate runtime. This can be compiled with `#[no_std]`, ready for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 512.
#![recursion_limit = "512"]
// `construct_runtime!` does a lot of recursion and requires us to increase the limits.
#![recursion_limit = "1024"]

use codec::{Decode, Encode, MaxEncodedLen};
use frame_election_provider_support::{
Expand Down Expand Up @@ -1190,6 +1190,7 @@ impl pallet_message_queue::Config for Runtime {
type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<u32>;
type Size = u32;
type QueueChangeHandler = ();
type QueuePausedQuery = ();
type HeapSize = ConstU32<{ 64 * 1024 }>;
type MaxStale = ConstU32<128>;
type ServiceWeight = MessageQueueServiceWeight;
Expand Down
1 change: 0 additions & 1 deletion bin/node/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pallet-asset-conversion = { version = "4.0.0-dev", path = "../../../frame/asset-
pallet-assets = { version = "4.0.0-dev", path = "../../../frame/assets" }
pallet-asset-conversion-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment/asset-conversion-tx-payment" }
pallet-asset-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment/asset-tx-payment" }
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
sc-block-builder = { version = "0.10.0-dev", path = "../../../client/block-builder" }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
sc-client-db = { version = "0.10.0-dev", features = ["rocksdb"], path = "../../../client/db" }
Expand Down
1 change: 0 additions & 1 deletion client/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ thiserror = "1.0"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../utils/prometheus" }
sc-client-api = { version = "4.0.0-dev", path = "../api" }
sc-network = { version = "0.10.0-dev", path = "../network/" }
sc-network-common = { version = "0.10.0-dev", path = "../network/common" }
sp-api = { version = "4.0.0-dev", path = "../../primitives/api" }
sp-authority-discovery = { version = "4.0.0-dev", path = "../../primitives/authority-discovery" }
sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" }
Expand Down
1 change: 0 additions & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ sc-client-api = { version = "4.0.0-dev", path = "../api" }
sc-client-db = { version = "0.10.0-dev", default-features = false, path = "../db" }
sc-keystore = { version = "4.0.0-dev", path = "../keystore" }
sc-network = { version = "0.10.0-dev", path = "../network" }
sc-network-common = { version = "0.10.0-dev", path = "../network/common" }
sc-service = { version = "0.10.0-dev", default-features = false, path = "../service" }
sc-telemetry = { version = "4.0.0-dev", path = "../telemetry" }
sc-tracing = { version = "4.0.0-dev", path = "../tracing" }
Expand Down
12 changes: 8 additions & 4 deletions client/cli/src/arg_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,14 @@ impl Into<sc_network::config::SyncMode> for SyncMode {
fn into(self) -> sc_network::config::SyncMode {
match self {
SyncMode::Full => sc_network::config::SyncMode::Full,
SyncMode::Fast =>
sc_network::config::SyncMode::Fast { skip_proofs: false, storage_chain_mode: false },
SyncMode::FastUnsafe =>
sc_network::config::SyncMode::Fast { skip_proofs: true, storage_chain_mode: false },
SyncMode::Fast => sc_network::config::SyncMode::LightState {
skip_proofs: false,
storage_chain_mode: false,
},
SyncMode::FastUnsafe => sc_network::config::SyncMode::LightState {
skip_proofs: true,
storage_chain_mode: false,
},
SyncMode::Warp => sc_network::config::SyncMode::Warp,
}
}
Expand Down
1 change: 0 additions & 1 deletion client/consensus/babe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ sc-client-api = { version = "4.0.0-dev", path = "../../api" }
sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" }
sc-consensus-epochs = { version = "0.10.0-dev", path = "../epochs" }
sc-consensus-slots = { version = "0.10.0-dev", path = "../slots" }
sc-keystore = { version = "4.0.0-dev", path = "../../keystore" }
sc-telemetry = { version = "4.0.0-dev", path = "../../telemetry" }
sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" }
sp-application-crypto = { version = "23.0.0", path = "../../../primitives/application-crypto" }
Expand Down
8 changes: 4 additions & 4 deletions client/consensus/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,10 +1152,10 @@ where
// Verification for imported blocks is skipped in two cases:
// 1. When importing blocks below the last finalized block during network initial
// synchronization.
// 2. When importing whole state we don't calculate epoch descriptor, but rather
// read it from the state after import. We also skip all verifications
// because there's no parent state and we trust the sync module to verify
// that the state is correct and finalized.
// 2. When importing whole state we don't calculate epoch descriptor, but rather read it
// from the state after import. We also skip all verifications because there's no
// parent state and we trust the sync module to verify that the state is correct and
// finalized.
return Ok(block)
}

Expand Down
2 changes: 0 additions & 2 deletions client/consensus/beefy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ wasm-timer = "0.2.5"
prometheus = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../../utils/prometheus" }
sc-client-api = { version = "4.0.0-dev", path = "../../api" }
sc-consensus = { version = "0.10.0-dev", path = "../../consensus/common" }
sc-keystore = { version = "4.0.0-dev", path = "../../keystore" }
sc-network = { version = "0.10.0-dev", path = "../../network" }
sc-network-common = { version = "0.10.0-dev", path = "../../network/common" }
sc-network-gossip = { version = "0.10.0-dev", path = "../../network-gossip" }
sc-network-sync = { version = "0.10.0-dev", path = "../../network/sync" }
sc-utils = { version = "4.0.0-dev", path = "../../utils" }
Expand Down
8 changes: 4 additions & 4 deletions client/consensus/beefy/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ pub(crate) struct VoterOracle<B: Block> {
///
/// There are three voter states coresponding to three queue states:
/// 1. voter uninitialized: queue empty,
/// 2. up-to-date - all mandatory blocks leading up to current GRANDPA finalized:
/// queue has ONE element, the 'current session' where `mandatory_done == true`,
/// 2. up-to-date - all mandatory blocks leading up to current GRANDPA finalized: queue has ONE
/// element, the 'current session' where `mandatory_done == true`,
/// 3. lagging behind GRANDPA: queue has [1, N] elements, where all `mandatory_done == false`.
/// In this state, everytime a session gets its mandatory block BEEFY finalized, it's
/// popped off the queue, eventually getting to state `2. up-to-date`.
/// In this state, everytime a session gets its mandatory block BEEFY finalized, it's popped
/// off the queue, eventually getting to state `2. up-to-date`.
sessions: VecDeque<Rounds<B>>,
/// Min delta in block numbers between two blocks, BEEFY should vote on.
min_block_delta: u32,
Expand Down
8 changes: 0 additions & 8 deletions client/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ ip_network = "0.4.1"
libp2p = { version = "0.51.3", features = ["dns", "identify", "kad", "macros", "mdns", "noise", "ping", "tcp", "tokio", "yamux", "websocket", "request-response"] }
linked_hash_set = "0.1.3"
log = "0.4.17"
lru = "0.10.0"
mockall = "0.11.3"
parking_lot = "0.12.1"
partial_sort = "0.2.0"
Expand All @@ -41,20 +40,13 @@ thiserror = "1.0"
unsigned-varint = { version = "0.7.1", features = ["futures", "asynchronous_codec"] }
zeroize = "1.4.3"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../utils/prometheus" }
sc-block-builder = { version = "0.10.0-dev", path = "../block-builder" }
sc-client-api = { version = "4.0.0-dev", path = "../api" }
sc-consensus = { version = "0.10.0-dev", path = "../consensus/common" }
sc-network-common = { version = "0.10.0-dev", path = "./common" }
sc-utils = { version = "4.0.0-dev", path = "../utils" }
sp-arithmetic = { version = "16.0.0", path = "../../primitives/arithmetic" }
sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" }
sp-consensus = { version = "0.10.0-dev", path = "../../primitives/consensus/common" }
sp-core = { version = "21.0.0", path = "../../primitives/core" }
sp-runtime = { version = "24.0.0", path = "../../primitives/runtime" }
# Force 0.9.2 as snow release to fix the compilation.
#
# When libp2p also enforces this version, we can get rid off this extra dep here.
snow = "0.9.2"
wasm-timer = "0.2"

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion client/network/bitswap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ thiserror = "1.0"
unsigned-varint = { version = "0.7.1", features = ["futures", "asynchronous_codec"] }
sc-client-api = { version = "4.0.0-dev", path = "../../api" }
sc-network = { version = "0.10.0-dev", path = "../" }
sc-network-common = { version = "0.10.0-dev", path = "../common" }
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
sp-runtime = { version = "24.0.0", path = "../../../primitives/runtime" }

Expand Down
10 changes: 0 additions & 10 deletions client/network/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"]
prost-build = "0.11"

[dependencies]
array-bytes = "4.1"
async-trait = "0.1.57"
bitflags = "1.3.2"
bytes = "1"
codec = { package = "parity-scale-codec", version = "3.6.1", features = [
"derive",
] }
futures = "0.3.21"
futures-timer = "3.0.2"
libp2p-identity = { version = "0.1.2", features = ["peerid"] }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../../utils/prometheus" }
smallvec = "1.8.0"
sc-consensus = { version = "0.10.0-dev", path = "../../consensus/common" }
sc-utils = { version = "4.0.0-dev", path = "../../utils" }
serde = { version = "1.0.163", features = ["derive"] }
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
sp-consensus-grandpa = { version = "4.0.0-dev", path = "../../../primitives/consensus/grandpa" }
sp-runtime = { version = "24.0.0", path = "../../../primitives/runtime" }
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
thiserror = "1.0"
zeroize = "1.4.3"

[dev-dependencies]
tempfile = "3.1.0"
54 changes: 28 additions & 26 deletions client/network/common/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,32 +185,43 @@ pub enum PollBlockAnnounceValidation<H> {
/// The announcement.
announce: BlockAnnounce<H>,
},
/// The announcement header should be imported.
ImportHeader {
/// Who sent the processed block announcement?
who: PeerId,
/// Was this their new best block?
is_best: bool,
/// The announcement.
announce: BlockAnnounce<H>,
},
/// The block announcement should be skipped.
Skip,
}

/// Operation mode.
#[derive(Debug, PartialEq, Eq)]
/// Sync operation mode.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum SyncMode {
// Sync headers only
Light,
// Sync headers and block bodies
/// Full block download and verification.
Full,
// Sync headers and the last finalied state
LightState { storage_chain_mode: bool, skip_proofs: bool },
// Warp sync mode.
/// Download blocks and the latest state.
LightState {
/// Skip state proof download and verification.
skip_proofs: bool,
/// Download indexed transactions for recent blocks.
storage_chain_mode: bool,
},
/// Warp sync - verify authority set transitions and the latest state.
Warp,
}

impl SyncMode {
/// Returns `true` if `self` is [`Self::Warp`].
pub fn is_warp(&self) -> bool {
matches!(self, Self::Warp)
}

/// Returns `true` if `self` is [`Self::LightState`].
pub fn light_state(&self) -> bool {
matches!(self, Self::LightState { .. })
}
}

impl Default for SyncMode {
fn default() -> Self {
Self::Full
}
}
#[derive(Debug)]
pub struct Metrics {
pub queued_blocks: u32,
Expand Down Expand Up @@ -376,12 +387,6 @@ pub trait ChainSync<Block: BlockT>: Send {
response: BlockResponse<Block>,
) -> Result<OnBlockData<Block>, BadPeer>;

/// Procss received block data.
fn process_block_response_data(
&mut self,
blocks_to_import: Result<OnBlockData<Block>, BadPeer>,
);

/// Handle a response from the remote to a justification request that we made.
///
/// `request` must be the original request that triggered `response`.
Expand Down Expand Up @@ -421,9 +426,6 @@ pub trait ChainSync<Block: BlockT>: Send {
/// [`ChainSync::push_block_announce_validation`].
///
/// This should be polled until it returns [`Poll::Pending`].
///
/// If [`PollBlockAnnounceValidation::ImportHeader`] is returned, then the caller MUST try to
/// import passed header (call `on_block_data`). The network request isn't sent in this case.
fn poll_block_announce_validation(
&mut self,
cx: &mut std::task::Context<'_>,
Expand Down
1 change: 0 additions & 1 deletion client/network/light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ prost = "0.11"
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
sc-client-api = { version = "4.0.0-dev", path = "../../api" }
sc-network = { version = "0.10.0-dev", path = "../" }
sc-network-common = { version = "0.10.0-dev", path = "../common" }
sp-core = { version = "21.0.0", path = "../../../primitives/core" }
sp-runtime = { version = "24.0.0", path = "../../../primitives/runtime" }
thiserror = "1.0"
Loading

0 comments on commit 7ea67b3

Please sign in to comment.