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.
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
ortest_importRawBlock
ortest_importRLPBlock
?????, does NOT bypass validation/verification.test_snapshot
- Exact copy of State and Chain database up to last mined/finalized block. -> idtest_revert
- Revert to snapshot denoted byid
. 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.