Skip to content

Commit

Permalink
Merge pull request #110 from bobanetwork/add-l1blobbasefee
Browse files Browse the repository at this point in the history
Add L1BlobBaseFee to the receipt
  • Loading branch information
boyuan-chen authored Aug 19, 2024
2 parents b837d36 + b9855fe commit 7ca3cd6
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 319 deletions.
6 changes: 6 additions & 0 deletions core/types/gen_receipt_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ type Receipt struct {
DepositReceiptVersion *uint64 `json:"depositReceiptVersion,omitempty"`

// Fee scalars were introduced after the Ecotone hardfork
L1BaseFeeScalar *uint64 `json:"l1BaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
L1BlobBaseFeeScalar *uint64 `json:"l1BlobBaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
L1BaseFeeScalar *uint64 `json:"l1BaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
L1BlobBaseFeeScalar *uint64 `json:"l1BlobBaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
L1BlobBaseFee *big.Int `json:"l1BlobBaseFee,omitempty"` // Always nil prior to the Ecotone hardfork
}

type receiptMarshaling struct {
Expand All @@ -125,6 +126,7 @@ type receiptMarshaling struct {
DepositNonce *hexutil.Uint64
DepositReceiptVersion *hexutil.Uint64
L1BaseFeeScalar *hexutil.Uint64
L1BlobBaseFee *hexutil.Big
L1BlobBaseFeeScalar *hexutil.Uint64
}

Expand Down Expand Up @@ -659,6 +661,10 @@ func (r Receipts) DeriveFields(config *chain.Config, hash libcommon.Hash, number
l1BaseFeeScalar := gasParams.L1BaseFeeScalar.Uint64()
r[i].L1BaseFeeScalar = &l1BaseFeeScalar
}
if gasParams.L1BlobBaseFee != nil {
l1BlobBaseFee := gasParams.L1BlobBaseFee
r[i].L1BlobBaseFee = l1BlobBaseFee.ToBig()
}
if gasParams.L1BlobBaseFeeScalar != nil {
l1BlobBaseFeeScalar := gasParams.L1BlobBaseFeeScalar.Uint64()
r[i].L1BlobBaseFeeScalar = &l1BlobBaseFeeScalar
Expand Down
Loading

0 comments on commit 7ca3cd6

Please sign in to comment.