forked from bcnmy/nexus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🙈 Add cache_forge to .gitignore * Add .husky to .gitignore * 🎨 Update tab width to 4 spaces in .prettierrc * 🚧 Disable no-inline-assembly rule in .solhint.json * ⚡️ Add account-abstraction dependency and update husky hooks * 🔥 Remove Git hooks for branch name validation * 🔧 Update tsconfig.json to disable strict mode * 🎨 Update Solidity version and remappings, delete unused contracts and tests * 🙈 Add .vscode/settings.json to .gitignore * 🔥 Delete unused contracts and tests * ✨ Add utility functions for conversion and formatting * ✨ Add buildUserOp function to utils.ts * ✨ Add git hook to check branch names * ✨ Add SmartAccount contract * ✨ Add AccountConfig contract implementation * ✨ Add Execution contract for account execution * ✨ Add ModuleConfig contract for managing modules * ✨ Add Storage contract for isolated storage access * ✨ Add Validator contract for user operation validation * ⚡️ Add ERC-7579 interfaces for smart account configuration, execution, module, and module configuration * ✨ Add IStorage interface for ERC20 account storage * 🚀 Add deployment of SmartAccount contract * 🚧 Update import statement and variable name in Deploy script * ⚡️ Add Entrypoint 0.7.0 * ⚡️ Add Imports.sol for consolidated imports * ✅ Add SmartAccount test file * 👷 Remove unnecessary branch from PR Automation Workflow * ✏️ Update storage location for SmartAccount in contracts * Feat/slither (bcnmy#14) * 👷 Add Slither analysis workflow * ♻️ Update Slither workflow to include Foundry installation*** * Add permissions and update Slither configuration * Update Slither workflow to ensure tool availability * Update Slither workflow * Add Slither workflow to run static analysis * 💚 add yarn.lock * ✨ Update Slither workflow to include Node.js setup and SARIF report generation * Remove SARIF file upload step in slither.yml * Update Slither configuration in workflow * 🚧 Update Slither workflow to include Foundry installation and contract building * Remove target directory for analysis in slither.yml workflow * 🚑 Update Slither workflow to include SARIF file upload * Add token to SARIF file upload * Add comment.js and update slither.yml workflow * Update node version in slither.yml * Update Slither workflow to fail on medium severity issues * Add target directory for Slither analysis * Update slither.yml with filter paths for mock contracts * Update slither-args in slither.yml * Fix slither-args path in GitHub workflow * Update slither configuration to exclude node_modules directory * Update slither-args in slither.yml workflow * Update Slither version to 0.10.0 * Update slither.yml to fail on no severity issues * Add check for pull request event in comment.js * Update GitHub Actions workflow to trigger on pull requests (bcnmy#15) * Update GitHub Actions workflow to trigger on pull requests * Update Slither workflow permissions and arguments * Refactor CI workflow and remove redundant coverage and slither workflows * Update Node.js and Foundry versions * Add Foundry to PATH * Update CI workflow to install lcov and make other improvements * Add cache for Foundry Toolchain * Update CI workflow configuration * Refactor GitHub Actions workflow*** * Update CI workflow to cache node_modules and Foundry toolchain * Update CI workflow and add linting, unit tests, coverage, and static analysis * Update cache keys and add Foundry toolchain * Add Foundry cache key generation and ensure Foundry directory exists * Update CI workflow and cache actions*** * Update CI workflow and dependencies * Update CI workflow to install Foundry and generate coverage report * Add lcov installation step and update Codecov upload for Foundry and Hardhat coverage reports * Refactor CI workflow and add Slither analysis * Update CI Workflow to include linting, unit tests, coverage, and slither analysis * Refactor CI workflow and update Slither analysis
- Loading branch information
Showing
40 changed files
with
6,173 additions
and
461 deletions.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = async ({ github, context, header, body }) => { | ||
const comment = [header, body].join("\n"); | ||
|
||
// Check if the workflow is triggered by a pull request event | ||
if (!context.payload.pull_request) { | ||
console.log('This workflow is not triggered by a pull request. Skipping comment creation/update.'); | ||
return; | ||
} | ||
|
||
const { data: comments } = await github.rest.issues.listComments({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.payload.pull_request.number, | ||
}); | ||
|
||
const botComment = comments.find( | ||
comment => comment.user.type === 'Bot' && comment.body.startsWith(header) | ||
); | ||
|
||
const commentFn = botComment ? 'updateComment' : 'createComment'; | ||
|
||
await github.rest.issues[commentFn]({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: comment, | ||
...(botComment ? { comment_id: botComment.id } : { issue_number: context.payload.pull_request.number }), | ||
}); | ||
}; |
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
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 |
---|---|---|
@@ -1,44 +1,77 @@ | ||
name: Test workflow | ||
on: push | ||
name: Unified CI Workflow | ||
|
||
on: pull_request | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
lint: | ||
name: Lint sources | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
cache-key: ${{ steps.cache-keys.outputs.cache-key }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
uses: actions/[email protected] | ||
|
||
- name: Get cache key | ||
id: cache-keys | ||
run: echo "::set-output name=cache-key::$(echo ${{ runner.os }}-node-$(cat yarn.lock | sha256sum | cut -d' ' -f1))" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ steps.cache-keys.outputs.cache-key }} | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
lint: | ||
name: Lint sources | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
uses: foundry-rs/foundry-toolchain@v1.1.1 | ||
with: | ||
version: nightly | ||
cache: true | ||
|
||
- name: Install foundry dependencies | ||
run: forge install | ||
- name: Cache node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ needs.setup.outputs.cache-key }} | ||
|
||
- name: Lint sources | ||
run: yarn lint:sol | ||
|
||
unit_test: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Create a fake .secret file | ||
run: echo "primary twist rack vendor diagram image used route theme frown either will" > .secret | ||
uses: actions/[email protected] | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ needs.setup.outputs.cache-key }} | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
uses: foundry-rs/foundry-toolchain@v1.1.1 | ||
with: | ||
version: nightly | ||
cache: true | ||
|
||
- name: Install foundry dependencies | ||
run: forge install | ||
|
@@ -48,3 +81,70 @@ jobs: | |
|
||
- name: Run Forge and Hardhat Tests | ||
run: yarn test | ||
|
||
coverage: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ needs.setup.outputs.cache-key }} | ||
|
||
- name: Install lcov (for genhtml) | ||
run: sudo apt-get update && sudo apt-get install -y lcov | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/[email protected] | ||
with: | ||
version: nightly | ||
cache: true | ||
|
||
- name: Generate Hardhat & Foundry Coverage Report | ||
run: yarn coverage:report | ||
|
||
- name: Upload Foundry Coverage Report to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
file: ./coverage/foundry/lcov.info | ||
flags: foundry | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
- name: Upload Hardhat Coverage Report to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
file: ./coverage/lcov.info | ||
flags: hardhat | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
analyze: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run Slither | ||
uses: crytic/[email protected] | ||
id: slither | ||
with: | ||
slither-version: "0.10.0" | ||
node-version: "18" | ||
fail-on: "none" | ||
slither-args: '--filter-paths "contracts/mock|node_modules" --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/contracts/' | ||
|
||
- name: Create/update checklist as PR comment | ||
uses: actions/github-script@v7 | ||
env: | ||
REPORT: ${{ steps.slither.outputs.stdout }} | ||
with: | ||
script: | | ||
const script = require('.github/scripts/comment') | ||
const header = '# Slither report' | ||
const body = process.env.REPORT | ||
await script({ github, context, header, body }) |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import { IAccountConfig } from "../interfaces/IAccountConfig.sol"; | ||
|
||
contract AccountConfig is IAccountConfig { | ||
/** | ||
* @notice Returns the account id of the smart account. | ||
* @return accountImplementationId The account id of the smart account. | ||
*/ | ||
function accountId() external view returns (string memory accountImplementationId) { | ||
return "ModularSmartAccount"; | ||
} | ||
|
||
/** | ||
* @notice Checks if the account supports a certain execution mode. | ||
* @param encodedMode The encoded mode. | ||
* @return True if the account supports the mode, false otherwise. | ||
*/ | ||
function supportsAccountMode(bytes32 encodedMode) external view returns (bool) { | ||
encodedMode; | ||
return true; | ||
} | ||
|
||
/** | ||
* @notice Checks if the account supports a certain module typeId. | ||
* @param moduleTypeId The module type ID. | ||
* @return True if the account supports the module type, false otherwise. | ||
*/ | ||
function supportsModule(uint256 moduleTypeId) external view returns (bool) { | ||
moduleTypeId; | ||
return true; | ||
} | ||
} |
Oops, something went wrong.