Skip to content

Commit 16e6b1d

Browse files
A0-3461: Update ABFT and remove legacy data IO (#1692)
# Description Updates AlephBFT, letting us get rid of the ugly `data_io::legacy` hack. Note that this updates `aleph_bft_crypto` which, in principle could be a compatibility issue. Fortunately, the change from 0.8 to 0.9 is only in some minor interfaces, the internal representation and, more importantly, encoding of all the types remains unchanged. ## Type of change - ABFT update # Checklist:
1 parent 323bd30 commit 16e6b1d

File tree

23 files changed

+153
-2368
lines changed

23 files changed

+153
-2368
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ homepage = "https://alephzero.org"
4747
repository = "https://github.com/Cardinal-Cryptography/aleph-node"
4848

4949
[workspace.dependencies]
50-
aleph-bft-crypto = { version = "0.8" }
51-
aleph-bft-mock = { version = "0.11.1" }
52-
aleph-bft-rmc = { version = "0.11" }
53-
aleph-bft-types = { version = "0.11" }
50+
aleph-bft-crypto = { version = "0.9" }
51+
aleph-bft-mock = { version = "0.14" }
52+
aleph-bft-rmc = { version = "0.13" }
53+
aleph-bft-types = { version = "0.13" }
5454
async-trait = { version = "0.1" }
5555
bytes = { version = "1.6" }
5656
derive_more = { version = "0.99" }

aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aggregator"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
license = "Apache 2.0"
55
authors.workspace = true
66
edition.workspace = true

finality-aleph/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ repository.workspace = true
1111
# fixed version to 'freeze' some types used in abft, mainly `SignatureSet` used in justification and signature aggregation
1212
aleph-bft-crypto = { workspace = true }
1313

14-
current-aleph-bft = { package = "aleph-bft", version = "0.33" }
15-
current-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.11" }
16-
legacy-aleph-bft = { package = "aleph-bft", version = "0.20" }
17-
legacy-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.6" }
14+
current-aleph-bft = { package = "aleph-bft", version = "0.36" }
15+
current-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.13" }
16+
legacy-aleph-bft = { package = "aleph-bft", version = "0.33" }
17+
legacy-aleph-bft-rmc = { package = "aleph-bft-rmc", version = "0.11" }
1818

1919
network-clique = { workspace = true }
2020
primitives = { workspace = true }
21-
legacy-aleph-aggregator = { package = "aggregator", git = "https://github.com/Cardinal-Cryptography/aleph-node.git", tag = "r-12.1" }
21+
legacy-aleph-aggregator = { package = "aggregator", git = "https://github.com/Cardinal-Cryptography/aleph-node.git", tag = "r-13.3" }
2222
current-aleph-aggregator = { path = "../aggregator", package = "aggregator" }
2323
rate-limiter = { package = "rate-limiter", path = "../rate-limiter" }
2424

finality-aleph/src/abft/common.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,3 @@ pub fn unit_creation_delay_fn(unit_creation_delay: UnitCreationDelay) -> DelaySc
3535

3636
// 7 days (as milliseconds)
3737
pub const SESSION_LEN_LOWER_BOUND_MS: u128 = 1000 * 60 * 60 * 24 * 7;
38-
39-
pub fn sanity_check_round_delays(max_rounds: u16, round_delays: DelaySchedule) {
40-
let delays_ok = sanity_check_round_delays_inner(max_rounds, round_delays);
41-
assert!(
42-
delays_ok,
43-
"Incorrect setting of delays. Make sure the total AlephBFT session time is at least {SESSION_LEN_LOWER_BOUND_MS}ms."
44-
);
45-
}
46-
47-
fn sanity_check_round_delays_inner(max_rounds: u16, round_delays: DelaySchedule) -> bool {
48-
let mut total_delay = Duration::from_millis(0);
49-
for t in 0..=max_rounds {
50-
total_delay += round_delays(t as usize);
51-
}
52-
total_delay.as_millis() > SESSION_LEN_LOWER_BOUND_MS
53-
}
54-
55-
#[test]
56-
fn sanity_check_fails_on_bad_config() {
57-
let round_delays = unit_creation_delay_fn(UnitCreationDelay(300));
58-
assert!(!sanity_check_round_delays_inner(5000, round_delays));
59-
}
60-
61-
#[test]
62-
fn sanity_check_passes_on_good_config() {
63-
let round_delays = unit_creation_delay_fn(UnitCreationDelay(300));
64-
assert!(sanity_check_round_delays_inner(7000, round_delays));
65-
}

finality-aleph/src/abft/crypto.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ impl legacy_aleph_bft::Index for Keychain {
6060
}
6161
}
6262

63-
#[async_trait::async_trait]
6463
impl current_aleph_bft::Keychain for Keychain {
6564
type Signature = Signature;
6665

@@ -77,15 +76,14 @@ impl current_aleph_bft::Keychain for Keychain {
7776
}
7877
}
7978

80-
#[async_trait::async_trait]
8179
impl legacy_aleph_bft::Keychain for Keychain {
8280
type Signature = Signature;
8381

8482
fn node_count(&self) -> legacy_aleph_bft::NodeCount {
8583
Keychain::node_count(self).into()
8684
}
8785

88-
async fn sign(&self, msg: &[u8]) -> Signature {
86+
fn sign(&self, msg: &[u8]) -> Signature {
8987
Keychain::sign(self, msg)
9088
}
9189

finality-aleph/src/abft/current/traits.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ where
1818
H: Header,
1919
V: HeaderVerifier<H>,
2020
{
21-
fn data_finalized(
22-
&mut self,
23-
data: AlephData<H::Unverified>,
24-
_creator: current_aleph_bft::NodeIndex,
25-
) {
21+
fn data_finalized(&mut self, data: AlephData<H::Unverified>) {
2622
OrderedDataInterpreter::data_finalized(self, data)
2723
}
2824
}

0 commit comments

Comments
 (0)