-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement GetBeaconState Endpoint #5668
Conversation
A quick note on this, a prysm node by default does not keep beacon state from genesis slot to last finalized slot. If user wants to query historical state older than last finalized slot, please use flag |
Cool I'll add a note about that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am i missing something?
beacon-chain/rpc/beacon/state.go
Outdated
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" | ||
pbrpc "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1" | ||
//"google.golang.org/grpc/codes" | ||
//"google.golang.org/grpc/status" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unimplemented, still in progress
beacon-chain/rpc/beacon/state.go
Outdated
req *pbrpc.BeaconStateRequest, | ||
) (*pbp2p.BeaconState, error) { | ||
|
||
//currentSlot := bs.GenesisTimeFetcher.CurrentSlot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
Codecov Report
@@ Coverage Diff @@
## master #5668 +/- ##
===========================================
+ Coverage 26.44% 41.86% +15.42%
===========================================
Files 239 272 +33
Lines 20892 23273 +2381
===========================================
+ Hits 5524 9744 +4220
+ Misses 14293 11762 -2531
- Partials 1075 1767 +692 |
shared/featureconfig/flags.go
Outdated
@@ -150,6 +150,10 @@ var ( | |||
Name: "wait-for-synced", | |||
Usage: "Uses WaitForSynced for validator startup, to ensure a validator is able to communicate with the beacon node as quick as possible", | |||
} | |||
enableDebugRPCEndpoints = &cli.BoolFlag{ | |||
Name: "enable-debug-rpc-endpoints", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a feature flag appropriate or should you make this a regular flag?
Feature flags are temporary while you work on the feature
beacon-chain/node/node.go
Outdated
@@ -536,6 +536,7 @@ func (b *BeaconNode) registerRPCService() error { | |||
slasherCert := b.cliCtx.String(flags.SlasherCertFlag.Name) | |||
slasherProvider := b.cliCtx.String(flags.SlasherProviderFlag.Name) | |||
mockEth1DataVotes := b.cliCtx.Bool(flags.InteropMockEth1DataVotesFlag.Name) | |||
enableDebugRPCEndpoints := ctx.Bool(flags.EnableDebugRPCEndpoints.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something went wrong with the indent here
beacon-chain/node/node.go
Outdated
@@ -568,6 +569,7 @@ func (b *BeaconNode) registerRPCService() error { | |||
SlasherCert: slasherCert, | |||
SlasherProvider: slasherProvider, | |||
StateGen: b.stateGen, | |||
EnableDebugRPCEndpoints: enableDebugRPCEndpoints, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
beacon-chain/node/node.go
Outdated
@@ -608,13 +610,15 @@ func (b *BeaconNode) registerGRPCGateway() error { | |||
selfAddress := fmt.Sprintf("127.0.0.1:%d", b.cliCtx.Int(flags.RPCPort.Name)) | |||
gatewayAddress := fmt.Sprintf("0.0.0.0:%d", gatewayPort) | |||
allowedOrigins := strings.Split(b.cliCtx.String(flags.GPRCGatewayCorsDomain.Name), ",") | |||
enableDebugRPCEndpoints := b.cliCtx.Bool(flags.EnableDebugRPCEndpoints.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
What type of PR is this?
Feature
What does this PR do? Why is it needed?
Follow-up on #5666, this PR implements the
GetBeaconState
/v1/beacon/state
endpoint into Prysm gated behind the feature flag--enable-debug-rpc
, useful for interop testing.CC @protolambda