Skip to content

Commit 038c167

Browse files
authored
Merge pull request testinprod-io#209 from testinprod-io/tip/post-ecotone-receipt
Tip/post ecotone receipt
2 parents b955a69 + 0a84e27 commit 038c167

File tree

3 files changed

+221
-175
lines changed

3 files changed

+221
-175
lines changed

core/types/receipt.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ type Receipt struct {
102102
// should be computed when set. The state transition process ensures this is only set for
103103
// post-Canyon deposit transactions.
104104
DepositReceiptVersion *uint64 `json:"depositReceiptVersion,omitempty"`
105+
106+
L1BlobBaseFee *big.Int `json:"l1BlobBaseFee,omitempty"` // Always nil prior to the Ecotone hardfork
107+
L1BaseFeeScalar *uint64 `json:"l1BaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
108+
L1BlobBaseFeeScalar *uint64 `json:"l1BlobBaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
105109
}
106110

107111
type receiptMarshaling struct {
@@ -115,9 +119,12 @@ type receiptMarshaling struct {
115119

116120
// Optimism
117121
L1GasPrice *hexutil.Big
122+
L1BlobBaseFee *hexutil.Big
118123
L1GasUsed *hexutil.Big
119124
L1Fee *hexutil.Big
120125
FeeScalar *big.Float
126+
L1BaseFeeScalar *hexutil.Uint64
127+
L1BlobBaseFeeScalar *hexutil.Uint64
121128
DepositNonce *hexutil.Uint64
122129
DepositReceiptVersion *hexutil.Uint64
123130
}
@@ -639,10 +646,19 @@ func (r Receipts) DeriveFields(config *chain.Config, hash libcommon.Hash, number
639646
l1Fee, l1GasUsed := gasParams.CostFunc(txs[i].RollupCostData())
640647
r[i].L1Fee = l1Fee.ToBig()
641648
r[i].L1GasUsed = l1GasUsed.ToBig()
642-
if gasParams.FeeScalar != nil {
643-
r[i].FeeScalar = gasParams.FeeScalar
644-
}
649+
r[i].FeeScalar = gasParams.FeeScalar
650+
r[i].L1BlobBaseFee = gasParams.L1BlobBaseFee.ToBig()
651+
r[i].L1BaseFeeScalar = u32ptrTou64ptr(gasParams.L1BaseFeeScalar)
652+
r[i].L1BlobBaseFeeScalar = u32ptrTou64ptr(gasParams.L1BlobBaseFeeScalar)
645653
}
646654
}
647655
return nil
648656
}
657+
658+
func u32ptrTou64ptr(a *uint32) *uint64 {
659+
if a == nil {
660+
return nil
661+
}
662+
b := uint64(*a)
663+
return &b
664+
}

0 commit comments

Comments
 (0)