Commit 5d7761a
coordinator/tributary tests (#783)
* feat: add task delay tests
* feat: add intend task tests
* feat(cosign): improve delay iteration txn use, sanity check timestamp, avoid overflow panic
* feat(cosign): refactor intend tests, add better test cases
* fix: the txn commit behavior on delay and even better tests
* feat(cosign): more delay improvements & refactor test into traits
* refactor(cosign): more refactors
* refactor(cosign): minor refactors
* feat(cosign): intend changes, add evaluator
* fix: test failures
* feat(cosign): more tests
* refactor(cosign): simpliy & cleanup delay tests
* feat(cosign): types tests
* refactor(cosign): simpliy, cleanup & get tests ready
* chore(cosign): merge issues
* misc
* Revert "misc"
This reverts commit 4a1cf91.
* misc
* misc2
* feat: adding rpc harness
* feat(cosign): skip 0 stake vsets
* feat(cosign): remove unwanted addition
* chore(log): wrong license
* feat(cosign): misc log & comments
* feat: add test libs & end clean up cosign tests
* feat(tributary): begin tests based off cosign
* feat(tributary): finish transaction.rs tests and add db.rs tests
* feat(tributary): add more db.rs tests
* feat(tributary): add initial scan_block.rs tests
Identified bugs:
- panic in Accumulated::<D>::get
- panic in assert!(slash_report.len() <= f);
* refactor(tributary): move utils to mod.rs
* feat(tributary): refactor db tests, improve handling of overflow attempts and add test cases
* misc
* feat(coordinator/cosign): adding full-stack tests
* feat(env): move serai_log into serai_env
* feat(tests/shim-rpc): add random failure rate
* feat(coordinator/cosign): more touch ups & fix evaluate -> delay flow for no events
* feat(coordinator/cosign): full_stack.rs tests
* feat(coordinator/cosign): initial review changes
* feat(coordinator/cosign): more review comment changes
* refactor(common/task): move test helpers from external crate
* refactor(coordinator/cosign): self-reviewing & cleaning up
* some misc
* refactor(coordinator/cosign): self-reviewing & cleaning up tests
* feat(cosign/tests/full_stack): add dos offline cosigns stall scenario & re-word readme.md
* refactor(coordinator/tributary): bringing in updates from cosign work, refactoring & improving some tests
* feat(coordinator/tributary): adding changes and new test cases
* feat(coordinator/tributary): finish the coverage adding scanning block and scanning tributary tests
* feat(substrate/test_helpers): missing test utility
* chore(coordinator/tributary): initial self-review by comparing changes
* chore(coordinator/tributary): missing misc
* chore: ci alerts
* chore(coordinator/tributary): fix match same arms
* chore: lock
* chore(coordinator/tributary): clippy errors
* chore(coordinator/tributary): clippy errors
* chore(coordinator/tributary): fix panics
* chore(coordinator/tributary): clippy errors
* chore(coordinator/tributary): clippy errors
* chore(coordinator/tributary): fmt errors
* Checkout the `Cargo.lock` from the latest commit from `next` this descends from
This reverts a myriad of `cargo update`s.
* Use a `u64` for attempts on the Tributary
A `u32`, when incremented by one, is technically feasible to overflow. This PR
changed it to return `None` for the next topic if it did overflow, but that'd
technically stop creating topics for ongoing protocols. This transformed a
panic (which would crash the entire `coordinator`) into a liveness failure for
this specific Tributary due to inaccurately claiming there was no next topic
(an unsound definition which would become a more localized liveness issue).
This uses a `u64` to ensure this state is unreachable when started from zero,
and incremented by one, unless so many years pass this is definitively
irrelevant.
* Correct the fix for the slash report's length exceeding `f`
Only pushing some elements meant that this vector no longer corresponded to the
list of validators. Since each element wasn't paired with a validator's ID, it
became meaningless. The `assert` which triggered was the underlying fault, and
it's been adjusted to only check the amount of non-zero elements is now less
than or equal to `f`.
* Restore `Topic::required_participation`
While it currently _can_ be collapsed to the function `required_participation`,
the ability for per-topic thresholds is desired.
The calculation is also updated to be infallible.
* Restore `to_signed` taking a nonce
Moving to `SigningProtocolRound` would be nice if all such transactions fit
that model. As shown, not all transactions do. Kludging them into
`SigningProtocolRound` isn't preferred, and it appears to have been improperly
done for `SigningProtocolRound` (causing a `clippy` lint which was allowed).
* Ban `borsh::from_reader` for reasons identified by @rafael-xmr
* Tidy the test helpers
Some are made more flexible, removing the need for other approximate variants.
Test helpers which encoded a non-syntactic semantic context via their name have
been removed outright, especially as `substrate/primitives` shouldn't have
helpers for Coordinator-specific definitions which may not be universal or
applicable to the Substrate context.
Similarly, these should likely be moved to `tests/helpers` where we have more
flexibility. We want to publish `substrate/primitives` but I couldn't care less
about the idea of publishing these test helpers and committing to them under
our API in any way. While the `Cargo.toml` already has a comment on the
`test-helpers` feature, their own crate entirely avoid any contamination here.
* Remove the `Preprocess`, `Share`, `GenericSignPayload`, `RoundPayloads` type aliases
I understand the intent. Unfortunately, these definitions were incorrect.
For a FROST protocol over Ristretto, the preprocess will be 64 bytes and the
share 32 bytes. This is used for the DKG confirmation, batches, where the
former hard-coded such a definition. For batches, the process is routed via
`VariantSignId` where the same processing occurs for transactions. Signing
transactions on external networks has a preprocess, share, of length variable
to the external network and its signing protocol. For Ethereum, it'd be a
66-byte preprocess and 32-byte share. For Bitcoin, it's a 64-byte preprocess
and 32-byte share _per input_ (concatenated into a single byte blob). For
Monero, it's a 160-byte preprocess and 32-byte share _per input_ (again so
concatenated).
* Redefine how Tributary genesis values are decided
The tests in `coordinator/tributary/src/tests/scan_tributary.rs` demonstrated
creating a tributary with one `NewSetInformation`, before reading from it with
another, which should be obviously invalid? `NewSetInformation::genesis` has
been added to make the genesis deterministic and binding to the
`NewSetInformation`, allowing the `ScanTributaryTask` to check its initialized
with values consistent to how the Tributary itself was initialized.
This updates the cited tests accordingly.
* Tweak some `scan_block` tests
One has an unclear story. Others have a pattern of checking a single message
(less than the threshold) causes no events, but doesn't check all messages less
than the threshold cause no events.
* Note other incongruent test
* Nits
Some of these fix behavior which was updated with prior commits, but for which
all the tests/cases had yet to be updated.
---------
Co-authored-by: Luke Parker <lukeparker5132@gmail.com>1 parent 7420f68 commit 5d7761a
23 files changed
Lines changed: 4157 additions & 89 deletions
File tree
- coordinator
- cosign
- src/tests
- types/src/tests
- src
- substrate
- src
- tributary
- src
- tests
- processor
- ethereum/src/primitives
- frost-attempt-manager/src
- messages/src
- substrate/primitives/src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
482 | 481 | | |
483 | 482 | | |
484 | 483 | | |
485 | | - | |
486 | | - | |
| 484 | + | |
487 | 485 | | |
488 | 486 | | |
489 | 487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
83 | 118 | | |
84 | 119 | | |
85 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
0 commit comments