-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add randomness to pallet-collator-assignment (#267)
* Add randomness to pallet-collator-assignment * Mock randomness inherent in tests * Do not shuffle collators if seed is 0 * Merge the functions to add and fill new container chains into one * Rotate collators according to config param * Use per-block randomness instead of per-epoch randomness * Dont check collator2002-01 dbpath Because a different collator may be assigned to container 2002 * Add zombie_tanssi_rotation test suite * Unit test collator assignment rotation * Fix integration test by killing storage value * Rename para-rotation suite to avoid moonwall bug * Increase zombienet test timeout * Mix subject with relay randomness, and fix bug all seeds starting with 1 There was a bug because we tried to read an Option<Hash> as a Hash, and this results in the first byte of the [u8; 32] being always 1, which is the marker for "Some" * Fix collators rotating 1 block too early * Add event CollatorAssignment::NewPendingAssignment * Fix tests after 1.1.0 upgrade * Make full_rotation_period configurable, defined in pallet_configuration * Use fast_or_prod macro to set full_rotation_period = 5 for tests * Store randomness from previous relay block in pallet storage Because since #288 collator rotation is handled in on_initialize, and we can only read the relay randomness after the set_validation_data inherent, which happens after on_initialize. The solution is to read the randomness on the on_finalize hook of the previous block, store it in pallet_collator_assignment, and delete it when reading it. * Change para-rotation test to rotate every 5 sessions instead of every 1 Rotating every session does not leave enough time for collators to detect their assignment, and some tests result in timeout * Rewrite migration using get_raw and put_raw * Rotation period of 0 disables rotation
- Loading branch information
1 parent
93cfc2f
commit 850faaf
Showing
31 changed files
with
2,159 additions
and
678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,6 +440,61 @@ jobs: | |
name: logs | ||
path: logs | ||
|
||
zombienet-tests-rotation: | ||
runs-on: self-hosted | ||
needs: ["set-tags", "build"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.set-tags.outputs.git_ref }} | ||
|
||
- name: Pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
cache: "pnpm" | ||
|
||
- name: "Download binaries" | ||
uses: actions/[email protected] | ||
with: | ||
name: binaries | ||
path: target/release | ||
|
||
- name: "Run zombie test" | ||
run: | | ||
chmod uog+x target/release/tanssi-node | ||
chmod uog+x target/release/container-chain-template-simple-node | ||
chmod uog+x target/release/container-chain-template-frontier-node | ||
cd test | ||
pnpm install | ||
## Run tests | ||
pnpm moonwall test zombie_tanssi_rotation | ||
- name: "Gather zombie logs" | ||
if: failure() | ||
run: | | ||
ls -ltr /tmp | ||
latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") | ||
logs_dir="logs" | ||
mkdir -p "$logs_dir" | ||
find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; | ||
- name: "Upload zombie logs" | ||
if: failure() | ||
uses: actions/[email protected] | ||
with: | ||
name: logs-rotation | ||
path: logs | ||
|
||
zombienet-tests-warp-sync: | ||
runs-on: ubuntu-latest | ||
needs: ["set-tags", "build"] | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.