Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
39ae619
feat: add task delay tests
rafael-xmr Dec 15, 2025
28548b2
feat: add intend task tests
rafael-xmr Dec 19, 2025
e89e68f
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Dec 19, 2025
d45d5e7
feat(cosign): improve delay iteration txn use, sanity check timestamp…
rafael-xmr Dec 23, 2025
057ebce
feat(cosign): refactor intend tests, add better test cases
rafael-xmr Dec 24, 2025
99fc4a5
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Dec 24, 2025
ac32f6d
fix: the txn commit behavior on delay and even better tests
rafael-xmr Dec 26, 2025
ce6a48e
feat(cosign): more delay improvements & refactor test into traits
rafael-xmr Dec 29, 2025
ed3f072
refactor(cosign): more refactors
rafael-xmr Dec 30, 2025
53d9441
refactor(cosign): minor refactors
rafael-xmr Dec 30, 2025
3d8e153
feat(cosign): intend changes, add evaluator
rafael-xmr Dec 30, 2025
344f6f6
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Dec 30, 2025
8bac6ff
fix: test failures
rafael-xmr Dec 30, 2025
4f4d1e6
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Jan 2, 2026
f49fc05
feat(cosign): more tests
rafael-xmr Jan 2, 2026
722dfd7
refactor(cosign): simpliy & cleanup delay tests
rafael-xmr Jan 6, 2026
7071732
feat(cosign): types tests
rafael-xmr Jan 6, 2026
2f14366
refactor(cosign): simpliy, cleanup & get tests ready
rafael-xmr Jan 6, 2026
445c5d1
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Jan 6, 2026
490647e
chore(cosign): merge issues
rafael-xmr Jan 6, 2026
4a1cf91
misc
rafael-xmr Jan 6, 2026
52158ab
Revert "misc"
rafael-xmr Jan 6, 2026
3fdfa44
misc
rafael-xmr Jan 6, 2026
d25dbbc
misc2
rafael-xmr Jan 6, 2026
873081f
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Jan 27, 2026
30e0482
feat: adding rpc harness
rafael-xmr Feb 20, 2026
99b84c2
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Feb 20, 2026
eb7eb2d
feat(cosign): skip 0 stake vsets
rafael-xmr Feb 23, 2026
95e6c4c
feat(cosign): remove unwanted addition
rafael-xmr Feb 23, 2026
e34d702
chore(log): wrong license
rafael-xmr Feb 23, 2026
e488dc2
feat(cosign): misc log & comments
rafael-xmr Feb 24, 2026
69733bb
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Feb 24, 2026
c2ec707
feat: add test libs & end clean up cosign tests
rafael-xmr Feb 25, 2026
b577451
feat(tributary): begin tests based off cosign
rafael-xmr Feb 26, 2026
c0ece41
feat(tributary): finish transaction.rs tests and add db.rs tests
rafael-xmr Feb 27, 2026
608db12
feat(tributary): add more db.rs tests
rafael-xmr Mar 2, 2026
0905cb6
feat(tributary): add initial scan_block.rs tests
rafael-xmr Mar 3, 2026
33a6cff
refactor(tributary): move utils to mod.rs
rafael-xmr Mar 3, 2026
38cb838
feat(tributary): refactor db tests, improve handling of overflow atte…
rafael-xmr Mar 5, 2026
b6c2a87
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Mar 9, 2026
a94f298
misc
rafael-xmr Mar 9, 2026
1493c16
feat(coordinator/cosign): adding full-stack tests
rafael-xmr Mar 13, 2026
836eb44
feat(env): move serai_log into serai_env
rafael-xmr Mar 16, 2026
3350b9b
feat(tests/shim-rpc): add random failure rate
rafael-xmr Mar 16, 2026
f494d3a
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Mar 16, 2026
75c5ade
feat(coordinator/cosign): more touch ups & fix evaluate -> delay flow…
rafael-xmr Mar 17, 2026
d7572c3
feat(coordinator/cosign): full_stack.rs tests
rafael-xmr Mar 20, 2026
11bf62c
feat(coordinator/cosign): initial review changes
rafael-xmr Mar 20, 2026
108754e
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Mar 20, 2026
3814122
feat(coordinator/cosign): more review comment changes
rafael-xmr Mar 23, 2026
f79a561
Merge remote-tracking branch 'origin/next-polkadot-sdk' into begin-co…
rafael-xmr Mar 23, 2026
3ca2bc5
refactor(common/task): move test helpers from external crate
rafael-xmr Mar 24, 2026
06039ee
refactor(coordinator/cosign): self-reviewing & cleaning up
rafael-xmr Mar 24, 2026
a708ed3
some misc
rafael-xmr Mar 24, 2026
9fa3ce7
refactor(coordinator/cosign): self-reviewing & cleaning up tests
rafael-xmr Mar 25, 2026
4b933e8
feat(cosign/tests/full_stack): add dos offline cosigns stall scenario…
rafael-xmr Mar 26, 2026
de80281
Merge branch 'begin-cosign-tests' into cosign-add-tributary-tests
rafael-xmr Mar 26, 2026
72dfa89
refactor(coordinator/tributary): bringing in updates from cosign work…
rafael-xmr Mar 30, 2026
58c5e32
feat(coordinator/tributary): adding changes and new test cases
rafael-xmr Apr 6, 2026
55aab58
feat(coordinator/tributary): finish the coverage adding scanning bloc…
rafael-xmr Apr 7, 2026
b298649
Merge remote-tracking branch 'origin/next' into begin-cosign-tests
rafael-xmr Apr 7, 2026
fba8ff9
Merge branch 'begin-cosign-tests' into cosign-add-tributary-tests
rafael-xmr Apr 7, 2026
e073057
feat(substrate/test_helpers): missing test utility
rafael-xmr Apr 7, 2026
9742a6d
Merge branch 'cosign-add-tributary-tests' into next-tributary-tests
rafael-xmr Apr 9, 2026
5b04ae0
chore(coordinator/tributary): initial self-review by comparing changes
rafael-xmr Apr 9, 2026
c40fa88
chore(coordinator/tributary): missing misc
rafael-xmr Apr 9, 2026
b1b2ccf
chore: ci alerts
rafael-xmr Apr 10, 2026
5cf5ba0
Merge remote-tracking branch 'origin/next' into next-tributary-tests
rafael-xmr Apr 10, 2026
9b9ec8d
chore(coordinator/tributary): fix match same arms
rafael-xmr Apr 15, 2026
b97b58a
Merge remote-tracking branch 'origin/next' into next-tributary-tests
rafael-xmr Apr 15, 2026
1b669c9
chore: lock
rafael-xmr Apr 15, 2026
3970ccc
chore(coordinator/tributary): clippy errors
rafael-xmr Apr 15, 2026
accd144
chore(coordinator/tributary): clippy errors
rafael-xmr Apr 15, 2026
d51f0bd
Merge remote-tracking branch 'origin/next' into next-tributary-tests
rafael-xmr Apr 15, 2026
febf688
chore(coordinator/tributary): fix panics
rafael-xmr Apr 15, 2026
f799da7
chore(coordinator/tributary): clippy errors
rafael-xmr Apr 15, 2026
75a1cf7
chore(coordinator/tributary): clippy errors
rafael-xmr Apr 15, 2026
32fbb59
chore(coordinator/tributary): fmt errors
rafael-xmr Apr 15, 2026
bd7de96
Checkout the `Cargo.lock` from the latest commit from `next` this des…
kayabaNerve Apr 23, 2026
c5e9e53
Merge branch 'next' into HEAD
kayabaNerve Apr 23, 2026
9353236
Use a `u64` for attempts on the Tributary
kayabaNerve Apr 23, 2026
17dba28
Correct the fix for the slash report's length exceeding `f`
kayabaNerve Apr 23, 2026
0e72ae9
Restore `Topic::required_participation`
kayabaNerve Apr 24, 2026
95b4b20
Restore `to_signed` taking a nonce
kayabaNerve Apr 24, 2026
da5e85d
Ban `borsh::from_reader` for reasons identified by @rafael-xmr
kayabaNerve Apr 24, 2026
709d04e
Tidy the test helpers
kayabaNerve Apr 23, 2026
6d64dd1
Remove the `Preprocess`, `Share`, `GenericSignPayload`, `RoundPayload…
kayabaNerve Apr 24, 2026
84e50fc
Redefine how Tributary genesis values are decided
kayabaNerve Apr 24, 2026
747bf45
Tweak some `scan_block` tests
kayabaNerve Apr 28, 2026
1d62704
Note other incongruent test
kayabaNerve Apr 28, 2026
c637c9b
Nits
kayabaNerve Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ path = "Option::map_or"
[[disallowed-methods]]
path = "Option::map_or_else"

[[disallowed-methods]]
path = "borsh::from_reader"
reason = "`borsh::from_reader` errors if there's any bytes following the read item, which isn't documented behavior"

# TODO: https://github.com/rust-lang/rust-clippy/pull/12194
[[disallowed-methods]]
path = "<ruint::Uint as core::ops::Add>::add"
Expand Down
1 change: 0 additions & 1 deletion coordinator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ zeroize = { version = "^1.5", default-features = false, features = ["std"] }
bitvec = { version = "1", default-features = false, features = ["std"] }
rand_core = { version = "0.6", default-features = false, features = ["std"] }

blake2 = { version = "0.11.0-rc.5", default-features = false, features = ["alloc"] }
schnorrkel = { version = "0.11", default-features = false, features = ["std"] }

dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion coordinator/cosign/src/tests/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn signed_cosign(
block_hash: random_block_hash(&mut OsRng),
cosigner,
},
signature: random_bytes_64(&mut OsRng),
signature: random_bytes(&mut OsRng),
}
}

Expand Down
2 changes: 1 addition & 1 deletion coordinator/cosign/types/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn random_external_network_id(rng: &mut (impl RngCore + CryptoRng)) -> Exter

/// Generate a random global session ID (`[u8; 32]`).
pub fn random_global_session<R: RngCore + CryptoRng>(rng: &mut R) -> [u8; 32] {
serai_primitives::test_helpers::random_bytes_32(rng)
serai_primitives::test_helpers::random_bytes(rng)
}

/// Generate a random [`Cosign`] for testing.
Expand Down
6 changes: 3 additions & 3 deletions coordinator/src/dkg_confirmation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ fn handle_frost_error<T>(result: Result<T, FrostError>) -> Result<T, Participant

#[rustfmt::skip]
enum Signer {
Preprocess { attempt: u32, seed: CachedPreprocess, preprocess: [u8; 64] },
Preprocess { attempt: u64, seed: CachedPreprocess, preprocess: [u8; 64] },
Share {
attempt: u32,
attempt: u64,
musig_validators: Vec<SeraiAddress>,
share: [u8; 32],
machine: Box<AlgorithmSignatureMachine<Ristretto, Schnorrkel>>,
Expand Down Expand Up @@ -151,7 +151,7 @@ impl<CD: DbTrait, TD: DbTrait> ConfirmDkgTask<CD, TD> {
fn preprocess(
db: &mut CD,
set: ExternalValidatorSet,
attempt: u32,
attempt: u64,
key: Zeroizing<<Ristretto as WrappedGroup>::F>,
signer: &mut Option<Signer>,
) {
Expand Down
4 changes: 1 addition & 3 deletions coordinator/src/tributary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::sync::Arc;

use zeroize::Zeroizing;
use rand_core::OsRng;
use blake2::{digest::typenum::U32, Digest as _, Blake2s};
use ciphersuite::*;
use dalek_ff_group::Ristretto;

Expand Down Expand Up @@ -482,8 +481,7 @@ pub(crate) async fn spawn_tributary<P: P2p>(
return;
}

let genesis =
<[u8; 32]>::from(Blake2s::<U32>::digest(borsh::to_vec(&(set.serai_block, set.set)).unwrap()));
let genesis = set.tributary_genesis();

// Since the Serai block will be finalized, then cosigned, before we handle this, this time will
// be a couple of minutes stale. While the Tributary will still function with a start time in the
Expand Down
1 change: 1 addition & 0 deletions coordinator/substrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ workspace = true
[dependencies]
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }

blake2 = { version = "0.11.0-rc.5", default-features = false, features = ["alloc"] }
dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] }

serai-client-serai = { path = "../../substrate/client/serai", default-features = false }
Expand Down
35 changes: 35 additions & 0 deletions coordinator/substrate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ use std::collections::HashMap;

use borsh::{BorshSerialize, BorshDeserialize};

use blake2::{
digest::{typenum::U32, Digest as _},
Blake2b,
};
use dkg::Participant;

use serai_client_serai::abi::{
Expand Down Expand Up @@ -80,6 +84,37 @@ impl NewSetInformation {
self.participant_indexes.insert(*validator, these_is);
}
}

/// Create a new [`NewSetInformation`].
pub fn new(
set: ExternalValidatorSet,
serai_block: [u8; 32],
declaration_time: u64,
threshold: u16,
validators: Vec<(SeraiAddress, u16)>,
evrf_public_keys: Vec<([u8; 32], Vec<u8>)>,
) -> Self {
let mut result = Self {
set,
serai_block,
declaration_time,
threshold,
validators,
evrf_public_keys,
participant_indexes: Default::default(),
participant_indexes_reverse_lookup: Default::default(),
};
result.init_participant_indexes();
result
}
}

impl NewSetInformation {
/// The hash to use for the genesis of the corresponding Tributary.
pub fn tributary_genesis(&self) -> [u8; 32] {
// This MUST only hash data completely deterministic to the Substrate blockchain.
Blake2b::<U32>::digest(borsh::to_vec(self).unwrap()).into()
}
}

mod _public_db {
Expand Down
16 changes: 14 additions & 2 deletions coordinator/tributary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = fals
dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] }
schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", default-features = false, features = ["std"] }

serai-primitives = { path = "../../substrate/primitives", default-features = false, features = ["std"] }
serai-primitives = { path = "../../substrate/primitives", default-features = false, features = ["std", "test-helpers"] }

serai-db = { path = "../../common/db" }
serai-task = { path = "../../common/task", version = "0.1" }
Expand All @@ -40,7 +40,19 @@ serai-coordinator-substrate = { path = "../substrate" }

messages = { package = "serai-processor-messages", path = "../../processor/messages" }

log = { version = "0.4", default-features = false, features = ["std"] }
serai-env = { path = "../../common/env", version = "0.1.0" }

[dev-dependencies]
rand = { version = "0.8", default-features = false, features = ["std"] }
rand_chacha = { version = "0.3", default-features = false, features = ["std"] }

tendermint = { package = "tendermint-machine", path = "../tributary-sdk/tendermint" }
tributary-sdk = { path = "../tributary-sdk", features = ["tests"] }

tokio = { version = "1", default-features = false, features = ["rt", "time", "macros", "rt-multi-thread"] }

serai-task = { path = "../../common/task", features = ["test-helpers"] }
serai-substrate-tests = { path = "../../tests/substrate" }

[features]
longer-reattempts = []
Loading
Loading