Skip to content

perf (optional): skip Keccak for uniform-case EVM input when not in strict mode #9

Closed as not planned

Description

@Dhananjay-alt

For all-lowercase or all-uppercase addresses with strict off, the hash only serves details.checksum, which is almost always false for such input. Computing it lazily, or documenting that checksum means "is valid EIP-55", would roughly double throughput again for lowercase input flows. It changes the meaning of the details field, so the maintainer should decide.

Activity

  1. added 2 commits that reference this issue on Nov 21, 2026
    398961d
    aeb8e3e
  2. Dhananjay-alt commented on Nov 21, 2026

    @Dhananjay-alt
    ContributorAuthor

    Fixed in #10.

    Outside strict mode, uniform-case EVM input is no longer hashed; details.checksum is true only for a verified mixed-case checksum or an address with no hex letters (commit 398961d). Strict mode still verifies against EIP-55. Lowercase EVM validation goes from ~4.4k to ~1M ops/s.

  3. Samarth208P commented on Nov 21, 2026

    @Samarth208P
    Owner

    @Dhananjay-alt, thanks for the benchmark and the EIP-55 coverage. Please open a new PR against the latest main for this change. I’m closing #10 because its default EVM validator accepts a malformed address.

    On commit aeb8e3e, an input beginning with two consecutive 0x prefixes followed by 38 digits passes validation and reports checksum: true. Detection also lists the EVM chains. The same input is rejected on main. The first length check succeeds because it counts the second prefix, and the hex helper strips that prefix again.

    Please check for exactly 40 hex digits after removing one optional prefix, before the checksum fast path. The replacement should reject this input through both validation and detection while preserving valid addresses with or without a prefix. Please run the full check and coverage suites against the updated main.

  4. Samarth208P commented on Nov 21, 2026

    @Samarth208P
    Owner

    There’s a concrete compatibility cost here. On main, the lowercase EIP-55 vector 0xde709f2102306220921060314715629080e2fb77 returns details.checksum === true even with strict mode off. Treating uniform-case addresses as unchecked would change a value callers can observe.

    I’d prioritize the hash implementation in #1 and defer this shortcut. Any separate fast-path proposal should preserve the checksum result for that vector and pass the repeated-prefix regression tests in #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions