@@ -573,6 +573,29 @@ func TestEnginePayloadEnvelope_MarshalJSON_UsesWireFieldNames(t *testing.T) {
573573 require .JSONEq (t , string (envelope .RawExecutionPayload ), string (decoded .RawExecutionPayload ))
574574}
575575
576+ func TestEnginePayloadEnvelope_UnmarshalClearsOmittedFields (t * testing.T ) {
577+ withOptionals := strings .ReplaceAll (minimalPayloadEnvelopeJSON ,
578+ `"executionRequests": []` , `"executionRequests": ["0x01"]` )
579+ withOptionals = strings .ReplaceAll (withOptionals ,
580+ `"shouldOverrideBuilder": false` , `"shouldOverrideBuilder": true` )
581+
582+ var envelope EnginePayloadEnvelope
583+ require .NoError (t , json .Unmarshal ([]byte (withOptionals ), & envelope ))
584+ require .NotEmpty (t , envelope .Requests )
585+ require .True (t , envelope .Override )
586+
587+ var withoutOptionals map [string ]json.RawMessage
588+ require .NoError (t , json .Unmarshal ([]byte (minimalPayloadEnvelopeJSON ), & withoutOptionals ))
589+ delete (withoutOptionals , "executionRequests" )
590+ delete (withoutOptionals , "shouldOverrideBuilder" )
591+ encoded , err := json .Marshal (withoutOptionals )
592+ require .NoError (t , err )
593+
594+ require .NoError (t , json .Unmarshal (encoded , & envelope ))
595+ require .Nil (t , envelope .Requests )
596+ require .False (t , envelope .Override )
597+ }
598+
576599func TestIsUnsupportedForkErr (t * testing.T ) {
577600 tests := []struct {
578601 name string
0 commit comments