Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Productionise snapshot settings #5

Merged
merged 9 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Foundry + Python + Node",
"image": "mcr.microsoft.com/devcontainers/base:0",

"features": {
"ghcr.io/devcontainers/features/node:1": {}
}
}
31 changes: 31 additions & 0 deletions .github/workflows/pinata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Pin to IPFS

on:
push:
branches: [main]

jobs:
pin:
strategy:
matrix:
node-version: [18.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ matrix.os }}-yarn-
- run: yarn install --frozen
- run: yarn ipfs:publish
env:
IPFS_DEPLOY_PINATA__API_KEY: ${{ secrets.API_KEY }}
IPFS_DEPLOY_PINATA__SECRET_API_KEY: ${{ secrets.API_SECRET }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ New changes are automatically tested with GitHub Actions.

It requires [Yarn 1 (classic)](https://classic.yarnpkg.com/en/docs/install) to be installed.

Once any changes have been merged into `main`, the `settings.json` will be automatically uploaded and pinned to IPFS. The resultant CID can be used to inform the transaction for replacing the `snapshot` TXT record on the ENS domain.

### Install dependencies

```sh
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build": "tsc",
"lint": "eslint --max-warnings 0 .",
"fmt": "yarn lint --fix",
"ipfs:publish": "npx ipfs-deploy src/settings.json -p pinata -C -q",
"test": "jest"
},
"devDependencies": {
Expand All @@ -24,6 +25,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"ipfs-deploy": "^12.0.1",
fedgiac marked this conversation as resolved.
Show resolved Hide resolved
"jest": "^29.7.0",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
Expand Down
1 change: 1 addition & 0 deletions src/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"voting": {
"type": "basic",
"period": 604800,
"quorum": 35000000,
"hideAbstain": false
},
"filters": {
Expand Down
6 changes: 6 additions & 0 deletions test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ describe("settings.json", () => {
snapshot.utils.validateSchema(snapshot.schemas.space, settings),
).toBe(true);
});
test("Spam protection: require 10000 COW/vCOW", () => {
expect(settings.validation.params.minScore).toBe(10_000);
});
test("Participation: require 35M COW/vCOW quorum", () => {
expect(settings.voting.quorum).toBe(35_000_000);
});
});
Loading
Loading