Currently to invoke getter fvm actors, one must use the FvmExecState which is taking &mut self. This imposes some restrictions on how tratis, query functions are written as it forces getter to use &mut self if the getter is hold FvmExecState.
This PR creates a FvmCallState from FvmExecState so that when calling getters, it's a &self instead of &mut self. Behind the scene it's using a ReadOnlyBlockStore wrapper for the blockstore to ensure no data will be committed.
Fendermint already has FvmQueryState for the App, I also looked into that strcut first, but it seems to be holding quite a few fields which is pretty difficult to derive from FvmExecState. The current approach might be easier or smaller a change.
Currently to invoke getter fvm actors, one must use the
FvmExecState
which is taking&mut self
. This imposes some restrictions on how tratis, query functions are written as it forces getter to use&mut self
if the getter is holdFvmExecState
.This PR creates a
FvmCallState
fromFvmExecState
so that when calling getters, it's a&self
instead of&mut self
. Behind the scene it's using aReadOnlyBlockStore
wrapper for the blockstore to ensure no data will be committed.Fendermint already has
FvmQueryState
for theApp
, I also looked into that strcut first, but it seems to be holding quite a few fields which is pretty difficult to derive fromFvmExecState
. The current approach might be easier or smaller a change.