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

Deploy OP Stack onto sequencer docker compose #76

Merged
merged 155 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
fe1f3c5
build(deps-dev): bump eslint-plugin-unicorn from 42.0.0 to 48.0.1
dependabot[bot] Sep 14, 2023
ed73f1f
feat(proxyd): high availability
felipe-op Sep 14, 2023
c7c21a2
revert weird comment replaces
felipe-op Sep 14, 2023
b15fe51
semgrep
felipe-op Sep 14, 2023
7b93339
release lock on errors, validate if local is behind remote before acq…
felipe-op Sep 14, 2023
b8b39ed
don't schedule updates for completed games
refcell Sep 15, 2023
2a91d6d
add concurrency metrics
refcell Sep 15, 2023
c323b81
labeling issue
refcell Sep 15, 2023
99fb84d
nits
felipe-op Sep 15, 2023
9accb0e
nits
felipe-op Sep 15, 2023
cea66c7
fix(indexer): Fix uri util
Sep 14, 2023
049a99e
bump version
Sep 15, 2023
5e2b2d0
fix: Fix json tags
Sep 15, 2023
0ecc2df
build(deps-dev): bump @types/node from 20.5.0 to 20.6.1
dependabot[bot] Sep 15, 2023
8ab7c2c
feat(indexer): Enable devnet indexer as a preset
Sep 15, 2023
beb36a7
comments
Sep 15, 2023
e8fc677
fix: Include preset in presets
Sep 15, 2023
73f16c1
op-program: Use hardcoded chain config when available
Inphi Sep 17, 2023
7d0e3a6
Fix a typo in derivation.md
cynic-1 Sep 18, 2023
44cc8e4
Fix a typo in glossary.md
cynic-1 Sep 18, 2023
0d1c412
Address coordinator changes
refcell Sep 18, 2023
ea51dfa
trace provider
refcell Sep 15, 2023
a0f10e5
Add support for the output cannon trace type
refcell Sep 15, 2023
21345d5
Merge branch 'develop' into 09-14-fix_indexer_Fix_uri_util
mergify[bot] Sep 18, 2023
9b39896
Remove mutex and reorder metric updates
refcell Sep 18, 2023
873daaf
build(deps): bump ethereum/client-go in /ops-bedrock (#7283)
dependabot[bot] Sep 18, 2023
5fe9953
Merge branch 'develop' into 09-14-fix_indexer_Fix_uri_util
mergify[bot] Sep 18, 2023
64cb79e
Merge pull request #7251 from ethereum-optimism/09-14-fix_indexer_Fix…
OptimismBot Sep 18, 2023
ff8ae4a
Merge branch 'develop' into dependabot/npm_and_yarn/types/node-20.6.1
mergify[bot] Sep 18, 2023
4e8e61d
Merge pull request #7268 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 18, 2023
fbfd621
Merge branch 'develop' into dependabot/npm_and_yarn/eslint-plugin-uni…
mergify[bot] Sep 18, 2023
3f3544a
Merge pull request #7284 from cynic-1/patch-3
trianglesphere Sep 18, 2023
93cbd63
Merge branch 'develop' into dependabot/npm_and_yarn/eslint-plugin-uni…
mergify[bot] Sep 18, 2023
b7e022b
build(deps-dev): bump @types/node from 20.5.0 to 20.6.2
dependabot[bot] Sep 18, 2023
0d90dcc
Merge pull request #7280 from cynic-1/patch-2
trianglesphere Sep 18, 2023
b51fb4c
Merge branch 'develop' into dependabot/npm_and_yarn/eslint-plugin-uni…
mergify[bot] Sep 18, 2023
cd2b344
Merge pull request #7006 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 18, 2023
be4e0ba
Merge branch 'develop' into refcell/output-trace-type
mergify[bot] Sep 18, 2023
a6797a3
Merge branch 'develop' into felipe/proxyd-ha
mergify[bot] Sep 18, 2023
0e666c6
Merge pull request #7252 from ethereum-optimism/felipe/proxyd-ha
OptimismBot Sep 18, 2023
33ee2df
Merge branch 'develop' into dependabot/npm_and_yarn/types/node-20.6.2
mergify[bot] Sep 18, 2023
dbba9a3
build(deps-dev): bump markdownlint from 0.31.0 to 0.31.1
dependabot[bot] Sep 18, 2023
181e96e
Merge pull request #7295 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 18, 2023
251265c
Merge branch 'develop' into refcell/output-trace-type
mergify[bot] Sep 18, 2023
088ad14
build(deps-dev): bump vitest from 0.34.1 to 0.34.4
dependabot[bot] Sep 18, 2023
4926d5f
Merge pull request #7273 from ethereum-optimism/refcell/output-trace-…
OptimismBot Sep 18, 2023
66cbc5c
forge install: safe-contracts
maurelian Sep 15, 2023
36defa4
bindings: Add Safe and SafeProxyFactory bindings
maurelian Sep 18, 2023
32be46a
ci: Update semgrepignore
maurelian Sep 18, 2023
f368843
Merge pull request #7293 from ethereum-optimism/jm/add-safe-bindings
OptimismBot Sep 19, 2023
586d8e5
Merge branch 'develop' into dependabot/npm_and_yarn/vitest-0.34.4
mergify[bot] Sep 19, 2023
2c7cfb8
feat(ctb): DelayedVetoable as a simple forwarder
maurelian Sep 6, 2023
e76d230
feat(ctb): Add the delay.
maurelian Sep 8, 2023
574e0b8
feat(ctb): Add vetoer and initiator roles
maurelian Sep 8, 2023
7b40bd2
feat(ctb): move DelayedVetoable to L1 dir
maurelian Sep 8, 2023
a5f8569
feat(ctb): Add semver
maurelian Sep 8, 2023
a6279cb
refactor(ctb): Remove the veto function.
maurelian Sep 9, 2023
ef08493
feat(op-bindings): Add bindings for DelayedVetoable
maurelian Sep 7, 2023
abd752e
feat(ctb): make vetoer and iniator getters virtual
maurelian Sep 11, 2023
12c9e3b
chore(ctb): Update semver and import path
maurelian Sep 12, 2023
e096a62
feat(ctb): Make storage variables immutable
maurelian Sep 13, 2023
f95b314
feat(ctb): Remove ability to receive eth
maurelian Sep 13, 2023
70df675
feat(ctb): Start with a delay of zero and forward instantly
maurelian Sep 14, 2023
af490bb
chore(ctb): Allow vetoing after the delay
maurelian Sep 14, 2023
1d09930
fix(ctb): Address compiler warnings
maurelian Sep 14, 2023
0a1ffdc
fix(ctb): Immutables scream like a snake
maurelian Sep 14, 2023
a4c6644
fix(ctb): Properly handle return data
maurelian Sep 15, 2023
82f27c2
refactor(ctb): Inline the _activateDelay logic
maurelian Sep 15, 2023
7cd55c4
feat(ctb): Update semver to 1.0.0
maurelian Sep 15, 2023
76e632c
feat(ctb): Update tests and add comments for queuedAt selector clash
maurelian Sep 18, 2023
cabfcd7
locks and bindings
maurelian Sep 15, 2023
5d93697
op-node: Fix race condition while closing OpNode (#7303)
Inphi Sep 19, 2023
b6c8e14
introduce the rollup rpc url flag
refcell Sep 15, 2023
4cfe73f
Rollup RPC Flag
refcell Sep 15, 2023
8dd1df8
Merge branch 'develop' into dependabot/npm_and_yarn/vitest-0.34.4
mergify[bot] Sep 19, 2023
2220794
Merge pull request #7297 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 19, 2023
f6cccda
Merge branch 'develop' into dependabot/npm_and_yarn/markdownlint-0.31.1
mergify[bot] Sep 19, 2023
b32eacd
Merge pull request #7294 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 19, 2023
da44c91
Merge branch 'develop' into jm/basic-delay
mergify[bot] Sep 19, 2023
122a015
Revert "Merge pull request #6863 from ethereum-optimism/08-17-chore_i…
Sep 15, 2023
0511b47
Merge pull request #7121 from ethereum-optimism/jm/basic-delay
OptimismBot Sep 19, 2023
fca6e25
Merge branch 'develop' into inphi/host-chainid
mergify[bot] Sep 19, 2023
802b3a2
feat(ctb): Rework FaultDisputeGame resolution
Inphi Aug 30, 2023
9c39a63
:bug: fix(indexer): add retries to db connection
Sep 1, 2023
a51c60a
cleaner
Sep 19, 2023
df4a2d6
cleaner again
Sep 19, 2023
2961cf9
Merge pull request #7278 from ethereum-optimism/inphi/host-chainid
OptimismBot Sep 19, 2023
177dfd7
Merge branch 'develop' into refcell/l2-consensus
mergify[bot] Sep 19, 2023
9672f1d
Merge pull request #7274 from ethereum-optimism/refcell/l2-consensus
OptimismBot Sep 19, 2023
57f4ca3
Merge pull request #7091 from ethereum-optimism/09-01-fix_indexer_add…
roninjin10 Sep 19, 2023
7fefff6
op-challenger: Updated for the revised resolution (#7155)
Inphi Sep 19, 2023
8d8b670
build(deps-dev): bump @types/node from 20.5.0 to 20.6.2 (#7302)
dependabot[bot] Sep 19, 2023
48a146d
Merge branch 'develop' into inphi/fdg-rez
mergify[bot] Sep 19, 2023
220846d
fix(op-bootnode): add missed flags and enable metrics server (#7282)
bnoieh Sep 19, 2023
0b5f3ab
Merge branch 'develop' into inphi/fdg-rez
mergify[bot] Sep 19, 2023
7e38500
Chore: Cleanup the op-bootnode.
refcell Sep 19, 2023
b43d770
espresso demo setup
nomaxg Sep 19, 2023
16f0aad
Merge pull request #7061 from ethereum-optimism/inphi/fdg-rez
OptimismBot Sep 19, 2023
2771936
fix(ctb): Add vm.assume to prevent clashes on additional test cases (…
maurelian Sep 19, 2023
d966ccf
build(deps-dev): bump @typescript-eslint/parser from 6.4.0 to 6.7.2
dependabot[bot] Sep 18, 2023
0a3c460
Merge pull request #7296 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 19, 2023
1732d9c
build(deps): bump viem from 1.3.1 to 1.11.0
dependabot[bot] Sep 19, 2023
c93a553
Merge pull request #7309 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 19, 2023
6a3a96c
Merge branch 'develop' into refcell/cleanup-bootnode
mergify[bot] Sep 20, 2023
024c751
Merge pull request #7307 from ethereum-optimism/refcell/cleanup-bootnode
OptimismBot Sep 20, 2023
ae10db9
Support old Make version by avoiding SHELLSTATUS
karlb Sep 18, 2023
d8501a7
Merge pull request #7286 from celo-org/karlb/makefile-macos-fix
OptimismBot Sep 20, 2023
a27f562
Constant time parent lookup fix.
refcell Sep 20, 2023
9cf7abb
fix l1 origin bug
nomaxg Sep 20, 2023
e7fd0a1
remove unecessary log
nomaxg Sep 20, 2023
9267b85
Fix contract indices nit
refcell Sep 20, 2023
c5732fc
Merge pull request #7316 from ethereum-optimism/refcell/constant-time…
OptimismBot Sep 20, 2023
df2415a
Merge branch 'develop' into refcell/complete-games-queue
mergify[bot] Sep 20, 2023
d41133c
build(deps): bump envalid from 7.3.1 to 8.0.0
dependabot[bot] Sep 20, 2023
92d2e22
Merge pull request #7261 from ethereum-optimism/refcell/complete-game…
OptimismBot Sep 20, 2023
8ca84ee
Merge branch 'develop' into refcell/executor-thread-metrics
mergify[bot] Sep 20, 2023
61f9ea2
Merge pull request #7262 from ethereum-optimism/refcell/executor-thre…
OptimismBot Sep 20, 2023
fd30c43
Merge branch 'develop' into revert-indexer-disable
mergify[bot] Sep 20, 2023
30fdc8f
Track the number of claims in each game.
refcell Sep 15, 2023
5f00fa1
zero out the claim count upon resolution
refcell Sep 15, 2023
db4a958
Fix nits
refcell Sep 19, 2023
54d1700
Merge pull request #7265 from ethereum-optimism/revert-indexer-disable
OptimismBot Sep 20, 2023
bddac53
Apply suggestions from code review
roninjin10 Sep 21, 2023
061dfdb
Init MM metrics
spacesailor24 Sep 20, 2023
bf4c458
Merge branch 'develop' into wyatt/ufm/init-mm-metrics
mergify[bot] Sep 21, 2023
875b549
lint
Sep 21, 2023
b15e3ff
Merge pull request #7320 from ethereum-optimism/wyatt/ufm/init-mm-met…
OptimismBot Sep 21, 2023
51da485
Merge branch 'develop' into refcell/claim-count-tracker
mergify[bot] Sep 21, 2023
3a83da3
build(deps-dev): bump @types/node from 20.5.0 to 20.6.3
dependabot[bot] Sep 21, 2023
eb76a0d
Merge pull request #7264 from ethereum-optimism/refcell/claim-count-t…
OptimismBot Sep 21, 2023
6676871
Merge branch 'develop' into 09-15-feat_indexer_Enable_devnet_indexer_…
mergify[bot] Sep 21, 2023
cabb04c
Merge pull request #7271 from ethereum-optimism/09-15-feat_indexer_En…
OptimismBot Sep 21, 2023
313fbaf
chore(indexer): remove indexer all command
Sep 14, 2023
cedd438
Merge pull request #7247 from ethereum-optimism/09-14-chore_indexer_r…
OptimismBot Sep 21, 2023
4fd84d6
Merge branch 'develop' into dependabot/npm_and_yarn/types/node-20.6.3
mergify[bot] Sep 21, 2023
15dfa31
Merge pull request #7318 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 21, 2023
e422c54
Merge branch 'develop' into dependabot/npm_and_yarn/envalid-8.0.0
mergify[bot] Sep 21, 2023
fe1ad87
build(deps-dev): bump vitest from 0.34.1 to 0.34.4
dependabot[bot] Sep 21, 2023
5351d10
build(deps-dev): bump glob from 10.3.3 to 10.3.5
dependabot[bot] Sep 21, 2023
05597a5
Merge pull request #7326 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 21, 2023
ffd9b0b
Merge branch 'develop' into dependabot/npm_and_yarn/glob-10.3.5
mergify[bot] Sep 21, 2023
8be6b99
Merge pull request #7327 from ethereum-optimism/dependabot/npm_and_ya…
OptimismBot Sep 21, 2023
2bc83f9
contracts-bedrock: internal devnet ProtocolVersions deployment
protolambda Sep 21, 2023
ebe48e4
go: update libp2p to fix Go 1.21 build
protolambda Sep 21, 2023
e089763
Merge pull request #7332 from ethereum-optimism/deploy-devnet-protoco…
tynes Sep 21, 2023
681c2df
Merge pull request #7319 from ethereum-optimism/dependabot/npm_and_ya…
tynes Sep 21, 2023
4c676e5
Merge branch 'develop' into update-libp2p
mergify[bot] Sep 21, 2023
4e0e173
Merge pull request #7333 from ethereum-optimism/update-libp2p
OptimismBot Sep 21, 2023
e81b66f
unformat init.py, pass l1blockref down to the espresso l1 origin func…
nomaxg Sep 21, 2023
38449bb
Merge branch 'integration' into espresso-demo-setup
nomaxg Sep 21, 2023
7188b32
update libp2p
nomaxg Sep 22, 2023
1a00228
Revert "update libp2p"
nomaxg Sep 22, 2023
05fdae3
update libp2p
nomaxg Sep 22, 2023
3eacf11
add back ff dep
nomaxg Sep 22, 2023
5658f9a
lint fixes
nomaxg Sep 22, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ cache
packages/contracts-bedrock/deployments/devnetL1
packages/contracts-bedrock/deployments/devnetL1-espresso
packages/contracts-bedrock/deployments/devnetL1-espresso2
packages/contracts-bedrock/deployments/espresso-demo
packages/contracts-bedrock/deployments/anvil

# vim
Expand All @@ -38,6 +39,7 @@ packages/contracts-bedrock/deployments/anvil
.devnet
.devnet-espresso
.devnet-espresso2
.espresso-demo

# Ignore local fuzzing results
**/testdata/fuzz/
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ITESTS_L2_HOST=http://localhost:9545
BEDROCK_TAGS_REMOTE?=origin
DEVNET_ESPRESSO_FLAGS=--espresso --deploy-config="devnetL1-espresso.json" --deploy-config-template="devnetL1-espresso-template.json" --deployment="devnetL1-espresso" --devnet-dir=".devnet-espresso" --l2-provider-url="http://localhost:19090"
DEVNET_ESPRESSO_OP2_FLAGS=--espresso --deploy-config="devnetL1-espresso2.json" --deploy-config-template="devnetL1-espresso2-template.json" --deployment="devnetL1-espresso2" --devnet-dir=".devnet-espresso2" --l2-provider-url="http://localhost:29090" --faucet-url="http://localhost:28111" --l2="op2"
DEVNET_ESPRESSO_DEMO_FLAGS=--espresso --deploy-config="espresso-demo.json" --deploy-config-template="espresso-demo-template.json" --deployment="espresso-demo" --devnet-dir=".espresso-demo" --l2-provider-url="http://localhost:19090" --l2="op" --compose-file "demo-docker-compose.yml" --faucet-url="http://localhost:28111"
monorepo-base := $(realpath .)

build: build-go build-ts
Expand Down Expand Up @@ -122,6 +123,10 @@ devnet-up-espresso2:
PYTHONPATH=./bedrock-devnet python3 ./bedrock-devnet/main.py --monorepo-dir=. $(DEVNET_ESPRESSO_OP2_FLAGS) --deploy-l2
.PHONY: devnet-up-espresso2

devnet-up-espresso-demo:
PYTHONPATH=./bedrock-devnet python3 ./bedrock-devnet/main.py --monorepo-dir=. $(DEVNET_ESPRESSO_DEMO_FLAGS) --deploy-l2
.PHONY: devnet-up-espresso-demo

# alias for devnet-up
devnet-up-deploy: devnet-up

Expand All @@ -137,6 +142,10 @@ devnet-test-espresso2:
PYTHONPATH=./bedrock-devnet python3 ./bedrock-devnet/main.py --monorepo-dir=. $(DEVNET_ESPRESSO_OP2_FLAGS) --test
.PHONY: devnet-test-espresso2

devnet-test-espresso-demo:
PYTHONPATH=./bedrock-devnet python3 ./bedrock-devnet/main.py --monorepo-dir=. $(DEVNET_ESPRESSO_DEMO_FLAGS) --test
.PHONY: devnet-test-espresso-demo

devnet-down:
@(cd ./ops-bedrock && GENESIS_TIMESTAMP=$(shell date +%s) docker compose down -v)
.PHONY: devnet-down
Expand All @@ -145,9 +154,11 @@ devnet-clean:
rm -rf ./packages/contracts-bedrock/deployments/devnetL1
rm -rf ./packages/contracts-bedrock/deployments/devnetL1-espresso
rm -rf ./packages/contracts-bedrock/deployments/devnetL1-espresso2
rm -rf ./packages/contracts-bedrock/deployments/espresso-demo
rm -rf ./.devnet
rm -rf ./.devnet-espresso
rm -rf ./.devnet-espresso2
rm -rf ./.espresso-demo
cd ./ops-bedrock && docker compose down -v
docker image ls 'ops-bedrock*' --format='{{.Repository}}' | xargs -r docker rmi
docker volume ls --filter name=ops-bedrock --format='{{.Name}}' | xargs -r docker volume rm
Expand Down
26 changes: 17 additions & 9 deletions bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
parser.add_argument('--deployment', help='Path to deployment output files, relative to packages/contracts-bedrock/deployments', default='devnetL1')
parser.add_argument('--devnet-dir', help='Output path for devnet config, relative to --monorepo-dir', default='.devnet')
parser.add_argument('--espresso', help='Run on Espresso Sequencer', type=bool, action=argparse.BooleanOptionalAction)
parser.add_argument("--compose-file", help="Compose file to use for demo images", type=str, default="docker-compose.yml")

log = logging.getLogger()

Expand Down Expand Up @@ -119,9 +120,14 @@ def deploy_contracts(paths, deploy_config: str, deploy_l2: bool):
account = response['result'][0]
log.info(f'Deploying with {account}')

# The create2 account is shared by both L2s, so don't redeploy it if we are deploying onto an
# existing L1.
if not deploy_l2:
# The create2 account is shared by both L2s, so don't redeploy it unless necessary
# We check to see if the create2 deployer exists by querying its balance
res = run_command(
["cast", "balance", "0x3fAB184622Dc19b6109349B94811493BF2a45362"],
capture_output=True,
)
deployer_balance = int(res.stdout.strip())
jbearer marked this conversation as resolved.
Show resolved Hide resolved
if deployer_balance == 0:
# send some ether to the create2 deployer account
run_command([
'cast', 'send', '--from', account,
Expand Down Expand Up @@ -205,6 +211,7 @@ def devnet_deploy(paths, args):
espresso = args.espresso
l2 = args.l2
l2_provider_url = args.l2_provider_url
compose_file = args.compose_file

if os.path.exists(paths.genesis_l1_path) and os.path.isfile(paths.genesis_l1_path):
log.info('L1 genesis already generated.')
Expand Down Expand Up @@ -237,7 +244,7 @@ def devnet_deploy(paths, args):
else:
# Deploy L1 and sequencer network.
log.info('Starting L1.')
run_command(['docker', 'compose', 'up', '-d', 'l1'], cwd=paths.ops_bedrock_dir, env={
run_command(['docker', 'compose', '-f', compose_file, 'up', '-d', 'l1'], cwd=paths.ops_bedrock_dir, env={
'PWD': paths.ops_bedrock_dir,
'DEVNET_DIR': paths.devnet_dir
})
Expand All @@ -254,7 +261,7 @@ def devnet_deploy(paths, args):
'sequencer0',
'sequencer1',
]
run_command(['docker-compose', 'up', '-d'] + espresso_services, cwd=paths.ops_bedrock_dir, env={
run_command(['docker-compose', '-f', compose_file, 'up', '-d'] + espresso_services, cwd=paths.ops_bedrock_dir, env={
'PWD': paths.ops_bedrock_dir,
'DEVNET_DIR': paths.devnet_dir
})
Expand All @@ -277,7 +284,7 @@ def devnet_deploy(paths, args):
addresses = read_json(paths.addresses_json_path)

log.info('Bringing up L2.')
run_command(['docker', 'compose', 'up', '-d', f'{l2}-l2', f'{l2}-geth-proxy'], cwd=paths.ops_bedrock_dir, env={
run_command(['docker', 'compose', '-f', compose_file, 'up', '-d', f'{l2}-l2', f'{l2}-geth-proxy'], cwd=paths.ops_bedrock_dir, env={
'PWD': paths.ops_bedrock_dir,
'DEVNET_DIR': paths.devnet_dir
})
Expand All @@ -293,7 +300,7 @@ def devnet_deploy(paths, args):
log.info(f'Using batch inbox {batch_inbox_address}')

log.info('Bringing up everything else.')
command = ['docker', 'compose', 'up', '-d']
command = ['docker', 'compose', '-f', compose_file, 'up', '-d']
if args.deploy_l2:
# If we are deploying onto an existing L1, don't restart the services that are already
# running.
Expand All @@ -307,7 +314,7 @@ def devnet_deploy(paths, args):
})

log.info('Starting block explorer')
run_command(['docker-compose', 'up', '-d', f'{l2}-blockscout'], cwd=paths.ops_bedrock_dir)
run_command(['docker-compose', '-f', compose_file, 'up', '-d', f'{l2}-blockscout'], cwd=paths.ops_bedrock_dir)

log.info('Devnet ready.')

Expand Down Expand Up @@ -388,12 +395,13 @@ def devnet_test(paths, l2_provider_url, faucet_url):
timeout=8*60,
)

def run_command(args, check=True, shell=False, cwd=None, env=None, timeout=None):
def run_command(args, check=True, shell=False, cwd=None, env=None, timeout=None, capture_output=False):
env = env if env else {}
return subprocess.run(
args,
check=check,
shell=shell,
capture_output=capture_output,
env={
**os.environ,
**env
Expand Down
22 changes: 19 additions & 3 deletions op-node/rollup/derive/batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,23 @@ const (
// conform with the constraints of the derivation pipeline. The resulting L1 origin will always be
// the same as parent's or one block after parent's, will always conform to the derivation
// constraints, and is deterministic given `parent` and `suggested.`
func EspressoL1Origin(cfg *rollup.Config, parent eth.L2BlockRef, suggested eth.L1BlockRef) uint64 {
func EspressoL1Origin(cfg *rollup.Config, parent eth.L2BlockRef, suggested eth.L1BlockRef, nextL1Block eth.L1BlockRef, l log.Logger) uint64 {
prev := parent.L1Origin
windowStart := parent.Time + cfg.BlockTime
nextL1BlockEligible := nextL1Block.Time <= windowStart

// Constraint 1: the L1 origin must not skip an L1 block.
if suggested.Number > prev.Number+1 {
// If we did skip an L1 block, that is Espresso telling us that multiple new L1 blocks have
// already been produced. In this case, we will not block when fetching the next L1 origin,
// so advance as far as the derivation pipeline allows: one block.
return prev.Number + 1
if nextL1BlockEligible {
l.Info("We skipped an L1 block and the next L1 block is eligible as an origin, advancing by one")
return prev.Number + 1
} else {
l.Info("We skipped an L1 block and the next L1 block is not eligible as an origin, using the old origin")
return prev.Number
}
}
// Constraint 2: the L1 origin number decreased.
//
Expand All @@ -57,6 +64,7 @@ func EspressoL1Origin(cfg *rollup.Config, parent eth.L2BlockRef, suggested eth.L
// In this case, we have no indication that new L1 blocks are ready. We don't want to
// advance the L1 origin number and force the derivation pipeline to block waiting for a new
// L1 block to be produced, so just reuse the previous L1 origin.
l.Info("L1 origin decreased, using the old origin")
return prev.Number
}
// Constraint 3: the L1 origin is too old.
Expand All @@ -65,6 +73,7 @@ func EspressoL1Origin(cfg *rollup.Config, parent eth.L2BlockRef, suggested eth.L
// forced to advance the L1 origin. At worst, the derivation pipeline may block until the
// next L1 origin is available, but if the chosen L1 origin is this old, it is likely that a
// new L1 block is available and Espresso just hasn't seen it yet for some reason.
l.Info("L1 origin is too old, advancing by one")
return prev.Number + 1
}
// Constraint 4: the L1 origin must not be newer than the L2 batch.
Expand All @@ -73,6 +82,7 @@ func EspressoL1Origin(cfg *rollup.Config, parent eth.L2BlockRef, suggested eth.L
// timestamp earlier than `prev`, and thus earlier than the current batch. Espresso must be
// running ahead of the L2, which is fine, we'll just wait to advance the L1 origin until
// the L2 chain catches up.
l.Info("L1 origin is newer than the L2 batch, use the previous origin")
return prev.Number
}

Expand Down Expand Up @@ -139,7 +149,13 @@ func CheckBatchEspresso(cfg *rollup.Config, log log.Logger, l2SafeHead eth.L2Blo
log.Warn("error reading suggested L1 origin", "err", err, "l1 head", jst.Next.L1Head)
return BatchUndecided
}
expectedL1Origin := EspressoL1Origin(cfg, l2SafeHead, suggestedL1Origin)
nextL1Number := l2SafeHead.L1Origin.Number + 1
nextL1Block, err := l1.L1BlockRefByNumber(context.Background(), nextL1Number)
if err != nil {
log.Warn("error reading next possible L1 origin", "err", err, "origin", nextL1Number)
return BatchUndecided
}
expectedL1Origin := EspressoL1Origin(cfg, l2SafeHead, suggestedL1Origin, nextL1Block, log)
actualL1Origin := uint64(batch.Batch.EpochNum)
if expectedL1Origin != actualL1Origin {
log.Warn("dropping batch because L1 origin was not set correctly",
Expand Down
7 changes: 6 additions & 1 deletion op-node/rollup/driver/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ func (d *Sequencer) sealEspressoBatch(ctx context.Context) (*eth.ExecutionPayloa
if err != nil {
return nil, fmt.Errorf("failed to fetch suggested L1 origin %d: %w", batch.jst.Next.L1Head, err)
}
l1OriginNumber := derive.EspressoL1Origin(d.config, batch.onto, suggestedL1Origin)
nextL1Number := batch.onto.L1Origin.Number + 1
nextL1Block, err := d.l1OriginSelector.FindL1OriginByNumber(ctx, nextL1Number)
if err != nil {
return nil, fmt.Errorf("failed to fetch next possible L1 origin %d: %w", nextL1Block, err)
}
l1OriginNumber := derive.EspressoL1Origin(d.config, batch.onto, suggestedL1Origin, nextL1Block, d.log)
l1Origin := suggestedL1Origin
if l1Origin.Number != l1OriginNumber {
l1Origin, err = d.l1OriginSelector.FindL1OriginByNumber(ctx, l1OriginNumber)
Expand Down
Loading