mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-03 18:43:46 +00:00
* 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 * Allow using MPT * fix issues after merge * bump version --------- Co-authored-by: Ömer Faruk Irmak <omerfirmak@gmail.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
77 lines
1.8 KiB
Go
77 lines
1.8 KiB
Go
package da
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/scroll-tech/da-codec/encoding"
|
|
|
|
"github.com/scroll-tech/go-ethereum/common"
|
|
"github.com/scroll-tech/go-ethereum/core/types"
|
|
"github.com/scroll-tech/go-ethereum/rollup/l1"
|
|
)
|
|
|
|
type Type int
|
|
|
|
const (
|
|
// CommitBatchV0Type contains data of event of CommitBatchV0Type
|
|
CommitBatchV0Type Type = iota
|
|
// CommitBatchWithBlobType contains data of event of CommitBatchWithBlobType (v1, v2, v3, v4)
|
|
CommitBatchWithBlobType
|
|
// RevertBatchType contains data of event of RevertBatchType
|
|
RevertBatchType
|
|
// FinalizeBatchType contains data of event of FinalizeBatchType
|
|
FinalizeBatchType
|
|
)
|
|
|
|
// Entry represents a single DA event (commit, revert, finalize).
|
|
type Entry interface {
|
|
Type() Type
|
|
BatchIndex() uint64
|
|
L1BlockNumber() uint64
|
|
CompareTo(Entry) int
|
|
Event() l1.RollupEvent
|
|
}
|
|
|
|
type EntryWithBlocks interface {
|
|
Entry
|
|
Blocks() []*PartialBlock
|
|
Version() encoding.CodecVersion
|
|
Chunks() []*encoding.DAChunkRawTx
|
|
BlobVersionedHashes() []common.Hash
|
|
}
|
|
|
|
type Entries []Entry
|
|
|
|
// PartialHeader represents a partial header (from DA) of a block.
|
|
type PartialHeader struct {
|
|
Number uint64
|
|
Time uint64
|
|
BaseFee *big.Int
|
|
GasLimit uint64
|
|
Difficulty uint64
|
|
ExtraData []byte
|
|
}
|
|
|
|
func (h *PartialHeader) ToHeader() *types.Header {
|
|
return &types.Header{
|
|
Number: big.NewInt(0).SetUint64(h.Number),
|
|
Time: h.Time,
|
|
BaseFee: h.BaseFee,
|
|
GasLimit: h.GasLimit,
|
|
Difficulty: new(big.Int).SetUint64(h.Difficulty),
|
|
Extra: h.ExtraData,
|
|
}
|
|
}
|
|
|
|
// PartialBlock represents a partial block (from DA).
|
|
type PartialBlock struct {
|
|
PartialHeader *PartialHeader
|
|
Transactions types.Transactions
|
|
}
|
|
|
|
func NewPartialBlock(partialHeader *PartialHeader, txs types.Transactions) *PartialBlock {
|
|
return &PartialBlock{
|
|
PartialHeader: partialHeader,
|
|
Transactions: txs,
|
|
}
|
|
}
|