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

Add /eth/v1/beacon/deposit_snapshot endpoint #13514

Merged
merged 28 commits into from
Feb 7, 2024
Merged

Conversation

saolyn
Copy link
Contributor

@saolyn saolyn commented Jan 23, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

This PR adds the missing endpoint to retrieve deposit snapshot data.
https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getDepositSnapshot

@saolyn saolyn changed the title WIP: Add "/eth/v1/beacon/deposit_snapshot" endpoint Add /eth/v1/beacon/deposit_snapshot endpoint Jan 23, 2024
@saolyn saolyn added the API Api related tasks label Jan 23, 2024
@saolyn saolyn marked this pull request as ready for review January 23, 2024 22:35
@saolyn saolyn requested a review from a team as a code owner January 23, 2024 22:35
james-prysm
james-prysm previously approved these changes Jan 24, 2024
Copy link
Contributor

@rkapka rkapka left a comment

Choose a reason for hiding this comment

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

SSZ support missing

beacon-chain/rpc/eth/beacon/handlers_test.go Outdated Show resolved Hide resolved
beacon-chain/rpc/eth/beacon/handlers_test.go Show resolved Hide resolved
beacon-chain/rpc/eth/beacon/handlers.go Outdated Show resolved Hide resolved
@james-prysm james-prysm dismissed their stale review January 24, 2024 15:46

ssz is needed

api/server/structs/conversions.go Show resolved Hide resolved
api/server/structs/endpoints_beacon.go Outdated Show resolved Hide resolved
func DepositSnapshotFromConsensus(ds *eth.DepositSnapshot) *DepositSnapshot {
finalized := make([]string, 0, len(ds.Finalized))
for i, f := range ds.Finalized {
if i >= depositsnapshot.DepositContractDepth {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function should not have logic in it, it should purely convert between types. You should check the length of the returned value inside the handler. Although I find it peculiar that we add constraints to a returned value, I guess it might be OK as an indication that we have a bug somewhere in the deposit snapshot code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I have modified it to check ahead of time as if the length of finalized exceeds the deposit contract depth we likely have an invalid snapshot

@saolyn saolyn added this pull request to the merge queue Feb 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 7, 2024
@saolyn saolyn added this pull request to the merge queue Feb 7, 2024
Merged via the queue into develop with commit 5afb125 Feb 7, 2024
17 checks passed
@saolyn saolyn deleted the http-add-snapshot-endpoint branch February 7, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants