filecoin-project / ref-fvm

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

Support custom bundles for testing post nv16 #466

Open vyzo opened 2 years ago

vyzo commented 2 years ago

Starting with https://github.com/filecoin-project/filecoin-ffi/pull/258 and https://github.com/filecoin-project/lotus/pull/8429 we have some niceties in lotus, which allows us to pass in a manifest that is different from what is in the state tree for testing (provided the state is identical).

In order to take advantage of it and support frictionless testing of new actor bundles, we will need to add support in fvm for redirecting calls to system-state actor CodeCIDs to the code CIDs defined by the manifest we passed in. We can do this with an environment variable (no changes in consructor etc) that instructs the fvm.

In terms of mechanics, implementation should be straightforward: We already have the system-state builtin actors in the system actor state manifest, and we have the ones under testing passed in the manifest. All we have to do is parse both, and match identical type strings to create the mapping.

One potential difficulty is the gas estimation, which may require running both the old and the new actor, and charge gas according to the old actor. This allows us to also test gas charge changes.

vyzo commented 2 years ago

cc @raulk @Stebalien

raulk commented 2 years ago

This is now supported in Lotus. However, it's not well documented, so leaving it open for now.