1
- set export
2
-
3
1
export RUSTDOCFLAGS := ' -D warnings'
4
2
5
- LOG_LEVELS := " RUST_LOG=timeboost=debug,sailfish=debug,cliquenet=debug,tests=debug"
3
+ log_levels := " RUST_LOG=timeboost=debug,sailfish=debug,cliquenet=debug,tests=debug"
4
+ run_as_root := if env (" CI" , " " ) == " true" { " sudo" } else { " run0" }
6
5
7
6
####################
8
7
###BUILD COMMANDS###
@@ -34,7 +33,7 @@ build-port-alloc:
34
33
35
34
[private ]
36
35
build-test-utils :
37
- cargo build --release -p test-utils
36
+ cargo build --release -p test-utils --all-features
38
37
39
38
####################
40
39
###CHECK COMMANDS###
@@ -159,10 +158,10 @@ test-contracts: build-contracts
159
158
forge test
160
159
161
160
test_ci * ARGS : build-port-alloc
162
- env {{ LOG_LEVELS }} NO_COLOR=1 target/ release/ run \
161
+ env {{ log_levels }} NO_COLOR=1 target/ release/ run \
163
162
- -spawn target/ release/ port-alloc \
164
163
cargo nextest run -- --workspace {{ ARGS}}
165
- env {{ LOG_LEVELS }} NO_COLOR=1 cargo test --doc {{ ARGS}}
164
+ env {{ log_levels }} NO_COLOR=1 cargo test --doc {{ ARGS}}
166
165
167
166
test-individually : build-port-alloc
168
167
@ for pkg in $(cargo metadata --no-deps --format-version 1 | jq -r ' .packages[].name' ); do \
@@ -176,30 +175,28 @@ test-contract-deploy *ARGS:
176
175
scripts/ test-contract-deploy {{ ARGS}}
177
176
178
177
test-all : build_release build-test-utils
179
- env RUST_LOG=timeboost_builder::submit=debug,block_checker=info,warn target/ release/ run \
178
+ env RUST_LOG=timeboost_builder::submit=debug,block_checker=info,warn \
179
+ target/ release/ run \
180
180
- -verbose \
181
181
- -timeout 120 \
182
182
- -spawn " 1:anvil --port 8545" \
183
183
- -run " 2:sleep 3" \
184
- - -run " 3:scripts/deploy-contract-local" \
185
- - -spawn " 4:target/release/block-maker --port 55000 --committee test-configs/local/committee.toml" \
186
- - -spawn " 4:target/release/yapper --keyset-file test-configs/local/committee.toml" \
187
- - -spawn " 5:target/release/run-committee --configs test-configs/local/ --committee-id 0 --timeboost target/release/timeboost" \
188
- target/ release/ block-checker -- \
189
- - -config test-configs/ local/ node_0.toml \
190
- - -committee test-configs/ local/ committee.toml \
191
- - -committee-id 0 \
192
- - -blocks 1000
184
+ - -run " 3:scripts/deploy-contract-local test-configs/local/committee.toml http://localhost:8545" \
185
+ - -spawn " 4:target/release/block-maker --bind 127.0.0.1:55000 -c test-configs/local/committee.toml" \
186
+ - -spawn " 4:target/release/yapper -c test-configs/local/committee.toml" \
187
+ - -spawn " 5:target/release/run-committee -c test-configs/local/" \
188
+ target/ release/ block-checker -- -c test-configs/ local -b 1000
193
189
194
190
test-dyn-comm : build_release_until build-test-utils
195
- env RUST_LOG=sailfish=warn,yapper= error , timeboost=info,info target/ release/ run \
191
+ env RUST_LOG=sailfish=warn,timeboost=info,info target/ release/ run \
196
192
- -verbose \
197
193
- -timeout 120 \
198
194
- -spawn " 1:anvil --port 8545" \
199
195
- -run " 2:sleep 2" \
200
- - -run " 3:scripts/deploy-contract-local" \
201
- - -spawn " 4:target/release/run-committee --configs test-configs/c0/ --committee-id 0 --until 2000" \
196
+ - -run " 3:scripts/deploy-contract-local test-configs/local/committee.toml http://localhost:8545 " \
197
+ - -spawn " 4:target/release/run-committee -c test-configs/c0/ --until 2000" \
202
198
- -run " 5:target/release/mkconfig -n 4 \
199
+ --committee-id 1 \
203
200
--public-addr 127.0.0.1:9000 \
204
201
--internal-addr 127.0.0.1:9003 \
205
202
--http-api 127.0.0.1:9004 \
@@ -226,11 +223,51 @@ test-dyn-comm: build_release_until build-test-utils
226
223
-k 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35 \
227
224
-c test-configs/c1/committee.toml" \
228
225
- -spawn " 9:target/release/yapper \
229
- --keyset-file test-configs/c1/committee.toml \
226
+ --config test-configs/c1/committee.toml \
230
227
--parent-url http://localhost:8545 \
231
228
--key-manager-contract 0x2bbf15bc655c4cc157b769cfcb1ea9924b9e1a35" \
232
229
target/ release/ run-committee -- \
233
- - -configs test-configs/ c1/ \
234
- - -committee-id 1 \
230
+ - c test-configs/ c1/ \
235
231
- -until 800 \
236
232
- -required-decrypt-rounds 3 && rm -rf test-configs/ c1
233
+
234
+ [linux ]
235
+ forward-ipv4 val : build-test-utils
236
+ {{ run_as_root}} target/ release/ net-setup system --forward-ipv4 {{ val}}
237
+
238
+ [linux ]
239
+ create-net : build-test-utils
240
+ {{ run_as_root}} target/ release/ net-setup create -c test-configs/ linux/ net.toml
241
+
242
+ [linux ]
243
+ delete-net : build-test-utils
244
+ {{ run_as_root}} target/ release/ net-setup delete -c test-configs/ linux/ net.toml
245
+
246
+ [linux ]
247
+ netsim : build_release build-test-utils
248
+ #!/usr/bin/env bash
249
+ set -eo pipefail
250
+ function run_as_root {
251
+ if [ " $CI" == " true" ]; then
252
+ sudo --preserve-env =PATH,HOME,RUST_LOG " $@"
253
+ else
254
+ run0 --setenv=PATH --setenv=HOME --setenv=RUST_LOG " $@"
255
+ fi
256
+ }
257
+ export RUST_LOG=timeboost_builder::submit=debug,block_checker=info,warn
258
+ run_as_root target/ release/ run \
259
+ - -verbose \
260
+ - -timeout 120 \
261
+ - -clear-env \
262
+ - -env PATH \
263
+ - -env HOME \
264
+ - -env RUST_LOG \
265
+ - -uid $(id -u) \
266
+ - -gid $(id -g) \
267
+ - -spawn " 1:anvil --host 11.0.1.0 --port 8545" \
268
+ - -run " 2:sleep 3" \
269
+ - -run " 3:scripts/deploy-contract-local test-configs/linux/committee.toml http://11.0.1.0:8545" \
270
+ - -spawn " 4:target/release/block-maker --bind 11.0.1.0:55000 -c test-configs/linux/committee.toml" \
271
+ - -spawn " 4:target/release/yapper -c test-configs/linux/committee.toml" \
272
+ - -spawn-as-root " 5:target/release/run-committee -u $(id -u) -g $(id -g) -c test-configs/linux/" \
273
+ target/ release/ block-checker -- -c test-configs/ linux -b 200
0 commit comments