Skip to content

Fix blockchain transaction error handling#4094

Open
Bojan131 wants to merge 1 commit intov8/developfrom
fix/blockchain-error-handling
Open

Fix blockchain transaction error handling#4094
Bojan131 wants to merge 1 commit intov8/developfrom
fix/blockchain-error-handling

Conversation

@Bojan131
Copy link
Collaborator

What

Fixes various transient blockchain errors that caused publishes and other operations to fail unnecessarily — socket hang ups, connection resets, fee too low on Gnosis, RPC timeouts on NeuroWeb, and missed blockchain events.

Changes

Transaction retries (web3-service.js)

  • Added retry logic (up to 10 attempts) for transient RPC errors like socket hang up, connection reset, 502/503, fee too low
  • Gas price is only bumped on nonce or execution errors, not on network errors (avoids wasting gas)
  • Gas estimation now retries on transient failures instead of falling back to a fixed limit
  • Added a 60s timeout on initial RPC provider connection — prevents the node from hanging forever if an RPC endpoint is down

Gnosis gas fixes (gnosis-service.js)

  • Fixed EIP-1559 gas parameter building to properly calculate maxFeePerGas and maxPriorityFeePerGas
  • Fixed double gwei-parsing bug in gas price comparison that caused "max priority fee higher than max fee" errors

Event listener resilience (ot-ethers.js, blockchain-event-listener-command.js)

  • eth_getLogs now tries all configured RPC providers before giving up (was using a single random one)
  • Added a warning log when blockchain events are missed due to large block gaps

Error constants (constants.js)

  • Added new transient error patterns so the retry logic can catch them

Why

These errors were the main cause of failed publishes on Gnosis ("fee too low", "transaction execution fails"), Base ("socket hang up"), and NeuroWeb ("expect block number from id", node hanging on startup). The retry logic handles temporary RPC hiccups, and the gas fixes prevent permanent failures on Gnosis.

Made with Cursor

- Add retry logic for transient errors (socket hang up, connection reset, 502/503, fee too low)
- Only bump gas price on nonce/fee errors, not on network errors
- Add gas estimation retries for transient RPC failures
- Add 60s timeout on RPC provider connection to prevent node hanging on unresponsive RPCs
- Fix BigNumber NaN bug in gas price calculation during retry
- Fix Gnosis EIP-1559 gas params and double gwei-parsing in gas price comparison
- Add RPC failover for blockchain event fetching (try all providers before failing)
- Log warning when blockchain events are missed due to large block gaps

Made-with: Cursor
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