@@ -38,6 +38,7 @@ import (
3838 "github.com/prysmaticlabs/prysm/v5/testing/util"
3939 "github.com/prysmaticlabs/prysm/v5/time/slots"
4040 logTest "github.com/sirupsen/logrus/hooks/test"
41+ "google.golang.org/protobuf/encoding/protojson"
4142)
4243
4344var (
@@ -168,6 +169,7 @@ func TestClient_HTTP(t *testing.T) {
168169 cfg .CapellaForkEpoch = 1
169170 cfg .DenebForkEpoch = 2
170171 cfg .ElectraForkEpoch = 3
172+ cfg .FuluForkEpoch = 4
171173 params .OverrideBeaconConfig (cfg )
172174
173175 t .Run (GetPayloadMethod , func (t * testing.T ) {
@@ -406,7 +408,48 @@ func TestClient_HTTP(t *testing.T) {
406408
407409 require .DeepEqual (t , requests , resp .ExecutionRequests )
408410 })
411+ t .Run (GetPayloadMethodV5 , func (t * testing.T ) {
412+ payloadId := [8 ]byte {1 }
413+ want , ok := fix ["ExecutionBundleFulu" ].(* pb.ExecutionBundleFulu )
414+ require .Equal (t , true , ok )
415+
416+ srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
417+ w .Header ().Set ("Content-Type" , "application/json" )
418+ defer func () {
419+ require .NoError (t , r .Body .Close ())
420+ }()
421+ // Read and verify request
422+ enc , err := io .ReadAll (r .Body )
423+ require .NoError (t , err )
424+ jsonRequestString := string (enc )
425+ reqArg , err := json .Marshal (pb .PayloadIDBytes (payloadId ))
426+ require .NoError (t , err )
427+ require .Equal (t , strings .Contains (jsonRequestString , string (reqArg )), true )
428+
429+ // Use protojson to marshal the result correctly
430+ marshaled , err := protojson .Marshal (want )
431+ require .NoError (t , err )
432+
433+ response := `{"jsonrpc":"2.0","id":1,"result":` + string (marshaled ) + `}`
434+ _ , err = w .Write ([]byte (response ))
435+ require .NoError (t , err )
436+ }))
437+ defer srv .Close ()
409438
439+ rpcClient , err := rpc .DialHTTP (srv .URL )
440+ require .NoError (t , err )
441+ defer rpcClient .Close ()
442+
443+ client := & Service {rpcClient : rpcClient }
444+ resp , err := client .GetPayload (ctx , payloadId , 4 * params .BeaconConfig ().SlotsPerEpoch )
445+ require .NoError (t , err )
446+
447+ _ , ok = resp .BlobsBundle .(* pb.BlobsBundleV2 )
448+ if ! ok {
449+ t .Logf ("resp.BlobsBundle has unexpected type: %T" , resp .BlobsBundle )
450+ }
451+ require .Equal (t , true , ok )
452+ })
410453 t .Run (ForkchoiceUpdatedMethod + " VALID status" , func (t * testing.T ) {
411454 forkChoiceState := & pb.ForkchoiceState {
412455 HeadBlockHash : []byte ("head" ),
@@ -1540,6 +1583,7 @@ func fixtures() map[string]interface{} {
15401583 "ExecutionPayloadCapellaWithValue" : s .ExecutionPayloadWithValueCapella ,
15411584 "ExecutionPayloadDenebWithValue" : s .ExecutionPayloadWithValueDeneb ,
15421585 "ExecutionBundleElectra" : s .ExecutionBundleElectra ,
1586+ "ExecutionBundleFulu" : s .ExecutionBundleFulu ,
15431587 "ValidPayloadStatus" : s .ValidPayloadStatus ,
15441588 "InvalidBlockHashStatus" : s .InvalidBlockHashStatus ,
15451589 "AcceptedStatus" : s .AcceptedStatus ,
@@ -1860,15 +1904,20 @@ func fixturesStruct() *payloadFixtures {
18601904 LatestValidHash : foo [:],
18611905 }
18621906 return & payloadFixtures {
1863- ExecutionBlock : executionBlock ,
1864- ExecutionPayloadBody : executionPayloadBodyFixture ,
1865- ExecutionPayload : executionPayloadFixture ,
1866- ExecutionPayloadCapella : executionPayloadFixtureCapella ,
1867- ExecutionPayloadDeneb : executionPayloadFixtureDeneb ,
1868- EmptyExecutionPayloadDeneb : emptyExecutionPayloadDeneb ,
1869- ExecutionPayloadWithValueCapella : executionPayloadWithValueFixtureCapella ,
1870- ExecutionPayloadWithValueDeneb : executionPayloadWithValueFixtureDeneb ,
1871- ExecutionBundleElectra : executionBundleFixtureElectra ,
1907+ ExecutionBlock : executionBlock ,
1908+ ExecutionPayloadBody : executionPayloadBodyFixture ,
1909+ ExecutionPayload : executionPayloadFixture ,
1910+ ExecutionPayloadCapella : executionPayloadFixtureCapella ,
1911+ ExecutionPayloadDeneb : executionPayloadFixtureDeneb ,
1912+ EmptyExecutionPayloadDeneb : emptyExecutionPayloadDeneb ,
1913+ ExecutionPayloadWithValueCapella : executionPayloadWithValueFixtureCapella ,
1914+ ExecutionPayloadWithValueDeneb : executionPayloadWithValueFixtureDeneb ,
1915+ ExecutionBundleElectra : executionBundleFixtureElectra ,
1916+ ExecutionBundleFulu : & pb.ExecutionBundleFulu {
1917+ Payload : & pb.ExecutionPayloadDeneb {},
1918+ BlobsBundle : & pb.BlobsBundleV2 {},
1919+ ExecutionRequests : [][]byte {},
1920+ },
18721921 ValidPayloadStatus : validStatus ,
18731922 InvalidBlockHashStatus : inValidBlockHashStatus ,
18741923 AcceptedStatus : acceptedStatus ,
@@ -1893,6 +1942,7 @@ type payloadFixtures struct {
18931942 ExecutionPayloadWithValueCapella * pb.GetPayloadV2ResponseJson
18941943 ExecutionPayloadWithValueDeneb * pb.GetPayloadV3ResponseJson
18951944 ExecutionBundleElectra * pb.GetPayloadV4ResponseJson
1945+ ExecutionBundleFulu * pb.ExecutionBundleFulu
18961946 ValidPayloadStatus * pb.PayloadStatus
18971947 InvalidBlockHashStatus * pb.PayloadStatus
18981948 AcceptedStatus * pb.PayloadStatus
0 commit comments