Skip to content

Commit

Permalink
docs: Update script (#1116)
Browse files Browse the repository at this point in the history
* chore: update demo scripts

* chore: update simd

* fix: remove $GOPATH
  • Loading branch information
shiki-tak authored Sep 19, 2023
1 parent db83acb commit 9bf681f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 40 deletions.
Binary file modified demo/L1/simd-darwin-arm64
Binary file not shown.
24 changes: 22 additions & 2 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Demo

- Run the test script, start the L1 chain and L2 sequencer, and then run the tx.
1. Reset L1 and L2 data
```
./reset.sh
```

2. Run L1 chain
```
./run_chain.sh
```

3. Create rollup & register sequencer info
```
./prepare_rollup.sh
```

3. Run L2 sequencer
```
./run_sequencer.sh
```

4. Execute bank tx
```
./test_sequencer.sh
```
```
17 changes: 17 additions & 0 deletions demo/reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
L2BINARYNAME=rollupd
L1_KEYRING_DIR=~/.simapp
L2_KEYRING_DIR=~/.l2simapp

# Remove L1 data
pkill simd-darwin-arm64
rm -rf $L1_KEYRING_DIR

# Remove L2 data
if [ -x "$(which ${L2BINARYNAME})" ]; then
echo "clear L2 Binary"
pkill $L2BINARYNAME
rm $GOPATH/bin/$L2BINARYNAME
fi

rm -rf $L2_KEYRING_DIR
4 changes: 0 additions & 4 deletions demo/run_chain.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash

# Remove data
pkill ./L1/simd-darwin-arm64
rm -rf ~/.simapp

# Prepare chain
TEST_MNEMONIC="mind flame tobacco sense move hammer drift crime ring globe art gaze cinnamon helmet cruise special produce notable negative wait path scrap recall have"
BASE_DIR=~/.simapp
Expand Down
28 changes: 28 additions & 0 deletions demo/run_sequencer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
L2BINARYNAME=rollupd
ROLLUP_NAME=test-rollup
L1_CHAIN_ID=sim
L2_CHAIN_ID=sim2
L1_KEYRING_DIR=~/.simapp
L2_KEYRING_DIR=~/.l2simapp
RPC_URI=http://localhost:26659
TEST_SEQUENCER_ADDRESS=link1twsfmuj28ndph54k4nw8crwu8h9c8mh3rtx705
SEQUENCER_DIR=simapp0
TEST_MNEMONIC="mind flame tobacco sense move hammer drift crime ring globe art gaze cinnamon helmet cruise special produce notable negative wait path scrap recall have"

cd ..

# Build & rename
make build && cp -r build/simd $GOPATH/bin/$L2BINARYNAME
${L2BINARYNAME} version

# Init sequencer

${L2BINARYNAME} init rollupdemo --home $L2_KEYRING_DIR/$SEQUENCER_DIR --chain-id $L2_CHAIN_ID > /dev/null 2>&1
${L2BINARYNAME} keys add validator --keyring-backend=test --home $L2_KEYRING_DIR/$SEQUENCER_DIR --recover --account=0 <<< ${TEST_MNEMONIC} > /dev/null 2>&1
${L2BINARYNAME} add-genesis-account $(${L2BINARYNAME} --home $L2_KEYRING_DIR/$SEQUENCER_DIR keys show validator -a --keyring-backend=test) 100000000000stake,100000000000tcony --home $L2_KEYRING_DIR/$SEQUENCER_DIR > /dev/null 2>&1
${L2BINARYNAME} gentx validator 10000000000stake --keyring-backend=test --home $L2_KEYRING_DIR/$SEQUENCER_DIR --chain-id=$L2_CHAIN_ID > /dev/null 2>&1
${L2BINARYNAME} collect-gentxs --home $L2_KEYRING_DIR/$SEQUENCER_DIR > /dev/null 2>&1

# Run L2 sequencer
${L2BINARYNAME} start --home $L2_KEYRING_DIR/$SEQUENCER_DIR --p2p.laddr "tcp://0.0.0.0:26556" --grpc.address "0.0.0.0:9190" --grpc-web.address "0.0.0.0:9191" --rollkit.sequencer "true" --rollkit.da_layer finschia --rollkit.da_config='{"rpc_uri":"'$RPC_URI'","chain_id":"'$L1_CHAIN_ID'","keyring_dir":"'$L1_KEYRING_DIR'","from":"'$TEST_SEQUENCER_ADDRESS'", "rollup_name":"'$ROLLUP_NAME'"}' > $L2_KEYRING_DIR/$L2_CHAIN_ID.log 2>&1 &
34 changes: 0 additions & 34 deletions demo/test_sequencer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,15 @@

L2BINARYNAME=rollupd
ROLLUP_NAME=test-rollup
GOPATH=$HOME/go
L1_CHAIN_ID=sim
L2_CHAIN_ID=sim2
L1_KEYRING_DIR=~/.simapp
L2_KEYRING_DIR=~/.l2simapp
NAMESPACE_ID=$(openssl rand -hex 8)
RPC_URI=http://localhost:26659
TEST_SEQUENCER_ADDRESS=link1twsfmuj28ndph54k4nw8crwu8h9c8mh3rtx705
DA_BLOCK_HEIGH=1
SEQUENCER_DIR=simapp0
TEST_MNEMONIC="mind flame tobacco sense move hammer drift crime ring globe art gaze cinnamon helmet cruise special produce notable negative wait path scrap recall have"

# Reset
rm -rf $L2_KEYRING_DIR
pkill $L2BINARYNAME
rm $GOPATH/bin/$L2BINARYNAME

# Run L1 chain
./run_chain.sh

sleep 10

# Prepare rollup info
./prepare_rollup.sh

cd ..

# Build & rename
make build && cp -r build/simd $GOPATH/bin/$L2BINARYNAME
${L2BINARYNAME} version

# Init sequencer

${L2BINARYNAME} init rollupdemo --home $L2_KEYRING_DIR/$SEQUENCER_DIR --chain-id $L2_CHAIN_ID > /dev/null 2>&1
${L2BINARYNAME} keys add validator --keyring-backend=test --home $L2_KEYRING_DIR/$SEQUENCER_DIR --recover --account=0 <<< ${TEST_MNEMONIC} > /dev/null 2>&1
${L2BINARYNAME} add-genesis-account $(${L2BINARYNAME} --home $L2_KEYRING_DIR/$SEQUENCER_DIR keys show validator -a --keyring-backend=test) 100000000000stake,100000000000tcony --home $L2_KEYRING_DIR/$SEQUENCER_DIR > /dev/null 2>&1
${L2BINARYNAME} gentx validator 10000000000stake --keyring-backend=test --home $L2_KEYRING_DIR/$SEQUENCER_DIR --chain-id=$L2_CHAIN_ID > /dev/null 2>&1
${L2BINARYNAME} collect-gentxs --home $L2_KEYRING_DIR/$SEQUENCER_DIR > /dev/null 2>&1

# Run L2 sequencer
${L2BINARYNAME} start --home $L2_KEYRING_DIR/$SEQUENCER_DIR --p2p.laddr "tcp://0.0.0.0:26556" --grpc.address "0.0.0.0:9190" --grpc-web.address "0.0.0.0:9191" --rollkit.sequencer "true" --rollkit.da_layer finschia --rollkit.da_config='{"rpc_uri":"'$RPC_URI'","chain_id":"'$L1_CHAIN_ID'","keyring_dir":"'$L1_KEYRING_DIR'","from":"'$TEST_SEQUENCER_ADDRESS'", "rollup_name":"'$ROLLUP_NAME'"}' --rollkit.namespace_id $NAMESPACE_ID --rollkit.da_start_height $DA_BLOCK_HEIGH > $L2_KEYRING_DIR/$L2_CHAIN_ID.log 2>&1 &
sleep 10

# Send test
${L2BINARYNAME} keys add alice --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test
sleep 1
Expand Down

0 comments on commit 9bf681f

Please sign in to comment.