3737 conf .IsthmusTime = & time
3838 return & conf
3939 }()
40+ jovianTestConfig = func () * params.ChainConfig {
41+ conf := * isthmusTestConfig // copy the config
42+ time := uint64 (0 )
43+ conf .JovianTime = & time
44+ return & conf
45+ }()
4046
4147 depositReceiptNoNonce = & Receipt {
4248 Status : ReceiptStatusFailed ,
95101 },
96102 Type : DepositTxType ,
97103 }
104+
105+ daFootprintGasScalar = uint16 (400 )
98106)
99107
100108func clearComputedFieldsOnOPStackReceipts (receipts []* Receipt ) []* Receipt {
@@ -109,6 +117,7 @@ func clearComputedFieldsOnOPStackReceipts(receipts []*Receipt) []*Receipt {
109117 receipt .L1BlobBaseFeeScalar = nil
110118 receipt .OperatorFeeScalar = nil
111119 receipt .OperatorFeeConstant = nil
120+ receipt .DAFootprintGasScalar = nil
112121 }
113122 return receipts
114123}
@@ -200,6 +209,15 @@ func getOptimismIsthmusTxReceipts(l1AttributesPayload []byte, l1GasPrice, l1Blob
200209 return txs , receipts
201210}
202211
212+ func getOptimismJovianTxReceipts (l1AttributesPayload []byte , l1GasPrice , l1BlobBaseFee , l1GasUsed , l1Fee * big.Int , baseFeeScalar , blobBaseFeeScalar , operatorFeeScalar , operatorFeeConstant , daFootprintGasScalar * uint64 ) ([]* Transaction , []* Receipt ) {
213+ txs , receipts := getOptimismIsthmusTxReceipts (l1AttributesPayload , l1GasPrice , l1BlobBaseFee , l1GasUsed , l1Fee , baseFeeScalar , blobBaseFeeScalar , operatorFeeScalar , operatorFeeConstant )
214+ receipts [1 ].DAFootprintGasScalar = daFootprintGasScalar
215+ if daFootprintGasScalar != nil {
216+ receipts [1 ].BlobGasUsed = * daFootprintGasScalar * txs [1 ].RollupCostData ().EstimatedDASize ().Uint64 ()
217+ }
218+ return txs , receipts
219+ }
220+
203221func TestDeriveOptimismBedrockTxReceipts (t * testing.T ) {
204222 // Bedrock style l1 attributes with L1Scalar=7_000_000 (becomes 7 after division), L1Overhead=50, L1BaseFee=1000*1e6
205223 payload := common .Hex2Bytes ("015d8eb900000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000006acfc0015d8eb900000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000006acfc0" )
@@ -286,6 +304,29 @@ func TestDeriveOptimismIsthmusTxReceiptsNoOperatorFee(t *testing.T) {
286304 diffReceipts (t , receipts , derivedReceipts )
287305}
288306
307+ func TestDeriveOptimismJovianTxReceipts (t * testing.T ) {
308+ // Jovian style l1 attributes with baseFeeScalar=2, blobBaseFeeScalar=3, baseFee=1000*1e6, blobBaseFee=10*1e6, operatorFeeScalar=1439103868, operatorFeeConstant=1256417826609331460, daFootprintGasScalar=400
309+ payload := common .Hex2Bytes ("3db6be2b000000020000000300000000000004d200000000000004d200000000000004d2000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d255c6fb7c116fb15b44847d040190" )
310+ // the parameters we use below are defined in rollup_test.go
311+ baseFeeScalarUint64 := baseFeeScalar .Uint64 ()
312+ blobBaseFeeScalarUint64 := blobBaseFeeScalar .Uint64 ()
313+ operatorFeeScalarUint64 := operatorFeeScalar .Uint64 ()
314+ operatorFeeConstantUint64 := operatorFeeConstant .Uint64 ()
315+ daFootprintGasScalarUint64 := uint64 (daFootprintGasScalar )
316+ txs , receipts := getOptimismJovianTxReceipts (payload , baseFee , blobBaseFee , minimumFjordGas , fjordFee , & baseFeeScalarUint64 , & blobBaseFeeScalarUint64 , & operatorFeeScalarUint64 , & operatorFeeConstantUint64 , & daFootprintGasScalarUint64 )
317+
318+ // Re-derive receipts.
319+ baseFee := big .NewInt (1000 )
320+ derivedReceipts := clearComputedFieldsOnOPStackReceipts (receipts )
321+ // Should error out if we try to process this with a pre-Jovian config
322+ err := Receipts (derivedReceipts ).DeriveFields (bedrockGenesisTestConfig , blockHash , blockNumber .Uint64 (), 0 , baseFee , nil , txs )
323+ require .Error (t , err )
324+
325+ err = Receipts (derivedReceipts ).DeriveFields (jovianTestConfig , blockHash , blockNumber .Uint64 (), 0 , baseFee , nil , txs )
326+ require .NoError (t , err )
327+ diffReceipts (t , receipts , derivedReceipts )
328+ }
329+
289330func diffReceipts (t * testing.T , receipts , derivedReceipts []* Receipt ) {
290331 // Check diff of receipts against derivedReceipts.
291332 r1 , err := json .MarshalIndent (receipts , "" , " " )
0 commit comments