Skip to content
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

Add a helper to regen a state of the right fork #14326

Open
potuz opened this issue Aug 9, 2024 · 0 comments
Open

Add a helper to regen a state of the right fork #14326

potuz opened this issue Aug 9, 2024 · 0 comments

Comments

@potuz
Copy link
Contributor

potuz commented Aug 9, 2024

Say you need to verify a signature of an object from slot 32 N + s with 0 < s < 32, that is in the middle of the epoch.

We would typically call StateByRoot to regenerate the prestate/poststate of the object and use that state to verify the signature. But in fact we only care about having the right epoch N and the right Fork version of the object. Both of these can be obtained from the object itself perhaps.

There are different designs to avoid this state regeneration:

  • The simplest most naive one is to simply grab from db a state from the right fork and perhaps at an epoch boundary, this has more chances of not having to regenerate anything
  • Another one is to simply use the headstate since until we reuse indices the BLS keys won't have changed and we can get the epoch and fork version from the object.

The biggest problem is that the validator set may have changed between the required state and the one we are using.

We currently regenerate the pre/post-state to the object (think for beacon blocks) when we would be find regenerating the justified state previous to the object, plus perhaps using the object's fork version instead of the state one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant