Skip to content

Commit

Permalink
fixed dependency issues
Browse files Browse the repository at this point in the history
add ERC1271 to interfaces

fix contract size limit

foo
  • Loading branch information
zeroknots committed Nov 13, 2024
1 parent c0913d7 commit 9d04cbe
Show file tree
Hide file tree
Showing 12 changed files with 521 additions and 349 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Compiler files
Deploy.toml
cache/
out/
cache_forge/
Expand Down
10 changes: 3 additions & 7 deletions Deploy.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[deployments]
rpcs = [
"http://localhost:8545",
"https://base-sepolia.g.alchemy.com/v2/UFjkvGA-mZ1AuvJaQjQYjpgw3WFqGNjr"
]


Expand All @@ -10,10 +10,6 @@ entrypoint = "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
proxy_admin = "0x0000000071727De22E5E9d8BAf0edAc6f37da032" #todo

[deployments.module.SmartSession]
gh_artifacts_url = "https://api.github.com/repos/erc7579/smartsessions/actions/artifacts/2171696454/zip"
salt = "0x0000000000000000000000000000000000000000e5068a3f93a9e201a1832999"
gh_artifacts_url = "https://api.github.com/repos/erc7579/smartsessions/actions/artifacts/2180128402/zip"
salt = "0x0000000000000000000000000000000000000000e5068a3f93a9e201a1832998"

[deployments.module.SudoPolicy]
file = "./artifacts/SudoPolicy/SudoPolicy.json"
source_file_url = "./artifacts/SudoPolicy/verify.json"
salt = "0x0000000000000000000000000000000000000000e5068a3f93a9e201a1832997"
1 change: 1 addition & 0 deletions artifacts/SmartSession/SmartSession.json

Large diffs are not rendered by default.

229 changes: 229 additions & 0 deletions artifacts/SmartSession/verify.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions contracts/SmartSession.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pragma solidity ^0.8.25;
import "./DataTypes.sol";

import { IERC7579Account } from "erc7579/interfaces/IERC7579Account.sol";
import { IAccountExecute } from "modulekit/external/ERC4337.sol";
import { PackedUserOperation } from "modulekit/external/ERC4337.sol";
import { EIP1271_MAGIC_VALUE, IERC1271 } from "module-bases/interfaces/IERC1271.sol";
import { IAccountExecute } from "account-abstraction/interfaces/IAccountExecute.sol";
import { PackedUserOperation } from "account-abstraction/interfaces/PackedUserOperation.sol";
import { EIP1271_MAGIC_VALUE, IERC1271 } from "./interfaces/IERC1271.sol";
import { ExecType, CallType, CALLTYPE_BATCH, CALLTYPE_SINGLE, EXECTYPE_DEFAULT } from "erc7579/lib/ModeLib.sol";

import { ISmartSession } from "./ISmartSession.sol";
Expand Down
19 changes: 19 additions & 0 deletions contracts/interfaces/IERC1271.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.8.0 <0.9.0;

// bytes4(keccak256("isValidSignature(bytes32,bytes)")
bytes4 constant EIP1271_MAGIC_VALUE = 0x1626ba7e;

interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param _dataHash Arbitrary length data signed on behalf of address(this)
* @param _signature Signature byte array associated with _data
*
* MUST return the bytes4 magic value 0x1626ba7e when function passes.
* MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc >
* 0.5)
* MUST allow external calls
*/
function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view returns (bytes4);
}
3 changes: 1 addition & 2 deletions contracts/lib/PolicyLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { ValidationDataLib } from "./ValidationDataLib.sol";
import { IdLib } from "./IdLib.sol";
import { EnumerableSet } from "../utils/EnumerableSet4337.sol";

import { ERC7579ValidatorBase } from "modulekit/Modules.sol";
import { PackedUserOperation } from "modulekit/external/ERC4337.sol";
import { PackedUserOperation } from "account-abstraction/interfaces/PackedUserOperation.sol";
import { CallType, CALLTYPE_DELEGATECALL, EXECTYPE_DEFAULT, EXECTYPE_TRY } from "erc7579/lib/ModeLib.sol";
import { IERC7579Account } from "erc7579/interfaces/IERC7579Account.sol";
import { ExcessivelySafeCall } from "excessively-safe-call/ExcessivelySafeCall.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ValidationDataLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import { ValidationData } from "../DataTypes.sol";
import { _packValidationData } from "@ERC4337/account-abstraction/contracts/core/Helpers.sol";
import { _packValidationData } from "account-abstraction/core/Helpers.sol";
// @author zeroknots rhinestone

library ValidationDataLib {
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
fuzz = { runs = 1_000 }
gas_reports = ["*"]
optimizer = true
optimizer_runs = 10_0
optimizer_runs = 800
out = "out"
script = "script"
solc = "0.8.27"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"name": "Biconomy & Rhinestone"
},
"dependencies": {
"erc7579": "github:erc7579/erc7579-implementation#b3f8bcb2df3aae3217213ffa8b7a87c1eb42ec56",
"@rhinestone/flatbytes": "github:rhinestonewtf/flatbytes",
"@rhinestone/modulekit": "^0.4.17",
"@rhinestone/modulekit": "0.4.8",
"freshcryptolib": "github:rdubois-crypto/FreshCryptoLib",
"solmate": "github:transmissions11/solmate",
"stringutils": "github:Arachnid/solidity-stringutils"
Expand Down
592 changes: 259 additions & 333 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/mock/MockK1Validator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PackedUserOperation } from "modulekit/external/ERC4337.sol";
import { ECDSA } from "solady/utils/ECDSA.sol";
import { SignatureCheckerLib } from "solady/utils/SignatureCheckerLib.sol";
import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import { EIP1271_MAGIC_VALUE, IERC1271 } from "module-bases/interfaces/IERC1271.sol";
import { EIP1271_MAGIC_VALUE, IERC1271 } from "contracts/interfaces/IERC1271.sol";
import "forge-std/console2.sol";

contract MockK1Validator is IValidator {
Expand Down

0 comments on commit 9d04cbe

Please sign in to comment.