Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check UserOperation Sender #335

Open
wants to merge 1 commit into
base: feat/aa-v7
Choose a base branch
from
Open

Conversation

ylv-io
Copy link
Collaborator

@ylv-io ylv-io commented Jan 8, 2025

Description

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Deployment
  • Forge Script
  • Code refactor / cleanup
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

Issue Resolution

…nction, adding PackedUserOperation import, and updating tests to validate handleOps with KintoWallets.
@ylv-io ylv-io changed the base branch from main to feat/aa-v7 January 8, 2025 22:16
Copy link

Check UserOperation Sender

Generated at commit: 8f934a3c3a45ee1316877d87659add13d91d2da7

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
4
2
0
11
39
56
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Copy link

github-actions bot commented Jan 8, 2025

Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

encode-packed-collision

Impact: High
Confidence: High

function compress(PackedUserOperation calldata op) external view returns (bytes memory compressed) {
// decode `callData` (selector, target, value, bytesOp)
bytes4 selector = bytes4(_slice(op.callData, 0, 4));
bytes memory callData = _slice(op.callData, 4, op.callData.length - 4);
// set flags based on conditions
uint8 flags = _flags(selector, op, callData);
bytes memory buffer = abi.encodePacked(flags);
// encode `sender`, `nonce` and `initCode`
buffer = abi.encodePacked(buffer, op.sender, uint32(op.nonce), uint32(op.initCode.length), op.initCode);
console2.logBytes(buffer);
// encode `callData` depending on the selector
if (selector == IKintoWallet.execute.selector) {
// if selector is `execute`, encode the callData as a single operation
(address target, uint256 value, bytes memory bytesOp) = abi.decode(callData, (address, uint256, bytes));
buffer = _encodeExecuteCalldata(op, target, value, bytesOp, buffer);
} else {
// if selector is `executeBatch`, encode the callData as a batch of operations
(address[] memory targets, uint256[] memory values, bytes[] memory bytesOps) =
abi.decode(callData, (address[], uint256[], bytes[]));
buffer = _encodeExecuteBatchCalldata(targets, values, bytesOps, buffer);
}
// encode gas params
buffer = abi.encodePacked(buffer, op.accountGasLimits, op.gasFees, uint32(op.preVerificationGas));
console2.logBytes(buffer);
// if there is a paymaster, then encode it's gas settings
if (flags & 0x02 == 0x02) {
buffer = abi.encodePacked(buffer, op.paymasterAndData[20:52]);
}
console2.log("op.signature.length:", op.signature.length);
console2.logBytes(op.signature);
// encode `signature` content
buffer = abi.encodePacked(buffer, uint32(op.signature.length), op.signature);
console2.logBytes(buffer);
return LibZip.flzCompress(buffer);
}

unchecked-transfer

Impact: High
Confidence: Medium

function withdraw(address asset, uint256 amount) public returns (uint256) {
address pool = poolAddressProvider.getPool();
// If amount is max uint256, withdraw all available
if (amount == type(uint256).max) {
amount = IERC20(IAavePool(pool).getReserveData(asset).aTokenAddress).balanceOf(address(this));
}
// Withdraw from Aave
IAavePool(pool).withdraw(asset, amount, address(this));
// Send the fee to the Safe
uint256 fee = amount * FEE / 1e18;
IERC20(asset).transfer(safe, fee);
return amount - fee;
}

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.18%. Comparing base (3af76f4) to head (8f934a3).

Additional details and impacted files
@@              Coverage Diff               @@
##           feat/aa-v7     #335      +/-   ##
==============================================
+ Coverage       88.70%   89.18%   +0.47%     
==============================================
  Files              41       41              
  Lines            2533     2525       -8     
==============================================
+ Hits             2247     2252       +5     
+ Misses            286      273      -13     
Files with missing lines Coverage Δ
src/apps/KintoAppRegistry.sol 94.76% <100.00%> (+5.77%) ⬆️

if (_isSystemContract[to]) return true;

// Deployer EOAs are allowed to use CREATE and CREATE2
if (to == address(0) || to == CREATE2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this logic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this function not called anymore by geth?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants