Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
blockchaindevsh committed Dec 27, 2024
1 parent b2bc505 commit 8098298
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,24 @@ func (miner *Miner) commitTransaction(env *environment, tx *types.Transaction) e

func (miner *Miner) commitBlobTransaction(env *environment, tx *types.Transaction) error {
sc := tx.BlobTxSidecar()
if sc == nil && env.isEffectivelySequencing() /* we want to allow blob tx without blobs when it's deriving */ {
panic("blob transaction without blobs in miner")
var nblobs int
if sc == nil {
if env.isEffectivelySequencing() /* we want to allow blob tx without blobs when it's deriving */ {
panic("blob transaction without blobs in miner")
} else { // deriving, which does not have the sidecar
nblobs = len(tx.BlobHashes())
}
} else {
if !env.isEffectivelySequencing() {
panic("blob transaction with blobs in derivation")
}
nblobs = len(sc.Blobs)
}
// Checking against blob gas limit: It's kind of ugly to perform this check here, but there
// isn't really a better place right now. The blob gas limit is checked at block validation time
// and not during execution. This means core.ApplyTransaction will not return an error if the
// tx has too many blobs. So we have to explicitly check it here.
if (env.blobs+len(tx.BlobHashes() /* we changed here, otherwise it'll panic when deriving */))*params.BlobTxBlobGasPerBlob > params.MaxBlobGasPerBlock {
if (env.blobs+nblobs)*params.BlobTxBlobGasPerBlob > params.MaxBlobGasPerBlock {
return errors.New("max data blobs reached")
}
receipt, err := miner.applyTransaction(env, tx)
Expand Down

0 comments on commit 8098298

Please sign in to comment.