babylonchain / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
1 stars 0 forks source link

feat: add babylon chain configs #13

Closed parketh closed 3 weeks ago

parketh commented 3 weeks ago

Summary

This PR removes the hardcoded Babylon chain configs (CW contract address and chain type) from the engine queue, and dynamically imports them from chain configs at deployment.

It closes #12.

Description

Refer to OP docs on creating L2 rollup.

We add two new values to .envrc as follows:

# Babylonchain finality gadget
export BBN_FINALITY_GADGET_CHAIN_TYPE=0
export BBN_FINALITY_GADGET_CONTRACT_ADDRESS=bbn1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqxxvh0f

Then, we amend the config script at packages/contracts-bedrock/scripts/getting-started/config.sh to include these params:

"babylonFinalityGadgetChainType": "$BBN_FINALITY_GADGET_CHAIN_TYPE",
"babylonFinalityGadgetContractAddress": "$BBN_FINALITY_GADGET_CONTRACT_ADDRESS"

Finally, we update Finalizer by adding the BabylonConfig object so that we can read the Babylon configs in the engine queue, and remove the hard code.

Test plan

# Generate the chain config file
./scripts/getting-started/config.sh

# Generate `genesis.json`
# Note it's necessary to first set the L1_RPC_URL in env
go run cmd/main.go genesis l2 \                                                                                                                                                                                                                                                                   
  --deploy-config ../packages/contracts-bedrock/deploy-config/getting-started.json \
  --l1-deployments ../packages/contracts-bedrock/deployments/getting-started/.deploy \
  --outfile.l2 genesis.json \
  --outfile.rollup rollup.json \
  --l1-rpc $L1_RPC_URL

# Run tests
cd op-node/rollup
go test
bap2pecs commented 3 weeks ago

seems there is an issue that the test plan doesn't pass @parketh will create an issue to track it

parketh commented 3 weeks ago

seems there is an issue that the test plan doesn't pass @parketh will create an issue to track it

tracking here: https://github.com/babylonchain/optimism/issues/14