@@ -13,6 +13,7 @@ import (
1313
1414 "github.com/ethereum-optimism/optimism/op-node/rollup"
1515 "github.com/ethereum-optimism/optimism/op-service/eth"
16+ "github.com/ethereum-optimism/optimism/op-service/ptr"
1617 opsigner "github.com/ethereum-optimism/optimism/op-service/signer"
1718 "github.com/ethereum-optimism/optimism/op-service/testlog"
1819 "github.com/ethereum-optimism/optimism/op-service/testutils"
@@ -123,19 +124,19 @@ func createSignedP2Payload(payload MarshalSSZ, signer Signer, l2ChainID *big.Int
123124 return snappy .Encode (nil , data ), nil
124125}
125126
126- func createExecutionPayload (w types.Withdrawals , withdrawalsRoot * common.Hash , excessGas , gasUsed * uint64 ) * eth.ExecutionPayload {
127+ func createExecutionPayload (w types.Withdrawals , withdrawalsRoot * common.Hash , excessBlobGas , blobGasUsed * uint64 ) * eth.ExecutionPayload {
127128 return & eth.ExecutionPayload {
128129 Timestamp : hexutil .Uint64 (time .Now ().Unix ()),
129130 Withdrawals : & w ,
130131 WithdrawalsRoot : withdrawalsRoot ,
131- ExcessBlobGas : (* eth .Uint64Quantity )(excessGas ),
132- BlobGasUsed : (* eth .Uint64Quantity )(gasUsed ),
132+ ExcessBlobGas : (* eth .Uint64Quantity )(excessBlobGas ),
133+ BlobGasUsed : (* eth .Uint64Quantity )(blobGasUsed ),
133134 }
134135}
135136
136- func createEnvelope (h * common.Hash , w types.Withdrawals , withdrawalsRoot * common.Hash , excessGas , gasUsed * uint64 ) * eth.ExecutionPayloadEnvelope {
137+ func createEnvelope (h * common.Hash , w types.Withdrawals , withdrawalsRoot * common.Hash , excessBlobGas , blobGasUsed * uint64 ) * eth.ExecutionPayloadEnvelope {
137138 return & eth.ExecutionPayloadEnvelope {
138- ExecutionPayload : createExecutionPayload (w , withdrawalsRoot , excessGas , gasUsed ),
139+ ExecutionPayload : createExecutionPayload (w , withdrawalsRoot , excessBlobGas , blobGasUsed ),
139140 ParentBeaconBlockRoot : h ,
140141 }
141142}
@@ -157,7 +158,12 @@ func TestBlockValidator(t *testing.T) {
157158 mockGossipConf := & mockGossipSetupConfigurablesWithThreshold {threshold : 60 * time .Second }
158159 v2Validator := BuildBlocksValidator (testlog .Logger (t , log .LevelCrit ), cfg , runCfg , eth .BlockV2 , mockGossipConf )
159160 v3Validator := BuildBlocksValidator (testlog .Logger (t , log .LevelCrit ), cfg , runCfg , eth .BlockV3 , mockGossipConf )
160- v4Validator := BuildBlocksValidator (testlog .Logger (t , log .LevelCrit ), cfg , runCfg , eth .BlockV4 , mockGossipConf )
161+ v4Validator := BuildBlocksValidator (testlog .Logger (t , log .LevelDebug ), cfg , runCfg , eth .BlockV4 , mockGossipConf )
162+ jovianCfg := & rollup.Config {
163+ L2ChainID : big .NewInt (100 ),
164+ JovianTime : ptr .New (uint64 (0 )),
165+ }
166+ v4JovianValidator := BuildBlocksValidator (testlog .Logger (t , log .LevelCrit ), jovianCfg , runCfg , eth .BlockV4 , mockGossipConf )
161167
162168 zero , one := uint64 (0 ), uint64 (1 )
163169 beaconHash , withdrawalsRoot := common .HexToHash ("0x1234" ), common .HexToHash ("0x9876" )
@@ -174,8 +180,7 @@ func TestBlockValidator(t *testing.T) {
174180 {"V3RejectExecutionPayload" , v3Validator , pubsub .ValidationReject , createExecutionPayload (types.Withdrawals {}, nil , & zero , & zero )},
175181 }
176182
177- for _ , tt := range payloadTests {
178- test := tt
183+ for _ , test := range payloadTests {
179184 t .Run (fmt .Sprintf ("ExecutionPayload_%s" , test .name ), func (t * testing.T ) {
180185 e := & eth.ExecutionPayloadEnvelope {ExecutionPayload : test .payload }
181186 test .payload .BlockHash , _ = e .CheckBlockHash () // hack to generate the block hash easily.
@@ -198,10 +203,11 @@ func TestBlockValidator(t *testing.T) {
198203 {"V3Valid" , v3Validator , pubsub .ValidationAccept , createEnvelope (& beaconHash , types.Withdrawals {}, nil , & zero , & zero )},
199204 {"V4Valid" , v4Validator , pubsub .ValidationAccept , createEnvelope (& beaconHash , types.Withdrawals {}, & withdrawalsRoot , & zero , & zero )},
200205 {"V4RejectNoWithdrawalRoot" , v4Validator , pubsub .ValidationReject , createEnvelope (& beaconHash , types.Withdrawals {}, nil , & zero , & zero )},
206+ {"V4AcceptNonZeroBlobGasUsedJovian" , v4JovianValidator , pubsub .ValidationAccept , createEnvelope (& beaconHash , types.Withdrawals {}, & withdrawalsRoot , & zero , & one )},
207+ // Note: v3+ test cases with nil blobGasUsed cannot easily be included because they already fail at the SSZ marshaling stage.
201208 }
202209
203- for _ , tt := range envelopeTests {
204- test := tt
210+ for _ , test := range envelopeTests {
205211 t .Run (fmt .Sprintf ("ExecutionPayloadEnvelope_%s" , test .name ), func (t * testing.T ) {
206212 test .payload .ExecutionPayload .BlockHash , _ = test .payload .CheckBlockHash () // hack to generate the block hash easily.
207213 data , err := createSignedP2Payload (test .payload , signer , cfg .L2ChainID )
0 commit comments