Skip to content

Commit 3d05908

Browse files
committed
add dynamic committee integration test
1 parent 21ce864 commit 3d05908

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ jobs:
141141
run: just run_sailfish_demo
142142
- name: Test with block-maker
143143
run: just test-all
144+
- name: Test dynamic committee change
145+
run: just test-dyn-comm
144146

145147
contracts:
146148
runs-on: ubuntu-latest

justfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,42 @@ test-all: build_release build-test-utils
188188
--committee test-configs/local/committee.toml \
189189
--committee-id 0 \
190190
--blocks 1000
191+
192+
test-dyn-comm: build_release build-test-utils
193+
env RUST_LOG=info target/release/run \
194+
--verbose \
195+
--timeout 120 \
196+
--spawn "1:anvil --port 8545" \
197+
--run "2:sleep 2" \
198+
--run "3:scripts/deploy-test-contract" \
199+
--spawn "4:target/release/yapper --keyset-file test-configs/c0/committee.toml" \
200+
--spawn "5:target/release/run-committee --configs test-configs/c0/ --committee 0" \
201+
--run "6:target/release/mkconfig -n 6 \
202+
--public-addr '127.0.0.1:9000' \
203+
--internal-addr '127.0.0.1:9003' \
204+
--http-api '127.0.0.1:9004' \
205+
--chain-namespace 10101 \
206+
--parent-rpc-url 'http://127.0.0.1:8545' \
207+
--parent-ws-url 'ws://127.0.0.1:8545' \
208+
--parent-chain-id 31337 \
209+
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
210+
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
211+
--timestamp '`just now-plus-20s`' \
212+
--stamp-dir '/tmp' \
213+
--output 'test-configs/c1'" \
214+
--run "7:target/release/register -m 'attend year erase basket blind adapt stove broccoli isolate unveil acquire category' \
215+
-i 0 \
216+
-u 'http://localhost:8545' \
217+
-k '0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35' \
218+
-c 'test-configs/c1/committee.toml'" \
219+
--run "8:pkill -9 yapper && target/release/yapper --keyset-file test-configs/c1/committee.toml" \
220+
target/release/run-committee --configs test-configs/c1 \
221+
--committee 1 \
222+
--until 800 \
223+
--required-decrypt-rounds 3 && rm -rf test-configs/c1
224+
225+
226+
# portable calculation of now() + 20s in "%Y-%m-%dT%H:%M:%SZ" format
227+
[private]
228+
now-plus-20s:
229+
@python3 -c 'from datetime import datetime, timedelta, timezone; print((datetime.now(timezone.utc)+timedelta(seconds=20)).strftime("%Y-%m-%dT%H:%M:%SZ"))'

test-utils/src/binaries/run-committee.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ struct Args {
1313
#[clap(long, short)]
1414
committee: u64,
1515

16-
#[clap(long, short)]
16+
#[clap(long, short, default_value = "target/release/timeboost")]
1717
timeboost: PathBuf,
1818

1919
#[clap(long, short, default_value = "/tmp")]
2020
tmp: PathBuf,
21+
22+
#[clap(long)]
23+
until: Option<u64>,
24+
25+
#[clap(long)]
26+
required_decrypt_rounds: Option<u64>,
2127
}
2228

2329
#[tokio::main]
@@ -52,6 +58,12 @@ async fn main() -> Result<()> {
5258
.arg("--config")
5359
.arg(entry.path())
5460
.arg("--ignore-stamp");
61+
if let Some(until) = args.until {
62+
cmd.arg("--until").arg(until.to_string());
63+
}
64+
if let Some(r) = args.required_decrypt_rounds {
65+
cmd.arg("--required-decrypt-rounds").arg(r.to_string());
66+
}
5567
commands.push(cmd);
5668
}
5769

0 commit comments

Comments
 (0)