Skip to content

fix: sync Account.Extra with GovCouncil contract slots on genesis init#73

Merged
eomti-wm merged 7 commits intodevfrom
fix/sync-account-extra-and-slots
Apr 10, 2026
Merged

fix: sync Account.Extra with GovCouncil contract slots on genesis init#73
eomti-wm merged 7 commits intodevfrom
fix/sync-account-extra-and-slots

Conversation

@eomti-wm
Copy link
Copy Markdown
Contributor

@eomti-wm eomti-wm commented Apr 8, 2026

Summary

Ensure consistency between Account.Extra bits and GovCouncil contract storage slots (blacklist / authorized accounts) at genesis initialization.
Previously, the two sources could diverge — addresses set via chain config params were not reflected in alloc.Extra, and vice versa.

Changes

Bug Fixes

  • Alloc ↔ contract slot sync (systemcontracts/gov_council.go, systemcontracts/systemcontracts.go)
    Pass genesis.Alloc to initializeGovCouncil and reconcile blacklist/authorized addresses from both Account.Extra bits and chain config params into a unified set (union).
    Both alloc.Extra and contract storage slots are updated to reflect the final state.

  • Nil map panic (core/genesis.go)
    Initialize genesis.Alloc before passing to GetSystemContractsTransition to prevent a nil map write panic when Alloc is unset at the time InjectContracts is called.

Additions

  • Prealloc encoding (core/mkalloc.go, core/genesis.go)
    Include Account.Extra in prealloc RLP encoding/decoding (rlp:"optional" for backward compatibility).

  • Extra bit validation (core/types/state_account_extra.go, core/genesis.go)
    Add AccountExtraValidMask constant and ValidateExtra function.
    Reject undefined Extra bits early in initializeAnzeonGenesis before any initialization runs.

eomti-wm added 6 commits April 8, 2026 14:53
Add Extra field to prealloc format to preserve Account.Extra
during genesis serialization. Declared as rlp:"optional" to
maintain backward compatibility with existing prealloc data.
…nsition

Nil map was passed to GetSystemContractsTransition when genesis.Alloc was
not pre-allocated, causing a potential panic on write inside system contract
initialization. Move the nil check before the call to ensure a valid map is
always passed.
Introduce AccountExtraValidMask as the union of all defined bit masks,
and ValidateExtra to reject any account extra value with undefined bits set.
Reconcile blacklist and authorized account addresses from Account.Extra
and chain config params, ensuring both alloc and GovCouncil contract
storage slots reflect the same state at genesis.
@eomti-wm eomti-wm self-assigned this Apr 8, 2026
@eomti-wm eomti-wm added the bug Something isn't working label Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@hominlee-wemade hominlee-wemade left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@0xmhha 0xmhha left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@colinkim colinkim left a comment

Choose a reason for hiding this comment

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

LGTM

@eomti-wm eomti-wm merged commit 319b84d into dev Apr 10, 2026
3 checks passed
@eomti-wm eomti-wm deleted the fix/sync-account-extra-and-slots branch April 10, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants