Skip to content

Commit

Permalink
sync: fix inconsistent circ supply at the same epoch (#4802)
Browse files Browse the repository at this point in the history
* Fix inconsistent circ supply at the same epoch
  • Loading branch information
simlecode authored Feb 24, 2022
1 parent cd35470 commit c798350
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions pkg/vm/vmcontext/vmcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ func (vm *VM) ApplyImplicitMessage(msg types.ChainMsg) (*Ret, error) {
Method: unsignedMsg.Method,
Params: unsignedMsg.Params,
}
if err := vm.SetCurrentEpoch(vm.vmOption.Epoch); err != nil {
return nil, xerrors.Errorf("error advancing vm an epoch: %w", err)
}

return vm.applyImplicitMessage(imsg)
}

Expand Down Expand Up @@ -125,8 +123,8 @@ func NewVM(ctx context.Context, actorImpls ActorImplLookup, vmOption VmOption) (
State: st,
vmOption: vmOption,
baseCircSupply: baseCirc,
// loaded during execution
// currentEpoch: ..,
pricelist: vmOption.GasPriceSchedule.PricelistByEpoch(vmOption.Epoch),
currentEpoch: vmOption.Epoch,
}, nil
}

Expand Down Expand Up @@ -155,9 +153,6 @@ func (vm *VM) ApplyGenesisMessage(from address.Address, to address.Address, meth
Params: params,
}

if err := vm.SetCurrentEpoch(0); err != nil {
return nil, xerrors.Errorf("error advancing vm an epoch: %w", err)
}
ret, err := vm.applyImplicitMessage(imsg)
if err != nil {
return ret, err
Expand Down Expand Up @@ -432,9 +427,6 @@ func (vm *VM) ApplyMessage(msg types.ChainMsg) (*Ret, error) {

// applyMessage applies the message To the current stateView.
func (vm *VM) applyMessage(msg *types.Message, onChainMsgSize int) (*Ret, error) {
if err := vm.SetCurrentEpoch(vm.vmOption.Epoch); err != nil {
return nil, xerrors.Errorf("error advancing vm an epoch: %w", err)
}
// This Method does not actually execute the message itself,
// but rather deals with the pre/post processing of a message.
// (see: `invocationContext.invoke()` for the dispatch and execution)
Expand Down

0 comments on commit c798350

Please sign in to comment.