nimbus-eth2 icon indicating copy to clipboard operation
nimbus-eth2 copied to clipboard

Support for retrieving state by `state_root`

Open wuzhong-zhu opened this issue 1 year ago • 1 comments

We recently encountered an issue with the beacon API when calling /eth/v1/beacon/states/{state_id}/finality_checkpoints. The API returned a 500 error, indicating that it was not implemented.

Upon reviewing the source code located at https://github.com/status-im/nimbus-eth2/blob/c22962f3821d069f86ee38826443f9830931cc7c/beacon_chain/rpc/rest_beacon_api.nim#LL216C27-L216C27, we discovered that the function was not implemented in the source code.

I just want to ask if there is a roadmap for creating this, and if there is an alternate way to check the finality state of a certain block.

wuzhong-zhu avatar May 30 '23 05:05 wuzhong-zhu

Nimbus doesn't implement obtaining a BeaconState by its root, because this would require some additional tables to our database that are not otherwise necessary.

Most applications can be adapted to obtain a state by slot number. For example, if you have a BeaconBlock, you can obtain the state corresponding to the same slot and then verify that the latest_block_header field in the state refers to the same block.

zah avatar May 30 '23 08:05 zah