From bdccf1730bcc14060d1e6d666d1ede61ddf1fb9a Mon Sep 17 00:00:00 2001 From: Flotapponnier Date: Mon, 21 Sep 2026 01:06:12 +0200 Subject: [PATCH] terminal-fill: destination gas on Relay rows = the actual execution Relay reports minus the app-sponsored part (the quoted userPays overstated it: 0.204 vs 0.126 $ on a pump.fun buy) Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01L4rjxemTvgRwrCG6D2iK5D --- .../cmd/script/xchain.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/harnesses/terminal-fill-quality/cmd/script/xchain.go b/harnesses/terminal-fill-quality/cmd/script/xchain.go index 0496cf409..56d9d78f6 100644 --- a/harnesses/terminal-fill-quality/cmd/script/xchain.go +++ b/harnesses/terminal-fill-quality/cmd/script/xchain.go @@ -232,6 +232,9 @@ type relayRaw struct { UserPays struct { AmountUsd string `json:"amountUsd"` } `json:"userPays"` + Sponsored struct { + AmountUsd string `json:"amountUsd"` + } `json:"sponsored"` } `json:"components"` } `json:"quoted"` } `json:"feeSponsorship"` @@ -724,11 +727,25 @@ func classify(a xchainApp, c originChain, r relayRaw) (relayRequest, bool) { } } if v, ok := comps["execution"]; ok { - x.DestGasUsd = f64(v.UserPays.AmountUsd) + x.DestGasUsd = f64(v.UserPays.AmountUsd) // the quoted gas the user paid; replaced by the actual below when reported } } else { x.AppFeeUsd = appFee } + // The gas actually spent on the destination (Relay's actual execution), + // less the part the app sponsored: what the user really paid for gas. + // The quoted gas above overstates it (quoted 0.204 $, actual 0.126 $ on + // a pump.fun app buy on Robinhood Chain); the difference is Relay's. + if v, ok := r.Data.ExpandedPriceImpact.Actual["execution"]; ok && f64(v.Usd) != 0 { + actual := math.Abs(f64(v.Usd)) + if c, ok := comps["execution"]; ok { + actual -= f64(c.Sponsored.AmountUsd) + } + if actual < 0 { + actual = 0 + } + x.DestGasUsd = actual + } for _, k := range []string{"fixed", "price"} { if v, ok := r.Data.FeesUsd[k]; ok { x.RelayFixedUsd += math.Abs(f64(v))