Skip to content

Generic UTXO Client

Ursa (9R) requested to merge ursa/utxo-client into develop

This contains refactoring for a new generic UTXO package leveraging the Ethereum rpc package for JSON RPC in order to avoid the primary performance issues noted in #1544 (closed):

  • Connection reuse avoids DNS lookup and connection re-establishment on every RPC call
  • Exposure of batch RPCs for mempool and transaction fetch avoids head of line blocking on latency (doubly important for DOGE which requires transaction fanout on every block)

This will consolidate all UTXO chains into a single place which aims to share the same code paths as much as possible, and simply switch around the client chain where behavior between chains diverge (or type conversions for underlying libraries are necessary). The initial implementation remains close to the original UTXO clients to simplify folding in the others, but some refactoring was necessary to make the structure chain-agnostic, along with some minor cleanup. PRs to add subsequent chains will be much smaller. After all UTXO chains have been folded in, we can perform further polish (added some TODO comments to revisit).

The only chain added to the initial pass is DOGE, since it receives the greatest efficiency gain due to the need to fanout to all transaction in the block. Following successful rollout, we'll proceed with folding the other chains into this package in order of depth: BCH, LTC, BTC. The new client version is flagged on via config or environment variable, and each chain rollout will follow the tentative process:

  • Leverage new client in smoke tests (already enabled there)
  • Deploy and test in stagenet
  • 9R deploys a canary node with the new client version for one week
  • 9R deploys many nodes with the new client version for one week
  • (need to confirm with 9R that we're open to taking the above risk)
  • New client version is made default for the network on subsequent release
  • Hold for one week of full network adoption with no issues found
  • PR to remove legacy client from code
  • PR to fold next chain in the list into the utxo package

Review notes:

  • Tests are pretty much verbatim from the corresponding files in the dogecoin package (will add all tests from other chains the same way as they're folded in)
  • Might be easiest to review by pulling up the dogecoin chain in an editor and jump to the same function for comparison
  • This is a good chance to audit the client, so if there's other things you notice in review that we should come back to even if they're not specific to this, flag in comment and I'll add a TODO
Edited by Ursa (9R)

Merge request reports