Skip to content

feat: mee 3.0.0, stx validator support#184

Merged
filmakarov merged 43 commits into
developfrom
feat/stx-validator-support
Feb 26, 2026
Merged

feat: mee 3.0.0, stx validator support#184
filmakarov merged 43 commits into
developfrom
feat/stx-validator-support

Conversation

@filmakarov

@filmakarov filmakarov commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Stx validator + p256 support

StxValidator Integration (MEE V3.0.0)

This PR integrates the new StxValidator from bcnmy/stx-contracts#18 into the SDK, introducing MEE version 3.0.0 with enhanced signature validation capabilities and P256 (secp256r1) signer support.

🎯 Overview

The StxValidator replaces MeeK1Validator in MEE V3.0.0, providing a more flexible and efficient validation system that supports multiple signature types and stateless validator architectures. This enables support for both traditional EOA signers and modern P256 signers used in passkeys and secure enclaves.

✨ Key Features

1. New StxValidator Module

  • Introduces toStxValidator() factory function supporting five signature modes:
    • simple - Basic supertransaction mode
    • no-stx - Regular userOps without supertransaction envelope
    • permit - ERC-2612 token permit approvals
    • on-chain - Pre-approved on-chain transactions
    • safe-sa - Safe multisig integration
  • Implements stateless validator architecture with configurable ownership data
  • Full ERC-7739 compliance for PersonalSign and TypedDataSign flows
  • Smart stub signature generation based on mode and merkle tree size

2. P256 (secp256r1) Signer Support

  • New toP256Signer() utility creates viem-compatible LocalAccount for P256 keys
  • Enables passkey and secure enclave integration for smart accounts
  • Automatic detection and handling of P256 signers throughout the SDK
  • Custom signature prefixes (0x177eee12, 0x177eee10) for P256 validation
  • Direct hash signing for userOps (no toEthSignedMessageHash wrapping)
  • Extracts ownership data as x || y coordinates from public key

3. Ownership Management System

  • New decorator module for managing multiple ownership types across chains
  • addOwnership() - Register new ownership on StxValidator
  • changeOwnership() - Update existing ownership with validation
  • cleanOwnership() - Remove ownership data
  • getOwnership() - Query current ownership state
  • Supports ownership types: eoa, p256, safe, or custom validator addresses
  • Multi-chain operations with selective chain targeting

4. Signature Format Changes

For MEE V3.0.0:

  • P256 signatures wrapped with mode prefix: 0x177eee12 + signature
  • Vanilla EIP-1271 requires explicit mode flags to bypass ERC-7739
  • New signMessage1271() method for pure 1271 flows (never uses 7739)
  • Permit mode data packing changed from split (v,r,s) to raw signature bytes

PR-Codex overview

This PR focuses on enhancing the StxValidator integration, introducing support for P256 signers, and updating various modules and tests for improved functionality and compatibility across different MEE versions.

Detailed summary

  • Added exports for StxValidator in multiple files.
  • Introduced signUserOperationHash method for signing user operation hashes.
  • Updated toDefaultModule to conditionally use StxValidator.
  • Enhanced ownership management methods in the StxValidator.
  • Introduced P256 signer functionality, including a new toP256Signer utility.
  • Updated tests to cover new features and ensure backward compatibility across MEE versions.
  • Adjusted size limits in size-limit.json.
  • Updated package.json to include @noble/curves.
  • Added integration tests for various modes, ensuring functionality across different MEE versions.

The following files were skipped due to too many changes: src/sdk/account/toNexusAccount.ts, src/sdk/account/decorators/ownership.ts, src/sdk/clients/decorators/mee/signPermitQuote.test.ts, src/sdk/clients/decorators/mee/signSafeQuote.test.ts, bun.lock, src/sdk/modules/validators/stxValidator/toStxValidator.ts, src/sdk/integration-tests/mee-versions/safe-mode.integration.test.ts, src/sdk/integration-tests/mee-versions/no-stx.integration.test.ts, src/sdk/account/toNexusAccount.test.ts, src/sdk/account/decorators/ownership.test.ts, src/sdk/modules/validators/stxValidator/toStxValidator.test.ts

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

@github-actions

github-actions Bot commented Feb 10, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
core (esm) 78.53 KB (+20.16% 🔺)
core (cjs) 98.97 KB (+24.29% 🔺)
bundler (tree-shaking) 7 KB (+5.23% 🔺)
paymaster (tree-shaking) 543 B (0%)

Comment thread src/test/vitest.config.ts Outdated
Comment thread src/sdk/account/decorators/ownership.ts
Comment thread src/sdk/account/decorators/ownership.ts
Comment thread src/sdk/account/decorators/ownership.test.ts Outdated
Comment thread src/sdk/account/utils/getVersion.ts Outdated
Comment thread src/sdk/account/toNexusAccount.ts
Comment thread src/sdk/account/toNexusAccount.ts
Comment thread src/sdk/account/toNexusAccount.ts
Comment thread src/sdk/account/toNexusAccount.ts Outdated
Comment thread src/sdk/account/decorators/ownership.test.ts
* ```
*/
export const formatSignedPermitQuotePayload = (
account_: MultichainSmartAccount,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These kind of functions (prepareSignable payload variant and formatSignedQuote) are intentionally designed for modularity and it should strictly avoid nexus account being passed as param.

If so, it loses its ability to work independently in backend system without nexus.

You can pass it as params instead of the whole account

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can pass it as params instead of the whole account

by 'it' you mean what exactly?

p.s. do we even need this 'ability to work independently in backend system' yet?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean what ever you're dependent on mcNexusAccount such as meeVersions and etc.. You can pass it as params

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we use this independently in STX api

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in a merged branch #187

Comment thread src/sdk/modules/validators/stxValidator/toStxValidator.ts
Comment thread src/sdk/integration-tests/mee-versions/simple-mode.integration.test.ts Outdated
Comment thread src/sdk/integration-tests/mee-versions/no-stx.integration.test.ts Outdated

@vr16x vr16x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core integration seems good, just added some questions and comments.

@vr16x vr16x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@vr16x vr16x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triggering paid tests

* chore: fix tests to use proper quote type

* chore: fix import

---------

Co-authored-by: Filipp Makarov <fmc@Filipps-MacBook-Pro.local>

@vr16x vr16x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paid tests

@filmakarov
filmakarov merged commit 449863f into develop Feb 26, 2026
5 of 6 checks passed
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.

2 participants