Skip to content

add progressive state schema - #17358

Open
Inspector-Butters wants to merge 2 commits into
developfrom
progressive-state-schema
Open

add progressive state schema#17358
Inspector-Butters wants to merge 2 commits into
developfrom
progressive-state-schema

Conversation

@Inspector-Butters

Copy link
Copy Markdown
Contributor

This PR changes how we access the fields of each fork in the state_native package going forward (starting with gloas).

we can no longer use FieldIndex.RealPosition() since a field can have a different index for each fork.
and now we have another thing to keep track of: each fork's ActiveField []bool.

it will create a progressiveStateSchema for gloas+ forks which will keep track of fields, fieldIndexes, and activeFields.
I've showcased how this should be used. look at the changes in state_trie.go. for later forks, the only thing we need to do, is to update the fields.go file to include the new fork fields and progressiveStateSchema.

Fixes #17301

@Inspector-Butters
Inspector-Butters force-pushed the progressive-state-schema branch from 4d54a9f to 49fe7c2 Compare August 14, 2026 12:22
@Inspector-Butters
Inspector-Butters force-pushed the progressive-state-schema branch from 49fe7c2 to fb28a34 Compare August 14, 2026 12:24
@syjn99
syjn99 self-requested a review August 18, 2026 00:30

func newProgressiveStateFieldsSchema(allFields []types.FieldIndex, inactiveFields []types.FieldIndex, forkFieldCount int) (*progressiveStateSchema, error) {
if len(allFields) == 0 {
return nil, fmt.Errorf("progressive state schema requires at least one field")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: I think we can just use errors.New in this case (static string). It's a bit faster than fmt.Errorf. So here's my personal rules:

  • static string: errors.New
  • formatted string: fmt.Errorf
  • wrapping an err: fmt.Errorf with %w formatter

return schema, nil
}

func (schema *progressiveStateSchema) getFieldIndex(field types.FieldIndex) (int, bool) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is just a wrapper of map accessor, then can't we just use schema.fieldIndex in the caller side instead?

"github.com/OffchainLabs/prysm/v7/runtime/version"
)

const maxProgressiveStateFields = 256

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like we have same value (maxProgressiveActiveFields) in other package

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

Successfully merging this pull request may close these issues.

Handle ActiveFields checks for > gloas forks in progressive methods

2 participants