Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
52 changes: 49 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
NETWORK_RPC_URL=http://localhost:8545
MNEMONIC=optional deployer mnemonic goes here
BLOCK_EXPLORER_KEY=optional etherscan key for verifying contracts
# endpoints
MAINNET_RPC_URL=http://localhost:8545
GNOSIS_RPC_URL=http://localhost:8546
HOODI_RPC_URL=http://localhost:8547
CHIADO_RPC_URL=http://localhost:8548

# verification
ETHERSCAN_API_KEY=123
GNOSISSCAN_API_KEY=456

# test settings
# Use this to run tests with a forked vault contracts
TEST_USE_FORK_VAULTS=false
# Skip snapshots update in tests
TEST_SKIP_SNAPSHOTS=false

# deployment
PRIVATE_KEY=0x12345
# Add transactions to remove vault factories in current deployment files
REMOVE_PREV_FACTORIES=false

# contract variables
# mainnet
#META_VAULT_FACTORY_OWNER=0x2685C0e39EEAAd383fB71ec3F493991d532A87ae
#OS_TOKEN_REDEEMER_OWNER=0x2685C0e39EEAAd383fB71ec3F493991d532A87ae
#OS_TOKEN_REDEEMER_ROOT_UPDATE_DELAY=432000
#VALIDATORS_REGISTRY=0x00000000219ab540356cBB839Cbe05303d7705Fa

# hoodi
#META_VAULT_FACTORY_OWNER=0xFF2B6d2d5c205b99E2e6f607B6aFA3127B9957B6
#OS_TOKEN_REDEEMER_OWNER=0xFF2B6d2d5c205b99E2e6f607B6aFA3127B9957B6
#OS_TOKEN_REDEEMER_ROOT_UPDATE_DELAY=432000
#VALIDATORS_REGISTRY=0x00000000219ab540356cBB839Cbe05303d7705Fa

# chiado
#META_VAULT_FACTORY_OWNER=0xFF2B6d2d5c205b99E2e6f607B6aFA3127B9957B6
#OS_TOKEN_REDEEMER_OWNER=0xFF2B6d2d5c205b99E2e6f607B6aFA3127B9957B6
#OS_TOKEN_REDEEMER_ROOT_UPDATE_DELAY=432000
#TOKENS_CONVERTER_FACTORY=0xB67D5b629926Ea16485c8a6A568C860f79cd2FA7
#VALIDATORS_REGISTRY=0xb97036A26259B7147018913bD58a774cf91acf25
#GNO_TOKEN=0x19C653Da7c37c66208fbfbE8908A5051B57b4C70

# gnosis
#META_VAULT_FACTORY_OWNER=
#OS_TOKEN_REDEEMER_OWNER=
#OS_TOKEN_REDEEMER_ROOT_UPDATE_DELAY=432000
#TOKENS_CONVERTER_FACTORY=
#VALIDATORS_REGISTRY=0x0B98057eA310F4d31F2a452B414647007d1645d9
#GNO_TOKEN=0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb
73 changes: 0 additions & 73 deletions .github/workflows/CI.yaml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: code coverage

on:
pull_request:

jobs:
comment-forge-coverage:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'code coverage' step
Uses Step
uses 'foundry-rs/foundry-toolchain' with ref 'v1', not a pinned commit hash
with:
version: stable

- name: Run forge coverage
id: coverage
run: |
{
echo 'COVERAGE<<EOF'
echo "| File | % Lines | % Statements | % Branches | % Funcs |"
echo "|------|---------|--------------|------------|---------|"
forge coverage --skip script --no-match-coverage "(keeper|mocks|test|script|VaultsRegistry|DepositDataRegistry)" 2>/dev/null |
grep '^|' |
grep -v 'test/' |
grep -v '^|--' |
grep -v 'File' |
sed 's/-*+//g'
echo EOF
} >> "$GITHUB_OUTPUT"
env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }}
TEST_SKIP_SNAPSHOTS: true
TEST_USE_FORK_VAULTS: false

- name: Check coverage is updated
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const file = "coverage.txt"
if(!fs.existsSync(file)) {
console.log("Nothing to check");
return
}
const currentCoverage = fs.readFileSync(file, "utf8").trim();
const newCoverage = (`${{ steps.coverage.outputs.COVERAGE }}`).trim();
if (newCoverage != currentCoverage) {
core.setFailed(`Code coverage not updated. Run : forge coverage | grep '^|' | grep -v 'test/' > coverage.txt`);
}

- name: Comment on PR
id: comment
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
})

const botComment = comments.find(comment => comment.user.id === 41898282)

const output = `${{ steps.coverage.outputs.COVERAGE }}`;
const commentBody = `Forge code coverage:\n${output}\n`;

if (botComment) {
github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
})
} else {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
}
24 changes: 24 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Lint' step
Uses Step
uses 'foundry-rs/foundry-toolchain' with ref 'v1', not a pinned commit hash
with:
version: stable

- name: Lint
run: forge fmt --check
Comment on lines +11 to +24

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 year ago

To fix the issue, we will add a permissions block at the workflow level (root level) to restrict the permissions of the GITHUB_TOKEN. Since the workflow only performs linting tasks, it only needs contents: read permissions. This change ensures that the workflow adheres to the principle of least privilege and avoids granting unnecessary permissions.


Suggested changeset 1
.github/workflows/lint.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -2,2 +2,5 @@
 
+permissions:
+  contents: read
+
 on:
EOF
@@ -2,2 +2,5 @@

permissions:
contents: read

on:
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
42 changes: 42 additions & 0 deletions .github/workflows/slither.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Slither

on:
push:
branches:
- main
pull_request:

jobs:
slither:
name: Slither analysis
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Slither' step
Uses Step
uses 'foundry-rs/foundry-toolchain' with ref 'v1', not a pinned commit hash
with:
version: stable

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install pip3
run: |
python -m pip install --upgrade pip

- name: Install Slither
run: |
pip3 install slither-analyzer

- name: Build
run: forge compile --skip test

- name: Run Slither
run: |
slither --fail-high --skip-clean .
Comment on lines +11 to +42

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 year ago

To fix the issue, we will add a permissions block at the root of the workflow file. This block will specify the minimal permissions required for the workflow to function. Since the workflow only reads repository contents and does not perform any write operations, we will set contents: read as the permission. This ensures that the workflow has the least privileges necessary to complete its tasks.


Suggested changeset 1
.github/workflows/slither.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/slither.yaml b/.github/workflows/slither.yaml
--- a/.github/workflows/slither.yaml
+++ b/.github/workflows/slither.yaml
@@ -2,2 +2,5 @@
 
+permissions:
+  contents: read
+
 on:
EOF
@@ -2,2 +2,5 @@

permissions:
contents: read

on:
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
32 changes: 32 additions & 0 deletions .github/workflows/test-fork.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on:
push:
branches:
- main
pull_request:

jobs:
forge-fork-tests:
name: Forge Fork Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Tests' step
Uses Step
uses 'foundry-rs/foundry-toolchain' with ref 'v1', not a pinned commit hash
with:
version: stable

- name: Run tests
run: forge test --isolate -vvv
env:
FORGE_SNAPSHOT_CHECK: false
TEST_USE_FORK_VAULTS: true
TEST_SKIP_SNAPSHOTS: true
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }}
FOUNDRY_PROFILE: test
Comment on lines +11 to +32

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 year ago

To fix the issue, we will add a permissions block at the root level of the workflow. This block will specify contents: read, which is sufficient for the operations performed in this workflow (e.g., checking out the repository and reading secrets). This change ensures that the workflow does not have unnecessary write permissions.


Suggested changeset 1
.github/workflows/test-fork.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test-fork.yaml b/.github/workflows/test-fork.yaml
--- a/.github/workflows/test-fork.yaml
+++ b/.github/workflows/test-fork.yaml
@@ -2,2 +2,5 @@
 
+permissions:
+  contents: read
+
 on:
EOF
@@ -2,2 +2,5 @@

permissions:
contents: read

on:
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
31 changes: 31 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on:
push:
branches:
- main
pull_request:

jobs:
forge-tests:
name: Forge Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Tests' step
Uses Step
uses 'foundry-rs/foundry-toolchain' with ref 'v1', not a pinned commit hash
with:
version: stable

- name: Run tests
run: forge test --isolate --gas-snapshot-check=true -vvv
env:
TEST_USE_FORK_VAULTS: false
TEST_SKIP_SNAPSHOTS: false
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }}
FOUNDRY_PROFILE: test
Comment on lines +11 to +31

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 year ago

To fix the issue, we will add a permissions block at the root of the workflow file. This block will specify the minimal permissions required for the workflow to function. Based on the workflow's operations, it only needs to read the repository contents. Therefore, we will set contents: read as the permission. This change ensures that the GITHUB_TOKEN is restricted to the least privilege necessary.


Suggested changeset 1
.github/workflows/test.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -8,2 +8,5 @@
 
+permissions:
+  contents: read
+
 jobs:
EOF
@@ -8,2 +8,5 @@

permissions:
contents: read

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Loading