Fix circsuypply calc around null blocks

This commit is contained in:
Aayush Rajasekaran 2022-01-05 13:52:51 -05:00 committed by Jennifer Wang
parent bfbd01ab15
commit 832e204ec4
2 changed files with 12 additions and 2 deletions

View File

@ -169,7 +169,10 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager
} }
} }
vmi.SetBlockHeight(i + 1) if err = vmi.SetBlockHeight(ctx, i+1); err != nil {
return cid.Undef, cid.Undef, xerrors.Errorf("error advancing vm an epoch: %w", err)
}
pstate = newState pstate = newState
} }

View File

@ -827,8 +827,15 @@ func (vm *VM) StateTree() types.StateTree {
return vm.cstate return vm.cstate
} }
func (vm *VM) SetBlockHeight(h abi.ChainEpoch) { func (vm *VM) SetBlockHeight(ctx context.Context, h abi.ChainEpoch) error {
vm.blockHeight = h vm.blockHeight = h
ncirc, err := vm.circSupplyCalc(ctx, vm.blockHeight, vm.cstate)
if err != nil {
return err
}
vm.baseCircSupply = ncirc
return nil
} }
func (vm *VM) Invoke(act *types.Actor, rt *Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) { func (vm *VM) Invoke(act *types.Actor, rt *Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) {