Skip to content

Commit

Permalink
feat: update repo template (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamegyed authored Sep 3, 2024
1 parent c81e712 commit 5c723fc
Show file tree
Hide file tree
Showing 16 changed files with 188 additions and 1,442 deletions.
1,155 changes: 0 additions & 1,155 deletions .gasestimates.md

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/setup-ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Setup CI"
description: "Reusable setup for multiple CI checks"

runs:
using: "composite"
steps:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: Install Foundry dependencies
shell: bash
run: forge install

- name: "Install the Node.js dependencies"
shell: bash
run: "pnpm install"
96 changes: 18 additions & 78 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Modular Account Test CI

on: [pull_request, workflow_dispatch]

Expand All @@ -12,106 +12,46 @@ jobs:
name: Run Linters
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
- uses: actions/checkout@v3
with:
submodules: "recursive"

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

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
submodules: recursive

- name: "Install Node.js dependencies"
run: "pnpm install"
- uses: ./.github/workflows/setup-ci

- run: forge fmt --check
- name: "Check formatting"
run: forge fmt --check

- name: "Lint the contracts"
run: "pnpm lint"

# check-inspect:
# name: Verify Inspections
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Install Foundry
# uses: foundry-rs/foundry-toolchain@v1
# with:
# version: nightly

# - run: forge install
# - run: bash ./utils/inspect.sh

# - run: git status --untracked-files=no --porcelain
# - run: git --no-pager diff

# - name: Check Inspections
# run: if [[ -n "$(git status --untracked-files=no --porcelain)" ]]; then echo "Inspection difference detected, verify tests are passing and run \`bash ./utils/inspect.sh\` to fix." && exit 1; fi

test:
name: Run Forge Tests
test-optimized-test-deep:
name: Run Forge Tests (optimized-test-deep)
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Install forge dependencies
run: forge install

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js dependencies"
run: "pnpm install"
- uses: ./.github/workflows/setup-ci

- name: Build project
run: forge build --sizes
run: FOUNDRY_PROFILE=optimized-build forge build

- name: Run tests
run: FOUNDRY_PROFILE=deep forge test -vvv
run: FOUNDRY_PROFILE=optimized-test-deep forge test -vvv

test-lite:
name: Run Forge Tests [lite build]
test-default:
name: Run Forge Tests (default)
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Install forge dependencies
run: forge install

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js dependencies"
run: "pnpm install"
- uses: ./.github/workflows/setup-ci

- name: Build project
run: FOUNDRY_PROFILE=lite forge build
run: forge build

- name: Run tests
run: FOUNDRY_PROFILE=lite forge test -vvv
run: forge test -vvv
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ out-optimized/
cache/
node_modules/

# coverage
# Coverage
report/
lcov.info

# secret
# env vars
.env

# deployments
Expand All @@ -17,4 +17,4 @@ broadcast/**/dry-run/**/*

# misc
.DS_Store
**/.DS_Store
**/.DS_Store
21 changes: 21 additions & 0 deletions .solhint-script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "solhint:recommended",
"rules": {
"func-name-mixedcase": "off",
"immutable-vars-naming": ["error"],
"no-unused-import": ["error"],
"compiler-version": ["error", ">=0.8.19"],
"custom-errors": "off",
"no-console": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"max-states-count": ["warn", 30],
"modifier-name-mixedcase": ["error"],
"private-vars-leading-underscore": ["error"],
"no-inline-assembly": "warn",
"avoid-low-level-calls": "off",
"one-contract-per-file": "off",
"no-empty-blocks": "off",
"reason-string": "off"
}
}
2 changes: 1 addition & 1 deletion .solhint-src.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"rules": {
"immutable-vars-naming": ["error"],
"no-unused-import": ["error"],
"compiler-version": ["error", ">=0.8.22"],
"compiler-version": ["error", ">=0.8.26"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"func-param-name-mixedcase": ["error"],
Expand Down
8 changes: 6 additions & 2 deletions .solhint-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"func-name-mixedcase": "off",
"immutable-vars-naming": ["error"],
"no-unused-import": ["error"],
"compiler-version": ["error", ">=0.8.22"],
"compiler-version": ["error", ">=0.8.26"],
"custom-errors": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"max-states-count": ["warn", 30],
"modifier-name-mixedcase": ["error"],
"private-vars-leading-underscore": ["error"],
"no-inline-assembly": "off",
"avoid-low-level-calls": "off"
"avoid-low-level-calls": "off",
"one-contract-per-file": "off",
"no-empty-blocks": "off",
"reason-string": ["warn", { "maxLength": 64 }]
}
}
65 changes: 0 additions & 65 deletions .storagelayout.md

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.22",
"solidity.compileUsingRemoteVersion": "v0.8.26+commit.8a97fa7a",
"editor.formatOnSave": true,
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

Alchemy's Modular Account is a maximally modular, upgradeable smart contract account that is compatible with [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) and [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900).

> :warning: **This branch contains changes that are under development.** To use the latest audited version make sure to use the correct commit. The tagged versions can be found in the [releases](https://github.com/alchemyplatform/modular-account/releases).
## Overview

This repository contains:
Expand Down
50 changes: 28 additions & 22 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
[profile.default]
solc = '0.8.22'
evm_version='paris'
via_ir = true
solc = '0.8.26'
via_ir = false
src = 'src'
out = 'out'
test = 'test'
libs = ['lib']
out = 'out'
optimizer = true
optimizer_runs = 900
ignored_error_codes = []
optimizer_runs = 200
auto_detect_solc = false
bytecode_hash = "none"
auto_detect_remappings = false
fs_permissions = [
{ access = "read", path = "./out-optimized" }
]

[fuzz]
runs = 500
Expand All @@ -19,34 +23,36 @@ fail_on_revert = true
depth = 10

[profile.optimized-build]
script = 'src'
via_ir = true
test = 'src'
optimizer_runs = 10000
out = 'out-optimized'

[profile.lite]
via_ir = false
optimizer = true
optimizer_runs = 10_000
ignored_error_codes = []
[profile.optimized-test]
src = 'test'

[profile.deep.fuzz]
[profile.optimized-test-deep]
src = 'test'

[profile.optimized-test-deep.fuzz]
runs = 10000

[profile.optimized-test-deep.invariant]
runs = 5000
depth = 32

[profile.deep.fuzz]
runs = 100000

[profile.deep.invariant]
runs = 5000
depth = 32

[fmt]
line_length = 115
wrap_comments = true

[rpc_endpoints]
mainnet = "${MAINNET_RPC_URL}"
sepolia = "${SEPOLIA_RPC_URL}"
goerli = "${GOERLI_RPC_URL}"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}" }
goerli = { key = "${ETHERSCAN_API_KEY}" }
sort_imports = true
number_underscore = "thousands"
int_types = "long"

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Loading

0 comments on commit 5c723fc

Please sign in to comment.