mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
HTTP API: /eth/v1/beacon/pool/bls_to_execution_changes (#12963)
* wip * wip changes for beacon handlers * wip * updating protos * fixing conflict * fixing protos * fixing more tests * migrating tests and removing one that is irrelevant * fixing e2e * fixing unit tests * missed adding routes * gaz * fixing more tests * Update beacon-chain/rpc/eth/beacon/handlers_pool.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update beacon-chain/rpc/eth/shared/structs.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update beacon-chain/rpc/eth/shared/structs.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update beacon-chain/rpc/eth/shared/structs.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update beacon-chain/rpc/eth/shared/structs.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * radek's comments * fixing protos after conflict * accidently removed a proto type --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -18,6 +18,7 @@ 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))
|
||||
for index, signedBlsToExecutionChange := range blsToExecutionChanges {
|
||||
|
||||
@@ -5,9 +5,11 @@ import (
|
||||
|
||||
"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"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
|
||||
func TestBeaconBlockJsonHelpers_JsonifyTransactions(t *testing.T) {
|
||||
@@ -44,9 +46,9 @@ func TestBeaconBlockJsonHelpers_JsonifyBlsToExecutionChanges(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
expectedResult := []*apimiddleware.SignedBLSToExecutionChangeJson{
|
||||
expectedResult := []*shared.SignedBLSToExecutionChange{
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "1",
|
||||
FromBLSPubkey: hexutil.Encode([]byte{2}),
|
||||
ToExecutionAddress: hexutil.Encode([]byte{3}),
|
||||
@@ -54,7 +56,7 @@ func TestBeaconBlockJsonHelpers_JsonifyBlsToExecutionChanges(t *testing.T) {
|
||||
Signature: hexutil.Encode([]byte{7}),
|
||||
},
|
||||
{
|
||||
Message: &apimiddleware.BLSToExecutionChangeJson{
|
||||
Message: &shared.BLSToExecutionChange{
|
||||
ValidatorIndex: "4",
|
||||
FromBLSPubkey: hexutil.Encode([]byte{5}),
|
||||
ToExecutionAddress: hexutil.Encode([]byte{6}),
|
||||
@@ -63,7 +65,8 @@ func TestBeaconBlockJsonHelpers_JsonifyBlsToExecutionChanges(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
result := jsonifyBlsToExecutionChanges(input)
|
||||
result, err := shared.SignedBlsToExecutionChangesFromConsensus(input)
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, expectedResult, result)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user