-
Notifications
You must be signed in to change notification settings - Fork 65
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 beacon block reward endpoint #162
base: master
Are you sure you want to change the base?
Conversation
Ignore the events.go (It was fixed by @mcdee). It is still working perfectly without errors, but |
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.
Thanks for this PR, a few comments inline. Also, please could you add in api/v1/beaconblockreward_yaml.go
and api/v1/beaconblockreward_test.go
files to add YAML support and tests for the spec, respectively? The tests in particular are important to keep up coverage rates for the library.
apiv1 "github.com/attestantio/go-eth2-client/api/v1" | ||
) | ||
|
||
// BeaconBlockHeader provides the block header given the opts. |
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.
Please could you fix this comment to match the function.
"github.com/pkg/errors" | ||
) | ||
|
||
// BeaconBlockReward Rewards info for a single block |
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.
Please can you fix comments so that they end in a period? Thanks.
// BeaconBlockReward Rewards info for a single block | ||
type BeaconBlockReward struct { | ||
// Proposer of the block, the proposer index who receives these rewards | ||
ProposerIndex uint64 |
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 be of type phase0.ValidatorIndex
// Proposer of the block, the proposer index who receives these rewards | ||
ProposerIndex uint64 | ||
// Total block reward in gwei, equal to attestations + sync_aggregate + proposer_slashings + attester_slashings | ||
Total uint64 |
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 and other gwei values should be of type phase0.Gwei
@@ -21,6 +21,7 @@ import ( | |||
"math/rand" | |||
"net" | |||
"net/http" | |||
"net/url" |
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.
Please can you revert the changes to this file, as they have been addressed elsewhere.
@mcdee Thank you very for the comments. I will take a look. A comment from my side. YAML files can be found in |
Sorry, after taking another look it appears that the rewards object is not a spec object, so it doesn't need the YAML piece. |
Add Block Rewards.
Endpoint
/eth/v1/beacon/rewards/blocks
is now available to fetch data regarding the block rewards on a slot.To test it you can run the following:
One problem I had, was when testing it against QuickNode, some time an error appeared
Context Deadline Exceeded
, due to the fact that the rewards endpoint with curl takes about 1 min to complete.