Skip to content

Commit 72c0999

Browse files
authored
Merge pull request #532 from EspressoSystems/tw/more-cleanup
Add committee ID to node config.
2 parents 986f37d + f0347d4 commit 72c0999

39 files changed

+222
-352
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
- name: Run tests with late-start node
119119
run: just run_demo -l --ignore-stamp --yapper -c test-configs/c0
120120
- name: Run sailfish demo
121-
run: just run_sailfish_demo
121+
run: just run-sailfish-demo
122122
- name: Test with block-maker
123123
run: just test-all
124124
- name: Test dynamic committee change

docker-compose.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ services:
2020
image: timeboost:latest
2121
environment:
2222
- RUST_LOG=debug
23-
entrypoint: ["/app/deploy-contract-docker"]
23+
entrypoint: [
24+
"/app/deploy-contract",
25+
"-d", "/app/deploy",
26+
"-r", "/app/register",
27+
"-c", "committee.toml",
28+
"-u", "http://172.20.0.11:8545"
29+
]
2430
depends_on:
2531
demo-l1-network:
2632
condition: service_healthy
@@ -95,7 +101,7 @@ services:
95101
- "8032:8001"
96102
- "8062:8002"
97103
- "8082:8003"
98-
- "8102:8004"
104+
- "8102:8004"
99105
- "8802:8800"
100106
- "9002:9000"
101107
depends_on:
@@ -120,7 +126,7 @@ services:
120126
- "8033:8001"
121127
- "8063:8002"
122128
- "8083:8003"
123-
- "8103:8004"
129+
- "8103:8004"
124130
- "8803:8800"
125131
- "9003:9000"
126132
depends_on:
@@ -145,7 +151,7 @@ services:
145151
- "8034:8001"
146152
- "8064:8002"
147153
- "8084:8003"
148-
- "8104:8004"
154+
- "8104:8004"
149155
- "8804:8800"
150156
- "9004:9000"
151157
depends_on:
@@ -155,7 +161,7 @@ services:
155161
image: timeboost:latest
156162
ports:
157163
- "55000:55000"
158-
command:
164+
command:
159165
[
160166
"/app/block-maker",
161167
"--port", "55000",

docker/timeboost.Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ COPY --from=builder /app/target/release/register .
3030
COPY --from=builder /app/target/release/deploy .
3131
COPY --from=builder /app/target/release/block-maker .
3232
COPY --from=builder /app/target/release/block-checker .
33-
COPY --from=builder /app/scripts/deploy-contract-docker .
33+
COPY --from=builder /app/scripts/deploy-contract .
3434

3535
COPY --from=builder /app/test-configs/docker .
3636

@@ -40,7 +40,14 @@ COPY --from=builder /root/.foundry/bin/cast /usr/local/bin/cast
4040
RUN chmod +x /usr/local/bin/forge /usr/local/bin/cast
4141

4242
# Set ownership of application files and make binary executable
43-
RUN chown -R timeboostuser:appgroup /app && chmod +x /app/timeboost /app/yapper /app/register /app/deploy /app/deploy-contract-docker /app/block-maker /app/block-checker
43+
RUN chown -R timeboostuser:appgroup /app && chmod +x \
44+
/app/timeboost \
45+
/app/yapper \
46+
/app/register \
47+
/app/deploy \
48+
/app/deploy-contract \
49+
/app/block-maker \
50+
/app/block-checker
4451

4552
# Switch to non-root user
4653
USER timeboostuser

justfile

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fix:
6464
ci_local:
6565
just build && just lint && just test_ci --release && \
6666
just run_demo --ignore-stamp --yapper -c test-configs/c0 && \
67-
just run_sailfish_demo && just build_docker
67+
just run-sailfish-demo && just build_docker
6868

6969
bacon: clippy check fmt
7070

@@ -88,8 +88,17 @@ stop_monitoring:
8888
run_demo *ARGS:
8989
scripts/run-timeboost-demo {{ARGS}}
9090

91-
run_sailfish_demo *ARGS:
92-
scripts/run-sailfish-demo {{ARGS}}
91+
run-sailfish-demo: build-test-utils build_release
92+
env RUST_LOG=sailfish=info,warn \
93+
target/release/run --verbose \
94+
--spawn "1:anvil --port 8545" \
95+
--run "2:sleep 3" \
96+
--run "3:scripts/deploy-contract -c test-configs/c0/committee.toml -u http://localhost:8545" \
97+
--spawn "4:target/release/sailfish -c test-configs/c0/node_0.toml --stamp /tmp/stamp-0.sf --ignore-stamp" \
98+
--spawn "4:target/release/sailfish -c test-configs/c0/node_1.toml --stamp /tmp/stamp-1.sf --ignore-stamp" \
99+
--spawn "4:target/release/sailfish -c test-configs/c0/node_2.toml --stamp /tmp/stamp-2.sf --ignore-stamp" \
100+
--spawn "4:target/release/sailfish -c test-configs/c0/node_3.toml --stamp /tmp/stamp-3.sf --ignore-stamp" \
101+
target/release/sailfish -- -c test-configs/c0/node_4.toml --stamp /tmp/stamp-4.sf --ignore-stamp --until 300
93102

94103
run *ARGS:
95104
cargo run {{ARGS}}
@@ -99,6 +108,7 @@ bench *ARGS:
99108

100109
mkconfig NUM_NODES DATETIME *ARGS:
101110
cargo run --release --bin mkconfig -- -n {{NUM_NODES}} \
111+
--committee-id 0 \
102112
--public-addr "127.0.0.1:8000" \
103113
--internal-addr "127.0.0.1:8003" \
104114
--http-api "127.0.0.1:8004" \
@@ -114,22 +124,27 @@ mkconfig NUM_NODES DATETIME *ARGS:
114124

115125
mkconfig_docker DATETIME *ARGS:
116126
cargo run --release --bin mkconfig -- -n 5 \
127+
--committee-id 0 \
117128
--public-addr "172.20.0.2:8000" \
118129
--internal-addr "172.20.0.2:8003" \
119130
--http-api "172.20.0.2:8004" \
131+
--nitro-addr "172.20.0.12:55000" \
120132
--mode "increment-address" \
121133
--chain-namespace 10101 \
122-
--parent-rpc-url "http://172.20.0.12:8545" \
123-
--parent-ws-url "ws://172.20.0.12:8545" \
134+
--parent-rpc-url "http://172.20.0.11:8545" \
135+
--parent-ws-url "ws://172.20.0.11:8546" \
124136
--parent-chain-id 31337 \
125137
--parent-ibox-contract "0xa0f3a1a4e2b2bcb7b48c8527c28098f207572ec1" \
126138
--key-manager-contract "0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
127139
--timestamp {{DATETIME}} \
128140
--stamp-dir "/tmp" \
141+
--espresso-base-url "http://172.20.0.14:41000/v1/" \
142+
--espresso-websocket-url "ws://172.20.0.14:41000/v1/" \
129143
--output "test-configs/docker" {{ARGS}}
130144

131145
mkconfig_nitro DATETIME *ARGS:
132146
cargo run --release --bin mkconfig -- -n 2 \
147+
--committee-id 0 \
133148
--public-addr "127.0.0.1:8000" \
134149
--internal-addr "0.0.0.0:8003" \
135150
--http-api "127.0.0.1:8004" \
@@ -181,7 +196,7 @@ test-all: build_release build-test-utils
181196
--timeout 120 \
182197
--spawn "1:anvil --port 8545" \
183198
--run "2:sleep 3" \
184-
--run "3:scripts/deploy-contract-local test-configs/local/committee.toml http://localhost:8545" \
199+
--run "3:scripts/deploy-contract -c test-configs/local/committee.toml -u http://localhost:8545" \
185200
--spawn "4:target/release/block-maker --bind 127.0.0.1:55000 -c test-configs/local/committee.toml" \
186201
--spawn "4:target/release/yapper -c test-configs/local/committee.toml" \
187202
--spawn "5:target/release/run-committee -c test-configs/local/" \
@@ -193,7 +208,7 @@ test-dyn-comm: build_release_until build-test-utils
193208
--timeout 120 \
194209
--spawn "1:anvil --port 8545" \
195210
--run "2:sleep 2" \
196-
--run "3:scripts/deploy-contract-local test-configs/local/committee.toml http://localhost:8545" \
211+
--run "3:scripts/deploy-contract -c test-configs/local/committee.toml -u http://localhost:8545" \
197212
--spawn "4:target/release/run-committee -c test-configs/c0/ --until 2000" \
198213
--run "5:target/release/mkconfig -n 4 \
199214
--committee-id 1 \
@@ -266,7 +281,7 @@ netsim: build_release build-test-utils
266281
--gid $(id -g) \
267282
--spawn "1:anvil --host 11.0.1.0 --port 8545" \
268283
--run "2:sleep 3" \
269-
--run "3:scripts/deploy-contract-local test-configs/linux/committee.toml http://11.0.1.0:8545" \
284+
--run "3:scripts/deploy-contract -c test-configs/linux/committee.toml -u http://11.0.1.0:8545" \
270285
--spawn "4:target/release/block-maker --bind 11.0.1.0:55000 -c test-configs/linux/committee.toml" \
271286
--spawn "4:target/release/yapper -c test-configs/linux/committee.toml" \
272287
--spawn-as-root "5:target/release/run-committee -u $(id -u) -g $(id -g) -c test-configs/linux/" \

scripts/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

scripts/deploy-contract

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
manager_mnemonic="attend year erase basket blind adapt stove broccoli isolate unveil acquire category"
6+
manager_account_index=0
7+
manager_address="0x36561082951eed7ffD59cFD82D70570C57072d02"
8+
faucet_private_key="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
9+
10+
deploy_cmd=target/release/deploy
11+
register_cmd=target/release/register
12+
committee=
13+
url=
14+
15+
while [[ $# -gt 0 ]]; do
16+
case "$1" in
17+
-d|--deploy)
18+
deploy_cmd="$2"
19+
shift 2
20+
;;
21+
-r|--register)
22+
register_cmd="$2"
23+
shift
24+
;;
25+
-c|--committee)
26+
committee="$2"
27+
shift 2
28+
;;
29+
-u|--url)
30+
url="$2"
31+
shift 2
32+
;;
33+
*)
34+
echo -e "Unknown: $1\n"
35+
echo "Usage: $0 [Options] where
36+
37+
Options:
38+
39+
-d | --deploy <PATH>
40+
Path to deploy executable.
41+
42+
-r | --register <PATH>
43+
Path to register executable.
44+
45+
-c | --committee <PATH>
46+
Path to committee configuration.
47+
48+
-u | --url <URL>
49+
Contract URL"
50+
exit 1
51+
;;
52+
esac
53+
done
54+
55+
deployment_file=$(mktemp -t timeboost-deployment-XXXXX)
56+
57+
# Fund manager account && create deployment file
58+
cast send --value 1ether -r "$url" --private-key "$faucet_private_key" "$manager_address"
59+
env RUST_LOG=info $deploy_cmd \
60+
-m "$manager_mnemonic" \
61+
-i "$manager_account_index" \
62+
-u "$url" \
63+
-o "$deployment_file"
64+
65+
# Extract the deployed KeyManager address
66+
km_addr=$(sed -nr 's/^key_manager.*=.*"(.+)"/\1/p' "$deployment_file")
67+
68+
# Update the contract
69+
env RUST_LOG=info $register_cmd \
70+
-a new-committee \
71+
-m "$manager_mnemonic" \
72+
-i "$manager_account_index" \
73+
-u "$url" \
74+
-k "$km_addr" \
75+
-c "$committee"
76+
77+
# Clean up the temporary deployment file
78+
rm -f "$deployment_file"

scripts/deploy-contract-docker

Lines changed: 0 additions & 33 deletions
This file was deleted.

scripts/deploy-contract-local

Lines changed: 0 additions & 35 deletions
This file was deleted.

scripts/run-sailfish-demo

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)