Skip to content

Commit

Permalink
feat(taiko-client): changes for meta.blobCreatedIn (#18960)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Feb 19, 2025
1 parent 8a542cd commit c0e0901
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 22 deletions.
3 changes: 3 additions & 0 deletions packages/taiko-client/bindings/metadata/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type TaikoProposalMetaData interface {
GetTxHash() common.Hash
GetProposer() common.Address
GetCoinbase() common.Address
GetBlobCreatedIn() *big.Int
}

type TaikoBlockMetaDataOntake interface {
Expand All @@ -40,6 +41,7 @@ type TaikoBlockMetaDataOntake interface {
GetLivenessBond() *big.Int
GetProposedAt() uint64
GetProposedIn() uint64
GetBlobCreatedIn() *big.Int
GetBlobTxListOffset() uint32
GetBlobTxListLength() uint32
GetBlobIndex() uint8
Expand All @@ -61,6 +63,7 @@ type TaikoBatchMetaDataPacaya interface {
GetProposer() common.Address
GetProposedAt() uint64
GetProposedIn() uint64
GetBlobCreatedIn() *big.Int
GetTxListOffset() uint32
GetTxListSize() uint32
GetLastBlockID() uint64
Expand Down
5 changes: 5 additions & 0 deletions packages/taiko-client/bindings/metadata/metadata_ontake.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ func (m *TaikoDataBlockMetadataOntake) GetProposedIn() uint64 {
return m.ProposedIn
}

// GetBlobCreatedIn returns the L1 block number when the blob created.
func (m *TaikoDataBlockMetadataOntake) GetBlobCreatedIn() *big.Int {
return new(big.Int).SetUint64(m.BlockNumber)
}

// GetBlobTxListOffset returns the blob tx list offset.
func (m *TaikoDataBlockMetadataOntake) GetBlobTxListOffset() uint32 {
return m.BlobTxListOffset
Expand Down
5 changes: 5 additions & 0 deletions packages/taiko-client/bindings/metadata/metadata_pacaya.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func (m *TaikoDataBlockMetadataPacaya) GetProposedIn() uint64 {
return m.ProposedIn
}

// GetBlobCreatedIn returns the L1 block number when the blob created.
func (m *TaikoDataBlockMetadataPacaya) GetBlobCreatedIn() *big.Int {
return new(big.Int).SetUint64(m.BlobCreatedIn)
}

// GetTxListOffset returns calldata tx list offset.
func (m *TaikoDataBlockMetadataPacaya) GetTxListOffset() uint32 {
return m.BlobByteOffset
Expand Down
2 changes: 1 addition & 1 deletion packages/taiko-client/bindings/pacaya/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2be4b799893cb2bf683d47e08f11d1f41c7da52e
d698944ecb2fddd3a8c51e69507c8703b51a2e80
8 changes: 4 additions & 4 deletions packages/taiko-client/bindings/pacaya/gen_prover_set.go

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions packages/taiko-client/bindings/pacaya/gen_taiko_inbox.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/taiko-client/driver/chain_syncer/blob/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewSyncer(
)

var (
txListFetcherBlob = txlistFetcher.NewBlobTxListFetcher(client.L1Beacon, blobDataSource)
txListFetcherBlob = txlistFetcher.NewBlobTxListFetcher(client, blobDataSource)
txListFetcherCalldata = txlistFetcher.NewCalldataFetch(client)
)
return &Syncer{
Expand Down
16 changes: 11 additions & 5 deletions packages/taiko-client/driver/txlist_fetcher/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (

// BlobFetcher is responsible for fetching the txList blob from the L1 block sidecar.
type BlobFetcher struct {
l1Beacon *rpc.BeaconClient
cli *rpc.Client
dataSource *rpc.BlobDataSource
}

// NewBlobTxListFetcher creates a new BlobFetcher instance based on the given rpc client.
func NewBlobTxListFetcher(l1Beacon *rpc.BeaconClient, ds *rpc.BlobDataSource) *BlobFetcher {
return &BlobFetcher{l1Beacon, ds}
func NewBlobTxListFetcher(cli *rpc.Client, ds *rpc.BlobDataSource) *BlobFetcher {
return &BlobFetcher{cli, ds}
}

// FetchOntake implements the TxListFetcher interface.
Expand Down Expand Up @@ -95,11 +95,17 @@ func (d *BlobFetcher) FetchPacaya(
return nil, pkg.ErrBlobUnused
}

// Fetch the L1 block header with the given blob.
l1Header, err := d.cli.L1.HeaderByNumber(ctx, meta.GetBlobCreatedIn())
if err != nil {
return nil, err
}

var b []byte
// Fetch the L1 block sidecars.
sidecars, err := d.dataSource.GetBlobs(
ctx,
meta.GetProposedAt(),
l1Header.Time,
meta.GetBlobHashes()[0],
)
if err != nil {
Expand All @@ -108,7 +114,7 @@ func (d *BlobFetcher) FetchPacaya(

log.Info(
"Fetch sidecars",
"blockNumber", meta.GetRawBlockHeight(),
"blockNumber", meta.GetBlobCreatedIn(),
"sidecars", len(sidecars),
)

Expand Down

0 comments on commit c0e0901

Please sign in to comment.