Skip to content

Commit

Permalink
Merge pull request #4 from rhinestonewtf/feature/remediation
Browse files Browse the repository at this point in the history
remediations
  • Loading branch information
kopy-kat authored Jul 8, 2024
2 parents d968e45 + e8cbed6 commit e17b03c
Show file tree
Hide file tree
Showing 31 changed files with 1,490 additions and 824 deletions.
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
test/
src/utils/Safe7579UserOperationBuilder.sol
Binary file not shown.
91 changes: 0 additions & 91 deletions broadcast/Deploy.s.sol/11155111/run-1715275639.json

This file was deleted.

91 changes: 0 additions & 91 deletions broadcast/Deploy.s.sol/11155111/run-latest.json

This file was deleted.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
"test:optimized": "pnpm run build:optimized && FOUNDRY_PROFILE=test-optimized forge test"
},
"dependencies": {
"@rhinestone/module-bases": "github:rhinestonewtf/module-bases",
"@ERC4337/account-abstraction": "github:kopy-kat/account-abstraction#develop",
"@ERC4337/account-abstraction-v0.6": "github:eth-infinitism/account-abstraction#v0.6.0",
"@rhinestone/erc4337-validation": "0.0.1-alpha.2",
"@rhinestone/module-bases": "github:rhinestonewtf/module-bases",
"@rhinestone/sentinellist": "github:rhinestonewtf/sentinellist",
"@rhinestone/checknsignatures": "github:rhinestonewtf/checknsignatures",
"@safe-global/safe-contracts": "^1.4.1",
"ds-test": "github:dapphub/ds-test",
"erc7579": "github:erc7579/erc7579-implementation",
Expand Down
742 changes: 442 additions & 300 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { Script } from "forge-std/Script.sol";
import { Safe7579 } from "src/Safe7579.sol";
import { Safe7579Launchpad } from "src/Safe7579Launchpad.sol";
import { IERC7484 } from "src/interfaces/IERC7484.sol";
import { MockRegistry } from "test/mocks/MockRegistry.sol";

Check warning on line 8 in script/Deploy.s.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

imported name MockRegistry is not used
import { Safe } from "@safe-global/safe-contracts/contracts/Safe.sol";

Check warning on line 9 in script/Deploy.s.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

imported name Safe is not used
import { SafeProxyFactory } from

Check warning on line 10 in script/Deploy.s.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

imported name SafeProxyFactory is not used
"@safe-global/safe-contracts/contracts/proxies/SafeProxyFactory.sol";
import { MockValidator } from "test/mocks/MockValidator.sol";

Check warning on line 12 in script/Deploy.s.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

imported name MockValidator is not used

/**
* @title Deploy
Expand All @@ -15,10 +20,16 @@ contract DeployScript is Script {
bytes32 salt = bytes32(uint256(0));

address entryPoint = address(0x0000000071727De22E5E9d8BAf0edAc6f37da032);
IERC7484 registry = IERC7484(0xe0cde9239d16bEf05e62Bbf7aA93e420f464c826);
IERC7484 registry = IERC7484(0x25A4b2F363678E13A0A5DB79b712dE00347a593E);

vm.startBroadcast(vm.envUint("PK"));

// new MockValidator{ salt: salt }();

// new Safe{ salt: salt }();
// new SafeProxyFactory{ salt: salt }();

// IERC7484 registry = new MockRegistry{ salt: salt }();
new Safe7579{ salt: salt }();
new Safe7579Launchpad{ salt: salt }(entryPoint, registry);

Expand Down
43 changes: 12 additions & 31 deletions src/ISafe7579.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
pragma solidity ^0.8.20;

import "./DataTypes.sol";
import { IERC7579Account } from "./interfaces//IERC7579Account.sol";

import { IERC7579Account } from "./interfaces/IERC7579Account.sol";
import { ModeCode } from "./lib/ModeLib.sol";
import { PackedUserOperation } from
"@ERC4337/account-abstraction/contracts/core/UserOperationLib.sol";
import { ISafeOp } from "./interfaces/ISafeOp.sol";

/**
* @title ERC7579 Adapter for Safe accounts.
* creates full ERC7579 compliance to Safe accounts
* @author rhinestone | zeroknots.eth, Konrad Kopp (@kopy-kat)
*/
interface ISafe7579 is IERC7579Account {
interface ISafe7579 is IERC7579Account, ISafeOp {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* Validation */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
Expand All @@ -30,7 +30,6 @@ interface ISafe7579 is IERC7579Account {
uint256 missingAccountFunds
)
external
payable
returns (uint256 packedValidSig);

/**
Expand Down Expand Up @@ -71,7 +70,7 @@ interface ISafe7579 is IERC7579Account {
* @param mode The encoded execution mode of the transaction. See ModeLib.sol for details
* @param executionCalldata The encoded execution call data
*/
function execute(ModeCode mode, bytes memory executionCalldata) external payable;
function execute(ModeCode mode, bytes memory executionCalldata) external;

/**
* @dev Executes a transaction on behalf of the Safe account.
Expand All @@ -95,7 +94,6 @@ interface ISafe7579 is IERC7579Account {
bytes memory executionCalldata
)
external
payable
returns (bytes[] memory returnDatas);

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
Expand All @@ -117,13 +115,7 @@ interface ISafe7579 is IERC7579Account {
* @param initData arbitrary data that may be required on the module during `onInstall`
* initialization.
*/
function installModule(
uint256 moduleType,
address module,
bytes memory initData
)
external
payable;
function installModule(uint256 moduleType, address module, bytes memory initData) external;

/**
* Uninstalls a Module of a certain type on the smart account.
Expand All @@ -142,8 +134,7 @@ interface ISafe7579 is IERC7579Account {
address module,
bytes memory deInitData
)
external
payable;
external;

/**
* Function to check if the account has a certain module installed
Expand Down Expand Up @@ -190,8 +181,7 @@ interface ISafe7579 is IERC7579Account {
ModuleInit[] memory hooks,
RegistryInit memory registryInit
)
external
payable;
external;

/**
* This function is intended to be called by Launchpad.validateUserOp()
Expand All @@ -201,7 +191,7 @@ interface ISafe7579 is IERC7579Account {
* @dev Note: this function DOES NOT call onInstall() on the validator modules or emit
* ModuleInstalled events. this has to be done by the launchpad
*/
function launchpadValidators(ModuleInit[] memory validators) external payable;
function initializeAccountWithValidators(ModuleInit[] memory validators) external;

/**
* Configure the Safe7579 with a IERC7484 registry
Expand All @@ -214,8 +204,8 @@ interface ISafe7579 is IERC7579Account {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* Query Account Details */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function getValidatorPaginated(
address start,
function getValidatorsPaginated(
address cursor,
uint256 pageSize
)
external
Expand Down Expand Up @@ -243,14 +233,7 @@ interface ISafe7579 is IERC7579Account {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* Query Misc */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function supportsExecutionMode(ModeCode encodedMode) external pure returns (bool supported);
function supportsModule(uint256 moduleTypeId) external pure returns (bool);
function accountId() external view returns (string memory accountImplementationId);

/**
* Domain Separator for EIP-712.
*/
function domainSeparator() external view returns (bytes32);
/**
* Safe7579 is using validator selection encoding in the userop nonce.
* to make it easier for SDKs / devs to integrate, this function can be
Expand All @@ -264,18 +247,16 @@ interface ISafe7579 is IERC7579Account {
/* Custom Errors */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
error InvalidModule(address module);
error LinkedListError();
error InitializerError();
error ValidatorStorageHelperError();
error InvalidModuleType(address module, uint256 moduleType);

// fallback handlers
error InvalidInput();
error InvalidCallType(CallType callType);
error NoFallbackHandler(bytes4 msgSig);
error InvalidFallbackHandler(bytes4 msgSig);
error FallbackInstalled(bytes4 msgSig);

// Hooks
error HookPostCheckFailed();
error HookAlreadyInstalled(address currentHook);
error InvalidHookType();

Expand Down
Loading

0 comments on commit e17b03c

Please sign in to comment.