ChainSafe / ChainSafe/lodestar

Requesting state by state root does not work for finalized state(s)

Open
#7,780 0 comments 0 reactions 0 assignees View on GitHub
meta-bug scope-ux
Dominant language
TypeScript
Stars
1.4k
Forks
483
Avg merge
1d 16h
Merged PRs (30d)
150

Description

This seems like a bug to me, we can serve the state if `finalized` is passed but not if state root hex is used

eg. fetching finality checkpoints

```
~> curl -s https://lodestar-mainnet.chainsafe.io/eth/v1/beacon/states/finalized/finality_checkpoints | jq
{
"data": {
"previous_justified": {
"epoch": "362680",
"root": "0x411eaaa43af1f5b46f350fc4e780f262c15e69873bdace4d8194552cf8e5104e"
},
"current_justified": {
"epoch": "362681",
"root": "0xf15828709f86603ecff6df41bd6649d38a1eb15b1ce88ed04480fcf502a0fbed"
},
"finalized": {
"epoch": "362680",
"root": "0x411eaaa43af1f5b46f350fc4e780f262c15e69873bdace4d8194552cf8e5104e"
}
},
"execution_optimistic": false,
"finalized": true
}
```

no issues in first query, but using the finalized state root for epoch `362680` does not work
```
~> curl -s https://lodestar-mainnet.chainsafe.io/eth/v1/beacon/states/0x06bdba2417932d6f101eae65e95f935e4dc605e7b7d6fb8c6e838f6befaa3156/finality_checkpoints | jq
{
"code": 404,
"message": "No state found for id '0x06bdba2417932d6f101eae65e95f935e4dc605e7b7d6fb8c6e838f6befaa3156'"
}
```

even for apis that have state regen (like `getStateV2`) enabled it won't serve the state and just return
```
{
"code": 500,
"message": "REGEN_ERROR_STATE_NOT_IN_FORKCHOICE"
}
```

but using the slot (instead of root) for the same state works. This seems to be an issue how we resolve the state and is likely a bug.

Needs more investigation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.