mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Remove API Middleware (#13243)
* remove api/gateway/apimiddleware * fix errors in api/gateway * remove beacon-chain/rpc/apimiddleware * fix errors in api/client/beacon * fix errors in validator/client/beacon-api * fix errors in beacon-chain/node * fix errors in validator/node * fix errors in cmd/prysmctl/validator * fix errors in testing/endtoend * fix all other code * remove comment * fix tests --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -73,7 +73,7 @@ go_test(
|
||||
data = glob(["testdata/**"]),
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//build/bazel:go_default_library",
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
|
||||
@@ -188,7 +188,7 @@ func writeSignedVoluntaryExitJSON(sve *eth.SignedVoluntaryExit, outputDirectory
|
||||
return errors.Wrap(err, "failed to marshal JSON signed voluntary exit")
|
||||
}
|
||||
|
||||
filepath := path.Join(outputDirectory, fmt.Sprintf("validator-exit-%s.json", jsve.Exit.ValidatorIndex))
|
||||
filepath := path.Join(outputDirectory, fmt.Sprintf("validator-exit-%s.json", jsve.Message.ValidatorIndex))
|
||||
if err := file.WriteFile(filepath, b); err != nil {
|
||||
return errors.Wrap(err, "failed to write validator exist json")
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/build/bazel"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
@@ -57,10 +57,10 @@ func TestWriteSignedVoluntaryExitJSON(t *testing.T) {
|
||||
b, err := file.ReadFileAsBytes(path.Join(output, "validator-exit-300.json"))
|
||||
require.NoError(t, err)
|
||||
|
||||
svej := &apimiddleware.SignedVoluntaryExitJson{}
|
||||
svej := &shared.SignedVoluntaryExit{}
|
||||
require.NoError(t, json.Unmarshal(b, svej))
|
||||
|
||||
require.Equal(t, fmt.Sprintf("%d", sve.Exit.Epoch), svej.Exit.Epoch)
|
||||
require.Equal(t, fmt.Sprintf("%d", sve.Exit.ValidatorIndex), svej.Exit.ValidatorIndex)
|
||||
require.Equal(t, fmt.Sprintf("%d", sve.Exit.Epoch), svej.Message.Epoch)
|
||||
require.Equal(t, fmt.Sprintf("%d", sve.Exit.ValidatorIndex), svej.Message.ValidatorIndex)
|
||||
require.Equal(t, "0x0102", svej.Signature)
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ go_library(
|
||||
"//api:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/core/signing:go_default_library",
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/beacon:go_default_library",
|
||||
"//beacon-chain/rpc/eth/config:go_default_library",
|
||||
"//beacon-chain/rpc/eth/node:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//beacon-chain/rpc/eth/validator:go_default_library",
|
||||
@@ -115,8 +115,8 @@ go_test(
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//api:go_default_library",
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/beacon:go_default_library",
|
||||
"//beacon-chain/rpc/eth/config:go_default_library",
|
||||
"//beacon-chain/rpc/eth/node:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared/testing:go_default_library",
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/node"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/validator/client/iface"
|
||||
@@ -60,7 +60,7 @@ func (c *beaconApiNodeClient) GetGenesis(ctx context.Context, _ *empty.Empty) (*
|
||||
return nil, errors.Wrapf(err, "failed to parse genesis time `%s`", genesisJson.GenesisTime)
|
||||
}
|
||||
|
||||
depositContractJson := apimiddleware.DepositContractResponseJson{}
|
||||
depositContractJson := config.GetDepositContractResponse{}
|
||||
errJson, err = c.jsonRestHandler.Get(ctx, "/eth/v1/config/deposit_contract", &depositContractJson)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, msgUnexpectedError)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/node"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
@@ -22,7 +22,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
name string
|
||||
genesisResponse *beacon.Genesis
|
||||
genesisError error
|
||||
depositContractResponse apimiddleware.DepositContractResponseJson
|
||||
depositContractResponse config.GetDepositContractResponse
|
||||
depositContractError error
|
||||
queriesDepositContract bool
|
||||
expectedResponse *ethpb.Genesis
|
||||
@@ -66,7 +66,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
GenesisValidatorsRoot: hexutil.Encode([]byte{2}),
|
||||
},
|
||||
queriesDepositContract: true,
|
||||
depositContractResponse: apimiddleware.DepositContractResponseJson{
|
||||
depositContractResponse: config.GetDepositContractResponse{
|
||||
Data: nil,
|
||||
},
|
||||
expectedError: "deposit contract data is nil",
|
||||
@@ -78,8 +78,8 @@ func TestGetGenesis(t *testing.T) {
|
||||
GenesisValidatorsRoot: hexutil.Encode([]byte{2}),
|
||||
},
|
||||
queriesDepositContract: true,
|
||||
depositContractResponse: apimiddleware.DepositContractResponseJson{
|
||||
Data: &apimiddleware.DepositContractJson{
|
||||
depositContractResponse: config.GetDepositContractResponse{
|
||||
Data: &config.DepositContractData{
|
||||
Address: "foo",
|
||||
},
|
||||
},
|
||||
@@ -92,8 +92,8 @@ func TestGetGenesis(t *testing.T) {
|
||||
GenesisValidatorsRoot: hexutil.Encode([]byte{2}),
|
||||
},
|
||||
queriesDepositContract: true,
|
||||
depositContractResponse: apimiddleware.DepositContractResponseJson{
|
||||
Data: &apimiddleware.DepositContractJson{
|
||||
depositContractResponse: config.GetDepositContractResponse{
|
||||
Data: &config.DepositContractData{
|
||||
Address: hexutil.Encode([]byte{3}),
|
||||
},
|
||||
},
|
||||
@@ -122,7 +122,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
testCase.genesisError,
|
||||
)
|
||||
|
||||
depositContractJson := apimiddleware.DepositContractResponseJson{}
|
||||
depositContractJson := config.GetDepositContractResponse{}
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
if testCase.queriesDepositContract {
|
||||
|
||||
@@ -19,7 +19,7 @@ type beaconApiValidatorClient struct {
|
||||
dutiesProvider dutiesProvider
|
||||
stateValidatorsProvider StateValidatorsProvider
|
||||
jsonRestHandler JsonRestHandler
|
||||
beaconBlockConverter beaconBlockConverter
|
||||
beaconBlockConverter BeaconBlockConverter
|
||||
prysmBeaconChainCLient iface.PrysmBeaconChainClient
|
||||
}
|
||||
|
||||
|
||||
@@ -6,24 +6,24 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
type beaconBlockConverter interface {
|
||||
ConvertRESTPhase0BlockToProto(block *apimiddleware.BeaconBlockJson) (*ethpb.BeaconBlock, error)
|
||||
ConvertRESTAltairBlockToProto(block *apimiddleware.BeaconBlockAltairJson) (*ethpb.BeaconBlockAltair, error)
|
||||
ConvertRESTBellatrixBlockToProto(block *apimiddleware.BeaconBlockBellatrixJson) (*ethpb.BeaconBlockBellatrix, error)
|
||||
ConvertRESTCapellaBlockToProto(block *apimiddleware.BeaconBlockCapellaJson) (*ethpb.BeaconBlockCapella, error)
|
||||
type BeaconBlockConverter interface {
|
||||
ConvertRESTPhase0BlockToProto(block *shared.BeaconBlock) (*ethpb.BeaconBlock, error)
|
||||
ConvertRESTAltairBlockToProto(block *shared.BeaconBlockAltair) (*ethpb.BeaconBlockAltair, error)
|
||||
ConvertRESTBellatrixBlockToProto(block *shared.BeaconBlockBellatrix) (*ethpb.BeaconBlockBellatrix, error)
|
||||
ConvertRESTCapellaBlockToProto(block *shared.BeaconBlockCapella) (*ethpb.BeaconBlockCapella, error)
|
||||
}
|
||||
|
||||
type beaconApiBeaconBlockConverter struct{}
|
||||
|
||||
// ConvertRESTPhase0BlockToProto converts a Phase0 JSON beacon block to its protobuf equivalent
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTPhase0BlockToProto(block *apimiddleware.BeaconBlockJson) (*ethpb.BeaconBlock, error) {
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTPhase0BlockToProto(block *shared.BeaconBlock) (*ethpb.BeaconBlock, error) {
|
||||
blockSlot, err := strconv.ParseUint(block.Slot, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse slot `%s`", block.Slot)
|
||||
@@ -125,19 +125,19 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTPhase0BlockToProto(block *apim
|
||||
}
|
||||
|
||||
// ConvertRESTAltairBlockToProto converts an Altair JSON beacon block to its protobuf equivalent
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTAltairBlockToProto(block *apimiddleware.BeaconBlockAltairJson) (*ethpb.BeaconBlockAltair, error) {
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTAltairBlockToProto(block *shared.BeaconBlockAltair) (*ethpb.BeaconBlockAltair, error) {
|
||||
if block.Body == nil {
|
||||
return nil, errors.New("block body is nil")
|
||||
}
|
||||
|
||||
// Call convertRESTPhase0BlockToProto to set the phase0 fields because all the error handling and the heavy lifting
|
||||
// has already been done
|
||||
phase0Block, err := c.ConvertRESTPhase0BlockToProto(&apimiddleware.BeaconBlockJson{
|
||||
phase0Block, err := c.ConvertRESTPhase0BlockToProto(&shared.BeaconBlock{
|
||||
Slot: block.Slot,
|
||||
ProposerIndex: block.ProposerIndex,
|
||||
ParentRoot: block.ParentRoot,
|
||||
StateRoot: block.StateRoot,
|
||||
Body: &apimiddleware.BeaconBlockBodyJson{
|
||||
Body: &shared.BeaconBlockBody{
|
||||
RandaoReveal: block.Body.RandaoReveal,
|
||||
Eth1Data: block.Body.Eth1Data,
|
||||
Graffiti: block.Body.Graffiti,
|
||||
@@ -189,19 +189,19 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTAltairBlockToProto(block *apim
|
||||
}
|
||||
|
||||
// ConvertRESTBellatrixBlockToProto converts a Bellatrix JSON beacon block to its protobuf equivalent
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTBellatrixBlockToProto(block *apimiddleware.BeaconBlockBellatrixJson) (*ethpb.BeaconBlockBellatrix, error) {
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTBellatrixBlockToProto(block *shared.BeaconBlockBellatrix) (*ethpb.BeaconBlockBellatrix, error) {
|
||||
if block.Body == nil {
|
||||
return nil, errors.New("block body is nil")
|
||||
}
|
||||
|
||||
// Call convertRESTAltairBlockToProto to set the altair fields because all the error handling and the heavy lifting
|
||||
// has already been done
|
||||
altairBlock, err := c.ConvertRESTAltairBlockToProto(&apimiddleware.BeaconBlockAltairJson{
|
||||
altairBlock, err := c.ConvertRESTAltairBlockToProto(&shared.BeaconBlockAltair{
|
||||
Slot: block.Slot,
|
||||
ProposerIndex: block.ProposerIndex,
|
||||
ParentRoot: block.ParentRoot,
|
||||
StateRoot: block.StateRoot,
|
||||
Body: &apimiddleware.BeaconBlockBodyAltairJson{
|
||||
Body: &shared.BeaconBlockBodyAltair{
|
||||
RandaoReveal: block.Body.RandaoReveal,
|
||||
Eth1Data: block.Body.Eth1Data,
|
||||
Graffiti: block.Body.Graffiti,
|
||||
@@ -266,9 +266,9 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTBellatrixBlockToProto(block *a
|
||||
return nil, errors.Wrapf(err, "failed to parse execution payload gas used `%s`", block.Body.ExecutionPayload.GasUsed)
|
||||
}
|
||||
|
||||
timestamp, err := strconv.ParseUint(block.Body.ExecutionPayload.TimeStamp, 10, 64)
|
||||
timestamp, err := strconv.ParseUint(block.Body.ExecutionPayload.Timestamp, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse execution payload timestamp `%s`", block.Body.ExecutionPayload.TimeStamp)
|
||||
return nil, errors.Wrapf(err, "failed to parse execution payload timestamp `%s`", block.Body.ExecutionPayload.Timestamp)
|
||||
}
|
||||
|
||||
extraData, err := hexutil.Decode(block.Body.ExecutionPayload.ExtraData)
|
||||
@@ -327,7 +327,7 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTBellatrixBlockToProto(block *a
|
||||
}
|
||||
|
||||
// ConvertRESTCapellaBlockToProto converts a Capella JSON beacon block to its protobuf equivalent
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *apimiddleware.BeaconBlockCapellaJson) (*ethpb.BeaconBlockCapella, error) {
|
||||
func (c beaconApiBeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *shared.BeaconBlockCapella) (*ethpb.BeaconBlockCapella, error) {
|
||||
if block.Body == nil {
|
||||
return nil, errors.New("block body is nil")
|
||||
}
|
||||
@@ -338,12 +338,12 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *api
|
||||
|
||||
// Call convertRESTBellatrixBlockToProto to set the bellatrix fields because all the error handling and the heavy
|
||||
// lifting has already been done
|
||||
bellatrixBlock, err := c.ConvertRESTBellatrixBlockToProto(&apimiddleware.BeaconBlockBellatrixJson{
|
||||
bellatrixBlock, err := c.ConvertRESTBellatrixBlockToProto(&shared.BeaconBlockBellatrix{
|
||||
Slot: block.Slot,
|
||||
ProposerIndex: block.ProposerIndex,
|
||||
ParentRoot: block.ParentRoot,
|
||||
StateRoot: block.StateRoot,
|
||||
Body: &apimiddleware.BeaconBlockBodyBellatrixJson{
|
||||
Body: &shared.BeaconBlockBodyBellatrix{
|
||||
RandaoReveal: block.Body.RandaoReveal,
|
||||
Eth1Data: block.Body.Eth1Data,
|
||||
Graffiti: block.Body.Graffiti,
|
||||
@@ -353,7 +353,7 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *api
|
||||
Deposits: block.Body.Deposits,
|
||||
VoluntaryExits: block.Body.VoluntaryExits,
|
||||
SyncAggregate: block.Body.SyncAggregate,
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadJson{
|
||||
ExecutionPayload: &shared.ExecutionPayload{
|
||||
ParentHash: block.Body.ExecutionPayload.ParentHash,
|
||||
FeeRecipient: block.Body.ExecutionPayload.FeeRecipient,
|
||||
StateRoot: block.Body.ExecutionPayload.StateRoot,
|
||||
@@ -363,7 +363,7 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *api
|
||||
BlockNumber: block.Body.ExecutionPayload.BlockNumber,
|
||||
GasLimit: block.Body.ExecutionPayload.GasLimit,
|
||||
GasUsed: block.Body.ExecutionPayload.GasUsed,
|
||||
TimeStamp: block.Body.ExecutionPayload.TimeStamp,
|
||||
Timestamp: block.Body.ExecutionPayload.Timestamp,
|
||||
ExtraData: block.Body.ExecutionPayload.ExtraData,
|
||||
BaseFeePerGas: block.Body.ExecutionPayload.BaseFeePerGas,
|
||||
BlockHash: block.Body.ExecutionPayload.BlockHash,
|
||||
@@ -380,7 +380,7 @@ func (c beaconApiBeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *api
|
||||
return nil, errors.Wrap(err, "failed to get withdrawals")
|
||||
}
|
||||
|
||||
blsToExecutionChanges, err := convertBlsToExecutionChangesToProto(block.Body.BLSToExecutionChanges)
|
||||
blsToExecutionChanges, err := convertBlsToExecutionChangesToProto(block.Body.BlsToExecutionChanges)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get bls to execution changes")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package beacon_api
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
test_helpers "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api/test-helpers"
|
||||
@@ -21,12 +21,12 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
expectedErrorMessage string
|
||||
generateData func() *apimiddleware.BeaconBlockJson
|
||||
generateData func() *shared.BeaconBlock
|
||||
}{
|
||||
{
|
||||
name: "nil body",
|
||||
expectedErrorMessage: "block body is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body = nil
|
||||
return beaconBlock
|
||||
@@ -35,7 +35,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "nil eth1 data",
|
||||
expectedErrorMessage: "eth1 data is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Eth1Data = nil
|
||||
return beaconBlock
|
||||
@@ -44,7 +44,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad slot",
|
||||
expectedErrorMessage: "failed to parse slot `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Slot = "foo"
|
||||
return beaconBlock
|
||||
@@ -53,7 +53,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad proposer index",
|
||||
expectedErrorMessage: "failed to parse proposer index `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.ProposerIndex = "bar"
|
||||
return beaconBlock
|
||||
@@ -62,7 +62,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad parent root",
|
||||
expectedErrorMessage: "failed to decode parent root `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.ParentRoot = "foo"
|
||||
return beaconBlock
|
||||
@@ -71,7 +71,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad state root",
|
||||
expectedErrorMessage: "failed to decode state root `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.StateRoot = "bar"
|
||||
return beaconBlock
|
||||
@@ -80,7 +80,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad randao reveal",
|
||||
expectedErrorMessage: "failed to decode randao reveal `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.RandaoReveal = "foo"
|
||||
return beaconBlock
|
||||
@@ -89,7 +89,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad deposit root",
|
||||
expectedErrorMessage: "failed to decode deposit root `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Eth1Data.DepositRoot = "bar"
|
||||
return beaconBlock
|
||||
@@ -98,7 +98,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad deposit count",
|
||||
expectedErrorMessage: "failed to parse deposit count `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Eth1Data.DepositCount = "foo"
|
||||
return beaconBlock
|
||||
@@ -107,7 +107,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad block hash",
|
||||
expectedErrorMessage: "failed to decode block hash `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Eth1Data.BlockHash = "bar"
|
||||
return beaconBlock
|
||||
@@ -116,7 +116,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad graffiti",
|
||||
expectedErrorMessage: "failed to decode graffiti `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Graffiti = "foo"
|
||||
return beaconBlock
|
||||
@@ -125,7 +125,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad proposer slashings",
|
||||
expectedErrorMessage: "failed to get proposer slashings",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.ProposerSlashings[0] = nil
|
||||
return beaconBlock
|
||||
@@ -134,7 +134,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad attester slashings",
|
||||
expectedErrorMessage: "failed to get attester slashings",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.AttesterSlashings[0] = nil
|
||||
return beaconBlock
|
||||
@@ -143,7 +143,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad attestations",
|
||||
expectedErrorMessage: "failed to get attestations",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Attestations[0] = nil
|
||||
return beaconBlock
|
||||
@@ -152,7 +152,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad deposits",
|
||||
expectedErrorMessage: "failed to get deposits",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.Deposits[0] = nil
|
||||
return beaconBlock
|
||||
@@ -161,7 +161,7 @@ func TestGetBeaconBlockConverter_Phase0Error(t *testing.T) {
|
||||
{
|
||||
name: "bad voluntary exits",
|
||||
expectedErrorMessage: "failed to get voluntary exits",
|
||||
generateData: func() *apimiddleware.BeaconBlockJson {
|
||||
generateData: func() *shared.BeaconBlock {
|
||||
beaconBlock := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
beaconBlock.Body.VoluntaryExits[0] = nil
|
||||
return beaconBlock
|
||||
@@ -192,12 +192,12 @@ func TestGetBeaconBlockConverter_AltairError(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
expectedErrorMessage string
|
||||
generateData func() *apimiddleware.BeaconBlockAltairJson
|
||||
generateData func() *shared.BeaconBlockAltair
|
||||
}{
|
||||
{
|
||||
name: "nil body",
|
||||
expectedErrorMessage: "block body is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockAltairJson {
|
||||
generateData: func() *shared.BeaconBlockAltair {
|
||||
beaconBlock := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
beaconBlock.Body = nil
|
||||
return beaconBlock
|
||||
@@ -206,7 +206,7 @@ func TestGetBeaconBlockConverter_AltairError(t *testing.T) {
|
||||
{
|
||||
name: "nil sync aggregate",
|
||||
expectedErrorMessage: "sync aggregate is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockAltairJson {
|
||||
generateData: func() *shared.BeaconBlockAltair {
|
||||
beaconBlock := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
beaconBlock.Body.SyncAggregate = nil
|
||||
return beaconBlock
|
||||
@@ -215,7 +215,7 @@ func TestGetBeaconBlockConverter_AltairError(t *testing.T) {
|
||||
{
|
||||
name: "bad phase0 fields",
|
||||
expectedErrorMessage: "failed to get the phase0 fields of the altair block",
|
||||
generateData: func() *apimiddleware.BeaconBlockAltairJson {
|
||||
generateData: func() *shared.BeaconBlockAltair {
|
||||
beaconBlock := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
beaconBlock.Body.Eth1Data = nil
|
||||
return beaconBlock
|
||||
@@ -224,7 +224,7 @@ func TestGetBeaconBlockConverter_AltairError(t *testing.T) {
|
||||
{
|
||||
name: "bad sync committee bits",
|
||||
expectedErrorMessage: "failed to decode sync committee bits `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockAltairJson {
|
||||
generateData: func() *shared.BeaconBlockAltair {
|
||||
beaconBlock := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
beaconBlock.Body.SyncAggregate.SyncCommitteeBits = "foo"
|
||||
return beaconBlock
|
||||
@@ -233,7 +233,7 @@ func TestGetBeaconBlockConverter_AltairError(t *testing.T) {
|
||||
{
|
||||
name: "bad sync committee signature",
|
||||
expectedErrorMessage: "failed to decode sync committee signature `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockAltairJson {
|
||||
generateData: func() *shared.BeaconBlockAltair {
|
||||
beaconBlock := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
beaconBlock.Body.SyncAggregate.SyncCommitteeSignature = "bar"
|
||||
return beaconBlock
|
||||
@@ -264,12 +264,12 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
expectedErrorMessage string
|
||||
generateData func() *apimiddleware.BeaconBlockBellatrixJson
|
||||
generateData func() *shared.BeaconBlockBellatrix
|
||||
}{
|
||||
{
|
||||
name: "nil body",
|
||||
expectedErrorMessage: "block body is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body = nil
|
||||
return beaconBlock
|
||||
@@ -278,7 +278,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "nil execution payload",
|
||||
expectedErrorMessage: "execution payload is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload = nil
|
||||
return beaconBlock
|
||||
@@ -287,7 +287,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad altair fields",
|
||||
expectedErrorMessage: "failed to get the altair fields of the bellatrix block",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.Eth1Data = nil
|
||||
return beaconBlock
|
||||
@@ -296,7 +296,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad parent hash",
|
||||
expectedErrorMessage: "failed to decode execution payload parent hash `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.ParentHash = "foo"
|
||||
return beaconBlock
|
||||
@@ -305,7 +305,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad fee recipient",
|
||||
expectedErrorMessage: "failed to decode execution payload fee recipient `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.FeeRecipient = "bar"
|
||||
return beaconBlock
|
||||
@@ -314,7 +314,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad state root",
|
||||
expectedErrorMessage: "failed to decode execution payload state root `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.StateRoot = "foo"
|
||||
return beaconBlock
|
||||
@@ -323,7 +323,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad receipts root",
|
||||
expectedErrorMessage: "failed to decode execution payload receipts root `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.ReceiptsRoot = "bar"
|
||||
return beaconBlock
|
||||
@@ -332,7 +332,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad logs bloom",
|
||||
expectedErrorMessage: "failed to decode execution payload logs bloom `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.LogsBloom = "foo"
|
||||
return beaconBlock
|
||||
@@ -341,7 +341,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad prev randao",
|
||||
expectedErrorMessage: "failed to decode execution payload prev randao `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.PrevRandao = "bar"
|
||||
return beaconBlock
|
||||
@@ -350,7 +350,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad block number",
|
||||
expectedErrorMessage: "failed to parse execution payload block number `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.BlockNumber = "foo"
|
||||
return beaconBlock
|
||||
@@ -359,7 +359,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad gas limit",
|
||||
expectedErrorMessage: "failed to parse execution payload gas limit `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.GasLimit = "bar"
|
||||
return beaconBlock
|
||||
@@ -368,7 +368,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad gas used",
|
||||
expectedErrorMessage: "failed to parse execution payload gas used `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.GasUsed = "foo"
|
||||
return beaconBlock
|
||||
@@ -377,16 +377,16 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad timestamp",
|
||||
expectedErrorMessage: "failed to parse execution payload timestamp `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.TimeStamp = "bar"
|
||||
beaconBlock.Body.ExecutionPayload.Timestamp = "bar"
|
||||
return beaconBlock
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad extra data",
|
||||
expectedErrorMessage: "failed to decode execution payload extra data `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.ExtraData = "foo"
|
||||
return beaconBlock
|
||||
@@ -395,7 +395,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad base fee per gas",
|
||||
expectedErrorMessage: "failed to parse execution payload base fee per gas `bar`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.BaseFeePerGas = "bar"
|
||||
return beaconBlock
|
||||
@@ -404,7 +404,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad block hash",
|
||||
expectedErrorMessage: "failed to decode execution payload block hash `foo`",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.BlockHash = "foo"
|
||||
return beaconBlock
|
||||
@@ -413,7 +413,7 @@ func TestGetBeaconBlockConverter_BellatrixError(t *testing.T) {
|
||||
{
|
||||
name: "bad transactions",
|
||||
expectedErrorMessage: "failed to get execution payload transactions",
|
||||
generateData: func() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
generateData: func() *shared.BeaconBlockBellatrix {
|
||||
beaconBlock := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.Transactions[0] = "bar"
|
||||
return beaconBlock
|
||||
@@ -444,12 +444,12 @@ func TestGetBeaconBlockConverter_CapellaError(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
expectedErrorMessage string
|
||||
generateData func() *apimiddleware.BeaconBlockCapellaJson
|
||||
generateData func() *shared.BeaconBlockCapella
|
||||
}{
|
||||
{
|
||||
name: "nil body",
|
||||
expectedErrorMessage: "block body is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockCapellaJson {
|
||||
generateData: func() *shared.BeaconBlockCapella {
|
||||
beaconBlock := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
beaconBlock.Body = nil
|
||||
return beaconBlock
|
||||
@@ -458,7 +458,7 @@ func TestGetBeaconBlockConverter_CapellaError(t *testing.T) {
|
||||
{
|
||||
name: "nil execution payload",
|
||||
expectedErrorMessage: "execution payload is nil",
|
||||
generateData: func() *apimiddleware.BeaconBlockCapellaJson {
|
||||
generateData: func() *shared.BeaconBlockCapella {
|
||||
beaconBlock := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload = nil
|
||||
return beaconBlock
|
||||
@@ -467,7 +467,7 @@ func TestGetBeaconBlockConverter_CapellaError(t *testing.T) {
|
||||
{
|
||||
name: "bad bellatrix fields",
|
||||
expectedErrorMessage: "failed to get the bellatrix fields of the capella block",
|
||||
generateData: func() *apimiddleware.BeaconBlockCapellaJson {
|
||||
generateData: func() *shared.BeaconBlockCapella {
|
||||
beaconBlock := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
beaconBlock.Body.Eth1Data = nil
|
||||
return beaconBlock
|
||||
@@ -476,7 +476,7 @@ func TestGetBeaconBlockConverter_CapellaError(t *testing.T) {
|
||||
{
|
||||
name: "bad withdrawals",
|
||||
expectedErrorMessage: "failed to get withdrawals",
|
||||
generateData: func() *apimiddleware.BeaconBlockCapellaJson {
|
||||
generateData: func() *shared.BeaconBlockCapella {
|
||||
beaconBlock := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
beaconBlock.Body.ExecutionPayload.Withdrawals[0] = nil
|
||||
return beaconBlock
|
||||
@@ -485,9 +485,9 @@ func TestGetBeaconBlockConverter_CapellaError(t *testing.T) {
|
||||
{
|
||||
name: "bad bls execution changes",
|
||||
expectedErrorMessage: "failed to get bls to execution changes",
|
||||
generateData: func() *apimiddleware.BeaconBlockCapellaJson {
|
||||
generateData: func() *shared.BeaconBlockCapella {
|
||||
beaconBlock := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
beaconBlock.Body.BLSToExecutionChanges[0] = nil
|
||||
beaconBlock.Body.BlsToExecutionChanges[0] = nil
|
||||
return beaconBlock
|
||||
},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
@@ -18,16 +18,15 @@ func jsonifyTransactions(transactions [][]byte) []string {
|
||||
return jsonTransactions
|
||||
}
|
||||
|
||||
// TODO: remove when apimiddleware is migrated away
|
||||
func jsonifyBlsToExecutionChanges(blsToExecutionChanges []*ethpb.SignedBLSToExecutionChange) []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
jsonBlsToExecutionChanges := make([]*apimiddleware.SignedBLSToExecutionChangeJson, len(blsToExecutionChanges))
|
||||
func jsonifyBlsToExecutionChanges(blsToExecutionChanges []*ethpb.SignedBLSToExecutionChange) []*shared.SignedBLSToExecutionChange {
|
||||
jsonBlsToExecutionChanges := make([]*shared.SignedBLSToExecutionChange, len(blsToExecutionChanges))
|
||||
for index, signedBlsToExecutionChange := range blsToExecutionChanges {
|
||||
blsToExecutionChangeJson := &apimiddleware.BLSToExecutionChangeJson{
|
||||
blsToExecutionChangeJson := &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: uint64ToString(signedBlsToExecutionChange.Message.ValidatorIndex),
|
||||
FromBLSPubkey: hexutil.Encode(signedBlsToExecutionChange.Message.FromBlsPubkey),
|
||||
ToExecutionAddress: hexutil.Encode(signedBlsToExecutionChange.Message.ToExecutionAddress),
|
||||
}
|
||||
signedJson := &apimiddleware.SignedBLSToExecutionChangeJson{
|
||||
signedJson := &shared.SignedBLSToExecutionChange{
|
||||
Message: blsToExecutionChangeJson,
|
||||
Signature: hexutil.Encode(signedBlsToExecutionChange.Signature),
|
||||
}
|
||||
@@ -36,46 +35,46 @@ func jsonifyBlsToExecutionChanges(blsToExecutionChanges []*ethpb.SignedBLSToExec
|
||||
return jsonBlsToExecutionChanges
|
||||
}
|
||||
|
||||
func jsonifyEth1Data(eth1Data *ethpb.Eth1Data) *apimiddleware.Eth1DataJson {
|
||||
return &apimiddleware.Eth1DataJson{
|
||||
func jsonifyEth1Data(eth1Data *ethpb.Eth1Data) *shared.Eth1Data {
|
||||
return &shared.Eth1Data{
|
||||
BlockHash: hexutil.Encode(eth1Data.BlockHash),
|
||||
DepositCount: uint64ToString(eth1Data.DepositCount),
|
||||
DepositRoot: hexutil.Encode(eth1Data.DepositRoot),
|
||||
}
|
||||
}
|
||||
|
||||
func jsonifyAttestations(attestations []*ethpb.Attestation) []*apimiddleware.AttestationJson {
|
||||
jsonAttestations := make([]*apimiddleware.AttestationJson, len(attestations))
|
||||
func jsonifyAttestations(attestations []*ethpb.Attestation) []*shared.Attestation {
|
||||
jsonAttestations := make([]*shared.Attestation, len(attestations))
|
||||
for index, attestation := range attestations {
|
||||
jsonAttestations[index] = jsonifyAttestation(attestation)
|
||||
}
|
||||
return jsonAttestations
|
||||
}
|
||||
|
||||
func jsonifyAttesterSlashings(attesterSlashings []*ethpb.AttesterSlashing) []*apimiddleware.AttesterSlashingJson {
|
||||
jsonAttesterSlashings := make([]*apimiddleware.AttesterSlashingJson, len(attesterSlashings))
|
||||
func jsonifyAttesterSlashings(attesterSlashings []*ethpb.AttesterSlashing) []*shared.AttesterSlashing {
|
||||
jsonAttesterSlashings := make([]*shared.AttesterSlashing, len(attesterSlashings))
|
||||
for index, attesterSlashing := range attesterSlashings {
|
||||
jsonAttesterSlashing := &apimiddleware.AttesterSlashingJson{
|
||||
Attestation_1: jsonifyIndexedAttestation(attesterSlashing.Attestation_1),
|
||||
Attestation_2: jsonifyIndexedAttestation(attesterSlashing.Attestation_2),
|
||||
jsonAttesterSlashing := &shared.AttesterSlashing{
|
||||
Attestation1: jsonifyIndexedAttestation(attesterSlashing.Attestation_1),
|
||||
Attestation2: jsonifyIndexedAttestation(attesterSlashing.Attestation_2),
|
||||
}
|
||||
jsonAttesterSlashings[index] = jsonAttesterSlashing
|
||||
}
|
||||
return jsonAttesterSlashings
|
||||
}
|
||||
|
||||
func jsonifyDeposits(deposits []*ethpb.Deposit) []*apimiddleware.DepositJson {
|
||||
jsonDeposits := make([]*apimiddleware.DepositJson, len(deposits))
|
||||
func jsonifyDeposits(deposits []*ethpb.Deposit) []*shared.Deposit {
|
||||
jsonDeposits := make([]*shared.Deposit, len(deposits))
|
||||
for depositIndex, deposit := range deposits {
|
||||
proofs := make([]string, len(deposit.Proof))
|
||||
for proofIndex, proof := range deposit.Proof {
|
||||
proofs[proofIndex] = hexutil.Encode(proof)
|
||||
}
|
||||
|
||||
jsonDeposit := &apimiddleware.DepositJson{
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
jsonDeposit := &shared.Deposit{
|
||||
Data: &shared.DepositData{
|
||||
Amount: uint64ToString(deposit.Data.Amount),
|
||||
PublicKey: hexutil.Encode(deposit.Data.PublicKey),
|
||||
Pubkey: hexutil.Encode(deposit.Data.PublicKey),
|
||||
Signature: hexutil.Encode(deposit.Data.Signature),
|
||||
WithdrawalCredentials: hexutil.Encode(deposit.Data.WithdrawalCredentials),
|
||||
},
|
||||
@@ -86,12 +85,12 @@ func jsonifyDeposits(deposits []*ethpb.Deposit) []*apimiddleware.DepositJson {
|
||||
return jsonDeposits
|
||||
}
|
||||
|
||||
func jsonifyProposerSlashings(proposerSlashings []*ethpb.ProposerSlashing) []*apimiddleware.ProposerSlashingJson {
|
||||
jsonProposerSlashings := make([]*apimiddleware.ProposerSlashingJson, len(proposerSlashings))
|
||||
func jsonifyProposerSlashings(proposerSlashings []*ethpb.ProposerSlashing) []*shared.ProposerSlashing {
|
||||
jsonProposerSlashings := make([]*shared.ProposerSlashing, len(proposerSlashings))
|
||||
for index, proposerSlashing := range proposerSlashings {
|
||||
jsonProposerSlashing := &apimiddleware.ProposerSlashingJson{
|
||||
Header_1: jsonifySignedBeaconBlockHeader(proposerSlashing.Header_1),
|
||||
Header_2: jsonifySignedBeaconBlockHeader(proposerSlashing.Header_2),
|
||||
jsonProposerSlashing := &shared.ProposerSlashing{
|
||||
SignedHeader1: jsonifySignedBeaconBlockHeader(proposerSlashing.Header_1),
|
||||
SignedHeader2: jsonifySignedBeaconBlockHeader(proposerSlashing.Header_2),
|
||||
}
|
||||
jsonProposerSlashings[index] = jsonProposerSlashing
|
||||
}
|
||||
@@ -99,11 +98,11 @@ func jsonifyProposerSlashings(proposerSlashings []*ethpb.ProposerSlashing) []*ap
|
||||
}
|
||||
|
||||
// JsonifySignedVoluntaryExits converts an array of voluntary exit structs to a JSON hex string compatible format.
|
||||
func JsonifySignedVoluntaryExits(voluntaryExits []*ethpb.SignedVoluntaryExit) []*apimiddleware.SignedVoluntaryExitJson {
|
||||
jsonSignedVoluntaryExits := make([]*apimiddleware.SignedVoluntaryExitJson, len(voluntaryExits))
|
||||
func JsonifySignedVoluntaryExits(voluntaryExits []*ethpb.SignedVoluntaryExit) []*shared.SignedVoluntaryExit {
|
||||
jsonSignedVoluntaryExits := make([]*shared.SignedVoluntaryExit, len(voluntaryExits))
|
||||
for index, signedVoluntaryExit := range voluntaryExits {
|
||||
jsonSignedVoluntaryExit := &apimiddleware.SignedVoluntaryExitJson{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
jsonSignedVoluntaryExit := &shared.SignedVoluntaryExit{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: uint64ToString(signedVoluntaryExit.Exit.Epoch),
|
||||
ValidatorIndex: uint64ToString(signedVoluntaryExit.Exit.ValidatorIndex),
|
||||
},
|
||||
@@ -114,9 +113,9 @@ func JsonifySignedVoluntaryExits(voluntaryExits []*ethpb.SignedVoluntaryExit) []
|
||||
return jsonSignedVoluntaryExits
|
||||
}
|
||||
|
||||
func jsonifySignedBeaconBlockHeader(signedBeaconBlockHeader *ethpb.SignedBeaconBlockHeader) *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
return &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
func jsonifySignedBeaconBlockHeader(signedBeaconBlockHeader *ethpb.SignedBeaconBlockHeader) *shared.SignedBeaconBlockHeader {
|
||||
return &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
BodyRoot: hexutil.Encode(signedBeaconBlockHeader.Header.BodyRoot),
|
||||
ParentRoot: hexutil.Encode(signedBeaconBlockHeader.Header.ParentRoot),
|
||||
ProposerIndex: uint64ToString(signedBeaconBlockHeader.Header.ProposerIndex),
|
||||
@@ -127,47 +126,47 @@ func jsonifySignedBeaconBlockHeader(signedBeaconBlockHeader *ethpb.SignedBeaconB
|
||||
}
|
||||
}
|
||||
|
||||
func jsonifyIndexedAttestation(indexedAttestation *ethpb.IndexedAttestation) *apimiddleware.IndexedAttestationJson {
|
||||
func jsonifyIndexedAttestation(indexedAttestation *ethpb.IndexedAttestation) *shared.IndexedAttestation {
|
||||
attestingIndices := make([]string, len(indexedAttestation.AttestingIndices))
|
||||
for index, attestingIndex := range indexedAttestation.AttestingIndices {
|
||||
attestingIndex := uint64ToString(attestingIndex)
|
||||
attestingIndices[index] = attestingIndex
|
||||
}
|
||||
|
||||
return &apimiddleware.IndexedAttestationJson{
|
||||
return &shared.IndexedAttestation{
|
||||
AttestingIndices: attestingIndices,
|
||||
Data: jsonifyAttestationData(indexedAttestation.Data),
|
||||
Signature: hexutil.Encode(indexedAttestation.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
func jsonifyAttestationData(attestationData *ethpb.AttestationData) *apimiddleware.AttestationDataJson {
|
||||
return &apimiddleware.AttestationDataJson{
|
||||
func jsonifyAttestationData(attestationData *ethpb.AttestationData) *shared.AttestationData {
|
||||
return &shared.AttestationData{
|
||||
BeaconBlockRoot: hexutil.Encode(attestationData.BeaconBlockRoot),
|
||||
CommitteeIndex: uint64ToString(attestationData.CommitteeIndex),
|
||||
Slot: uint64ToString(attestationData.Slot),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: uint64ToString(attestationData.Source.Epoch),
|
||||
Root: hexutil.Encode(attestationData.Source.Root),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: uint64ToString(attestationData.Target.Epoch),
|
||||
Root: hexutil.Encode(attestationData.Target.Root),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func jsonifyAttestation(attestation *ethpb.Attestation) *apimiddleware.AttestationJson {
|
||||
return &apimiddleware.AttestationJson{
|
||||
func jsonifyAttestation(attestation *ethpb.Attestation) *shared.Attestation {
|
||||
return &shared.Attestation{
|
||||
AggregationBits: hexutil.Encode(attestation.AggregationBits),
|
||||
Data: jsonifyAttestationData(attestation.Data),
|
||||
Signature: hexutil.Encode(attestation.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
func jsonifySignedAggregateAndProof(signedAggregateAndProof *ethpb.SignedAggregateAttestationAndProof) *apimiddleware.SignedAggregateAttestationAndProofJson {
|
||||
return &apimiddleware.SignedAggregateAttestationAndProofJson{
|
||||
Message: &apimiddleware.AggregateAttestationAndProofJson{
|
||||
func jsonifySignedAggregateAndProof(signedAggregateAndProof *ethpb.SignedAggregateAttestationAndProof) *shared.SignedAggregateAttestationAndProof {
|
||||
return &shared.SignedAggregateAttestationAndProof{
|
||||
Message: &shared.AggregateAttestationAndProof{
|
||||
AggregatorIndex: uint64ToString(signedAggregateAndProof.Message.AggregatorIndex),
|
||||
Aggregate: jsonifyAttestation(signedAggregateAndProof.Message.Aggregate),
|
||||
SelectionProof: hexutil.Encode(signedAggregateAndProof.Message.SelectionProof),
|
||||
@@ -176,10 +175,10 @@ func jsonifySignedAggregateAndProof(signedAggregateAndProof *ethpb.SignedAggrega
|
||||
}
|
||||
}
|
||||
|
||||
func jsonifyWithdrawals(withdrawals []*enginev1.Withdrawal) []*apimiddleware.WithdrawalJson {
|
||||
jsonWithdrawals := make([]*apimiddleware.WithdrawalJson, len(withdrawals))
|
||||
func jsonifyWithdrawals(withdrawals []*enginev1.Withdrawal) []*shared.Withdrawal {
|
||||
jsonWithdrawals := make([]*shared.Withdrawal, len(withdrawals))
|
||||
for index, withdrawal := range withdrawals {
|
||||
jsonWithdrawals[index] = &apimiddleware.WithdrawalJson{
|
||||
jsonWithdrawals[index] = &shared.Withdrawal{
|
||||
WithdrawalIndex: strconv.FormatUint(withdrawal.Index, 10),
|
||||
ValidatorIndex: strconv.FormatUint(uint64(withdrawal.ValidatorIndex), 10),
|
||||
ExecutionAddress: hexutil.Encode(withdrawal.Address),
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -77,7 +76,7 @@ func TestBeaconBlockJsonHelpers_JsonifyEth1Data(t *testing.T) {
|
||||
BlockHash: []byte{3},
|
||||
}
|
||||
|
||||
expectedResult := &apimiddleware.Eth1DataJson{
|
||||
expectedResult := &shared.Eth1Data{
|
||||
DepositRoot: hexutil.Encode([]byte{1}),
|
||||
DepositCount: "2",
|
||||
BlockHash: hexutil.Encode([]byte{3}),
|
||||
@@ -125,18 +124,18 @@ func TestBeaconBlockJsonHelpers_JsonifyAttestations(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.AttestationJson{
|
||||
expectedResult := []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: hexutil.Encode([]byte{1}),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "2",
|
||||
CommitteeIndex: "3",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{4}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "5",
|
||||
Root: hexutil.Encode([]byte{6}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "7",
|
||||
Root: hexutil.Encode([]byte{8}),
|
||||
},
|
||||
@@ -145,15 +144,15 @@ func TestBeaconBlockJsonHelpers_JsonifyAttestations(t *testing.T) {
|
||||
},
|
||||
{
|
||||
AggregationBits: hexutil.Encode([]byte{10}),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "11",
|
||||
CommitteeIndex: "12",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{13}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "14",
|
||||
Root: hexutil.Encode([]byte{15}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "16",
|
||||
Root: hexutil.Encode([]byte{17}),
|
||||
},
|
||||
@@ -242,36 +241,36 @@ func TestBeaconBlockJsonHelpers_JsonifyAttesterSlashings(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.AttesterSlashingJson{
|
||||
expectedResult := []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"1", "2"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "3",
|
||||
CommitteeIndex: "4",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{5}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "6",
|
||||
Root: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "8",
|
||||
Root: hexutil.Encode([]byte{9}),
|
||||
},
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{10}),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"11", "12"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "13",
|
||||
CommitteeIndex: "14",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{15}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "16",
|
||||
Root: hexutil.Encode([]byte{17}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "18",
|
||||
Root: hexutil.Encode([]byte{19}),
|
||||
},
|
||||
@@ -280,34 +279,34 @@ func TestBeaconBlockJsonHelpers_JsonifyAttesterSlashings(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"21", "22"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "23",
|
||||
CommitteeIndex: "24",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{25}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "26",
|
||||
Root: hexutil.Encode([]byte{27}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "28",
|
||||
Root: hexutil.Encode([]byte{29}),
|
||||
},
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{30}),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"31", "32"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "33",
|
||||
CommitteeIndex: "34",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{35}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "36",
|
||||
Root: hexutil.Encode([]byte{37}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "38",
|
||||
Root: hexutil.Encode([]byte{39}),
|
||||
},
|
||||
@@ -346,14 +345,14 @@ func TestBeaconBlockJsonHelpers_JsonifyDeposits(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.DepositJson{
|
||||
expectedResult := []*shared.Deposit{
|
||||
{
|
||||
Proof: []string{
|
||||
hexutil.Encode([]byte{1}),
|
||||
hexutil.Encode([]byte{2}),
|
||||
},
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: hexutil.Encode([]byte{3}),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: hexutil.Encode([]byte{3}),
|
||||
WithdrawalCredentials: hexutil.Encode([]byte{4}),
|
||||
Amount: "5",
|
||||
Signature: hexutil.Encode([]byte{6}),
|
||||
@@ -364,8 +363,8 @@ func TestBeaconBlockJsonHelpers_JsonifyDeposits(t *testing.T) {
|
||||
hexutil.Encode([]byte{7}),
|
||||
hexutil.Encode([]byte{8}),
|
||||
},
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: hexutil.Encode([]byte{9}),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: hexutil.Encode([]byte{9}),
|
||||
WithdrawalCredentials: hexutil.Encode([]byte{10}),
|
||||
Amount: "11",
|
||||
Signature: hexutil.Encode([]byte{12}),
|
||||
@@ -425,10 +424,10 @@ func TestBeaconBlockJsonHelpers_JsonifyProposerSlashings(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.ProposerSlashingJson{
|
||||
expectedResult := []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: hexutil.Encode([]byte{3}),
|
||||
@@ -437,8 +436,8 @@ func TestBeaconBlockJsonHelpers_JsonifyProposerSlashings(t *testing.T) {
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{6}),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "7",
|
||||
ProposerIndex: "8",
|
||||
ParentRoot: hexutil.Encode([]byte{9}),
|
||||
@@ -449,8 +448,8 @@ func TestBeaconBlockJsonHelpers_JsonifyProposerSlashings(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "13",
|
||||
ProposerIndex: "14",
|
||||
ParentRoot: hexutil.Encode([]byte{15}),
|
||||
@@ -459,8 +458,8 @@ func TestBeaconBlockJsonHelpers_JsonifyProposerSlashings(t *testing.T) {
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{18}),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "19",
|
||||
ProposerIndex: "20",
|
||||
ParentRoot: hexutil.Encode([]byte{21}),
|
||||
@@ -494,16 +493,16 @@ func TestBeaconBlockJsonHelpers_JsonifySignedVoluntaryExits(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.SignedVoluntaryExitJson{
|
||||
expectedResult := []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "1",
|
||||
ValidatorIndex: "2",
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{3}),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "4",
|
||||
ValidatorIndex: "5",
|
||||
},
|
||||
@@ -527,8 +526,8 @@ func TestBeaconBlockJsonHelpers_JsonifySignedBeaconBlockHeader(t *testing.T) {
|
||||
Signature: []byte{6},
|
||||
}
|
||||
|
||||
expectedResult := &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
expectedResult := &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: hexutil.Encode([]byte{3}),
|
||||
@@ -561,17 +560,17 @@ func TestBeaconBlockJsonHelpers_JsonifyIndexedAttestation(t *testing.T) {
|
||||
Signature: []byte{10},
|
||||
}
|
||||
|
||||
expectedResult := &apimiddleware.IndexedAttestationJson{
|
||||
expectedResult := &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"1", "2"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "3",
|
||||
CommitteeIndex: "4",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{5}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "6",
|
||||
Root: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "8",
|
||||
Root: hexutil.Encode([]byte{9}),
|
||||
},
|
||||
@@ -598,15 +597,15 @@ func TestBeaconBlockJsonHelpers_JsonifyAttestationData(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := &apimiddleware.AttestationDataJson{
|
||||
expectedResult := &shared.AttestationData{
|
||||
Slot: "1",
|
||||
CommitteeIndex: "2",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{3}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "4",
|
||||
Root: hexutil.Encode([]byte{5}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "6",
|
||||
Root: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
@@ -632,7 +631,7 @@ func TestBeaconBlockJsonHelpers_JsonifyWithdrawals(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.WithdrawalJson{
|
||||
expectedResult := []*shared.Withdrawal{
|
||||
{
|
||||
WithdrawalIndex: "1",
|
||||
ValidatorIndex: "2",
|
||||
|
||||
@@ -5,13 +5,13 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
func convertProposerSlashingsToProto(jsonProposerSlashings []*apimiddleware.ProposerSlashingJson) ([]*ethpb.ProposerSlashing, error) {
|
||||
func convertProposerSlashingsToProto(jsonProposerSlashings []*shared.ProposerSlashing) ([]*ethpb.ProposerSlashing, error) {
|
||||
proposerSlashings := make([]*ethpb.ProposerSlashing, len(jsonProposerSlashings))
|
||||
|
||||
for index, jsonProposerSlashing := range jsonProposerSlashings {
|
||||
@@ -19,12 +19,12 @@ func convertProposerSlashingsToProto(jsonProposerSlashings []*apimiddleware.Prop
|
||||
return nil, errors.Errorf("proposer slashing at index `%d` is nil", index)
|
||||
}
|
||||
|
||||
header1, err := convertProposerSlashingSignedHeaderToProto(jsonProposerSlashing.Header_1)
|
||||
header1, err := convertProposerSlashingSignedHeaderToProto(jsonProposerSlashing.SignedHeader1)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get proposer header 1")
|
||||
}
|
||||
|
||||
header2, err := convertProposerSlashingSignedHeaderToProto(jsonProposerSlashing.Header_2)
|
||||
header2, err := convertProposerSlashingSignedHeaderToProto(jsonProposerSlashing.SignedHeader2)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get proposer header 2")
|
||||
}
|
||||
@@ -38,38 +38,38 @@ func convertProposerSlashingsToProto(jsonProposerSlashings []*apimiddleware.Prop
|
||||
return proposerSlashings, nil
|
||||
}
|
||||
|
||||
func convertProposerSlashingSignedHeaderToProto(signedHeader *apimiddleware.SignedBeaconBlockHeaderJson) (*ethpb.SignedBeaconBlockHeader, error) {
|
||||
func convertProposerSlashingSignedHeaderToProto(signedHeader *shared.SignedBeaconBlockHeader) (*ethpb.SignedBeaconBlockHeader, error) {
|
||||
if signedHeader == nil {
|
||||
return nil, errors.New("signed header is nil")
|
||||
}
|
||||
|
||||
if signedHeader.Header == nil {
|
||||
if signedHeader.Message == nil {
|
||||
return nil, errors.New("header is nil")
|
||||
}
|
||||
|
||||
slot, err := strconv.ParseUint(signedHeader.Header.Slot, 10, 64)
|
||||
slot, err := strconv.ParseUint(signedHeader.Message.Slot, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse header slot `%s`", signedHeader.Header.Slot)
|
||||
return nil, errors.Wrapf(err, "failed to parse header slot `%s`", signedHeader.Message.Slot)
|
||||
}
|
||||
|
||||
proposerIndex, err := strconv.ParseUint(signedHeader.Header.ProposerIndex, 10, 64)
|
||||
proposerIndex, err := strconv.ParseUint(signedHeader.Message.ProposerIndex, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse header proposer index `%s`", signedHeader.Header.ProposerIndex)
|
||||
return nil, errors.Wrapf(err, "failed to parse header proposer index `%s`", signedHeader.Message.ProposerIndex)
|
||||
}
|
||||
|
||||
parentRoot, err := hexutil.Decode(signedHeader.Header.ParentRoot)
|
||||
parentRoot, err := hexutil.Decode(signedHeader.Message.ParentRoot)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to decode header parent root `%s`", signedHeader.Header.ParentRoot)
|
||||
return nil, errors.Wrapf(err, "failed to decode header parent root `%s`", signedHeader.Message.ParentRoot)
|
||||
}
|
||||
|
||||
stateRoot, err := hexutil.Decode(signedHeader.Header.StateRoot)
|
||||
stateRoot, err := hexutil.Decode(signedHeader.Message.StateRoot)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to decode header state root `%s`", signedHeader.Header.StateRoot)
|
||||
return nil, errors.Wrapf(err, "failed to decode header state root `%s`", signedHeader.Message.StateRoot)
|
||||
}
|
||||
|
||||
bodyRoot, err := hexutil.Decode(signedHeader.Header.BodyRoot)
|
||||
bodyRoot, err := hexutil.Decode(signedHeader.Message.BodyRoot)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to decode header body root `%s`", signedHeader.Header.BodyRoot)
|
||||
return nil, errors.Wrapf(err, "failed to decode header body root `%s`", signedHeader.Message.BodyRoot)
|
||||
}
|
||||
|
||||
signature, err := hexutil.Decode(signedHeader.Signature)
|
||||
@@ -89,7 +89,7 @@ func convertProposerSlashingSignedHeaderToProto(signedHeader *apimiddleware.Sign
|
||||
}, nil
|
||||
}
|
||||
|
||||
func convertAttesterSlashingsToProto(jsonAttesterSlashings []*apimiddleware.AttesterSlashingJson) ([]*ethpb.AttesterSlashing, error) {
|
||||
func convertAttesterSlashingsToProto(jsonAttesterSlashings []*shared.AttesterSlashing) ([]*ethpb.AttesterSlashing, error) {
|
||||
attesterSlashings := make([]*ethpb.AttesterSlashing, len(jsonAttesterSlashings))
|
||||
|
||||
for index, jsonAttesterSlashing := range jsonAttesterSlashings {
|
||||
@@ -97,12 +97,12 @@ func convertAttesterSlashingsToProto(jsonAttesterSlashings []*apimiddleware.Atte
|
||||
return nil, errors.Errorf("attester slashing at index `%d` is nil", index)
|
||||
}
|
||||
|
||||
attestation1, err := convertIndexedAttestationToProto(jsonAttesterSlashing.Attestation_1)
|
||||
attestation1, err := convertIndexedAttestationToProto(jsonAttesterSlashing.Attestation1)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get attestation 1")
|
||||
}
|
||||
|
||||
attestation2, err := convertIndexedAttestationToProto(jsonAttesterSlashing.Attestation_2)
|
||||
attestation2, err := convertIndexedAttestationToProto(jsonAttesterSlashing.Attestation2)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get attestation 2")
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func convertAttesterSlashingsToProto(jsonAttesterSlashings []*apimiddleware.Atte
|
||||
return attesterSlashings, nil
|
||||
}
|
||||
|
||||
func convertIndexedAttestationToProto(jsonAttestation *apimiddleware.IndexedAttestationJson) (*ethpb.IndexedAttestation, error) {
|
||||
func convertIndexedAttestationToProto(jsonAttestation *shared.IndexedAttestation) (*ethpb.IndexedAttestation, error) {
|
||||
if jsonAttestation == nil {
|
||||
return nil, errors.New("indexed attestation is nil")
|
||||
}
|
||||
@@ -149,7 +149,7 @@ func convertIndexedAttestationToProto(jsonAttestation *apimiddleware.IndexedAtte
|
||||
}, nil
|
||||
}
|
||||
|
||||
func convertCheckpointToProto(jsonCheckpoint *apimiddleware.CheckpointJson) (*ethpb.Checkpoint, error) {
|
||||
func convertCheckpointToProto(jsonCheckpoint *shared.Checkpoint) (*ethpb.Checkpoint, error) {
|
||||
if jsonCheckpoint == nil {
|
||||
return nil, errors.New("checkpoint is nil")
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func convertCheckpointToProto(jsonCheckpoint *apimiddleware.CheckpointJson) (*et
|
||||
}, nil
|
||||
}
|
||||
|
||||
func convertAttestationToProto(jsonAttestation *apimiddleware.AttestationJson) (*ethpb.Attestation, error) {
|
||||
func convertAttestationToProto(jsonAttestation *shared.Attestation) (*ethpb.Attestation, error) {
|
||||
if jsonAttestation == nil {
|
||||
return nil, errors.New("json attestation is nil")
|
||||
}
|
||||
@@ -197,7 +197,7 @@ func convertAttestationToProto(jsonAttestation *apimiddleware.AttestationJson) (
|
||||
}, nil
|
||||
}
|
||||
|
||||
func convertAttestationsToProto(jsonAttestations []*apimiddleware.AttestationJson) ([]*ethpb.Attestation, error) {
|
||||
func convertAttestationsToProto(jsonAttestations []*shared.Attestation) ([]*ethpb.Attestation, error) {
|
||||
var attestations []*ethpb.Attestation
|
||||
for index, jsonAttestation := range jsonAttestations {
|
||||
if jsonAttestation == nil {
|
||||
@@ -215,7 +215,7 @@ func convertAttestationsToProto(jsonAttestations []*apimiddleware.AttestationJso
|
||||
return attestations, nil
|
||||
}
|
||||
|
||||
func convertAttestationDataToProto(jsonAttestationData *apimiddleware.AttestationDataJson) (*ethpb.AttestationData, error) {
|
||||
func convertAttestationDataToProto(jsonAttestationData *shared.AttestationData) (*ethpb.AttestationData, error) {
|
||||
if jsonAttestationData == nil {
|
||||
return nil, errors.New("attestation data is nil")
|
||||
}
|
||||
@@ -254,7 +254,7 @@ func convertAttestationDataToProto(jsonAttestationData *apimiddleware.Attestatio
|
||||
}, nil
|
||||
}
|
||||
|
||||
func convertDepositsToProto(jsonDeposits []*apimiddleware.DepositJson) ([]*ethpb.Deposit, error) {
|
||||
func convertDepositsToProto(jsonDeposits []*shared.Deposit) ([]*ethpb.Deposit, error) {
|
||||
deposits := make([]*ethpb.Deposit, len(jsonDeposits))
|
||||
|
||||
for depositIndex, jsonDeposit := range jsonDeposits {
|
||||
@@ -276,9 +276,9 @@ func convertDepositsToProto(jsonDeposits []*apimiddleware.DepositJson) ([]*ethpb
|
||||
return nil, errors.Errorf("deposit data at index `%d` is nil", depositIndex)
|
||||
}
|
||||
|
||||
pubkey, err := hexutil.Decode(jsonDeposit.Data.PublicKey)
|
||||
pubkey, err := hexutil.Decode(jsonDeposit.Data.Pubkey)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to decode deposit public key `%s`", jsonDeposit.Data.PublicKey)
|
||||
return nil, errors.Wrapf(err, "failed to decode deposit public key `%s`", jsonDeposit.Data.Pubkey)
|
||||
}
|
||||
|
||||
withdrawalCredentials, err := hexutil.Decode(jsonDeposit.Data.WithdrawalCredentials)
|
||||
@@ -310,7 +310,7 @@ func convertDepositsToProto(jsonDeposits []*apimiddleware.DepositJson) ([]*ethpb
|
||||
return deposits, nil
|
||||
}
|
||||
|
||||
func convertVoluntaryExitsToProto(jsonVoluntaryExits []*apimiddleware.SignedVoluntaryExitJson) ([]*ethpb.SignedVoluntaryExit, error) {
|
||||
func convertVoluntaryExitsToProto(jsonVoluntaryExits []*shared.SignedVoluntaryExit) ([]*ethpb.SignedVoluntaryExit, error) {
|
||||
attestingIndices := make([]*ethpb.SignedVoluntaryExit, len(jsonVoluntaryExits))
|
||||
|
||||
for index, jsonVoluntaryExit := range jsonVoluntaryExits {
|
||||
@@ -318,18 +318,18 @@ func convertVoluntaryExitsToProto(jsonVoluntaryExits []*apimiddleware.SignedVolu
|
||||
return nil, errors.Errorf("signed voluntary exit at index `%d` is nil", index)
|
||||
}
|
||||
|
||||
if jsonVoluntaryExit.Exit == nil {
|
||||
if jsonVoluntaryExit.Message == nil {
|
||||
return nil, errors.Errorf("voluntary exit at index `%d` is nil", index)
|
||||
}
|
||||
|
||||
epoch, err := strconv.ParseUint(jsonVoluntaryExit.Exit.Epoch, 10, 64)
|
||||
epoch, err := strconv.ParseUint(jsonVoluntaryExit.Message.Epoch, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse voluntary exit epoch `%s`", jsonVoluntaryExit.Exit.Epoch)
|
||||
return nil, errors.Wrapf(err, "failed to parse voluntary exit epoch `%s`", jsonVoluntaryExit.Message.Epoch)
|
||||
}
|
||||
|
||||
validatorIndex, err := strconv.ParseUint(jsonVoluntaryExit.Exit.ValidatorIndex, 10, 64)
|
||||
validatorIndex, err := strconv.ParseUint(jsonVoluntaryExit.Message.ValidatorIndex, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse voluntary exit validator index `%s`", jsonVoluntaryExit.Exit.ValidatorIndex)
|
||||
return nil, errors.Wrapf(err, "failed to parse voluntary exit validator index `%s`", jsonVoluntaryExit.Message.ValidatorIndex)
|
||||
}
|
||||
|
||||
signature, err := hexutil.Decode(jsonVoluntaryExit.Signature)
|
||||
@@ -364,7 +364,7 @@ func convertTransactionsToProto(jsonTransactions []string) ([][]byte, error) {
|
||||
return transactions, nil
|
||||
}
|
||||
|
||||
func convertWithdrawalsToProto(jsonWithdrawals []*apimiddleware.WithdrawalJson) ([]*enginev1.Withdrawal, error) {
|
||||
func convertWithdrawalsToProto(jsonWithdrawals []*shared.Withdrawal) ([]*enginev1.Withdrawal, error) {
|
||||
withdrawals := make([]*enginev1.Withdrawal, len(jsonWithdrawals))
|
||||
|
||||
for index, jsonWithdrawal := range jsonWithdrawals {
|
||||
@@ -403,7 +403,7 @@ func convertWithdrawalsToProto(jsonWithdrawals []*apimiddleware.WithdrawalJson)
|
||||
return withdrawals, nil
|
||||
}
|
||||
|
||||
func convertBlsToExecutionChangesToProto(jsonSignedBlsToExecutionChanges []*apimiddleware.SignedBLSToExecutionChangeJson) ([]*ethpb.SignedBLSToExecutionChange, error) {
|
||||
func convertBlsToExecutionChangesToProto(jsonSignedBlsToExecutionChanges []*shared.SignedBLSToExecutionChange) ([]*ethpb.SignedBLSToExecutionChange, error) {
|
||||
signedBlsToExecutionChanges := make([]*ethpb.SignedBLSToExecutionChange, len(jsonSignedBlsToExecutionChanges))
|
||||
|
||||
for index, jsonBlsToExecutionChange := range jsonSignedBlsToExecutionChanges {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
@@ -14,15 +14,15 @@ import (
|
||||
func TestBeaconBlockProtoHelpers_ConvertProposerSlashingsToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.ProposerSlashingJson
|
||||
generateInput func() []*shared.ProposerSlashing
|
||||
expectedResult []*ethpb.ProposerSlashing
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil proposer slashing",
|
||||
expectedErrorMessage: "proposer slashing at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.ProposerSlashingJson {
|
||||
return []*apimiddleware.ProposerSlashingJson{
|
||||
generateInput: func() []*shared.ProposerSlashing {
|
||||
return []*shared.ProposerSlashing{
|
||||
nil,
|
||||
}
|
||||
},
|
||||
@@ -30,21 +30,18 @@ func TestBeaconBlockProtoHelpers_ConvertProposerSlashingsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad header 1",
|
||||
expectedErrorMessage: "failed to get proposer header 1",
|
||||
generateInput: func() []*apimiddleware.ProposerSlashingJson {
|
||||
return []*apimiddleware.ProposerSlashingJson{
|
||||
{
|
||||
Header_1: nil,
|
||||
Header_2: nil,
|
||||
},
|
||||
}
|
||||
generateInput: func() []*shared.ProposerSlashing {
|
||||
input := generateProposerSlashings()
|
||||
input[0].SignedHeader1 = nil
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad header 2",
|
||||
expectedErrorMessage: "failed to get proposer header 2",
|
||||
generateInput: func() []*apimiddleware.ProposerSlashingJson {
|
||||
generateInput: func() []*shared.ProposerSlashing {
|
||||
input := generateProposerSlashings()
|
||||
input[0].Header_2 = nil
|
||||
input[0].SignedHeader2 = nil
|
||||
return input
|
||||
},
|
||||
},
|
||||
@@ -117,73 +114,73 @@ func TestBeaconBlockProtoHelpers_ConvertProposerSlashingsToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertProposerSlashingSignedHeaderToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() *apimiddleware.SignedBeaconBlockHeaderJson
|
||||
generateInput func() *shared.SignedBeaconBlockHeader
|
||||
expectedResult *ethpb.SignedBeaconBlockHeader
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil signed header",
|
||||
expectedErrorMessage: "signed header is nil",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson { return nil },
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader { return nil },
|
||||
},
|
||||
{
|
||||
name: "nil header",
|
||||
expectedErrorMessage: "header is nil",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Header = nil
|
||||
input.Message = nil
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad slot",
|
||||
expectedErrorMessage: "failed to parse header slot `foo`",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Header.Slot = "foo"
|
||||
input.Message.Slot = "foo"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad proposer index",
|
||||
expectedErrorMessage: "failed to parse header proposer index `bar`",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Header.ProposerIndex = "bar"
|
||||
input.Message.ProposerIndex = "bar"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad parent root",
|
||||
expectedErrorMessage: "failed to decode header parent root `foo`",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Header.ParentRoot = "foo"
|
||||
input.Message.ParentRoot = "foo"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad state root",
|
||||
expectedErrorMessage: "failed to decode header state root `bar`",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Header.StateRoot = "bar"
|
||||
input.Message.StateRoot = "bar"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad body root",
|
||||
expectedErrorMessage: "failed to decode header body root `foo`",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Header.BodyRoot = "foo"
|
||||
input.Message.BodyRoot = "foo"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad parent root",
|
||||
expectedErrorMessage: "failed to decode signature `bar`",
|
||||
generateInput: func() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
generateInput: func() *shared.SignedBeaconBlockHeader {
|
||||
input := generateSignedBeaconBlockHeader()
|
||||
input.Signature = "bar"
|
||||
return input
|
||||
@@ -222,15 +219,15 @@ func TestBeaconBlockProtoHelpers_ConvertProposerSlashingSignedHeaderToProto(t *t
|
||||
func TestBeaconBlockProtoHelpers_ConvertAttesterSlashingsToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.AttesterSlashingJson
|
||||
generateInput func() []*shared.AttesterSlashing
|
||||
expectedResult []*ethpb.AttesterSlashing
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil attester slashing",
|
||||
expectedErrorMessage: "attester slashing at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.AttesterSlashingJson {
|
||||
return []*apimiddleware.AttesterSlashingJson{
|
||||
generateInput: func() []*shared.AttesterSlashing {
|
||||
return []*shared.AttesterSlashing{
|
||||
nil,
|
||||
}
|
||||
},
|
||||
@@ -238,11 +235,11 @@ func TestBeaconBlockProtoHelpers_ConvertAttesterSlashingsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad attestation 1",
|
||||
expectedErrorMessage: "failed to get attestation 1",
|
||||
generateInput: func() []*apimiddleware.AttesterSlashingJson {
|
||||
return []*apimiddleware.AttesterSlashingJson{
|
||||
generateInput: func() []*shared.AttesterSlashing {
|
||||
return []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: nil,
|
||||
Attestation_2: nil,
|
||||
Attestation1: nil,
|
||||
Attestation2: nil,
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -250,9 +247,9 @@ func TestBeaconBlockProtoHelpers_ConvertAttesterSlashingsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad attestation 2",
|
||||
expectedErrorMessage: "failed to get attestation 2",
|
||||
generateInput: func() []*apimiddleware.AttesterSlashingJson {
|
||||
generateInput: func() []*shared.AttesterSlashing {
|
||||
input := generateAttesterSlashings()
|
||||
input[0].Attestation_2 = nil
|
||||
input[0].Attestation2 = nil
|
||||
return input
|
||||
},
|
||||
},
|
||||
@@ -353,19 +350,19 @@ func TestBeaconBlockProtoHelpers_ConvertAttesterSlashingsToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertAttestationToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() *apimiddleware.IndexedAttestationJson
|
||||
generateInput func() *shared.IndexedAttestation
|
||||
expectedResult *ethpb.IndexedAttestation
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil indexed attestation",
|
||||
expectedErrorMessage: "indexed attestation is nil",
|
||||
generateInput: func() *apimiddleware.IndexedAttestationJson { return nil },
|
||||
generateInput: func() *shared.IndexedAttestation { return nil },
|
||||
},
|
||||
{
|
||||
name: "bad attesting index",
|
||||
expectedErrorMessage: "failed to parse attesting index `foo`",
|
||||
generateInput: func() *apimiddleware.IndexedAttestationJson {
|
||||
generateInput: func() *shared.IndexedAttestation {
|
||||
input := generateIndexedAttestation()
|
||||
input.AttestingIndices[0] = "foo"
|
||||
return input
|
||||
@@ -374,7 +371,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad signature",
|
||||
expectedErrorMessage: "failed to decode attestation signature `bar`",
|
||||
generateInput: func() *apimiddleware.IndexedAttestationJson {
|
||||
generateInput: func() *shared.IndexedAttestation {
|
||||
input := generateIndexedAttestation()
|
||||
input.Signature = "bar"
|
||||
return input
|
||||
@@ -383,7 +380,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad data",
|
||||
expectedErrorMessage: "failed to get attestation data",
|
||||
generateInput: func() *apimiddleware.IndexedAttestationJson {
|
||||
generateInput: func() *shared.IndexedAttestation {
|
||||
input := generateIndexedAttestation()
|
||||
input.Data = nil
|
||||
return input
|
||||
@@ -429,19 +426,19 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertCheckpointToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() *apimiddleware.CheckpointJson
|
||||
generateInput func() *shared.Checkpoint
|
||||
expectedResult *ethpb.Checkpoint
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil checkpoint",
|
||||
expectedErrorMessage: "checkpoint is nil",
|
||||
generateInput: func() *apimiddleware.CheckpointJson { return nil },
|
||||
generateInput: func() *shared.Checkpoint { return nil },
|
||||
},
|
||||
{
|
||||
name: "bad epoch",
|
||||
expectedErrorMessage: "failed to parse checkpoint epoch `foo`",
|
||||
generateInput: func() *apimiddleware.CheckpointJson {
|
||||
generateInput: func() *shared.Checkpoint {
|
||||
input := generateCheckpoint()
|
||||
input.Epoch = "foo"
|
||||
return input
|
||||
@@ -450,7 +447,7 @@ func TestBeaconBlockProtoHelpers_ConvertCheckpointToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad root",
|
||||
expectedErrorMessage: "failed to decode checkpoint root `bar`",
|
||||
generateInput: func() *apimiddleware.CheckpointJson {
|
||||
generateInput: func() *shared.Checkpoint {
|
||||
input := generateCheckpoint()
|
||||
input.Root = "bar"
|
||||
return input
|
||||
@@ -483,15 +480,15 @@ func TestBeaconBlockProtoHelpers_ConvertCheckpointToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertAttestationsToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.AttestationJson
|
||||
generateInput func() []*shared.Attestation
|
||||
expectedResult []*ethpb.Attestation
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil attestation",
|
||||
expectedErrorMessage: "attestation at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.AttestationJson {
|
||||
return []*apimiddleware.AttestationJson{
|
||||
generateInput: func() []*shared.Attestation {
|
||||
return []*shared.Attestation{
|
||||
nil,
|
||||
}
|
||||
},
|
||||
@@ -499,7 +496,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad aggregation bits",
|
||||
expectedErrorMessage: "failed to decode aggregation bits `foo`",
|
||||
generateInput: func() []*apimiddleware.AttestationJson {
|
||||
generateInput: func() []*shared.Attestation {
|
||||
input := generateAttestations()
|
||||
input[0].AggregationBits = "foo"
|
||||
return input
|
||||
@@ -508,7 +505,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad data",
|
||||
expectedErrorMessage: "failed to get attestation data",
|
||||
generateInput: func() []*apimiddleware.AttestationJson {
|
||||
generateInput: func() []*shared.Attestation {
|
||||
input := generateAttestations()
|
||||
input[0].Data = nil
|
||||
return input
|
||||
@@ -517,7 +514,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad signature",
|
||||
expectedErrorMessage: "failed to decode attestation signature `bar`",
|
||||
generateInput: func() []*apimiddleware.AttestationJson {
|
||||
generateInput: func() []*shared.Attestation {
|
||||
input := generateAttestations()
|
||||
input[0].Signature = "bar"
|
||||
return input
|
||||
@@ -582,19 +579,19 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationsToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertAttestationDataToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() *apimiddleware.AttestationDataJson
|
||||
generateInput func() *shared.AttestationData
|
||||
expectedResult *ethpb.AttestationData
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil attestation data",
|
||||
expectedErrorMessage: "attestation data is nil",
|
||||
generateInput: func() *apimiddleware.AttestationDataJson { return nil },
|
||||
generateInput: func() *shared.AttestationData { return nil },
|
||||
},
|
||||
{
|
||||
name: "bad slot",
|
||||
expectedErrorMessage: "failed to parse attestation slot `foo`",
|
||||
generateInput: func() *apimiddleware.AttestationDataJson {
|
||||
generateInput: func() *shared.AttestationData {
|
||||
input := generateAttestationData()
|
||||
input.Slot = "foo"
|
||||
return input
|
||||
@@ -603,7 +600,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationDataToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad committee index",
|
||||
expectedErrorMessage: "failed to parse attestation committee index `bar`",
|
||||
generateInput: func() *apimiddleware.AttestationDataJson {
|
||||
generateInput: func() *shared.AttestationData {
|
||||
input := generateAttestationData()
|
||||
input.CommitteeIndex = "bar"
|
||||
return input
|
||||
@@ -612,7 +609,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationDataToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad beacon block root",
|
||||
expectedErrorMessage: "failed to decode attestation beacon block root `foo`",
|
||||
generateInput: func() *apimiddleware.AttestationDataJson {
|
||||
generateInput: func() *shared.AttestationData {
|
||||
input := generateAttestationData()
|
||||
input.BeaconBlockRoot = "foo"
|
||||
return input
|
||||
@@ -621,7 +618,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationDataToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad source checkpoint",
|
||||
expectedErrorMessage: "failed to get attestation source checkpoint",
|
||||
generateInput: func() *apimiddleware.AttestationDataJson {
|
||||
generateInput: func() *shared.AttestationData {
|
||||
input := generateAttestationData()
|
||||
input.Source = nil
|
||||
return input
|
||||
@@ -630,7 +627,7 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationDataToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad target checkpoint",
|
||||
expectedErrorMessage: "failed to get attestation target checkpoint",
|
||||
generateInput: func() *apimiddleware.AttestationDataJson {
|
||||
generateInput: func() *shared.AttestationData {
|
||||
input := generateAttestationData()
|
||||
input.Target = nil
|
||||
return input
|
||||
@@ -672,15 +669,15 @@ func TestBeaconBlockProtoHelpers_ConvertAttestationDataToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.DepositJson
|
||||
generateInput func() []*shared.Deposit
|
||||
expectedResult []*ethpb.Deposit
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil deposit",
|
||||
expectedErrorMessage: "deposit at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
return []*apimiddleware.DepositJson{
|
||||
generateInput: func() []*shared.Deposit {
|
||||
return []*shared.Deposit{
|
||||
nil,
|
||||
}
|
||||
},
|
||||
@@ -688,7 +685,7 @@ func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad proof",
|
||||
expectedErrorMessage: "failed to decode deposit proof `foo`",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
generateInput: func() []*shared.Deposit {
|
||||
input := generateDeposits()
|
||||
input[0].Proof[0] = "foo"
|
||||
return input
|
||||
@@ -697,7 +694,7 @@ func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
{
|
||||
name: "nil data",
|
||||
expectedErrorMessage: "deposit data at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
generateInput: func() []*shared.Deposit {
|
||||
input := generateDeposits()
|
||||
input[0].Data = nil
|
||||
return input
|
||||
@@ -706,16 +703,16 @@ func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad public key",
|
||||
expectedErrorMessage: "failed to decode deposit public key `bar`",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
generateInput: func() []*shared.Deposit {
|
||||
input := generateDeposits()
|
||||
input[0].Data.PublicKey = "bar"
|
||||
input[0].Data.Pubkey = "bar"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad withdrawal credentials",
|
||||
expectedErrorMessage: "failed to decode deposit withdrawal credentials `foo`",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
generateInput: func() []*shared.Deposit {
|
||||
input := generateDeposits()
|
||||
input[0].Data.WithdrawalCredentials = "foo"
|
||||
return input
|
||||
@@ -724,7 +721,7 @@ func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad amount",
|
||||
expectedErrorMessage: "failed to parse deposit amount `bar`",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
generateInput: func() []*shared.Deposit {
|
||||
input := generateDeposits()
|
||||
input[0].Data.Amount = "bar"
|
||||
return input
|
||||
@@ -733,7 +730,7 @@ func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad signature",
|
||||
expectedErrorMessage: "failed to decode signature `foo`",
|
||||
generateInput: func() []*apimiddleware.DepositJson {
|
||||
generateInput: func() []*shared.Deposit {
|
||||
input := generateDeposits()
|
||||
input[0].Data.Signature = "foo"
|
||||
return input
|
||||
@@ -788,15 +785,15 @@ func TestBeaconBlockProtoHelpers_ConvertDepositsToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertVoluntaryExitsToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.SignedVoluntaryExitJson
|
||||
generateInput func() []*shared.SignedVoluntaryExit
|
||||
expectedResult []*ethpb.SignedVoluntaryExit
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil voluntary exit",
|
||||
expectedErrorMessage: "signed voluntary exit at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
return []*apimiddleware.SignedVoluntaryExitJson{
|
||||
generateInput: func() []*shared.SignedVoluntaryExit {
|
||||
return []*shared.SignedVoluntaryExit{
|
||||
nil,
|
||||
}
|
||||
},
|
||||
@@ -804,34 +801,34 @@ func TestBeaconBlockProtoHelpers_ConvertVoluntaryExitsToProto(t *testing.T) {
|
||||
{
|
||||
name: "nil data",
|
||||
expectedErrorMessage: "voluntary exit at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
generateInput: func() []*shared.SignedVoluntaryExit {
|
||||
input := generateSignedVoluntaryExits()
|
||||
input[0].Exit = nil
|
||||
input[0].Message = nil
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad epoch",
|
||||
expectedErrorMessage: "failed to parse voluntary exit epoch `foo`",
|
||||
generateInput: func() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
generateInput: func() []*shared.SignedVoluntaryExit {
|
||||
input := generateSignedVoluntaryExits()
|
||||
input[0].Exit.Epoch = "foo"
|
||||
input[0].Message.Epoch = "foo"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad validator index",
|
||||
expectedErrorMessage: "failed to parse voluntary exit validator index `bar`",
|
||||
generateInput: func() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
generateInput: func() []*shared.SignedVoluntaryExit {
|
||||
input := generateSignedVoluntaryExits()
|
||||
input[0].Exit.ValidatorIndex = "bar"
|
||||
input[0].Message.ValidatorIndex = "bar"
|
||||
return input
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "bad signature",
|
||||
expectedErrorMessage: "failed to decode signature `foo`",
|
||||
generateInput: func() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
generateInput: func() []*shared.SignedVoluntaryExit {
|
||||
input := generateSignedVoluntaryExits()
|
||||
input[0].Signature = "foo"
|
||||
return input
|
||||
@@ -921,14 +918,14 @@ func TestBeaconBlockProtoHelpers_ConvertTransactionsToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertWithdrawalsToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.WithdrawalJson
|
||||
generateInput func() []*shared.Withdrawal
|
||||
expectedResult []*enginev1.Withdrawal
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil withdrawal",
|
||||
expectedErrorMessage: "withdrawal at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.WithdrawalJson {
|
||||
generateInput: func() []*shared.Withdrawal {
|
||||
input := generateWithdrawals()
|
||||
input[0] = nil
|
||||
return input
|
||||
@@ -937,7 +934,7 @@ func TestBeaconBlockProtoHelpers_ConvertWithdrawalsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad withdrawal index",
|
||||
expectedErrorMessage: "failed to parse withdrawal index `foo`",
|
||||
generateInput: func() []*apimiddleware.WithdrawalJson {
|
||||
generateInput: func() []*shared.Withdrawal {
|
||||
input := generateWithdrawals()
|
||||
input[0].WithdrawalIndex = "foo"
|
||||
return input
|
||||
@@ -946,7 +943,7 @@ func TestBeaconBlockProtoHelpers_ConvertWithdrawalsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad validator index",
|
||||
expectedErrorMessage: "failed to parse validator index `bar`",
|
||||
generateInput: func() []*apimiddleware.WithdrawalJson {
|
||||
generateInput: func() []*shared.Withdrawal {
|
||||
input := generateWithdrawals()
|
||||
input[0].ValidatorIndex = "bar"
|
||||
return input
|
||||
@@ -955,7 +952,7 @@ func TestBeaconBlockProtoHelpers_ConvertWithdrawalsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad execution address",
|
||||
expectedErrorMessage: "failed to decode execution address `foo`",
|
||||
generateInput: func() []*apimiddleware.WithdrawalJson {
|
||||
generateInput: func() []*shared.Withdrawal {
|
||||
input := generateWithdrawals()
|
||||
input[0].ExecutionAddress = "foo"
|
||||
return input
|
||||
@@ -964,7 +961,7 @@ func TestBeaconBlockProtoHelpers_ConvertWithdrawalsToProto(t *testing.T) {
|
||||
{
|
||||
name: "bad amount",
|
||||
expectedErrorMessage: "failed to parse withdrawal amount `bar`",
|
||||
generateInput: func() []*apimiddleware.WithdrawalJson {
|
||||
generateInput: func() []*shared.Withdrawal {
|
||||
input := generateWithdrawals()
|
||||
input[0].Amount = "bar"
|
||||
return input
|
||||
@@ -1007,14 +1004,14 @@ func TestBeaconBlockProtoHelpers_ConvertWithdrawalsToProto(t *testing.T) {
|
||||
func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
generateInput func() []*apimiddleware.SignedBLSToExecutionChangeJson
|
||||
generateInput func() []*shared.SignedBLSToExecutionChange
|
||||
expectedResult []*ethpb.SignedBLSToExecutionChange
|
||||
expectedErrorMessage string
|
||||
}{
|
||||
{
|
||||
name: "nil bls to execution change",
|
||||
expectedErrorMessage: "bls to execution change at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
generateInput: func() []*shared.SignedBLSToExecutionChange {
|
||||
input := generateBlsToExecutionChanges()
|
||||
input[0] = nil
|
||||
return input
|
||||
@@ -1023,7 +1020,7 @@ func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.
|
||||
{
|
||||
name: "nil bls to execution change message",
|
||||
expectedErrorMessage: "bls to execution change message at index `0` is nil",
|
||||
generateInput: func() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
generateInput: func() []*shared.SignedBLSToExecutionChange {
|
||||
input := generateBlsToExecutionChanges()
|
||||
input[0].Message = nil
|
||||
return input
|
||||
@@ -1032,7 +1029,7 @@ func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.
|
||||
{
|
||||
name: "bad validator index",
|
||||
expectedErrorMessage: "failed to decode validator index `foo`",
|
||||
generateInput: func() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
generateInput: func() []*shared.SignedBLSToExecutionChange {
|
||||
input := generateBlsToExecutionChanges()
|
||||
input[0].Message.ValidatorIndex = "foo"
|
||||
return input
|
||||
@@ -1041,7 +1038,7 @@ func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.
|
||||
{
|
||||
name: "bad from bls pubkey",
|
||||
expectedErrorMessage: "failed to decode bls pubkey `bar`",
|
||||
generateInput: func() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
generateInput: func() []*shared.SignedBLSToExecutionChange {
|
||||
input := generateBlsToExecutionChanges()
|
||||
input[0].Message.FromBLSPubkey = "bar"
|
||||
return input
|
||||
@@ -1050,7 +1047,7 @@ func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.
|
||||
{
|
||||
name: "bad to execution address",
|
||||
expectedErrorMessage: "failed to decode execution address `foo`",
|
||||
generateInput: func() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
generateInput: func() []*shared.SignedBLSToExecutionChange {
|
||||
input := generateBlsToExecutionChanges()
|
||||
input[0].Message.ToExecutionAddress = "foo"
|
||||
return input
|
||||
@@ -1059,7 +1056,7 @@ func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.
|
||||
{
|
||||
name: "bad signature",
|
||||
expectedErrorMessage: "failed to decode signature `bar`",
|
||||
generateInput: func() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
generateInput: func() []*shared.SignedBLSToExecutionChange {
|
||||
input := generateBlsToExecutionChanges()
|
||||
input[0].Signature = "bar"
|
||||
return input
|
||||
@@ -1081,11 +1078,11 @@ func TestBeaconBlockProtoHelpers_ConvertBlsToExecutionChangesToProto(t *testing.
|
||||
}
|
||||
}
|
||||
|
||||
func generateProposerSlashings() []*apimiddleware.ProposerSlashingJson {
|
||||
return []*apimiddleware.ProposerSlashingJson{
|
||||
func generateProposerSlashings() []*shared.ProposerSlashing {
|
||||
return []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: hexutil.Encode([]byte{3}),
|
||||
@@ -1094,8 +1091,8 @@ func generateProposerSlashings() []*apimiddleware.ProposerSlashingJson {
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{6}),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "7",
|
||||
ProposerIndex: "8",
|
||||
ParentRoot: hexutil.Encode([]byte{9}),
|
||||
@@ -1106,8 +1103,8 @@ func generateProposerSlashings() []*apimiddleware.ProposerSlashingJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "13",
|
||||
ProposerIndex: "14",
|
||||
ParentRoot: hexutil.Encode([]byte{15}),
|
||||
@@ -1116,8 +1113,8 @@ func generateProposerSlashings() []*apimiddleware.ProposerSlashingJson {
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{18}),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "19",
|
||||
ProposerIndex: "20",
|
||||
ParentRoot: hexutil.Encode([]byte{21}),
|
||||
@@ -1130,9 +1127,9 @@ func generateProposerSlashings() []*apimiddleware.ProposerSlashingJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateSignedBeaconBlockHeader() *apimiddleware.SignedBeaconBlockHeaderJson {
|
||||
return &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
func generateSignedBeaconBlockHeader() *shared.SignedBeaconBlockHeader {
|
||||
return &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: hexutil.Encode([]byte{3}),
|
||||
@@ -1143,37 +1140,37 @@ func generateSignedBeaconBlockHeader() *apimiddleware.SignedBeaconBlockHeaderJso
|
||||
}
|
||||
}
|
||||
|
||||
func generateAttesterSlashings() []*apimiddleware.AttesterSlashingJson {
|
||||
return []*apimiddleware.AttesterSlashingJson{
|
||||
func generateAttesterSlashings() []*shared.AttesterSlashing {
|
||||
return []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"1", "2"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "3",
|
||||
CommitteeIndex: "4",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{5}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "6",
|
||||
Root: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "8",
|
||||
Root: hexutil.Encode([]byte{9}),
|
||||
},
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{10}),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"11", "12"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "13",
|
||||
CommitteeIndex: "14",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{15}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "16",
|
||||
Root: hexutil.Encode([]byte{17}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "18",
|
||||
Root: hexutil.Encode([]byte{19}),
|
||||
},
|
||||
@@ -1182,34 +1179,34 @@ func generateAttesterSlashings() []*apimiddleware.AttesterSlashingJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"21", "22"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "23",
|
||||
CommitteeIndex: "24",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{25}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "26",
|
||||
Root: hexutil.Encode([]byte{27}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "28",
|
||||
Root: hexutil.Encode([]byte{29}),
|
||||
},
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{30}),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"31", "32"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "33",
|
||||
CommitteeIndex: "34",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{35}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "36",
|
||||
Root: hexutil.Encode([]byte{37}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "38",
|
||||
Root: hexutil.Encode([]byte{39}),
|
||||
},
|
||||
@@ -1220,18 +1217,18 @@ func generateAttesterSlashings() []*apimiddleware.AttesterSlashingJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateIndexedAttestation() *apimiddleware.IndexedAttestationJson {
|
||||
return &apimiddleware.IndexedAttestationJson{
|
||||
func generateIndexedAttestation() *shared.IndexedAttestation {
|
||||
return &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"1", "2"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "3",
|
||||
CommitteeIndex: "4",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{5}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "6",
|
||||
Root: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "8",
|
||||
Root: hexutil.Encode([]byte{9}),
|
||||
},
|
||||
@@ -1240,26 +1237,26 @@ func generateIndexedAttestation() *apimiddleware.IndexedAttestationJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateCheckpoint() *apimiddleware.CheckpointJson {
|
||||
return &apimiddleware.CheckpointJson{
|
||||
func generateCheckpoint() *shared.Checkpoint {
|
||||
return &shared.Checkpoint{
|
||||
Epoch: "1",
|
||||
Root: hexutil.Encode([]byte{2}),
|
||||
}
|
||||
}
|
||||
|
||||
func generateAttestations() []*apimiddleware.AttestationJson {
|
||||
return []*apimiddleware.AttestationJson{
|
||||
func generateAttestations() []*shared.Attestation {
|
||||
return []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: hexutil.Encode([]byte{1}),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "2",
|
||||
CommitteeIndex: "3",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{4}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "5",
|
||||
Root: hexutil.Encode([]byte{6}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "7",
|
||||
Root: hexutil.Encode([]byte{8}),
|
||||
},
|
||||
@@ -1268,15 +1265,15 @@ func generateAttestations() []*apimiddleware.AttestationJson {
|
||||
},
|
||||
{
|
||||
AggregationBits: hexutil.Encode([]byte{10}),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "11",
|
||||
CommitteeIndex: "12",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{13}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "14",
|
||||
Root: hexutil.Encode([]byte{15}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "16",
|
||||
Root: hexutil.Encode([]byte{17}),
|
||||
},
|
||||
@@ -1286,31 +1283,31 @@ func generateAttestations() []*apimiddleware.AttestationJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateAttestationData() *apimiddleware.AttestationDataJson {
|
||||
return &apimiddleware.AttestationDataJson{
|
||||
func generateAttestationData() *shared.AttestationData {
|
||||
return &shared.AttestationData{
|
||||
Slot: "1",
|
||||
CommitteeIndex: "2",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{3}),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "4",
|
||||
Root: hexutil.Encode([]byte{5}),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "6",
|
||||
Root: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func generateDeposits() []*apimiddleware.DepositJson {
|
||||
return []*apimiddleware.DepositJson{
|
||||
func generateDeposits() []*shared.Deposit {
|
||||
return []*shared.Deposit{
|
||||
{
|
||||
Proof: []string{
|
||||
hexutil.Encode([]byte{1}),
|
||||
hexutil.Encode([]byte{2}),
|
||||
},
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: hexutil.Encode([]byte{3}),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: hexutil.Encode([]byte{3}),
|
||||
WithdrawalCredentials: hexutil.Encode([]byte{4}),
|
||||
Amount: "5",
|
||||
Signature: hexutil.Encode([]byte{6}),
|
||||
@@ -1321,8 +1318,8 @@ func generateDeposits() []*apimiddleware.DepositJson {
|
||||
hexutil.Encode([]byte{7}),
|
||||
hexutil.Encode([]byte{8}),
|
||||
},
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: hexutil.Encode([]byte{9}),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: hexutil.Encode([]byte{9}),
|
||||
WithdrawalCredentials: hexutil.Encode([]byte{10}),
|
||||
Amount: "11",
|
||||
Signature: hexutil.Encode([]byte{12}),
|
||||
@@ -1331,17 +1328,17 @@ func generateDeposits() []*apimiddleware.DepositJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateSignedVoluntaryExits() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
return []*apimiddleware.SignedVoluntaryExitJson{
|
||||
func generateSignedVoluntaryExits() []*shared.SignedVoluntaryExit {
|
||||
return []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "1",
|
||||
ValidatorIndex: "2",
|
||||
},
|
||||
Signature: hexutil.Encode([]byte{3}),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "4",
|
||||
ValidatorIndex: "5",
|
||||
},
|
||||
@@ -1350,8 +1347,8 @@ func generateSignedVoluntaryExits() []*apimiddleware.SignedVoluntaryExitJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateWithdrawals() []*apimiddleware.WithdrawalJson {
|
||||
return []*apimiddleware.WithdrawalJson{
|
||||
func generateWithdrawals() []*shared.Withdrawal {
|
||||
return []*shared.Withdrawal{
|
||||
{
|
||||
WithdrawalIndex: "1",
|
||||
ValidatorIndex: "2",
|
||||
@@ -1367,10 +1364,10 @@ func generateWithdrawals() []*apimiddleware.WithdrawalJson {
|
||||
}
|
||||
}
|
||||
|
||||
func generateBlsToExecutionChanges() []*apimiddleware.SignedBLSToExecutionChangeJson {
|
||||
return []*apimiddleware.SignedBLSToExecutionChangeJson{
|
||||
func generateBlsToExecutionChanges() []*shared.SignedBLSToExecutionChange {
|
||||
return []*shared.SignedBLSToExecutionChange{
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "1",
|
||||
FromBLSPubkey: hexutil.Encode([]byte{2}),
|
||||
ToExecutionAddress: hexutil.Encode([]byte{3}),
|
||||
@@ -1378,7 +1375,7 @@ func generateBlsToExecutionChanges() []*apimiddleware.SignedBLSToExecutionChange
|
||||
Signature: hexutil.Encode([]byte{4}),
|
||||
},
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "5",
|
||||
FromBLSPubkey: hexutil.Encode([]byte{6}),
|
||||
ToExecutionAddress: hexutil.Encode([]byte{7}),
|
||||
|
||||
@@ -12,7 +12,6 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api/mock",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/beacon:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//beacon-chain/rpc/eth/validator:go_default_library",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: validator/client/beacon-api/beacon_block_converter.go
|
||||
// Source: github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api (interfaces: BeaconBlockConverter)
|
||||
|
||||
// Package mock is a generated GoMock package.
|
||||
package mock
|
||||
@@ -8,89 +8,89 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
apimiddleware "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
shared "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
// MockbeaconBlockConverter is a mock of beaconBlockConverter interface.
|
||||
type MockbeaconBlockConverter struct {
|
||||
// MockBeaconBlockConverter is a mock of BeaconBlockConverter interface.
|
||||
type MockBeaconBlockConverter struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockbeaconBlockConverterMockRecorder
|
||||
recorder *MockBeaconBlockConverterMockRecorder
|
||||
}
|
||||
|
||||
// MockbeaconBlockConverterMockRecorder is the mock recorder for MockbeaconBlockConverter.
|
||||
type MockbeaconBlockConverterMockRecorder struct {
|
||||
mock *MockbeaconBlockConverter
|
||||
// MockBeaconBlockConverterMockRecorder is the mock recorder for MockBeaconBlockConverter.
|
||||
type MockBeaconBlockConverterMockRecorder struct {
|
||||
mock *MockBeaconBlockConverter
|
||||
}
|
||||
|
||||
// NewMockbeaconBlockConverter creates a new mock instance.
|
||||
func NewMockbeaconBlockConverter(ctrl *gomock.Controller) *MockbeaconBlockConverter {
|
||||
mock := &MockbeaconBlockConverter{ctrl: ctrl}
|
||||
mock.recorder = &MockbeaconBlockConverterMockRecorder{mock}
|
||||
// NewMockBeaconBlockConverter creates a new mock instance.
|
||||
func NewMockBeaconBlockConverter(ctrl *gomock.Controller) *MockBeaconBlockConverter {
|
||||
mock := &MockBeaconBlockConverter{ctrl: ctrl}
|
||||
mock.recorder = &MockBeaconBlockConverterMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockbeaconBlockConverter) EXPECT() *MockbeaconBlockConverterMockRecorder {
|
||||
func (m *MockBeaconBlockConverter) EXPECT() *MockBeaconBlockConverterMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ConvertRESTAltairBlockToProto mocks base method.
|
||||
func (m *MockbeaconBlockConverter) ConvertRESTAltairBlockToProto(block *apimiddleware.BeaconBlockAltairJson) (*eth.BeaconBlockAltair, error) {
|
||||
func (m *MockBeaconBlockConverter) ConvertRESTAltairBlockToProto(arg0 *shared.BeaconBlockAltair) (*eth.BeaconBlockAltair, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConvertRESTAltairBlockToProto", block)
|
||||
ret := m.ctrl.Call(m, "ConvertRESTAltairBlockToProto", arg0)
|
||||
ret0, _ := ret[0].(*eth.BeaconBlockAltair)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ConvertRESTAltairBlockToProto indicates an expected call of ConvertRESTAltairBlockToProto.
|
||||
func (mr *MockbeaconBlockConverterMockRecorder) ConvertRESTAltairBlockToProto(block interface{}) *gomock.Call {
|
||||
func (mr *MockBeaconBlockConverterMockRecorder) ConvertRESTAltairBlockToProto(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTAltairBlockToProto", reflect.TypeOf((*MockbeaconBlockConverter)(nil).ConvertRESTAltairBlockToProto), block)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTAltairBlockToProto", reflect.TypeOf((*MockBeaconBlockConverter)(nil).ConvertRESTAltairBlockToProto), arg0)
|
||||
}
|
||||
|
||||
// ConvertRESTBellatrixBlockToProto mocks base method.
|
||||
func (m *MockbeaconBlockConverter) ConvertRESTBellatrixBlockToProto(block *apimiddleware.BeaconBlockBellatrixJson) (*eth.BeaconBlockBellatrix, error) {
|
||||
func (m *MockBeaconBlockConverter) ConvertRESTBellatrixBlockToProto(arg0 *shared.BeaconBlockBellatrix) (*eth.BeaconBlockBellatrix, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConvertRESTBellatrixBlockToProto", block)
|
||||
ret := m.ctrl.Call(m, "ConvertRESTBellatrixBlockToProto", arg0)
|
||||
ret0, _ := ret[0].(*eth.BeaconBlockBellatrix)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ConvertRESTBellatrixBlockToProto indicates an expected call of ConvertRESTBellatrixBlockToProto.
|
||||
func (mr *MockbeaconBlockConverterMockRecorder) ConvertRESTBellatrixBlockToProto(block interface{}) *gomock.Call {
|
||||
func (mr *MockBeaconBlockConverterMockRecorder) ConvertRESTBellatrixBlockToProto(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTBellatrixBlockToProto", reflect.TypeOf((*MockbeaconBlockConverter)(nil).ConvertRESTBellatrixBlockToProto), block)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTBellatrixBlockToProto", reflect.TypeOf((*MockBeaconBlockConverter)(nil).ConvertRESTBellatrixBlockToProto), arg0)
|
||||
}
|
||||
|
||||
// ConvertRESTCapellaBlockToProto mocks base method.
|
||||
func (m *MockbeaconBlockConverter) ConvertRESTCapellaBlockToProto(block *apimiddleware.BeaconBlockCapellaJson) (*eth.BeaconBlockCapella, error) {
|
||||
func (m *MockBeaconBlockConverter) ConvertRESTCapellaBlockToProto(arg0 *shared.BeaconBlockCapella) (*eth.BeaconBlockCapella, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConvertRESTCapellaBlockToProto", block)
|
||||
ret := m.ctrl.Call(m, "ConvertRESTCapellaBlockToProto", arg0)
|
||||
ret0, _ := ret[0].(*eth.BeaconBlockCapella)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ConvertRESTCapellaBlockToProto indicates an expected call of ConvertRESTCapellaBlockToProto.
|
||||
func (mr *MockbeaconBlockConverterMockRecorder) ConvertRESTCapellaBlockToProto(block interface{}) *gomock.Call {
|
||||
func (mr *MockBeaconBlockConverterMockRecorder) ConvertRESTCapellaBlockToProto(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTCapellaBlockToProto", reflect.TypeOf((*MockbeaconBlockConverter)(nil).ConvertRESTCapellaBlockToProto), block)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTCapellaBlockToProto", reflect.TypeOf((*MockBeaconBlockConverter)(nil).ConvertRESTCapellaBlockToProto), arg0)
|
||||
}
|
||||
|
||||
// ConvertRESTPhase0BlockToProto mocks base method.
|
||||
func (m *MockbeaconBlockConverter) ConvertRESTPhase0BlockToProto(block *apimiddleware.BeaconBlockJson) (*eth.BeaconBlock, error) {
|
||||
func (m *MockBeaconBlockConverter) ConvertRESTPhase0BlockToProto(arg0 *shared.BeaconBlock) (*eth.BeaconBlock, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConvertRESTPhase0BlockToProto", block)
|
||||
ret := m.ctrl.Call(m, "ConvertRESTPhase0BlockToProto", arg0)
|
||||
ret0, _ := ret[0].(*eth.BeaconBlock)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ConvertRESTPhase0BlockToProto indicates an expected call of ConvertRESTPhase0BlockToProto.
|
||||
func (mr *MockbeaconBlockConverterMockRecorder) ConvertRESTPhase0BlockToProto(block interface{}) *gomock.Call {
|
||||
func (mr *MockBeaconBlockConverterMockRecorder) ConvertRESTPhase0BlockToProto(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTPhase0BlockToProto", reflect.TypeOf((*MockbeaconBlockConverter)(nil).ConvertRESTPhase0BlockToProto), block)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConvertRESTPhase0BlockToProto", reflect.TypeOf((*MockBeaconBlockConverter)(nil).ConvertRESTPhase0BlockToProto), arg0)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -150,10 +149,10 @@ func (c beaconApiValidatorClient) proposeBeaconBlock(ctx context.Context, in *et
|
||||
}
|
||||
|
||||
func marshallBeaconBlockPhase0(block *ethpb.SignedBeaconBlock) ([]byte, error) {
|
||||
signedBeaconBlockJson := &apimiddleware.SignedBeaconBlockJson{
|
||||
signedBeaconBlockJson := &shared.SignedBeaconBlock{
|
||||
Signature: hexutil.Encode(block.Signature),
|
||||
Message: &apimiddleware.BeaconBlockJson{
|
||||
Body: &apimiddleware.BeaconBlockBodyJson{
|
||||
Message: &shared.BeaconBlock{
|
||||
Body: &shared.BeaconBlockBody{
|
||||
Attestations: jsonifyAttestations(block.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(block.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(block.Block.Body.Deposits),
|
||||
@@ -174,14 +173,14 @@ func marshallBeaconBlockPhase0(block *ethpb.SignedBeaconBlock) ([]byte, error) {
|
||||
}
|
||||
|
||||
func marshallBeaconBlockAltair(block *ethpb.SignedBeaconBlockAltair) ([]byte, error) {
|
||||
signedBeaconBlockAltairJson := &apimiddleware.SignedBeaconBlockAltairJson{
|
||||
signedBeaconBlockAltairJson := &shared.SignedBeaconBlockAltair{
|
||||
Signature: hexutil.Encode(block.Signature),
|
||||
Message: &apimiddleware.BeaconBlockAltairJson{
|
||||
Message: &shared.BeaconBlockAltair{
|
||||
ParentRoot: hexutil.Encode(block.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(block.Block.ProposerIndex),
|
||||
Slot: uint64ToString(block.Block.Slot),
|
||||
StateRoot: hexutil.Encode(block.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyAltairJson{
|
||||
Body: &shared.BeaconBlockBodyAltair{
|
||||
Attestations: jsonifyAttestations(block.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(block.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(block.Block.Body.Deposits),
|
||||
@@ -190,7 +189,7 @@ func marshallBeaconBlockAltair(block *ethpb.SignedBeaconBlockAltair) ([]byte, er
|
||||
ProposerSlashings: jsonifyProposerSlashings(block.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(block.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(block.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
@@ -202,14 +201,14 @@ func marshallBeaconBlockAltair(block *ethpb.SignedBeaconBlockAltair) ([]byte, er
|
||||
}
|
||||
|
||||
func marshallBeaconBlockBellatrix(block *ethpb.SignedBeaconBlockBellatrix) ([]byte, error) {
|
||||
signedBeaconBlockBellatrixJson := &apimiddleware.SignedBeaconBlockBellatrixJson{
|
||||
signedBeaconBlockBellatrixJson := &shared.SignedBeaconBlockBellatrix{
|
||||
Signature: hexutil.Encode(block.Signature),
|
||||
Message: &apimiddleware.BeaconBlockBellatrixJson{
|
||||
Message: &shared.BeaconBlockBellatrix{
|
||||
ParentRoot: hexutil.Encode(block.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(block.Block.ProposerIndex),
|
||||
Slot: uint64ToString(block.Block.Slot),
|
||||
StateRoot: hexutil.Encode(block.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyBellatrixJson{
|
||||
Body: &shared.BeaconBlockBodyBellatrix{
|
||||
Attestations: jsonifyAttestations(block.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(block.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(block.Block.Body.Deposits),
|
||||
@@ -218,11 +217,11 @@ func marshallBeaconBlockBellatrix(block *ethpb.SignedBeaconBlockBellatrix) ([]by
|
||||
ProposerSlashings: jsonifyProposerSlashings(block.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(block.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(block.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadJson{
|
||||
ExecutionPayload: &shared.ExecutionPayload{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(block.Block.Body.ExecutionPayload.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(block.Block.Body.ExecutionPayload.BlockHash),
|
||||
BlockNumber: uint64ToString(block.Block.Body.ExecutionPayload.BlockNumber),
|
||||
@@ -235,7 +234,7 @@ func marshallBeaconBlockBellatrix(block *ethpb.SignedBeaconBlockBellatrix) ([]by
|
||||
PrevRandao: hexutil.Encode(block.Block.Body.ExecutionPayload.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(block.Block.Body.ExecutionPayload.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(block.Block.Body.ExecutionPayload.StateRoot),
|
||||
TimeStamp: uint64ToString(block.Block.Body.ExecutionPayload.Timestamp),
|
||||
Timestamp: uint64ToString(block.Block.Body.ExecutionPayload.Timestamp),
|
||||
Transactions: jsonifyTransactions(block.Block.Body.ExecutionPayload.Transactions),
|
||||
},
|
||||
},
|
||||
@@ -246,14 +245,14 @@ func marshallBeaconBlockBellatrix(block *ethpb.SignedBeaconBlockBellatrix) ([]by
|
||||
}
|
||||
|
||||
func marshallBeaconBlockBlindedBellatrix(block *ethpb.SignedBlindedBeaconBlockBellatrix) ([]byte, error) {
|
||||
signedBeaconBlockBellatrixJson := &apimiddleware.SignedBlindedBeaconBlockBellatrixJson{
|
||||
signedBeaconBlockBellatrixJson := &shared.SignedBlindedBeaconBlockBellatrix{
|
||||
Signature: hexutil.Encode(block.Signature),
|
||||
Message: &apimiddleware.BlindedBeaconBlockBellatrixJson{
|
||||
Message: &shared.BlindedBeaconBlockBellatrix{
|
||||
ParentRoot: hexutil.Encode(block.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(block.Block.ProposerIndex),
|
||||
Slot: uint64ToString(block.Block.Slot),
|
||||
StateRoot: hexutil.Encode(block.Block.StateRoot),
|
||||
Body: &apimiddleware.BlindedBeaconBlockBodyBellatrixJson{
|
||||
Body: &shared.BlindedBeaconBlockBodyBellatrix{
|
||||
Attestations: jsonifyAttestations(block.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(block.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(block.Block.Body.Deposits),
|
||||
@@ -262,11 +261,11 @@ func marshallBeaconBlockBlindedBellatrix(block *ethpb.SignedBlindedBeaconBlockBe
|
||||
ProposerSlashings: jsonifyProposerSlashings(block.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(block.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(block.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayloadHeader: &apimiddleware.ExecutionPayloadHeaderJson{
|
||||
ExecutionPayloadHeader: &shared.ExecutionPayloadHeader{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(block.Block.Body.ExecutionPayloadHeader.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.BlockHash),
|
||||
BlockNumber: uint64ToString(block.Block.Body.ExecutionPayloadHeader.BlockNumber),
|
||||
@@ -279,7 +278,7 @@ func marshallBeaconBlockBlindedBellatrix(block *ethpb.SignedBlindedBeaconBlockBe
|
||||
PrevRandao: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.StateRoot),
|
||||
TimeStamp: uint64ToString(block.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
Timestamp: uint64ToString(block.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
TransactionsRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.TransactionsRoot),
|
||||
},
|
||||
},
|
||||
@@ -290,14 +289,14 @@ func marshallBeaconBlockBlindedBellatrix(block *ethpb.SignedBlindedBeaconBlockBe
|
||||
}
|
||||
|
||||
func marshallBeaconBlockCapella(block *ethpb.SignedBeaconBlockCapella) ([]byte, error) {
|
||||
signedBeaconBlockCapellaJson := &apimiddleware.SignedBeaconBlockCapellaJson{
|
||||
signedBeaconBlockCapellaJson := &shared.SignedBeaconBlockCapella{
|
||||
Signature: hexutil.Encode(block.Signature),
|
||||
Message: &apimiddleware.BeaconBlockCapellaJson{
|
||||
Message: &shared.BeaconBlockCapella{
|
||||
ParentRoot: hexutil.Encode(block.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(block.Block.ProposerIndex),
|
||||
Slot: uint64ToString(block.Block.Slot),
|
||||
StateRoot: hexutil.Encode(block.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyCapellaJson{
|
||||
Body: &shared.BeaconBlockBodyCapella{
|
||||
Attestations: jsonifyAttestations(block.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(block.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(block.Block.Body.Deposits),
|
||||
@@ -306,11 +305,11 @@ func marshallBeaconBlockCapella(block *ethpb.SignedBeaconBlockCapella) ([]byte,
|
||||
ProposerSlashings: jsonifyProposerSlashings(block.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(block.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(block.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadCapellaJson{
|
||||
ExecutionPayload: &shared.ExecutionPayloadCapella{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(block.Block.Body.ExecutionPayload.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(block.Block.Body.ExecutionPayload.BlockHash),
|
||||
BlockNumber: uint64ToString(block.Block.Body.ExecutionPayload.BlockNumber),
|
||||
@@ -323,11 +322,11 @@ func marshallBeaconBlockCapella(block *ethpb.SignedBeaconBlockCapella) ([]byte,
|
||||
PrevRandao: hexutil.Encode(block.Block.Body.ExecutionPayload.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(block.Block.Body.ExecutionPayload.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(block.Block.Body.ExecutionPayload.StateRoot),
|
||||
TimeStamp: uint64ToString(block.Block.Body.ExecutionPayload.Timestamp),
|
||||
Timestamp: uint64ToString(block.Block.Body.ExecutionPayload.Timestamp),
|
||||
Transactions: jsonifyTransactions(block.Block.Body.ExecutionPayload.Transactions),
|
||||
Withdrawals: jsonifyWithdrawals(block.Block.Body.ExecutionPayload.Withdrawals),
|
||||
},
|
||||
BLSToExecutionChanges: jsonifyBlsToExecutionChanges(block.Block.Body.BlsToExecutionChanges),
|
||||
BlsToExecutionChanges: jsonifyBlsToExecutionChanges(block.Block.Body.BlsToExecutionChanges),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -336,14 +335,14 @@ func marshallBeaconBlockCapella(block *ethpb.SignedBeaconBlockCapella) ([]byte,
|
||||
}
|
||||
|
||||
func marshallBeaconBlockBlindedCapella(block *ethpb.SignedBlindedBeaconBlockCapella) ([]byte, error) {
|
||||
signedBeaconBlockCapellaJson := &apimiddleware.SignedBlindedBeaconBlockCapellaJson{
|
||||
signedBeaconBlockCapellaJson := &shared.SignedBlindedBeaconBlockCapella{
|
||||
Signature: hexutil.Encode(block.Signature),
|
||||
Message: &apimiddleware.BlindedBeaconBlockCapellaJson{
|
||||
Message: &shared.BlindedBeaconBlockCapella{
|
||||
ParentRoot: hexutil.Encode(block.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(block.Block.ProposerIndex),
|
||||
Slot: uint64ToString(block.Block.Slot),
|
||||
StateRoot: hexutil.Encode(block.Block.StateRoot),
|
||||
Body: &apimiddleware.BlindedBeaconBlockBodyCapellaJson{
|
||||
Body: &shared.BlindedBeaconBlockBodyCapella{
|
||||
Attestations: jsonifyAttestations(block.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(block.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(block.Block.Body.Deposits),
|
||||
@@ -352,11 +351,11 @@ func marshallBeaconBlockBlindedCapella(block *ethpb.SignedBlindedBeaconBlockCape
|
||||
ProposerSlashings: jsonifyProposerSlashings(block.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(block.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(block.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(block.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayloadHeader: &apimiddleware.ExecutionPayloadHeaderCapellaJson{
|
||||
ExecutionPayloadHeader: &shared.ExecutionPayloadHeaderCapella{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(block.Block.Body.ExecutionPayloadHeader.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.BlockHash),
|
||||
BlockNumber: uint64ToString(block.Block.Body.ExecutionPayloadHeader.BlockNumber),
|
||||
@@ -369,11 +368,11 @@ func marshallBeaconBlockBlindedCapella(block *ethpb.SignedBlindedBeaconBlockCape
|
||||
PrevRandao: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.StateRoot),
|
||||
TimeStamp: uint64ToString(block.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
Timestamp: uint64ToString(block.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
TransactionsRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.TransactionsRoot),
|
||||
WithdrawalsRoot: hexutil.Encode(block.Block.Body.ExecutionPayloadHeader.WithdrawalsRoot),
|
||||
},
|
||||
BLSToExecutionChanges: jsonifyBlsToExecutionChanges(block.Block.Body.BlsToExecutionChanges),
|
||||
BlsToExecutionChanges: jsonifyBlsToExecutionChanges(block.Block.Body.BlsToExecutionChanges),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -26,14 +26,14 @@ func TestProposeBeaconBlock_Altair(t *testing.T) {
|
||||
genericSignedBlock := ðpb.GenericSignedBeaconBlock{}
|
||||
genericSignedBlock.Block = altairBlock
|
||||
|
||||
jsonAltairBlock := &apimiddleware.SignedBeaconBlockAltairJson{
|
||||
jsonAltairBlock := &shared.SignedBeaconBlockAltair{
|
||||
Signature: hexutil.Encode(altairBlock.Altair.Signature),
|
||||
Message: &apimiddleware.BeaconBlockAltairJson{
|
||||
Message: &shared.BeaconBlockAltair{
|
||||
ParentRoot: hexutil.Encode(altairBlock.Altair.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(altairBlock.Altair.Block.ProposerIndex),
|
||||
Slot: uint64ToString(altairBlock.Altair.Block.Slot),
|
||||
StateRoot: hexutil.Encode(altairBlock.Altair.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyAltairJson{
|
||||
Body: &shared.BeaconBlockBodyAltair{
|
||||
Attestations: jsonifyAttestations(altairBlock.Altair.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(altairBlock.Altair.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(altairBlock.Altair.Block.Body.Deposits),
|
||||
@@ -42,7 +42,7 @@ func TestProposeBeaconBlock_Altair(t *testing.T) {
|
||||
ProposerSlashings: jsonifyProposerSlashings(altairBlock.Altair.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(altairBlock.Altair.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(altairBlock.Altair.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(altairBlock.Altair.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(altairBlock.Altair.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
@@ -27,14 +27,14 @@ func TestProposeBeaconBlock_Bellatrix(t *testing.T) {
|
||||
genericSignedBlock := ðpb.GenericSignedBeaconBlock{}
|
||||
genericSignedBlock.Block = bellatrixBlock
|
||||
|
||||
jsonBellatrixBlock := &apimiddleware.SignedBeaconBlockBellatrixJson{
|
||||
jsonBellatrixBlock := &shared.SignedBeaconBlockBellatrix{
|
||||
Signature: hexutil.Encode(bellatrixBlock.Bellatrix.Signature),
|
||||
Message: &apimiddleware.BeaconBlockBellatrixJson{
|
||||
Message: &shared.BeaconBlockBellatrix{
|
||||
ParentRoot: hexutil.Encode(bellatrixBlock.Bellatrix.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(bellatrixBlock.Bellatrix.Block.ProposerIndex),
|
||||
Slot: uint64ToString(bellatrixBlock.Bellatrix.Block.Slot),
|
||||
StateRoot: hexutil.Encode(bellatrixBlock.Bellatrix.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyBellatrixJson{
|
||||
Body: &shared.BeaconBlockBodyBellatrix{
|
||||
Attestations: jsonifyAttestations(bellatrixBlock.Bellatrix.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(bellatrixBlock.Bellatrix.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(bellatrixBlock.Bellatrix.Block.Body.Deposits),
|
||||
@@ -43,11 +43,11 @@ func TestProposeBeaconBlock_Bellatrix(t *testing.T) {
|
||||
ProposerSlashings: jsonifyProposerSlashings(bellatrixBlock.Bellatrix.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(bellatrixBlock.Bellatrix.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadJson{
|
||||
ExecutionPayload: &shared.ExecutionPayload{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.BlockHash),
|
||||
BlockNumber: uint64ToString(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.BlockNumber),
|
||||
@@ -60,7 +60,7 @@ func TestProposeBeaconBlock_Bellatrix(t *testing.T) {
|
||||
PrevRandao: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.StateRoot),
|
||||
TimeStamp: uint64ToString(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.Timestamp),
|
||||
Timestamp: uint64ToString(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.Timestamp),
|
||||
Transactions: jsonifyTransactions(bellatrixBlock.Bellatrix.Block.Body.ExecutionPayload.Transactions),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -28,14 +28,14 @@ func TestProposeBeaconBlock_BlindedBellatrix(t *testing.T) {
|
||||
genericSignedBlock := ðpb.GenericSignedBeaconBlock{}
|
||||
genericSignedBlock.Block = blindedBellatrixBlock
|
||||
|
||||
jsonBlindedBellatrixBlock := &apimiddleware.SignedBlindedBeaconBlockBellatrixJson{
|
||||
jsonBlindedBellatrixBlock := &shared.SignedBlindedBeaconBlockBellatrix{
|
||||
Signature: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Signature),
|
||||
Message: &apimiddleware.BlindedBeaconBlockBellatrixJson{
|
||||
Message: &shared.BlindedBeaconBlockBellatrix{
|
||||
ParentRoot: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(blindedBellatrixBlock.BlindedBellatrix.Block.ProposerIndex),
|
||||
Slot: uint64ToString(blindedBellatrixBlock.BlindedBellatrix.Block.Slot),
|
||||
StateRoot: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.StateRoot),
|
||||
Body: &apimiddleware.BlindedBeaconBlockBodyBellatrixJson{
|
||||
Body: &shared.BlindedBeaconBlockBodyBellatrix{
|
||||
Attestations: jsonifyAttestations(blindedBellatrixBlock.BlindedBellatrix.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(blindedBellatrixBlock.BlindedBellatrix.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(blindedBellatrixBlock.BlindedBellatrix.Block.Body.Deposits),
|
||||
@@ -44,11 +44,11 @@ func TestProposeBeaconBlock_BlindedBellatrix(t *testing.T) {
|
||||
ProposerSlashings: jsonifyProposerSlashings(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(blindedBellatrixBlock.BlindedBellatrix.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayloadHeader: &apimiddleware.ExecutionPayloadHeaderJson{
|
||||
ExecutionPayloadHeader: &shared.ExecutionPayloadHeader{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.BlockHash),
|
||||
BlockNumber: uint64ToString(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.BlockNumber),
|
||||
@@ -61,7 +61,7 @@ func TestProposeBeaconBlock_BlindedBellatrix(t *testing.T) {
|
||||
PrevRandao: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.StateRoot),
|
||||
TimeStamp: uint64ToString(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
Timestamp: uint64ToString(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
TransactionsRoot: hexutil.Encode(blindedBellatrixBlock.BlindedBellatrix.Block.Body.ExecutionPayloadHeader.TransactionsRoot),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -28,14 +28,14 @@ func TestProposeBeaconBlock_BlindedCapella(t *testing.T) {
|
||||
genericSignedBlock := ðpb.GenericSignedBeaconBlock{}
|
||||
genericSignedBlock.Block = blindedCapellaBlock
|
||||
|
||||
jsonBlindedCapellaBlock := &apimiddleware.SignedBlindedBeaconBlockCapellaJson{
|
||||
jsonBlindedCapellaBlock := &shared.SignedBlindedBeaconBlockCapella{
|
||||
Signature: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Signature),
|
||||
Message: &apimiddleware.BlindedBeaconBlockCapellaJson{
|
||||
Message: &shared.BlindedBeaconBlockCapella{
|
||||
ParentRoot: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(blindedCapellaBlock.BlindedCapella.Block.ProposerIndex),
|
||||
Slot: uint64ToString(blindedCapellaBlock.BlindedCapella.Block.Slot),
|
||||
StateRoot: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.StateRoot),
|
||||
Body: &apimiddleware.BlindedBeaconBlockBodyCapellaJson{
|
||||
Body: &shared.BlindedBeaconBlockBodyCapella{
|
||||
Attestations: jsonifyAttestations(blindedCapellaBlock.BlindedCapella.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(blindedCapellaBlock.BlindedCapella.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(blindedCapellaBlock.BlindedCapella.Block.Body.Deposits),
|
||||
@@ -44,11 +44,11 @@ func TestProposeBeaconBlock_BlindedCapella(t *testing.T) {
|
||||
ProposerSlashings: jsonifyProposerSlashings(blindedCapellaBlock.BlindedCapella.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(blindedCapellaBlock.BlindedCapella.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayloadHeader: &apimiddleware.ExecutionPayloadHeaderCapellaJson{
|
||||
ExecutionPayloadHeader: &shared.ExecutionPayloadHeaderCapella{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.BlockHash),
|
||||
BlockNumber: uint64ToString(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.BlockNumber),
|
||||
@@ -61,11 +61,11 @@ func TestProposeBeaconBlock_BlindedCapella(t *testing.T) {
|
||||
PrevRandao: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.StateRoot),
|
||||
TimeStamp: uint64ToString(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
Timestamp: uint64ToString(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.Timestamp),
|
||||
TransactionsRoot: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.TransactionsRoot),
|
||||
WithdrawalsRoot: hexutil.Encode(blindedCapellaBlock.BlindedCapella.Block.Body.ExecutionPayloadHeader.WithdrawalsRoot),
|
||||
},
|
||||
BLSToExecutionChanges: jsonifyBlsToExecutionChanges(blindedCapellaBlock.BlindedCapella.Block.Body.BlsToExecutionChanges),
|
||||
BlsToExecutionChanges: jsonifyBlsToExecutionChanges(blindedCapellaBlock.BlindedCapella.Block.Body.BlsToExecutionChanges),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
@@ -27,14 +27,14 @@ func TestProposeBeaconBlock_Capella(t *testing.T) {
|
||||
genericSignedBlock := ðpb.GenericSignedBeaconBlock{}
|
||||
genericSignedBlock.Block = capellaBlock
|
||||
|
||||
jsonCapellaBlock := &apimiddleware.SignedBeaconBlockCapellaJson{
|
||||
jsonCapellaBlock := &shared.SignedBeaconBlockCapella{
|
||||
Signature: hexutil.Encode(capellaBlock.Capella.Signature),
|
||||
Message: &apimiddleware.BeaconBlockCapellaJson{
|
||||
Message: &shared.BeaconBlockCapella{
|
||||
ParentRoot: hexutil.Encode(capellaBlock.Capella.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(capellaBlock.Capella.Block.ProposerIndex),
|
||||
Slot: uint64ToString(capellaBlock.Capella.Block.Slot),
|
||||
StateRoot: hexutil.Encode(capellaBlock.Capella.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyCapellaJson{
|
||||
Body: &shared.BeaconBlockBodyCapella{
|
||||
Attestations: jsonifyAttestations(capellaBlock.Capella.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(capellaBlock.Capella.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(capellaBlock.Capella.Block.Body.Deposits),
|
||||
@@ -43,11 +43,11 @@ func TestProposeBeaconBlock_Capella(t *testing.T) {
|
||||
ProposerSlashings: jsonifyProposerSlashings(capellaBlock.Capella.Block.Body.ProposerSlashings),
|
||||
RandaoReveal: hexutil.Encode(capellaBlock.Capella.Block.Body.RandaoReveal),
|
||||
VoluntaryExits: JsonifySignedVoluntaryExits(capellaBlock.Capella.Block.Body.VoluntaryExits),
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: hexutil.Encode(capellaBlock.Capella.Block.Body.SyncAggregate.SyncCommitteeBits),
|
||||
SyncCommitteeSignature: hexutil.Encode(capellaBlock.Capella.Block.Body.SyncAggregate.SyncCommitteeSignature),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadCapellaJson{
|
||||
ExecutionPayload: &shared.ExecutionPayloadCapella{
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(capellaBlock.Capella.Block.Body.ExecutionPayload.BaseFeePerGas).String(),
|
||||
BlockHash: hexutil.Encode(capellaBlock.Capella.Block.Body.ExecutionPayload.BlockHash),
|
||||
BlockNumber: uint64ToString(capellaBlock.Capella.Block.Body.ExecutionPayload.BlockNumber),
|
||||
@@ -60,11 +60,11 @@ func TestProposeBeaconBlock_Capella(t *testing.T) {
|
||||
PrevRandao: hexutil.Encode(capellaBlock.Capella.Block.Body.ExecutionPayload.PrevRandao),
|
||||
ReceiptsRoot: hexutil.Encode(capellaBlock.Capella.Block.Body.ExecutionPayload.ReceiptsRoot),
|
||||
StateRoot: hexutil.Encode(capellaBlock.Capella.Block.Body.ExecutionPayload.StateRoot),
|
||||
TimeStamp: uint64ToString(capellaBlock.Capella.Block.Body.ExecutionPayload.Timestamp),
|
||||
Timestamp: uint64ToString(capellaBlock.Capella.Block.Body.ExecutionPayload.Timestamp),
|
||||
Transactions: jsonifyTransactions(capellaBlock.Capella.Block.Body.ExecutionPayload.Transactions),
|
||||
Withdrawals: jsonifyWithdrawals(capellaBlock.Capella.Block.Body.ExecutionPayload.Withdrawals),
|
||||
},
|
||||
BLSToExecutionChanges: jsonifyBlsToExecutionChanges(capellaBlock.Capella.Block.Body.BlsToExecutionChanges),
|
||||
BlsToExecutionChanges: jsonifyBlsToExecutionChanges(capellaBlock.Capella.Block.Body.BlsToExecutionChanges),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -26,14 +26,14 @@ func TestProposeBeaconBlock_Phase0(t *testing.T) {
|
||||
genericSignedBlock := ðpb.GenericSignedBeaconBlock{}
|
||||
genericSignedBlock.Block = phase0Block
|
||||
|
||||
jsonPhase0Block := &apimiddleware.SignedBeaconBlockJson{
|
||||
jsonPhase0Block := &shared.SignedBeaconBlock{
|
||||
Signature: hexutil.Encode(phase0Block.Phase0.Signature),
|
||||
Message: &apimiddleware.BeaconBlockJson{
|
||||
Message: &shared.BeaconBlock{
|
||||
ParentRoot: hexutil.Encode(phase0Block.Phase0.Block.ParentRoot),
|
||||
ProposerIndex: uint64ToString(phase0Block.Phase0.Block.ProposerIndex),
|
||||
Slot: uint64ToString(phase0Block.Phase0.Block.Slot),
|
||||
StateRoot: hexutil.Encode(phase0Block.Phase0.Block.StateRoot),
|
||||
Body: &apimiddleware.BeaconBlockBodyJson{
|
||||
Body: &shared.BeaconBlockBody{
|
||||
Attestations: jsonifyAttestations(phase0Block.Phase0.Block.Body.Attestations),
|
||||
AttesterSlashings: jsonifyAttesterSlashings(phase0Block.Phase0.Block.Body.AttesterSlashings),
|
||||
Deposits: jsonifyDeposits(phase0Block.Phase0.Block.Body.Deposits),
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -21,8 +21,8 @@ func (c beaconApiValidatorClient) proposeExit(ctx context.Context, signedVolunta
|
||||
return nil, errors.New("exit is nil")
|
||||
}
|
||||
|
||||
jsonSignedVoluntaryExit := apimiddleware.SignedVoluntaryExitJson{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
jsonSignedVoluntaryExit := shared.SignedVoluntaryExit{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: strconv.FormatUint(uint64(signedVoluntaryExit.Exit.Epoch), 10),
|
||||
ValidatorIndex: strconv.FormatUint(uint64(signedVoluntaryExit.Exit.ValidatorIndex), 10),
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -24,8 +24,8 @@ func TestProposeExit_Valid(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonSignedVoluntaryExit := apimiddleware.SignedVoluntaryExitJson{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
jsonSignedVoluntaryExit := shared.SignedVoluntaryExit{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "1",
|
||||
ValidatorIndex: "2",
|
||||
},
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -89,7 +88,7 @@ func (c beaconApiValidatorClient) getHeadSignedBeaconBlock(ctx context.Context)
|
||||
|
||||
switch signedBlockResponseJson.Version {
|
||||
case "phase0":
|
||||
jsonPhase0Block := apimiddleware.SignedBeaconBlockJson{}
|
||||
jsonPhase0Block := shared.SignedBeaconBlock{}
|
||||
if err := decoder.Decode(&jsonPhase0Block); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to decode signed phase0 block response json")
|
||||
}
|
||||
@@ -114,7 +113,7 @@ func (c beaconApiValidatorClient) getHeadSignedBeaconBlock(ctx context.Context)
|
||||
slot = phase0Block.Slot
|
||||
|
||||
case "altair":
|
||||
jsonAltairBlock := apimiddleware.SignedBeaconBlockAltairJson{}
|
||||
jsonAltairBlock := shared.SignedBeaconBlockAltair{}
|
||||
if err := decoder.Decode(&jsonAltairBlock); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to decode signed altair block response json")
|
||||
}
|
||||
@@ -139,7 +138,7 @@ func (c beaconApiValidatorClient) getHeadSignedBeaconBlock(ctx context.Context)
|
||||
slot = altairBlock.Slot
|
||||
|
||||
case "bellatrix":
|
||||
jsonBellatrixBlock := apimiddleware.SignedBeaconBlockBellatrixJson{}
|
||||
jsonBellatrixBlock := shared.SignedBeaconBlockBellatrix{}
|
||||
if err := decoder.Decode(&jsonBellatrixBlock); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to decode signed bellatrix block response json")
|
||||
}
|
||||
@@ -164,7 +163,7 @@ func (c beaconApiValidatorClient) getHeadSignedBeaconBlock(ctx context.Context)
|
||||
slot = bellatrixBlock.Slot
|
||||
|
||||
case "capella":
|
||||
jsonCapellaBlock := apimiddleware.SignedBeaconBlockCapellaJson{}
|
||||
jsonCapellaBlock := shared.SignedBeaconBlockCapella{}
|
||||
if err := decoder.Decode(&jsonCapellaBlock); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to decode signed capella block response json")
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared/testing"
|
||||
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -48,12 +47,12 @@ func TestStreamBlocks_UnsupportedConsensusVersion(t *testing.T) {
|
||||
func TestStreamBlocks_Error(t *testing.T) {
|
||||
testSuites := []struct {
|
||||
consensusVersion string
|
||||
generateBeaconBlockConverter func(ctrl *gomock.Controller, conversionError error) *mock.MockbeaconBlockConverter
|
||||
generateBeaconBlockConverter func(ctrl *gomock.Controller, conversionError error) *mock.MockBeaconBlockConverter
|
||||
}{
|
||||
{
|
||||
consensusVersion: "phase0",
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockbeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockBeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter.EXPECT().ConvertRESTPhase0BlockToProto(
|
||||
gomock.Any(),
|
||||
).Return(
|
||||
@@ -66,8 +65,8 @@ func TestStreamBlocks_Error(t *testing.T) {
|
||||
},
|
||||
{
|
||||
consensusVersion: "altair",
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockbeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockBeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter.EXPECT().ConvertRESTAltairBlockToProto(
|
||||
gomock.Any(),
|
||||
).Return(
|
||||
@@ -80,8 +79,8 @@ func TestStreamBlocks_Error(t *testing.T) {
|
||||
},
|
||||
{
|
||||
consensusVersion: "bellatrix",
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockbeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockBeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter.EXPECT().ConvertRESTBellatrixBlockToProto(
|
||||
gomock.Any(),
|
||||
).Return(
|
||||
@@ -94,8 +93,8 @@ func TestStreamBlocks_Error(t *testing.T) {
|
||||
},
|
||||
{
|
||||
consensusVersion: "capella",
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockbeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
generateBeaconBlockConverter: func(ctrl *gomock.Controller, conversionError error) *mock.MockBeaconBlockConverter {
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter.EXPECT().ConvertRESTCapellaBlockToProto(
|
||||
gomock.Any(),
|
||||
).Return(
|
||||
@@ -124,7 +123,7 @@ func TestStreamBlocks_Error(t *testing.T) {
|
||||
expectedErrorMessage: "failed to get signed %s block",
|
||||
conversionError: errors.New("foo"),
|
||||
generateData: func(consensusVersion string) []byte {
|
||||
blockBytes, err := json.Marshal(apimiddleware.SignedBeaconBlockJson{Signature: "0x01"})
|
||||
blockBytes, err := json.Marshal(shared.SignedBeaconBlock{Signature: "0x01"})
|
||||
require.NoError(t, err)
|
||||
return blockBytes
|
||||
},
|
||||
@@ -133,7 +132,7 @@ func TestStreamBlocks_Error(t *testing.T) {
|
||||
name: "signature decoding failed",
|
||||
expectedErrorMessage: "failed to decode %s block signature `foo`",
|
||||
generateData: func(consensusVersion string) []byte {
|
||||
blockBytes, err := json.Marshal(apimiddleware.SignedBeaconBlockJson{Signature: "foo"})
|
||||
blockBytes, err := json.Marshal(shared.SignedBeaconBlock{Signature: "foo"})
|
||||
require.NoError(t, err)
|
||||
return blockBytes
|
||||
},
|
||||
@@ -202,13 +201,13 @@ func TestStreamBlocks_Phase0Valid(t *testing.T) {
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
// For the second call, return the same block as the previous one. This block shouldn't be returned by the second Recv().
|
||||
phase0BeaconBlock1 := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
phase0BeaconBlock1.Slot = "1"
|
||||
signedBeaconBlockContainer1 := apimiddleware.SignedBeaconBlockJson{
|
||||
signedBeaconBlockContainer1 := shared.SignedBeaconBlock{
|
||||
Message: phase0BeaconBlock1,
|
||||
Signature: "0x01",
|
||||
}
|
||||
@@ -246,7 +245,7 @@ func TestStreamBlocks_Phase0Valid(t *testing.T) {
|
||||
// If verifiedOnly == false, this block will be returned by the second Recv(); otherwise, another block will be requested.
|
||||
phase0BeaconBlock2 := test_helpers.GenerateJsonPhase0BeaconBlock()
|
||||
phase0BeaconBlock2.Slot = "2"
|
||||
signedBeaconBlockContainer2 := apimiddleware.SignedBeaconBlockJson{
|
||||
signedBeaconBlockContainer2 := shared.SignedBeaconBlock{
|
||||
Message: phase0BeaconBlock2,
|
||||
Signature: "0x02",
|
||||
}
|
||||
@@ -366,13 +365,13 @@ func TestStreamBlocks_AltairValid(t *testing.T) {
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
// For the second call, return the same block as the previous one. This block shouldn't be returned by the second Recv().
|
||||
altairBeaconBlock1 := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
altairBeaconBlock1.Slot = "1"
|
||||
signedBeaconBlockContainer1 := apimiddleware.SignedBeaconBlockAltairJson{
|
||||
signedBeaconBlockContainer1 := shared.SignedBeaconBlockAltair{
|
||||
Message: altairBeaconBlock1,
|
||||
Signature: "0x01",
|
||||
}
|
||||
@@ -410,7 +409,7 @@ func TestStreamBlocks_AltairValid(t *testing.T) {
|
||||
// If verifiedOnly == false, this block will be returned by the second Recv(); otherwise, another block will be requested.
|
||||
altairBeaconBlock2 := test_helpers.GenerateJsonAltairBeaconBlock()
|
||||
altairBeaconBlock2.Slot = "2"
|
||||
signedBeaconBlockContainer2 := apimiddleware.SignedBeaconBlockAltairJson{
|
||||
signedBeaconBlockContainer2 := shared.SignedBeaconBlockAltair{
|
||||
Message: altairBeaconBlock2,
|
||||
Signature: "0x02",
|
||||
}
|
||||
@@ -530,13 +529,13 @@ func TestStreamBlocks_BellatrixValid(t *testing.T) {
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
// For the second call, return the same block as the previous one. This block shouldn't be returned by the second Recv().
|
||||
bellatrixBeaconBlock1 := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
bellatrixBeaconBlock1.Slot = "1"
|
||||
signedBeaconBlockContainer1 := apimiddleware.SignedBeaconBlockBellatrixJson{
|
||||
signedBeaconBlockContainer1 := shared.SignedBeaconBlockBellatrix{
|
||||
Message: bellatrixBeaconBlock1,
|
||||
Signature: "0x01",
|
||||
}
|
||||
@@ -574,7 +573,7 @@ func TestStreamBlocks_BellatrixValid(t *testing.T) {
|
||||
// If verifiedOnly == false, this block will be returned by the second Recv(); otherwise, another block will be requested.
|
||||
bellatrixBeaconBlock2 := test_helpers.GenerateJsonBellatrixBeaconBlock()
|
||||
bellatrixBeaconBlock2.Slot = "2"
|
||||
signedBeaconBlockContainer2 := apimiddleware.SignedBeaconBlockBellatrixJson{
|
||||
signedBeaconBlockContainer2 := shared.SignedBeaconBlockBellatrix{
|
||||
Message: bellatrixBeaconBlock2,
|
||||
Signature: "0x02",
|
||||
}
|
||||
@@ -694,13 +693,13 @@ func TestStreamBlocks_CapellaValid(t *testing.T) {
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
// For the second call, return the same block as the previous one. This block shouldn't be returned by the second Recv().
|
||||
capellaBeaconBlock1 := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
capellaBeaconBlock1.Slot = "1"
|
||||
signedBeaconBlockContainer1 := apimiddleware.SignedBeaconBlockCapellaJson{
|
||||
signedBeaconBlockContainer1 := shared.SignedBeaconBlockCapella{
|
||||
Message: capellaBeaconBlock1,
|
||||
Signature: "0x01",
|
||||
}
|
||||
@@ -738,7 +737,7 @@ func TestStreamBlocks_CapellaValid(t *testing.T) {
|
||||
// If verifiedOnly == false, this block will be returned by the second Recv(); otherwise, another block will be requested.
|
||||
capellaBeaconBlock2 := test_helpers.GenerateJsonCapellaBeaconBlock()
|
||||
capellaBeaconBlock2.Slot = "2"
|
||||
signedBeaconBlockContainer2 := apimiddleware.SignedBeaconBlockCapellaJson{
|
||||
signedBeaconBlockContainer2 := shared.SignedBeaconBlockCapella{
|
||||
Message: capellaBeaconBlock2,
|
||||
Signature: "0x02",
|
||||
}
|
||||
@@ -858,7 +857,7 @@ func TestStreamBlocks_DenebValid(t *testing.T) {
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockbeaconBlockConverter(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
// For the second call, return the same block as the previous one. This block shouldn't be returned by the second Recv().
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
@@ -84,13 +84,17 @@ func (c *beaconApiValidatorClient) submitAggregateSelectionProof(ctx context.Con
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *beaconApiValidatorClient) getAggregateAttestation(ctx context.Context, slot primitives.Slot, attestationDataRoot []byte) (*apimiddleware.AggregateAttestationResponseJson, error) {
|
||||
func (c *beaconApiValidatorClient) getAggregateAttestation(
|
||||
ctx context.Context,
|
||||
slot primitives.Slot,
|
||||
attestationDataRoot []byte,
|
||||
) (*validator.AggregateAttestationResponse, error) {
|
||||
params := url.Values{}
|
||||
params.Add("slot", strconv.FormatUint(uint64(slot), 10))
|
||||
params.Add("attestation_data_root", hexutil.Encode(attestationDataRoot))
|
||||
endpoint := buildURL("/eth/v1/validator/aggregate_attestation", params)
|
||||
|
||||
var aggregateAttestationResponse apimiddleware.AggregateAttestationResponseJson
|
||||
var aggregateAttestationResponse validator.AggregateAttestationResponse
|
||||
errJson, err := c.jsonRestHandler.Get(ctx, endpoint, &aggregateAttestationResponse)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, msgUnexpectedError)
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/node"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
@@ -242,10 +241,10 @@ func TestSubmitAggregateSelectionProof(t *testing.T) {
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
ctx,
|
||||
fmt.Sprintf("%s?attestation_data_root=%s&slot=%d", aggregateAttestationEndpoint, hexutil.Encode(attestationDataRootBytes[:]), slot),
|
||||
&apimiddleware.AggregateAttestationResponseJson{},
|
||||
&validator.AggregateAttestationResponse{},
|
||||
).SetArg(
|
||||
2,
|
||||
apimiddleware.AggregateAttestationResponseJson{
|
||||
validator.AggregateAttestationResponse{
|
||||
Data: jsonifyAttestation(aggregateAttestation),
|
||||
},
|
||||
).Return(
|
||||
|
||||
@@ -6,12 +6,12 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
func (c *beaconApiValidatorClient) submitSignedAggregateSelectionProof(ctx context.Context, in *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error) {
|
||||
body, err := json.Marshal([]*apimiddleware.SignedAggregateAttestationAndProofJson{jsonifySignedAggregateAndProof(in.SignedAggregateAndProof)})
|
||||
body, err := json.Marshal([]*shared.SignedAggregateAttestationAndProof{jsonifySignedAggregateAndProof(in.SignedAggregateAndProof)})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to marshal SignedAggregateAttestationAndProof")
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -21,7 +21,7 @@ func TestSubmitSignedAggregateSelectionProof_Valid(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
signedAggregateAndProof := generateSignedAggregateAndProofJson()
|
||||
marshalledSignedAggregateSignedAndProof, err := json.Marshal([]*apimiddleware.SignedAggregateAttestationAndProofJson{jsonifySignedAggregateAndProof(signedAggregateAndProof)})
|
||||
marshalledSignedAggregateSignedAndProof, err := json.Marshal([]*shared.SignedAggregateAttestationAndProof{jsonifySignedAggregateAndProof(signedAggregateAndProof)})
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
@@ -54,7 +54,7 @@ func TestSubmitSignedAggregateSelectionProof_BadRequest(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
signedAggregateAndProof := generateSignedAggregateAndProofJson()
|
||||
marshalledSignedAggregateSignedAndProof, err := json.Marshal([]*apimiddleware.SignedAggregateAttestationAndProofJson{jsonifySignedAggregateAndProof(signedAggregateAndProof)})
|
||||
marshalledSignedAggregateSignedAndProof, err := json.Marshal([]*shared.SignedAggregateAttestationAndProof{jsonifySignedAggregateAndProof(signedAggregateAndProof)})
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -25,11 +25,11 @@ func (c beaconApiValidatorClient) submitSignedContributionAndProof(ctx context.C
|
||||
return errors.New("signed contribution and proof contribution is nil")
|
||||
}
|
||||
|
||||
jsonContributionAndProofs := []apimiddleware.SignedContributionAndProofJson{
|
||||
jsonContributionAndProofs := []shared.SignedContributionAndProof{
|
||||
{
|
||||
Message: &apimiddleware.ContributionAndProofJson{
|
||||
Message: &shared.ContributionAndProof{
|
||||
AggregatorIndex: strconv.FormatUint(uint64(in.Message.AggregatorIndex), 10),
|
||||
Contribution: &apimiddleware.SyncCommitteeContributionJson{
|
||||
Contribution: &shared.SyncCommitteeContribution{
|
||||
Slot: strconv.FormatUint(uint64(in.Message.Contribution.Slot), 10),
|
||||
BeaconBlockRoot: hexutil.Encode(in.Message.Contribution.BlockRoot),
|
||||
SubcommitteeIndex: strconv.FormatUint(in.Message.Contribution.SubcommitteeIndex, 10),
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
@@ -22,11 +22,11 @@ func TestSubmitSignedContributionAndProof_Valid(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonContributionAndProofs := []apimiddleware.SignedContributionAndProofJson{
|
||||
jsonContributionAndProofs := []shared.SignedContributionAndProof{
|
||||
{
|
||||
Message: &apimiddleware.ContributionAndProofJson{
|
||||
Message: &shared.ContributionAndProof{
|
||||
AggregatorIndex: "1",
|
||||
Contribution: &apimiddleware.SyncCommitteeContributionJson{
|
||||
Contribution: &shared.SyncCommitteeContribution{
|
||||
Slot: "2",
|
||||
BeaconBlockRoot: hexutil.Encode([]byte{3}),
|
||||
SubcommitteeIndex: "4",
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
@@ -23,7 +23,7 @@ func (c beaconApiValidatorClient) subscribeCommitteeSubnets(ctx context.Context,
|
||||
}
|
||||
|
||||
slotToCommitteesAtSlotMap := make(map[primitives.Slot]uint64)
|
||||
jsonCommitteeSubscriptions := make([]*apimiddleware.BeaconCommitteeSubscribeJson, len(in.CommitteeIds))
|
||||
jsonCommitteeSubscriptions := make([]*shared.BeaconCommitteeSubscription, len(in.CommitteeIds))
|
||||
for index := range in.CommitteeIds {
|
||||
subscribeSlot := in.Slots[index]
|
||||
subscribeCommitteeId := in.CommitteeIds[index]
|
||||
@@ -59,7 +59,7 @@ func (c beaconApiValidatorClient) subscribeCommitteeSubnets(ctx context.Context,
|
||||
}
|
||||
}
|
||||
|
||||
jsonCommitteeSubscriptions[index] = &apimiddleware.BeaconCommitteeSubscribeJson{
|
||||
jsonCommitteeSubscriptions[index] = &shared.BeaconCommitteeSubscription{
|
||||
CommitteeIndex: strconv.FormatUint(uint64(subscribeCommitteeId), 10),
|
||||
CommitteesAtSlot: strconv.FormatUint(committeesAtSlot, 10),
|
||||
Slot: strconv.FormatUint(uint64(subscribeSlot), 10),
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -31,9 +31,9 @@ func TestSubscribeCommitteeSubnets_Valid(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonCommitteeSubscriptions := make([]*apimiddleware.BeaconCommitteeSubscribeJson, len(subscribeSlots))
|
||||
jsonCommitteeSubscriptions := make([]*shared.BeaconCommitteeSubscription, len(subscribeSlots))
|
||||
for index := range jsonCommitteeSubscriptions {
|
||||
jsonCommitteeSubscriptions[index] = &apimiddleware.BeaconCommitteeSubscribeJson{
|
||||
jsonCommitteeSubscriptions[index] = &shared.BeaconCommitteeSubscription{
|
||||
ValidatorIndex: strconv.FormatUint(uint64(validatorIndices[index]), 10),
|
||||
CommitteeIndex: strconv.FormatUint(uint64(committeeIndices[index]), 10),
|
||||
CommitteesAtSlot: strconv.FormatUint(committeesAtSlot[index], 10),
|
||||
|
||||
@@ -9,8 +9,9 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v4/time/slots"
|
||||
@@ -44,7 +45,7 @@ func (c *beaconApiValidatorClient) submitSyncMessage(ctx context.Context, syncMe
|
||||
|
||||
func (c *beaconApiValidatorClient) getSyncMessageBlockRoot(ctx context.Context) (*ethpb.SyncMessageBlockRootResponse, error) {
|
||||
// Get head beacon block root.
|
||||
var resp apimiddleware.BlockRootResponseJson
|
||||
var resp beacon.BlockRootResponse
|
||||
errJson, err := c.jsonRestHandler.Get(ctx, "/eth/v1/beacon/blocks/head/root", &resp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, msgUnexpectedError)
|
||||
@@ -95,7 +96,7 @@ func (c *beaconApiValidatorClient) getSyncCommitteeContribution(
|
||||
|
||||
url := buildURL("/eth/v1/validator/sync_committee_contribution", params)
|
||||
|
||||
var resp apimiddleware.ProduceSyncCommitteeContributionResponseJson
|
||||
var resp validator.ProduceSyncCommitteeContributionResponse
|
||||
errJson, err := c.jsonRestHandler.Get(ctx, url, &resp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, msgUnexpectedError)
|
||||
@@ -138,7 +139,7 @@ func (c *beaconApiValidatorClient) getSyncSubcommitteeIndex(ctx context.Context,
|
||||
return ðpb.SyncSubcommitteeIndexResponse{Indices: indices}, nil
|
||||
}
|
||||
|
||||
func convertSyncContributionJsonToProto(contribution *apimiddleware.SyncCommitteeContributionJson) (*ethpb.SyncCommitteeContribution, error) {
|
||||
func convertSyncContributionJsonToProto(contribution *shared.SyncCommitteeContribution) (*ethpb.SyncCommitteeContribution, error) {
|
||||
if contribution == nil {
|
||||
return nil, errors.New("sync committee contribution is nil")
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator"
|
||||
@@ -102,12 +101,12 @@ func TestGetSyncMessageBlockRoot(t *testing.T) {
|
||||
name string
|
||||
endpointError error
|
||||
expectedErrorMessage string
|
||||
expectedResponse apimiddleware.BlockRootResponseJson
|
||||
expectedResponse beacon.BlockRootResponse
|
||||
}{
|
||||
{
|
||||
name: "valid request",
|
||||
expectedResponse: apimiddleware.BlockRootResponseJson{
|
||||
Data: &apimiddleware.BlockRootContainerJson{
|
||||
expectedResponse: beacon.BlockRootResponse{
|
||||
Data: &beacon.BlockRoot{
|
||||
Root: blockRoot,
|
||||
},
|
||||
},
|
||||
@@ -119,20 +118,20 @@ func TestGetSyncMessageBlockRoot(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "execution optimistic",
|
||||
expectedResponse: apimiddleware.BlockRootResponseJson{
|
||||
expectedResponse: beacon.BlockRootResponse{
|
||||
ExecutionOptimistic: true,
|
||||
},
|
||||
expectedErrorMessage: "the node is currently optimistic and cannot serve validators",
|
||||
},
|
||||
{
|
||||
name: "no data",
|
||||
expectedResponse: apimiddleware.BlockRootResponseJson{},
|
||||
expectedResponse: beacon.BlockRootResponse{},
|
||||
expectedErrorMessage: "no data returned",
|
||||
},
|
||||
{
|
||||
name: "no root",
|
||||
expectedResponse: apimiddleware.BlockRootResponseJson{
|
||||
Data: new(apimiddleware.BlockRootContainerJson),
|
||||
expectedResponse: beacon.BlockRootResponse{
|
||||
Data: new(beacon.BlockRoot),
|
||||
},
|
||||
expectedErrorMessage: "no root returned",
|
||||
},
|
||||
@@ -145,7 +144,7 @@ func TestGetSyncMessageBlockRoot(t *testing.T) {
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
ctx,
|
||||
"/eth/v1/beacon/blocks/head/root",
|
||||
&apimiddleware.BlockRootResponseJson{},
|
||||
&beacon.BlockRootResponse{},
|
||||
).SetArg(
|
||||
2,
|
||||
test.expectedResponse,
|
||||
@@ -184,7 +183,7 @@ func TestGetSyncCommitteeContribution(t *testing.T) {
|
||||
SubnetId: 1,
|
||||
}
|
||||
|
||||
contributionJson := &apimiddleware.SyncCommitteeContributionJson{
|
||||
contributionJson := &shared.SyncCommitteeContribution{
|
||||
Slot: "1",
|
||||
BeaconBlockRoot: blockRoot,
|
||||
SubcommitteeIndex: "1",
|
||||
@@ -194,13 +193,13 @@ func TestGetSyncCommitteeContribution(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
contribution apimiddleware.ProduceSyncCommitteeContributionResponseJson
|
||||
contribution validator.ProduceSyncCommitteeContributionResponse
|
||||
endpointErr error
|
||||
expectedErrMsg string
|
||||
}{
|
||||
{
|
||||
name: "valid request",
|
||||
contribution: apimiddleware.ProduceSyncCommitteeContributionResponseJson{Data: contributionJson},
|
||||
contribution: validator.ProduceSyncCommitteeContributionResponse{Data: contributionJson},
|
||||
},
|
||||
{
|
||||
name: "bad request",
|
||||
@@ -216,11 +215,11 @@ func TestGetSyncCommitteeContribution(t *testing.T) {
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
ctx,
|
||||
"/eth/v1/beacon/blocks/head/root",
|
||||
&apimiddleware.BlockRootResponseJson{},
|
||||
&beacon.BlockRootResponse{},
|
||||
).SetArg(
|
||||
2,
|
||||
apimiddleware.BlockRootResponseJson{
|
||||
Data: &apimiddleware.BlockRootContainerJson{
|
||||
beacon.BlockRootResponse{
|
||||
Data: &beacon.BlockRoot{
|
||||
Root: blockRoot,
|
||||
},
|
||||
},
|
||||
@@ -233,7 +232,7 @@ func TestGetSyncCommitteeContribution(t *testing.T) {
|
||||
ctx,
|
||||
fmt.Sprintf("/eth/v1/validator/sync_committee_contribution?beacon_block_root=%s&slot=%d&subcommittee_index=%d",
|
||||
blockRoot, uint64(request.Slot), request.SubnetId),
|
||||
&apimiddleware.ProduceSyncCommitteeContributionResponseJson{},
|
||||
&validator.ProduceSyncCommitteeContributionResponse{},
|
||||
).SetArg(
|
||||
2,
|
||||
test.contribution,
|
||||
|
||||
@@ -14,7 +14,6 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api/test-helpers",
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/rpc/apimiddleware:go_default_library",
|
||||
"//beacon-chain/rpc/eth/shared:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package test_helpers
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -219,24 +219,24 @@ func GenerateProtoAltairBeaconBlock() *ethpb.BeaconBlockAltair {
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
return &apimiddleware.BeaconBlockAltairJson{
|
||||
func GenerateJsonAltairBeaconBlock() *shared.BeaconBlockAltair {
|
||||
return &shared.BeaconBlockAltair{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: FillEncodedByteSlice(32, 3),
|
||||
StateRoot: FillEncodedByteSlice(32, 4),
|
||||
Body: &apimiddleware.BeaconBlockBodyAltairJson{
|
||||
Body: &shared.BeaconBlockBodyAltair{
|
||||
RandaoReveal: FillEncodedByteSlice(96, 5),
|
||||
Eth1Data: &apimiddleware.Eth1DataJson{
|
||||
Eth1Data: &shared.Eth1Data{
|
||||
DepositRoot: FillEncodedByteSlice(32, 6),
|
||||
DepositCount: "7",
|
||||
BlockHash: FillEncodedByteSlice(32, 8),
|
||||
},
|
||||
Graffiti: FillEncodedByteSlice(32, 9),
|
||||
ProposerSlashings: []*apimiddleware.ProposerSlashingJson{
|
||||
ProposerSlashings: []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "10",
|
||||
ProposerIndex: "11",
|
||||
ParentRoot: FillEncodedByteSlice(32, 12),
|
||||
@@ -245,8 +245,8 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 15),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "16",
|
||||
ProposerIndex: "17",
|
||||
ParentRoot: FillEncodedByteSlice(32, 18),
|
||||
@@ -257,8 +257,8 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "22",
|
||||
ProposerIndex: "23",
|
||||
ParentRoot: FillEncodedByteSlice(32, 24),
|
||||
@@ -267,8 +267,8 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 27),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "28",
|
||||
ProposerIndex: "29",
|
||||
ParentRoot: FillEncodedByteSlice(32, 30),
|
||||
@@ -279,36 +279,36 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
AttesterSlashings: []*apimiddleware.AttesterSlashingJson{
|
||||
AttesterSlashings: []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"34", "35"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "36",
|
||||
CommitteeIndex: "37",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "39",
|
||||
Root: FillEncodedByteSlice(32, 40),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "41",
|
||||
Root: FillEncodedByteSlice(32, 42),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 43),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"44", "45"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "46",
|
||||
CommitteeIndex: "47",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "49",
|
||||
Root: FillEncodedByteSlice(32, 50),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "51",
|
||||
Root: FillEncodedByteSlice(32, 52),
|
||||
},
|
||||
@@ -317,34 +317,34 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"54", "55"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "56",
|
||||
CommitteeIndex: "57",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "59",
|
||||
Root: FillEncodedByteSlice(32, 60),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "61",
|
||||
Root: FillEncodedByteSlice(32, 62),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 63),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"64", "65"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "66",
|
||||
CommitteeIndex: "67",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "69",
|
||||
Root: FillEncodedByteSlice(32, 70),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "71",
|
||||
Root: FillEncodedByteSlice(32, 72),
|
||||
},
|
||||
@@ -353,18 +353,18 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
Attestations: []*apimiddleware.AttestationJson{
|
||||
Attestations: []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 74),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "75",
|
||||
CommitteeIndex: "76",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "78",
|
||||
Root: FillEncodedByteSlice(32, 79),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "80",
|
||||
Root: FillEncodedByteSlice(32, 81),
|
||||
},
|
||||
@@ -373,15 +373,15 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 83),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "84",
|
||||
CommitteeIndex: "85",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "87",
|
||||
Root: FillEncodedByteSlice(32, 88),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "89",
|
||||
Root: FillEncodedByteSlice(32, 90),
|
||||
},
|
||||
@@ -389,11 +389,11 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
Signature: FillEncodedByteSlice(96, 91),
|
||||
},
|
||||
},
|
||||
Deposits: []*apimiddleware.DepositJson{
|
||||
Deposits: []*shared.Deposit{
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 92)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 94),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 94),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 95),
|
||||
Amount: "96",
|
||||
Signature: FillEncodedByteSlice(96, 97),
|
||||
@@ -401,31 +401,31 @@ func GenerateJsonAltairBeaconBlock() *apimiddleware.BeaconBlockAltairJson {
|
||||
},
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 98)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 100),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 100),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 101),
|
||||
Amount: "102",
|
||||
Signature: FillEncodedByteSlice(96, 103),
|
||||
},
|
||||
},
|
||||
},
|
||||
VoluntaryExits: []*apimiddleware.SignedVoluntaryExitJson{
|
||||
VoluntaryExits: []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "104",
|
||||
ValidatorIndex: "105",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 106),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "107",
|
||||
ValidatorIndex: "108",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 109),
|
||||
},
|
||||
},
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: FillEncodedByteSlice(64, 110),
|
||||
SyncCommitteeSignature: FillEncodedByteSlice(96, 111),
|
||||
},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package test_helpers
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
@@ -471,24 +470,24 @@ func GenerateProtoBlindedBellatrixBeaconBlock() *ethpb.BlindedBeaconBlockBellatr
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson {
|
||||
return &apimiddleware.BeaconBlockBellatrixJson{
|
||||
func GenerateJsonBellatrixBeaconBlock() *shared.BeaconBlockBellatrix {
|
||||
return &shared.BeaconBlockBellatrix{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: FillEncodedByteSlice(32, 3),
|
||||
StateRoot: FillEncodedByteSlice(32, 4),
|
||||
Body: &apimiddleware.BeaconBlockBodyBellatrixJson{
|
||||
Body: &shared.BeaconBlockBodyBellatrix{
|
||||
RandaoReveal: FillEncodedByteSlice(96, 5),
|
||||
Eth1Data: &apimiddleware.Eth1DataJson{
|
||||
Eth1Data: &shared.Eth1Data{
|
||||
DepositRoot: FillEncodedByteSlice(32, 6),
|
||||
DepositCount: "7",
|
||||
BlockHash: FillEncodedByteSlice(32, 8),
|
||||
},
|
||||
Graffiti: FillEncodedByteSlice(32, 9),
|
||||
ProposerSlashings: []*apimiddleware.ProposerSlashingJson{
|
||||
ProposerSlashings: []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "10",
|
||||
ProposerIndex: "11",
|
||||
ParentRoot: FillEncodedByteSlice(32, 12),
|
||||
@@ -497,8 +496,8 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 15),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "16",
|
||||
ProposerIndex: "17",
|
||||
ParentRoot: FillEncodedByteSlice(32, 18),
|
||||
@@ -509,8 +508,8 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "22",
|
||||
ProposerIndex: "23",
|
||||
ParentRoot: FillEncodedByteSlice(32, 24),
|
||||
@@ -519,8 +518,8 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 27),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "28",
|
||||
ProposerIndex: "29",
|
||||
ParentRoot: FillEncodedByteSlice(32, 30),
|
||||
@@ -531,36 +530,36 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
},
|
||||
},
|
||||
AttesterSlashings: []*apimiddleware.AttesterSlashingJson{
|
||||
AttesterSlashings: []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"34", "35"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "36",
|
||||
CommitteeIndex: "37",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "39",
|
||||
Root: FillEncodedByteSlice(32, 40),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "41",
|
||||
Root: FillEncodedByteSlice(32, 42),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 43),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"44", "45"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "46",
|
||||
CommitteeIndex: "47",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "49",
|
||||
Root: FillEncodedByteSlice(32, 50),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "51",
|
||||
Root: FillEncodedByteSlice(32, 52),
|
||||
},
|
||||
@@ -569,34 +568,34 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"54", "55"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "56",
|
||||
CommitteeIndex: "57",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "59",
|
||||
Root: FillEncodedByteSlice(32, 60),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "61",
|
||||
Root: FillEncodedByteSlice(32, 62),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 63),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"64", "65"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "66",
|
||||
CommitteeIndex: "67",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "69",
|
||||
Root: FillEncodedByteSlice(32, 70),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "71",
|
||||
Root: FillEncodedByteSlice(32, 72),
|
||||
},
|
||||
@@ -605,18 +604,18 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
},
|
||||
},
|
||||
Attestations: []*apimiddleware.AttestationJson{
|
||||
Attestations: []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 74),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "75",
|
||||
CommitteeIndex: "76",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "78",
|
||||
Root: FillEncodedByteSlice(32, 79),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "80",
|
||||
Root: FillEncodedByteSlice(32, 81),
|
||||
},
|
||||
@@ -625,15 +624,15 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 83),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "84",
|
||||
CommitteeIndex: "85",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "87",
|
||||
Root: FillEncodedByteSlice(32, 88),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "89",
|
||||
Root: FillEncodedByteSlice(32, 90),
|
||||
},
|
||||
@@ -641,11 +640,11 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
Signature: FillEncodedByteSlice(96, 91),
|
||||
},
|
||||
},
|
||||
Deposits: []*apimiddleware.DepositJson{
|
||||
Deposits: []*shared.Deposit{
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 92)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 94),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 94),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 95),
|
||||
Amount: "96",
|
||||
Signature: FillEncodedByteSlice(96, 97),
|
||||
@@ -653,35 +652,35 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
},
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 98)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 100),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 100),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 101),
|
||||
Amount: "102",
|
||||
Signature: FillEncodedByteSlice(96, 103),
|
||||
},
|
||||
},
|
||||
},
|
||||
VoluntaryExits: []*apimiddleware.SignedVoluntaryExitJson{
|
||||
VoluntaryExits: []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "104",
|
||||
ValidatorIndex: "105",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 106),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "107",
|
||||
ValidatorIndex: "108",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 109),
|
||||
},
|
||||
},
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: FillEncodedByteSlice(64, 110),
|
||||
SyncCommitteeSignature: FillEncodedByteSlice(96, 111),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadJson{
|
||||
ExecutionPayload: &shared.ExecutionPayload{
|
||||
ParentHash: FillEncodedByteSlice(32, 112),
|
||||
FeeRecipient: FillEncodedByteSlice(20, 113),
|
||||
StateRoot: FillEncodedByteSlice(32, 114),
|
||||
@@ -691,7 +690,7 @@ func GenerateJsonBellatrixBeaconBlock() *apimiddleware.BeaconBlockBellatrixJson
|
||||
BlockNumber: "118",
|
||||
GasLimit: "119",
|
||||
GasUsed: "120",
|
||||
TimeStamp: "121",
|
||||
Timestamp: "121",
|
||||
ExtraData: FillEncodedByteSlice(32, 122),
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(FillByteSlice(32, 123)).String(),
|
||||
BlockHash: FillEncodedByteSlice(32, 124),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package test_helpers
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
@@ -522,24 +521,24 @@ func GenerateProtoBlindedCapellaBeaconBlock() *ethpb.BlindedBeaconBlockCapella {
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
return &apimiddleware.BeaconBlockCapellaJson{
|
||||
func GenerateJsonCapellaBeaconBlock() *shared.BeaconBlockCapella {
|
||||
return &shared.BeaconBlockCapella{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: FillEncodedByteSlice(32, 3),
|
||||
StateRoot: FillEncodedByteSlice(32, 4),
|
||||
Body: &apimiddleware.BeaconBlockBodyCapellaJson{
|
||||
Body: &shared.BeaconBlockBodyCapella{
|
||||
RandaoReveal: FillEncodedByteSlice(96, 5),
|
||||
Eth1Data: &apimiddleware.Eth1DataJson{
|
||||
Eth1Data: &shared.Eth1Data{
|
||||
DepositRoot: FillEncodedByteSlice(32, 6),
|
||||
DepositCount: "7",
|
||||
BlockHash: FillEncodedByteSlice(32, 8),
|
||||
},
|
||||
Graffiti: FillEncodedByteSlice(32, 9),
|
||||
ProposerSlashings: []*apimiddleware.ProposerSlashingJson{
|
||||
ProposerSlashings: []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "10",
|
||||
ProposerIndex: "11",
|
||||
ParentRoot: FillEncodedByteSlice(32, 12),
|
||||
@@ -548,8 +547,8 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 15),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "16",
|
||||
ProposerIndex: "17",
|
||||
ParentRoot: FillEncodedByteSlice(32, 18),
|
||||
@@ -560,8 +559,8 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "22",
|
||||
ProposerIndex: "23",
|
||||
ParentRoot: FillEncodedByteSlice(32, 24),
|
||||
@@ -570,8 +569,8 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 27),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "28",
|
||||
ProposerIndex: "29",
|
||||
ParentRoot: FillEncodedByteSlice(32, 30),
|
||||
@@ -582,36 +581,36 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
AttesterSlashings: []*apimiddleware.AttesterSlashingJson{
|
||||
AttesterSlashings: []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"34", "35"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "36",
|
||||
CommitteeIndex: "37",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "39",
|
||||
Root: FillEncodedByteSlice(32, 40),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "41",
|
||||
Root: FillEncodedByteSlice(32, 42),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 43),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"44", "45"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "46",
|
||||
CommitteeIndex: "47",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "49",
|
||||
Root: FillEncodedByteSlice(32, 50),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "51",
|
||||
Root: FillEncodedByteSlice(32, 52),
|
||||
},
|
||||
@@ -620,34 +619,34 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"54", "55"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "56",
|
||||
CommitteeIndex: "57",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "59",
|
||||
Root: FillEncodedByteSlice(32, 60),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "61",
|
||||
Root: FillEncodedByteSlice(32, 62),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 63),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"64", "65"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "66",
|
||||
CommitteeIndex: "67",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "69",
|
||||
Root: FillEncodedByteSlice(32, 70),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "71",
|
||||
Root: FillEncodedByteSlice(32, 72),
|
||||
},
|
||||
@@ -656,18 +655,18 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
Attestations: []*apimiddleware.AttestationJson{
|
||||
Attestations: []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 74),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "75",
|
||||
CommitteeIndex: "76",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "78",
|
||||
Root: FillEncodedByteSlice(32, 79),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "80",
|
||||
Root: FillEncodedByteSlice(32, 81),
|
||||
},
|
||||
@@ -676,15 +675,15 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 83),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "84",
|
||||
CommitteeIndex: "85",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "87",
|
||||
Root: FillEncodedByteSlice(32, 88),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "89",
|
||||
Root: FillEncodedByteSlice(32, 90),
|
||||
},
|
||||
@@ -692,11 +691,11 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
Signature: FillEncodedByteSlice(96, 91),
|
||||
},
|
||||
},
|
||||
Deposits: []*apimiddleware.DepositJson{
|
||||
Deposits: []*shared.Deposit{
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 92)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 94),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 94),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 95),
|
||||
Amount: "96",
|
||||
Signature: FillEncodedByteSlice(96, 97),
|
||||
@@ -704,35 +703,35 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 98)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 100),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 100),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 101),
|
||||
Amount: "102",
|
||||
Signature: FillEncodedByteSlice(96, 103),
|
||||
},
|
||||
},
|
||||
},
|
||||
VoluntaryExits: []*apimiddleware.SignedVoluntaryExitJson{
|
||||
VoluntaryExits: []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "104",
|
||||
ValidatorIndex: "105",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 106),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "107",
|
||||
ValidatorIndex: "108",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 109),
|
||||
},
|
||||
},
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: FillEncodedByteSlice(64, 110),
|
||||
SyncCommitteeSignature: FillEncodedByteSlice(96, 111),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadCapellaJson{
|
||||
ExecutionPayload: &shared.ExecutionPayloadCapella{
|
||||
ParentHash: FillEncodedByteSlice(32, 112),
|
||||
FeeRecipient: FillEncodedByteSlice(20, 113),
|
||||
StateRoot: FillEncodedByteSlice(32, 114),
|
||||
@@ -742,7 +741,7 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
BlockNumber: "118",
|
||||
GasLimit: "119",
|
||||
GasUsed: "120",
|
||||
TimeStamp: "121",
|
||||
Timestamp: "121",
|
||||
ExtraData: FillEncodedByteSlice(32, 122),
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(FillByteSlice(32, 123)).String(),
|
||||
BlockHash: FillEncodedByteSlice(32, 124),
|
||||
@@ -750,7 +749,7 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
FillEncodedByteSlice(32, 125),
|
||||
FillEncodedByteSlice(32, 126),
|
||||
},
|
||||
Withdrawals: []*apimiddleware.WithdrawalJson{
|
||||
Withdrawals: []*shared.Withdrawal{
|
||||
{
|
||||
WithdrawalIndex: "127",
|
||||
ValidatorIndex: "128",
|
||||
@@ -765,9 +764,9 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
BLSToExecutionChanges: []*apimiddleware.SignedBLSToExecutionChangeJson{
|
||||
BlsToExecutionChanges: []*shared.SignedBLSToExecutionChange{
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "135",
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 136),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 137),
|
||||
@@ -775,7 +774,7 @@ func GenerateJsonCapellaBeaconBlock() *apimiddleware.BeaconBlockCapellaJson {
|
||||
Signature: FillEncodedByteSlice(96, 138),
|
||||
},
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "139",
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 140),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 141),
|
||||
@@ -1014,19 +1013,19 @@ func GenerateJsonBlindedCapellaBeaconBlock() *shared.BlindedBeaconBlockCapella {
|
||||
TransactionsRoot: FillEncodedByteSlice(32, 125),
|
||||
WithdrawalsRoot: FillEncodedByteSlice(32, 126),
|
||||
},
|
||||
BlsToExecutionChanges: []*shared.SignedBlsToExecutionChange{
|
||||
BlsToExecutionChanges: []*shared.SignedBLSToExecutionChange{
|
||||
{
|
||||
Message: &shared.BlsToExecutionChange{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "135",
|
||||
FromBlsPubkey: FillEncodedByteSlice(48, 136),
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 136),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 137),
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 138),
|
||||
},
|
||||
{
|
||||
Message: &shared.BlsToExecutionChange{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "139",
|
||||
FromBlsPubkey: FillEncodedByteSlice(48, 140),
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 140),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 141),
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 142),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package test_helpers
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
@@ -575,25 +575,25 @@ func GenerateProtoBlindedDenebBeaconBlock() *ethpb.BlindedBeaconBlockAndBlobsDen
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson {
|
||||
return &apimiddleware.BeaconBlockContentsDenebJson{
|
||||
Block: &apimiddleware.BeaconBlockDenebJson{
|
||||
func GenerateJsonDenebBeaconBlock() *shared.BeaconBlockContentsDeneb {
|
||||
return &shared.BeaconBlockContentsDeneb{
|
||||
Block: &shared.BeaconBlockDeneb{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: FillEncodedByteSlice(32, 3),
|
||||
StateRoot: FillEncodedByteSlice(32, 4),
|
||||
Body: &apimiddleware.BeaconBlockBodyDenebJson{
|
||||
Body: &shared.BeaconBlockBodyDeneb{
|
||||
RandaoReveal: FillEncodedByteSlice(96, 5),
|
||||
Eth1Data: &apimiddleware.Eth1DataJson{
|
||||
Eth1Data: &shared.Eth1Data{
|
||||
DepositRoot: FillEncodedByteSlice(32, 6),
|
||||
DepositCount: "7",
|
||||
BlockHash: FillEncodedByteSlice(32, 8),
|
||||
},
|
||||
Graffiti: FillEncodedByteSlice(32, 9),
|
||||
ProposerSlashings: []*apimiddleware.ProposerSlashingJson{
|
||||
ProposerSlashings: []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "10",
|
||||
ProposerIndex: "11",
|
||||
ParentRoot: FillEncodedByteSlice(32, 12),
|
||||
@@ -602,8 +602,8 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 15),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "16",
|
||||
ProposerIndex: "17",
|
||||
ParentRoot: FillEncodedByteSlice(32, 18),
|
||||
@@ -614,8 +614,8 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "22",
|
||||
ProposerIndex: "23",
|
||||
ParentRoot: FillEncodedByteSlice(32, 24),
|
||||
@@ -624,8 +624,8 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 27),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "28",
|
||||
ProposerIndex: "29",
|
||||
ParentRoot: FillEncodedByteSlice(32, 30),
|
||||
@@ -636,36 +636,36 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
},
|
||||
},
|
||||
AttesterSlashings: []*apimiddleware.AttesterSlashingJson{
|
||||
AttesterSlashings: []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"34", "35"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "36",
|
||||
CommitteeIndex: "37",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "39",
|
||||
Root: FillEncodedByteSlice(32, 40),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "41",
|
||||
Root: FillEncodedByteSlice(32, 42),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 43),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"44", "45"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "46",
|
||||
CommitteeIndex: "47",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "49",
|
||||
Root: FillEncodedByteSlice(32, 50),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "51",
|
||||
Root: FillEncodedByteSlice(32, 52),
|
||||
},
|
||||
@@ -674,34 +674,34 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"54", "55"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "56",
|
||||
CommitteeIndex: "57",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "59",
|
||||
Root: FillEncodedByteSlice(32, 60),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "61",
|
||||
Root: FillEncodedByteSlice(32, 62),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 63),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"64", "65"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "66",
|
||||
CommitteeIndex: "67",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "69",
|
||||
Root: FillEncodedByteSlice(32, 70),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "71",
|
||||
Root: FillEncodedByteSlice(32, 72),
|
||||
},
|
||||
@@ -710,18 +710,18 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
},
|
||||
},
|
||||
Attestations: []*apimiddleware.AttestationJson{
|
||||
Attestations: []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 74),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "75",
|
||||
CommitteeIndex: "76",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "78",
|
||||
Root: FillEncodedByteSlice(32, 79),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "80",
|
||||
Root: FillEncodedByteSlice(32, 81),
|
||||
},
|
||||
@@ -730,15 +730,15 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 83),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "84",
|
||||
CommitteeIndex: "85",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "87",
|
||||
Root: FillEncodedByteSlice(32, 88),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "89",
|
||||
Root: FillEncodedByteSlice(32, 90),
|
||||
},
|
||||
@@ -746,11 +746,11 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
Signature: FillEncodedByteSlice(96, 91),
|
||||
},
|
||||
},
|
||||
Deposits: []*apimiddleware.DepositJson{
|
||||
Deposits: []*shared.Deposit{
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 92)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 94),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 94),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 95),
|
||||
Amount: "96",
|
||||
Signature: FillEncodedByteSlice(96, 97),
|
||||
@@ -758,35 +758,35 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
},
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 98)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 100),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 100),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 101),
|
||||
Amount: "102",
|
||||
Signature: FillEncodedByteSlice(96, 103),
|
||||
},
|
||||
},
|
||||
},
|
||||
VoluntaryExits: []*apimiddleware.SignedVoluntaryExitJson{
|
||||
VoluntaryExits: []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "104",
|
||||
ValidatorIndex: "105",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 106),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "107",
|
||||
ValidatorIndex: "108",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 109),
|
||||
},
|
||||
},
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: FillEncodedByteSlice(64, 110),
|
||||
SyncCommitteeSignature: FillEncodedByteSlice(96, 111),
|
||||
},
|
||||
ExecutionPayload: &apimiddleware.ExecutionPayloadDenebJson{
|
||||
ExecutionPayload: &shared.ExecutionPayloadDeneb{
|
||||
ParentHash: FillEncodedByteSlice(32, 112),
|
||||
FeeRecipient: FillEncodedByteSlice(20, 113),
|
||||
StateRoot: FillEncodedByteSlice(32, 114),
|
||||
@@ -796,7 +796,7 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
BlockNumber: "118",
|
||||
GasLimit: "119",
|
||||
GasUsed: "120",
|
||||
TimeStamp: "121",
|
||||
Timestamp: "121",
|
||||
ExtraData: FillEncodedByteSlice(32, 122),
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(FillByteSlice(32, 123)).String(),
|
||||
BlockHash: FillEncodedByteSlice(32, 124),
|
||||
@@ -804,7 +804,7 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
FillEncodedByteSlice(32, 125),
|
||||
FillEncodedByteSlice(32, 126),
|
||||
},
|
||||
Withdrawals: []*apimiddleware.WithdrawalJson{
|
||||
Withdrawals: []*shared.Withdrawal{
|
||||
{
|
||||
WithdrawalIndex: "127",
|
||||
ValidatorIndex: "128",
|
||||
@@ -821,9 +821,9 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
BlobGasUsed: "135",
|
||||
ExcessBlobGas: "136",
|
||||
},
|
||||
BLSToExecutionChanges: []*apimiddleware.SignedBLSToExecutionChangeJson{
|
||||
BlsToExecutionChanges: []*shared.SignedBLSToExecutionChange{
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "137",
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 138),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 139),
|
||||
@@ -831,7 +831,7 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
Signature: FillEncodedByteSlice(96, 140),
|
||||
},
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "141",
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 142),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 143),
|
||||
@@ -842,7 +842,7 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
BlobKzgCommitments: []string{FillEncodedByteSlice(48, 145), FillEncodedByteSlice(48, 146)},
|
||||
},
|
||||
},
|
||||
BlobSidecars: []*apimiddleware.BlobSidecarJson{
|
||||
BlobSidecars: []*shared.BlobSidecar{
|
||||
{
|
||||
BlockRoot: FillEncodedByteSlice(32, 147),
|
||||
Index: "148",
|
||||
@@ -867,25 +867,25 @@ func GenerateJsonDenebBeaconBlock() *apimiddleware.BeaconBlockContentsDenebJson
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockContentsDenebJson {
|
||||
return &apimiddleware.BlindedBeaconBlockContentsDenebJson{
|
||||
BlindedBlock: &apimiddleware.BlindedBeaconBlockDenebJson{
|
||||
func GenerateJsonBlindedDenebBeaconBlock() *shared.BlindedBeaconBlockContentsDeneb {
|
||||
return &shared.BlindedBeaconBlockContentsDeneb{
|
||||
BlindedBlock: &shared.BlindedBeaconBlockDeneb{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: FillEncodedByteSlice(32, 3),
|
||||
StateRoot: FillEncodedByteSlice(32, 4),
|
||||
Body: &apimiddleware.BlindedBeaconBlockBodyDenebJson{
|
||||
Body: &shared.BlindedBeaconBlockBodyDeneb{
|
||||
RandaoReveal: FillEncodedByteSlice(96, 5),
|
||||
Eth1Data: &apimiddleware.Eth1DataJson{
|
||||
Eth1Data: &shared.Eth1Data{
|
||||
DepositRoot: FillEncodedByteSlice(32, 6),
|
||||
DepositCount: "7",
|
||||
BlockHash: FillEncodedByteSlice(32, 8),
|
||||
},
|
||||
Graffiti: FillEncodedByteSlice(32, 9),
|
||||
ProposerSlashings: []*apimiddleware.ProposerSlashingJson{
|
||||
ProposerSlashings: []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "10",
|
||||
ProposerIndex: "11",
|
||||
ParentRoot: FillEncodedByteSlice(32, 12),
|
||||
@@ -894,8 +894,8 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 15),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "16",
|
||||
ProposerIndex: "17",
|
||||
ParentRoot: FillEncodedByteSlice(32, 18),
|
||||
@@ -906,8 +906,8 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "22",
|
||||
ProposerIndex: "23",
|
||||
ParentRoot: FillEncodedByteSlice(32, 24),
|
||||
@@ -916,8 +916,8 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 27),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "28",
|
||||
ProposerIndex: "29",
|
||||
ParentRoot: FillEncodedByteSlice(32, 30),
|
||||
@@ -928,36 +928,36 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
},
|
||||
},
|
||||
AttesterSlashings: []*apimiddleware.AttesterSlashingJson{
|
||||
AttesterSlashings: []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"34", "35"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "36",
|
||||
CommitteeIndex: "37",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "39",
|
||||
Root: FillEncodedByteSlice(32, 40),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "41",
|
||||
Root: FillEncodedByteSlice(32, 42),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 43),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"44", "45"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "46",
|
||||
CommitteeIndex: "47",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "49",
|
||||
Root: FillEncodedByteSlice(32, 50),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "51",
|
||||
Root: FillEncodedByteSlice(32, 52),
|
||||
},
|
||||
@@ -966,34 +966,34 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"54", "55"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "56",
|
||||
CommitteeIndex: "57",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "59",
|
||||
Root: FillEncodedByteSlice(32, 60),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "61",
|
||||
Root: FillEncodedByteSlice(32, 62),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 63),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"64", "65"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "66",
|
||||
CommitteeIndex: "67",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "69",
|
||||
Root: FillEncodedByteSlice(32, 70),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "71",
|
||||
Root: FillEncodedByteSlice(32, 72),
|
||||
},
|
||||
@@ -1002,18 +1002,18 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
},
|
||||
},
|
||||
Attestations: []*apimiddleware.AttestationJson{
|
||||
Attestations: []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 74),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "75",
|
||||
CommitteeIndex: "76",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "78",
|
||||
Root: FillEncodedByteSlice(32, 79),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "80",
|
||||
Root: FillEncodedByteSlice(32, 81),
|
||||
},
|
||||
@@ -1022,15 +1022,15 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 83),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "84",
|
||||
CommitteeIndex: "85",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "87",
|
||||
Root: FillEncodedByteSlice(32, 88),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "89",
|
||||
Root: FillEncodedByteSlice(32, 90),
|
||||
},
|
||||
@@ -1038,11 +1038,11 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
Signature: FillEncodedByteSlice(96, 91),
|
||||
},
|
||||
},
|
||||
Deposits: []*apimiddleware.DepositJson{
|
||||
Deposits: []*shared.Deposit{
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 92)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 94),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 94),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 95),
|
||||
Amount: "96",
|
||||
Signature: FillEncodedByteSlice(96, 97),
|
||||
@@ -1050,35 +1050,35 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
},
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 98)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 100),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 100),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 101),
|
||||
Amount: "102",
|
||||
Signature: FillEncodedByteSlice(96, 103),
|
||||
},
|
||||
},
|
||||
},
|
||||
VoluntaryExits: []*apimiddleware.SignedVoluntaryExitJson{
|
||||
VoluntaryExits: []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "104",
|
||||
ValidatorIndex: "105",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 106),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "107",
|
||||
ValidatorIndex: "108",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 109),
|
||||
},
|
||||
},
|
||||
SyncAggregate: &apimiddleware.SyncAggregateJson{
|
||||
SyncAggregate: &shared.SyncAggregate{
|
||||
SyncCommitteeBits: FillEncodedByteSlice(64, 110),
|
||||
SyncCommitteeSignature: FillEncodedByteSlice(96, 111),
|
||||
},
|
||||
ExecutionPayloadHeader: &apimiddleware.ExecutionPayloadHeaderDenebJson{
|
||||
ExecutionPayloadHeader: &shared.ExecutionPayloadHeaderDeneb{
|
||||
ParentHash: FillEncodedByteSlice(32, 112),
|
||||
FeeRecipient: FillEncodedByteSlice(20, 113),
|
||||
StateRoot: FillEncodedByteSlice(32, 114),
|
||||
@@ -1088,7 +1088,7 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
BlockNumber: "118",
|
||||
GasLimit: "119",
|
||||
GasUsed: "120",
|
||||
TimeStamp: "121",
|
||||
Timestamp: "121",
|
||||
ExtraData: FillEncodedByteSlice(32, 122),
|
||||
BaseFeePerGas: bytesutil.LittleEndianBytesToBigInt(FillByteSlice(32, 123)).String(),
|
||||
BlockHash: FillEncodedByteSlice(32, 124),
|
||||
@@ -1097,9 +1097,9 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
BlobGasUsed: "127",
|
||||
ExcessBlobGas: "128",
|
||||
},
|
||||
BLSToExecutionChanges: []*apimiddleware.SignedBLSToExecutionChangeJson{
|
||||
BlsToExecutionChanges: []*shared.SignedBLSToExecutionChange{
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "129",
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 130),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 131),
|
||||
@@ -1107,7 +1107,7 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
Signature: FillEncodedByteSlice(96, 132),
|
||||
},
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "133",
|
||||
FromBLSPubkey: FillEncodedByteSlice(48, 134),
|
||||
ToExecutionAddress: FillEncodedByteSlice(20, 135),
|
||||
@@ -1118,7 +1118,7 @@ func GenerateJsonBlindedDenebBeaconBlock() *apimiddleware.BlindedBeaconBlockCont
|
||||
BlobKzgCommitments: []string{FillEncodedByteSlice(48, 137), FillEncodedByteSlice(48, 138)},
|
||||
},
|
||||
},
|
||||
BlindedBlobSidecars: []*apimiddleware.BlindedBlobSidecarJson{
|
||||
BlindedBlobSidecars: []*shared.BlindedBlobSidecar{
|
||||
{
|
||||
BlockRoot: FillEncodedByteSlice(32, 139),
|
||||
Index: "140",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package test_helpers
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -215,24 +215,24 @@ func GenerateProtoPhase0BeaconBlock() *ethpb.BeaconBlock {
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
return &apimiddleware.BeaconBlockJson{
|
||||
func GenerateJsonPhase0BeaconBlock() *shared.BeaconBlock {
|
||||
return &shared.BeaconBlock{
|
||||
Slot: "1",
|
||||
ProposerIndex: "2",
|
||||
ParentRoot: FillEncodedByteSlice(32, 3),
|
||||
StateRoot: FillEncodedByteSlice(32, 4),
|
||||
Body: &apimiddleware.BeaconBlockBodyJson{
|
||||
Body: &shared.BeaconBlockBody{
|
||||
RandaoReveal: FillEncodedByteSlice(96, 5),
|
||||
Eth1Data: &apimiddleware.Eth1DataJson{
|
||||
Eth1Data: &shared.Eth1Data{
|
||||
DepositRoot: FillEncodedByteSlice(32, 6),
|
||||
DepositCount: "7",
|
||||
BlockHash: FillEncodedByteSlice(32, 8),
|
||||
},
|
||||
Graffiti: FillEncodedByteSlice(32, 9),
|
||||
ProposerSlashings: []*apimiddleware.ProposerSlashingJson{
|
||||
ProposerSlashings: []*shared.ProposerSlashing{
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "10",
|
||||
ProposerIndex: "11",
|
||||
ParentRoot: FillEncodedByteSlice(32, 12),
|
||||
@@ -241,8 +241,8 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 15),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "16",
|
||||
ProposerIndex: "17",
|
||||
ParentRoot: FillEncodedByteSlice(32, 18),
|
||||
@@ -253,8 +253,8 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Header_1: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader1: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "22",
|
||||
ProposerIndex: "23",
|
||||
ParentRoot: FillEncodedByteSlice(32, 24),
|
||||
@@ -263,8 +263,8 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 27),
|
||||
},
|
||||
Header_2: &apimiddleware.SignedBeaconBlockHeaderJson{
|
||||
Header: &apimiddleware.BeaconBlockHeaderJson{
|
||||
SignedHeader2: &shared.SignedBeaconBlockHeader{
|
||||
Message: &shared.BeaconBlockHeader{
|
||||
Slot: "28",
|
||||
ProposerIndex: "29",
|
||||
ParentRoot: FillEncodedByteSlice(32, 30),
|
||||
@@ -275,36 +275,36 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
AttesterSlashings: []*apimiddleware.AttesterSlashingJson{
|
||||
AttesterSlashings: []*shared.AttesterSlashing{
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"34", "35"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "36",
|
||||
CommitteeIndex: "37",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "39",
|
||||
Root: FillEncodedByteSlice(32, 40),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "41",
|
||||
Root: FillEncodedByteSlice(32, 42),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 43),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"44", "45"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "46",
|
||||
CommitteeIndex: "47",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 48),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "49",
|
||||
Root: FillEncodedByteSlice(32, 50),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "51",
|
||||
Root: FillEncodedByteSlice(32, 52),
|
||||
},
|
||||
@@ -313,34 +313,34 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
},
|
||||
{
|
||||
Attestation_1: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation1: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"54", "55"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "56",
|
||||
CommitteeIndex: "57",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 58),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "59",
|
||||
Root: FillEncodedByteSlice(32, 60),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "61",
|
||||
Root: FillEncodedByteSlice(32, 62),
|
||||
},
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 63),
|
||||
},
|
||||
Attestation_2: &apimiddleware.IndexedAttestationJson{
|
||||
Attestation2: &shared.IndexedAttestation{
|
||||
AttestingIndices: []string{"64", "65"},
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "66",
|
||||
CommitteeIndex: "67",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 68),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "69",
|
||||
Root: FillEncodedByteSlice(32, 70),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "71",
|
||||
Root: FillEncodedByteSlice(32, 72),
|
||||
},
|
||||
@@ -349,18 +349,18 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
},
|
||||
},
|
||||
Attestations: []*apimiddleware.AttestationJson{
|
||||
Attestations: []*shared.Attestation{
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(32, 74),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "75",
|
||||
CommitteeIndex: "76",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 77),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "78",
|
||||
Root: FillEncodedByteSlice(32, 79),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "80",
|
||||
Root: FillEncodedByteSlice(32, 81),
|
||||
},
|
||||
@@ -369,15 +369,15 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
{
|
||||
AggregationBits: FillEncodedByteSlice(4, 83),
|
||||
Data: &apimiddleware.AttestationDataJson{
|
||||
Data: &shared.AttestationData{
|
||||
Slot: "84",
|
||||
CommitteeIndex: "85",
|
||||
BeaconBlockRoot: FillEncodedByteSlice(32, 38),
|
||||
Source: &apimiddleware.CheckpointJson{
|
||||
Source: &shared.Checkpoint{
|
||||
Epoch: "87",
|
||||
Root: FillEncodedByteSlice(32, 88),
|
||||
},
|
||||
Target: &apimiddleware.CheckpointJson{
|
||||
Target: &shared.Checkpoint{
|
||||
Epoch: "89",
|
||||
Root: FillEncodedByteSlice(32, 90),
|
||||
},
|
||||
@@ -385,11 +385,11 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
Signature: FillEncodedByteSlice(96, 91),
|
||||
},
|
||||
},
|
||||
Deposits: []*apimiddleware.DepositJson{
|
||||
Deposits: []*shared.Deposit{
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 92)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 94),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 94),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 95),
|
||||
Amount: "96",
|
||||
Signature: FillEncodedByteSlice(96, 97),
|
||||
@@ -397,24 +397,24 @@ func GenerateJsonPhase0BeaconBlock() *apimiddleware.BeaconBlockJson {
|
||||
},
|
||||
{
|
||||
Proof: FillEncodedByteArraySlice(33, FillEncodedByteSlice(32, 98)),
|
||||
Data: &apimiddleware.Deposit_DataJson{
|
||||
PublicKey: FillEncodedByteSlice(48, 100),
|
||||
Data: &shared.DepositData{
|
||||
Pubkey: FillEncodedByteSlice(48, 100),
|
||||
WithdrawalCredentials: FillEncodedByteSlice(32, 101),
|
||||
Amount: "102",
|
||||
Signature: FillEncodedByteSlice(96, 103),
|
||||
},
|
||||
},
|
||||
},
|
||||
VoluntaryExits: []*apimiddleware.SignedVoluntaryExitJson{
|
||||
VoluntaryExits: []*shared.SignedVoluntaryExit{
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "104",
|
||||
ValidatorIndex: "105",
|
||||
},
|
||||
Signature: FillEncodedByteSlice(96, 106),
|
||||
},
|
||||
{
|
||||
Exit: &apimiddleware.VoluntaryExitJson{
|
||||
Message: &shared.VoluntaryExit{
|
||||
Epoch: "107",
|
||||
ValidatorIndex: "108",
|
||||
},
|
||||
|
||||
@@ -40,7 +40,6 @@ go_library(
|
||||
],
|
||||
deps = [
|
||||
"//api/gateway:go_default_library",
|
||||
"//api/gateway/apimiddleware:go_default_library",
|
||||
"//api/server:go_default_library",
|
||||
"//async/event:go_default_library",
|
||||
"//cmd:go_default_library",
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
fastssz "github.com/prysmaticlabs/fastssz"
|
||||
"github.com/prysmaticlabs/prysm/v4/api/gateway"
|
||||
"github.com/prysmaticlabs/prysm/v4/api/gateway/apimiddleware"
|
||||
"github.com/prysmaticlabs/prysm/v4/api/server"
|
||||
"github.com/prysmaticlabs/prysm/v4/async/event"
|
||||
"github.com/prysmaticlabs/prysm/v4/cmd"
|
||||
@@ -814,7 +813,7 @@ func (c *ValidatorClient) registerRPCGatewayService(router *mux.Router) error {
|
||||
gwruntime.WithForwardResponseOption(gateway.HttpResponseModifier),
|
||||
)
|
||||
|
||||
muxHandler := func(_ *apimiddleware.ApiProxyMiddleware, h http.HandlerFunc, w http.ResponseWriter, req *http.Request) {
|
||||
muxHandler := func(h http.HandlerFunc, w http.ResponseWriter, req *http.Request) {
|
||||
// The validator gateway handler requires this special logic as it serves the web APIs and the web UI.
|
||||
if strings.HasPrefix(req.URL.Path, "/api") {
|
||||
req.URL.Path = strings.Replace(req.URL.Path, "/api", "", 1)
|
||||
|
||||
Reference in New Issue
Block a user