Skip to content

fix(genesis): validate denylister uniqueness and non-zero addresses in Denylist schema - #403

Open
Lesnak1 wants to merge 1 commit into
circlefin:mainfrom
Lesnak1:fix/genesis-denylist-validation
Open

Lesnak1 wants to merge 1 commit into
circlefin:mainfrom
Lesnak1:fix/genesis-denylist-validation

Conversation

@Lesnak1

@Lesnak1 Lesnak1 commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Follow-up to genesis/runtime invariant alignments (similar to #359 for ProtocolConfig and #346 for ValidatorManager):

  1. Owner cannot be the zero addressDenylist.initialize(initialOwner) in Denylist.sol explicitly reverts with ZeroAddress() when given address(0). The genesis schema previously accepted address(0), writing an un-ownable proxy contract state.
  2. Denylisters cannot contain the zero addressDenylist.addDenylister(account) in Denylist.sol explicitly reverts with ZeroAddress(). The genesis schema previously allowed address(0) to be configured and initialized as a denylister in genesis storage.
  3. Denylisters must be unique — Initial denylisters are mapped to storage slots via slotForAddressMap(DENYLIST_STORAGE_LOCATION + 1n, addr). Duplicate entries (or case-variant hex duplicates) previously resulted in duplicate storage keys, throwing an unhandled Duplicate storage key runtime error in buildAccountAlloc instead of failing graceful schema validation. Matches the uniqueness validation in sibling modules ValidatorManager.ts and NativeFiatToken.ts.

Test plan

  • Added tests/unit/denylist-genesis.test.ts covering zero-address owner, zero-address denylisters, duplicate denylisters, mixed-casing hex duplicates, and proxy admin separation.
  • Ran unit test suite: 31 passing across all unit tests in tests/unit/.
  • Formatted and linted with Prettier and ESLint.

…n Denylist schema

Align Denylist genesis schema with runtime contract invariants from Denylist.sol:

1. Validate that owner is not the zero address (reverts on-chain in initialize).
2. Validate that denylisters do not contain the zero address (reverts on-chain in addDenylister).
3. Validate that denylisters are unique (case-insensitive) to prevent duplicate storage key collisions during genesis allocation building.
4. Add unit test suite in tests/unit/denylist-genesis.test.ts covering all validation cases.
@Lesnak1
Lesnak1 force-pushed the fix/genesis-denylist-validation branch from b195c2c to baf964f Compare September 16, 2026 09:57
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.

1 participant