-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
feat: implement expected withdrawals API #6514
feat: implement expected withdrawals API #6514
Conversation
This is a tentative implement. |
Thanks for your contribution🙂
Just trying to understand the scope of this PR. Is it only adding the route definition of If latter, it would be great if you can mark it as PR draft and reach out to the maintainers on Discord if you need any assistance. If former, I am happy to review it once the CI checks are passed😀 |
That would be appreciated! So far, surveying how to implement the API. If both adding Routes and Types are completed, I would like to ask you to review before the implementation of the function and test. |
@ensi321 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #6514 +/- ##
============================================
- Coverage 61.55% 61.47% -0.08%
============================================
Files 556 558 +2
Lines 58586 58736 +150
Branches 1847 1848 +1
============================================
+ Hits 36060 36110 +50
- Misses 22486 22586 +100
Partials 40 40 |
I misunderstood the concept. I will recreate it. |
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.
Good work! Left some comments regarding the route definition
Please convert this PR into PR draft while working on the implementation and convert it back when it's ready for another round of review. You can read more about it here Maintainers will get notifications every time you commit unless you make this a draft 😅 |
@ensi321 Great! Thank you for the tips. According to these hints, I will program it again. |
2207ec4
to
06f0039
Compare
I implemented the interface for getting the withdrawal data. |
You will also need to add a http server for your newly created builder api.
lodestar/packages/api/src/beacon/index.ts Line 14 in 87f07fe
Lodestar should start serving this route afterwards. Also you will need to define a http client too which is similar to http server. See |
@ensi321 Thank you so much for taking the time to review the code, especially with your busy schedule. curl -X 'GET' 'http://localhost:9596/eth/v1/builder/states/head/expected_withdrawals' -H 'accept: application/json'| python3 -m json.tool
{
"execution_optimistic": false,
"data": [
{
"index": 1,
"validator_index": 1,
"address": "0xAbcF8e0d4e9587369b2301D0790347320302cc09",
"amount": 1
}
]
} |
Hi, I almost done (exception handlings are not yet) , but, Development network ./lodestar dev --genesisValidators 8 --reset --rest.namespace "*" always returns http://localhost:9596/eth/v1/builder/states/head/expected_withdrawals empty array. How do I get getExpectedWithdrawals method value on this environment? |
I recommend testing this kind of features by running it as a beacon node on mainnet or other public testnet like holesky. I admit it might be hard for contributors who have limited hardwares.
This is expected. The reason why
The current If running a beacon node on mainnet/testnet is too much for you, and wish to test this locally with
Lastly run I ran this locally and the api returns |
@ensi321 Thanks! I will resume this soon. |
@HiroyukiNaito Are you planning to continue on this? Since we recently refactored our api framework, most of the changes in this PR are outdated, I suggest to just open a new PR and continue discussion there.
Just a side note on this, it's pretty easy to spin up a mainnet node on any device, it just takes 1-2 min on my laptop to startup and be synced to head, you can just run ./lodestar beacon --checkpointSyncUrl https://beaconstate-mainnet.chainsafe.io --forceCheckpointSync --execution.engineMock This requires ~5-6GB RAM but other than that it's pretty lightweight. |
this PR has too many conflicts since we did a major refactoring of the api layer, it makes sense to tackle this in a new PR |
Motivation
Latest beacon API spec requires expected withdrawals API
Description
Implement the following route:
https://ethereum.github.io/beacon-APIs/#/Builder/getNextWithdrawals
Closes #5696
Steps to test or reproduce
Progress
Components
lodestar/packages/beacon-node/src/api/impl/debug/index.ts
Line 39 in c94ecd2
lodestar/packages/state-transition/src/block/processWithdrawals.ts
Line 65 in 918924e
lodestar/packages/beacon-node/src/util/forkChoice.ts
Line 3 in 1d3bf04