Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.

refactor: always allow alias for all spaces#634

Merged
bonustrack merged 2 commits into
masterfrom
refactor/always-aliased-spaces
Apr 23, 2026
Merged

refactor: always allow alias for all spaces#634
bonustrack merged 2 commits into
masterfrom
refactor/always-aliased-spaces

Conversation

@bonustrack

@bonustrack bonustrack commented Apr 23, 2026

Copy link
Copy Markdown
Member

Closes snapshot-labs/workflow#793

Summary

  • Drop the space.voting.aliased opt-in — every space now accepts vote, proposal, update-proposal, delete-proposal signed by a valid alias of the author.
  • Promote flag-proposal to EVM (it was already allowed on Starknet via TYPES_EXECUTABLE_BY_STARKNET_ALIAS).

Kept the diff intentionally minimal (4 lines); the space.voting.aliased field on existing space settings is simply ignored, no migration needed. The three-bucket structure in alias.ts and the optionalAlias param stay for now — a follow-up PR can collapse them.

Test plan

  • yarn lint
  • yarn test (needs DB — run in CI)
  • Manual: with an (address=A, alias=B) row in aliases, submit a vote signed by B with message.from = A to a space without voting.aliased. Before: rejected. After: accepted.
  • Manual: submit a flag-proposal signed by an EVM alias of a space admin. Before: rejected. After: accepted.
  • Manual: submit a vote signed by B when (A, B) is missing from aliases → still rejected with wrong alias (regression check).

Follow-ups (separate PRs)

  • Collapse the three type buckets in alias.ts into one flat list; drop the now-always-true optionalAlias parameter.
  • Add signer column to votes / proposals, populated with body.address when it differs from message.from (#793).
  • Add type (user | agent) to the aliases table (#793).
  • Remove aliased from the voting object in the snapshot.js space JSON schema.

🤖 Generated with Claude Code

bonustrack and others added 2 commits April 23, 2026 14:09
Drop the space.voting.aliased opt-in so every space accepts
vote/proposal/update-proposal/delete-proposal signed by a valid
alias of the author. Promote flag-proposal to EVM as well (it was
already allowed on Starknet). See snapshot-labs/workflow#793.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Now that every space is aliased, the optional and Starknet-specific
buckets in alias.ts are redundant. Merge them into a single
TYPES_EXECUTABLE_BY_ALIAS list and drop the optionalAlias param,
isStarknetAddress, getAllowedTypes, and the memoization cache.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bonustrack
bonustrack requested a review from ChaituVR April 23, 2026 07:18
Comment thread src/helpers/alias.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't want to track the signer on vote, proposal etc? maybe in next PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This would require change in db but I want us to move faster on this and get this merged sooner than later. So yes, that would fit into another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we can add more test cases:

  • verifyAlias('vote', ...) with a valid alias in DB → resolves.
  • verifyAlias('proposal', ...) with a valid alias in DB → resolves.
  • verifyAlias('update-proposal', ...) with a valid alias in DB → resolves.
  • verifyAlias('delete-proposal', ...) with a valid alias in DB → resolves.
  • verifyAlias('flag-proposal', ...) with a valid EVM alias in DB → resolves (covers the Starknet → EVM promotion).
  • verifyAlias('vote', ...) when DB returns empty → rejects 'wrong alias'.
  • verifyAlias('settings', ...) with an alias pair → rejects 'alias not allowed for the type: settings' (already covered, keep).
  • verifyAlias('alias', ...) via alias signer → rejects (alias registration itself can't be aliased).
  • verifyAlias('vote', ...) where body.address === message.from → resolves without touching DB (no queryAsync call).

@bonustrack
bonustrack merged commit 5cb3d25 into master Apr 23, 2026
2 checks passed

@ChaituVR ChaituVR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utAck

@bonustrack
bonustrack deleted the refactor/always-aliased-spaces branch April 23, 2026 13:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants