diff --git a/packages/contracts-rfq/contracts/FastBridgeV2.sol b/packages/contracts-rfq/contracts/FastBridgeV2.sol index 7f938f28f1..d52ecac002 100644 --- a/packages/contracts-rfq/contracts/FastBridgeV2.sol +++ b/packages/contracts-rfq/contracts/FastBridgeV2.sol @@ -262,6 +262,9 @@ contract FastBridgeV2 is Admin, IFastBridgeV2 { /// @inheritdoc IFastBridge function refund(bytes memory request) external { bytes32 transactionId = keccak256(request); + + if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect(); + BridgeTransaction memory transaction = getBridgeTransaction(request); if (hasRole(REFUNDER_ROLE, msg.sender)) { @@ -272,8 +275,7 @@ contract FastBridgeV2 is Admin, IFastBridgeV2 { if (block.timestamp <= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded(); } - // set status to refunded if still in requested state - if (bridgeStatuses[transactionId] != BridgeStatus.REQUESTED) revert StatusIncorrect(); + // if all checks passed, set to REFUNDED status bridgeStatuses[transactionId] = BridgeStatus.REFUNDED; // transfer origin collateral back to original sender diff --git a/packages/contracts-rfq/test/FastBridgeV2.Src.t.sol b/packages/contracts-rfq/test/FastBridgeV2.Src.t.sol index 8a0106d0c0..c80f818e3f 100644 --- a/packages/contracts-rfq/test/FastBridgeV2.Src.t.sol +++ b/packages/contracts-rfq/test/FastBridgeV2.Src.t.sol @@ -800,13 +800,11 @@ contract FastBridgeV2SrcTest is FastBridgeV2Test { } function test_refund_revert_statusNull() public { - vm.skip(true); // TODO: unskip when fixed vm.expectRevert(StatusIncorrect.selector); refund({caller: refunder, bridgeTx: ethTx}); } function test_refund_revert_statusProven() public { - vm.skip(true); // TODO: unskip when fixed bridge({caller: userA, msgValue: 0, params: tokenParams}); prove({caller: relayerA, bridgeTx: tokenTx, destTxHash: hex"01"}); vm.expectRevert(StatusIncorrect.selector); @@ -814,7 +812,6 @@ contract FastBridgeV2SrcTest is FastBridgeV2Test { } function test_refund_revert_statusClaimed() public { - vm.skip(true); // TODO: unskip when fixed bridge({caller: userA, msgValue: 0, params: tokenParams}); prove({caller: relayerA, bridgeTx: tokenTx, destTxHash: hex"01"}); skip(CLAIM_DELAY + 1);