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

Prysm rpc: Get local header #14378

Closed
wants to merge 0 commits into from
Closed

Prysm rpc: Get local header #14378

wants to merge 0 commits into from

Conversation

terencechain
Copy link
Member

This PR adds a Prysm RPC endpoint to retrieve the local header for the proposer to sign. The getLocalHeader call uses the existing getLocalPayloadFromEngine method and the input slot and proposer index to obtain the payload from the execution client.

This PR does not include caching the payload, we should implement caching once the end-to-end process is more defined, so we have a clearer understanding of what the cache's API will look like.

@terencechain terencechain added the ePBS EIP-7732 label Aug 23, 2024
@terencechain terencechain requested a review from a team as a code owner August 23, 2024 15:28
@terencechain terencechain requested review from kasey, nalepae and nisdas and removed request for a team August 23, 2024 15:28
@terencechain terencechain force-pushed the get-local-header branch 3 times, most recently from 1da49d3 to 2df5f30 Compare August 23, 2024 17:12
Copy link

@jihoonsong jihoonsong left a comment

Choose a reason for hiding this comment

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

"Happy path" unit test fails for me. Not sure if it's just me but I attached some solutions.

})
t.Run("Happy case", func(t *testing.T) {
params.SetupTestConfigCleanup(t)
cfg := params.BeaconConfig().Copy()
Copy link

@jihoonsong jihoonsong Aug 26, 2024

Choose a reason for hiding this comment

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

This uses minimal config, producing the following error: Unexpected error: rpc error: code = Internal desc = Could not process slots up to 8: could not process slots: could not process epbs epoch: state randao length 65536 different than EpochsPerHistoricalVector 64.

I came up with two solutions:

  1. Replace L48 with cfg := params.MainnetConfig().Copy() and add OptimisticModeFetcher: &mock.ChainService{Optimistic: false}, to vs := &Server{...} (L70 or so).
  2. Add cfg.EpochsPerHistoricalVector = 65536 between L48 and L49.

Applying either of them fixes it.

Copy link
Member Author

Choose a reason for hiding this comment

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

CI/CD passes, that's all it matters here. To run beacon-chain/rpc/prysm/v1alpha1/validator, you should use bazel instead of native golang. bazel test //beacon-chain/rpc/prysm/v1alpha1/validator:go_default_test --test_filter=TestServer_GetLocalHeader

Comment on lines 75 to 82
ExecutionEngineCaller: &powtesting.EngineClient{
GetPayloadResponse: &blocks.GetPayloadResponse{ExecutionData: executionData, BlobsBundle: &v1.BlobsBundle{
KzgCommitments: kzgs,
}},
},
}

Choose a reason for hiding this comment

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

Not a big of a deal but I think this is easier to read:

Suggested change
ExecutionEngineCaller: &powtesting.EngineClient{
GetPayloadResponse: &blocks.GetPayloadResponse{ExecutionData: executionData, BlobsBundle: &v1.BlobsBundle{
KzgCommitments: kzgs,
}},
},
}
ExecutionEngineCaller: &powtesting.EngineClient{
GetPayloadResponse: &blocks.GetPayloadResponse{
ExecutionData: executionData,
BlobsBundle: &v1.BlobsBundle{
KzgCommitments: kzgs,
}},
},


st, parentRoot, err := vs.getParentState(ctx, slot)
if err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you return a status here too?

Suggested change
return nil, err
return nil, status.Errorf(codes.Internal, "Could not get parent state: %v", err)

GasLimit: localPayload.ExecutionData.GasLimit(),
BuilderIndex: proposerIndex,
Slot: slot,
Value: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is value meant to be 0?

Choose a reason for hiding this comment

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

This is called when a proposer is a builder. Value here means how much do I pay for myself, so making it non-zero is effectively same with zero value.

@terencechain
Copy link
Member Author

Moved to #14409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ePBS EIP-7732
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants