-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add GET /eth/v2/beacon/pool/attestations
endpoint
#14560
Conversation
/eth/v2/beacon/pool/attestations
endpoint
/eth/v2/beacon/pool/attestations
endpointGET /eth/v2/beacon/pool/attestations
endpoint
c43e5ba
to
33a2948
Compare
} | ||
httputil.WriteJson(w, &structs.ListAttestationsResponse{Data: filteredAtts}) | ||
w.Header().Set(api.VersionHeader, version.String(firstVersion)) |
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 idea as for slashings: we should use the head state or current slot to determine the version and only return attestations for that version.
|
||
for _, att := range attestations { | ||
var includeAttestation bool | ||
attOld, ok := att.(*eth.Attestation) |
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.
maybe rename to att
since there is only one type of attestations in v1?
} | ||
httputil.WriteJson(w, &structs.ListAttestationsResponse{Data: allAtts}) | ||
data := attOld.GetData() | ||
attStruct := structs.AttFromConsensus(attOld) |
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.
this should ideally be done inside if includeAttestation
return | ||
} | ||
data := attElectra.GetData() | ||
attStruct := structs.AttElectraFromConsensus(attElectra) |
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.
this should ideally be done inside if includeAttestation
return | ||
} | ||
data := attOld.GetData() | ||
attStruct := structs.AttFromConsensus(attOld) |
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.
this should ideally be done inside if includeAttestation
if isEmptyReq { | ||
return true |
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.
This part is not really needed. If both are empty, then return committeeIndexMatch && slotMatch
will return true
. Also you will be able to have one function argument less.
ElectraForkVersion []byte `yaml:"ELECTRA_FORK_VERSION" spec:"true"` // ElectraForkVersion is used to represent the fork version for electra. | ||
ElectraForkEpoch primitives.Epoch `yaml:"ELECTRA_FORK_EPOCH" spec:"true"` // ElectraForkEpoch is used to represent the assigned fork epoch for electra. |
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.
👍
* add ListAttestationsV2 endpoint * fix endpoint * changelog * add endpoint to tests * add trailing comma * add version header + lint fix * all reviews * modify v1 and comments * fix linter * Radek' review
What type of PR is this?
Other
What does this PR do? Why is it needed?
Beacon API Electra alignment, add missing endpoint for GET
/eth/v2/beacon/pool/attestations
.As described in the spec https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getPoolAttestationsV2
Which issues(s) does this PR fix?
Part of #14476
Other notes for review
Acknowledgements