filecoin-project / ref-fvm

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

Actor & state-tree versioning #94

Closed Stebalien closed 2 years ago

Stebalien commented 2 years ago

The VM itself needs to understand actor version for 3 reasons:

  1. Actor lookup/registration in the init actor.
  2. Actor lookup in the state-tree.
  3. Network upgrades.

For 1, we could:

  1. Understand all versions of the init actor.
  2. Invoke methods on the current init actor wasm module to perform lookups/insertions.
  3. Understand only the current version and version the entire FVM. To do that, we'd need a layer higher up the stack to multiplex between different FVM versions.

For 2, we could:

  1. Understand all state-tree versions.
  2. Compile the state-tree HAMT code to WASM, but that doesn't really buy us anything over (1).
  3. Again, understand the current version and version the entire FVM.

For 3, we could:

  1. Add the network upgrade logic to the FVM (implies understanding all versions).
  2. Perform upgrades outside the FVM iteself (which I'd much prefer).

Finally: do we even support old actor versions in the FVM, or only new actor versions (6+)? We don't have v0 rust actors, and versions before v6 haven't been audited (and likely won't sync the chain).

Some interesting notes:

  1. All we need is the init actor and the HAMT, nothing else.
  2. The shape of the init actor has never changed, except for the HAMT itself.
jennijuju commented 2 years ago

The conclusion for now is that the implementation will handle the previous actor versions