@@ -38,15 +38,15 @@ var ErrExpensiveFork = errors.New("refusing explicit call due to state fork at e
3838// Call applies the given message to the given tipset's parent state, at the epoch following the
3939// tipset's parent. In the presence of null blocks, the height at which the message is invoked may
4040// be less than the specified tipset.
41- func (sm * StateManager ) Call (ctx context.Context , msg * types.Message , ts * types.TipSet ) (* api.InvocResult , error ) {
41+ func (sm * StateManager ) Call (ctx context.Context , msg * types.Message , ts * types.TipSet , flushAllBlocks bool ) (* api.InvocResult , error ) {
4242 buffStore := blockstore .NewTieredBstore (sm .cs .StateBlockstore (), blockstore .NewMemorySync ())
43- return sm .CallWithStore (ctx , msg , ts , buffStore )
43+ return sm .CallWithStore (ctx , msg , ts , buffStore , flushAllBlocks )
4444}
4545
4646// CallWithStore applies the given message to the given tipset's parent state, at the epoch following the
4747// tipset's parent. In the presence of null blocks, the height at which the message is invoked may
4848// be less than the specified tipset.
49- func (sm * StateManager ) CallWithStore (ctx context.Context , msg * types.Message , ts * types.TipSet , bstore blockstore.Blockstore ) (* api.InvocResult , error ) {
49+ func (sm * StateManager ) CallWithStore (ctx context.Context , msg * types.Message , ts * types.TipSet , bstore blockstore.Blockstore , flushAllBlocks bool ) (* api.InvocResult , error ) {
5050 // Copy the message as we modify it below.
5151 msgCopy := * msg
5252 msg = & msgCopy
@@ -63,13 +63,13 @@ func (sm *StateManager) CallWithStore(ctx context.Context, msg *types.Message, t
6363 if msg .Value == types .EmptyInt {
6464 msg .Value = types .NewInt (0 )
6565 }
66- return sm .callInternal (ctx , msg , nil , ts , cid .Undef , sm .GetNetworkVersion , false , execSameSenderMessages , bstore )
66+ return sm .callInternal (ctx , msg , nil , ts , cid .Undef , sm .GetNetworkVersion , false , execSameSenderMessages , bstore , flushAllBlocks )
6767}
6868
6969// ApplyOnStateWithGas applies the given message on top of the given state root with gas tracing enabled
7070func (sm * StateManager ) ApplyOnStateWithGas (ctx context.Context , stateCid cid.Cid , msg * types.Message , ts * types.TipSet ) (* api.InvocResult , error ) {
7171 buffStore := blockstore .NewTieredBstore (sm .cs .StateBlockstore (), blockstore .NewMemorySync ())
72- return sm .callInternal (ctx , msg , nil , ts , stateCid , sm .GetNetworkVersion , true , execNoMessages , buffStore )
72+ return sm .callInternal (ctx , msg , nil , ts , stateCid , sm .GetNetworkVersion , true , execNoMessages , buffStore , false )
7373}
7474
7575// CallWithGas calculates the state for a given tipset, and then applies the given message on top of that state.
@@ -81,7 +81,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
8181 strategy = execSameSenderMessages
8282 }
8383 buffStore := blockstore .NewTieredBstore (sm .cs .StateBlockstore (), blockstore .NewMemorySync ())
84- return sm .callInternal (ctx , msg , priorMsgs , ts , cid .Undef , sm .GetNetworkVersion , true , strategy , buffStore )
84+ return sm .callInternal (ctx , msg , priorMsgs , ts , cid .Undef , sm .GetNetworkVersion , true , strategy , buffStore , false )
8585}
8686
8787// CallAtStateAndVersion allows you to specify a message to execute on the given stateCid and network version.
@@ -93,7 +93,7 @@ func (sm *StateManager) CallAtStateAndVersion(ctx context.Context, msg *types.Me
9393 return v
9494 }
9595 buffStore := blockstore .NewTieredBstore (sm .cs .StateBlockstore (), blockstore .NewMemorySync ())
96- return sm .callInternal (ctx , msg , nil , nil , stateCid , nvGetter , true , execSameSenderMessages , buffStore )
96+ return sm .callInternal (ctx , msg , nil , nil , stateCid , nvGetter , true , execSameSenderMessages , buffStore , false )
9797}
9898
9999// - If no tipset is specified, the first tipset without an expensive migration or one in its parent is used.
@@ -109,6 +109,7 @@ func (sm *StateManager) callInternal(
109109 checkGas bool ,
110110 strategy execMessageStrategy ,
111111 bstore blockstore.Blockstore ,
112+ flushAllBlocks bool ,
112113) (* api.InvocResult , error ) {
113114 ctx , span := trace .StartSpan (ctx , "statemanager.callInternal" )
114115 defer span .End ()
@@ -183,6 +184,7 @@ func (sm *StateManager) callInternal(
183184 LookbackState : LookbackStateGetterForTipset (sm , ts ),
184185 TipSetGetter : TipSetGetterForTipset (sm .cs , ts ),
185186 Tracing : true ,
187+ FlushAllBlocks : flushAllBlocks ,
186188 }
187189 vmi , err := sm .newVM (ctx , vmopt )
188190 if err != nil {
0 commit comments