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

Regenerated genesis bug #650

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Regenerated genesis bug #650

merged 3 commits into from
Oct 23, 2024

Conversation

blmalone
Copy link
Contributor

Discoverd in this pr, we found that the regenerated genesis contains storage allocations that have zero as the value field. This causes the genesis allocs test to fail because op-deployer doesn't do this, nor should it.

@blmalone blmalone requested a review from a team as a code owner October 23, 2024 03:16
@blmalone blmalone self-assigned this Oct 23, 2024
@geoknee
Copy link
Collaborator

geoknee commented Oct 23, 2024

I'm a bit confused by this change. AFAICT this is not a bug in the validation code, but possibly a bug in the genesis creation code itself. Seems weird to "fix" it here -- wouldn't this risk a valid genesis allocs (valid by our working definition, that it was generated using standard tooling invocations at a specified commit in the monorepo) failing validation (because it would have the the zeros which are now removed from the expectation).

@mds1
Copy link
Contributor

mds1 commented Oct 23, 2024

The key point is that for slots that are not set in genesis, the default storage value is zero. So two genesis files, where one omits zero valued slots and one explicitly sets them, are equivalent.

Therefore I think the ideal fix is for the superchain registry to normalize both the provided genesis and the generated genesis before diffing them, by removing all slots where the value being set in storage is zero. This way it doesn't matter whether or not the provided and generated genesis files have these no-op keys being set, since both versions are equivalent

In op-deployer, we do this same normalization when generating genesis. But you are right that this diff might cause genesis files generated by other scripts that don't normalize to fail. So we could extend this PR to normalize both genesis files to be more robust

@geoknee
Copy link
Collaborator

geoknee commented Oct 23, 2024

@mds1 agreed, Blaine and I just reached the same conclusion :-)

@blmalone blmalone added this pull request to the merge queue Oct 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 23, 2024
@blmalone blmalone added this pull request to the merge queue Oct 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 23, 2024
@blmalone blmalone added this pull request to the merge queue Oct 23, 2024
@bitwiseguy
Copy link
Collaborator

Should we remove empty storage slots in the version of the genesis file that gets stored in the repo? Might save us some bytes

Merged via the queue into main with commit f8587d7 Oct 23, 2024
11 checks passed
@blmalone blmalone deleted the bm/regenerated-alloc-bug branch October 23, 2024 14:04
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.

4 participants