-
Notifications
You must be signed in to change notification settings - Fork 57
Add build CI, remappings validation, and ERC721 Medusa coverage #107
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
base: main
Are you sure you want to change the base?
Changes from all commits
6657131
25390c5
17c853c
4667091
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,130 @@ | |||||||||||||||||||||||||||||
| name: Build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - main | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - "*" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| validate-remappings: | |||||||||||||||||||||||||||||
| name: Validate remappings | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout repository | |||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| submodules: recursive | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Check all remapping targets exist | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| rc=0 | |||||||||||||||||||||||||||||
| for file in $(find . -name remappings.txt -not -path './lib/*' -not -path './node_modules/*'); do | |||||||||||||||||||||||||||||
| dir=$(dirname "$file") | |||||||||||||||||||||||||||||
| # Collect search bases: the remappings dir + libs from foundry.toml | |||||||||||||||||||||||||||||
| bases="$dir" | |||||||||||||||||||||||||||||
| if [ -f "$dir/foundry.toml" ]; then | |||||||||||||||||||||||||||||
| for lib in $(grep "^libs" "$dir/foundry.toml" | sed "s/.*\[//;s/\].*//;s/'//g;s/\"//g;s/,/ /g"); do | |||||||||||||||||||||||||||||
| bases="$bases $dir/$lib" | |||||||||||||||||||||||||||||
| done | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| while IFS= read -r line; do | |||||||||||||||||||||||||||||
| [ -z "$line" ] && continue | |||||||||||||||||||||||||||||
| target=$(echo "$line" | sed 's/.*=//') | |||||||||||||||||||||||||||||
| found=false | |||||||||||||||||||||||||||||
| for base in $bases; do | |||||||||||||||||||||||||||||
| if [ -d "$base/$target" ]; then | |||||||||||||||||||||||||||||
| found=true | |||||||||||||||||||||||||||||
| break | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| done | |||||||||||||||||||||||||||||
| if [ "$found" = false ]; then | |||||||||||||||||||||||||||||
| echo "::error file=$file::Broken remapping: $line (target '$target' not found)" | |||||||||||||||||||||||||||||
| rc=1 | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| done < "$file" | |||||||||||||||||||||||||||||
| done | |||||||||||||||||||||||||||||
| exit $rc | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| foundry-root: | |||||||||||||||||||||||||||||
| name: Compile root contracts (Foundry) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout repository | |||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| submodules: recursive | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install Foundry | |||||||||||||||||||||||||||||
| uses: foundry-rs/foundry-toolchain@v1 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run forge build | |||||||||||||||||||||||||||||
| run: forge build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| foundry-tests: | |||||||||||||||||||||||||||||
|
Comment on lines
+52
to
+66
Check warningCode 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 AutofixAI 24 days ago In general, fix this by explicitly declaring a minimal The best minimal fix without changing existing functionality is to add a root-level Concretely, edit permissions:
contents: readbetween line 1 (
Suggested changeset
1
.github/workflows/build.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Compile ${{ matrix.standard }} test harness (Foundry) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| fail-fast: false | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| standard: [ERC20, ERC721, ERC4626] | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout repository | |||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| submodules: recursive | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install Foundry | |||||||||||||||||||||||||||||
| uses: foundry-rs/foundry-toolchain@v1 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run forge build | |||||||||||||||||||||||||||||
| working-directory: tests/${{ matrix.standard }}/foundry | |||||||||||||||||||||||||||||
| run: forge build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| hardhat-root: | |||||||||||||||||||||||||||||
|
Comment on lines
+67
to
+86
Check warningCode 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 AutofixAI 24 days ago To fix the problem, explicitly declare restricted Concretely, in permissions:
contents: readimmediately after the
Suggested changeset
1
.github/workflows/build.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Compile root contracts (Hardhat) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout repository | |||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| submodules: recursive | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Node.js | |||||||||||||||||||||||||||||
| uses: actions/setup-node@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| node-version: 22 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: npm install | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run hardhat compile | |||||||||||||||||||||||||||||
| run: npx hardhat compile | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| hardhat-tests: | |||||||||||||||||||||||||||||
|
Comment on lines
+87
to
+106
Check warningCode 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 AutofixAI 24 days ago To fix this, explicitly restrict the Concretely, in permissions:
contents: readThis leaves all job logic unchanged while ensuring that the
Suggested changeset
1
.github/workflows/build.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Compile ${{ matrix.standard }} test harness (Hardhat) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| fail-fast: false | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| standard: [ERC20, ERC721, ERC4626] | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout repository | |||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| submodules: recursive | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Node.js | |||||||||||||||||||||||||||||
| uses: actions/setup-node@v6 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| node-version: 22 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| working-directory: tests/${{ matrix.standard }}/hardhat | |||||||||||||||||||||||||||||
| run: npm install | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run hardhat compile | |||||||||||||||||||||||||||||
| working-directory: tests/${{ matrix.standard }}/hardhat | |||||||||||||||||||||||||||||
| run: npx hardhat compile | |||||||||||||||||||||||||||||
|
Comment on lines
+107
to
+130
Check warningCode 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 AutofixAI 24 days ago To fix the problem, explicitly set minimal Concretely, in
This will restrict the token for all jobs (
Suggested changeset
1
.github/workflows/build.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,6 @@ on: | |
| branches: | ||
| - "*" | ||
|
|
||
| env: | ||
| FOUNDRY_PROFILE: ci | ||
|
|
||
| jobs: | ||
| foundry: | ||
| name: Test Foundry examples | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| { | ||
| "fuzzing": { | ||
| "workers": 10, | ||
| "workerResetLimit": 50, | ||
| "timeout": 0, | ||
| "testLimit": 500000, | ||
| "callSequenceLength": 100, | ||
| "corpusDirectory": "tests/medusa-corpus-ext", | ||
| "coverageEnabled": true, | ||
| "targetContracts": [], | ||
| "targetContractsBalances": [], | ||
| "constructorArgs": {}, | ||
| "deployerAddress": "0x10000", | ||
| "senderAddresses": [ | ||
| "0x10000", | ||
| "0x20000", | ||
| "0x30000" | ||
| ], | ||
| "blockNumberDelayMax": 60480, | ||
| "blockTimestampDelayMax": 604800, | ||
| "blockGasLimit": 125000000, | ||
| "transactionGasLimit": 12500000, | ||
| "testing": { | ||
| "stopOnFailedTest": true, | ||
| "stopOnFailedContractMatching": false, | ||
| "stopOnNoTests": true, | ||
| "testAllContracts": true, | ||
| "traceAll": false, | ||
| "assertionTesting": { | ||
| "enabled": true, | ||
| "testViewMethods": false, | ||
| "panicCodeConfig": { | ||
| "failOnCompilerInsertedPanic": false, | ||
| "failOnAssertion": true, | ||
| "failOnArithmeticUnderflow": false, | ||
| "failOnDivideByZero": false, | ||
| "failOnEnumTypeConversionOutOfBounds": false, | ||
| "failOnIncorrectStorageAccess": false, | ||
| "failOnPopEmptyArray": false, | ||
| "failOnOutOfBoundsArrayAccess": false, | ||
| "failOnAllocateTooMuchMemory": false, | ||
| "failOnCallUninitializedVariable": false | ||
| } | ||
| }, | ||
| "propertyTesting": { | ||
| "enabled": false, | ||
| "testPrefixes": [ | ||
| "property_" | ||
| ] | ||
| }, | ||
| "optimizationTesting": { | ||
| "enabled": false, | ||
| "testPrefixes": [ | ||
| "optimize_" | ||
| ] | ||
| } | ||
| }, | ||
| "chainConfig": { | ||
| "codeSizeCheckDisabled": true, | ||
| "cheatCodes": { | ||
| "cheatCodesEnabled": true, | ||
| "enableFFI": false | ||
| } | ||
| } | ||
| }, | ||
| "compilation": { | ||
| "platform": "crytic-compile", | ||
| "platformConfig": { | ||
| "target": ".", | ||
| "solcVersion": "", | ||
| "exportDirectory": "", | ||
| "args": ["--foundry-compile-all"] | ||
| } | ||
| }, | ||
| "logging": { | ||
| "level": "info", | ||
| "logDirectory": "", | ||
| "noColor": false | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| { | ||
| "fuzzing": { | ||
| "workers": 10, | ||
| "workerResetLimit": 50, | ||
| "timeout": 0, | ||
| "testLimit": 500000, | ||
| "callSequenceLength": 100, | ||
| "corpusDirectory": "tests/medusa-corpus", | ||
| "coverageEnabled": true, | ||
| "targetContracts": [], | ||
| "targetContractsBalances": [], | ||
| "constructorArgs": {}, | ||
| "deployerAddress": "0x10000", | ||
| "senderAddresses": [ | ||
| "0x10000", | ||
| "0x20000", | ||
| "0x30000" | ||
| ], | ||
| "blockNumberDelayMax": 60480, | ||
| "blockTimestampDelayMax": 604800, | ||
| "blockGasLimit": 125000000, | ||
| "transactionGasLimit": 12500000, | ||
| "testing": { | ||
| "stopOnFailedTest": true, | ||
| "stopOnFailedContractMatching": true, | ||
| "stopOnNoTests": true, | ||
| "testAllContracts": false, | ||
| "traceAll": false, | ||
| "assertionTesting": { | ||
| "enabled": true, | ||
| "testViewMethods": false, | ||
| "panicCodeConfig": { | ||
| "failOnCompilerInsertedPanic": false, | ||
| "failOnAssertion": true, | ||
| "failOnArithmeticUnderflow": false, | ||
| "failOnDivideByZero": false, | ||
| "failOnEnumTypeConversionOutOfBounds": false, | ||
| "failOnIncorrectStorageAccess": false, | ||
| "failOnPopEmptyArray": false, | ||
| "failOnOutOfBoundsArrayAccess": false, | ||
| "failOnAllocateTooMuchMemory": false, | ||
| "failOnCallUninitializedVariable": false | ||
| } | ||
| }, | ||
| "propertyTesting": { | ||
| "enabled": false, | ||
| "testPrefixes": [ | ||
| "property_" | ||
| ] | ||
| }, | ||
| "optimizationTesting": { | ||
| "enabled": false, | ||
| "testPrefixes": [ | ||
| "optimize_" | ||
| ] | ||
| } | ||
| }, | ||
| "chainConfig": { | ||
| "codeSizeCheckDisabled": true, | ||
| "cheatCodes": { | ||
| "cheatCodesEnabled": true, | ||
| "enableFFI": false | ||
| } | ||
| } | ||
| }, | ||
| "compilation": { | ||
| "platform": "crytic-compile", | ||
| "platformConfig": { | ||
| "target": ".", | ||
| "solcVersion": "", | ||
| "exportDirectory": "", | ||
| "args": ["--foundry-compile-all"] | ||
| } | ||
| }, | ||
| "logging": { | ||
| "level": "info", | ||
| "logDirectory": "", | ||
| "noColor": false | ||
| } | ||
| } |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 24 days ago
In general, the fix is to add an explicit
permissionsblock that grants only the minimal necessary scopes to theGITHUB_TOKEN. Since this workflow only checks out code and runs build/test commands, it can safely operate with read-only access to repository contents. The simplest and clearest solution is to add a top-levelpermissions:block (at the root of the workflow, alongsidenameandon) withcontents: read, which will apply to all jobs in this workflow.Concretely, edit
.github/workflows/build.yamland insert:between the
name: Buildline and theon:block (lines 1–3 in the given snippet). This will not change any existing behavior of the jobs, sinceactions/checkoutand the other actions used only require read access to repository contents. No other lines or jobs need individualpermissionsblocks unless you later introduce steps that require additional scopes.