Skip to content

Commit

Permalink
fix bug in txWrapDataMax value (ethereum#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-bayardo authored Jan 13, 2023
1 parent 4c3a671 commit 4a0b0e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ const (
// to validate whether they fit into the pool or not.
txMaxSize = 4 * txSlotSize // 128KB

// txWrapDataMax is the maximum size for the additional wrapper data,
// enough to encode a blob-transaction wrapper data (48 bytes for commitment, 4 for offset, 48 for a commitment)
txWrapDataMax = 4 + 4 + params.MaxBlobsPerBlock*(params.FieldElementsPerBlob*32+48)
// txWrapDataMax is the maximum size of an ssz encoded BlobTxWrapData (2 4-byte offsets + the
// raw data for each blob, each kzg commitment, and the aggregated commitment)
txWrapDataMax = 4 + 4 + params.MaxBlobsPerBlock*(params.FieldElementsPerBlob*32+48) + 48
)

var (
Expand Down
3 changes: 2 additions & 1 deletion core/types/data_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,9 @@ type BlobTxWrapData struct {
KzgAggregatedProof KZGProof
}

// sizeWrapData returns the size in bytes of the ssz-encoded BlobTxWrapData
func (b *BlobTxWrapData) sizeWrapData() common.StorageSize {
return common.StorageSize(4 + 4 + b.BlobKzgs.ByteLength() + b.Blobs.ByteLength() + b.KzgAggregatedProof.ByteLength())
return common.StorageSize(codec.ContainerLength(&b.BlobKzgs, &b.Blobs, &b.KzgAggregatedProof))
}

// validateBlobTransactionWrapper implements validate_blob_transaction_wrapper from EIP-4844
Expand Down

0 comments on commit 4a0b0e1

Please sign in to comment.