Conversation
| validate_from_to_addresses(tx_from_rpc, maker_address, maker_swap_v2_contract).map_mm_err()?; | ||
| let taker_address = self.my_addr().await; | ||
|
|
||
| match tx.unsigned().action() { |
There was a problem hiding this comment.
Why not make a function similar to the validate_from_to_addresses fn to validate to and from?
Or, we could even reuse validate_from_to_addresses fn if we change it to accept SignedEthTx:
https://github.com/KomodoPlatform/komodo-defi-framework/compare/fix/eth-swapv2-offline-maker-payment-validation...dimxy:komodo-defi-framework:validate-from-reuse-suggestion?expand=1
There was a problem hiding this comment.
Thanks for the suggestion and the detailed code changes. Fixed here c13654b
…tion in `validate_maker_payment_v2_impl`
e5196fc to
0d7d442
Compare
…nvert Web3 tx to `SignedEthTx` in taker/NFT paths
0d7d442 to
c13654b
Compare
|
Was planning to work on the todo in #2618 (comment) but since I already got an approval, I will do it in another PR. |
I thought the PR was ready for merge as it's not in a draft mode. |
It's totally fine, I think it's better to keep it short :) |
|
but in |
There is a todo in the opening comment about As for |
dimxy
left a comment
There was a problem hiding this comment.
LGTM.
Validate maker payment from the signed tx bytes (offline), without requiring mempool presence, while deferring on-chain visibility to the existing confirmation step.
Agree that we should not rely on tx presence in mempool, we need at least one confirmation
* dev: fix(TPU): correct dexfee in check balance to prevent swap failures (#2600) fix(tests): fix/remove kmd rewards failing test (#2633) chore(ci): bump CI container image to debian bullseye-slim to match dev (#2641) chore(release): add changelog entries for v2.5.2-beta (#2639) chore(release): bump mm2 version to 2.5.2-beta (#2638) feat(ci): add macos universal2 build (#2628) fix(metrics): remove memory_db size metric (#2632) fix(zcoin): exact-anchor witnesses in wasm get_spendable_notes (#2629) fix(evm-swapv2): no mempool inclusion required for maker payment validation (#2618) chore(rust 1.90): make CI clippy/fmt pass Revert "fix(ordermatch): ignore loop-back; clear on null root; reject stale keep-alives (#2580)" Revert "fix(orderbook): validate roots before commit (#2605)"
…dation (#2618) This commit validates maker payment from the signed tx bytes (offline), without requiring mempool presence, while deferring on-chain visibility to the existing confirmation step. It fixes a problem where taker-side validation failed when the maker broadcasted via private/MEV-protected relays.
Problem
Taker-side validation failed when the maker broadcasted via private/MEV-protected relays (e.g., Polygon protect RPC), because the tx wasn’t visible on public RPCs. This caused false negatives and unnecessary refunds.
What this PR changes
Validate maker payment from the signed tx bytes (offline), without requiring mempool presence, while deferring on-chain visibility to the existing confirmation step.
Why this isn’t a complete solution
Offline checks don’t prove the maker actually broadcasted the tx. If the maker never submits the tx (and taker doesn’t rebroadcast it), the taker still waits until the maker-payment confirmation timeout before switching to the “immediate refund” path (refund via taker’s secret). This fixes the false‑negatives, but the drawback is that fast‑fail isn’t kept. The taker now may wait until the timeout if the maker never broadcasts.
Future Work
validate_taker_funding_impl: Only a brief visibility delay is needed to find the transaction, since there’s no confirmation step yet (we may need to add one). Note: there is no need for a fast-fail for this step as the maker’s payment hasn’t been broadcast.send_raw_transactionreturns the expected tx hash, oreth_getTransactionByHashand proceed only if the hash is visible (pending or included)