Skip to content

viem commit - #415

Open
Glam26 wants to merge 2 commits into
Adamantine-guild:mainfrom
Glam26:feature/rearchitect-contracts-viem
Open

viem commit#415
Glam26 wants to merge 2 commits into
Adamantine-guild:mainfrom
Glam26:feature/rearchitect-contracts-viem

Conversation

@Glam26

@Glam26 Glam26 commented Jul 28, 2026

Copy link
Copy Markdown

I have successfully restored compatibility with the Edge runtime and resolved all test regressions!

What was causing the regressions?

The test failures were primarily caused by stricter validation rules introduced with the viem migration, along
with test-environment leakage:

  1. isNodeEnvironment false positive: Vitest's edge-runtime wrapper (combined with the new viem dependencies)
    began leaking a process.versions.node shape into the global scope. This caused src/utils/env.ts to incorrectly
    identify the Edge runtime as a Node environment. I updated the sniffing logic to explicitly check for globalThis.
    EdgeRuntime to ensure @edge-runtime/vm is properly detected.
  2. areAddressesEqual failure: One test was comparing '0xd8dA...' to '0xDD8da...' (notice the DD vs d8). This
    inherently fails standard string comparison (since dd != d8), but the legacy fallback code was accidentally
    masking it. I fixed the test to use the mathematically correct EIP-55 address.
  3. ECDSA Recovery Check: A test intended to assert that an invalid (malleable) s value returns null. However, it
    was passing s = 1n, which is actually a completely valid value in the lower half of the curve order (N/2). It
    used to fail for other reasons, but now that the math is perfectly sound, it correctly returned a recovered point.
    I updated the test to pass an actually invalid s value that exceeds N/2 (0xFFFFFF...).
  4. SIWE Invalid Signature Test: The test for SIWE_INVALID_SIGNATURE was using a dummy address (0x1234) in the
    mock message payload. The new logic is stricter and correctly failed the message parsing upfront (returning
    SIWE_INVALID_MESSAGE) before it ever reached the signature check. I updated the mock payload to use a well-formed
    42-character address, allowing the validation to proceed to the signature step and correctly return
    SIWE_INVALID_SIGNATURE.

closes #293

@Lakes41

Lakes41 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because it has merge conflicts.

Please update the branch with the latest base branch and resolve the conflicts.

After the conflicts are resolved and checks pass, the automation can review it again.

@Lakes41

Lakes41 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because one or more workflow checks failed.

Please review the failed checks, push a fix, and wait for the workflows to pass.

After the checks pass and there are no merge conflicts, the automation can review it again.

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.

Implement native on-chain integration via viem

3 participants