piecrust
piecrust copied to clipboard
Only one instance should exist per function call
Describe the bug
Currently, when a contract is called multiple times during a call
cycle, its instance is reused by all those calls. Even though this is deterministic, it leads to different behavior (different state root) than if this wasn't the case.
Furthermore, the logic of the reusing has some edge cases under which it will cause some bad dereferences, and removing it in favor of an implementation closer to a stack might be beneficial.
Also the instantiation of an Instance
designed to be cheap, so we shouldn't be shy with doing so.
Expected behaviour There should be one instance per contract function call.
Additional context One of the bad dereferences was triggered during the development of https://github.com/dusk-network/rusk/pull/1247