Skip to content

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Aug 15, 2025

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

This PR will reject space setting saving, as well as proposal creation, when a non pro space is using overriding strategies.

List of overriding strategies from https://score.snapshot.org/api/strategies

@wa0x6e wa0x6e requested a review from Copilot August 15, 2025 00:25
@wa0x6e wa0x6e changed the base branch from master to feat-validate-space-strategies August 15, 2025 00:25
Copilot

This comment was marked as outdated.

@wa0x6e wa0x6e requested a review from Copilot August 18, 2025 20:39
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 implements validation to restrict overriding strategies to pro (turbo) spaces only, addressing GitHub issue #631. The change ensures that non-pro spaces cannot use overriding strategies when saving space settings or creating proposals.

  • Added validation logic to reject overriding strategies for non-turbo spaces
  • Added comprehensive test coverage for both rejection and acceptance scenarios

Reviewed Changes

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

File Description
src/helpers/validation.ts Added validation check to reject overriding strategies for non-turbo spaces
test/unit/helpers/validation.test.ts Added test cases to verify override strategy validation for both turbo and non-turbo spaces

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

@wa0x6e wa0x6e requested a review from ChaituVR August 18, 2025 20:40
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

@wa0x6e wa0x6e merged commit 6c57cdf into feat-validate-space-strategies Aug 19, 2025
2 checks passed
@wa0x6e wa0x6e deleted the feat-overriding-strategies-for-non-pro branch August 19, 2025 11:00
wa0x6e added a commit that referenced this pull request Aug 22, 2025
* feat: validate space strategies

* fix: duplicate request preventor for EIP-1271 requests (#515)

* fix: duplicate request preventor for EIP-1271 requests

* fix test

* chore: increase follow limit for Turbo users (#516)

* chore: allows 50 follows for turbo users

* chore: allows 50 follows for turbo users

* fix: allow copeland on production (#517)

* fix: all copeland on production

* fix: remove unused variable

* feat: use unified API to check if SX space exists (#520)

* feat: add mnt, ape, curtis to networks whitelist (#521)

Updated mantle to mnt as it's new NetworkID for it.

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.54 to 0.12.55 (#524)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.54 to 0.12.55.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.54...v0.12.55)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.55 to 0.12.56 (#525)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.55 to 0.12.56.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.55...v0.12.56)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.56 to 0.12.57 (#526)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.56 to 0.12.57.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.56...v0.12.57)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: sync spaces custom domain with walletconnect allowed origins (#487)

* feat: sync spaces custom domain with walletconnect allowed origins

* refactor: better variable name

* Update .env.example

Co-authored-by: Less <[email protected]>

* chore: only use domain without protocol prefix

---------

Co-authored-by: Chaitanya <[email protected]>
Co-authored-by: Less <[email protected]>

* fix: prevent non-premium networks (#522)

* feat: prevent non-premium networks

* add testcases

* Improve network filtering and fix test case

* fix: allow turbo spaces to create proposals with non-premuim networks (#528)

* feat: use correct network when fetching shib space controller (#527)

* feat: use correct network when fetching shib space controller

* chore: use network realm instead of chain id

* fix: allow network param override

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.57 to 0.12.58 (#531)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.57 to 0.12.58.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.57...v0.12.58)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.58
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add turbo tracking (#523)

* feat: add turbo tracking every 10s

* fix: correct syntax for GetSpaces query

* ci: deactivate schnaps for tests

* refactor: rename to turbo_expiration

* chore: remove quotes around url in .env.example

Co-authored-by: Chaitanya <[email protected]>

* refactor: only track if SCHNAPS_API_URL is set

* chore: remove log

* chore: remove dead env var

Co-authored-by: Wan <[email protected]>

* refactor: move while loop out of if condition

Co-authored-by: Wan <[email protected]>

* lint: fix

* chore: remove track turbo status

* ci: move loop in if condition

* refactor: move while loop out of if condition

* fix: process only relevant spaces for the instance network

* fix: use sentry to capture errors

* fix: use fech with keep alive

* fix: fix invalid comparison

* docs: add note about future feature

* fix: only update `turbo_expiration` field

* fix: improve sql query

---------

Co-authored-by: Chaitanya <[email protected]>
Co-authored-by: Wan <[email protected]>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.58 to 0.12.59 (#532)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.58 to 0.12.59.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.58...v0.12.59)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.59
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.59 to 0.12.60 (#533)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.59 to 0.12.60.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.59...v0.12.60)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.60
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: use pineapple gateway to get JSON on poke (#535)

* fix: skip indexing from outdated schnaps api (#537)

* fix: assign fallback value (#538)

* fix: infer turbo status from turbo expiration date (#539)

* fix: infer turbo status from turbo expiration date

* fix: update schema.sql

* chore: mark eden-online-override strategy as overriding

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.60 to 0.12.62 (#540)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.60 to 0.12.62.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.60...v0.12.62)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.62
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.62 to 0.12.63 (#543)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.62 to 0.12.63.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.62...v0.12.63)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.63
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.63 to 0.12.64 (#544)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.63 to 0.12.64.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.63...v0.12.64)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.64
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.64 to 0.12.65 (#545)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.64 to 0.12.65.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.64...v0.12.65)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.12.65
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.12.65 to 0.13.0 (#546)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.65 to 0.13.0.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.12.65...v0.13.0)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add delay before finalizing proposal scores (#541)

* feat: add delay before finalising proposal scores

* Revert "feat: add delay before finalising proposal scores"

This reverts commit f174357.

* fix: add delay up to 1min after proposal close

* Update src/scores.ts

Co-authored-by: Chaitanya <[email protected]>

* Update src/scores.ts

* Update src/scores.ts

Co-authored-by: Chaitanya <[email protected]>

---------

Co-authored-by: Chaitanya <[email protected]>

* refactor: remove unused requestEonKey function from shutter helper (#549)

* feat: allow vote and proposal handling from starknet aliases (#542)

* feat: allow vote and proposal handling from starknet aliases

* Update src/helpers/alias.ts

Co-authored-by: Copilot <[email protected]>

* test: update test name

* feat: allow starknet aliases to update proposal

* test: test improvement

* fix: remove duplicate

* test: improve tests

* refactor: code improvement

* fix: fix invalid date comparison

* fix: allow optional alias to update proposal

* fix lint here for now

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Chaitanya <[email protected]>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.13.0 to 0.14.1 (#552)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.13.0 to 0.14.1.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.13.0...v0.14.1)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.14.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: remove duplicate promisification of Pool and Connection in mysql helper (#551)

Co-authored-by: Chaitanya <[email protected]>

* feat: allow starknet aliases to flag proposals (#550)

* feat: allow starknet aliases to flag proposals

* Update src/helpers/alias.ts

Co-authored-by: Chaitanya <[email protected]>

---------

Co-authored-by: Chaitanya <[email protected]>

* fix: add split-delegation to list of override strategies (#547)

* refactor: simplify retry logic in fetchWithRetry method (#553)

* fix: remove duplicate promisification of Pool and Connection in mysql helper

* refactor: simplify retry logic in fetchWithRetry method

---------

Co-authored-by: Chaitanya <[email protected]>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.14.1 to 0.14.2 (#556)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.14.1 to 0.14.2.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.14.1...v0.14.2)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.14.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: update `network` column to support starknet chain id (#558)

* chore(deps): bump @snapshot-labs/snapshot.js from 0.14.2 to 0.14.4 (#559)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.14.2 to 0.14.4.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.14.2...v0.14.4)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.14.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: prevent spaces from setting themselves as parent or child (#560)

- Add validation to prevent circular references in space hierarchy
- Reject when space.parent equals the space ID
- Reject when space.children array contains the space ID
- Add comprehensive tests for parent/child validation
- Ensure proper error messages for validation failures

* chore(deps): bump @snapshot-labs/snapshot.js from 0.14.4 to 0.14.5 (#561)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.14.4 to 0.14.5.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.14.4...v0.14.5)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.14.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add support for sonic domain name (#562)

* feat: add support for sonic domain name

* fix: fix wrong sonic network

* chore: add sonic-staked-balance to override strategy (#568)

* chore: remove matic from sx (#573)

* chore(deps): bump @snapshot-labs/snapshot.js from 0.14.5 to 0.14.6 (#565)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.14.5 to 0.14.6.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.14.5...v0.14.6)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.14.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wan <[email protected]>

* chore(deps): bump @snapshot-labs/pineapple from 1.1.0 to 1.2.0 (#564)

Bumps @snapshot-labs/pineapple from 1.1.0 to 1.2.0.

---
updated-dependencies:
- dependency-name: "@snapshot-labs/pineapple"
  dependency-version: 1.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wan <[email protected]>

* chore(deps): bump @snapshot-labs/snapshot.js from 0.14.6 to 0.14.7 (#575)

Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.14.6 to 0.14.7.
- [Release notes](https://github.com/snapshot-labs/snapshot.js/releases)
- [Commits](snapshot-labs/snapshot.js@v0.14.6...v0.14.7)

---
updated-dependencies:
- dependency-name: "@snapshot-labs/snapshot.js"
  dependency-version: 0.14.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: validate space strategies

* chore: lint fix

* feat: validate space strategies

* chore: lint fix

* refactor: better strategies handling

refactor:

refactor:

* fix: stop infinite loop on app shutdown

* refactor: remove magic number

* fix: update error message to reflect disabled status

* refactor: remove useless try/catch

* test: reset mock after each test

* feat: only allow override strategies on pro spaces (#581)

* refactor: better filename to avoid confusion

* fix: increase refresh interval to 5min

* fix: start express app only after loading all strategies

* tests: mock strategies list

* Update src/helpers/strategies.ts

Co-authored-by: Copilot <[email protected]>

* tests: fix race condition in E2E tests

* fix: strategy should honor the Strategy signature

* fix: throw error on internal error from score-api

* fix: use getter to avoid reference invalidation

* refactor: use default argument

* fix: use single quote

* fix: delay first strategies loop run

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Chaitanya <[email protected]>
Co-authored-by: Less <[email protected]>
Co-authored-by: Wiktor Tkaczyński <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pscott <[email protected]>
Co-authored-by: Yoginth <[email protected]>
Co-authored-by: Copilot <[email protected]>
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