Skip to content

Commit 1f32009

Browse files
committed
chore: add RI
1 parent 2d5e10b commit 1f32009

59 files changed

Lines changed: 7635 additions & 4 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
Borrowed from foundry.
3+
4+
Thank you for your Pull Request. Please provide a description above and review
5+
the requirements below.
6+
7+
Bug fixes and new features should include tests.
8+
-->
9+
10+
## Motivation
11+
12+
<!--
13+
Explain the context and why you're making that change. What is the problem
14+
you're trying to solve? In some cases there is not a problem and this can be
15+
thought of as being the motivation for your change.
16+
17+
If your PR solves a particular issue, tag that issue.
18+
-->
19+
20+
## Solution
21+
22+
<!--
23+
Summarize the solution and provide any necessary context needed to understand
24+
the code change.
25+
-->

.github/workflows/test.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: ERC6900 RI Test CI
2+
3+
on: [pull_request, workflow_dispatch]
4+
5+
concurrency:
6+
group: ${{github.workflow}}-${{github.ref}}
7+
cancel-in-progress: true
8+
9+
# Runs linter, tests, and inspection checker in parallel
10+
jobs:
11+
lint:
12+
name: Run Linters
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Install Foundry
17+
uses: foundry-rs/foundry-toolchain@v1
18+
with:
19+
version: nightly
20+
- run: forge install
21+
22+
- run: forge fmt --check
23+
24+
- name: "Check out the repo"
25+
uses: "actions/checkout@v3"
26+
with:
27+
submodules: "recursive"
28+
29+
- name: "Install Foundry"
30+
uses: "foundry-rs/foundry-toolchain@v1"
31+
32+
- name: "Install Pnpm"
33+
uses: "pnpm/action-setup@v2"
34+
with:
35+
version: "8"
36+
37+
- name: "Install Node.js"
38+
uses: "actions/setup-node@v3"
39+
with:
40+
cache: "pnpm"
41+
node-version: "lts/*"
42+
43+
- name: "Install the Node.js dependencies"
44+
run: "pnpm install"
45+
46+
- name: "Lint the contracts"
47+
run: "pnpm lint"
48+
49+
test:
50+
name: Run Forge Tests
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
with:
55+
submodules: recursive
56+
57+
- name: Install Foundry
58+
uses: foundry-rs/foundry-toolchain@v1
59+
with:
60+
version: nightly
61+
62+
- name: Install forge dependencies
63+
run: forge install
64+
65+
- name: Build project
66+
run: forge build
67+
68+
- name: Run tests
69+
run: FOUNDRY_PROFILE=deep forge test -vvv
70+
71+
test-lite:
72+
name: Run Forge Tests [lite build]
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v3
76+
with:
77+
submodules: recursive
78+
79+
- name: Install Foundry
80+
uses: foundry-rs/foundry-toolchain@v1
81+
with:
82+
version: nightly
83+
84+
- name: Install forge dependencies
85+
run: forge install
86+
87+
- name: Build project
88+
run: FOUNDRY_PROFILE=lite forge build
89+
90+
- name: Run tests
91+
run: FOUNDRY_PROFILE=lite forge test -vvv

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Foundry build and cache directories
2+
out/
3+
cache/
4+
node_modules/

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "lib/account-abstraction"]
2+
path = lib/account-abstraction
3+
url = https://github.com/eth-infinitism/account-abstraction
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
7+
[submodule "lib/forge-std"]
8+
path = lib/forge-std
9+
url = https://github.com/foundry-rs/forge-std

.solhint-src.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "solhint:recommended",
3+
"rules": {
4+
"immutable-vars-naming": ["error"],
5+
"no-unused-import": ["error"],
6+
"compiler-version": ["error", ">=0.8.19"],
7+
"func-visibility": ["error", { "ignoreConstructors": true }],
8+
"max-line-length": ["error", 120],
9+
"func-param-name-mixedcase": ["error"],
10+
"modifier-name-mixedcase": ["error"],
11+
"private-vars-leading-underscore": ["error"],
12+
"ordering": ["warn"],
13+
"no-inline-assembly": "off",
14+
"avoid-low-level-calls": "off",
15+
"no-complex-fallback": "off"
16+
}
17+
}

.solhint-test.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "solhint:recommended",
3+
"rules": {
4+
"func-name-mixedcase": "off",
5+
"immutable-vars-naming": ["error"],
6+
"no-unused-import": ["error"],
7+
"compiler-version": ["error", ">=0.8.19"],
8+
"func-visibility": ["error", { "ignoreConstructors": true }],
9+
"max-line-length": ["error", 120],
10+
"max-states-count": ["warn", 30],
11+
"modifier-name-mixedcase": ["error"],
12+
"private-vars-leading-underscore": ["error"],
13+
"no-inline-assembly": "off",
14+
"avoid-low-level-calls": "off"
15+
}
16+
}
17+

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"solidity.packageDefaultDependenciesContractsDirectory": "src",
3+
"solidity.packageDefaultDependenciesDirectory": "lib",
4+
"solidity.compileUsingRemoteVersion": "v0.8.19",
5+
"editor.formatOnSave": true,
6+
"[solidity]": {
7+
"editor.defaultFormatter": "JuanBlanco.solidity"
8+
},
9+
"solidity.formatter": "forge",
10+
"search.exclude": { "lib": true }
11+
}

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ Reference implementation for [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900)
44

55
The implementation includes an upgradable modular account with two plugins (`SingleOwnerPlugin` and `TokenReceiverPlugin`). It is compliant with ERC-6900 with the latest updates.
66

7-
## Caveat
7+
## Important Callouts
88

9-
- **_Not audited and should not be used in production_**.
10-
- Not optimized in both deployments and execution.
11-
- Lack support for easy account states building. It is possible off-chain, but not easy.
9+
- **Not audited and should NOT be used in production**.
10+
- Not optimized in both deployments and execution. We’ve explicitly removed some optimizations for reader comprehension.
1211

1312
## Development
1413

foundry.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[profile.default]
2+
solc = '0.8.19'
3+
via_ir = true
4+
src = 'src'
5+
out = 'out'
6+
test = 'test'
7+
libs = ['lib']
8+
optimizer = true
9+
optimizer_runs = 10_000
10+
ignored_error_codes = [3628]
11+
12+
[fuzz]
13+
runs = 500
14+
15+
[invariant]
16+
runs=500
17+
fail_on_revert = true
18+
depth = 10
19+
20+
[profile.lite]
21+
solc = '0.8.19'
22+
via_ir = false
23+
optimizer = true
24+
optimizer_runs = 10_000
25+
ignored_error_codes = [3628]
26+
27+
[profile.deep.fuzz]
28+
runs = 10000
29+
30+
[profile.deep.invariant]
31+
runs = 5000
32+
depth = 32
33+
34+
[fmt]
35+
line_length = 115
36+
wrap_comments = true
37+
38+
[rpc_endpoints]
39+
mainnet = "${RPC_URL_MAINNET}"
40+
goerli = "${RPC_URL_GOERLI}"
41+
42+
[etherscan]
43+
mainnet = { key = "${ETHERSCAN_API_KEY}" }
44+
goerli = { key = "${ETHERSCAN_API_KEY}" }
45+
46+
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

lib/account-abstraction

Submodule account-abstraction added at 187613b

0 commit comments

Comments
 (0)