Skip to content

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Sep 14, 2025

Toward snapshot-labs/sx-monorepo#1585

This PR adds support for verifying starknet messages signed by multiple signers.

This will enable verifying messages signed by argent x smart account wallets, with argent shield enabled (https://docs.ready.co/aa-use-cases/verifying-signatures-and-cosigners#verifying-multi-signatures)

Also adding a new hashtype for the new starknet alias payload, which is now following the SNIP-12 format (https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-12.md)

{
  StarkNetDomain: [
    { name: 'name', type: 'felt' },
    { name: 'version', type: 'felt' },
    { name: 'chainId', type: 'felt' }
  ],
  SetAlias: [
    { name: 'from', type: 'felt' },
    { name: 'alias', type: 'felt' },
    { name: 'timestamp', type: 'felt' }
  ]
}

How to test

  • Use this branch: feat: migrate offchain starknet signing to support SNIP-12 sx-monorepo#1588
  • Connect with an argent X smart account wallet
  • Create an alias (follow a space)
  • Sign the message
  • In the dev console, network tab, copy and send the sign payload to the starknet verify function (the sig array first element should be 0x2)
  • It should return true
  • Repeat with a standard wallet
  • It should also work
  • Repeat using the master branch
  • It should also work (does not break existing feature)

Note

We're only supporting SNIP-12 revision 0

Revision 1 require starknet.js v7, which require node >= 22

@wa0x6e wa0x6e force-pushed the feat-support-starknet-multiple-signers-signature branch 2 times, most recently from f5bfaff to 06ef71b Compare September 14, 2025 12:59
@wa0x6e wa0x6e requested a review from Copilot September 14, 2025 13:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for verifying Starknet messages signed by multiple signers, enabling verification of Argent X smart account wallets with Argent Shield. It introduces a new signature parsing function and updates the verification logic to handle multi-signer scenarios while maintaining backward compatibility.

Key changes:

  • Implements multi-signer signature verification for Starknet
  • Adds new hash type for SNIP-12 format alias payload
  • Maintains backward compatibility with existing single-signer verification

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/verify/starknet.ts Adds getSignatureArray function and updates verify logic to handle multi-signer signatures
src/verify/starknet.spec.ts Adds test coverage for multi-signer verification scenarios
test/fixtures/starknet/message-alias-multisigner.json New test fixture for multi-signer signature verification
src/sign/hashedTypes.json Adds new hash type for SNIP-12 format alias payload

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +56 to +60
test('should return true when verifying on a different network', () => {
expect(
verify(message.address, message.sig, message.data, 'SN_SEPOLIA')
).resolves.toBe(true);
});
Copy link
Member

Choose a reason for hiding this comment

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

why it will return true for different network 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the old behavior.

It's just highlighting that the behavior is different when there is a co-signer

Copy link
Member

Choose a reason for hiding this comment

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

Is it because normal signatures doesn't depend on network?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

verification always occur onchain, by calling a contract method. it's weird that it works

Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

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

tAck

@ChaituVR ChaituVR merged commit ce61ff0 into master Sep 15, 2025
7 of 8 checks passed
@ChaituVR ChaituVR deleted the feat-support-starknet-multiple-signers-signature branch September 15, 2025 18:40
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