Skip to content

fix: derive Nexus EIP-712 domain version fallback from MEE version#205

Open
fichiokaku wants to merge 1 commit into
developfrom
fix/nexus-domain-version-fallback-by-mee-version
Open

fix: derive Nexus EIP-712 domain version fallback from MEE version#205
fichiokaku wants to merge 1 commit into
developfrom
fix/nexus-domain-version-fallback-by-mee-version

Conversation

@fichiokaku
Copy link
Copy Markdown
Contributor

@fichiokaku fichiokaku commented May 25, 2026

Summary

`NEXUS_DOMAIN_VERSION` is a static `"1.2.0"` string (Constants.ts:110) that's only correct for MEE versions backed by Nexus 1.2.0 (`V2_0_0`, `V2_1_0`). For any MEE `≥ V2_2_0` the Nexus domain version moved to the 1.3.x line, so the hardcoded constant produces signatures the on-chain Nexus contract rejects.

The bug surfaces in:

  • `getAccountMeta`'s fallback path — taken when `eip712Domain()` cannot be queried on-chain (e.g. for a counterfactual SCA whose factory isn't deployed yet).
  • `makeInstallDataAndHash`'s default `domainVersion` parameter.

Neither has production call sites in abstractjs (only tests + external consumers), so the runtime impact of this release is zero — this is a correctness fix for downstream users and a safer default for any future internal use.

What's added

A small helper `getNexusDomainVersion(meeVersionOrConfig)` that derives the correct version from the existing `MEEVersionConfig.accountId` field. The `accountId` is already formatted as `biconomy.nexus.<X.Y.Z>` and mirrors the on-chain `_domainNameAndVersion()` return — no new mapping is needed; abstractjs already has this data per MEE version in `DEFAULT_CONFIGURATIONS_BY_MEE_VERSION`.

```ts
getNexusDomainVersion(MEEVersion.V2_2_2) // → "1.3.2"
getNexusDomainVersion(MEEVersion.V2_2_1) // → "1.3.1"
getNexusDomainVersion(MEEVersion.V2_1_0) // → "1.2.0"
getNexusDomainVersion(getMEEVersion(MEEVersion.V2_2_2)) // → "1.3.2"
```

What's changed

File Change
`src/sdk/constants/index.ts` Add `getNexusDomainVersion` helper
`src/sdk/account/utils/Utils.ts` `getAccountMeta` gains an optional 3rd parameter `meeVersionOrConfig`; when supplied the fallback derives from it. Backwards-compatible — existing two-arg call sites still hit the legacy fallback. `makeInstallDataAndHash` docstring updated to point at the new helper.
`src/sdk/account/utils/Constants.ts` `NEXUS_DOMAIN_VERSION` marked `@deprecated` with migration guidance. Constant still exported for back-compat.

Why this matters

The production signing path in `signQuote.ts` already uses viem's `getEip712Domain` action which queries on-chain correctly, so the bug does not affect already-deployed accounts signed via the standard flow. Where it surfaces:

  1. Counterfactual SCA flows that need the domain version before `eip712Domain()` is queryable.
  2. External consumers importing `NEXUS_DOMAIN_VERSION` directly or calling `getAccountMeta` without overriding.
  3. Smart Session install-mode flows built on top of `makeInstallDataAndHash` that don't pass an explicit `domainVersion`.

Test plan

  • `bunx tsc --noEmit` clean — 0 errors
  • Existing tests pass on CI
  • Optional: add a unit test asserting `getNexusDomainVersion(MEEVersion.V2_2_2) === "1.3.2"` for each enum entry (kept out of this PR to keep scope tight — happy to add as a follow-up)

PR-Codex overview

This PR focuses on updating the handling of the Nexus EIP-712 domain version, introducing a new method for determining the correct version based on the MEE version, and deprecating the legacy constant.

Detailed summary

  • Added documentation for NEXUS_DOMAIN_VERSION indicating its deprecation.
  • Introduced getNexusDomainVersion function for determining the domain version based on MEE version.
  • Updated makeInstallDataAndHash to default to NEXUS_DOMAIN_NAME and warn about legacy version.
  • Enhanced getAccountMeta to use getNexusDomainVersion for determining the version if MEE version is provided.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

NEXUS_DOMAIN_VERSION is a static "1.2.0" string that's only correct for
MEE versions backed by Nexus 1.2.0 (V2_0_0, V2_1_0). For any MEE
≥ V2_2_0 the Nexus domain version moved to the 1.3.x line, so the
hardcoded constant produces signatures the on-chain Nexus contract
rejects. The bug surfaces in getAccountMeta's fallback path (taken
when eip712Domain() cannot be queried on-chain — e.g. for a
counterfactual SCA whose factory isn't deployed yet) and as the
default for makeInstallDataAndHash.

Add a small helper getNexusDomainVersion(meeVersionOrConfig) that
derives the correct version from the existing MEEVersionConfig.accountId
field (formatted "biconomy.nexus.<X.Y.Z>", mirroring on-chain
_domainNameAndVersion). No new mapping is needed — abstractjs already
has the accountId per MEE version in DEFAULT_CONFIGURATIONS_BY_MEE_VERSION.

- getAccountMeta gains an optional 3rd parameter meeVersionOrConfig;
  when supplied the fallback derives from it instead of the legacy
  constant. Backwards-compatible: existing call sites pass two args
  and continue to use the legacy fallback.
- makeInstallDataAndHash already exposes domainVersion as an optional
  parameter, so callers can pass getNexusDomainVersion(...) directly.
  Updated the docstring to call this out and warn about the default.
- NEXUS_DOMAIN_VERSION marked @deprecated; kept exported for back-compat.

No production call site in abstractjs uses either function (only
tests + external consumers), so the runtime impact is zero in this
release.
@github-actions
Copy link
Copy Markdown

size-limit report 📦

Path Size
core (esm) 71.97 KB (+0.02% 🔺)
core (cjs) 87.18 KB (+0.25% 🔺)
bundler (tree-shaking) 7.15 KB (+0.17% 🔺)
paymaster (tree-shaking) 543 B (0%)

@fichiokaku fichiokaku requested a review from vr16x May 25, 2026 22:14
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