Skip to content

Commit

Permalink
Switch devnet/e2e to default to using fault proofs (ethereum-optimism…
Browse files Browse the repository at this point in the history
…#10719)

* Introduce fast dispute game type

Avoids the need to change configuration to support fast withdrawals via fault proofs.

* e2e: Wait for game to become resolvable.

* Update kontrol snapshots.

* e2e: Set correct game type for proposer.

* challenger: Fast games are alphabet vm, not cannon.

* Set fast game clock duration to 0.

* Update snapshots again

* Use game type consistently.

* Switch devnet/e2e to default to using fault proofs

---------

Co-authored-by: refcell <[email protected]>
  • Loading branch information
ajsutton and refcell authored Jun 4, 2024
1 parent d87c88d commit c41dcf7
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 101 deletions.
101 changes: 52 additions & 49 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ jobs:
FOUNDRY_PROFILE: ci
command: pnpm build
- run:
name: Generate FPAC allocs
command: DEVNET_FPAC="true" make devnet-allocs
name: Generate L2OO allocs
command: DEVNET_L2OO="true" make devnet-allocs
- run:
name: Copy FPAC allocs to .devnet-fpac
command: cp -r .devnet/ .devnet-fault-proofs/
name: Copy L2OO allocs to .devnet-l2oo
command: cp -r .devnet/ .devnet-l2oo/
- run:
name: Generate Plasma allocs
command: DEVNET_PLASMA="true" make devnet-allocs
Expand All @@ -231,7 +231,7 @@ jobs:
name: Copy Plasma allocs to .devnet-plasma
command: cp -r .devnet/ .devnet-plasma-generic/
- run:
name: Generate non-FPAC allocs
name: Generate default allocs
command: make devnet-allocs
- persist_to_workspace:
root: "."
Expand All @@ -247,11 +247,11 @@ jobs:
- ".devnet/allocs-l2-delta.json"
- ".devnet/allocs-l2-ecotone.json"
- ".devnet/addresses.json"
- ".devnet-fault-proofs/allocs-l1.json"
- ".devnet-fault-proofs/addresses.json"
- ".devnet-fault-proofs/allocs-l2.json"
- ".devnet-fault-proofs/allocs-l2-delta.json"
- ".devnet-fault-proofs/allocs-l2-ecotone.json"
- ".devnet-l2oo/allocs-l1.json"
- ".devnet-l2oo/addresses.json"
- ".devnet-l2oo/allocs-l2.json"
- ".devnet-l2oo/allocs-l2-delta.json"
- ".devnet-l2oo/allocs-l2-ecotone.json"
- ".devnet-plasma/allocs-l1.json"
- ".devnet-plasma/addresses.json"
- ".devnet-plasma/allocs-l2.json"
Expand Down Expand Up @@ -936,7 +936,7 @@ jobs:

go-e2e-test:
parameters:
fpac:
variant:
type: string
default: ''
module:
Expand All @@ -958,8 +958,8 @@ jobs:
type: string
default: ""
environment:
DEVNET_FPAC: 'false'
OP_E2E_USE_FPAC: 'false'
DEVNET_L2OO: 'false'
OP_E2E_USE_L2OO: 'false'
docker:
- image: <<pipeline.parameters.ci_builder_image>>
resource_class: xlarge
Expand All @@ -968,17 +968,17 @@ jobs:
- checkout
- when:
condition:
equal: ['-fault-proofs', <<parameters.fpac>>]
equal: ['-l2oo', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_FPAC = true
command: echo 'export DEVNET_FPAC=true' >> $BASH_ENV
name: Set DEVNET_L2OO = true
command: echo 'export DEVNET_L2OO=true' >> $BASH_ENV
- run:
name: Set OP_E2E_USE_FPAC = true
command: echo 'export OP_E2E_USE_FPAC=true' >> $BASH_ENV
name: Set OP_E2E_USE_L2OO = true
command: echo 'export OP_E2E_USE_L2OO=true' >> $BASH_ENV
- when:
condition:
equal: ['-plasma', <<parameters.fpac>>]
equal: ['-plasma', <<parameters.variant>>]
steps:
- run:
name: Set OP_E2E_USE_PLASMA = true
Expand All @@ -1000,11 +1000,11 @@ jobs:
name: Load devnet-allocs
command: |
mkdir -p .devnet
cp /tmp/workspace/.devnet<<parameters.fpac>>/allocs-l2.json .devnet/allocs-l2.json
cp /tmp/workspace/.devnet<<parameters.fpac>>/allocs-l2-delta.json .devnet/allocs-l2-delta.json
cp /tmp/workspace/.devnet<<parameters.fpac>>/allocs-l2-ecotone.json .devnet/allocs-l2-ecotone.json
cp /tmp/workspace/.devnet<<parameters.fpac>>/allocs-l1.json .devnet/allocs-l1.json
cp /tmp/workspace/.devnet<<parameters.fpac>>/addresses.json .devnet/addresses.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2.json .devnet/allocs-l2.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2-delta.json .devnet/allocs-l2-delta.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2-ecotone.json .devnet/allocs-l2-ecotone.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l1.json .devnet/allocs-l1.json
cp /tmp/workspace/.devnet<<parameters.variant>>/addresses.json .devnet/addresses.json
cp /tmp/workspace/packages/contracts-bedrock/deploy-config/devnetL1.json packages/contracts-bedrock/deploy-config/devnetL1.json
cp -r /tmp/workspace/packages/contracts-bedrock/deployments/devnetL1 packages/contracts-bedrock/deployments/devnetL1
- run:
Expand All @@ -1027,6 +1027,9 @@ jobs:
- store_artifacts:
path: /testlogs
when: always
- store_artifacts:
path: /tmp/test-results
when: always
- store_test_results:
path: /tmp/test-results
- when:
Expand Down Expand Up @@ -1084,12 +1087,12 @@ jobs:

indexer-tests:
parameters:
fpac:
variant:
type: string
default: ''
environment:
DEVNET_FPAC: 'false'
OP_E2E_USE_FPAC: 'false'
DEVNET_L2OO: 'false'
OP_E2E_USE_L2OO: 'false'
docker:
- image: <<pipeline.parameters.ci_builder_image>>
- image: cimg/postgres:14.1
Expand All @@ -1098,14 +1101,14 @@ jobs:
- checkout
- when:
condition:
equal: ['fault-proofs', <<parameters.fpac>>]
equal: ['l2oo', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_FPAC = true
command: echo 'export DEVNET_FPAC=true' >> $BASH_ENV
name: Set DEVNET_L2OO = true
command: echo 'export DEVNET_L2OO=true' >> $BASH_ENV
- run:
name: Set OP_E2E_USE_FPAC = true
command: echo 'export OP_E2E_USE_FPAC=true' >> $BASH_ENV
name: Set OP_E2E_USE_L2OO = true
command: echo 'export OP_E2E_USE_L2OO=true' >> $BASH_ENV
- check-changed:
patterns: indexer
- run:
Expand Down Expand Up @@ -1257,33 +1260,33 @@ jobs:
machine:
image: <<pipeline.parameters.base_image>>
parameters:
fpac:
variant:
type: string
environment:
DOCKER_BUILDKIT: 1
DEVNET_NO_BUILD: 'true'
# Default value; Can be overridden.
DEVNET_FPAC: 'false'
DEVNET_L2OO: 'false'
DEVNET_PLASMA: 'false'
steps:
- checkout
- when:
condition:
equal: ['fault-proofs', <<parameters.fpac>>]
equal: ['l2oo', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_FPAC = true
command: echo 'export DEVNET_FPAC=true' >> $BASH_ENV
name: Set DEVNET_L2OO = true
command: echo 'export DEVNET_L2OO=true' >> $BASH_ENV
- when:
condition:
equal: ['plasma', <<parameters.fpac>>]
equal: ['plasma', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_PLASMA = true
command: echo 'export DEVNET_PLASMA=true' >> $BASH_ENV
- when:
condition:
equal: ['plasma-generic', <<parameters.fpac>>]
equal: ['plasma-generic', <<parameters.variant>>]
steps:
- run:
name: Set DEVNET_PLASMA = true
Expand Down Expand Up @@ -1341,11 +1344,11 @@ jobs:
- when:
condition:
not:
equal: ['legacy', <<parameters.fpac>>]
equal: ['default', <<parameters.variant>>]
steps:
- run:
name: Use non-legacy devnet allocs
command: rm -r .devnet && mv .devnet-<<parameters.fpac>> .devnet
name: Use non-default devnet allocs
command: rm -r .devnet && mv .devnet-<<parameters.variant>> .devnet
- run:
name: Load and tag docker images
command: |
Expand Down Expand Up @@ -1700,10 +1703,10 @@ workflows:
binary_name: proxyd
working_directory: proxyd
- indexer-tests:
name: indexer-tests<< matrix.fpac >>
name: indexer-tests<< matrix.variant >>
matrix:
parameters:
fpac: ["", "-fault-proofs"]
variant: ["", "-l2oo"]
- semgrep-scan
- go-mod-download
- fuzz-golang:
Expand Down Expand Up @@ -1779,21 +1782,21 @@ workflows:
module: op-service
requires: ["go-mod-download"]
- go-e2e-test:
name: op-e2e-HTTP-tests<< matrix.fpac >>
name: op-e2e-HTTP-tests<< matrix.variant >>
matrix:
parameters:
fpac: ["", "-fault-proofs"]
variant: ["", "-l2oo"]
module: op-e2e
target: test-http
parallelism: 4
requires:
- go-mod-download
- pnpm-monorepo
- go-e2e-test:
name: op-e2e-action-tests<< matrix.fpac >>
name: op-e2e-action-tests<< matrix.variant >>
matrix:
parameters:
fpac: ["", "-fault-proofs", "-plasma"]
variant: ["", "-l2oo", "-plasma"]
module: op-e2e
target: test-actions
parallelism: 1
Expand Down Expand Up @@ -1888,7 +1891,7 @@ workflows:
- devnet:
matrix:
parameters:
fpac: ["legacy", "fault-proofs", "plasma", "plasma-generic"]
variant: ["default", "l2oo", "plasma", "plasma-generic"]
requires:
- pnpm-monorepo
- op-batcher-docker-build
Expand Down
28 changes: 14 additions & 14 deletions bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# Global environment variables
DEVNET_NO_BUILD = os.getenv('DEVNET_NO_BUILD') == "true"
DEVNET_FPAC = os.getenv('DEVNET_FPAC') == "true"
DEVNET_L2OO = os.getenv('DEVNET_L2OO') == "true"
DEVNET_PLASMA = os.getenv('DEVNET_PLASMA') == "true"
GENERIC_PLASMA = os.getenv('GENERIC_PLASMA') == "true"

Expand Down Expand Up @@ -130,8 +130,8 @@ def init_devnet_l1_deploy_config(paths, update_timestamp=False):
deploy_config = read_json(paths.devnet_config_template_path)
if update_timestamp:
deploy_config['l1GenesisBlockTimestamp'] = '{:#x}'.format(int(time.time()))
if DEVNET_FPAC:
deploy_config['useFaultProofs'] = True
if DEVNET_L2OO:
deploy_config['useFaultProofs'] = False
if DEVNET_PLASMA:
deploy_config['usePlasma'] = True
if GENERIC_PLASMA:
Expand Down Expand Up @@ -184,10 +184,10 @@ def devnet_deploy(paths):
log.info('L1 genesis already generated.')
else:
log.info('Generating L1 genesis.')
if not os.path.exists(paths.allocs_l1_path) or DEVNET_FPAC or DEVNET_PLASMA:
# If this is the FPAC devnet then we need to generate the allocs
if not os.path.exists(paths.allocs_l1_path) or DEVNET_L2OO or DEVNET_PLASMA:
# If this is a devnet variant then we need to generate the allocs
# file here always. This is because CI will run devnet-allocs
# without DEVNET_FPAC=true which means the allocs will be wrong.
# without setting the appropriate env var which means the allocs will be wrong.
# Re-running this step means the allocs will be correct.
devnet_l1_allocs(paths)
else:
Expand Down Expand Up @@ -219,9 +219,9 @@ def devnet_deploy(paths):
else:
log.info('Generating L2 genesis and rollup configs.')
l2_allocs_path = pjoin(paths.devnet_dir, 'allocs-l2.json')
if os.path.exists(l2_allocs_path) == False or DEVNET_FPAC == True:
# Also regenerate if FPAC.
# The FPAC flag may affect the L1 deployments addresses, which may affect the L2 genesis.
if os.path.exists(l2_allocs_path) == False or DEVNET_L2OO == True:
# Also regenerate if L2OO.
# The L2OO flag may affect the L1 deployments addresses, which may affect the L2 genesis.
devnet_l2_allocs(paths)
else:
log.info('Re-using existing L2 allocs.')
Expand Down Expand Up @@ -263,14 +263,14 @@ def devnet_deploy(paths):
'SEQUENCER_BATCH_INBOX_ADDRESS': batch_inbox_address
}

# Selectively set the L2OO_ADDRESS or DGF_ADDRESS if using FPAC.
# Selectively set the L2OO_ADDRESS or DGF_ADDRESS if using L2OO.
# Must be done selectively because op-proposer throws if both are set.
if DEVNET_FPAC:
if DEVNET_L2OO:
docker_env['L2OO_ADDRESS'] = l2_output_oracle
else:
docker_env['DGF_ADDRESS'] = dispute_game_factory
docker_env['DG_TYPE'] = '254'
docker_env['PROPOSAL_INTERVAL'] = '10s'
else:
docker_env['L2OO_ADDRESS'] = l2_output_oracle

if DEVNET_PLASMA:
docker_env['PLASMA_ENABLED'] = 'true'
Expand All @@ -290,7 +290,7 @@ def devnet_deploy(paths):
run_command(['docker', 'compose', 'up', '-d', 'op-node', 'op-proposer', 'op-batcher', 'artifact-server'], cwd=paths.ops_bedrock_dir, env=docker_env)

# Optionally bring up op-challenger.
if DEVNET_FPAC:
if not DEVNET_L2OO:
log.info('Bringing up `op-challenger`.')
run_command(['docker', 'compose', 'up', '-d', 'op-challenger'], cwd=paths.ops_bedrock_dir, env=docker_env)

Expand Down
2 changes: 1 addition & 1 deletion indexer/e2e_tests/etl_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestE2EETL(t *testing.T) {
require.NoError(t, wait.For(context.Background(), time.Second, func() (bool, error) {
var l2Height *big.Int
var err error
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
gameCount, err := disputeGameFactory.GameCount(&bind.CallOpts{Context: context.Background()})
require.NoError(t, err)
if gameCount.Cmp(big.NewInt(0)) == 0 {
Expand Down
8 changes: 4 additions & 4 deletions op-e2e/actions/l2_proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func NewL2Proposer(t Testing, log log.Logger, cfg *ProposerCfg, l1 *ethclient.Cl

var l2OutputOracle *bindings.L2OutputOracleCaller
var disputeGameFactory *bindings.DisputeGameFactoryCaller
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
disputeGameFactory, err = bindings.NewDisputeGameFactoryCaller(*cfg.DisputeGameFactoryAddr, l1)
require.NoError(t, err)
} else {
Expand Down Expand Up @@ -137,7 +137,7 @@ func (p *L2Proposer) sendTx(t Testing, data []byte) {
require.NoError(t, err)

var addr common.Address
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
addr = *p.disputeGameFactoryAddr
} else {
addr = *p.l2OutputOracleAddr
Expand Down Expand Up @@ -205,7 +205,7 @@ func toCallArg(msg ethereum.CallMsg) interface{} {
}

func (p *L2Proposer) fetchNextOutput(t Testing) (*eth.OutputResponse, bool, error) {
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
blockNumber, err := p.driver.FetchCurrentBlockNumber(t.Ctx())
if err != nil {
return nil, false, err
Expand Down Expand Up @@ -247,7 +247,7 @@ func (p *L2Proposer) ActMakeProposalTx(t Testing) {
}

var txData []byte
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
txData, _, err = p.driver.ProposeL2OutputDGFTxData(output)
require.NoError(t, err)
} else {
Expand Down
4 changes: 2 additions & 2 deletions op-e2e/actions/l2_proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func RunProposerTest(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
rollupSeqCl, miner.EthClient(), seqEngine.EthClient(), seqEngine.EngineClient(t, sd.RollupCfg))

var proposer *L2Proposer
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
optimismPortal2Contract, err := bindingspreview.NewOptimismPortal2(sd.DeploymentsL1.OptimismPortalProxy, miner.EthClient())
require.NoError(t, err)
respectedGameType, err := optimismPortal2Contract.RespectedGameType(&bind.CallOpts{})
Expand Down Expand Up @@ -113,7 +113,7 @@ func RunProposerTest(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
}

// check that L1 stored the expected output root
if e2eutils.UseFPAC() {
if e2eutils.UseFaultProofs() {
optimismPortal2Contract, err := bindingspreview.NewOptimismPortal2(sd.DeploymentsL1.OptimismPortalProxy, miner.EthClient())
require.NoError(t, err)
respectedGameType, err := optimismPortal2Contract.RespectedGameType(&bind.CallOpts{})
Expand Down
Loading

0 comments on commit c41dcf7

Please sign in to comment.