Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
blob bundle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed Oct 8, 2023
1 parent bde2f8c commit 4c974fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,9 @@ func getCapellaPayload(
}

func getBlobsBundle(blobsBundle *engine.BlobsBundleV1) *builderApiDeneb.BlobsBundle {
var commitments []deneb.KzgCommitment
var proofs []deneb.KzgProof
var blobs []deneb.Blob
commitments := make([]deneb.KzgCommitment, len(blobsBundle.Commitments))
proofs := make([]deneb.KzgProof, len(blobsBundle.Proofs))
blobs := make([]deneb.Blob, len(blobsBundle.Blobs))

// we assume the lengths for blobs bundle is validated beforehand to be the same
for i := range blobsBundle.Blobs {
Expand Down
9 changes: 7 additions & 2 deletions miner/environment_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (envDiff *environmentDiff) commitBlobTx(tx *types.Transaction, chData chain
return nil, txType, err
}

envDiff.newTxs = append(envDiff.newTxs, tx.WithoutBlobTxSidecar())
envDiff.newSidecars = append(envDiff.newSidecars, sc)
envDiff.newBlobs += len(sc.Blobs)
*envDiff.header.BlobGasUsed += receipt.BlobGasUsed
Expand Down Expand Up @@ -145,7 +146,6 @@ func (envDiff *environmentDiff) commitLegacyTx(tx *types.Transaction, chData cha
}

envDiff.newProfit = envDiff.newProfit.Add(envDiff.newProfit, gasPrice.Mul(gasPrice, big.NewInt(int64(receipt.GasUsed))))
envDiff.newTxs = append(envDiff.newTxs, tx)
envDiff.newReceipts = append(envDiff.newReceipts, receipt)

return receipt, shiftTx, nil
Expand All @@ -156,7 +156,12 @@ func (envDiff *environmentDiff) commitTx(tx *types.Transaction, chData chainData
if tx.Type() == types.BlobTxType {
return envDiff.commitBlobTx(tx, chData)
}
return envDiff.commitLegacyTx(tx, chData)
receipt, skip, err := envDiff.commitLegacyTx(tx, chData)
if err != nil {
return nil, skip, err
}
envDiff.newTxs = append(envDiff.newTxs, tx)
return receipt, skip, nil
}

// Commit Bundle to env diff
Expand Down

0 comments on commit 4c974fe

Please sign in to comment.