Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong l2 chain owner and nonce issues #41

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,39 @@ For help and further scripts, see:

## Named accounts

Here is a list of address that are used in the testnode setup, avoid using them before the deployment finishes or you might end up with some nonce race.

```bash
./test-node.bash script print-address --account sequencer
./test-node.bash script print-address --account <name>
./test-node.bash script print-private-key --account <name>
```

```
sequencer: 0xe2148eE53c0755215Df69b2616E552154EdC584f
validator: 0x6A568afe0f82d34759347bb36F14A6bB171d2CBe
l2owner: 0x5E1497dD1f08C87b2d8FE23e9AAB6c1De833D927
l3owner: 0x863c904166E801527125D8672442D736194A3362
l3sequencer: 0x3E6134aAD4C4d422FF2A4391Dc315c4DDf98D1a5
user_l1user: 0x058E6C774025ade66153C65672219191c72c7095
user_l1traffic: 0xa2db25762CFdF7bAF602F3Bcf2ec534937725f00
user_l1traffic_b: 0xacC305CaCB4605Aa1975001e24D25F7A5d11dC61
user_l2traffic: 0x7641C76365faC5090d315410358073D4ba199c57
user_l2traffic_b: 0x0d25ca3B2c4b8e8c9fe4104Fbd6D37B9563FdaE4
user_token_bridge_deployer: 0x3EaCb30f025630857aDffac9B2366F953eFE4F98
user_fee_token_deployer: 0x2AC5278D230f88B481bBE4A94751d7188ef48Ca2
```

While not a named account, 0x3f1eae7d46d88f08fc2f8ed27fcb2ab183eb2d0e is funded on all test chains.
While not a named account, 0x3f1eae7d46d88f08fc2f8ed27fcb2ab183eb2d0e is funded on all test chains and is used to fund other accounts.

The following account is funded on all L1, L2, and L3 and can be used for testing without risk of nonce race from testnode setup:
```
user_user: 0xC3Aa24dA923c30BD0738111c458ec68A8FdC2dfD
```

## Deployment status

- L2 and L3 are deployed when their respective RPC are avaliable (port 8545 and 3347)
- L2 token bridge is deployed if `docker-compose run --entrypoint sh tokenbridge -c "cat l1l2_network.json"` returns a valid json.
- L3 token bridge is deployed if `docker-compose run --entrypoint sh tokenbridge -c "cat l2l3_network.json"` returns a valid json.

## Contact

Expand Down
2 changes: 1 addition & 1 deletion scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ function writeL3ChainConfig(argv: any) {
"AllowDebugPrecompiles": true,
"DataAvailabilityCommittee": false,
"InitialArbOSVersion": 11,
"InitialChainOwner": "0x0000000000000000000000000000000000000000",
"InitialChainOwner": argv.l3owner,
"GenesisBlockNum": 0
}
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ async function main() {
l2url: { string: true, default: "ws://sequencer:8548" },
l3url: { string: true, default: "ws://l3node:3348" },
validationNodeUrl: { string: true, default: "ws://validation_node:8549" },
l2owner: { string: true, default: "0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E" },
l2owner: { string: true, default: "0x0000000000000000000000000000000000000000" },
l3owner: { string: true, default: "0x0000000000000000000000000000000000000000" },
})
.options(stressOptions)
.command(bridgeFundsCommand)
Expand Down
39 changes: 24 additions & 15 deletions test-node.bash
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,25 @@ if $force_init; then
docker compose up --wait geth
fi

echo == Funding validator, sequencer and l2owner
echo == Funding user on L1
docker compose run scripts send-l1 --ethamount 100 --to user_user --wait

echo == Funding validator, sequencer, l2owner and token bridge deployer
docker compose run scripts send-l1 --ethamount 1000 --to validator --wait
docker compose run scripts send-l1 --ethamount 1000 --to sequencer --wait
docker compose run scripts send-l1 --ethamount 1000 --to l2owner --wait
docker compose run scripts send-l1 --ethamount 1000 --to user_token_bridge_deployer --wait

echo == create l1 traffic
docker compose run scripts send-l1 --ethamount 1000 --to user_l1user --wait
docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1user --to user_l1user_b --wait --delay 500 --times 1000000 > /dev/null &

echo == Writing l2 chain config
docker compose run scripts write-l2-chain-config
docker compose run scripts send-l1 --ethamount 1000 --to user_l1traffic --wait
docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1traffic --to user_l1traffic_b --wait --delay 500 --times 1000000 > /dev/null &

sequenceraddress=`docker compose run scripts print-address --account sequencer | tail -n 1 | tr -d '\r\n'`
l2ownerAddress=`docker compose run scripts print-address --account l2owner | tail -n 1 | tr -d '\r\n'`

echo == Writing l2 chain config
docker compose run scripts write-l2-chain-config --l2owner $l2ownerAddress

docker compose run --entrypoint /usr/local/bin/deploy sequencer --l1conn ws://geth:8546 --l1keystore /home/user/l1keystore --sequencerAddress $sequenceraddress --ownerAddress $l2ownerAddress --l1DeployAccount $l2ownerAddress --l1deployment /config/deployment.json --authorizevalidators 10 --wasmrootpath /home/user/target/machines --l1chainid=$l1chainid --l2chainconfig /config/l2_chain_config.json --l2chainname arb-dev-test --l2chaininfo /config/deployed_chain_info.json
docker compose run --entrypoint sh sequencer -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json"

Expand All @@ -361,35 +365,39 @@ if $force_init; then
docker compose run scripts bridge-funds --ethamount 100000 --wait
docker compose run scripts bridge-funds --ethamount 1000 --wait --from "key_0x$devprivkey"

echo == Funding user on L2
docker compose run scripts send-l2 --ethamount 100 --to user_user --wait

if $tokenbridge; then
echo == Deploying L1-L2 token bridge
sleep 10 # no idea why this sleep is needed but without it the deploy fails randomly
rollupAddress=`docker compose run --entrypoint sh poster -c "jq -r '.[0].rollup.rollup' /config/deployed_chain_info.json | tail -n 1 | tr -d '\r\n'"`
l2ownerKey=`docker compose run scripts print-private-key --account l2owner | tail -n 1 | tr -d '\r\n'`
docker compose run -e ROLLUP_OWNER_KEY=$l2ownerKey -e ROLLUP_ADDRESS=$rollupAddress -e PARENT_KEY=$devprivkey -e PARENT_RPC=http://geth:8545 -e CHILD_KEY=$devprivkey -e CHILD_RPC=http://sequencer:8547 tokenbridge deploy:local:token-bridge
l2_token_bridge_deployer_key=`docker compose run scripts print-private-key --account user_token_bridge_deployer | tail -n 1 | tr -d '\r\n'`
docker compose run -e ROLLUP_OWNER_KEY=$l2ownerKey -e ROLLUP_ADDRESS=$rollupAddress -e PARENT_KEY=$l2_token_bridge_deployer_key -e PARENT_RPC=http://geth:8545 -e CHILD_KEY=$l2_token_bridge_deployer_key -e CHILD_RPC=http://sequencer:8547 tokenbridge deploy:local:token-bridge
docker compose run --entrypoint sh tokenbridge -c "cat network.json && cp network.json l1l2_network.json && cp network.json localNetwork.json"
echo
fi

if $l3node; then
echo == Funding l3 users
echo == Funding l3 owner and sequencer
docker compose run scripts send-l2 --ethamount 1000 --to l3owner --wait
docker compose run scripts send-l2 --ethamount 1000 --to l3sequencer --wait

echo == Funding l2 deployers
docker compose run scripts send-l1 --ethamount 100 --to user_token_bridge_deployer --wait
docker compose run scripts send-l2 --ethamount 100 --to user_token_bridge_deployer --wait

echo == Funding token deployer
docker compose run scripts send-l1 --ethamount 100 --to user_fee_token_deployer --wait
docker compose run scripts send-l2 --ethamount 100 --to user_fee_token_deployer --wait

echo == create l2 traffic
docker compose run scripts send-l2 --ethamount 100 --to user_traffic_generator --wait
docker compose run scripts send-l2 --ethamount 0.0001 --from user_traffic_generator --to user_fee_token_deployer --wait --delay 500 --times 1000000 > /dev/null &
docker compose run scripts send-l2 --ethamount 100 --to user_l2traffic --wait
docker compose run scripts send-l2 --ethamount 0.0001 --from user_l2traffic --to user_l2traffic_b --wait --delay 500 --times 1000000 > /dev/null &

l3owneraddress=`docker compose run scripts print-address --account l3owner | tail -n 1 | tr -d '\r\n'`
echo == Writing l3 chain config
docker compose run scripts write-l3-chain-config
docker compose run scripts write-l3-chain-config --l3owner $l3owneraddress

if $l3_custom_fee_token; then
echo == Deploying custom fee token
Expand All @@ -398,7 +406,6 @@ if $force_init; then
fi

echo == Deploying L3
l3owneraddress=`docker compose run scripts print-address --account l3owner | tail -n 1 | tr -d '\r\n'`
l3ownerkey=`docker compose run scripts print-private-key --account l3owner | tail -n 1 | tr -d '\r\n'`
l3sequenceraddress=`docker compose run scripts print-address --account l3sequencer | tail -n 1 | tr -d '\r\n'`
docker compose run --entrypoint /usr/local/bin/deploy sequencer --l1conn ws://sequencer:8548 --l1keystore /home/user/l1keystore --sequencerAddress $l3sequenceraddress --ownerAddress $l3owneraddress --l1DeployAccount $l3owneraddress --l1deployment /config/l3deployment.json --authorizevalidators 10 --wasmrootpath /home/user/target/machines --l1chainid=412346 --l2chainconfig /config/l3_chain_config.json --l2chainname orbit-dev-test --l2chaininfo /config/deployed_l3_chain_info.json --maxDataSize 104857 $EXTRA_L3_DEPLOY_FLAG
Expand All @@ -409,15 +416,15 @@ if $force_init; then

if $l3_token_bridge; then
echo == Deploying L2-L3 token bridge
deployer_key=`printf "%s" "user_token_bridge_deployer" | openssl dgst -sha256 | sed 's/^.*= //'`
l3_token_bridge_deployer_key=`docker compose run scripts print-private-key --account user_token_bridge_deployer | tail -n 1 | tr -d '\r\n'`
rollupAddress=`docker compose run --entrypoint sh poster -c "jq -r '.[0].rollup.rollup' /config/deployed_l3_chain_info.json | tail -n 1 | tr -d '\r\n'"`
l2Weth=""
if $tokenbridge; then
# we deployed an L1 L2 token bridge
# we need to pull out the L2 WETH address and pass it as an override to the L2 L3 token bridge deployment
l2Weth=`docker compose run --entrypoint sh tokenbridge -c "cat l1l2_network.json" | jq -r '.l2Network.tokenBridge.l2Weth'`
fi
docker compose run -e PARENT_WETH_OVERRIDE=$l2Weth -e ROLLUP_OWNER_KEY=$l3ownerkey -e ROLLUP_ADDRESS=$rollupAddress -e PARENT_RPC=http://sequencer:8547 -e PARENT_KEY=$deployer_key -e CHILD_RPC=http://l3node:3347 -e CHILD_KEY=$deployer_key tokenbridge deploy:local:token-bridge
docker compose run -e PARENT_WETH_OVERRIDE=$l2Weth -e ROLLUP_OWNER_KEY=$l3ownerkey -e ROLLUP_ADDRESS=$rollupAddress -e PARENT_RPC=http://sequencer:8547 -e PARENT_KEY=$l3_token_bridge_deployer_key -e CHILD_RPC=http://l3node:3347 -e CHILD_KEY=$l3_token_bridge_deployer_key tokenbridge deploy:local:token-bridge
docker compose run --entrypoint sh tokenbridge -c "cat network.json && cp network.json l2l3_network.json"
echo
fi
Expand All @@ -432,6 +439,8 @@ if $force_init; then
docker compose run scripts bridge-to-l3 --ethamount 500 --wait --from "key_0x$devprivkey"
fi

echo == Funding user on L3
docker compose run scripts send-l3 --ethamount 100 --to user_user --wait
fi
fi

Expand Down
Loading