Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
fac6311
feat: validate space strategies
wa0x6e Mar 9, 2025
09cde68
fix: duplicate request preventor for EIP-1271 requests (#515)
ChaituVR Mar 11, 2025
611e081
chore: increase follow limit for Turbo users (#516)
bonustrack Mar 11, 2025
4d8f1ad
fix: allow copeland on production (#517)
ChaituVR Mar 14, 2025
ae2a23f
feat: use unified API to check if SX space exists (#520)
Sekhmet Mar 24, 2025
badd12a
feat: add mnt, ape, curtis to networks whitelist (#521)
Sekhmet Mar 25, 2025
fd8ab6f
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.54 to 0.12.55 …
dependabot[bot] Mar 26, 2025
f30be53
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.55 to 0.12.56 …
dependabot[bot] Mar 26, 2025
3104246
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.56 to 0.12.57 …
dependabot[bot] Mar 28, 2025
c8121e9
feat: sync spaces custom domain with walletconnect allowed origins (#…
wa0x6e Mar 31, 2025
a1dee26
fix: prevent non-premium networks (#522)
ChaituVR Apr 2, 2025
a21aaca
fix: allow turbo spaces to create proposals with non-premuim networks…
ChaituVR Apr 3, 2025
da6af19
feat: use correct network when fetching shib space controller (#527)
wa0x6e Apr 14, 2025
ec30ecd
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.57 to 0.12.58 …
dependabot[bot] Apr 14, 2025
b6d764d
feat: add turbo tracking (#523)
pscott Apr 15, 2025
cf3719a
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.58 to 0.12.59 …
dependabot[bot] Apr 16, 2025
589cf8b
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.59 to 0.12.60 …
dependabot[bot] Apr 22, 2025
61578e2
chore: use pineapple gateway to get JSON on poke (#535)
ChaituVR Apr 24, 2025
dcde46a
fix: skip indexing from outdated schnaps api (#537)
wa0x6e Apr 25, 2025
5adf223
fix: assign fallback value (#538)
wa0x6e Apr 28, 2025
815b897
fix: infer turbo status from turbo expiration date (#539)
wa0x6e May 1, 2025
fa1b786
chore: mark eden-online-override strategy as overriding
bonustrack May 20, 2025
03b1ad7
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.60 to 0.12.62 …
dependabot[bot] May 21, 2025
35375df
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.62 to 0.12.63 …
dependabot[bot] Jun 4, 2025
1fc2775
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.63 to 0.12.64 …
dependabot[bot] Jun 10, 2025
94b079f
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.64 to 0.12.65 …
dependabot[bot] Jun 13, 2025
c81c533
chore(deps): bump @snapshot-labs/snapshot.js from 0.12.65 to 0.13.0 (…
dependabot[bot] Jun 18, 2025
155fe15
feat: add delay before finalizing proposal scores (#541)
wa0x6e Jun 22, 2025
f4d464f
refactor: remove unused requestEonKey function from shutter helper (#…
bigint Jun 29, 2025
b2a3b0c
feat: allow vote and proposal handling from starknet aliases (#542)
wa0x6e Jun 30, 2025
4321bc9
chore(deps): bump @snapshot-labs/snapshot.js from 0.13.0 to 0.14.1 (#…
dependabot[bot] Jun 30, 2025
190484e
fix: remove duplicate promisification of Pool and Connection in mysql…
bigint Jun 30, 2025
71535a7
feat: allow starknet aliases to flag proposals (#550)
wa0x6e Jun 30, 2025
b7ea17c
fix: add split-delegation to list of override strategies (#547)
wa0x6e Jun 30, 2025
7b25718
refactor: simplify retry logic in fetchWithRetry method (#553)
bigint Jul 1, 2025
2df80e6
chore(deps): bump @snapshot-labs/snapshot.js from 0.14.1 to 0.14.2 (#…
dependabot[bot] Jul 1, 2025
181ca38
fix: update `network` column to support starknet chain id (#558)
wa0x6e Jul 8, 2025
e8c87a2
chore(deps): bump @snapshot-labs/snapshot.js from 0.14.2 to 0.14.4 (#…
dependabot[bot] Jul 15, 2025
4dbcfeb
feat: prevent spaces from setting themselves as parent or child (#560)
ChaituVR Jul 16, 2025
1d1a24d
chore(deps): bump @snapshot-labs/snapshot.js from 0.14.4 to 0.14.5 (#…
dependabot[bot] Jul 17, 2025
c36e9d8
feat: add support for sonic domain name (#562)
wa0x6e Jul 21, 2025
271152c
chore: add sonic-staked-balance to override strategy (#568)
ChaituVR Aug 5, 2025
89b2188
chore: remove matic from sx (#573)
wa0x6e Aug 7, 2025
a45151a
chore(deps): bump @snapshot-labs/snapshot.js from 0.14.5 to 0.14.6 (#…
dependabot[bot] Aug 8, 2025
5e73cc2
chore(deps): bump @snapshot-labs/pineapple from 1.1.0 to 1.2.0 (#564)
dependabot[bot] Aug 8, 2025
ca67b26
chore(deps): bump @snapshot-labs/snapshot.js from 0.14.6 to 0.14.7 (#…
dependabot[bot] Aug 9, 2025
6195859
feat: validate space strategies
wa0x6e Mar 9, 2025
7eee9a6
chore: lint fix
wa0x6e Aug 12, 2025
ff9cae4
feat: validate space strategies
wa0x6e Mar 9, 2025
b17284f
chore: lint fix
wa0x6e Aug 12, 2025
ec91679
Merge branch 'master' into feat-validate-space-strategies
wa0x6e Aug 12, 2025
49162ef
refactor: better strategies handling
wa0x6e Aug 14, 2025
18c9919
fix: stop infinite loop on app shutdown
wa0x6e Aug 14, 2025
2eb90a5
refactor: remove magic number
wa0x6e Aug 14, 2025
e12e40c
fix: update error message to reflect disabled status
wa0x6e Aug 14, 2025
a8b3668
refactor: remove useless try/catch
wa0x6e Aug 15, 2025
c214894
test: reset mock after each test
wa0x6e Aug 15, 2025
6c57cdf
feat: only allow override strategies on pro spaces (#581)
wa0x6e Aug 19, 2025
e7f0ecf
Merge branch 'master' into feat-validate-space-strategies
ChaituVR Aug 19, 2025
ea54370
refactor: better filename to avoid confusion
wa0x6e Aug 20, 2025
e5e4e8c
fix: increase refresh interval to 5min
wa0x6e Aug 20, 2025
6fc5edb
fix: start express app only after loading all strategies
wa0x6e Aug 20, 2025
28e34f2
tests: mock strategies list
wa0x6e Aug 20, 2025
87184eb
Update src/helpers/strategies.ts
wa0x6e Aug 20, 2025
3fe0ba1
tests: fix race condition in E2E tests
wa0x6e Aug 20, 2025
87bb640
fix: strategy should honor the Strategy signature
wa0x6e Aug 20, 2025
83e61c8
fix: throw error on internal error from score-api
wa0x6e Aug 20, 2025
09ba5a1
fix: use getter to avoid reference invalidation
wa0x6e Aug 20, 2025
cb2a274
refactor: use default argument
wa0x6e Aug 20, 2025
01a27e4
fix: use single quote
wa0x6e Aug 22, 2025
35d40b7
fix: delay first strategies loop run
wa0x6e Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/writer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { addOrUpdateSpace, getSpace } from '../helpers/actions';
import log from '../helpers/log';
import db from '../helpers/mysql';
import { getLimit, getSpaceType } from '../helpers/options';
import { clearStampCache, DEFAULT_NETWORK, jsonParse } from '../helpers/utils';
import { clearStampCache, DEFAULT_NETWORK, fetchWithKeepAlive, jsonParse } from '../helpers/utils';

const SNAPSHOT_ENV = process.env.NETWORK || 'testnet';
const broviderUrl = process.env.BROVIDER_URL || 'https://rpc.snapshot.org';
const scoreAPIUrl = process.env.SCORE_API_URL || 'https://score.snapshot.org';

export async function validateSpaceSettings(originalSpace: any) {
const spaceType = originalSpace.turbo ? 'turbo' : 'default';
Expand Down Expand Up @@ -80,6 +81,26 @@ export async function verify(body): Promise<any> {
return Promise.reject(`max number of strategies is ${strategiesLimit}`);
}

try {
const strategiesList = await (await fetchWithKeepAlive(`${scoreAPIUrl}/api/strategies`)).json();

msg.payload.strategies
.map(strategy => strategy.name)
.forEach(strategyName => {
const strategy = strategiesList[strategyName];

if (!strategy) {
return Promise.reject(`strategy "${strategyName}" is not a valid strategy`);
}

if (strategy.disabled) {
return Promise.reject(`strategy "${strategyName}" has been deprecated`);
}
});
} catch (e) {
return Promise.reject('failed to validate strategies');
}

const controller = await snapshot.utils.getSpaceController(msg.space, DEFAULT_NETWORK, {
broviderUrl
});
Expand Down
7 changes: 5 additions & 2 deletions test/unit/writer/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ function randomStrategies(count = 1) {
return Array(count)
.fill(0)
.map(() => ({
name: `strategy-${Math.floor(Math.random() * 1000)}`
name: 'whitelist',
params: {
addresses: [`0x${Math.floor(Math.random() * 1000)}`]
}
}));
}

Expand Down Expand Up @@ -134,7 +137,7 @@ describe('writer/settings', () => {
it.todo('rejects if the submitter does not have permission to change admin');
const maxStrategiesForNormalSpace = LIMITS['space.default.strategies_limit'];
const maxStrategiesForTurboSpace = LIMITS['space.turbo.strategies_limit'];
it(`rejects if passing more than ${maxStrategiesForNormalSpace} strategies for normal space`, async () => {
it.only(`rejects if passing more than ${maxStrategiesForNormalSpace} strategies for normal space`, async () => {
return expect(
verify(
editedInput({
Expand Down