Skip to content

Espresso 2: derivation pipeline#445

Draft
QuentinI wants to merge 6 commits into
celo-org:celo-rebase-17from
EspressoSystems:ag/derivation-pipeline
Draft

Espresso 2: derivation pipeline#445
QuentinI wants to merge 6 commits into
celo-org:celo-rebase-17from
EspressoSystems:ag/derivation-pipeline

Conversation

@QuentinI
Copy link
Copy Markdown

This PR introduces the op-node changes of Espresso integration: batch authentication and caff node. As I can't push branches to this PR I can't create a clean stacked PR; relevant changes over #443 are in commit 08a9056

Batch authentication: derivation pipeline now reads BatchAuthenticated events emitted by the BatchAuthenticator contract introduced by #443, gated by EspressoEnforcementTime hardfork timestamp.

Caff node: op-node gains Caff mode support. When a node is configured as a Caff node (CaffNodeConfig.Enabled) and the parent L2 block has reached the configured caffeination height (and the Espresso enforcement hardfork is active), derivation pulls batches directly from the Espresso sequencer via Espresso Streamer

The PR includes unit tests for the batch-authenticator event scanner, Espresso batch RLP round-trip, and the new event-based authorization path across the calldata, blob, and altDA data sources. e2e testing involving actual Espresso instance is not part of this PR because it requires batcher changes as well.

QuentinI and others added 6 commits May 8, 2026 02:50
Adds the Espresso-introduced contracts and the minimum supporting changes
required for them to compile, test, and pass the contract checks.

New contracts and scripts:

- src/L1/BatchAuthenticator.sol and interfaces/L1/IBatchAuthenticator.sol
  (upgradeable contract that authenticates batch transactions, with switching
  between Espresso and fallback batchers)
- scripts/deploy/DeployBatchAuthenticator.s.sol and
  scripts/deploy/DeployEspresso.s.sol
- test/L1/BatchAuthenticator.t.sol and test/mocks/MockEspressoTEEVerifiers.sol
- snapshots/{abi,storageLayout}/BatchAuthenticator.json
- snapshots/semver-lock.json entry for BatchAuthenticator

New submodules:

- lib/espresso-tee-contracts (interfaces required by BatchAuthenticator)
- lib/openzeppelin-contracts-upgradeable-v5 (OZ v5 used by BatchAuthenticator
  via OwnableUpgradeable)

Supporting changes (Espresso-driven):

- foundry.toml: remappings for OZ v5 and espresso-tee-contracts; ignored
  warning codes for vendored libs; OOM-safe jobs settings; via-ir profile.
- justfile: fix-proxy-artifact recipe to handle OZ v5 shadowing Proxy/ProxyAdmin
  artifacts; build/coverage hooks.
- src/universal/Proxy.sol, src/universal/ProxyAdmin.sol: pin pragma to exact
  0.8.15 so they stay in their own compilation group and never emit PUSH0.
- src/universal/ReinitializableBase.sol: loosen pragma to ^0.8.15 so
  BatchAuthenticator (compiled with OZ v5) can import it.
- scripts/* and test/*: disambiguate Proxy artifact lookups to
  src/universal/Proxy.sol:Proxy (avoids OZ v5 proxy/Proxy.sol shadow).
- scripts/checks: bypass interface checks for artifacts originating from lib/;
  add Espresso-related contract names to exclude lists; pragma exclusions for
  Proxy/ProxyAdmin/BatchAuthenticator.
- test/vendor/Initializable.t.sol: exclude BatchAuthenticator (deployed by a
  separate Espresso script).

Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: piersy <pierspowlesland@gmail.com>
…derivation

Adds the Go derivation pipeline changes that consume the BatchAuthenticator
contract introduced in the previous PR. Stacks on the contracts PR.

Introduces an L2-timestamp hardfork (EspressoEnforcementTime) gating all
Espresso derivation semantics. Pre-fork, derivation behaves exactly as
upstream Optimism: batches are accepted based on the L1 transaction sender
matching the SystemConfig batcher address. Post-fork, batches are
authenticated via BatchInfoAuthenticated(bytes32) events emitted by the
BatchAuthenticator contract, and sender-based authorization is rejected.

Adds CollectAuthenticatedBatches which scans L1 receipts over a configurable
lookback window (default 100 blocks) to build the set of authenticated batch
commitment hashes for each L1 block being derived. Results are cached in
two reorg-safe (block-hash-keyed) LRU caches: one for receipt-derived event
sets, one for L1BlockRef resolution. For consecutive L1 blocks the lookback
windows overlap by ~99 blocks, so only one new block's receipts need to be
fetched on each call.

Adds the Caff node code path: when configured (CaffNodeConfig.Enabled) and
active (post-fork, parent L2 block >= configured caffeination height),
derivation pulls batches directly from the Espresso (HotShot) sequencer via
the espresso-streamers package instead of L1. Below that height, or for
non-Caff nodes, derivation falls back to the upstream L1-based path. Build
tag //go:build !mips64 isolates the Caff streamer integration from the
op-program fault-proof target; an empty stub provides the same surface for
mips64 builds and unconditionally falls through to upstream L1 derivation.

The espresso package's only mips64-clean file is constants.go, holding
DefaultBatchAuthLookbackWindow. All other espresso package files
(cli.go, ethclient.go) carry //go:build !mips64 because their dependencies
(espresso-streamers/op, espresso-network/sdks/go) are not mips64-buildable.
The single mips64-reachable consumer of espresso constants is
rollup.Config.BatchAuthLookbackWindowOrDefault (op-node/rollup/espresso_config.go,
untagged); CLI-config conversion helpers live in espresso_cli_config.go
under !mips64.

Adds rollup.Config fields: EspressoEnforcementTime *uint64, CaffNodeConfig,
BatchAuthenticatorAddress, BatchAuthLookbackWindow.

Adds unit tests for batch authentication, Espresso batch round-trip, and
event-based authorization across calldata, blob, and altda data sources.
Adds L1FinalizedBlock() to the L1Fetcher interface family (used by
CaffNextBatch) and corresponding mock/sources/op-program implementations.

Co-authored-by: OpenCode <noreply@opencode.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant