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

Espresso migration #46

Merged
merged 55 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
631874a
add orbit-actions submodule to nitro-testnode to enable migration e2e…
zacshowa Aug 20, 2024
26ac754
update docker-compose.yaml for building espresso integrated nitro nod…
zacshowa Aug 21, 2024
73735d4
create bash scripts to orchestrate migration tests.
zacshowa Aug 21, 2024
66f137b
add light client addr to create-espresso-integrated-nitro-node.bash
zacshowa Aug 21, 2024
2591c33
add const for espresso config path to enable writing to different vol…
zacshowa Aug 21, 2024
853a470
write all configs to espresso-config volume to avoid any missing conf…
zacshowa Aug 21, 2024
03cfd37
write all configs to espresso-config volume to avoid missing any for …
zacshowa Aug 21, 2024
4d7f7d4
detach espresso-dev-node to make migration test visible
zacshowa Aug 21, 2024
dc9f43b
add espresso boolean and start espresso sequencer docker-compose service
zacshowa Aug 21, 2024
1a12259
start espresso-dev-node after standing up nitro-testnode to avoid inc…
zacshowa Aug 21, 2024
1d62c1f
copy l2_chain_info to espresso-config volume
zacshowa Aug 21, 2024
8faf6d4
properly copy l2_chain_info.json to espresso-config volume
zacshowa Aug 21, 2024
8d890c3
Merge branch 'integration' into espresso-migration
ImJeremyHe Aug 22, 2024
8fc2fb1
Rename and lint
ImJeremyHe Aug 22, 2024
8572963
create script command to extract upgrade-executor address from config…
zacshowa Aug 22, 2024
015cc1a
move location of test bash scripts and setup env file for the scripts
zacshowa Aug 22, 2024
00490b2
fix config in docker-compose.yaml
zacshowa Aug 22, 2024
5c576f6
modify original test script to copy l2_chain_info_json to espresso co…
zacshowa Aug 22, 2024
804b034
remove redundant command to extract upgrade-executor address.
zacshowa Aug 22, 2024
7a1d231
add non-changing upgrade-executor address to .env file.
zacshowa Aug 22, 2024
f95942e
update docker file to allow scripts image to build
zacshowa Aug 22, 2024
359b895
commit with current progress
zacshowa Aug 23, 2024
2fdf356
Update the orbit chain
ImJeremyHe Aug 23, 2024
8e68bc8
Lint
ImJeremyHe Aug 23, 2024
f75e6bc
Commit with current progress.
zacshowa Aug 23, 2024
f7d2e02
Merge branch 'espresso-migration' of github.com:EspressoSystems/nitro…
zacshowa Aug 23, 2024
ffd396e
Fix the migration test bash
ImJeremyHe Aug 26, 2024
d8322f3
Update orbit submodule
ImJeremyHe Aug 26, 2024
90e12dd
Add shell.nix
sveitser Aug 26, 2024
4210058
Some cleanup to bash test script
sveitser Aug 26, 2024
64c026c
Execute the test until Espresso integration node
sveitser Aug 26, 2024
9d55ff3
Fix deployment of child chain upgrade action
sveitser Aug 26, 2024
78244ef
Run a simple node with espresso
ImJeremyHe Aug 26, 2024
4037501
Write config to espresso volume for upgrade test
sveitser Aug 26, 2024
ee6519c
remove unused items in .env
zacshowa Aug 26, 2024
5813618
add sleep and cast call to test bash script.
zacshowa Aug 26, 2024
74222a3
re-add some removed vars to .env file
zacshowa Aug 27, 2024
c719f27
remove unneeded code in javascript commands.
zacshowa Aug 27, 2024
eec62f3
add assertions to test
zacshowa Aug 27, 2024
3721574
Manually call the upgrade pre-compile
sveitser Aug 27, 2024
bbb8757
commit with current progress
zacshowa Aug 28, 2024
6b9cda3
Deploy an UpgradeExecutor on child chain
sveitser Aug 28, 2024
775dbd3
Rename some variables in .env file
zacshowa Aug 28, 2024
60a1d61
Clean and finalize the migration-test.bash script and add comments de…
zacshowa Aug 28, 2024
1a43eaa
Add a README.md to go with the test.
zacshowa Aug 28, 2024
32c8a2f
docker compose down after finish
ImJeremyHe Aug 29, 2024
aea5b46
Add a flag to run a simple node with validator
ImJeremyHe Aug 30, 2024
b459a47
updates to migration test bash scripts
zacshowa Sep 3, 2024
8b5d7f3
Fix typo in migration-test.bash
zacshowa Sep 4, 2024
4d1068b
Merge branch 'espresso-migration' of github.com:EspressoSystems/nitro…
zacshowa Sep 4, 2024
39e8496
Undo unnecessary change in index.ts and docker files
zacshowa Sep 5, 2024
71d78a1
Merge remote-tracking branch 'origin/integration' into espresso-migra…
zacshowa Sep 5, 2024
c8fe3c5
Change when we write the espresso-config in the migration test
zacshowa Sep 6, 2024
46dbb2f
Update migration-test helper script
zacshowa Sep 6, 2024
fd55f28
Remove leftover references to sequencer espresso settings after merge
zacshowa Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "blockscout"]
path = blockscout
url = https://github.com/OffchainLabs/blockscout.git
[submodule "orbit-actions"]
path = orbit-actions
url = [email protected]:EspressoSystems/orbit-actions.git
branch = espresso-migration
20 changes: 20 additions & 0 deletions create-espresso-integrated-nitro-node.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:integration
lightClientAddr=0xb6eb235fa509e3206f959761d11e3777e16d0e98
espresso=true

# docker pull and tag the espresso integration nitro node.
docker pull $ESPRESSO_VERSION

docker tag $ESPRESSO_VERSION espresso-integration-testnode

# write the espresso configs to the config volume
echo == Writing configs
docker compose run scripts write-config --espresso $espresso --lightClientAddress $lightClientAddr

# do whatever other espresso setup is needed.

# run esprsso-integrated nitro node for sequencing.
docker compose up espresso-sequencer --detach
20 changes: 20 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ services:
depends_on:
- geth

espresso-sequencer:
sveitser marked this conversation as resolved.
Show resolved Hide resolved
pid: host # allow debugging
image: espresso-integration-testnode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between this and nitro-node-dev-testnode

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:integration eventually but it's currently necessary to use a local docker image for testing because we haven't merged @zacshowa's E2E changes in nitro and they will be needed for this upgrade test. So I guess it's a locally tagged image.

entrypoint: /usr/local/bin/nitro
ports:
- "127.0.0.1:8547:8547"
- "127.0.0.1:8548:8548"
- "127.0.0.1:9642:9642"
volumes:
- "seqdata:/home/user/.arbitrum/local/nitro"
- "l1keystore:/home/user/l1keystore"
- "espresso-config:/config"
- "tokenbridge-data:/tokenbridge-data"
command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain *
depends_on:
- geth

sequencer_b:
pid: host # allow debugging
image: nitro-node-dev-testnode
Expand Down Expand Up @@ -323,6 +340,7 @@ services:
- "l1keystore:/home/user/l1keystore"
- "config:/config"
- "tokenbridge-data:/tokenbridge-data"
- "espresso-config:/espresso-config"

relay:
pid: host
Expand Down Expand Up @@ -359,6 +377,7 @@ services:
NITRO_CONTRACTS_BRANCH: ${NITRO_CONTRACTS_BRANCH:-}
volumes:
- "config:/config"
- "espresso-config:/espresso-config"
- /var/run/docker.sock:/var/run/docker.sock

espresso-dev-node:
Expand Down Expand Up @@ -393,5 +412,6 @@ volumes:
poster-data-b:
poster-data-c:
config:
espresso-config:
postgres-data:
tokenbridge-data:
24 changes: 24 additions & 0 deletions migration-test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail


#Initialize a standard network not compatible with espresso.
./test-node.bash --simple --init --detach

#start espresso sequencer node
docker compose up espresso-dev-node --detach

#shutdown nitro node
docker stop nitro-testnode-sequencer-1

#start nitro node in new docker container with espresso image (create a new script to do this from pieces of test-node.bash)
./create-espresso-integrated-nitro-node.bash

#forge script to deploy new OSP entry and upgrade actions

#forge script to execute upgrade actions

#check the upgrade happened.


#./test-node.bash --espresso --latest-espresso-image --validate --tokenbridge --init --detach
1 change: 1 addition & 0 deletions orbit-actions
Submodule orbit-actions added at 3c3570
123 changes: 118 additions & 5 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ SLOTS_PER_EPOCH: 6
DEPOSIT_CONTRACT_ADDRESS: 0x4242424242424242424242424242424242424242
`
fs.writeFileSync(path.join(consts.configpath, "prysm.yaml"), prysm)
fs.writeFileSync(path.join(consts.espressoconfigpath, "prysm.yaml"), prysm)
sveitser marked this conversation as resolved.
Show resolved Hide resolved

}

function writeGethGenesisConfig(argv: any) {
Expand Down Expand Up @@ -144,16 +146,118 @@ function writeGethGenesisConfig(argv: any) {
}
`
fs.writeFileSync(path.join(consts.configpath, "geth_genesis.json"), gethConfig)
fs.writeFileSync(path.join(consts.espressoconfigpath, "geth_genesis.json"), gethConfig)
const jwt = `0x98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4`
fs.writeFileSync(path.join(consts.configpath, "jwt.hex"), jwt)
fs.writeFileSync(path.join(consts.espressoconfigpath, "jwt.hex"), jwt)
const val_jwt = `0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`
fs.writeFileSync(path.join(consts.configpath, "val_jwt.hex"), val_jwt)
fs.writeFileSync(path.join(consts.espressoconfigpath, "val_jwt.hex"), val_jwt)
}

function writeConfigs(argv: any) {
const valJwtSecret = path.join(consts.configpath, "val_jwt.hex")
const chainInfoFile = path.join(consts.configpath, "l2_chain_info.json")
const baseConfig = {
const baseConfig ={
"parent-chain": {
"connection": {
"url": argv.l1url,
},
},
"chain": {
"id": 412346,
"info-files": [chainInfoFile],
},
"node": {
"staker": {
"dangerous": {
"without-block-validator": false
},
"parent-chain-wallet" : {
"account": namedAddress("validator"),
"password": consts.l1passphrase,
"pathname": consts.l1keystore,
},
"disable-challenge": false,
"enable": false,
"staker-interval": "10s",
"make-assertion-interval": "10s",
"strategy": "MakeNodes",
},
"sequencer": false,
"dangerous": {
"no-sequencer-coordinator": false,
"disable-blob-reader": true,
},
"delayed-sequencer": {
"enable": false
},
"seq-coordinator": {
"enable": false,
"redis-url": argv.redisUrl,
"lockout-duration": "30s",
"lockout-spare": "1s",
"my-url": "",
"retry-interval": "0.5s",
"seq-num-duration": "24h0m0s",
"update-interval": "3s",
},
"batch-poster": {
"enable": false,
"redis-url": argv.redisUrl,
"max-delay": "30s",
"l1-block-bound": "ignore",
"parent-chain-wallet" : {
"account": namedAddress("sequencer"),
"password": consts.l1passphrase,
"pathname": consts.l1keystore,
},
"data-poster": {
"redis-signer": {
"signing-key": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
},
"wait-for-l1-finality": false
},
},
"block-validator": {
"validation-server" : {
"url": argv.validationNodeUrl,
"jwtsecret": valJwtSecret,
},
"dangerous": {"reset-block-validation": false},
},
"feed": {
"input": {
"url": [], // websocket urls
},
"output": {
"enable": false,
"signed": false,
"addr": "0.0.0.0",
},
}
},
"execution": {
"sequencer": {
"enable": false,
},
"forwarding-target": "null",
},
"persistent": {
"chain": "local",
"db-engine": "leveldb"
},
"ws": {
"addr": "0.0.0.0"
},
"http": {
"addr": "0.0.0.0",
"vhosts": "*",
"corsdomain": "*"
},
}

const espressoConfig = {
"parent-chain": {
"connection": {
"url": argv.l1url,
Expand Down Expand Up @@ -257,10 +361,9 @@ function writeConfigs(argv: any) {
"vhosts": "*",
"corsdomain": "*"
},
}


const baseConfJSON = JSON.stringify(baseConfig)
}
//conditionally use the espresso compliant config, or the base config based on the espresso portion being passed in via argv
const baseConfJSON = (argv.espresso) ? JSON.stringify(espressoConfig) : JSON.stringify(baseConfig)

if (argv.simple) {
let simpleConfig = JSON.parse(baseConfJSON)
Expand All @@ -274,6 +377,7 @@ function writeConfigs(argv: any) {
simpleConfig.node["batch-poster"]["redis-url"] = ""
simpleConfig.execution["sequencer"].enable = true
fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(simpleConfig))
fs.writeFileSync(path.join(consts.espressoconfigpath, "sequencer_config.json"), JSON.stringify(simpleConfig))
} else {
let validatorConfig = JSON.parse(baseConfJSON)
validatorConfig.node.staker.enable = true
Expand All @@ -285,10 +389,12 @@ function writeConfigs(argv: any) {
}
let validconfJSON = JSON.stringify(validatorConfig)
fs.writeFileSync(path.join(consts.configpath, "validator_config.json"), validconfJSON)
fs.writeFileSync(path.join(consts.espressoconfigpath, "validator_config.json"), validconfJSON)

let unsafeStakerConfig = JSON.parse(validconfJSON)
unsafeStakerConfig.node.staker.dangerous["without-block-validator"] = true
fs.writeFileSync(path.join(consts.configpath, "unsafe_staker_config.json"), JSON.stringify(unsafeStakerConfig))
fs.writeFileSync(path.join(consts.espressoconfigpath, "unsafe_staker_config.json"), JSON.stringify(unsafeStakerConfig))

let sequencerConfig = JSON.parse(baseConfJSON)
sequencerConfig.node.sequencer = true
Expand All @@ -304,6 +410,7 @@ function writeConfigs(argv: any) {
sequencerConfig.node["seq-coordinator"].enable = true
}
fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig))
fs.writeFileSync(path.join(consts.espressoconfigpath, "sequencer_config.json"), JSON.stringify(sequencerConfig))

let posterConfig = JSON.parse(baseConfJSON)
if (argv.espresso) {
Expand All @@ -315,6 +422,7 @@ function writeConfigs(argv: any) {
}
posterConfig.node["batch-poster"].enable = true
fs.writeFileSync(path.join(consts.configpath, "poster_config.json"), JSON.stringify(posterConfig))
fs.writeFileSync(path.join(consts.espressoconfigpath, "poster_config.json"), JSON.stringify(posterConfig))
}

let l3Config = JSON.parse(baseConfJSON)
Expand All @@ -335,6 +443,7 @@ function writeConfigs(argv: any) {
l3Config.node["batch-poster"].enable = true
l3Config.node["batch-poster"]["redis-url"] = ""
fs.writeFileSync(path.join(consts.configpath, "l3node_config.json"), JSON.stringify(l3Config))
fs.writeFileSync(path.join(consts.espressoconfigpath, "l3node_config.json"), JSON.stringify(l3Config))

let validationNodeConfig = JSON.parse(JSON.stringify({
"persistent": {
Expand All @@ -356,6 +465,7 @@ function writeConfigs(argv: any) {
},
}))
fs.writeFileSync(path.join(consts.configpath, "validation_node_config.json"), JSON.stringify(validationNodeConfig))
fs.writeFileSync(path.join(consts.espressoconfigpath, "validation_node_config.json"), JSON.stringify(validationNodeConfig))
}

function writeL2ChainConfig(argv: any) {
Expand Down Expand Up @@ -394,6 +504,8 @@ function writeL2ChainConfig(argv: any) {
}
const l2ChainConfigJSON = JSON.stringify(l2ChainConfig)
fs.writeFileSync(path.join(consts.configpath, "l2_chain_config.json"), l2ChainConfigJSON)
fs.writeFileSync(path.join(consts.espressoconfigpath, "l2_chain_config.json"), l2ChainConfigJSON)

}

function writeL3ChainConfig(argv: any) {
Expand Down Expand Up @@ -427,6 +539,7 @@ function writeL3ChainConfig(argv: any) {
}
const l3ChainConfigJSON = JSON.stringify(l3ChainConfig)
fs.writeFileSync(path.join(consts.configpath, "l3_chain_config.json"), l3ChainConfigJSON)
fs.writeFileSync(path.join(consts.espressoconfigpath, "l3_chain_config.json"), l3ChainConfigJSON)
}

export const writeConfigCommand = {
Expand Down
1 change: 1 addition & 0 deletions scripts/consts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const l1keystore = "/home/user/l1keystore";
export const l1passphrase = "passphrase";
export const configpath = "/config";
export const espressoconfigpath = "/espresso-config"
export const tokenbridgedatapath = "/tokenbridge-data";
// Not secure. Do not use for production purposes
export const l1mnemonic =
Expand Down
3 changes: 3 additions & 0 deletions test-node.bash
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ if $force_init; then
echo == Deploying L2 chain
docker compose run -e PARENT_CHAIN_RPC="http://geth:8545" -e DEPLOYER_PRIVKEY=$l2ownerKey -e PARENT_CHAIN_ID=$l1chainid -e CHILD_CHAIN_NAME="arb-dev-test" -e MAX_DATA_SIZE=117964 -e OWNER_ADDRESS=$l2ownerAddress -e WASM_MODULE_ROOT=$wasmroot -e SEQUENCER_ADDRESS=$sequenceraddress -e AUTHORIZE_VALIDATORS=10 -e CHILD_CHAIN_CONFIG_PATH="/config/l2_chain_config.json" -e CHAIN_DEPLOYMENT_INFO="/config/deployment.json" -e CHILD_CHAIN_INFO="/config/deployed_chain_info.json" -e LIGHT_CLIENT_ADDR=$lightClientAddr rollupcreator create-rollup-testnode
docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json"
#copy chain info needed by nitro node to espresso-config volume.
docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /espresso-config/l2_chain_info.json"


if $simple; then
echo == Writing configs
Expand Down
Loading