Skip to content
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

Merged
merged 25 commits into from
May 1, 2020
Merged

Conversation

rauljordan
Copy link
Contributor

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

@rauljordan rauljordan requested a review from a team as a code owner April 28, 2020 20:55
@terencechain
Copy link
Member

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 --enable-new-state-mgmt

@rauljordan
Copy link
Contributor Author

Cool I'll add a note about that

Copy link
Member

@prestonvanloon prestonvanloon left a 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?

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unimplemented, still in progress

req *pbrpc.BeaconStateRequest,
) (*pbp2p.BeaconState, error) {

//currentSlot := bs.GenesisTimeFetcher.CurrentSlot()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@rauljordan rauljordan marked this pull request as draft April 28, 2020 21:35
@rauljordan rauljordan marked this pull request as ready for review April 28, 2020 22:12
@rauljordan rauljordan self-assigned this Apr 28, 2020
@rauljordan rauljordan added the Ready For Review A pull request ready for code review label Apr 28, 2020
@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #5668 into master will increase coverage by 15.42%.
The diff coverage is n/a.

@@             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     

@@ -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",
Copy link
Member

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

prestonvanloon
prestonvanloon previously approved these changes Apr 29, 2020
@@ -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)
Copy link
Contributor

@shayzluf shayzluf Apr 29, 2020

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

@@ -568,6 +569,7 @@ func (b *BeaconNode) registerRPCService() error {
SlasherCert: slasherCert,
SlasherProvider: slasherProvider,
StateGen: b.stateGen,
EnableDebugRPCEndpoints: enableDebugRPCEndpoints,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@prylabs-bulldozer prylabs-bulldozer bot merged commit 2e33595 into master May 1, 2020
@delete-merged-branch delete-merged-branch bot deleted the implement-debug-state branch May 1, 2020 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants