Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion docs/CELO_TESTNET_MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ For example:

#### Q9: What access does Espresso need from Celo?

Espresso needs the following to operate the TEE batcher:
Espresso needs the following to operate the Espresso batcher:

| Requirement | Description |
|-------------|-------------|
Expand Down
6 changes: 3 additions & 3 deletions espresso/.env
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ FALLBACK_BATCHER_ADDRESS=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
# cast wallet private-key --mnemonic "test test ... junk" --hd-path "m/44'/60'/0'/0/2"
FALLBACK_BATCHER_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a

# TEE batcher registered in BatchAuthenticator (HD index 6).
# Espresso batcher registered in BatchAuthenticator (HD index 6).
# cast wallet address --mnemonic "test test ... junk" --hd-path "m/44'/60'/0'/0/6"
TEE_BATCHER_ADDRESS=0x976EA74026E726554dB657fA54763abd0C3a0aa9
ESPRESSO_BATCHER_ADDRESS=0x976EA74026E726554dB657fA54763abd0C3a0aa9
# cast wallet private-key --mnemonic "test test ... junk" --hd-path "m/44'/60'/0'/0/6"
TEE_BATCHER_PRIVATE_KEY=0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e
ESPRESSO_BATCHER_PRIVATE_KEY=0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e

L1_CHAIN_ID=11155111
L2_CHAIN_ID=22266222
Expand Down
114 changes: 57 additions & 57 deletions espresso/SECURITY_ANALYSIS.md

Large diffs are not rendered by default.

1,421 changes: 312 additions & 1,109 deletions espresso/bindings/batch_authenticator.go

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions espresso/bindings/opsuccinct_fault_dispute_game.go

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions espresso/devnet-tests/batcher_active_publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func TestBatcherActivePublishOnly(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Minute)
defer cancel()

// Initialize devnet with NON_TEE profile (starts both batchers)
// Initialize devnet with FALLBACK profile (starts both batchers)
d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand All @@ -69,13 +69,13 @@ func TestBatcherActivePublishOnly(t *testing.T) {
batchAuthenticator, err := bindings.NewBatchAuthenticator(config.BatchAuthenticatorAddress, d.L1)
require.NoError(t, err)

teeBatcherAddr, err := batchAuthenticator.TeeBatcher(&bind.CallOpts{})
espressoBatcherAddr, err := batchAuthenticator.EspressoBatcher(&bind.CallOpts{})
require.NoError(t, err)
nonTeeBatcherAddr := config.Genesis.SystemConfig.BatcherAddr
fallbackBatcherAddr := config.Genesis.SystemConfig.BatcherAddr

activeIsTee, err := batchAuthenticator.ActiveIsTee(&bind.CallOpts{})
activeIsEspresso, err := batchAuthenticator.ActiveIsEspresso(&bind.CallOpts{})
require.NoError(t, err)
t.Logf("Initial state: activeIsTee = %v", activeIsTee)
t.Logf("Initial state: activeIsEspresso = %v", activeIsEspresso)

// verifyPublishing helper function
verifyPublishing := func(expectTeeActive bool) {
Expand All @@ -100,24 +100,24 @@ func TestBatcherActivePublishOnly(t *testing.T) {
require.NoError(t, err)
t.Logf("Checking blocks %d-%d", startBlock, endBlock)

teePublished, err := hasBatchTransactions(ctx, d.L1, config.BatchInboxAddress, teeBatcherAddr, startBlock, endBlock)
espressoPublished, err := hasBatchTransactions(ctx, d.L1, config.BatchInboxAddress, espressoBatcherAddr, startBlock, endBlock)
require.NoError(t, err)
nonTeePublished, err := hasBatchTransactions(ctx, d.L1, config.BatchInboxAddress, nonTeeBatcherAddr, startBlock, endBlock)
fallbackPublished, err := hasBatchTransactions(ctx, d.L1, config.BatchInboxAddress, fallbackBatcherAddr, startBlock, endBlock)
require.NoError(t, err)

t.Logf("TEE batcher published: %v, non-TEE batcher published: %v", teePublished, nonTeePublished)
t.Logf("Espresso batcher published: %v, fallback batcher published: %v", espressoPublished, fallbackPublished)

if expectTeeActive {
require.True(t, teePublished, "TEE batcher should publish when active")
require.False(t, nonTeePublished, "non-TEE batcher should NOT publish when inactive")
require.True(t, espressoPublished, "Espresso batcher should publish when active")
require.False(t, fallbackPublished, "fallback batcher should NOT publish when inactive")
} else {
require.True(t, nonTeePublished, "non-TEE batcher should publish when active")
require.False(t, teePublished, "TEE batcher should NOT publish when inactive")
require.True(t, fallbackPublished, "fallback batcher should publish when active")
require.False(t, espressoPublished, "Espresso batcher should NOT publish when inactive")
}
}

// 1. Verify initial state
verifyPublishing(activeIsTee)
verifyPublishing(activeIsEspresso)

// 2. Switch state
t.Logf("Switching batcher state...")
Expand All @@ -128,8 +128,8 @@ func TestBatcherActivePublishOnly(t *testing.T) {
require.Equal(t, types.ReceiptStatusSuccessful, receipt.Status)

// Update expected state
activeIsTee = !activeIsTee
t.Logf("Switched state to: activeIsTee=%v", activeIsTee)
activeIsEspresso = !activeIsEspresso
t.Logf("Switched state to: activeIsEspresso=%v", activeIsEspresso)

// Wait for services to stabilize after switch. In-flight sendTxWithEspresso goroutines
// spawned before deactivation can take ~25s to drain their queued Txmgr.Send calls,
Expand All @@ -138,5 +138,5 @@ func TestBatcherActivePublishOnly(t *testing.T) {
time.Sleep(60 * time.Second)

// 3. Verify new state
verifyPublishing(activeIsTee)
verifyPublishing(activeIsEspresso)
}
2 changes: 1 addition & 1 deletion espresso/devnet-tests/batcher_restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestBatcherRestart(t *testing.T) {
defer cancel()

d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand Down
20 changes: 10 additions & 10 deletions espresso/devnet-tests/batcher_switching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/require"
)

// TestBatcherSwitching tests that the batcher can be switched from the TEE-enabled
// batcher to a fallback non-TEE batcher using the BatchAuthenticator contract.
// TestBatcherSwitching tests that the batcher can be switched from the Espresso
// batcher to a fallback batcher using the BatchAuthenticator contract.
Comment thread
jjeangal marked this conversation as resolved.
//
// This is the devnet equivalent of TestBatcherSwitching from the E2E tests.
// The test runs two batchers in parallel:
Expand All @@ -21,9 +21,9 @@ func TestBatcherSwitching(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

// Initialize devnet with NON_TEE profile (starts both batchers)
// Initialize devnet with FALLBACK profile (starts both batchers)
d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand All @@ -48,11 +48,11 @@ func TestBatcherSwitching(t *testing.T) {
require.NoError(t, err)

// Check current active batcher state before switching
activeIsTee, err := batchAuthenticator.ActiveIsTee(&bind.CallOpts{})
activeIsEspresso, err := batchAuthenticator.ActiveIsEspresso(&bind.CallOpts{})
require.NoError(t, err)
t.Logf("Before switch: activeIsTee = %v", activeIsTee)
t.Logf("Before switch: activeIsEspresso = %v", activeIsEspresso)

// Stop the primary "TEE" batcher (op-batcher with Espresso enabled)
// Stop the Espresso batcher (op-batcher with Espresso enabled)
require.NoError(t, d.StopBatcherSubmitting("op-batcher"))
t.Logf("Stopped op-batcher batch submission")

Expand All @@ -67,10 +67,10 @@ func TestBatcherSwitching(t *testing.T) {
t.Logf("SwitchBatcher transaction confirmed in block %d", receipt.BlockNumber.Uint64())

// Verify the switch happened
activeIsTeeAfter, err := batchAuthenticator.ActiveIsTee(&bind.CallOpts{})
activeIsEspressoAfter, err := batchAuthenticator.ActiveIsEspresso(&bind.CallOpts{})
require.NoError(t, err)
require.NotEqual(t, activeIsTee, activeIsTeeAfter, "activeIsTee should have toggled")
t.Logf("After switch: activeIsTee = %v", activeIsTeeAfter)
require.NotEqual(t, activeIsEspresso, activeIsEspressoAfter, "activeIsEspresso should have toggled")
t.Logf("After switch: activeIsEspresso = %v", activeIsEspressoAfter)

// Start the fallback batcher
require.NoError(t, d.StartBatcherSubmitting("op-batcher-fallback"))
Expand Down
2 changes: 1 addition & 1 deletion espresso/devnet-tests/challenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestChallengeGame(t *testing.T) {
defer cancel()

d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand Down
6 changes: 3 additions & 3 deletions espresso/devnet-tests/devnet_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func (d *Devnet) isRunning() bool {
type ComposeProfile string

const (
TEE ComposeProfile = "tee"
NON_TEE ComposeProfile = "default"
ESPRESSO ComposeProfile = "tee"
FALLBACK ComposeProfile = "default"
)

func (d *Devnet) Up(profile ComposeProfile) (err error) {
Expand All @@ -133,7 +133,7 @@ func (d *Devnet) Up(profile ComposeProfile) (err error) {
"docker", "compose", "up", "-d",
)
cmd.Env = append(os.Environ(), "COMPOSE_PROFILES="+string(profile))
// TEE batcher uses HD index 6 (distinct from the SystemConfig/fallback batcher at index 2)
// Espresso batcher uses HD index 6 (distinct from the SystemConfig/fallback batcher at index 2)
cmd.Env = append(
cmd.Env,
fmt.Sprintf("OP_BATCHER_PRIVATE_KEY=%s", hex.EncodeToString(crypto.FromECDSA(d.secrets.AccountAtIdx(6)))),
Expand Down
2 changes: 1 addition & 1 deletion espresso/devnet-tests/forced_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestForcedTransaction(t *testing.T) {

// Launch docker compose devnet
d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand Down
2 changes: 1 addition & 1 deletion espresso/devnet-tests/key_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestChangeBatchAuthenticatorOwner(t *testing.T) {

d := NewDevnet(ctx, t)

require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand Down
8 changes: 4 additions & 4 deletions espresso/devnet-tests/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"github.com/stretchr/testify/require"
)

func TestSmokeWithoutTEE(t *testing.T) {
func TestSmokeWithFallback(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Minute)
defer cancel()

d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() {
require.NoError(t, d.Down())
}()
Expand All @@ -22,12 +22,12 @@ func TestSmokeWithoutTEE(t *testing.T) {
require.NoError(t, d.RunSimpleL2Burn())
}

func TestSmokeWithTEE(t *testing.T) {
func TestSmokeWithEspresso(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Minute)
defer cancel()

d := NewDevnet(ctx, t)
require.NoError(t, d.Up(TEE))
require.NoError(t, d.Up(ESPRESSO))
defer func() {
require.NoError(t, d.Down())
}()
Expand Down
2 changes: 1 addition & 1 deletion espresso/devnet-tests/withdraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestWithdrawal(t *testing.T) {
defer cancel()

d := NewDevnet(ctx, t)
require.NoError(t, d.Up(NON_TEE))
require.NoError(t, d.Up(FALLBACK))
defer func() { require.NoError(t, d.Down()) }()

alice := crypto.PubkeyToAddress(d.secrets.Alice.PublicKey)
Expand Down
2 changes: 1 addition & 1 deletion espresso/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ services:
- --espresso.espresso-attestation-service=http://attestation-service-zk:${ESPRESSO_ATTESTATION_VERIFIER_PORT}
- --espresso.light-client-addr=0x703848f4c85f18e3acd8196c8ec91eb0b7bd0797
- --espresso.testing-batcher-private-key=${OP_TESTING_BATCHER_PRIVATE_KEY:-$OPERATOR_PRIVATE_KEY}
- --private-key=${OP_BATCHER_PRIVATE_KEY:-$TEE_BATCHER_PRIVATE_KEY}
- --private-key=${OP_BATCHER_PRIVATE_KEY:-$ESPRESSO_BATCHER_PRIVATE_KEY}
- --throttle.unsafe-da-bytes-lower-threshold=0
- --max-channel-duration=2
- --target-num-frames=1
Expand Down
4 changes: 2 additions & 2 deletions espresso/environment/14_batcher_fallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ func waitForRollupToMovePastL1Block(ctx context.Context, rollupCli *sources.Roll
// fallback batcher, ensuring seamless transitions in both directions.
//
// In this scenario the test starts with the batcher running in Espresso
// mode and verifies transactions work correctly. It then stops the TEE batcher,
// mode and verifies transactions work correctly. It then stops the Espresso batcher,
// sends switch action to the Batch Authenticator contract and switches to the
// fallback batcher, verifies transactions continue to go through. Next, it switches
// back to the TEE batcher by restarting it with proper caffeination heights
// back to the Espresso batcher by restarting it with proper caffeination heights
// (both Espresso and L2 heights set to ensure correct sync points). Finally, it
// launches a Caff node with the same caffeination heights and verifies it
// derives the same chain state as the verifier by comparing block hashes at the
Expand Down
2 changes: 1 addition & 1 deletion espresso/environment/6_batch_inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestE2eDevnetWithoutAuthenticatingBatches(t *testing.T) {
// Substitute batcher's transaction manager with one that always sends transactions, even
// if they won't succeed. Otherwise batcher wouldn't submit transactions that would revert to
// batch inbox.
// Use the TEE batcher key (HD index 6) — the same key the primary batcher signs with.
// Use the Espresso batcher key (HD index 6) — the same key the primary batcher signs with.
// This ensures the tx comes from an address that is NOT the SystemConfig batcher, so the
// derivation pipeline's fallback authorization won't accept it either.
txMgrCliConfig := setuputils.NewTxMgrConfig(system.NodeEndpoint(e2esys.RoleL1), system.Cfg.Secrets.AccountAtIdx(6))
Expand Down
10 changes: 5 additions & 5 deletions espresso/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ func (c *AdaptL1BlockRefClient) CallContract(ctx context.Context, call ethereum.
return c.L1Client.CallContract(ctx, call, blockNumber)
}

// FetchTeeBatcherAddress reads the TEE batcher address from the BatchAuthenticator
// FetchEspressoBatcherAddress reads the Espresso batcher address from the BatchAuthenticator
// contract on L1. This is used by the caff node to determine which address signed
// Espresso batches, since the TEE batcher may use a different key than the
// Espresso batches, since the Espresso batcher may use a different key than the
// SystemConfig batcher (fallback batcher).
func FetchTeeBatcherAddress(ctx context.Context, l1Client *ethclient.Client, batchAuthenticatorAddr common.Address) (common.Address, error) {
func FetchEspressoBatcherAddress(ctx context.Context, l1Client *ethclient.Client, batchAuthenticatorAddr common.Address) (common.Address, error) {
caller, err := bindings.NewBatchAuthenticatorCaller(batchAuthenticatorAddr, l1Client)
if err != nil {
return common.Address{}, fmt.Errorf("failed to bind BatchAuthenticator at %s: %w", batchAuthenticatorAddr, err)
}
addr, err := caller.TeeBatcher(&bind.CallOpts{Context: ctx})
addr, err := caller.EspressoBatcher(&bind.CallOpts{Context: ctx})
if err != nil {
return common.Address{}, fmt.Errorf("failed to call BatchAuthenticator.teeBatcher(): %w", err)
return common.Address{}, fmt.Errorf("failed to call BatchAuthenticator.espressoBatcher(): %w", err)
}
return addr, nil
}
6 changes: 3 additions & 3 deletions espresso/scripts/prepare-allocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ op-deployer init --l1-chain-id "${L1_CHAIN_ID}" \

dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .chains.[0].espressoEnabled -t bool -v true

# Configure Espresso TEE batcher for devnet. The TEE batcher uses HD index 6
# (TEE_BATCHER_ADDRESS). The fallback (non-TEE) batcher uses the standard OP stack
# Configure the Espresso batcher for devnet. The Espresso batcher uses HD index 6
# (ESPRESSO_BATCHER_ADDRESS). The fallback batcher uses the standard OP stack
# batcher address from SystemConfig.batcherHash (FALLBACK_BATCHER_ADDRESS, HD index 2).
dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .chains.[0].teeBatcher -v "${TEE_BATCHER_ADDRESS}"
dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .chains.[0].espressoBatcher -v "${ESPRESSO_BATCHER_ADDRESS}"
dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .l1ContractsLocator -v "${ARTIFACTS_DIR}"
dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .l2ContractsLocator -v "${ARTIFACTS_DIR}"
dasel put -f "${DEPLOYER_DIR}/intent.toml" -s .opcmAddress -v `jq -r .opcmAddress < ${DEPLOYER_DIR}/bootstrap_implementations.json`
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ require (
)

require (
github.com/EspressoSystems/espresso-streamers v1.0.0
github.com/EspressoSystems/espresso-streamers v1.0.1-0.20260406215806-453508e666cd
github.com/joho/godotenv v1.5.1
)

Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ github.com/DataDog/zstd v1.5.6-0.20230824185856-869dae002e5e h1:ZIWapoIRN1VqT8GR
github.com/DataDog/zstd v1.5.6-0.20230824185856-869dae002e5e/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/EspressoSystems/espresso-network/sdks/go v0.3.4 h1:1hf/k2rGqIGEGQW8O3fQFltPIyxSmumph8aKIa6AjCk=
github.com/EspressoSystems/espresso-network/sdks/go v0.3.4/go.mod h1:kaxR08mJb5Mijy7a2RhWCIWOevFI4PcXwDkzoEbsVTk=
github.com/EspressoSystems/espresso-streamers v0.0.2-0.20260401083845-6106312fbfd2 h1:QSDzLrdK6vbRv7R0yUd1RGRI3uJuDdJg/vVdkFdOsAM=
github.com/EspressoSystems/espresso-streamers v0.0.2-0.20260401083845-6106312fbfd2/go.mod h1:Op3SNwQnZ3bqwrUXMAORnL2/pNiFzpfOED4ltYs5o/U=
github.com/EspressoSystems/espresso-streamers v0.0.2-0.20260401163154-23746a33ce96 h1:/jViu0A5z/iLVTsxebsZ4gWdLZjsBcwgKfzorxn9sXA=
github.com/EspressoSystems/espresso-streamers v0.0.2-0.20260401163154-23746a33ce96/go.mod h1:Op3SNwQnZ3bqwrUXMAORnL2/pNiFzpfOED4ltYs5o/U=
github.com/EspressoSystems/espresso-streamers v1.0.0 h1:wMeB+aqevIJv0YNA7BcEXQgIUT8IgBLyuubD7R2B7lk=
github.com/EspressoSystems/espresso-streamers v1.0.0/go.mod h1:Op3SNwQnZ3bqwrUXMAORnL2/pNiFzpfOED4ltYs5o/U=
github.com/EspressoSystems/espresso-streamers v1.0.1-0.20260406215806-453508e666cd h1:utaI7XLRcTQTF+FyAN73+HETWopS2DK/KRQS2qqc098=
github.com/EspressoSystems/espresso-streamers v1.0.1-0.20260406215806-453508e666cd/go.mod h1:Op3SNwQnZ3bqwrUXMAORnL2/pNiFzpfOED4ltYs5o/U=
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
Expand Down
18 changes: 9 additions & 9 deletions op-batcher/batcher/espresso_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
// the BatchAuthenticator contract. Returns true if this batcher instance should
// be publishing batches, false if it should stay idle.
//
// The active batcher is determined by the contract's activeIsTee flag:
// - If activeIsTee is true, the TEE batcher address is active
// - If activeIsTee is false, the non-TEE (fallback) batcher address is active
// The active batcher is determined by the contract's activeIsEspresso flag:
// - If activeIsEspresso is true, the Espresso batcher address is active
// - If activeIsEspresso is false, the fallback batcher address is active
//
// This method compares the batcher's own address (from TxMgr) against the
// contract's registered TEE batcher address and the SystemConfig batcher address.
// contract's registered Espresso batcher address and the SystemConfig batcher address.
func (l *BatchSubmitter) isBatcherActive(ctx context.Context) (bool, error) {
// Check if contract code exists at the address
code, err := l.L1Client.CodeAt(ctx, l.RollupConfig.BatchAuthenticatorAddress, nil)
Expand All @@ -40,20 +40,20 @@ func (l *BatchSubmitter) isBatcherActive(ctx context.Context) (bool, error) {

callOpts := &bind.CallOpts{Context: cCtx}

activeIsTee, err := batchAuthenticator.ActiveIsTee(callOpts)
activeIsEspresso, err := batchAuthenticator.ActiveIsEspresso(callOpts)
if err != nil {
return false, fmt.Errorf("failed to check activeIsTee: %w", err)
return false, fmt.Errorf("failed to check activeIsEspresso: %w", err)
}

batcherAddr := l.Txmgr.From()

isActive := (activeIsTee && l.Config.UseEspresso) ||
(!activeIsTee && !l.Config.UseEspresso)
isActive := (activeIsEspresso && l.Config.UseEspresso) ||
(!activeIsEspresso && !l.Config.UseEspresso)

if !isActive {
l.Log.Info("Batcher is not the active batcher, skipping publish",
"batcherAddr", batcherAddr,
"activeIsTee", activeIsTee,
"activeIsEspresso", activeIsEspresso,
"UseEspresso", l.Config.UseEspresso,
)
}
Expand Down
Loading
Loading