From 6b3c021013b015da0aad4bec9a5941cde4efcf63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 13:19:59 +0530 Subject: [PATCH 01/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.32 to 0.12.33 (#474) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.32 to 0.12.33. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.32...v0.12.33) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e20bd6ba..8fbb0e79 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.32", + "@snapshot-labs/snapshot.js": "^0.12.33", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index e0ea04bf..aabc1b2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.32": - version "0.12.32" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.32.tgz#a92522c8563cf9849706ba6ea5592672aba8adde" - integrity sha512-GRmGMjcR8qdRE94QydVQVPf93lKjJp+J/ISoSTVp3oxKrkBEzY0DZx9gFlysBqF/h69PEeykJWUOH1YfQocYHw== +"@snapshot-labs/snapshot.js@^0.12.33": + version "0.12.33" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.33.tgz#3ce3166419931ef31f1070449318b98b9c482078" + integrity sha512-N5diNuGsglbcQ/t63EdnpUvl2bQO6TerpJE4bA+QHCEoqy/XQdqUjksosn/MWKt1gQfBjTYiN3aPGV4uj1mspA== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From beb8630cd802ff838a0e748d2a03c90d37357442 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Sat, 30 Nov 2024 20:31:42 +0530 Subject: [PATCH 02/14] feat: privacy field in proposal data (#467) * feat: privacy field in proposal data * handle update-proposal * Rename author-selection to any * merge two if into single if * pass privacy from ingestor * refactor --- src/ingestor.ts | 2 ++ src/writer/proposal.ts | 10 +++++++++- src/writer/update-proposal.ts | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/ingestor.ts b/src/ingestor.ts index 5a503251..893125ef 100644 --- a/src/ingestor.ts +++ b/src/ingestor.ts @@ -143,6 +143,7 @@ export default async function ingestor(req) { body: message.body, discussion: message.discussion || '', choices: message.choices, + privacy: message.privacy || '', labels: message.labels || [], start: message.start, end: message.end, @@ -169,6 +170,7 @@ export default async function ingestor(req) { name: message.title, body: message.body, discussion: message.discussion || '', + privacy: message.privacy || '', choices: message.choices, labels: message.labels || [], metadata: { diff --git a/src/writer/proposal.ts b/src/writer/proposal.ts index 59fdd79d..f3b28ad8 100644 --- a/src/writer/proposal.ts +++ b/src/writer/proposal.ts @@ -103,6 +103,10 @@ export async function verify(body): Promise { if (msg.payload.type !== space.voting.type) return Promise.reject('invalid voting type'); } + if (space.voting?.privacy !== 'any' && msg.payload.privacy) { + return Promise.reject('not allowed to set privacy'); + } + try { if (await isMalicious(msg.payload, space.id)) { return Promise.reject('invalid proposal content'); @@ -207,6 +211,10 @@ export async function action(body, ipfs, receipt, id): Promise { const plugins = JSON.stringify(metadata.plugins || {}); const spaceNetwork = spaceSettings.network; const proposalSnapshot = parseInt(msg.payload.snapshot || '0'); + let privacy = spaceSettings.voting?.privacy || ''; + if (privacy === 'any') { + privacy = msg.payload.privacy; + } let quorum = spaceSettings.voting?.quorum || 0; if (!quorum && spaceSettings.plugins?.quorum) { @@ -238,7 +246,7 @@ export async function action(body, ipfs, receipt, id): Promise { end: parseInt(msg.payload.end || '0'), quorum, quorum_type: (quorum && spaceSettings.voting?.quorumType) || '', - privacy: spaceSettings.voting?.privacy || '', + privacy, snapshot: proposalSnapshot || 0, app: kebabCase(msg.payload.app || ''), scores: JSON.stringify([]), diff --git a/src/writer/update-proposal.ts b/src/writer/update-proposal.ts index 2f63463b..8d187786 100644 --- a/src/writer/update-proposal.ts +++ b/src/writer/update-proposal.ts @@ -49,6 +49,10 @@ export async function verify(body): Promise { if (proposal.author !== body.address) return Promise.reject('Not the author'); + if (space.voting?.privacy !== 'any' && msg.payload.privacy) { + return Promise.reject('not allowed to set privacy'); + } + const spaceUpdateError = getSpaceUpdateError({ type: msg.payload.type, space @@ -63,6 +67,11 @@ export async function action(body, ipfs): Promise { const updated = parseInt(msg.timestamp); const metadata = msg.payload.metadata || {}; const plugins = JSON.stringify(metadata.plugins || {}); + const spaceSettings = await getSpace(msg.space); + let privacy = spaceSettings.voting?.privacy || ''; + if (privacy === 'any') { + privacy = msg.payload.privacy; + } const proposal = { ipfs, @@ -74,6 +83,7 @@ export async function action(body, ipfs): Promise { discussion: msg.payload.discussion, choices: JSON.stringify(msg.payload.choices), labels: msg.payload.labels?.length ? JSON.stringify(msg.payload.labels) : null, + privacy, scores: JSON.stringify([]), scores_by_strategy: JSON.stringify([]), flagged: +containsFlaggedLinks(msg.payload.body) From 2af5897c3ced6f0dfa8bfc033aff0f27e798d5d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:46:44 +0530 Subject: [PATCH 03/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.33 to 0.12.34 (#476) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.33 to 0.12.34. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.33...v0.12.34) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8fbb0e79..7c5a9879 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.33", + "@snapshot-labs/snapshot.js": "^0.12.34", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index aabc1b2d..c89630a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.33": - version "0.12.33" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.33.tgz#3ce3166419931ef31f1070449318b98b9c482078" - integrity sha512-N5diNuGsglbcQ/t63EdnpUvl2bQO6TerpJE4bA+QHCEoqy/XQdqUjksosn/MWKt1gQfBjTYiN3aPGV4uj1mspA== +"@snapshot-labs/snapshot.js@^0.12.34": + version "0.12.34" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.34.tgz#8b5714917a9c9d37a1ae2966c1a71c412458426f" + integrity sha512-wIps5J2UwRhATKQAikuzuWuyoW0l6R92jgIttq/EX003GyDKIWEToIte2m9eWJc7VSX4czdsg1F8g72TrPDP+A== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From 0c82c4e3d1e82fcdfcaf5234356ca4d64d7bb7bb Mon Sep 17 00:00:00 2001 From: Wan <495709+wa0x6e@users.noreply.github.com> Date: Sat, 7 Dec 2024 10:42:44 +0800 Subject: [PATCH 04/14] feat: accept longer app property (#463) * feat: accept longer app property * fix: delegate app validation to schema * fix: revert app chars limit to 24 --- src/ingestor.ts | 5 ++--- src/writer/proposal.ts | 3 +-- src/writer/vote.ts | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ingestor.ts b/src/ingestor.ts index 893125ef..61a99986 100644 --- a/src/ingestor.ts +++ b/src/ingestor.ts @@ -4,7 +4,6 @@ import { capture } from '@snapshot-labs/snapshot-sentry'; import snapshot from '@snapshot-labs/snapshot.js'; import hashTypes from '@snapshot-labs/snapshot.js/src/sign/hashedTypes.json'; import castArray from 'lodash/castArray'; -import kebabCase from 'lodash/kebabCase'; import { getProposal, getSpace } from './helpers/actions'; import { isValidAlias } from './helpers/alias'; import envelope from './helpers/envelope.json'; @@ -152,7 +151,7 @@ export default async function ingestor(req) { plugins: JSON.parse(message.plugins) }, type: message.type, - app: kebabCase(message.app || '') + app: message.app || '' }; if (type === 'alias') payload = { alias: message.alias }; if (type === 'statement') @@ -202,7 +201,7 @@ export default async function ingestor(req) { proposal: message.proposal, choice, reason: message.reason || '', - app: kebabCase(message.app || ''), + app: message.app || '', metadata: jsonParse(message.metadata, {}) }; type = 'vote'; diff --git a/src/writer/proposal.ts b/src/writer/proposal.ts index f3b28ad8..b61bc987 100644 --- a/src/writer/proposal.ts +++ b/src/writer/proposal.ts @@ -1,7 +1,6 @@ import { capture } from '@snapshot-labs/snapshot-sentry'; import snapshot from '@snapshot-labs/snapshot.js'; import networks from '@snapshot-labs/snapshot.js/src/networks.json'; -import kebabCase from 'lodash/kebabCase'; import { validateSpaceSettings } from './settings'; import { getSpace } from '../helpers/actions'; import { ACTIVE_PROPOSAL_BY_AUTHOR_LIMIT, getSpaceLimits } from '../helpers/limits'; @@ -248,7 +247,7 @@ export async function action(body, ipfs, receipt, id): Promise { quorum_type: (quorum && spaceSettings.voting?.quorumType) || '', privacy, snapshot: proposalSnapshot || 0, - app: kebabCase(msg.payload.app || ''), + app: msg.payload.app, scores: JSON.stringify([]), scores_by_strategy: JSON.stringify([]), scores_state: 'pending', diff --git a/src/writer/vote.ts b/src/writer/vote.ts index b047a93b..e86bac72 100644 --- a/src/writer/vote.ts +++ b/src/writer/vote.ts @@ -1,5 +1,4 @@ import snapshot from '@snapshot-labs/snapshot.js'; -import kebabCase from 'lodash/kebabCase'; import { getProposal } from '../helpers/actions'; import log from '../helpers/log'; import db from '../helpers/mysql'; @@ -108,7 +107,7 @@ export async function action(body, ipfs, receipt, id, context): Promise { const created = parseInt(msg.timestamp); const choice = JSON.stringify(msg.payload.choice); const metadata = JSON.stringify(msg.payload.metadata || {}); - const app = kebabCase(msg.payload.app || ''); + const app = msg.payload.app; const reason = msg.payload.reason || ''; const proposalId = msg.payload.proposal; From 9480369b6259975b9ca3a16b483c3f43d27351c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 22:19:07 +0530 Subject: [PATCH 05/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.34 to 0.12.36 (#478) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.34 to 0.12.36. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.34...v0.12.36) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7c5a9879..781b5381 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.34", + "@snapshot-labs/snapshot.js": "^0.12.36", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index c89630a1..54c6d17a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.34": - version "0.12.34" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.34.tgz#8b5714917a9c9d37a1ae2966c1a71c412458426f" - integrity sha512-wIps5J2UwRhATKQAikuzuWuyoW0l6R92jgIttq/EX003GyDKIWEToIte2m9eWJc7VSX4czdsg1F8g72TrPDP+A== +"@snapshot-labs/snapshot.js@^0.12.36": + version "0.12.36" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.36.tgz#89ff38be1b2ab2b239ab5caf0b20c5c4e65eed4e" + integrity sha512-cCwX8mLattshjMLzb731DWDQ8/D0uHINBjTNyFhdyxwW/7B1Dr4wAIQHR+iXwJDA3aiqDJPIP6llD1HRRllvBQ== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From f8836aef4892b708c39b015fd31f5304788e79f2 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Mon, 9 Dec 2024 16:11:12 +0530 Subject: [PATCH 06/14] fix: Increase timestamp check to 5 days (#479) --- src/ingestor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ingestor.ts b/src/ingestor.ts index 61a99986..408f3b1f 100644 --- a/src/ingestor.ts +++ b/src/ingestor.ts @@ -55,7 +55,7 @@ export default async function ingestor(req) { const formattedSignature = castArray(body.sig).join(','); const ts = Date.now() / 1e3; const over = 300; - const under = 60 * 60 * 24 * 3; // 3 days + const under = 60 * 60 * 24 * 5; // 5 days const overTs = (ts + over).toFixed(); const underTs = (ts - under).toFixed(); const { domain, message, types } = body.data; From 0f7f5ad547ccdbfce9f7c24c090a4074f8e516f7 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Mon, 9 Dec 2024 16:45:12 +0530 Subject: [PATCH 07/14] fix: Increase timestamp check to 6 days (#480) --- src/ingestor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ingestor.ts b/src/ingestor.ts index 408f3b1f..192595a2 100644 --- a/src/ingestor.ts +++ b/src/ingestor.ts @@ -55,7 +55,7 @@ export default async function ingestor(req) { const formattedSignature = castArray(body.sig).join(','); const ts = Date.now() / 1e3; const over = 300; - const under = 60 * 60 * 24 * 5; // 5 days + const under = 60 * 60 * 24 * 6; // 6 days const overTs = (ts + over).toFixed(); const underTs = (ts - under).toFixed(); const { domain, message, types } = body.data; From 8ef502337339afe02b7b2fd7b9a425bfee3efbdf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:10:32 +0530 Subject: [PATCH 08/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.36 to 0.12.37 (#481) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.36 to 0.12.37. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.36...v0.12.37) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 781b5381..d517c3f6 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.36", + "@snapshot-labs/snapshot.js": "^0.12.37", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index 54c6d17a..b25ebf08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.36": - version "0.12.36" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.36.tgz#89ff38be1b2ab2b239ab5caf0b20c5c4e65eed4e" - integrity sha512-cCwX8mLattshjMLzb731DWDQ8/D0uHINBjTNyFhdyxwW/7B1Dr4wAIQHR+iXwJDA3aiqDJPIP6llD1HRRllvBQ== +"@snapshot-labs/snapshot.js@^0.12.37": + version "0.12.37" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.37.tgz#13fa2037c9ffb9d6a3262a43bd8970a6128ac240" + integrity sha512-tsK6Ef2KDqnInYcZNcnjLV9GBpa8jralutMc4beQexr74SQ34NPshlKah0OeaXxkM6cdtFbQH6bXLUXwz1hBhg== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From 3707cf7ac7c7b7e797070a5817d014030bded559 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:45:37 +0530 Subject: [PATCH 09/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.37 to 0.12.38 (#482) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.37 to 0.12.38. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.37...v0.12.38) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d517c3f6..547d79c9 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.37", + "@snapshot-labs/snapshot.js": "^0.12.38", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index b25ebf08..244ac838 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.37": - version "0.12.37" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.37.tgz#13fa2037c9ffb9d6a3262a43bd8970a6128ac240" - integrity sha512-tsK6Ef2KDqnInYcZNcnjLV9GBpa8jralutMc4beQexr74SQ34NPshlKah0OeaXxkM6cdtFbQH6bXLUXwz1hBhg== +"@snapshot-labs/snapshot.js@^0.12.38": + version "0.12.38" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.38.tgz#e30bdb5218bd73cc961fb7b60c68cbf322321cd8" + integrity sha512-qbN+WPZW+XUr4icFsNhVrqR/mPLCz0XVEOBnN1RJBrzKhMYPgUNwjGBOA0jaIfYKQaD94vMxrhQWKoQud/yIJA== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From 7a66f6da6c972b9c5d6c93d956df03fdd3b9e95b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:17:09 +0530 Subject: [PATCH 10/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.38 to 0.12.39 (#483) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.38 to 0.12.39. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.38...v0.12.39) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 547d79c9..28b8072a 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.38", + "@snapshot-labs/snapshot.js": "^0.12.39", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index 244ac838..d8e82584 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.38": - version "0.12.38" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.38.tgz#e30bdb5218bd73cc961fb7b60c68cbf322321cd8" - integrity sha512-qbN+WPZW+XUr4icFsNhVrqR/mPLCz0XVEOBnN1RJBrzKhMYPgUNwjGBOA0jaIfYKQaD94vMxrhQWKoQud/yIJA== +"@snapshot-labs/snapshot.js@^0.12.39": + version "0.12.39" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.39.tgz#c64796aa58ec4fef4063daab4ceb173d7fc5ad95" + integrity sha512-yKTffnft7cdoSTYH8ceQxFMjghE2ycrtGWbkC5ZBEWHuP81ZfR+ZNjlWM0TtnNM87A3umhbW1wKCJ0tgn/JAFQ== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From c0b60e7b0d188518c92903bdec559050d2edda7d Mon Sep 17 00:00:00 2001 From: Less Date: Fri, 20 Dec 2024 20:34:00 +0700 Subject: [PATCH 11/14] feat: add BASE network id --- src/helpers/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts index 53f5bdf1..c4ccf157 100644 --- a/src/helpers/utils.ts +++ b/src/helpers/utils.ts @@ -8,7 +8,7 @@ import snapshot from '@snapshot-labs/snapshot.js'; import { Response } from 'express'; import fetch from 'node-fetch'; -const MAINNET_NETWORK_ID_WHITELIST = ['s', 'eth', 'matic', 'arb1', 'oeth', 'sn']; +const MAINNET_NETWORK_ID_WHITELIST = ['s', 'eth', 'matic', 'arb1', 'oeth', 'sn', 'base']; const TESTNET_NETWORK_ID_WHITELIST = ['s-tn', 'sep', 'linea-testnet', 'sn-sep']; const broviderUrl = process.env.BROVIDER_URL ?? 'https://rpc.snapshot.org'; From 760ae06fa12681d4f9e7a043199aef77b05c401b Mon Sep 17 00:00:00 2001 From: Less Date: Fri, 20 Dec 2024 20:34:52 +0700 Subject: [PATCH 12/14] feat: add BASE subgraph URL --- src/helpers/actions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helpers/actions.ts b/src/helpers/actions.ts index 09fbe832..3530761a 100644 --- a/src/helpers/actions.ts +++ b/src/helpers/actions.ts @@ -82,6 +82,7 @@ export async function sxSpaceExists(network: string, spaceId: string): Promise Date: Fri, 3 Jan 2025 22:33:00 +0530 Subject: [PATCH 13/14] chore(deps): bump @snapshot-labs/snapshot.js from 0.12.39 to 0.12.41 (#485) Bumps [@snapshot-labs/snapshot.js](https://github.com/snapshot-labs/snapshot.js) from 0.12.39 to 0.12.41. - [Release notes](https://github.com/snapshot-labs/snapshot.js/releases) - [Commits](https://github.com/snapshot-labs/snapshot.js/compare/v0.12.39...v0.12.41) --- updated-dependencies: - dependency-name: "@snapshot-labs/snapshot.js" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 28b8072a..283903b2 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@snapshot-labs/pineapple": "^1.1.0", "@snapshot-labs/snapshot-metrics": "^1.4.1", "@snapshot-labs/snapshot-sentry": "^1.5.5", - "@snapshot-labs/snapshot.js": "^0.12.39", + "@snapshot-labs/snapshot.js": "^0.12.41", "bluebird": "^3.7.2", "connection-string": "^1.0.1", "cors": "^2.8.5", diff --git a/yarn.lock b/yarn.lock index d8e82584..b289c658 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,10 +1350,10 @@ dependencies: "@sentry/node" "^7.81.1" -"@snapshot-labs/snapshot.js@^0.12.39": - version "0.12.39" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.39.tgz#c64796aa58ec4fef4063daab4ceb173d7fc5ad95" - integrity sha512-yKTffnft7cdoSTYH8ceQxFMjghE2ycrtGWbkC5ZBEWHuP81ZfR+ZNjlWM0TtnNM87A3umhbW1wKCJ0tgn/JAFQ== +"@snapshot-labs/snapshot.js@^0.12.41": + version "0.12.41" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.12.41.tgz#3a0a2866a78f14368eb0648ef2e22a8e66422b26" + integrity sha512-Deikl21gUzeY/2TE8xTNsHbwTNcSqvxDnrzA1LcLwyqAzA6tigwNBlqaS5E35v7t5z7Iz62j+CPEFzxv1ta6cA== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4" From 640b7e5251db61c1052761fea344cdbab1e5307a Mon Sep 17 00:00:00 2001 From: Wan <495709+wa0x6e@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:36:34 +0800 Subject: [PATCH 14/14] fix: add new columns in schema.sql (#469) * fix: add new columns in schema.sq * test: fix test * fix: update proposals table sql schema to match with production db * fix: revert changes, and add notes explaning discrepancies with prod db schema * docs: add columns name in notes --- test/e2e/api.test.ts | 7 ++++--- test/schema.sql | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/test/e2e/api.test.ts b/test/e2e/api.test.ts index a8eab703..a7ab1651 100644 --- a/test/e2e/api.test.ts +++ b/test/e2e/api.test.ts @@ -1,8 +1,8 @@ import fetch from 'node-fetch'; +import db from '../../src/helpers/mysql'; import proposalInput from '../fixtures/ingestor-payload/proposal.json'; -import { spacesSqlFixtures } from '../fixtures/space'; import proposalsFixtures from '../fixtures/proposal'; -import db from '../../src/helpers/mysql'; +import { spacesSqlFixtures } from '../fixtures/space'; const HOST = `http://localhost:${process.env.PORT || 3003}`; const SPACE_PREFIX = 'e2e-'; @@ -71,7 +71,8 @@ describe('POST /flag', () => { plugins: JSON.stringify(proposal.plugins), choices: JSON.stringify(proposal.choices), scores: JSON.stringify(proposal.scores), - scores_by_strategy: JSON.stringify(proposal.scores_by_strategy) + scores_by_strategy: JSON.stringify(proposal.scores_by_strategy), + vp_value_by_strategy: JSON.stringify(proposal.vp_value_by_strategy || []) })) .map(async proposal => { db.queryAsync('INSERT INTO snapshot_sequencer_test.proposals SET ?', proposal); diff --git a/test/schema.sql b/test/schema.sql index c18a8428..5e7757c4 100644 --- a/test/schema.sql +++ b/test/schema.sql @@ -28,6 +28,10 @@ CREATE TABLE spaces ( INDEX updated (updated) ); +-- Note: The `proposals` table schema might have some discrepancies +-- compared to the production database. This is due to legacy reasons +-- and the challenges associated with updating the schema because of its size. +-- `id` and `ipfs` columns should not have any default values. CREATE TABLE proposals ( id VARCHAR(66) NOT NULL, ipfs VARCHAR(64) NOT NULL, @@ -36,8 +40,8 @@ CREATE TABLE proposals ( updated INT(11) DEFAULT NULL, space VARCHAR(64) NOT NULL, network VARCHAR(12) NOT NULL, - symbol VARCHAR(16) NOT NULL, - type VARCHAR(24) NOT NULL, + symbol VARCHAR(16) NOT NULL DEFAULT '', + type VARCHAR(24) NOT NULL DEFAULT '', strategies JSON NOT NULL, validation JSON NOT NULL, plugins JSON NOT NULL, @@ -49,17 +53,20 @@ CREATE TABLE proposals ( start INT(11) NOT NULL, end INT(11) NOT NULL, quorum DECIMAL(64,30) NOT NULL, - quorum_type VARCHAR(24) NOT NULL DEFAULT '', + quorum_type VARCHAR(24) DEFAULT '', privacy VARCHAR(24) NOT NULL, snapshot INT(24) NOT NULL, app VARCHAR(24) NOT NULL, scores JSON NOT NULL, scores_by_strategy JSON NOT NULL, - scores_state VARCHAR(24) NOT NULL, + scores_state VARCHAR(24) NOT NULL DEFAULT '', scores_total DECIMAL(64,30) NOT NULL, scores_updated INT(11) NOT NULL, + scores_total_value DECIMAL(64,30) NOT NULL DEFAULT '0.000000000000000000000000000000', + vp_value_by_strategy json NOT NULL, votes INT(12) NOT NULL, flagged INT NOT NULL DEFAULT 0, + cb INT NOT NULL DEFAULT 0, PRIMARY KEY (id), INDEX ipfs (ipfs), INDEX author (author), @@ -73,7 +80,8 @@ CREATE TABLE proposals ( INDEX scores_state (scores_state), INDEX scores_updated (scores_updated), INDEX votes (votes), - INDEX flagged (flagged) + INDEX flagged (flagged), + INDEX cb (cb) ); CREATE TABLE votes (