Skip to content

feat(auth): add EIP-712 multisig signature verification - #3856

Open
VAIBHAVJINDAL3012 wants to merge 17 commits into
0xMiden:release/v0.16.0-rcfrom
inicio-labs:vaibhav/eip712-multisig-v0.16
Open

feat(auth): add EIP-712 multisig signature verification#3856
VAIBHAVJINDAL3012 wants to merge 17 commits into
0xMiden:release/v0.16.0-rcfrom
inicio-labs:vaibhav/eip712-multisig-v0.16

Conversation

@VAIBHAVJINDAL3012

Copy link
Copy Markdown
Contributor

Summary

This PR adds EIP-712 signature verification for ECDSA multisig approvers while preserving the existing raw-signature flow.

An ECDSA approver may provide either:

  • a raw signature over TX_SUMMARY_COMMITMENT; or
  • an EIP-712 signature over MidenTransaction(bytes32 txSummaryHash).

Falcon signatures continue using the existing raw path.

The implementation adds:

  • a reusable MASM verifier for generic EIP-712 digests;
  • a transaction-summary adapter that constructs the typed-data digest;
  • Rust helpers for deriving the digest and domain-separated advice-map key;
  • EIP-712 support across regular, smart, and guarded multisig verification.

Two existing responsibilities intentionally remain separate:

  • The raw path continues emitting AUTH_REQUEST_EVENT, while EIP-712 witnesses are supplied through a domain-separated advice-map entry. Reusing the event would require changing its existing stack contract and could break current hosts and authenticators.
  • verify_signature_by_scheme continues dispatching raw ECDSA and Falcon verification. EIP-712 uses a separate adapter because it is a message format—not a new signature scheme—and must first construct keccak256(0x1901 || domainSeparator || structHash). It then delegates to the existing ECDSA verifier.

Signed message

EIP712Domain {
    name: "Miden Multisig",
    version: "1"
}

MidenTransaction {
    bytes32 txSummaryHash
}

txSummaryHash is the transaction-summary commitment produced by the authentication component.

Security properties

  • Raw signatures remain unchanged and take precedence.
  • Each approver contributes at most once toward the threshold.
  • EIP-712 is accepted only for ecdsa_k256_keccak approvers.
  • Malformed witness lengths fail closed.
  • Signatures for another approver or transaction summary are rejected.
  • Existing replay protection remains unchanged.
  • Falcon and guardian-signature behavior remain unchanged.

Compatibility

The raw ECDSA and Falcon signature formats do not change.

Authentication procedure roots change for newly compiled multisig components. Existing deployed accounts retain their original account code.

Tests

Coverage includes:

  • raw, mixed raw/EIP-712, and all-EIP-712 multisig signing;
  • regular, smart, and guarded multisig accounts;
  • malformed witnesses and incorrect signature schemes;
  • raw/EIP-712 key-domain confusion;
  • cross-approver and cross-transaction-summary signatures;
  • duplicate witness and replay protection;
  • a fixed Ledger-compatible secp256k1 signature vector;
  • derivation checks for the EIP-712 constants.

Validated locally:

  • 41 regular multisig tests
  • 18 smart-multisig tests
  • 10 guarded-multisig tests
  • EIP-712 MASM and Rust unit tests

Scope

This first version signs only the transaction-summary commitment. Human-readable asset and transfer fields for Ledger clear signing are deferred to a follow-up.

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