Polygon RBF, Verification Hardening, and NR Alerting
Version: 1.0.0 Date: 2026-07-15
Goal: Operate Polygon proofs reliably in production — correct verification states, recover stuck mempool TX via RBF, and alert on long-pending transactions in New Relic.
New feature — RBF replay
Solution: POST /polygon/replay fetches the original TX, queries Polygon Gas Station for fast fee, resubmits with same nonce (Replace-By-Fee). Protected by global HMAC AuthGuard.
Request:
{ "txHash": "0xabc..." }
Response:
{ "newTxHash": "0xdef...", "updatedProofs": 2 }
Post-replay consistency:
- Rewrite local proof files with new
transactionHash - Update MongoDB polygon proof records (
type: polygonfilter) - OTel span
Replay-polygonwithbcyip:transaction.replay.newHash
Bug fixes — verification
False confirmed (null blockNumber):
- Guard
tx.blockNumberbeforegetBlock()—getBlock(null)returned latest block;nullcoerced to0in arithmetic → bypassedminConfirmations
Dropped mempool TX:
TransactionDroppedErrorwhengetTransaction()returns nullverifyProofs()returns{ verified, failed }; caller runsfailProofs()+polygonService.cleanup()
New Relic false positives:
- Pending TX: return null, do not
triggerSpanError - Dropped TX:
transaction.droppedspan event, not error - Guard
undefinedtransactionHash (no0xundefinedRPC)
Improvement — OTel for alerting
Attributes on #verifyTransaction span:
bcyip:transaction.status—pending|confirming|confirmed|droppedbcyip:transaction.hash
NRQL (pending > 2h):
FROM Span SELECT count(*)
WHERE name = '#verifyTransaction'
AND bcyip.transaction.status = 'pending'
SINCE 2 hours ago
FACET bcyip:transaction.hash
Files Modified:
src/services/polygon/polygon.service.ts- RBF, verification, OTel attributessrc/database/database.service.ts-getPolygonPendingProofsByTxHash(),updatePolygonTransactionHash(),failProofs()src/database/database.types.ts-ForgeTask.REPLAY,WithStatus+failedsrc/app.service.ts-replayPolygon(), verify cleanupsrc/app.controller.ts-POST /polygon/replay
Release fragment: feat-polygon-rbf-monitoring