Skip to content

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented May 25, 2025

Toward https://github.com/snapshot-labs/workflow/issues/562

This PR updates the schema and signing logic to accept and sign a payload submitted by starknet address alias

  • Allow starknet addresses as member (author, admin, moderator)
  • Allow starknet address in the from field of the payload
  • Update types for proposal, delete-proposal and vote- to have from field as string instead of address

Test

  • Create a proposal or vote payload with a starknet address in the from field.
  • Call the proposal or vote function with the corresponding payload
  • BEFORE: it return a UNSUPPORTED_OPERATION error
  • AFTER: it should sign and submit the message to sequencer

@wa0x6e wa0x6e requested a review from Copilot May 25, 2025 09:14
@wa0x6e wa0x6e marked this pull request as ready for review May 25, 2025 09:15
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 pull request updates the schema to support both EVM and Starknet addresses for members, admins, and moderators.

  • Updated the "members" property by replacing the single format with an anyOf clause that allows either EVM or Starknet addresses.
  • Applied similar changes to the "admins" and "moderators" properties.

@wa0x6e wa0x6e changed the title Update minor version (#1150) feat: allow starknet address as space members May 25, 2025
@wa0x6e wa0x6e requested review from ChaituVR and bonustrack May 25, 2025 09:16
@wa0x6e wa0x6e changed the title feat: allow starknet address as space members feat: allow starknet address in schema and when signing May 25, 2025
@wa0x6e wa0x6e force-pushed the feat-accept-starknet-address-in-space-settings branch from 3a853c5 to 334a89b Compare May 25, 2025 11:11
@wa0x6e wa0x6e force-pushed the feat-accept-starknet-address-in-space-settings branch from 334a89b to e0131fe Compare May 25, 2025 11:18
export const proposalTypes = {
Proposal: [
{ name: 'from', type: 'address' },
{ name: 'from', type: 'string' },
Copy link
Member

@bonustrack bonustrack May 26, 2025

Choose a reason for hiding this comment

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

Are we sure Starknet address doesn't work as address here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

using the address type return the following error:

Error: cannot resolve ENS names without a provider (operation="resolveName", value="", code=UNSUPPORTED_OPERATION, version=wallet/5.8.0)
    at Logger.makeError (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at /Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/wallet/lib/index.js:182:40
    at Function.<anonymous> (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/hash/lib/typed-data.js:422:46)
    at step (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/hash/lib/typed-data.js:33:23)
    at Object.next (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/hash/lib/typed-data.js:14:53)
    at /Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/hash/lib/typed-data.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/hash/lib/typed-data.js:4:12)
    at TypedDataEncoder.resolveNames (/Users/wan/Documents/GitHub/snapshot.js-bootstrap/node_modules/@ethersproject/hash/lib/typed-data.js:392:16) {
  reason: 'cannot resolve ENS names without a provider',
  code: 'UNSUPPORTED_OPERATION',
  operation: 'resolveName',
  value: ''
}

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 correct to say you are adding support for from as string but from as address is still available? We should not use string for Ethereum addresses ideally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it correct to say you are adding support for from as string but from as address is still available? We should not use string for Ethereum addresses ideally.

It will be always as string, from the sdk side. We validate the from with a getAddress before signing, so this field will always be a valid address when submitted.

People signing themselves, without the sdk and passing the types manually can continue signing using address

Comment on lines +70 to +71
"dd19ee4357e5bc813529e1b537b77ccb767135701f0223434f3b53f1ac03dcc6": "delete-proposal",
"817265460009cfdbde0752fcc7ef629ae7e05a6e8b6cbffab8a7cbf6cd19e87e": "delete-proposal",
Copy link
Member

Choose a reason for hiding this comment

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

Two new delete-proposal 🤔 i think only one should be added for current change

same for vote vote-string and vote-array, there are two added

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the duplicate one for proposal, vote- are there twice because of the Vote2 type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact no, duplicate proposals type are also legit, due to them being twice in the types.ts (Proposal2)

Copy link
Member

Choose a reason for hiding this comment

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

I think we should remove one, first one can be deprecated i think , but maybe in a different PR

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

utACK

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.

utAck

@wa0x6e wa0x6e merged commit 8bb09a1 into master Jun 17, 2025
4 checks passed
@wa0x6e wa0x6e deleted the feat-accept-starknet-address-in-space-settings branch June 17, 2025 23:34
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.

3 participants