Skip to content

Commit

Permalink
Merge pull request ethereum#125 from spencer-tb/len-blob-errors
Browse files Browse the repository at this point in the history
Add blob length errors for engine api and transition tool.
  • Loading branch information
Inphi authored May 3, 2023
2 parents 7d7c642 + 04bc070 commit ac64c44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions beacon/engine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ func ExecutableDataToBlock(params ExecutableData) (*types.Block, error) {
h := types.DeriveSha(types.Withdrawals(params.Withdrawals), trie.NewStackTrie(nil))
withdrawalsRoot = &h
}
// Check that number of blobs are valid
for _, tx := range txs {
if tx.Type() == types.BlobTxType && len(tx.DataHashes()) == 0 {
return nil, fmt.Errorf("zero blobs within a blob transaction")
}
}
header := &types.Header{
ParentHash: params.ParentHash,
UncleHash: types.EmptyUncleHash,
Expand Down
3 changes: 3 additions & 0 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,

for i, tx := range txs {
msg, err := core.TransactionToMessage(tx, signer, pre.Env.BaseFee)
if tx.Type() == types.BlobTxType && len(tx.DataHashes()) == 0 {
err = fmt.Errorf("blob transaction with zero blobs")
}
if err != nil {
log.Warn("rejected tx", "index", i, "hash", tx.Hash(), "error", err)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
Expand Down

0 comments on commit ac64c44

Please sign in to comment.