Sitelet https://github.com/ethereum-optimism/optimism/commit/517e6a997ac5efb46fc92c9359c538d522ac47d9
Skip to content

Commit 517e6a9

Browse files
authored
Add error type and fix misleading error info (#19276)
1 parent 1585a47 commit 517e6a9

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎op-alt-da/damgr.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ var ErrPendingChallenge = errors.New("not found, pending challenge")
2424
// ErrExpiredChallenge is returned when a challenge was not resolved and derivation should skip this input.
2525
var ErrExpiredChallenge = errors.New("challenge expired")
2626

27+
// ErrCommitmentTypeMismatch is returned when the commitment type of the input does not match the expected commitment type in the config.
28+
var ErrCommitmentTypeMismatch = errors.New("commitment type mismatch")
29+
2730
// ErrMissingPastWindow is returned when the input data is MIA and cannot be challenged.
2831
// This is a protocol fatal error.
2932
var ErrMissingPastWindow = errors.New("data missing past window")
@@ -202,7 +205,7 @@ func (d *DA) Reset(ctx context.Context, base eth.L1BlockRef, baseCfg eth.SystemC
202205
func (d *DA) GetInput(ctx context.Context, l1 L1Fetcher, comm CommitmentData, blockId eth.L1BlockRef) (eth.Data, error) {
203206
// If it's not the right commitment type, report it as an expired commitment in order to skip it
204207
if d.cfg.CommitmentType != comm.CommitmentType() {
205-
return nil, fmt.Errorf("invalid commitment type; expected: %v, got: %v: %w", d.cfg.CommitmentType, comm.CommitmentType(), ErrExpiredChallenge)
208+
return nil, fmt.Errorf("invalid commitment type; expected: %v, got: %v: %w", d.cfg.CommitmentType, comm.CommitmentType(), ErrCommitmentTypeMismatch)
206209
}
207210
status := d.state.GetChallengeStatus(comm, blockId.Number)
208211
// check if the challenge is expired

‎op-node/rollup/derive/altda_data_source.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ func (s *AltDADataSource) Next(ctx context.Context) (eth.Data, error) {
7777
if errors.Is(err, altda.ErrReorgRequired) {
7878
// challenge for a new previously derived commitment expired.
7979
return nil, NewResetError(err)
80+
} else if errors.Is(err, altda.ErrCommitmentTypeMismatch) {
81+
// expected different commitment type
82+
s.log.Warn("commitment mismatch, skipping batch", "err", err.Error())
83+
s.comm = nil
84+
// skip the input
85+
return s.Next(ctx)
8086
} else if errors.Is(err, altda.ErrExpiredChallenge) {
8187
// this commitment was challenged and the challenge expired.
8288
s.log.Warn("challenge expired, skipping batch", "comm", s.comm)

0 commit comments

Comments
 (0)