fix: derive Nexus EIP-712 domain version fallback from MEE version#205
Open
fichiokaku wants to merge 1 commit into
Open
fix: derive Nexus EIP-712 domain version fallback from MEE version#205fichiokaku wants to merge 1 commit into
fichiokaku wants to merge 1 commit into
Conversation
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.
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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
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:
Test plan
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
NEXUS_DOMAIN_VERSIONindicating its deprecation.getNexusDomainVersionfunction for determining the domain version based on MEE version.makeInstallDataAndHashto default toNEXUS_DOMAIN_NAMEand warn about legacy version.getAccountMetato usegetNexusDomainVersionfor determining the version if MEE version is provided.