interchaintest icon indicating copy to clipboard operation
interchaintest copied to clipboard

Chain state should be cached on startup (opt-in)

Open DavidNix opened this issue 2 years ago • 4 comments

Problem

The test setup can take a long time (> 60s) to create clients, connections, channels, faucet accounts, test accounts, etc.

Proposal

Allow a developer (or perhaps an end user) to optionally specify a starting state that already has the above mentioned transactions. That way, we can skip the setup and quickly get into more interesting aspects of IBC such as transfering funds from one chain to another.

This option could be part of the matrix file or command line flags.

Goals

  • MVP supports cosmos chains only.

DavidNix avatar May 12 '22 17:05 DavidNix

A couple of notes:

  • I'm good with it just supporting cosmos chains
  • Might want to architect so that test runs first and leaves a folder with state the way dev wants it. maybe susequent runs would copy that state to a new dir and start up chain from there.

jackzampolin avatar May 12 '22 17:05 jackzampolin

Great idea! There is the StartWithGenesisFile method that can be used in the tests. I think we could add a caching mechanism so that it does the ExportState method on a validator node after the chain start up and writes it to a cache dir, and then for future runs, if caching is enabled and the cached state file exists, it can just run with StartWithGenesisFile instead of Start. Once we have chain capabilities, caching after genesis could be one of them.

https://github.com/strangelove-ventures/interchaintest/tree/andrew/start_with_genesis

agouin avatar May 12 '22 17:05 agouin

All great options. I'm not sure on implementation details yet. There may be additional problems like the ability to ensure steps are idempotent (like creating channels) and/or the ability to no-op, ignore errors, or skip steps which don't need to be run as a result of using a cached state.

DavidNix avatar May 12 '22 19:05 DavidNix

andrews idea is the way ™️

jackzampolin avatar May 12 '22 20:05 jackzampolin