Skip to content

Commit 09fd0b2

Browse files
committed
pass espresso tests
1 parent d32fdf7 commit 09fd0b2

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed

op-batcher/batcher/driver.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,12 @@ func (l *BatchSubmitter) EspressoStreamer() *espresso.EspressoStreamer[derive.Es
145145
func (l *BatchSubmitter) isEspressoEnabled() bool {
146146
// First check if Espresso is configured (we need the client and the authenticator address)
147147
if l.Espresso == nil || l.RollupConfig.BatchAuthenticatorAddress == (common.Address{}) {
148+
l.Log.Info("Espresso is not enabled", "espresso", l.Espresso, "batchAuthenticatorAddress", l.RollupConfig.BatchAuthenticatorAddress)
148149
return false
149150
}
150151
// Check if the EspressoCeloIntegration fork is active based on current timestamp
151152
currentTime := uint64(time.Now().Unix())
153+
l.Log.Info("Checking if EspressoCeloIntegration is active", "currentTime", currentTime, "espressoCeloIntegrationTime", l.RollupConfig.EspressoCeloIntegrationTime)
152154
return l.RollupConfig.IsEspressoCeloIntegration(currentTime)
153155
}
154156

op-batcher/batcher/service.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ type BatcherConfig struct {
4949

5050
// UseAltDA is true if the rollup config has a DA challenge address so the batcher
5151
// will post inputs to the DA server and post commitments to blobs or calldata.
52-
UseAltDA bool
53-
UseEspresso bool
52+
UseAltDA bool
5453
// maximum number of concurrent blob put requests to the DA server
5554
MaxConcurrentDARequests uint64
5655
// public key and private key of the batcher
@@ -98,7 +97,8 @@ type BatcherService struct {
9897

9998
NotSubmittingOnStart bool
10099

101-
Attestation *nitrite.Result
100+
EspressoEnabled bool
101+
Attestation *nitrite.Result
102102
}
103103

104104
func (bs *BatcherService) EspressoStreamer() *espressoLocal.EspressoStreamer[derive.EspressoBatch] {
@@ -147,13 +147,13 @@ func (bs *BatcherService) initFromCLIConfig(ctx context.Context, version string,
147147
opts = append(optsFromRPC, opts...)
148148

149149
if len(cfg.EspressoUrls) > 0 {
150+
bs.EspressoEnabled = true
150151
bs.Espresso = espresso.NewMultipleNodesClient(cfg.EspressoUrls)
151152
espressoLightClient, err := espressoLightClient.NewLightclientCaller(common.HexToAddress(cfg.EspressoLightClientAddr), bs.L1Client)
152153
if err != nil {
153154
return fmt.Errorf("failed to create Espresso light client")
154155
}
155156
bs.EspressoLightClient = espressoLightClient
156-
// Note: UseEspresso is now determined dynamically by isEspressoEnabled() based on activation timestamp
157157
if err := bs.initKeyPair(); err != nil {
158158
return fmt.Errorf("failed to create key pair for batcher: %w", err)
159159
}
@@ -290,6 +290,13 @@ func (bs *BatcherService) initRollupConfig(ctx context.Context) error {
290290
return fmt.Errorf("failed to retrieve rollup config: %w", err)
291291
}
292292
bs.RollupConfig = rollupConfig
293+
294+
// Initialize EspressoCeloIntegrationTime to genesis timestamp if Espresso is enabled
295+
if bs.EspressoEnabled {
296+
timestamp := bs.RollupConfig.Genesis.L2Time
297+
bs.RollupConfig.EspressoCeloIntegrationTime = &timestamp
298+
}
299+
293300
if err := bs.RollupConfig.Check(); err != nil {
294301
return fmt.Errorf("invalid rollup config: %w", err)
295302
}

op-e2e/actions/proofs/espresso_celo_integration_activation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// system with EspressoCeloIntegration activation configured, and verifies
2222
// that the batcher begins working with Espresso after the activation time.
2323
func Test_EspressoCeloIntegrationActivation(t *testing.T) {
24-
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
24+
ctx, cancel := context.WithCancel(context.Background())
2525
defer cancel()
2626

2727
// Launch Espresso dev node environment

op-e2e/system/e2esys/setup.go

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ func (cfg SystemConfig) Start(t *testing.T, startOpts ...StartOption) (*System,
624624

625625
// sanity-check the deploy config
626626
require.Nil(t, cfg.DeployConfig.L2GenesisJovianTimeOffset, "Jovian is not supported in op-e2e tests yet")
627+
// espressoOffset := hexutil.Uint64(0)
628+
// cfg.DeployConfig.L2GenesisEspressoCeloIntegrationTimeOffset = &espressoOffset
627629

628630
if err := cfg.DeployConfig.Check(cfg.Loggers["config-check"]); err != nil {
629631
return nil, err
@@ -711,31 +713,31 @@ func (cfg SystemConfig) Start(t *testing.T, startOpts ...StartOption) (*System,
711713
L2Time: uint64(cfg.DeployConfig.L1GenesisBlockTimestamp),
712714
SystemConfig: e2eutils.SystemConfigFromDeployConfig(cfg.DeployConfig),
713715
},
714-
BlockTime: cfg.DeployConfig.L2BlockTime,
715-
MaxSequencerDrift: cfg.DeployConfig.MaxSequencerDrift,
716-
SeqWindowSize: cfg.DeployConfig.SequencerWindowSize,
717-
ChannelTimeoutBedrock: cfg.DeployConfig.ChannelTimeoutBedrock,
718-
L1ChainID: cfg.L1ChainIDBig(),
719-
L2ChainID: cfg.L2ChainIDBig(),
720-
BatchInboxAddress: cfg.DeployConfig.BatchInboxAddress,
721-
BatchAuthenticatorAddress: cfg.DeployConfig.BatchAuthenticatorAddress,
722-
DepositContractAddress: cfg.DeployConfig.OptimismPortalProxy,
723-
L1SystemConfigAddress: cfg.DeployConfig.SystemConfigProxy,
724-
RegolithTime: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
725-
CanyonTime: cfg.DeployConfig.CanyonTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
726-
DeltaTime: cfg.DeployConfig.DeltaTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
727-
EcotoneTime: cfg.DeployConfig.EcotoneTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
728-
FjordTime: cfg.DeployConfig.FjordTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
729-
GraniteTime: cfg.DeployConfig.GraniteTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
730-
HoloceneTime: cfg.DeployConfig.HoloceneTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
731-
PectraBlobScheduleTime: cfg.DeployConfig.PectraBlobScheduleTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
732-
IsthmusTime: cfg.DeployConfig.IsthmusTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
733-
JovianTime: cfg.DeployConfig.JovianTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
734-
InteropTime: cfg.DeployConfig.InteropTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
735-
Cel2Time: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
716+
BlockTime: cfg.DeployConfig.L2BlockTime,
717+
MaxSequencerDrift: cfg.DeployConfig.MaxSequencerDrift,
718+
SeqWindowSize: cfg.DeployConfig.SequencerWindowSize,
719+
ChannelTimeoutBedrock: cfg.DeployConfig.ChannelTimeoutBedrock,
720+
L1ChainID: cfg.L1ChainIDBig(),
721+
L2ChainID: cfg.L2ChainIDBig(),
722+
BatchInboxAddress: cfg.DeployConfig.BatchInboxAddress,
723+
BatchAuthenticatorAddress: cfg.DeployConfig.BatchAuthenticatorAddress,
724+
DepositContractAddress: cfg.DeployConfig.OptimismPortalProxy,
725+
L1SystemConfigAddress: cfg.DeployConfig.SystemConfigProxy,
726+
RegolithTime: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
727+
CanyonTime: cfg.DeployConfig.CanyonTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
728+
DeltaTime: cfg.DeployConfig.DeltaTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
729+
EcotoneTime: cfg.DeployConfig.EcotoneTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
730+
FjordTime: cfg.DeployConfig.FjordTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
731+
GraniteTime: cfg.DeployConfig.GraniteTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
732+
HoloceneTime: cfg.DeployConfig.HoloceneTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
733+
PectraBlobScheduleTime: cfg.DeployConfig.PectraBlobScheduleTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
734+
IsthmusTime: cfg.DeployConfig.IsthmusTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
735+
JovianTime: cfg.DeployConfig.JovianTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
736+
InteropTime: cfg.DeployConfig.InteropTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
737+
Cel2Time: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
736738
EspressoCeloIntegrationTime: cfg.DeployConfig.EspressoCeloIntegrationTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
737-
ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy,
738-
AltDAConfig: rollupAltDAConfig,
739+
ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy,
740+
AltDAConfig: rollupAltDAConfig,
739741
ChainOpConfig: &params.OptimismConfig{
740742
EIP1559Elasticity: cfg.DeployConfig.EIP1559Elasticity,
741743
EIP1559Denominator: cfg.DeployConfig.EIP1559Denominator,
@@ -748,6 +750,9 @@ func (cfg SystemConfig) Start(t *testing.T, startOpts ...StartOption) (*System,
748750
return nil, err
749751
}
750752
sys.RollupConfig = &defaultConfig
753+
timestamp := uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)
754+
sys.RollupConfig.EspressoCeloIntegrationTime = &timestamp
755+
log.Info("Setting EspressoCeloIntegrationTime", "espressoCeloIntegrationTime", sys.RollupConfig.EspressoCeloIntegrationTime, "l1GenesisBlockTimestamp", cfg.DeployConfig.L1GenesisBlockTimestamp)
751756

752757
// Create a fake Beacon node to hold on to blobs created by the L1 miner, and to serve them to L2
753758
bcn := fakebeacon.NewBeacon(testlog.Logger(t, log.LevelInfo).New("role", "l1_cl"),

op-node/rollup/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ func (c *Config) IsCel2(timestamp uint64) bool {
500500
}
501501

502502
func (c *Config) IsEspressoCeloIntegration(timestamp uint64) bool {
503-
return c.Cel2Time != nil && timestamp >= *c.Cel2Time && c.EspressoCeloIntegrationTime != nil && timestamp >= *c.EspressoCeloIntegrationTime
503+
return c.EspressoCeloIntegrationTime != nil && timestamp >= *c.EspressoCeloIntegrationTime
504504
}
505505

506506
func (c *Config) IsRegolithActivationBlock(l2BlockTime uint64) bool {

0 commit comments

Comments
 (0)