Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-wang-cb committed Sep 6, 2024
1 parent 8c438de commit 0bb3d6c
Showing 1 changed file with 22 additions and 31 deletions.
53 changes: 22 additions & 31 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ enclave := "devnet"

account := "TEST"

name := "Writer"
script-file := name + ".s.sol"

# Space-separated list of script arguments
script-args := "1000000"
script-signature := "run(" + \
Expand Down Expand Up @@ -80,19 +83,18 @@ create-devnet:
--args-file network_params.yaml \
--enclave {{enclave}}

l1-rpc-url := `kurtosis service inspect devnet el-1-geth-lighthouse | grep -- ' rpc: ' | sed 's/.*-> //'`
L2_RPC_URL := `kurtosis service inspect devnet op-el-1-op-geth-op-node | grep -- ' rpc: ' | sed 's/.*-> //'`
beacon-url := `kurtosis service inspect devnet cl-1-lighthouse-geth | grep -- ' http: ' | sed 's/.*-> //'`
ROLLUP_URL := `kurtosis service inspect devnet op-cl-1-op-node-op-geth | grep -- ' http: ' | sed 's/.*-> //'`

# Generates a fixture for the given script (name) and arguments (script-args)
generate-fixture:
#!/bin/bash
set -e

L2_RPC_URL={{shell("kurtosis service inspect " + enclave + " op-el-1-op-geth-op-node | grep -- ' rpc: ' | sed 's/.*-> //'")}}
ROLLUP_URL={{shell("kurtosis service inspect " + enclave + " op-cl-1-op-node-op-geth | grep -- ' http: ' | sed 's/.*-> //'")}}

forge script \
--non-interactive \
--password="" \
--rpc-url {{ L2_RPC_URL }} \
--rpc-url $L2_RPC_URL \
--account {{account}} \
--broadcast \
--sig "{{script-signature}}" \
Expand All @@ -105,7 +107,7 @@ generate-fixture:
L2_BLOCK_NUM=$(($(jq < broadcast/{{script-file}}/2151908/run-latest.json '.receipts[0].blockNumber' -r)))

while true; do
SYNC_STATUS=$(cast rpc optimism_syncStatus --rpc-url {{ ROLLUP_URL }})
SYNC_STATUS=$(cast rpc optimism_syncStatus --rpc-url $ROLLUP_URL)
L2_SAFE_BLOCK_NUM=$(echo $SYNC_STATUS | jq '.safe_l2.number')
L1_BLOCK_NUM=$(echo $SYNC_STATUS | jq '.head_l1.number')
if [ $L2_SAFE_BLOCK_NUM -ge $(($L2_BLOCK_NUM)) ]; then
Expand All @@ -121,44 +123,33 @@ generate-fixture:
--op-program {{op-program}} \
--l2-block $L2_BLOCK_NUM \
--l1-block $L1_BLOCK_NUM \
--l1-rpc-url http://{{l1-rpc-url}} \
--l2-rpc-url {{L2_RPC_URL}} \
--beacon-url {{beacon-url}} \
--rollup-url {{ROLLUP_URL}} \
--l1-rpc-url {{"http://" + shell("kurtosis service inspect " + enclave + " el-1-geth-lighthouse | grep -- ' rpc: ' | sed 's/.*-> //'")}} \
--l2-rpc-url $L2_RPC_URL \
--beacon-url {{shell("kurtosis service inspect " + enclave + " cl-1-lighthouse-geth | grep -- ' http: ' | sed 's/.*-> //'")}} \
--rollup-url $ROLLUP_URL \
--rollup-path {{rollup-path}} \
--genesis-path {{genesis-path}} \
--output {{fixture-file}} \
{{verbosity}}

run-fixture name index gasUse bool:
mkdir -p {{parent_directory("./output/op-program/{{name}}-{{index}}-{{gasUse}}-{{bool}}.json")}}
# Runs the given fixture through the op-program
run-fixture:
mkdir -p {{parent_directory(op-program-output)}}

{{opfp}} run-op-program \
--op-program {{op-program}} \
--fixture ./fixtures/{{name}}-{{index}}-{{gasUse}}-{{bool}}.json \
--output ./output/op-program/{{name}}-{{index}}-{{gasUse}}-{{bool}}.json \
--fixture {{fixture-file}} \
--output {{op-program-output}} \
{{verbosity}}

cannon-fixture name index gasUse bool:
mkdir -p {{parent_directory("./output/cannon/{{name}}-{{index}}-{{gasUse}}-{{bool}}.json")}}
cannon-fixture:
mkdir -p {{parent_directory(cannon-output)}}

{{opfp}} run-op-program \
--op-program {{op-program}} \
--fixture ./fixtures/{{name}}-{{index}}-{{gasUse}}-{{bool}}.json \
--fixture {{fixture-file}} \
--cannon {{cannon-bin}} \
--cannon-state {{cannon-state}} \
--cannon-meta {{cannon-meta}} \
--output ./output/cannon/{{name}}-{{index}}-{{gasUse}}-{{bool}}.json \
--output {{cannon-output}} \
{{verbosity}}

cannon-transfer-fixture gasUse address:
mkdir -p {{parent_directory("./output/cannon/Transfer-{{gasUse}}-{{address}}.json")}}
{{opfp}} run-op-program \
--op-program {{op-program}} \
--fixture ./fixtures/Transfer-{{gasUse}}-{{address}}.json \
--cannon {{cannon-bin}} \
--cannon-state {{cannon-state}} \
--cannon-meta {{cannon-meta}} \
--output ./output/cannon/Transfer-{{gasUse}}-{{address}}.json \
{{verbosity}}

0 comments on commit 0bb3d6c

Please sign in to comment.