Skip to content

Fix validateConsensus#15548

Merged
potuz merged 4 commits intodevelopfrom
fix-stater
Aug 7, 2025
Merged

Fix validateConsensus#15548
potuz merged 4 commits intodevelopfrom
fix-stater

Conversation

@potuz
Copy link
Contributor

@potuz potuz commented Jul 30, 2025

Reported by NuConstruct

The stater package looks for a stateroot using the head state from the blockchain package. However, this state is very unlikely to have the poststateroot since that's only added after slot processing. I assume that essentially any REST endpoint that uses this mechanism to get head is broken if it needs to gather a state by stateroot.

This PR is a placeholder to verify this is the issue, here I just check if the NSC already has the post-state since that will have already the processing state cached.

rkapka
rkapka previously approved these changes Jul 31, 2025
potuz added 2 commits July 31, 2025 09:37
Reported by NuConstruct

The stater package looks for a stateroot using the head state from the
blockchain package. However, this state is very unlikely to have the
poststateroot since that's only added after slot processing. I assume
that essentially any REST endpoint that uses this mechanism to get head
is broken if it needs to gather a state by stateroot.

This PR is a placeholder to verify this is the issue, here I just check
if the NSC already has the post-state since that will have already the
processing state cached.
if err != nil {
return errors.Wrap(err, "could not get parent state")
// Check if the state is already cached
parentState := transition.NextSlotState(parentBlockRoot[:], blk.Block().Slot())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this needs to be a function on s*Server if we might need to fix it elsewhere too

@potuz potuz added this pull request to the merge queue Aug 7, 2025
Merged via the queue into develop with commit fe000e5 Aug 7, 2025
15 checks passed
@potuz potuz deleted the fix-stater branch August 7, 2025 13:34
jtraglia pushed a commit to jtraglia/prysm that referenced this pull request Aug 11, 2025
* Fix validateConsensus

Reported by NuConstruct

The stater package looks for a stateroot using the head state from the
blockchain package. However, this state is very unlikely to have the
poststateroot since that's only added after slot processing. I assume
that essentially any REST endpoint that uses this mechanism to get head
is broken if it needs to gather a state by stateroot.

This PR is a placeholder to verify this is the issue, here I just check
if the NSC already has the post-state since that will have already the
processing state cached.

* Add changelog

* add fallback

* Fix tests
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
* Fix validateConsensus

Reported by NuConstruct

The stater package looks for a stateroot using the head state from the
blockchain package. However, this state is very unlikely to have the
poststateroot since that's only added after slot processing. I assume
that essentially any REST endpoint that uses this mechanism to get head
is broken if it needs to gather a state by stateroot.

This PR is a placeholder to verify this is the issue, here I just check
if the NSC already has the post-state since that will have already the
processing state cached.

* Add changelog

* add fallback

* Fix tests
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
* Fix validateConsensus

Reported by NuConstruct

The stater package looks for a stateroot using the head state from the
blockchain package. However, this state is very unlikely to have the
poststateroot since that's only added after slot processing. I assume
that essentially any REST endpoint that uses this mechanism to get head
is broken if it needs to gather a state by stateroot.

This PR is a placeholder to verify this is the issue, here I just check
if the NSC already has the post-state since that will have already the
processing state cached.

* Add changelog

* add fallback

* Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants