Last active
May 15, 2020 08:49
-
-
Save guybrush/71d0e043dedc8e64ab158bad36863a9b to your computer and use it in GitHub Desktop.
prysm node runs with `--enable-new-state-mgmt`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodeVersion : Prysm/Git commit: 34c02ffd346462f387f3d99eab798cf81f845c8e. Built at: 2020-05-14 03:26:24+00:00 | |
headEpoch : 6156 | |
finalizedEpoch: 6154 | |
justifiedEpoch: 6155 | |
panic: rpc error: code = Internal desc = Could not paginate results: page start 28500 >= list 28500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"eth2-exporter/utils" | |
"flag" | |
"fmt" | |
ptypes "github.com/gogo/protobuf/types" | |
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" | |
"google.golang.org/grpc" | |
) | |
func main() { | |
addrFlag := flag.String("addr", ":4000", "address of beacon-node to connect to") | |
epochFlag := flag.Uint64("epoch", 0, "epoch to query") | |
flag.Parse() | |
dialOpt := grpc.WithInsecure() | |
conn, err := grpc.Dial(*addrFlag, dialOpt) | |
if err != nil { | |
panic(err) | |
} | |
nodeClient := ethpb.NewNodeClient(conn) | |
version, err := nodeClient.GetVersion(context.Background(), &ptypes.Empty{}) | |
if err != nil { | |
panic(err) | |
} | |
chainClient := ethpb.NewBeaconChainClient(conn) | |
chainHead, err := chainClient.GetChainHead(context.Background(), &ptypes.Empty{}) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf("nodeVersion : %v\n", version.Version) | |
fmt.Printf("headEpoch : %v\n", chainHead.HeadEpoch) | |
fmt.Printf("finalizedEpoch: %v\n", chainHead.FinalizedEpoch) | |
fmt.Printf("justifiedEpoch: %v\n", chainHead.JustifiedEpoch) | |
epoch := *epochFlag | |
validatorsResponse := ðpb.Validators{} | |
validatorsRequest := ðpb.ListValidatorsRequest{PageSize: utils.PageSize, PageToken: validatorsResponse.NextPageToken, QueryFilter: ðpb.ListValidatorsRequest_Epoch{Epoch: epoch}} | |
if epoch == 0 { | |
validatorsRequest.QueryFilter = ðpb.ListValidatorsRequest_Genesis{Genesis: true} | |
} | |
for { | |
validatorsRequest.PageToken = validatorsResponse.NextPageToken | |
validatorsResponse, err = chainClient.ListValidators(context.Background(), validatorsRequest) | |
if err != nil { | |
panic(err) | |
} | |
if validatorsResponse.TotalSize == 0 { | |
break | |
} | |
if false { | |
for _, validator := range validatorsResponse.ValidatorList { | |
fmt.Println(validator.Index, validator.Validator.PublicKey) | |
} | |
} | |
if validatorsResponse.NextPageToken == "" { | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment