filecoin-project / ref-fvm

Reference implementation of the Filecoin Virtual Machine
https://fvm.filecoin.io/
Other
384 stars 139 forks source link

Improve testing framework #1697

Open Stebalien opened 1 year ago

Stebalien commented 1 year ago

The current integration testing framework:

https://github.com/filecoin-project/ref-fvm/blob/7c44970d968c8c49c4eedd5168eb16b08d095f26/testing/integration/src/tester.rs#L51-L72

Has some warts:

  1. There's no distinct "builder" versus "tester". This means the executor/state-tree get stashed in options. We should have:
    1. A TesterBuilder for setting up the executor.
    2. A TestBuilder::build() method to create the final Tester.
  2. Modifying the state-tree after instantiating the executor is painful (none of the helper functions like create_account, set_state, etc. work). Ideally, those functions would work on the fully instantiated tester (i.e., work through the instantiated executor) so they could be called at any time.
  3. We could use some additional helpers for sending messages, constructing new actors, etc.
  4. Right now, we construct many of these actors by manually constructing their state. Instead, we should construct them by invoking the actor's constructor (i.e., sending a message with method-number 1).

(this list is non-exhaustive).

Jacarte commented 1 year ago

Just for noting: