-
Notifications
You must be signed in to change notification settings - Fork 0
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
Execution may be stuck in destination chain as operators estimate gas consumption #433
Comments
Minor difference, execution won't be stuck as operation only need to supply gas as specified regardless of the estimation result. |
The estimation is accurate, caller of function knows |
To clarify, the estimation is accurate in the sense that it will have more gas limit available than is actually used. Meaning that there will be a bit of dust wei leftover still. An operator should never be in the negative if executing a job with this gas limit being set. |
The issue highlights that the gas which sender pays for, which is just the bridgeIn request, is less than what the operator estimates it will cost, because of the surrounding overhead. Therefore, it may be the case that operator decides the gas cost is too expensive and refuse to execute it, although user was honest and specified gas correctly. Does that make sense? |
Agree there would be an edge case that if the user submit the exact amount of gas will be rejected by operator. The risk seems to be low because at worst this should only cause some delay. |
I think it would cause more than delay, because if operator would refuse to executeJob this operation, the NFT would not be available in either chain. |
I think executeJob is permissionless after certain delay? |
Sure, but why would any executor take up an execution that is calculated to be too expensive? |
The user himself can execute the job, my point being the nft would not be lost. And I believe in most of the case the flow should prompt the user to include sufficient buffer to avoid this situation. |
Agree that user can always self execute, if it wasn't the case it would be HIGH risk as there is actually no way to rescue the NFT. However we are still talking about:
|
The fact that this require the user to intentionally submit the exact gas limit manually (which can be reasonably assumed to be prevented by UI) and an attacker cannot force a user into such situation (delay attack is not possible) make this issue low risk. |
Don't agree that this could only happen when user manually submits. We have no information ahead of time about how the UI works and whether it passes a spare gas limit over the actual gas amount. If it passes gas limit without buffers, the overestimation would lead gas limit to be too high and therefore not attractive for honest operators. |
Judging this as low risk and as a QA report |
Lines of code
https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/HolographOperator.sol#L567
Vulnerability details
Description
The Operator CLI uses jobEstimator() static function to calculate the required gas cost to perform executeJob(). The problem is that it overestimates used gas. The gas() opcode is called at the end of the assembly block, but needs to be calculated right after the call and correct for the memory storage of "result" variable:
The impact of this overestimation of gas is that honest operators may reject a job to be executed, as they calculate higher gas consumption which means it will not be executed successfully. Therefore, executions may be stuck on the destination chain indefinitely.
Impact
Executions may be stuck in destination chain.
Tools Used
Manual audit
Recommended Mitigation Steps
Gas needs to be calculated right after the call and correct for the memory storage of "result" variable:
The text was updated successfully, but these errors were encountered: