go-ethereum/rollup/da_syncer/serrors/errors.go
Jonas Theis 65a0d4e87d
feat(permissionless batches): recovery mode after permissionless batches (#1115)
* port changes from #1013

* port changes from #1068

* go.mod tidy

* fix compile error

* fix goimports

* fix log

* address review comments

* upgrade golang.org/x/net to 0.23.0

* port changes from #1018

* fix tests and linter errors

* address review comments

* refactor rollup sync service / verifier to use CalldataBlobSource to retrieve data from L1

* add configuration and initialize blob clients

* fix unit tests

* remove unused code

* address review comments

* address more review comments

* implement first version of new da-codec and to handle multiple batches submitted in one transaction

* add CommitBatchDAV7 and handle multiple commit events submitted in a single transactions

* fix bug due to previous batch being empty when processing the first batch within a set of batches

* Allow using MPT

* update to latest da-codec

* add field to CommittedBatchMeta to store LastL1MessageQueueHash for CodecV7 batches

* adjust rollup verifier to support CodecV7 batches

* address review comments

* fix issues after merge

* go mod tidy

* fix unit tests

* update da-codec

* add test TestValidateBatchCodecV7

* go mod tidy

* do not log error on shutdown

* add sanity check for version to deserialization of committedBatchMetaV7

* port changes from #1073

* chore: auto version bump [bot]

* address review comments

* add more logs

* disable ENRUpdater if DA sync mode is enabled

* exit pipeline if context is cancelled

* correctly handle override by setting the head of the chain to the parent's height so that created blocks will always become part of canonical chain

* fix error with genesis event being nil

* chore: auto version bump [bot]

* chore: auto version bump [bot]

* goimports

---------

Co-authored-by: Ömer Faruk Irmak <omerfirmak@gmail.com>
Co-authored-by: Thegaram <Thegaram@users.noreply.github.com>
Co-authored-by: jonastheis <jonastheis@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
2025-02-25 15:25:05 +01:00

63 lines
901 B
Go

package serrors
import (
"fmt"
)
const (
temporary Type = iota
eof
)
var (
TemporaryError = NewTemporaryError(nil)
EOFError = NewEOFError(nil)
Terminated = fmt.Errorf("terminated")
)
type Type uint8
func (t Type) String() string {
switch t {
case temporary:
return "temporary"
case eof:
return "EOF"
default:
return "unknown"
}
}
type syncError struct {
t Type
err error
}
func NewTemporaryError(err error) error {
return &syncError{t: temporary, err: err}
}
func NewEOFError(err error) error {
return &syncError{t: eof, err: err}
}
func (s *syncError) Error() string {
return fmt.Sprintf("%s: %v", s.t, s.err)
}
func (s *syncError) Unwrap() error {
return s.err
}
func (s *syncError) Is(target error) bool {
if target == nil {
return s == nil
}
targetSyncErr, ok := target.(*syncError)
if !ok {
return false
}
return s.t == targetSyncErr.t
}