Skip to content

Instantly share code, notes, and snippets.

@pipermerriam
Last active March 22, 2018 10:04
Show Gist options
  • Save pipermerriam/fa43310322320ac6904046e7e4da243a to your computer and use it in GitHub Desktop.
Save pipermerriam/fa43310322320ac6904046e7e4da243a to your computer and use it in GitHub Desktop.

test_ namespaced JSON-RPC endpoints

We propose the following new JSON-RPC endpoints to be optionally implemented by clients.

The motivation for these new endpoints is to allow the following use cases.

  • External integration testing (e.g. web3 style libraries).
  • Execution of JSON fixture tests over RPC (grey box testing).
  • Build JSON test fixtures.

Endpoints

Enabled by a flag of some sort like --enable-testrpc.

  • test_resetGenesis TBD define format for genesis params (use BlockchainTests format as base). -> wipes any chain state when called.
  • test_importBlock or test_importRawBlock or test_importRLPBlock?????, does NOT bypass validation/verification.
  • test_snapshot - Exact copy of State and Chain database up to last mined/finalized block. -> id
  • test_revert - Revert to snapshot denoted by id. Discards any pending state like unmined transactions.
  • test_mineBlock - bypass TBD header validation. extraData/coinbase/timestamp
  • test_knownAccounts - returns enumerated list of account addresses.
  • test_exportFixture - returns a BlockchainTest formatted json body.
mineBlocks() -> mine 1 block
mineBlocks([{}, {}]) -> naively mine n blocks.
mineBlocks([{'timestamp': 12345}]) -> mine blocks for each of the list of header overrides.
mineBlocks([{'pow': True}]) -> mine blocks for each item in list, if `pow == True` in any header params, mine using proof of work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment