You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TRON exact/permit2 facilitator re-broadcasts an already-settled payment when the same payload is resubmitted #122
@bankofai/x402-tron@2.1.2 (with @x402/core@2.29.0): after a successful settle, the pending-settlement record is deleted, so resubmitting the same payment payload builds and broadcasts a new settlement transaction. On-chain the Permit2 nonce is already consumed, so the transaction reverts — no double transfer, but the facilitator pays the energy/bandwidth fee for every replay.
Resource servers and clients legitimately retry the same PAYMENT-SIGNATURE after timeouts or ambiguous responses, so this turns ordinary retries into fee loss for the facilitator account.
Reproduction (Nile)
Run the exact/permit2 facilitator (x402Facilitator + ExactTronScheme with createFacilitatorTronSigner).
A later request with the same key finds no record and goes through submitPermit2Settlement again. There is no check that the Permit2 nonce is still unused (or a simulation) immediately before writeContract.
Suggestions
Keep a terminal record for successful settlements (at least until the authorization deadline) and return the original transaction on replay, or
Check the Permit2 nonce bitmap / simulate settle before broadcasting and fail without broadcasting when the nonce is spent.
Related observations (may be intentional)
The settle response reports payer as the 0x signing-form address from permit2Authorization.from rather than the TRON base58 address, and omits amount. Clients comparing receipts against the configured base58 payer need to account for this.
success: true is returned once the transaction is packed; at that moment the solidity node does not yet return the transaction. Documenting that success means "packed", not "solidified", would help integrators decide when to deliver.
Activity