Skip to content

Commit

Permalink
export and check for blobs
Browse files Browse the repository at this point in the history
Signed-off-by: Pranay Valson <[email protected]>
  • Loading branch information
noslav committed Mar 27, 2024
1 parent 102abbd commit 26e28f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/types/block_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ethereum/go-ethereum/params"
)

Expand Down Expand Up @@ -77,6 +78,14 @@ type TransactionExportRLP struct {
BlobTxSidecar *BlobTxSidecar `json:"blobTxSidecar" rlp:"optional"`
}

type BlobsSidecarForExport BlobTxSidecar

type BlobTxSidecarExportRLP struct {
Blobs []kzg4844.Blob
Commitments []kzg4844.Commitment
Proofs []kzg4844.Proof
}

func (r *ReceiptForExport) ExportReceipt() *ReceiptExportRLP {
enc := &ReceiptExportRLP{
PostStateOrStatus: (*Receipt)(r).statusEncoding(),
Expand All @@ -101,6 +110,14 @@ func (r *WithdrawalForExport) ExportWithdrawal() *WithdrawalExportRLP {
}
}

func (blob *BlobsSidecarForExport) ExportBlob(blobTxSidecar *BlobTxSidecar) *BlobTxSidecarExportRLP {
return &BlobTxSidecarExportRLP{
Blobs: blobTxSidecar.Blobs,
Commitments: blobTxSidecar.Commitments,
Proofs: blobTxSidecar.Proofs,
}
}

func (tx *TransactionForExport) ExportTx(chainConfig *params.ChainConfig, blockNumber *big.Int, baseFee *big.Int, blockTime uint64) *TransactionExportRLP {
var inner_tx *Transaction = (*Transaction)(tx)
v, r, s := tx.inner.rawSignatureValues()
Expand Down
3 changes: 3 additions & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ func (env *environment) copy() *environment {
cpy.sidecars = make([]*types.BlobTxSidecar, len(env.sidecars))
copy(cpy.sidecars, env.sidecars)

fmt.Println(cpy.header.ParentBeaconRoot, "Parent Beacon Root found")
fmt.Println(cpy.sidecars, "Sidecars also found")

return cpy
}

Expand Down

0 comments on commit 26e28f5

Please sign in to comment.