import msg "github.com/filecoin-project/specs/systems/filecoin_vm/message"
import st "github.com/filecoin-project/specs/systems/filecoin_vm/state_tree"
// VM is the object that controls execution.
// It is a stateless, pure function. It uses no local storage.
//
// TODO: make it just a function: VMExec(...) ?
type VM struct {
// Execute computes and returns outTree, a new StateTree which is the
// application of msgs to inTree.
//
// *Important:* Execute is intended to be a pure function, with no side-effects.
// however, storage of the new parts of the computed outTree may exist in
// local storage.
//
// *TODO:* define whether this should take 0, 1, or 2 IpldStores:
// - (): storage of IPLD datastructures is assumed implicit
// - (store): get and put to same IpldStore
// - (inStore, outStore): get from inStore, put new structures into outStore
//
// This decision impacts callers, and potentially impacts how we reason about
// local storage, and intermediate storage. It is definitely the case that
// implementations may want to operate on this differently, depending on
// how their IpldStores work.
Execute(inTree st.StateTree, msgs [msg.UnsignedMessage]) union {outTree st.StateTree, err error}
}