-
Notifications
You must be signed in to change notification settings - Fork 6
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
refactor(lean-imt): move from hardhat
to forge
#23
Closed
+772
−657
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
da4b3ce
chore: rebase
sripwoud 6707858
chore: rebase
sripwoud 6f2ffab
chore: rebase
sripwoud 27d8502
chore: rebase
sripwoud 2d0d9ee
chore: rebase
sripwoud 0693503
chore: update .gitmodules
sripwoud ac3436e
ci: install foundry in test workflow
sripwoud a29fa1c
ci: fix
sripwoud b9c97cc
refactor(lean-imt): rename test file
sripwoud 54171a7
chore(lean-imt): lint test
sripwoud b713528
chore(lean-imt): remove task
sripwoud 1c998f4
ci: fix slither job
sripwoud abd672d
chore: ignore formatting of forge lib
sripwoud a91b20f
ci(lean-imt): run slither only for lean-imt
sripwoud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,14 +60,23 @@ jobs: | |
with: | ||
path: node_modules | ||
key: ${{ needs.deps.outputs.cache-key }} | ||
# TODO: right now forge and node tooling coexist, eventually keep only forge action | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- run: yarn compile | ||
|
||
- name: Upload compilation results | ||
- name: Upload compilation results (hardhat) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: all-artifacts | ||
path: packages/**/artifacts/** | ||
- name: Upload compilation results (forge) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: all-artifacts-forge | ||
path: packages/**/out/** | ||
|
||
style: | ||
needs: deps | ||
|
@@ -93,6 +102,11 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
# TODO: right now forge and node tooling coexist, eventually keep only forge action | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
@@ -104,6 +118,10 @@ jobs: | |
with: | ||
name: all-artifacts | ||
path: packages/ | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: all-artifacts-forge | ||
path: packages/ | ||
|
||
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir) | ||
name: Test | ||
|
@@ -134,51 +152,30 @@ jobs: | |
echo "matrix=$matrix" >> $GITHUB_OUTPUT | ||
|
||
slither: | ||
if: needs.changed-files.outputs.any_changed == 'true' | ||
needs: [changed-files, set-matrix, deps] | ||
if: contains(needs.changed-files.outputs.modified_files, 'lean-imt') | ||
needs: [changed-files, compile] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
strategy: | ||
matrix: | ||
dir: ${{ fromJson(needs.set-matrix.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# FIXME this does not work as a way to restore compilation results for slither job but it does for the compile job ?? | ||
#- uses: actions/download-artifact@v4 | ||
# with: | ||
# name: all-artifacts | ||
# path: packages/ | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- uses: actions/cache/restore@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: node_modules | ||
key: ${{ needs.deps.outputs.cache-key }} | ||
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir) | ||
name: Compile contracts | ||
run: | | ||
workspace=$(jq -r '.name' packages/${{ matrix.dir }}/package.json) | ||
yarn workspace "$workspace" run compile | ||
name: all-artifacts-forge | ||
path: packages/ | ||
|
||
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir) | ||
name: Run slither | ||
- name: Run slither | ||
uses: crytic/[email protected] | ||
id: slither | ||
with: | ||
ignore-compile: true | ||
node-version: 20 | ||
fail-on: none | ||
sarif: results.sarif | ||
slither-args: --filter-paths "test" --exclude-dependencies --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/ | ||
target: packages/${{ matrix.dir }} | ||
|
||
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir) | ||
name: Upload SARIF files | ||
- name: Upload SARIF files | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: ${{ steps.slither.outputs.sarif }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,3 +80,6 @@ typechain-types | |
|
||
.envrc | ||
.tool-versions | ||
|
||
# forge build output | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "packages/lean-imt/lib/poseidon-solidity"] | ||
path = packages/lean-imt/lib/poseidon-solidity | ||
url = https://github.com/vimwitch/poseidon-solidity | ||
[submodule "packages/lean-imt/lib/forge-std"] | ||
path = packages/lean-imt/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ yarn-error.log* | |
|
||
# others | ||
target | ||
|
||
# forge lib | ||
packages/lean-imt/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[profile.default] | ||
remappings = [ | ||
"poseidon-solidity/=lib/poseidon-solidity/contracts/", | ||
] |
This file was deleted.
Oops, something went wrong.
Submodule poseidon-solidity
added at
8205c9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,40 +2,14 @@ | |
"name": "lean-imt.sol", | ||
"private": true, | ||
"scripts": { | ||
"start": "hardhat node", | ||
"compile": "hardhat compile", | ||
"test": "hardhat test", | ||
"compile": "forge build", | ||
"test": "forge test", | ||
"test:report-gas": "REPORT_GAS=true hardhat test", | ||
"test:coverage": "hardhat coverage", | ||
"typechain": "hardhat typechain", | ||
"test:coverage": "forge coverage", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that the current latest version of forge does not allow excluding the |
||
"lint": "solhint 'contracts/**/*.sol'" | ||
}, | ||
"devDependencies": { | ||
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3", | ||
"@nomicfoundation/hardhat-ethers": "^3.0.0", | ||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0", | ||
"@nomicfoundation/hardhat-toolbox": "^4.0.0", | ||
"@nomicfoundation/hardhat-verify": "^2.0.0", | ||
"@typechain/ethers-v6": "^0.5.0", | ||
"@typechain/hardhat": "^9.0.0", | ||
"@types/chai": "^4.2.0", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.10.7", | ||
"@zk-kit/lean-imt": "^2.0.1", | ||
"chai": "^4.2.0", | ||
"ethers": "^6.4.0", | ||
"hardhat": "^2.19.4", | ||
"hardhat-gas-reporter": "^1.0.8", | ||
"poseidon-lite": "^0.2.0", | ||
"prettier-plugin-solidity": "^1.3.1", | ||
"solhint": "^3.3.6", | ||
"solhint-plugin-prettier": "^0.1.0", | ||
"solidity-coverage": "^0.8.0", | ||
"ts-node": "^10.9.2", | ||
"typechain": "^8.3.0", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"poseidon-solidity": "0.0.5" | ||
"solhint-plugin-prettier": "^0.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "filter_paths": "lib" } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somehow slither was buggy when the monorepo combines contracts that are compiled with either hardhat or forge. As slither in the ci is new, and because eventually we'll have only forge, I suggest restricting the ci check to the forge pkgs as a temp fix.