Skip to content

fix(genesis): reject duplicate account address aliases - #469

Open
Yudis-bit wants to merge 2 commits into
circlefin:mainfrom
Yudis-bit:fix/genesis-account-collisions
Open

Yudis-bit wants to merge 2 commits into
circlefin:mainfrom
Yudis-bit:fix/genesis-account-collisions

Conversation

@Yudis-bit

@Yudis-bit Yudis-bit commented Sep 26, 2026 •

Copy link
Copy Markdown

Reject duplicate genesis allocations by comparing lowercase account identities while preserving the original address keys. This prevents mixed-case aliases from bypassing collision checks and inflating the native coin total supply.

The regression tests cover both prefund insertion orders, identical addresses, collisions with implementation and precompile addresses, and preservation of distinct balances, address casing, bytecode, nonce, and total supply.

Public CI now runs the existing make test-unit-hardhat target in Contracts Tests, using Node 22, npm ci, and the existing Foundry setup. This includes the matcher tests and all tests/unit/*.test.ts files.

Validation:

  • 43 Hardhat tests passed locally on Windows with Foundry 1.4.4, including all six genesis collision regressions.
  • Workflow validation: actionlint, Prettier, and git diff --check passed.

Closes #468.

Copilot AI lite review requested due to automatic review settings September 26, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

ZhiyuCircle
ZhiyuCircle previously approved these changes Sep 26, 2026
@ZhiyuCircle ZhiyuCircle added the pending-import Merged PR awaiting reverse-sync to upstream label Sep 26, 2026
@osr21

osr21 commented Sep 26, 2026

Copy link
Copy Markdown

Reviewed the shared insertion guard and the regression cases. Normalizing each validated hex address for the duplicate check is the right scope: it catches case aliases across generated and prefunded allocations while preserving the original key casing in the serialized genesis output. The tests also cover both alias insertion orders, collisions with an implementation and a precompile, and preservation of distinct allocations and total supply. I found no correctness issue in this change.

One non-blocking follow-up: the green checks on this PR do not appear to run the TypeScript tests/unit suite, so these regression tests currently rely on the locally reported command and will not guard future changes in CI unless the existing unit-test target is invoked there.

@ZhiyuCircle

Copy link
Copy Markdown
Contributor

the green checks on this PR do not appear to run the TypeScript tests/unit suite, so these regression tests currently rely on the locally reported command and will not guard future changes in CI unless the existing unit-test target is invoked there.

@Yudis-bit could you address @osr21 's above comment

@Yudis-bit
Yudis-bit force-pushed the fix/genesis-account-collisions branch from 9af7a85 to 8e46d5d Compare September 27, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-import Merged PR awaiting reverse-sync to upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Genesis builder accepts address aliases and double-counts prefund supply

4 participants