Skip to content

Commit

Permalink
Merge branch 'develop' into features/Social-Recovery-Module-dict-atta…
Browse files Browse the repository at this point in the history
…ck-resistant
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Oct 17, 2023
2 parents ca0c97d + 2cd521a commit 0744132
Show file tree
Hide file tree
Showing 108 changed files with 2,114 additions and 4,700 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/push_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,28 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Create a fake .secret file
run: echo "primary twist rack vendor diagram image used route theme frown either will" > .secret

- name: Install dependencies
run: yarn install --frozen-lockfile && yarn build
- name: Run tests

- name: Run Hardhat Tests
run: yarn test

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

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: forge-build

- name: Run Forge tests
run: |
forge test -vvv
id: forge-test
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ node_modules
.idea
coverage
coverage.json
typechain
types/
dist/

#Hardhat files
cache
artifacts
artifacts-filtered
typechain
typechain-types


#ignore .DS_Store recursively
.DS_Store

deployments/localhost
deployments/localhost

typings
forge-cache
out
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
10 changes: 9 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ hardhat.config.ts
scripts
test
artifacts
artifacts-filtered
cache
out
coverage
.env
.env.*
Expand All @@ -16,6 +18,12 @@ src/utils/execution.ts
src/utils/multisend.ts
src/Create2Factory.ts
typings/
typechain
typechain-types
.husky/pre-commit
.prettierignore
.prettierrc
.prettierrc
.github/
deployments/localhost
src/AASigner.ts
src/deploy/
45 changes: 10 additions & 35 deletions contracts/smart-account/BaseSmartAccount.sol
Original file line number Diff line number Diff line change
@@ -1,70 +1,45 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;

import {IAccount} from "@account-abstraction/contracts/interfaces/IAccount.sol";
import {IBaseSmartAccount} from "./interfaces/IBaseSmartAccount.sol";
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {UserOperationLib, UserOperation} from "@account-abstraction/contracts/interfaces/UserOperation.sol";
import {BaseSmartAccountErrors} from "./common/Errors.sol";
import "@account-abstraction/contracts/core/Helpers.sol";

/**
* Basic account implementation.
* This contract provides the basic logic for implementing the IAccount interface: validateUserOp function
* Specific account implementation should inherit it and provide the account-specific logic
*/
abstract contract BaseSmartAccount is IAccount, BaseSmartAccountErrors {
abstract contract BaseSmartAccount is IBaseSmartAccount {
using UserOperationLib for UserOperation;

// Return value in case of signature failure, with no time-range.
// equivalent to _packValidationData(true,0,0);
uint256 internal constant SIG_VALIDATION_FAILED = 1;

/**
* @dev Initialize the Smart Account with required states.
* @param handler Default fallback handler for the Smart Account.
* @param moduleSetupContract Initializes the auth module; can be a factory or registry for multiple accounts.
* @param moduleSetupData Contains address of the Setup Contract and setup data.
* @notice Ensure this is callable only once (use initializer modifier or state checks).
*/
/// @inheritdoc IBaseSmartAccount
function init(
address handler,
address moduleSetupContract,
bytes calldata moduleSetupData
) external virtual returns (address);
) external virtual override returns (address);

/**
* Validates the userOp.
* @param userOp validate the userOp.signature field
* @param userOpHash convenient field: the hash of the request, to check the signature against
* (also hashes the entrypoint and chain id)
* @param missingAccountFunds the amount of funds required to pay to EntryPoint to pay for the userOp execution.
* @return validationData signature and time-range of this operation
* <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,
* otherwise, an address of an "authorizer" contract.
* <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite"
* <6-byte> validAfter - first timestamp this operation is valid
* If no time-range in account, return SIG_VALIDATION_FAILED (1) for signature failure.
* Note that the validation code cannot use block.timestamp (or block.number) directly.
*/
/// @inheritdoc IBaseSmartAccount
function validateUserOp(
UserOperation calldata userOp,
bytes32 userOpHash,
uint256 missingAccountFunds
) external virtual override returns (uint256);

/**
* @return nonce the account nonce.
* @dev This method returns the next sequential nonce.
* @notice Provides 2D nonce functionality by allowing to use a nonce of a specific key.
*/
function nonce(uint192 _key) public view virtual returns (uint256) {
/// @inheritdoc IBaseSmartAccount
function nonce(
uint192 _key
) public view virtual override returns (uint256) {
return entryPoint().getNonce(address(this), _key);
}

/**
* return the entryPoint used by this account.
* subclass should return the current entryPoint used by this account.
*/
/// @inheritdoc IBaseSmartAccount
function entryPoint() public view virtual returns (IEntryPoint);

/**
Expand Down
Loading

0 comments on commit 0744132

Please sign in to comment.