@@ -168,6 +168,7 @@ func TestClient_HTTP(t *testing.T) {
168168 cfg .CapellaForkEpoch = 1
169169 cfg .DenebForkEpoch = 2
170170 cfg .ElectraForkEpoch = 3
171+ cfg .FuluForkEpoch = 4
171172 params .OverrideBeaconConfig (cfg )
172173
173174 t .Run (GetPayloadMethod , func (t * testing.T ) {
@@ -318,11 +319,11 @@ func TestClient_HTTP(t *testing.T) {
318319 require .DeepEqual (t , uint64 (2 ), g )
319320
320321 commitments := [][]byte {bytesutil .PadTo ([]byte ("commitment1" ), fieldparams .BLSPubkeyLength ), bytesutil .PadTo ([]byte ("commitment2" ), fieldparams .BLSPubkeyLength )}
321- require .DeepEqual (t , commitments , resp .BlobsBundle .GetKzgCommitments ())
322+ require .DeepEqual (t , commitments , resp .BlobsBundler .GetKzgCommitments ())
322323 proofs := [][]byte {bytesutil .PadTo ([]byte ("proof1" ), fieldparams .BLSPubkeyLength ), bytesutil .PadTo ([]byte ("proof2" ), fieldparams .BLSPubkeyLength )}
323- require .DeepEqual (t , proofs , resp .BlobsBundle .GetProofs ())
324+ require .DeepEqual (t , proofs , resp .BlobsBundler .GetProofs ())
324325 blobs := [][]byte {bytesutil .PadTo ([]byte ("a" ), fieldparams .BlobLength ), bytesutil .PadTo ([]byte ("b" ), fieldparams .BlobLength )}
325- require .DeepEqual (t , blobs , resp .BlobsBundle .GetBlobs ())
326+ require .DeepEqual (t , blobs , resp .BlobsBundler .GetBlobs ())
326327 })
327328 t .Run (GetPayloadMethodV4 , func (t * testing.T ) {
328329 payloadId := [8 ]byte {1 }
@@ -373,11 +374,11 @@ func TestClient_HTTP(t *testing.T) {
373374 require .DeepEqual (t , uint64 (2 ), g )
374375
375376 commitments := [][]byte {bytesutil .PadTo ([]byte ("commitment1" ), fieldparams .BLSPubkeyLength ), bytesutil .PadTo ([]byte ("commitment2" ), fieldparams .BLSPubkeyLength )}
376- require .DeepEqual (t , commitments , resp .BlobsBundle .GetKzgCommitments ())
377+ require .DeepEqual (t , commitments , resp .BlobsBundler .GetKzgCommitments ())
377378 proofs := [][]byte {bytesutil .PadTo ([]byte ("proof1" ), fieldparams .BLSPubkeyLength ), bytesutil .PadTo ([]byte ("proof2" ), fieldparams .BLSPubkeyLength )}
378- require .DeepEqual (t , proofs , resp .BlobsBundle .GetProofs ())
379+ require .DeepEqual (t , proofs , resp .BlobsBundler .GetProofs ())
379380 blobs := [][]byte {bytesutil .PadTo ([]byte ("a" ), fieldparams .BlobLength ), bytesutil .PadTo ([]byte ("b" ), fieldparams .BlobLength )}
380- require .DeepEqual (t , blobs , resp .BlobsBundle .GetBlobs ())
381+ require .DeepEqual (t , blobs , resp .BlobsBundler .GetBlobs ())
381382 requests := & pb.ExecutionRequests {
382383 Deposits : []* pb.DepositRequest {
383384 {
@@ -406,7 +407,52 @@ func TestClient_HTTP(t *testing.T) {
406407
407408 require .DeepEqual (t , requests , resp .ExecutionRequests )
408409 })
410+ t .Run (GetPayloadMethodV5 , func (t * testing.T ) {
411+ payloadId := [8 ]byte {1 }
412+ want , ok := fix ["ExecutionBundleFulu" ].(* pb.GetPayloadV5ResponseJson )
413+ require .Equal (t , true , ok )
414+ srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
415+ w .Header ().Set ("Content-Type" , "application/json" )
416+ defer func () {
417+ require .NoError (t , r .Body .Close ())
418+ }()
419+ enc , err := io .ReadAll (r .Body )
420+ require .NoError (t , err )
421+ jsonRequestString := string (enc )
422+
423+ reqArg , err := json .Marshal (pb .PayloadIDBytes (payloadId ))
424+ require .NoError (t , err )
425+
426+ // We expect the JSON string RPC request contains the right arguments.
427+ require .Equal (t , true , strings .Contains (
428+ jsonRequestString , string (reqArg ),
429+ ))
430+ resp := map [string ]interface {}{
431+ "jsonrpc" : "2.0" ,
432+ "id" : 1 ,
433+ "result" : want ,
434+ }
435+ err = json .NewEncoder (w ).Encode (resp )
436+ require .NoError (t , err )
437+ }))
438+ defer srv .Close ()
439+
440+ rpcClient , err := rpc .DialHTTP (srv .URL )
441+ require .NoError (t , err )
442+ defer rpcClient .Close ()
409443
444+ client := & Service {}
445+ client .rpcClient = rpcClient
446+
447+ // We call the RPC method via HTTP and expect a proper result.
448+ resp , err := client .GetPayload (ctx , payloadId , 4 * params .BeaconConfig ().SlotsPerEpoch )
449+ require .NoError (t , err )
450+ _ , ok = resp .BlobsBundler .(* pb.BlobsBundleV2 )
451+ if ! ok {
452+ t .Logf ("resp.BlobsBundler has unexpected type: %T" , resp .BlobsBundler )
453+ }
454+ require .Equal (t , ok , true )
455+ })
410456 t .Run (ForkchoiceUpdatedMethod + " VALID status" , func (t * testing.T ) {
411457 forkChoiceState := & pb.ForkchoiceState {
412458 HeadBlockHash : []byte ("head" ),
@@ -1540,6 +1586,7 @@ func fixtures() map[string]interface{} {
15401586 "ExecutionPayloadCapellaWithValue" : s .ExecutionPayloadWithValueCapella ,
15411587 "ExecutionPayloadDenebWithValue" : s .ExecutionPayloadWithValueDeneb ,
15421588 "ExecutionBundleElectra" : s .ExecutionBundleElectra ,
1589+ "ExecutionBundleFulu" : s .ExecutionBundleFulu ,
15431590 "ValidPayloadStatus" : s .ValidPayloadStatus ,
15441591 "InvalidBlockHashStatus" : s .InvalidBlockHashStatus ,
15451592 "AcceptedStatus" : s .AcceptedStatus ,
@@ -1775,6 +1822,36 @@ func fixturesStruct() *payloadFixtures {
17751822 append ([]byte {pb .WithdrawalRequestType }, withdrawalRequestBytes ... ),
17761823 append ([]byte {pb .ConsolidationRequestType }, consolidationRequestBytes ... )},
17771824 }
1825+ executionBundleFixtureFulu := & pb.GetPayloadV5ResponseJson {
1826+ ShouldOverrideBuilder : true ,
1827+ ExecutionPayload : & pb.ExecutionPayloadDenebJSON {
1828+ ParentHash : & common.Hash {'a' },
1829+ FeeRecipient : & common.Address {'b' },
1830+ StateRoot : & common.Hash {'c' },
1831+ ReceiptsRoot : & common.Hash {'d' },
1832+ LogsBloom : & hexutil.Bytes {'e' },
1833+ PrevRandao : & common.Hash {'f' },
1834+ BaseFeePerGas : "0x123" ,
1835+ BlockHash : & common.Hash {'g' },
1836+ Transactions : []hexutil.Bytes {{'h' }},
1837+ Withdrawals : []* pb.Withdrawal {},
1838+ BlockNumber : & hexUint ,
1839+ GasLimit : & hexUint ,
1840+ GasUsed : & hexUint ,
1841+ Timestamp : & hexUint ,
1842+ BlobGasUsed : & bgu ,
1843+ ExcessBlobGas : & ebg ,
1844+ },
1845+ BlockValue : "0x11fffffffff" ,
1846+ BlobsBundle : & pb.BlobBundleV2JSON {
1847+ Commitments : []hexutil.Bytes {[]byte ("commitment1" ), []byte ("commitment2" )},
1848+ Proofs : []hexutil.Bytes {[]byte ("proof1" ), []byte ("proof2" )},
1849+ Blobs : []hexutil.Bytes {{'a' }, {'b' }},
1850+ },
1851+ ExecutionRequests : []hexutil.Bytes {append ([]byte {pb .DepositRequestType }, depositRequestBytes ... ),
1852+ append ([]byte {pb .WithdrawalRequestType }, withdrawalRequestBytes ... ),
1853+ append ([]byte {pb .ConsolidationRequestType }, consolidationRequestBytes ... )},
1854+ }
17781855 parent := bytesutil .PadTo ([]byte ("parentHash" ), fieldparams .RootLength )
17791856 sha3Uncles := bytesutil .PadTo ([]byte ("sha3Uncles" ), fieldparams .RootLength )
17801857 miner := bytesutil .PadTo ([]byte ("miner" ), fieldparams .FeeRecipientLength )
@@ -1869,6 +1946,7 @@ func fixturesStruct() *payloadFixtures {
18691946 ExecutionPayloadWithValueCapella : executionPayloadWithValueFixtureCapella ,
18701947 ExecutionPayloadWithValueDeneb : executionPayloadWithValueFixtureDeneb ,
18711948 ExecutionBundleElectra : executionBundleFixtureElectra ,
1949+ ExecutionBundleFulu : executionBundleFixtureFulu ,
18721950 ValidPayloadStatus : validStatus ,
18731951 InvalidBlockHashStatus : inValidBlockHashStatus ,
18741952 AcceptedStatus : acceptedStatus ,
@@ -1893,6 +1971,7 @@ type payloadFixtures struct {
18931971 ExecutionPayloadWithValueCapella * pb.GetPayloadV2ResponseJson
18941972 ExecutionPayloadWithValueDeneb * pb.GetPayloadV3ResponseJson
18951973 ExecutionBundleElectra * pb.GetPayloadV4ResponseJson
1974+ ExecutionBundleFulu * pb.GetPayloadV5ResponseJson
18961975 ValidPayloadStatus * pb.PayloadStatus
18971976 InvalidBlockHashStatus * pb.PayloadStatus
18981977 AcceptedStatus * pb.PayloadStatus
0 commit comments