Skip to content

Commit

Permalink
Upgrade codec to 2.0 and bitvec to 0.20 (companion) (#2343)
Browse files Browse the repository at this point in the history
* upgrade codec and bitvec

* "Update Substrate"

Co-authored-by: parity-processbot <>
  • Loading branch information
thiolliere committed Jan 29, 2021
1 parent 6efeb1e commit 29f12f3
Show file tree
Hide file tree
Showing 44 changed files with 297 additions and 272 deletions.
372 changes: 196 additions & 176 deletions polkadot/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions polkadot/core-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ edition = "2018"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
parity-scale-codec = { version = "1.3.6", default-features = false, features = [ "derive" ] }
parity-util-mem = { version = "0.8.0", default-features = false, optional = true }
parity-scale-codec = { version = "2.0.0", default-features = false, features = [ "derive" ] }
parity-util-mem = { version = "0.9.0", default-features = false, optional = true }

[features]
default = [ "std" ]
Expand Down
2 changes: 1 addition & 1 deletion polkadot/erasure-coding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
primitives = { package = "polkadot-primitives", path = "../primitives" }
reed_solomon = { package = "reed-solomon-erasure", version = "4.0.2" }
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master" }
thiserror = "1.0.23"
4 changes: 2 additions & 2 deletions polkadot/node/core/approval-voting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ edition = "2018"

[dependencies]
futures = "0.3.8"
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["bit-vec", "derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["bit-vec", "derive"] }

polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-overseer = { path = "../../overseer" }
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
bitvec = "0.17.4"
bitvec = "0.20.1"

sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down
10 changes: 5 additions & 5 deletions polkadot/node/core/av-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ edition = "2018"
[dependencies]
futures = "0.3.12"
futures-timer = "3.0.2"
kvdb = "0.8.0"
kvdb-rocksdb = "0.10.0"
kvdb = "0.9.0"
kvdb-rocksdb = "0.11.0"
thiserror = "1.0.23"
tracing = "0.1.22"
tracing-futures = "0.2.4"
bitvec = "0.17.4"
bitvec = "0.20.1"

parity-scale-codec = { version = "1.3.6", features = ["derive"] }
parity-scale-codec = { version = "2.0.0", features = ["derive"] }
erasure = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
Expand All @@ -27,7 +27,7 @@ sc-service = { git = "https://github.com/paritytech/substrate", branch = "master
log = "0.4.13"
env_logger = "0.8.2"
assert_matches = "1.4.0"
kvdb-memorydb = "0.8.0"
kvdb-memorydb = "0.9.0"

sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
Expand Down
10 changes: 6 additions & 4 deletions polkadot/node/core/av-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ impl Decode for BEBlockNumber {
#[derive(Debug, Encode, Decode)]
enum State {
/// Candidate data was first observed at the given time but is not available in any block.
#[codec(index = "0")]
#[codec(index = 0)]
Unavailable(BETimestamp),
/// The candidate was first observed at the given time and was included in the given list of unfinalized blocks, which may be
/// empty. The timestamp here is not used for pruning. Either one of these blocks will be finalized or the state will regress to
/// `State::Unavailable`, in which case the same timestamp will be reused. Blocks are sorted ascending first by block number and
/// then hash.
#[codec(index = "1")]
#[codec(index = 1)]
Unfinalized(BETimestamp, Vec<(BEBlockNumber, Hash)>),
/// Candidate data has appeared in a finalized block and did so at the given time.
#[codec(index = "2")]
#[codec(index = 2)]
Finalized(BETimestamp)
}

Expand Down Expand Up @@ -967,7 +967,9 @@ fn process_message(
}
AvailabilityStoreMessage::QueryChunkAvailability(candidate, validator_index, tx) => {
let a = load_meta(&subsystem.db, &candidate)?
.map_or(false, |m| *m.chunks_stored.get(validator_index as usize).unwrap_or(&false));
.map_or(false, |m|
*m.chunks_stored.get(validator_index as usize).as_deref().unwrap_or(&false)
);
let _ = tx.send(a);
}
AvailabilityStoreMessage::StoreChunk {
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/backing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" }
bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
tracing = "0.1.22"
tracing-futures = "0.2.4"
thiserror = "1.0.23"
Expand Down
5 changes: 4 additions & 1 deletion polkadot/node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,10 @@ mod tests {
assert!(candidates[0].validity_votes.contains(
&ValidityAttestation::Explicit(signed_c.signature().clone())
));
assert_eq!(candidates[0].validator_indices, bitvec::bitvec![Lsb0, u8; 1, 0, 1, 1]);
assert_eq!(
candidates[0].validator_indices,
bitvec::bitvec![bitvec::order::Lsb0, u8; 1, 0, 1, 1],
);

virtual_overseer.send(FromOverseer::Signal(
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::stop_work(test_state.relay_parent)))
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/candidate-validation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tracing = "0.1.22"
tracing-futures = "0.2.4"

sp-core = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master" }
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["bit-vec", "derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["bit-vec", "derive"] }

polkadot-primitives = { path = "../../../primitives" }
polkadot-parachain = { path = "../../../parachain" }
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/provisioner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
futures = "0.3.12"
tracing = "0.1.22"
tracing-futures = "0.2.4"
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/provisioner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ fn select_availability_bitfields(

for (idx, _) in cores.iter().enumerate().filter(|v| !v.1.is_occupied()) {
// Bit is set for an unoccupied core - invalid
if *bitfield.payload().0.get(idx).unwrap_or(&false) {
if *bitfield.payload().0.get(idx).as_deref().unwrap_or(&false) {
continue 'a
}
}
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ futures = "0.3.12"
tracing = "0.1.22"
tracing-futures = "0.2.4"
memory-lru = "0.1.0"
parity-util-mem = { version = "0.8.0", default-features = false }
parity-util-mem = { version = "0.9.0", default-features = false }

sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/network/availability-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
futures = "0.3.12"
tracing = "0.1.22"
tracing-futures = "0.2.4"
parity-scale-codec = { version = "1.3.6", features = ["std"] }
parity-scale-codec = { version = "2.0.0", features = ["std"] }
polkadot-primitives = { path = "../../../primitives" }
polkadot-erasure-coding = { path = "../../../erasure-coding" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/network/bitfield-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ edition = "2018"
futures = "0.3.12"
tracing = "0.1.22"
tracing-futures = "0.2.4"
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
polkadot-primitives = { path = "../../../primitives" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
polkadot-node-network-protocol = { path = "../../network/protocol" }

[dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/network/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ futures = "0.3.12"
tracing = "0.1.22"
tracing-futures = "0.2.4"
polkadot-primitives = { path = "../../../primitives" }
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/network/bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ const LOG_TARGET: &'static str = "network_bridge";
#[derive(Debug, Encode, Decode, Clone)]
pub enum WireMessage<M> {
/// A message from a peer on a specific protocol.
#[codec(index = "1")]
#[codec(index = 1)]
ProtocolMessage(M),
/// A view update from a peer.
#[codec(index = "2")]
#[codec(index = 2)]
ViewUpdate(View),
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/network/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Primitives types for the Node-side"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" }
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
strum = { version = "0.20", features = ["derive"] }
thiserror = "1.0.23"
Expand Down
36 changes: 18 additions & 18 deletions polkadot/node/network/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub mod v1 {
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub enum AvailabilityDistributionMessage {
/// An erasure chunk for a given candidate hash.
#[codec(index = "0")]
#[codec(index = 0)]
Chunk(CandidateHash, ErasureChunk),
}

Expand All @@ -314,7 +314,7 @@ pub mod v1 {
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub enum BitfieldDistributionMessage {
/// A signed availability bitfield for a given relay-parent hash.
#[codec(index = "0")]
#[codec(index = 0)]
Bitfield(Hash, SignedAvailabilityBitfield),
}

Expand All @@ -323,19 +323,19 @@ pub mod v1 {
pub enum PoVDistributionMessage {
/// Notification that we are awaiting the given PoVs (by hash) against a
/// specific relay-parent hash.
#[codec(index = "0")]
#[codec(index = 0)]
Awaiting(Hash, Vec<Hash>),
/// Notification of an awaited PoV, in a given relay-parent context.
/// (relay_parent, pov_hash, compressed_pov)
#[codec(index = "1")]
#[codec(index = 1)]
SendPoV(Hash, Hash, CompressedPoV),
}

/// Network messages used by the statement distribution subsystem.
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub enum StatementDistributionMessage {
/// A signed full statement under a given relay-parent.
#[codec(index = "0")]
#[codec(index = 0)]
Statement(Hash, SignedFullStatement)
}

Expand All @@ -345,10 +345,10 @@ pub mod v1 {
/// Assignments for candidates in recent, unfinalized blocks.
///
/// Actually checking the assignment may yield a different result.
#[codec(index = "0")]
#[codec(index = 0)]
Assignments(Vec<(IndirectAssignmentCert, CandidateIndex)>),
/// Approvals for candidates in some recent, unfinalized block.
#[codec(index = "1")]
#[codec(index = 1)]
Approvals(Vec<IndirectSignedApprovalVote>),
}

Expand Down Expand Up @@ -417,40 +417,40 @@ pub mod v1 {
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub enum CollatorProtocolMessage {
/// Declare the intent to advertise collations under a collator ID.
#[codec(index = "0")]
#[codec(index = 0)]
Declare(CollatorId),
/// Advertise a collation to a validator. Can only be sent once the peer has declared
/// that they are a collator with given ID.
#[codec(index = "1")]
#[codec(index = 1)]
AdvertiseCollation(Hash, ParaId),
/// Request the advertised collation at that relay-parent.
#[codec(index = "2")]
#[codec(index = 2)]
RequestCollation(RequestId, Hash, ParaId),
/// A requested collation.
#[codec(index = "3")]
#[codec(index = 3)]
Collation(RequestId, CandidateReceipt, CompressedPoV),
}

/// All network messages on the validation peer-set.
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub enum ValidationProtocol {
/// Availability distribution messages
#[codec(index = "0")]
#[codec(index = 0)]
AvailabilityDistribution(AvailabilityDistributionMessage),
/// Bitfield distribution messages
#[codec(index = "1")]
#[codec(index = 1)]
BitfieldDistribution(BitfieldDistributionMessage),
/// PoV Distribution messages
#[codec(index = "2")]
#[codec(index = 2)]
PoVDistribution(PoVDistributionMessage),
/// Statement distribution messages
#[codec(index = "3")]
#[codec(index = 3)]
StatementDistribution(StatementDistributionMessage),
/// Availability recovery messages
#[codec(index = "4")]
#[codec(index = 4)]
AvailabilityRecovery(AvailabilityRecoveryMessage),
/// Approval distribution messages
#[codec(index = "5")]
#[codec(index = 5)]
ApprovalDistribution(ApprovalDistributionMessage),
}

Expand All @@ -464,7 +464,7 @@ pub mod v1 {
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub enum CollationProtocol {
/// Collator protocol messages
#[codec(index = "0")]
#[codec(index = 0)]
CollatorProtocol(CollatorProtocolMessage),
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Primitives types for the Node-side"
futures = "0.3.12"
polkadot-primitives = { path = "../../primitives" }
polkadot-statement-table = { path = "../../statement-table" }
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
runtime_primitives = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-vrf = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
6 changes: 3 additions & 3 deletions polkadot/node/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ pub mod approval;
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
pub enum Statement {
/// A statement that a validator seconds a candidate.
#[codec(index = "1")]
#[codec(index = 1)]
Seconded(CommittedCandidateReceipt),
/// A statement that a validator has deemed a candidate valid.
#[codec(index = "2")]
#[codec(index = 2)]
Valid(CandidateHash),
/// A statement that a validator has deemed a candidate invalid.
#[codec(index = "3")]
#[codec(index = 3)]
Invalid(CandidateHash),
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/subsystem-test-helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ futures = "0.3.12"
futures-timer = "3.0.2"
tracing = "0.1.22"
tracing-futures = "0.2.4"
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
parking_lot = "0.11.1"
pin-project = "1.0.4"
polkadot-node-primitives = { path = "../primitives" }
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/subsystem-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Subsystem traits and message definitions"
async-trait = "0.1.42"
futures = "0.3.12"
futures-timer = "3.0.2"
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
parking_lot = { version = "0.11.1", optional = true }
pin-project = "1.0.4"
streamunordered = "0.5.1"
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/subsystem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mick-jaeger = "0.1.2"
lazy_static = "1.4"
tracing = "0.1.22"
tracing-futures = "0.2.4"
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
parking_lot = "0.11.1"
pin-project = "1.0.4"
polkadot-node-primitives = { path = "../primitives" }
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/test/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }

# Polkadot dependencies
polkadot-test-runtime = { path = "../../../runtime/test-runtime" }
Expand Down
4 changes: 2 additions & 2 deletions polkadot/parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2018"
# note: special care is taken to avoid inclusion of `sp-io` externals when compiling
# this crate for WASM. This is critical to avoid forcing all parachain WASM into implementing
# various unnecessary Substrate-specific endpoints.
parity-scale-codec = { version = "1.3.6", default-features = false, features = [ "derive" ] }
parity-util-mem = { version = "0.8.0", optional = true }
parity-scale-codec = { version = "2.0.0", default-features = false, features = [ "derive" ] }
parity-util-mem = { version = "0.9.0", optional = true }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down

0 comments on commit 29f12f3

Please sign in to comment.