ref-fvm
ref-fvm copied to clipboard
Add `create` WASM module level function
Addresses https://github.com/filecoin-project/ref-fvm/issues/746. Adds new create
constructor entrypoint for actors. This allows the calling convention for constructors to change. At the moment:
- The calling convention is the same, only a single
params
block ID is passed. I think that this is a good way to do it, and the consistency of passing everything as an IPLD block is valuable IMO. - The method ID is always set to 1 in the constructor. However, method ID 1 is no longer special, so the
invoke
entrypoint can use it for whatever it wants. - The
create
call is charged the same gas as if it were a send. It's treated as a call equal toinvoke
. - The caller actor ID will still be set to the init actor within the constructor. However, with the changes in this PR, this becomes trivial to change, allowing us to set it to the ID of the actor which called the init actor. This can be achieved by passing the "original caller" into the
create_actor
syscall in the init actor. - I've only ensured that the integration tests are passing. If I get an approval on the general approach, I will update the rest of the tests as well.
Related updates to the builtin actors: https://github.com/filecoin-project/builtin-actors/pull/1339.