Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tip/post ecotone receipt #209

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ type Receipt struct {
// should be computed when set. The state transition process ensures this is only set for
// post-Canyon deposit transactions.
DepositReceiptVersion *uint64 `json:"depositReceiptVersion,omitempty"`

L1BlobBaseFee *big.Int `json:"l1BlobBaseFee,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
}

type receiptMarshaling struct {
Expand All @@ -115,9 +119,12 @@ type receiptMarshaling struct {

// Optimism
L1GasPrice *hexutil.Big
L1BlobBaseFee *hexutil.Big
L1GasUsed *hexutil.Big
L1Fee *hexutil.Big
FeeScalar *big.Float
L1BaseFeeScalar *hexutil.Uint64
L1BlobBaseFeeScalar *hexutil.Uint64
DepositNonce *hexutil.Uint64
DepositReceiptVersion *hexutil.Uint64
}
Expand Down Expand Up @@ -639,10 +646,19 @@ func (r Receipts) DeriveFields(config *chain.Config, hash libcommon.Hash, number
l1Fee, l1GasUsed := gasParams.CostFunc(txs[i].RollupCostData())
r[i].L1Fee = l1Fee.ToBig()
r[i].L1GasUsed = l1GasUsed.ToBig()
if gasParams.FeeScalar != nil {
r[i].FeeScalar = gasParams.FeeScalar
}
r[i].FeeScalar = gasParams.FeeScalar
r[i].L1BlobBaseFee = gasParams.L1BlobBaseFee.ToBig()
pcw109550 marked this conversation as resolved.
Show resolved Hide resolved
r[i].L1BaseFeeScalar = u32ptrTou64ptr(gasParams.L1BaseFeeScalar)
r[i].L1BlobBaseFeeScalar = u32ptrTou64ptr(gasParams.L1BlobBaseFeeScalar)
}
}
return nil
}

func u32ptrTou64ptr(a *uint32) *uint64 {
if a == nil {
return nil
}
b := uint64(*a)
return &b
}
Loading
Loading