-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
forge install: account-abstraction ver0.6.0 chore: clean interface comments
- Loading branch information
0 parents
commit c95bc28
Showing
117 changed files
with
22,735 additions
and
0 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,6 @@ | ||
DEPLOYER_PRIVATE_KEY= | ||
|
||
RPC_URL_MAINNET= | ||
RPC_URL_GOERLI= | ||
|
||
ETHERSCAN_API_KEY= |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
Borrowed from foundry. | ||
Thank you for your Pull Request. Please provide a description above and review | ||
the requirements below. | ||
Bug fixes and new features should include tests. | ||
--> | ||
|
||
## Motivation | ||
|
||
<!-- | ||
Explain the context and why you're making that change. What is the problem | ||
you're trying to solve? In some cases there is not a problem and this can be | ||
thought of as being the motivation for your change. | ||
If your PR solves a particular issue, tag that issue. | ||
--> | ||
|
||
## Solution | ||
|
||
<!-- | ||
Summarize the solution and provide any necessary context needed to understand | ||
the code change. | ||
--> |
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,110 @@ | ||
name: account-contracts Test CI | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
# Runs linter, tests, and inspection checker in parallel | ||
jobs: | ||
lint: | ||
name: Run Linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly-5be158ba6dc7c798a6f032026fe60fc01686b33b | ||
- run: forge install | ||
|
||
- run: forge fmt --check | ||
|
||
- name: "Check out the repo" | ||
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/*" | ||
|
||
- name: "Install the Node.js dependencies" | ||
run: "pnpm install" | ||
|
||
- 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 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly-5be158ba6dc7c798a6f032026fe60fc01686b33b | ||
|
||
- name: Install forge dependencies | ||
run: forge install | ||
|
||
- name: Build project | ||
run: forge build --sizes | ||
|
||
- name: Run tests | ||
run: FOUNDRY_PROFILE=deep forge test -vvv | ||
|
||
test-lite: | ||
name: Run Forge Tests [lite build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly-5be158ba6dc7c798a6f032026fe60fc01686b33b | ||
|
||
- name: Install forge dependencies | ||
run: forge install | ||
|
||
- name: Build project | ||
run: FOUNDRY_PROFILE=lite forge build | ||
|
||
- name: Run tests | ||
run: FOUNDRY_PROFILE=lite forge test -vvv |
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,8 @@ | ||
# Foundry build and cache directories | ||
out/ | ||
cache/ | ||
node_modules/ | ||
|
||
# coverage | ||
report/ | ||
lcov.info |
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,14 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/account-abstraction"] | ||
path = lib/account-abstraction | ||
url = https://github.com/eth-infinitism/account-abstraction | ||
branch = ver0.6.0 | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts | ||
branch = release-v4.9 | ||
[submodule "lib/light-account"] | ||
path = lib/light-account | ||
url = https://github.com/alchemyplatform/light-account |
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,17 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"immutable-vars-naming": ["error"], | ||
"no-unused-import": ["error"], | ||
"compiler-version": ["error", ">=0.8.21"], | ||
"func-visibility": ["error", { "ignoreConstructors": true }], | ||
"max-line-length": ["error", 120], | ||
"func-param-name-mixedcase": ["error"], | ||
"modifier-name-mixedcase": ["error"], | ||
"private-vars-leading-underscore": ["error"], | ||
"ordering": ["warn"], | ||
"no-inline-assembly": "off", | ||
"avoid-low-level-calls": "off", | ||
"no-complex-fallback": "off" | ||
} | ||
} |
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,16 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"func-name-mixedcase": "off", | ||
"immutable-vars-naming": ["error"], | ||
"no-unused-import": ["error"], | ||
"compiler-version": ["error", ">=0.8.21"], | ||
"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" | ||
} | ||
} |
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,82 @@ | ||
# Storage Layouts | ||
Generated via `bash utils/inspect.sh`. | ||
|
||
--- | ||
|
||
`forge inspect --pretty src/account/AccountExecutor.sol:AccountExecutor storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/account/BaseModularAccount.sol:BaseModularAccount storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/account/BaseModularAccountLoupe.sol:BaseModularAccountLoupe storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/account/DiamondStorageInitializable.sol:DiamondStorageInitializable storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/account/UpgradeableModularAccount.sol:UpgradeableModularAccount storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/factory/ModularAccountFactory.sol:ModularAccountFactory storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|---------------|---------|------|--------|-------|-------------------------------------------------------------| | ||
| _owner | address | 0 | 0 | 20 | src/factory/ModularAccountFactory.sol:ModularAccountFactory | | ||
| _pendingOwner | address | 1 | 0 | 20 | src/factory/ModularAccountFactory.sol:ModularAccountFactory | | ||
|
||
`forge inspect --pretty src/factory/ProxyLoader.sol:ProxyLoader storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/factory/verifiers/ECDSASigVerifier.sol:ECDSASigVerifier storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/plugins/BasePlugin.sol:BasePlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/plugins/TokenReceiverPlugin.sol:TokenReceiverPlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/plugins/owner/ExternalOwnerPlugin.sol:ExternalOwnerPlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|---------|-----------------------------|------|--------|-------|---------------------------------------------------------------| | ||
| _owners | mapping(address => address) | 0 | 0 | 32 | src/plugins/owner/ExternalOwnerPlugin.sol:ExternalOwnerPlugin | | ||
|
||
`forge inspect --pretty src/plugins/recovery/SocialRecoveryPlugin.sol:SocialRecoveryPlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------------------|--------------------------------------------------------------|------|--------|-------|--------------------------------------------------------------------| | ||
| _nameFallback | string | 0 | 0 | 32 | src/plugins/recovery/SocialRecoveryPlugin.sol:SocialRecoveryPlugin | | ||
| _versionFallback | string | 1 | 0 | 32 | src/plugins/recovery/SocialRecoveryPlugin.sol:SocialRecoveryPlugin | | ||
| _accountData | mapping(address => struct ISocialRecoveryPlugin.AccountData) | 2 | 0 | 32 | src/plugins/recovery/SocialRecoveryPlugin.sol:SocialRecoveryPlugin | | ||
|
||
`forge inspect --pretty src/plugins/security/AccountTimelockPlugin.sol:AccountTimelockPlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|---------------------|---------------------------------------------------------------|------|--------|-------|----------------------------------------------------------------------| | ||
| _seed | uint64 | 0 | 0 | 8 | src/plugins/security/AccountTimelockPlugin.sol:AccountTimelockPlugin | | ||
| _accountData | mapping(address => struct IAccountTimelockPlugin.AccountData) | 1 | 0 | 32 | src/plugins/security/AccountTimelockPlugin.sol:AccountTimelockPlugin | | ||
| _timelockExpiration | mapping(bytes32 => uint256) | 2 | 0 | 32 | src/plugins/security/AccountTimelockPlugin.sol:AccountTimelockPlugin | | ||
|
||
`forge inspect --pretty src/plugins/session/SessionKeyPlugin.sol:SessionKeyPlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/plugins/session/permissions/SessionKeyPermissionsBase.sol:SessionKeyPermissionsBase storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/plugins/session/permissions/SessionKeyPermissionsLoupe.sol:SessionKeyPermissionsLoupe storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
||
`forge inspect --pretty src/plugins/session/permissions/SessionKeyPermissionsPlugin.sol:SessionKeyPermissionsPlugin storage-layout` | ||
| Name | Type | Slot | Offset | Bytes | Contract | | ||
|------|------|------|--------|-------|----------| | ||
|
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,11 @@ | ||
{ | ||
"solidity.packageDefaultDependenciesContractsDirectory": "src", | ||
"solidity.packageDefaultDependenciesDirectory": "lib", | ||
"solidity.compileUsingRemoteVersion": "v0.8.21", | ||
"editor.formatOnSave": true, | ||
"[solidity]": { | ||
"editor.defaultFormatter": "JuanBlanco.solidity" | ||
}, | ||
"solidity.formatter": "forge", | ||
"search.exclude": { "lib": true } | ||
} |
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,51 @@ | ||
# Alchemy Modular Smart Contract Account (MSCA) | ||
|
||
Contracts for an upgradeable modular smart contract account that is compatible with ERC-4337 and ERC-6900, along with a set of plugins. | ||
|
||
## Development | ||
|
||
### Naming convention | ||
|
||
- `selector` is used for all function selectors. | ||
- `validation` and `validationFunction` are used to replace `validator`. | ||
- `associated` and `associatedFunction` are used to represents `validationFunction` and `hook` | ||
|
||
## Build | ||
|
||
```bash | ||
forge build | ||
|
||
# or use the lite profile to reduce compilation time | ||
FOUNDRY_PROFILE=lite forge build | ||
``` | ||
|
||
## Syntax check | ||
|
||
```bash | ||
pnpm lint:src && pnpm lint:test | ||
``` | ||
|
||
## Test | ||
|
||
```bash | ||
forge test -vvv | ||
|
||
# or use the lite profile to reduce compilation time | ||
FOUNDRY_PROFILE=lite forge test -vvv | ||
``` | ||
|
||
## Generate Inspections | ||
|
||
```bash | ||
bash utils/inspect.sh | ||
``` | ||
|
||
## Static Analysis | ||
|
||
```bash | ||
slither . | ||
``` | ||
|
||
## External Libraries | ||
|
||
We use Solady's highly optimized [UUPSUpgradeable](https://github.com/Vectorized/solady/blob/a061f38f27cd7ae330a86d42d3f15b4e7237f064/src/utils/UUPSUpgradeable.sol) in our contracts |
Oops, something went wrong.