Skip to content

Commit 13aec59

Browse files
committed
Merge branch 'main' into tw/netns
2 parents 6efdfd0 + a8ea3d3 commit 13aec59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+874
-240
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ jobs:
121121
run: just run_sailfish_demo
122122
- name: Test with block-maker
123123
run: just test-all
124+
- name: Test dynamic committee change
125+
run: just test-dyn-comm
124126

125127
netsim:
126128
runs-on: ubuntu-latest

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[submodule "timeboost-proto/protos"]
22
path = timeboost-proto/protos
33
url = https://github.com/EspressoSystems/timeboost-proto.git
4-
[submodule "contracts/lib/openzeppelin-contracts-upgradeable"]
5-
path = contracts/lib/openzeppelin-contracts-upgradeable
6-
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
74
[submodule "contracts"]
85
path = contracts
96
url = https://github.com/EspressoSystems/timeboost-contracts.git

Cargo.lock

Lines changed: 59 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ rust-version = "1.85.0"
3131

3232
[workspace.dependencies]
3333
aes-gcm = { version = "0.10.3" }
34-
alloy = { version = "1.0", features = ["default", "arbitrary", "k256", "serde", "rlp", "node-bindings", "getrandom", "signer-mnemonic"] }
3534
alloy-chains = "0.2"
3635
# derive feature is not exposed via `alloy`, thus has to explicitly declare here
3736
alloy-rlp = { version = "0.3.12", features = ["derive"] }
@@ -70,6 +69,7 @@ futures = { version = "0.3", default-features = false, features = ["alloc"] }
7069
generic-array = { version = "0.14.7", features = ["serde", "zeroize"] }
7170
http = "1.3.1"
7271
ipnet = { version = "2.11.0", features = ["serde"] }
72+
itertools = "0.14.0"
7373
jiff = { version = "0.2", default-features = false, features = ["serde", "std"] }
7474
minicbor = { version = "2.1.1", features = ["full"] }
7575
nohash-hasher = "0.2"
@@ -115,6 +115,20 @@ espresso-types = { git = "https://github.com/EspressoSystems/espresso-network.gi
115115
hotshot-query-service = { git = "https://github.com/EspressoSystems/espresso-network.git" }
116116
hotshot-types = { git = "https://github.com/EspressoSystems/espresso-network.git" }
117117

118+
[workspace.dependencies.alloy]
119+
version = "1.0"
120+
features = [
121+
"arbitrary",
122+
"default",
123+
"getrandom",
124+
"k256",
125+
"node-bindings",
126+
"rlp",
127+
"serde",
128+
"signer-mnemonic",
129+
"transport-ws"
130+
]
131+
118132
[profile.test]
119133
codegen-units = 16
120134
incremental = false

justfile

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ update-submodules:
1818
build_release *ARGS:
1919
cargo build --release --workspace --all-targets {{ARGS}}
2020

21+
build_release_until:
22+
cargo build --release --workspace --all-targets --features "until"
23+
2124
build_docker:
2225
docker build . -f ./docker/timeboost.Dockerfile -t timeboost:latest
2326
docker build . -f ./docker/yapper.Dockerfile -t yapper:latest
@@ -102,6 +105,7 @@ mkconfig NUM_NODES DATETIME *ARGS:
102105
--http-api "127.0.0.1:8004" \
103106
--chain-namespace 10101 \
104107
--parent-rpc-url "http://127.0.0.1:8545" \
108+
--parent-ws-url "ws://127.0.0.1:8545" \
105109
--parent-chain-id 31337 \
106110
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
107111
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
@@ -117,6 +121,7 @@ mkconfig_docker DATETIME *ARGS:
117121
--mode "increment-address" \
118122
--chain-namespace 10101 \
119123
--parent-rpc-url "http://127.0.0.1:8545" \
124+
--parent-ws-url "ws://127.0.0.1:8545" \
120125
--parent-chain-id 31337 \
121126
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
122127
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
@@ -132,6 +137,7 @@ mkconfig_nitro DATETIME *ARGS:
132137
--nitro-addr "localhost:55000" \
133138
--chain-namespace 412346 \
134139
--parent-rpc-url "http://127.0.0.1:8545" \
140+
--parent-ws-url "ws://127.0.0.1:8546" \
135141
--parent-chain-id 1337 \
136142
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
137143
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
@@ -179,9 +185,53 @@ test-all: build_release build-test-utils
179185
--run "3:scripts/deploy-test-contract test-configs/local/committee.toml http://localhost:8545" \
180186
--spawn "4:target/release/block-maker --bind 127.0.0.1:55000 -c test-configs/local/committee.toml" \
181187
--spawn "4:target/release/yapper -c test-configs/local/committee.toml" \
182-
--spawn "5:target/release/run-committee -c test-configs/local/ -t target/release/timeboost" \
188+
--spawn "5:target/release/run-committee -c test-configs/local/" \
183189
target/release/block-checker -- -c test-configs/local -b 1000
184190

191+
test-dyn-comm: build_release_until build-test-utils
192+
env RUST_LOG=sailfish=warn,timeboost=info,info target/release/run \
193+
--verbose \
194+
--timeout 120 \
195+
--spawn "1:anvil --port 8545" \
196+
--run "2:sleep 2" \
197+
--run "3:scripts/deploy-test-contract test-configs/local/committee.toml http://localhost:8545" \
198+
--spawn "4:target/release/run-committee -c test-configs/c0/ --until 2000" \
199+
--run "5:target/release/mkconfig -n 4 \
200+
--committee-id 1 \
201+
--public-addr 127.0.0.1:9000 \
202+
--internal-addr 127.0.0.1:9003 \
203+
--http-api 127.0.0.1:9004 \
204+
--chain-namespace 10101 \
205+
--parent-rpc-url http://127.0.0.1:8545 \
206+
--parent-ws-url ws://127.0.0.1:8545 \
207+
--parent-chain-id 31337 \
208+
--parent-ibox-contract 0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1 \
209+
--key-manager-contract 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
210+
--timestamp +16s \
211+
--stamp-dir /tmp \
212+
--output test-configs/c1" \
213+
--run "6:sleep 6" \
214+
--run "7:target/release/register \
215+
-a threshold-enc-key \
216+
-m 'attend year erase basket blind adapt stove broccoli isolate unveil acquire category' \
217+
-u http://localhost:8545 \
218+
-k 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
219+
-c test-configs/c0/committee.toml" \
220+
--run "8:target/release/register \
221+
-a new-committee \
222+
-m 'attend year erase basket blind adapt stove broccoli isolate unveil acquire category' \
223+
-u http://localhost:8545 \
224+
-k 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
225+
-c test-configs/c1/committee.toml" \
226+
--spawn "9:target/release/yapper \
227+
--config test-configs/c1/committee.toml \
228+
--parent-url http://localhost:8545 \
229+
--key-manager-contract 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
230+
target/release/run-committee -- \
231+
-c test-configs/c1/ \
232+
--until 800 \
233+
--required-decrypt-rounds 3 && rm -rf test-configs/c1
234+
185235
[linux]
186236
forward-ipv4 val: build-test-utils
187237
{{run_as_root}} target/release/net-setup system --forward-ipv4 {{val}}
@@ -220,5 +270,5 @@ netsim: build_release build-test-utils
220270
--run "3:scripts/deploy-test-contract test-configs/linux/committee.toml http://10.0.1.0:8545" \
221271
--spawn "4:target/release/block-maker --bind 10.0.1.0:55000 -c test-configs/linux/committee.toml" \
222272
--spawn "4:target/release/yapper -c test-configs/linux/committee.toml" \
223-
--spawn-as-root "5:target/release/run-committee -u $(id -u) -g $(id -g) -c test-configs/linux/ -t target/release/timeboost" \
273+
--spawn-as-root "5:target/release/run-committee -u $(id -u) -g $(id -g) -c test-configs/linux/" \
224274
target/release/block-checker -- -c test-configs/linux -b 200

multisig/src/committee.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::num::{NonZeroUsize, ParseIntError};
2+
use std::ops::{Add, Sub};
23
use std::{fmt, str::FromStr};
34

45
use std::sync::Arc;
@@ -107,6 +108,7 @@ impl Committee {
107108
#[derive(
108109
Debug,
109110
Copy,
111+
Default,
110112
Clone,
111113
PartialEq,
112114
Eq,
@@ -163,3 +165,19 @@ impl Committable for CommitteeId {
163165
.finalize()
164166
}
165167
}
168+
169+
impl Add<u64> for CommitteeId {
170+
type Output = Self;
171+
172+
fn add(self, rhs: u64) -> Self::Output {
173+
Self(self.0 + rhs)
174+
}
175+
}
176+
177+
impl Sub<u64> for CommitteeId {
178+
type Output = Self;
179+
180+
fn sub(self, rhs: u64) -> Self::Output {
181+
Self(self.0 - rhs)
182+
}
183+
}

scripts/deploy-test-contract

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ km_addr=$(sed -nr 's/^key_manager.*=.*"(.+)"/\1/p' "$DEPLOYMENT_FILE")
2424

2525
# Update the contract
2626
env RUST_LOG=info target/release/register \
27+
-a new-committee \
2728
-m "$MANAGER_MNEMONIC" \
2829
-i "$MANAGER_ACCOUNT_INDEX" \
2930
-u "$URL" \

scripts/run-timeboost-demo

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ i=0
116116
for f in "$config_dir"/node_*.toml; do
117117
cmd=(target/release/timeboost
118118
--committee-id 0
119-
--committee "$config_dir/committee.toml"
120119
--config "$f"
121120
--until $rounds
122121
--watchdog-timeout 120)

0 commit comments

Comments
 (0)