Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
44be0c1
conf: add ws endpoint in chain config
alxiong Sep 11, 2025
574b134
trigger set_next_committee by contract event
alxiong Sep 11, 2025
8c90d16
Merge remote-tracking branch 'origin/main' into ax/event-stream
alxiong Sep 11, 2025
3943601
use 8546 for nitro ws port
alxiong Sep 12, 2025
4224986
test: unit test for log event stream
alxiong Sep 12, 2025
0b70ae7
use Latest tag for test chain
alxiong Sep 12, 2025
195ff4a
Merge remote-tracking branch 'origin/main' into ax/event-stream
alxiong Sep 12, 2025
21ce864
add ws endpoint to test-configs/local
alxiong Sep 12, 2025
3d05908
add dynamic committee integration test
alxiong Sep 12, 2025
f52988d
maybe work
lukeiannucci Sep 12, 2025
8b8e8cf
500
lukeiannucci Sep 12, 2025
0277089
Merge branch 'main' into ax/event-stream
lukeiannucci Sep 12, 2025
2488c60
add register threshold-enc-key functionality
alxiong Sep 15, 2025
921807b
yapper optionally read enc_key from contract
alxiong Sep 15, 2025
7d95f46
scan from genesis for test, not missing any events
alxiong Sep 15, 2025
d07f98e
fix: sync prev committee during sequencerconfig derivation
alxiong Sep 15, 2025
f9651fa
fix: enough time for resharing
alxiong Sep 16, 2025
2f2dda0
Merge remote-tracking branch 'origin/main' into ax/event-stream
alxiong Sep 16, 2025
9e56d2f
remove tmp c1 configs, disambiguate --committee-id flag
alxiong Sep 16, 2025
8c10bda
minor fix
alxiong Sep 16, 2025
4fb6b12
update register, allow __SPACE__ for multi-word argument in run
alxiong Sep 16, 2025
04e216a
context err when parsing peer info
alxiong Sep 16, 2025
d07bd02
Merge remote-tracking branch 'origin/main' into ax/event-stream
alxiong Sep 17, 2025
b75a0b3
modularize committee sync and event stream logic
alxiong Sep 17, 2025
76c2277
mkconfig accept +20s, run.rs accepts single quoted multi-words
alxiong Sep 18, 2025
4547bcb
Stream<CommitteeInfo> and separating pubsub backend handle
alxiong Sep 19, 2025
45e62c2
Merge remote-tracking branch 'origin/main' into ax/event-stream
alxiong Sep 19, 2025
d4d1e3c
account for faster local run
alxiong Sep 19, 2025
fbc48a5
improve code quality
alxiong Sep 19, 2025
c153532
use registeredBlkNum from contract for from_block
alxiong Sep 19, 2025
d48f068
minor fix
alxiong Sep 19, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ jobs:
run: just run_sailfish_demo
- name: Test with block-maker
run: just test-all
- name: Test dynamic committee change
run: just test-dyn-comm

contracts:
runs-on: ubuntu-latest
Expand Down
74 changes: 66 additions & 8 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rust-version = "1.85.0"

[workspace.dependencies]
aes-gcm = { version = "0.10.3" }
alloy = { version = "1.0", features = ["default", "arbitrary", "k256", "serde", "rlp", "node-bindings", "getrandom", "signer-mnemonic"] }
alloy = { version = "1.0", features = ["default", "arbitrary", "k256", "serde", "rlp", "node-bindings", "getrandom", "signer-mnemonic", "transport-ws"] }
alloy-chains = "0.2"
# derive feature is not exposed via `alloy`, thus has to explicitly declare here
alloy-rlp = { version = "0.3.12", features = ["derive"] }
Expand Down Expand Up @@ -69,6 +69,7 @@ ethereum_ssz = "0.9.0"
futures = { version = "0.3", default-features = false, features = ["alloc"] }
generic-array = { version = "0.14.7", features = ["serde", "zeroize"] }
http = "1.3.1"
itertools = "0.14.0"
jiff = { version = "0.2", default-features = false, features = ["serde", "std"] }
minicbor = { version = "2.1.1", features = ["full"] }
nohash-hasher = "0.2"
Expand Down
57 changes: 56 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ update-submodules:
build_release *ARGS:
cargo build --release --workspace --all-targets {{ARGS}}

build_release_until:
cargo build --release --workspace --all-targets --features "until"

build_docker:
docker build . -f ./docker/timeboost.Dockerfile -t timeboost:latest
docker build . -f ./docker/yapper.Dockerfile -t yapper:latest
Expand Down Expand Up @@ -103,6 +106,7 @@ mkconfig NUM_NODES DATETIME *ARGS:
--http-api "127.0.0.1:8004" \
--chain-namespace 10101 \
--parent-rpc-url "http://127.0.0.1:8545" \
--parent-ws-url "ws://127.0.0.1:8545" \
--parent-chain-id 31337 \
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
Expand All @@ -118,6 +122,7 @@ mkconfig_docker DATETIME *ARGS:
--mode "increment-address" \
--chain-namespace 10101 \
--parent-rpc-url "http://127.0.0.1:8545" \
--parent-ws-url "ws://127.0.0.1:8545" \
--parent-chain-id 31337 \
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
Expand All @@ -133,6 +138,7 @@ mkconfig_nitro DATETIME *ARGS:
--nitro-addr "localhost:55000" \
--chain-namespace 412346 \
--parent-rpc-url "http://127.0.0.1:8545" \
--parent-ws-url "ws://127.0.0.1:8546" \
--parent-chain-id 1337 \
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
Expand Down Expand Up @@ -179,9 +185,58 @@ test-all: build_release build-test-utils
--run "3:scripts/deploy-test-contract" \
--spawn "4:target/release/block-maker --port 55000 --committee test-configs/local/committee.toml" \
--spawn "4:target/release/yapper --keyset-file test-configs/local/committee.toml" \
--spawn "5:target/release/run-committee --configs test-configs/local/ --committee 0 --timeboost target/release/timeboost" \
--spawn "5:target/release/run-committee --configs test-configs/local/ --committee-id 0 --timeboost target/release/timeboost" \
target/release/block-checker -- \
--config test-configs/local/node_0.toml \
--committee test-configs/local/committee.toml \
--committee-id 0 \
--blocks 1000

test-dyn-comm: build_release_until build-test-utils
env RUST_LOG=sailfish=warn,yapper=error,timeboost=info,info target/release/run \
--verbose \
--timeout 120 \
--spawn "1:anvil --port 8545" \
--run "2:sleep 2" \
--run "3:scripts/deploy-test-contract" \
--spawn "4:target/release/run-committee --configs test-configs/c0/ --committee-id 0 --until 1600" \
--run "5:target/release/mkconfig -n 4 \
--public-addr 127.0.0.1:9000 \
--internal-addr 127.0.0.1:9003 \
--http-api 127.0.0.1:9004 \
--chain-namespace 10101 \
--parent-rpc-url http://127.0.0.1:8545 \
--parent-ws-url ws://127.0.0.1:8545 \
--parent-chain-id 31337 \
--parent-ibox-contract 0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1 \
--key-manager-contract 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
--timestamp `just now-plus-20s` \
--stamp-dir /tmp \
--output test-configs/c1" \
--run "6:sleep 8" \
--run "7:target/release/register \
-a threshold-enc-key \
-m attend__SPACE__year__SPACE__erase__SPACE__basket__SPACE__blind__SPACE__adapt__SPACE__stove__SPACE__broccoli__SPACE__isolate__SPACE__unveil__SPACE__acquire__SPACE__category \
-u http://localhost:8545 \
-k 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
-c test-configs/c0/committee.toml" \
--run "8:target/release/register \
-a new-committee \
-m attend__SPACE__year__SPACE__erase__SPACE__basket__SPACE__blind__SPACE__adapt__SPACE__stove__SPACE__broccoli__SPACE__isolate__SPACE__unveil__SPACE__acquire__SPACE__category \
-u http://localhost:8545 \
-k 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
-c test-configs/c1/committee.toml" \
--spawn "9:target/release/yapper \
--keyset-file test-configs/c1/committee.toml \
--parent-url http://localhost:8545 \
--key-manager-contract 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
target/release/run-committee -- \
--configs test-configs/c1/ \
--committee-id 1 \
--until 800 \
--required-decrypt-rounds 3 && rm -rf test-configs/c1

# portable calculation of now() + 20s in "%Y-%m-%dT%H:%M:%SZ" format
[private]
now-plus-20s:
@python3 -c 'from datetime import datetime, timedelta, timezone; print((datetime.now(timezone.utc)+timedelta(seconds=20)).strftime("%Y-%m-%dT%H:%M:%SZ"))'
1 change: 1 addition & 0 deletions scripts/deploy-test-contract
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ km_addr=$(sed -nr 's/^key_manager.*=.*"(.+)"/\1/p' "$DEPLOYMENT_FILE")

# Update the contract
env RUST_LOG=info cargo run --release --bin register -- \
-a new-committee \
-m "$MANAGER_MNEMONIC" \
-i "$MANAGER_ACCOUNT_INDEX" \
-u "$URL" \
Expand Down
1 change: 0 additions & 1 deletion scripts/run-timeboost-demo
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ i=0
for f in "$config_dir"/node_*.toml; do
cmd=(target/release/timeboost
--committee-id 0
--committee "$config_dir/committee.toml"
--config "$f"
--until $rounds
--watchdog-timeout 120)
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-contract-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ km_addr=$(sed -nr 's/^key_manager.*=.*"(.+)"/\1/p' "$DEPLOYMENT_FILE")

# Update the contract
committee_config="test-configs/$COMMITTEE_PATH/committee.toml"
RUST_LOG=info cargo run --release --bin register -- -m "$MANAGER_MNEMONIC" -i "$MANAGER_ACCOUNT_INDEX" -u "$URL" -k "$km_addr" -c "$committee_config"
RUST_LOG=info cargo run --release --bin register -- -a new-committee -m "$MANAGER_MNEMONIC" -i "$MANAGER_ACCOUNT_INDEX" -u "$URL" -k "$km_addr" -c "$committee_config"

# Finally, clean up the temporary deployment file
rm -f "$DEPLOYMENT_FILE"
8 changes: 4 additions & 4 deletions test-configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ To generate configs for all nodes in a new committee:

``` sh
# see mkconfig.rs Args or `mkconfig --help` for more options
just mkconfig 5 2025-01-09T02:00:00Z --seed 42
just mkconfig 13 2025-01-09T02:00:00Z --nitro-addr "localhost:55000"
just mkconfig 5 2025-09-01T02:00:00Z --seed 42
just mkconfig 13 2025-09-01T02:00:00Z --nitro-addr "localhost:55000"

# recipe for docker env is fixed at 5 nodes
just mkconfig_docker 2025-01-09T02:00:00Z --seed 42
just mkconfig_docker 2025-09-01T02:00:00Z --seed 42

# recipe for nitro CI test, fixed at 2 nodes with nitro chain config
just mkconfig_nitro 2025-01-09T02:00:00Z --seed 42
just mkconfig_nitro 2025-09-01T02:00:00Z --seed 42
```

### On test wallet mnemonic
Expand Down
1 change: 1 addition & 0 deletions test-configs/c0/node_0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace = 10101
[chain.parent]
id = 31337
rpc-url = "http://127.0.0.1:8545/"
ws-url = "ws://127.0.0.1:8545/"
ibox-contract = "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1"
block-tag = "finalized"
key-manager-contract = "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35"
Expand Down
1 change: 1 addition & 0 deletions test-configs/c0/node_1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace = 10101
[chain.parent]
id = 31337
rpc-url = "http://127.0.0.1:8545/"
ws-url = "ws://127.0.0.1:8545/"
ibox-contract = "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1"
block-tag = "finalized"
key-manager-contract = "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35"
Expand Down
Loading