Skip to content

client/eth: Use total fee comparison for relay fee validation.#3575

Open
JoeGruffins wants to merge 6 commits intodecred:masterfrom
JoeGruffins:relayfee
Open

client/eth: Use total fee comparison for relay fee validation.#3575
JoeGruffins wants to merge 6 commits intodecred:masterfrom
JoeGruffins:relayfee

Conversation

@JoeGruffins
Copy link
Member

Sorry some unrelated commits in here just in a hurry. This also makes it so client can recover if a redeem is done manually.

@JoeGruffins JoeGruffins requested a review from martonp March 19, 2026 08:30
vboxuser added 6 commits March 19, 2026 08:36
The previous approach back-calculated the relay's per-gas profit using
the client's own base fee. Since the client and relay often use
different RPC providers with different base fees, the 2.2x base fee
multiplier amplified small differences into large tip miscalculations,
causing false rejections.

Instead of extracting the per-gas tip, compare the relay's total fee
against what the client would estimate using its own network fees and
a generous max relay tip. Accept anything within 150% of that estimate
to tolerate base fee variance while still rejecting unreasonable fees.
logoPath checked BipSymbols before stripping the token suffix, so
symbols like pol.eth were not recognized and fell back to a single
letter. Strip the suffix first so the base symbol is matched.
When a swap has been redeemed externally (e.g. via emergency gasless
redeem), the ETH wallet now detects this in two places:

In validateRedemptions, if isRedeemable returns false but the on-chain
status is SSRedeemed, return ErrSwapRedeemed with the redeemed value.
The Redeem method catches this and returns synthetic success data so
core advances the match state normally.

In confirmTransaction, before declaring a tx lost, check the contract
state. If the contract shows SSRedeemed, return confirmed instead of
ErrTxLost, preventing the match status from being reverted.

Also add MatchComplete to isRedeemable's early return to prevent
redundant redeem attempts on already-completed matches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant