Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fdac322
Add new HTTP endpoint that returns total supply as of given state root
alecalve Mar 10, 2025
2ceb554
Add doc in book
alecalve Mar 20, 2025
c8849f8
Apply review suggestions
alecalve Mar 27, 2025
9238b73
Fix YAML linting
alecalve Mar 27, 2025
dd16ee2
Check Markdown linting earlier in the test suite
alecalve Mar 27, 2025
e405540
Fix typo
alecalve Mar 27, 2025
cdf25ae
Merge branch 'unstable' into supply-endpoint
alecalve Mar 27, 2025
549df6a
Merge branch 'unstable' into supply-endpoint
alecalve Apr 25, 2025
008b292
Add test, change output format to conform with other endpoints
alecalve Apr 25, 2025
e2b34f7
Fix linting issues
alecalve Apr 25, 2025
f561f7e
Merge branch 'unstable' into supply-endpoint
eserilev May 19, 2025
79bc2ce
Fix formatting
alecalve May 19, 2025
6030e92
Merge branch 'unstable' into supply-endpoint
eserilev May 19, 2025
d565b75
Merge branch 'unstable' into supply-endpoint
alecalve May 20, 2025
7746973
Merge branch 'unstable' into supply-endpoint
eserilev May 20, 2025
de85db1
Merge branch 'unstable' into supply-endpoint
eserilev Jun 19, 2025
6623e14
Merge branch 'unstable' into supply-endpoint
alecalve Jun 20, 2025
ad09d3e
Merge branch 'unstable' into supply-endpoint
eserilev Jun 21, 2025
8ed54f6
rename global_validator_supply to total_supply
dapplion Feb 10, 2026
5d754f4
merge unstable, resolve test conflicts
dapplion Feb 10, 2026
ce3b7c4
fix: use expose_full() for private SensitiveUrl field
dapplion Feb 10, 2026
5a720fd
Merge branch 'unstable' into supply-endpoint
dapplion Feb 10, 2026
e5a941b
fix formatting
dapplion Feb 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4448,6 +4448,35 @@ pub fn serve<T: BeaconChainTypes>(
})
});

// GET lighthouse/analysis/global_validator_supply/{state_root}
let get_lighthouse_global_validator_supply = warp::path("lighthouse")
.and(warp::path("analysis"))
.and(warp::path("global_validator_supply"))
.and(warp::path::param::<StateId>())
.and(warp::path::end())
.and(task_spawner_filter.clone())
.and(chain_filter.clone())
.then(
|state_id: StateId,
task_spawner: TaskSpawner<T::EthSpec>,
chain: Arc<BeaconChain<T>>| {
task_spawner.blocking_json_task(Priority::P1, move || {
state_id
.map_state_and_execution_optimistic_and_finalized(
&chain,
|state, execution_optimistic, finalized| {
Ok((
state.balances().iter().sum::<u64>(),
execution_optimistic,
finalized,
))
},
)
.map(api_types::GenericResponse::from)
})
},
);

// GET lighthouse/analysis/attestation_performance/{index}
let get_lighthouse_attestation_performance = warp::path("lighthouse")
.and(warp::path("analysis"))
Expand Down Expand Up @@ -4720,6 +4749,7 @@ pub fn serve<T: BeaconChainTypes>(
.uor(get_lighthouse_staking)
.uor(get_lighthouse_database_info)
.uor(get_lighthouse_block_rewards)
.uor(get_lighthouse_global_validator_supply)
.uor(get_lighthouse_attestation_performance)
.uor(get_beacon_light_client_optimistic_update)
.uor(get_beacon_light_client_finality_update)
Expand Down
22 changes: 22 additions & 0 deletions book/src/api_lighthouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,28 @@ Caveats:
This is because the state *prior* to the `start_epoch` needs to be loaded from the database, and
loading a state on a boundary is most efficient.

## `lighthouse/analysis/global_validator_supply/{state_root}`

Returns the sum of all validator balances for a given state root.

```bash
curl -X GET "http://localhost:5052/lighthouse/analysis/global_validator_supply/0x7e76880eb67bbdc86250aa578958e9d0675e64e714337855204fb5abaaf82c2b" -H "accept: application/json" | jq
```

```json
{
"data": [
674144000000000,
false,
true
]
}
```

The two boolean flags in the response are respectively:
* `execution_optimistic`: whether the response was computed using optimistically synced data
* `finalized`: whether the response was computed over finalized dasta

## `/lighthouse/logs`

This is a Server Side Event subscription endpoint. This allows a user to read
Expand Down
Loading