-
Notifications
You must be signed in to change notification settings - Fork 993
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/attester_slashings
#14479
base: develop
Are you sure you want to change the base?
Conversation
/eth/v2/beacon/pool/attester_slashings
/eth/v2/beacon/pool/attester_slashings
ss := make([]*eth.AttesterSlashingElectra, len(sourceSlashings)) | ||
for i, slashing := range sourceSlashings { | ||
a, ok := slashing.(*eth.AttesterSlashingElectra) | ||
if ok { |
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.
you could do the reverse here and avoid the else
@@ -172,6 +172,11 @@ type GetAttesterSlashingsResponse struct { | |||
Data []*AttesterSlashing `json:"data"` | |||
} | |||
|
|||
type GetAttesterSlashingsV2Response struct { | |||
Version string `json:"version"` | |||
Data []json.RawMessage `json:"data"` // Accepts both `[]*AttesterSlashing` and `[]*AttesterSlashingElectra` types |
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.
Single json.RawMessage
will make the code more compact
} | ||
v := version.String(headState.Version()) |
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.
The version should be based on the version of the slashing, not the state. This is because (1) the only possible slashing versions are Phase0 and Electra, and (2) the state here can be after a fork with the slashing being before the fork.
@@ -172,6 +172,11 @@ type GetAttesterSlashingsResponse struct { | |||
Data []*AttesterSlashing `json:"data"` | |||
} | |||
|
|||
type GetAttesterSlashingsV2Response struct { |
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 is a different approach than what you did for https://github.com/prysmaticlabs/prysm/pull/14481/files#diff-b7de0123b995294eb1e799afb080f62c9a4a08195f9ed1f387a9071922b1ec97. Can you do the same here?
What type of PR is this?
Other
What does this PR do? Why is it needed?
Beacon API Electra alignment, add missing endpoint for
/eth/v2/beacon/pool/attester_slashings
.As described in the spec https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getPoolAttesterSlashingsV2
Which issues(s) does this PR fix?
Part of #14476
Other notes for review
Acknowledgements