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

PrepareBeaconProposer API #10367

Merged
merged 29 commits into from
Mar 16, 2022
Merged

PrepareBeaconProposer API #10367

merged 29 commits into from
Mar 16, 2022

Conversation

james-prysm
Copy link
Contributor

What type of PR is this?

Feature

part of #10292

What does this PR do? Why is it needed?

This PR implements the inner workings of https://github.com/ethereum/beacon-APIs/pull/178/files Beacon API to set the prysm config. This cache is then used when calling get execution payload

@james-prysm james-prysm marked this pull request as ready for review March 15, 2022 04:29
@james-prysm james-prysm requested a review from a team as a code owner March 15, 2022 04:29
@james-prysm james-prysm added the API Api related tasks label Mar 15, 2022
var FeeRecipients []common.Address
var ValidatorIndices []types.ValidatorIndex
for _, recipientContainer := range request.Recipients {
FeeRecipients = append(FeeRecipients, common.BytesToAddress(recipientContainer.FeeRecipient))
Copy link
Member

Choose a reason for hiding this comment

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

I think it's worth validating common.BytesToAddress(recipientContainer.FeeRecipient)

var FeeRecipients []common.Address
var ValidatorIndices []types.ValidatorIndex
for _, recipientContainer := range request.Recipients {
FeeRecipients = append(FeeRecipients, common.BytesToAddress(recipientContainer.FeeRecipient))
Copy link
Member

Choose a reason for hiding this comment

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

Same here. Worth validating common.BytesToAddress(recipientContainer.FeeRecipient)

@james-prysm james-prysm added the Merge PRs related to the great milestone the merge label Mar 15, 2022
var FeeRecipients []common.Address
var ValidatorIndices []types.ValidatorIndex
for _, recipientContainer := range request.Recipients {
if len(recipientContainer.FeeRecipient) != fieldparams.FeeRecipientLength {
Copy link
Member

Choose a reason for hiding this comment

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

Why not just do IsHexAddress(common.BytesToAddress(recipientContainer.FeeRecipient)))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do it that way too will update then.

},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should also read from the DB to ensure the expected data was saved

db := dbutil.SetupDB(t)
ctx := context.Background()
proposerServer := &Server{BeaconDB: db}
_, err := proposerServer.PrepareBeaconProposer(ctx, tt.args.request)
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 here

@rauljordan rauljordan merged commit d55c0d7 into develop Mar 16, 2022
@delete-merged-branch delete-merged-branch bot deleted the prepare-beacon-proposer-api branch March 16, 2022 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Merge PRs related to the great milestone the merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants