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

Commit 2faf02f

Browse files
author
Andronik Ordian
committed
merge master and resolve bitvec upgrade fallout
* master: Upgrade codec to 2.0 and bitvec to 0.20 (companion) (#2343) Companion PR for #7951 (#2336) Companion PR for 7934 (#2348)
2 parents 7022acb + 71a528e commit 2faf02f

File tree

51 files changed

+311
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+311
-288
lines changed

Cargo.lock

Lines changed: 196 additions & 176 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ pub fn run() -> Result<()> {
249249
})?)
250250
},
251251
Some(Subcommand::ValidationWorker(cmd)) => {
252-
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
252+
let mut builder = sc_cli::LoggerBuilder::new("");
253253
builder.with_colors(false);
254254
let _ = builder.init();
255255

core-primitives/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ edition = "2018"
88
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
99
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
1010
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
11-
parity-scale-codec = { version = "1.3.6", default-features = false, features = [ "derive" ] }
12-
parity-util-mem = { version = "0.8.0", default-features = false, optional = true }
11+
parity-scale-codec = { version = "2.0.0", default-features = false, features = [ "derive" ] }
12+
parity-util-mem = { version = "0.9.0", default-features = false, optional = true }
1313

1414
[features]
1515
default = [ "std" ]

erasure-coding/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[dependencies]
88
primitives = { package = "polkadot-primitives", path = "../primitives" }
99
reed_solomon = { package = "reed-solomon-erasure", version = "4.0.2" }
10-
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
10+
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
1111
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
1212
trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master" }
1313
thiserror = "1.0.23"

node/core/approval-voting/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ edition = "2018"
77
[dependencies]
88
futures = "0.3.8"
99
futures-timer = "3.0.2"
10-
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["bit-vec", "derive"] }
10+
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["bit-vec", "derive"] }
1111
tracing = "0.1.22"
1212
tracing-futures = "0.2.4"
13-
bitvec = "0.17.4"
13+
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
1414
merlin = "2.0"
1515
schnorrkel = "0.9.1"
1616

node/core/approval-voting/src/aux_schema/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl ApprovalEntry {
9696

9797
/// Whether a validator is already assigned.
9898
pub(crate) fn is_assigned(&self, validator_index: ValidatorIndex) -> bool {
99-
*self.assignments.get(validator_index as usize).unwrap_or(&false)
99+
self.assignments.get(validator_index as usize).map(|b| *b).unwrap_or(false)
100100
}
101101

102102
/// Import an assignment. No-op if already assigned on the same tranche.
@@ -176,7 +176,7 @@ impl CandidateEntry {
176176

177177
/// Note that a given validator has approved. Return the previous approval state.
178178
pub(crate) fn mark_approval(&mut self, validator: ValidatorIndex) -> bool {
179-
let prev = *self.approvals.get(validator as usize).unwrap_or(&false);
179+
let prev = self.approvals.get(validator as usize).map(|b| *b).unwrap_or(false);
180180
self.approvals.set(validator as usize, true);
181181
prev
182182
}
@@ -202,7 +202,7 @@ impl CandidateEntry {
202202
// The earliest-received assignment which has no corresponding approval
203203
let next_no_show = approval_entry.tranches.iter()
204204
.flat_map(|t| t.assignments.iter())
205-
.filter(|(v, _)| *self.approvals.get(*v as usize).unwrap_or(&false))
205+
.filter(|(v, _)| self.approvals.get(*v as usize).map(|b| *b).unwrap_or(false))
206206
.map(|(_, tick)| tick + no_show_duration)
207207
.min();
208208

node/core/approval-voting/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ fn check_approval(
12711271
let approvals = candidate.approvals();
12721272

12731273
let n_assigned = assigned_mask.count_ones();
1274-
assigned_mask &= approvals.iter().cloned();
1274+
assigned_mask &= approvals.iter().by_val();
12751275
let n_approved = assigned_mask.count_ones();
12761276

12771277
// note: the process of computing `required` only chooses `exact` if
@@ -1355,7 +1355,7 @@ fn tranches_to_approve(
13551355
// after a fixed duration.
13561356
let no_shows = tranche.assignments.iter().filter(|(v_index, tick)| {
13571357
tick + no_show_duration >= tick_now
1358-
&& *approvals.get(*v_index as usize).unwrap_or(&true)
1358+
&& approvals.get(*v_index as usize).map(|b| *b).unwrap_or(true)
13591359
}).count();
13601360

13611361
*state = Some(match s {

node/core/av-store/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ edition = "2018"
77
[dependencies]
88
futures = "0.3.12"
99
futures-timer = "3.0.2"
10-
kvdb = "0.8.0"
11-
kvdb-rocksdb = "0.10.0"
10+
kvdb = "0.9.0"
11+
kvdb-rocksdb = "0.11.0"
1212
thiserror = "1.0.23"
1313
tracing = "0.1.22"
1414
tracing-futures = "0.2.4"
15-
bitvec = "0.17.4"
15+
bitvec = "0.20.1"
1616

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

3232
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
3333
polkadot-node-subsystem-util = { path = "../../subsystem-util" }

node/core/av-store/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,16 @@ impl Decode for BEBlockNumber {
133133
#[derive(Debug, Encode, Decode)]
134134
enum State {
135135
/// Candidate data was first observed at the given time but is not available in any block.
136-
#[codec(index = "0")]
136+
#[codec(index = 0)]
137137
Unavailable(BETimestamp),
138138
/// The candidate was first observed at the given time and was included in the given list of unfinalized blocks, which may be
139139
/// empty. The timestamp here is not used for pruning. Either one of these blocks will be finalized or the state will regress to
140140
/// `State::Unavailable`, in which case the same timestamp will be reused. Blocks are sorted ascending first by block number and
141141
/// then hash.
142-
#[codec(index = "1")]
142+
#[codec(index = 1)]
143143
Unfinalized(BETimestamp, Vec<(BEBlockNumber, Hash)>),
144144
/// Candidate data has appeared in a finalized block and did so at the given time.
145-
#[codec(index = "2")]
145+
#[codec(index = 2)]
146146
Finalized(BETimestamp)
147147
}
148148

@@ -967,7 +967,9 @@ fn process_message(
967967
}
968968
AvailabilityStoreMessage::QueryChunkAvailability(candidate, validator_index, tx) => {
969969
let a = load_meta(&subsystem.db, &candidate)?
970-
.map_or(false, |m| *m.chunks_stored.get(validator_index as usize).unwrap_or(&false));
970+
.map_or(false, |m|
971+
*m.chunks_stored.get(validator_index as usize).as_deref().unwrap_or(&false)
972+
);
971973
let _ = tx.send(a);
972974
}
973975
AvailabilityStoreMessage::StoreChunk {

node/core/backing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
1313
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
1414
erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
1515
statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" }
16-
bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
16+
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
1717
tracing = "0.1.22"
1818
tracing-futures = "0.2.4"
1919
thiserror = "1.0.23"

0 commit comments

Comments
 (0)