onflow/flow-emulator

Provide Path for `flowdb` Folder Containing Emulator State

Closed this issue · 2 comments

Issue To Be Solved

When running the emulator, a user can provide an optional --persist flag. This creates a folder flowdb that persists the state of the emulator between runs.

It would be beneficial if it was possible to provide a path to the emulator for the folder that contains the state, so the emulator will read the state from this location.

If this was possible, users could create a fork of the state by duplicating the folder, allowing them to investigate further states whilst maintaining a base state that can be reverted to.

It will also be useful for creating manual test setups (outside of the testing libraries), where users can create a base test state that can be revisited. As an example, I was conducting a test in the emulator to investigate how the size of a particular dictionary would affect the cost of my txs. By copying the flowdb folder, I can revisit states where the dictionary is of a specific size.

hey @ph0ph0 we already have --dbpath for that.

Also emulator allows state snapshot management, as you suggesting ( I am currently refactoring it to be faster and work on windows )

https://github.com/onflow/flow-emulator/blob/master/README.md#managing-emulator-state

With snapshot (currently) the flowdb folder is tracked with git, and you can easily branch and switch to branch with single API call. Also with any git client you can have log of the transactions executed, blocks etc.

I especially started with objective of speeding up testing with emulator.

@bluesign thanks for letting me know - I did check the flags in the docs but missed that one 😅 apologies!

Cool, nice work!