when we see the. always, it overestimate the tx.outputs.length by adding +1. this would be reasonable when the array lenght is zero. but if the array is already filled with value, this would lead to case where more fee computation.
The issue here is, if the above condition does not met, the _skeleton.hasSufficientInputs never be updated.
Since the _netFee could add more value with totalTransfersValueWithoutChange, the above if check will not be executed.
later, when relayer try to enrichOutgoingTransaction, the function revert, since the inputsStorage.spendInput( is already spent.
Impact\
Since theinputsToSpend are flagged as spent in the storage, these can not be retried again.
Attachments
Revised Code File (Optional)
This can be fixed with following suggestions.
revert if the if check violates.
later, when retry, use bool flag to skip this if check.
This is a proper behaviour. Relayer will just call enrichOutgoingTransaction with more inputs until it has enough to cover the outputs total amount + fees
Github username: -- Twitter username: -- Submission hash (on-chain): 0xf742018bfbd540bf64c86535341145b736e3d29e50ae9c5b15fbaf309752629b Severity: high
Description: Description\
when a user initiate withdrawal, after taking the withdraw data from qeue, there are multiple seralizeing is done.
The flow could be like,
if we see the enrichOutgoingTransaction function, it does the following.
For each input in the provided list:
After that it checks,
AbstractTxSerializer.sol#L153-L156
when we see the. always, it overestimate the tx.outputs.length by adding +1. this would be reasonable when the array lenght is zero. but if the array is already filled with value, this would lead to case where more fee computation.
_estimateFees
The issue here is, if the above condition does not met, the
_skeleton.hasSufficientInputs
never be updated. Since the_netFee
could add more value withtotalTransfersValueWithoutChange
, the above if check will not be executed.later, when relayer try to
enrichOutgoingTransaction
, the function revert, since theinputsStorage.spendInput(
is already spent.Impact\
Since the
inputsToSpend
are flagged as spent in the storage, these can not be retried again.Attachments
This can be fixed with following suggestions.
if
check.