fix(genesis): normalize genesis identity comparisons - #374
Conversation
|
Reviewed this end-to-end, including running the tests. The premise is real, the fix is correct, and the tests are genuine regression coverage. Two things need attention before merge: the fix is incomplete in one file, and CI will not execute any of it. Verified the premise
export const schemaAddress = z.string().regex(/^0x[0-9a-fA-F]{40}$/) as z.Schema<Address>So mixed casing is accepted and two spellings of one identity are representable. Confirmed. Verified the tests actually catch the bugI ran them both ways rather than taking the diff at its word:
They're real regression tests, not tautological. Good. Incomplete:
|
| file | unique addresses | valid EIP-55 |
|---|---|---|
assets/devnet/config.json |
26 | 26 |
assets/mainnet/config.json |
40 | 40 |
assets/testnet/config.json |
26 | 26 |
All 92 already pass, so enforcing it changes no committed config and no output. It also catches single-character typos, which normalization silently accepts.
I'd keep this PR as the safe, reviewable fix and treat checksum enforcement as a separate change — but it's worth recording as the durable version, because normalization-at-comparison relies on every future author remembering.
Minor
security/is a new top-level directory that doesn't exist onmain. Worth confirming maintainers want that location rather thandocs/.- The security note ends with "Before upstream submission, run the repository's normal TypeScript formatting, linting, and unit-test commands" — that's a working note to yourself, and reads oddly in a committed file since this is the upstream submission.
overrides: Record<string, unknown>in the test helper drops type-checking on the override, so a typo'd key would silently produce a config that passes for the wrong reason. Typing it asPartial<ReturnType<typeof configWithValidators>>keeps the tests honest.- 9 commits including staging/unstaging churn (
stage EIP-7702 research,remove unrelated finding,separate EIP-7702 research). Worth squashing so the history is just the fix, tests, and doc.
For what it's worth, AccountCreator.ts is clean — its Map/Set keys are numeric registration IDs, not hex, so it isn't affected.
Disclosure: I'm an external community contributor, not affiliated with Circle, with no write access to this repository. Advisory only. Test results above were produced locally against PR head c7189f3 and main at de76122; the EIP-55 check used a self-tested keccak256 implementation verified against the standard empty-string and abc vectors.
20d4dc8 to
4b3bd40
Compare
4b3bd40 to
dea806c
Compare
|
Validation update |
Thanks for the detailed review. I addressed the NativeFiatToken minter finding as suggested. |
Summary
Normalize hexadecimal identities at comparison boundaries during genesis validation.
schemaAddressandschemaHexaccept mixed-case hexadecimal values, but several genesis validation checks previously compared raw strings. Because hexadecimal casing does not change the represented bytes, equivalent identities with different casing could bypass uniqueness or role-separation checks.What changed
Regression coverage
Added tests covering:
Security impact
This is a genesis/configuration integrity issue rather than a standalone permissionless exploit.
Without normalization, a malformed genesis configuration could represent the same underlying address/key bytes multiple times while bypassing string-based uniqueness or role-separation checks. This could result in unintended duplicate identities or role assignments during genesis construction.
The fix makes comparisons operate on the represented hexadecimal identity rather than its textual casing.
Validation
The regression tests are included in:
tests/unit/validator-manager-genesis-validation.test.tsThe full Arc toolchain was not executed in this environment. Before merging, run the repository's normal validation commands, including:
make test-unit-hardhatmake lintand attach/verify the resulting CI checks.
Scope
This PR is intentionally limited to genesis identity normalization and its regression coverage. EIP-7702 transaction-pool research was kept separate from this PR.