Enhanced validation in retryDepositSigned
and retryDeposit
functions
In the current implementation of the retryDepositSigned
function, the conditional check is implemented: if (deposit.isSigned == UNSIGNED_DEPOSIT) revert
. This condition triggers a revert if the deposit.isSigned
matches UNSIGNED_DEPOSIT
. Presently, the contract recognizes only two distinct states: SIGNED_DEPOSIT
and UNSIGNED_DEPOSIT
. However, given that isSigned
is defined as a uint88
, there exists a theoretical possibility for it to acquire a value beyond these two predefined states.
To ensure robustness and accommodate any future expansions or unforeseen scenarios, it is advisable to modify the validation logic. A more comprehensive approach would be to implement the check as if (deposit.isSigned != SIGNED_DEPOSIT) revert
. This modification ensures that the function only proceeds when the deposit is explicitly in the SIGNED_DEPOSIT
state, thereby enhancing the system's resilience against potential anomalies or changes in state definitions.
This recommendation for enhanced validation logic is equally applicable to the retryDeposit
function, where a similar pattern of state verification is observed. Implementing this change will contribute to the overall reliability and maintainability of the contract's codebase.
function retryDepositSigned(
uint32 _depositNonce,
bytes calldata _params,
GasParams calldata _gParams,
bool _hasFallbackToggled
) external payable override lock {
// Get Settlement Reference
Deposit storage deposit = getDeposit[_depositNonce];
// Check if deposit is signed
if (deposit.isSigned == UNSIGNED_DEPOSIT) revert NotDepositOwner();
...
}