Unverified Commit 71a528e8 authored by thiolliere's avatar thiolliere Committed by GitHub
Browse files

Upgrade codec to 2.0 and bitvec to 0.20 (companion) (#2343)

* upgrade codec and bitvec

* "Update Substrate"

Co-authored-by: parity-processbot <>
parent 1dd53d43
Pipeline #122339 passed with stages
in 29 minutes and 42 seconds
This diff is collapsed.
......@@ -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" ]
......
......@@ -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"
......@@ -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 }
......
......@@ -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" }
......@@ -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" }
......
......@@ -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)
}
......@@ -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 {
......
......@@ -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"
......
......@@ -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)))
......
......@@ -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" }
......
......@@ -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"
......
......@@ -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
}
}
......
......@@ -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" }
......
......@@ -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" }
......
......@@ -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", 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" }
......@@ -16,7 +16,7 @@ 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" }
......
......@@ -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" }
......
......@@ -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),
}
......
......@@ -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"
......
......@@ -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),
}
......@@ -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),
}
......@@ -323,11 +323,11 @@ 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),
}
......@@ -335,7 +335,7 @@ pub mod v1 {
#[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)
}
......@@ -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>),
}
......@@ -417,17 +417,17 @@ 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),
}
......@@ -435,22 +435,22 @@ pub mod v1 {
#[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),
}
......@@ -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),
}
......
......@@ -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" }
......
......@@ -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),
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment