Function: retrieveDeposit(uint32 _depositNonce, GasParams _gParams)
The function sends a cross-chain request to set the status of a deposit to STATUS_FAILED if the deposit was not successfully executed on the Root chain. To initiate this, several conditions must be met: the deposit associated with _depositNonce must exist, the caller must be the owner of this deposit, and the deposit's status should not already be STATUS_FAILED.
Inputs
_depositNonceControl: Fully controlled by the caller.
Constraints: The caller must be the owner of the deposit related to this
_depositNonce.Impact: The status of this deposit will be changed to
STATUS_FAILEDif the deposit action was not successfully executed on the Root chain. Subsequently, the owner of the deposit will be able to redeem these deposited funds.
_gParamsControl: Fully controlled by the caller.
Constraints: There are no constraints.
Impact: These values are used to encode
AdapterParametersdata for the LayerZero relayer contract.
Branches and code coverage
Intended branches
Check that status was changed to
STATUS_FAILED.
Negative behavior
The deposit for
_depositNoncedoes not exist.
Function call analysis
this._performCall(address payable(msg.sender), payload, _gParams, BridgeAgentConstants.BRANCH_BASE_CALL_OUT_GAS) -> ILayerZeroEndpoint(this.lzEndpointAddress).send{value: msg.value}What is controllable? The caller controls
_depositNonceand must be the owner of this deposit; additionally, the_gParamsparameters are controlled by the caller.If the return value is controllable, how is it used and how can it go wrong? There is no return value.
What happens if it reverts, reenters or does other unusual control flow? The function can revert if the provided fee is insufficient.
this._performCall(address payable(msg.sender), payload, _gParams, BridgeAgentConstants.BRANCH_BASE_CALL_OUT_GAS) -> IRootBridgeAgent(this.rootBridgeAgentAddress).lzReceive{value: msg.value}What is controllable? The
payloadcontains the address of the initial caller and the_depositNonceprovided and owned by the caller.If the return value is controllable, how is it used and how can it go wrong? There is no return value.
What happens if it reverts, reenters or does other unusual control flow? If the
address(this).excessivelySafeCallcall is unsuccessful, it will return asuccessstatus of false, and all ETH balance of the contract will be transferred to the rootPortAddress contract. Therefore, thelzReceivefunction can only revert if thesafeTransferAllETHfunction fails during the transfer of funds to therootPortAddress.