From c47923d20e5b81dfab4ae53d191ac3b211592d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Wed, 15 Sep 2021 19:23:13 +0200 Subject: [PATCH] Properly display sync committees in `GetStateV2` (#9599) Co-authored-by: Raul Jordan --- beacon-chain/rpc/apimiddleware/structs.go | 8 ++++---- shared/gateway/api_middleware_processing.go | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/beacon-chain/rpc/apimiddleware/structs.go b/beacon-chain/rpc/apimiddleware/structs.go index e3d9ee2f7..80f37dba6 100644 --- a/beacon-chain/rpc/apimiddleware/structs.go +++ b/beacon-chain/rpc/apimiddleware/structs.go @@ -527,8 +527,8 @@ type beaconStateV2Json struct { CurrentJustifiedCheckpoint *checkpointJson `json:"current_justified_checkpoint"` FinalizedCheckpoint *checkpointJson `json:"finalized_checkpoint"` InactivityScores []string `json:"inactivity_scores"` - CurrentSyncCommittee syncCommitteeJson `json:"current_sync_committee"` - NextSyncCommittee syncCommitteeJson `json:"next_sync_committee"` + CurrentSyncCommittee *syncCommitteeJson `json:"current_sync_committee"` + NextSyncCommittee *syncCommitteeJson `json:"next_sync_committee"` } type beaconStateContainerV2Json struct { @@ -572,8 +572,8 @@ type committeeJson struct { } type syncCommitteeJson struct { - Pubkeys []string `json:"pubkeys" hex:"true"` - PubkeyAggregates string `json:"pubkey_aggregates" hex:"true"` + Pubkeys []string `json:"pubkeys" hex:"true"` + AggregatePubkey string `json:"aggregate_pubkey" hex:"true"` } type syncCommitteeValidatorsJson struct { diff --git a/shared/gateway/api_middleware_processing.go b/shared/gateway/api_middleware_processing.go index 3117f28eb..f05148b21 100644 --- a/shared/gateway/api_middleware_processing.go +++ b/shared/gateway/api_middleware_processing.go @@ -294,6 +294,9 @@ func hexToBase64Processor(v reflect.Value) error { } func base64ToHexProcessor(v reflect.Value) error { + if v.String() == "" { + return nil + } b, err := base64.StdEncoding.DecodeString(v.String()) if err != nil { return err