Fee Calculators
TrustedSignerFeeCalculator.sol
This calculator allows the caller to be validated against using a pre-generated signature either globally or against an specific pool. If the sender has not obtained a valid signature, then the call will be rejected.
[MEDIUM] Signature Replay Attacks
If the same signature and deadline are reused, the signature could be replayed in multiple transactions until the deadline expires. There is no nonce or unique identifier to prevent replay, nor is there a mapping of previously used signatures.
We would recommend either include a unique nonce in the signature, or to include a mechanism to mark signatures as used (e.g. a mapping of used hashes) to prevent replay attacks.
error HashAlreadyUsed();
mapping (bytes32 => bool) internal _usedHashes;
function trackSwap(...) public view {
// Existing logic..
// Create the message hash from the `tx.origin`. This cannot be handled from `msg.sender`.
bytes32 messageHash = keccak256(abi.encodePacked(tx.origin, signedMessage.deadline));
if (_usedHashes[messageHash]) {
revert HashAlreadyUsed(messagedHash);
}
// Existing logic..
_usedHashes[messageHash] = true;
}
[INFO] Reentrancy in setTrustedPoolKeySigner
As any PoolKey can be entered, any contract address could be technically added and have the creator function called. This could lead to reentrancy, although there are no calls within the function that could be exploited.