-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathJustfile
60 lines (46 loc) · 2.16 KB
/
Justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Justfile
# Recipe to run the rsp CLI for a particular block and chain id.
run-block block_number chain_id:
cargo run --release --bin rsp -- --block-number {{block_number}} --chain-id {{chain_id}}
# Usage:
# just run-block <block_number> <chain_id>
# Example:
# just run-block 20526624 1
# Recipe to run the rsp CLI for a range of blocks.
run-blocks start_block end_block chain_id:
#!/usr/bin/env bash
echo "Running command for block numbers from {{start_block}} to {{end_block}} on chain ID: {{chain_id}}"
for ((block_number={{start_block}}; block_number<={{end_block}}; block_number++)); do
echo "Running for block number $block_number"
cargo run --release --bin rsp -- --block-number "$block_number" --chain-id {{chain_id}}
done
# Usage:
# just run-blocks <start_block> <end_block> <chain_id>
# Example:
# just run-blocks 20526624 20526630 1
# Recipe to run the rsp CLI (with tracing) for a block and chain id.
trace-block block chain_id:
TRACE_FILE=trace_$block_$chain_id.log cargo run --release --bin rsp -- --block-number "$block_number" --chain-id {{chain_id}}
cargo prove --trace
# Recipe to run the rsp CLI on the latest block in a loop at the given interval and submit proving times to ETH proofs.
run-eth-proofs cluster_id="1" sleep_time="900":
#!/usr/bin/env bash
while true; do
RESPONSE=$(curl -s \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
"$RPC_URL")
BLOCK_NUMBER=$((16#$(echo $RESPONSE | grep -o '"result":"[^"]*"' | cut -d'"' -f4 | sed 's/0x//')))
echo "Latest block number: $BLOCK_NUMBER"
ROUNDED_BLOCK=$((BLOCK_NUMBER - (BLOCK_NUMBER % 100)))
echo "Rounded block number: $ROUNDED_BLOCK"
echo "Running rsp..."
SP1_PROVER=cuda cargo run --bin rsp --release -F cuda -- --block-number $ROUNDED_BLOCK --eth-proofs-cluster-id {{cluster_id}} --rpc-url $RPC_URL --prove
echo "Sleeping for $(({{sleep_time}} / 60)) minutes..."
sleep {{sleep_time}}
done
# Usage:
# just run-eth-proofs <cluster-id> <sleep-time>
# Example:
# just run-eth-proofs 5 600