feat: fix input decoding in usv3 executor and execution dispatcher

This commit is contained in:
royvardhan
2025-02-14 00:53:43 +05:30
parent bd1971334e
commit 80500e615e
10 changed files with 237 additions and 321 deletions

View File

@@ -2,6 +2,7 @@
pragma solidity ^0.8.26;
import "@interfaces/IExecutor.sol";
import "forge-std/console.sol";
error ExecutionDispatcher__UnapprovedExecutor();
error ExecutionDispatcher__NonContractExecutor();
@@ -80,11 +81,16 @@ contract ExecutionDispatcher {
calculatedAmount = abi.decode(result, (uint256));
}
function _handleCallback(address executor, bytes calldata data) internal {
function _handleCallback(bytes calldata data) internal {
// Take last 20 bytes (excluding the final byte)
address executor =
address(bytes20(data[data.length - 21:data.length - 1]));
if (!executors[executor]) {
revert ExecutionDispatcher__UnapprovedExecutor();
}
// slither-disable-next-line controlled-delegatecall,low-level-calls
(bool success, bytes memory result) = executor.delegatecall(
abi.encodeWithSelector(IExecutor.handleCallback.selector, data)
);