This repository has been archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eip4844' into eip4844_docker
- Loading branch information
Showing
21 changed files
with
143 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package txlistdecoder | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/taikoxyz/taiko-client/bindings" | ||
"github.com/taikoxyz/taiko-client/pkg/rpc" | ||
) | ||
|
||
type BlobFetcher struct { | ||
rpc *rpc.Client | ||
} | ||
|
||
func NewBlobTxListFetcher(rpc *rpc.Client) *BlobFetcher { | ||
return &BlobFetcher{rpc} | ||
} | ||
|
||
func (d *BlobFetcher) Fetch( | ||
ctx context.Context, | ||
tx *types.Transaction, | ||
meta *bindings.TaikoDataBlockMetadata, | ||
) ([]byte, error) { | ||
if !meta.BlobUsed { | ||
return nil, errBlobUnused | ||
} | ||
|
||
sidecars, err := d.rpc.GetBlobs(ctx, new(big.Int).SetUint64(meta.L1Height+1)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
log.Info("Fetch sidecars", "sidecars", sidecars) | ||
|
||
for _, sidecar := range sidecars { | ||
log.Info("Found sidecar", "KzgCommitment", sidecar.KzgCommitment, "blobHash", common.Bytes2Hex(meta.BlobHash[:])) | ||
|
||
if sidecar.KzgCommitment == common.Bytes2Hex(meta.BlobHash[:]) { | ||
return common.Hex2Bytes(sidecar.Blob), nil | ||
} | ||
} | ||
|
||
return nil, errSidecarNotFound | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package txlistdecoder | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/taikoxyz/taiko-client/bindings" | ||
"github.com/taikoxyz/taiko-client/bindings/encoding" | ||
) | ||
|
||
type CalldataFetcher struct{} | ||
|
||
func (d *CalldataFetcher) Fetch( | ||
ctx context.Context, | ||
tx *types.Transaction, | ||
meta *bindings.TaikoDataBlockMetadata, | ||
) ([]byte, error) { | ||
if meta.BlobUsed { | ||
return nil, errBlobUsed | ||
} | ||
|
||
return encoding.UnpackTxListBytes(tx.Data()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package txlistdecoder | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/taikoxyz/taiko-client/bindings" | ||
) | ||
|
||
var ( | ||
errBlobUsed = errors.New("blob is used") | ||
errBlobUnused = errors.New("blob is not used") | ||
errSidecarNotFound = errors.New("sidecar not found") | ||
) | ||
|
||
type TxListFetcher interface { | ||
Fetch(ctx context.Context, tx *types.Transaction, meta *bindings.TaikoDataBlockMetadata) ([]byte, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters