Skip to content

Commit

Permalink
Productionise snapshot settings (#5)
Browse files Browse the repository at this point in the history
* test: spam protection

* feat: quorum

* chore: repo devcontainer

* cicd: auto pin ipfs

* fix: prettier

* cicd: test other ipfs action

* cicd: publish to ipfs

* docs: readme

* Update test/settings.test.ts

Co-authored-by: Federico Giacon <[email protected]>

---------

Co-authored-by: Federico Giacon <[email protected]>
  • Loading branch information
mfw78 and fedgiac authored Nov 27, 2023
1 parent da23097 commit b502cf9
Show file tree
Hide file tree
Showing 7 changed files with 3,816 additions and 111 deletions.
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",
"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

0 comments on commit b502cf9

Please sign in to comment.