lighthouse
lighthouse copied to clipboard
Add new HTTP endpoint to get supply for a given state root
Issue Addressed
Computing how much ETH is on the Consensus layer requires currently querying /eth/v1/beacon/states/{state_id}/validator_balances and summing up all balances of all validators.
That data is 68MB of JSON which has to be downloaded and processed.
Proposed Changes
This PR instead adds a simple enpoint where the computation is done at the node level, the returned data is therefore minimal.
Looks like this needs a sneaky cargo fmt --all
For Markdown linting, I took the liberty of moving the check earlier in the test process as it's fast to run. In this MR, the suite failed nearly 15mins into testing when it could have failed much earlier.
For Markdown linting, I took the liberty of moving the check earlier in the test process as it's fast to run. In this MR, the suite failed nearly 15mins into testing when it could have failed much earlier.
Nice, that's a good change! And thanks for being prompt in implementing the suggestions, I'll test this out more thoroughly soon
@macladson I have no idea why the windows release tests failed, are they known to be flaky or could my changes somehow be the cause?
@macladson I have no idea why the windows release tests failed, are they known to be flaky or could my changes somehow be the cause?
Not sure what happened but I retriggered the tests and it has passed now, must've just been flaky
Hi @alecalve thanks for all your work so far! I was wondering if you'd be up for writing a test case for this endpoint? If not, I can go ahead and push up a test case myself. Thanks!
Hi @alecalve thanks for all your work so far! I was wondering if you'd be up for writing a test case for this endpoint? If not, I can go ahead and push up a test case myself. Thanks!
I'll give it a try!
@alecalve this looks great!
There are two small lint issues that are blocking CI. If you run make lint-full you should see them.
I wasn't aware of this final step of linting, I only ran cargo fmt. To make clippy happy, I split the HTTP test function into GET/POST methods to avoid triggering this:
error: this function may allocate 513901 bytes on the stack
--> beacon_node/http_api/tests/tests.rs:7342:1
|
7342 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7343 | async fn lighthouse_endpoints() {
7344 | / ApiTester::new()
7345 | | .await
| |______________- this is the largest part, at 37296 bytes for type `{async fn body of tests::ApiTester::new()}`
Some required checks have failed. Could you please take a look @alecalve? 🙏
Some required checks have failed. Could you please take a look @alecalve? 🙏
Hi @alecalve, this pull request has been closed automatically due to 30 days of inactivity. If you’d like to continue working on it, feel free to reopen at any time.