vm: construct CBOR store properly.

This commit is contained in:
Raúl Kripalani 2020-11-10 15:36:03 +00:00
parent f8c3756ac0
commit 38c404e04e
2 changed files with 5 additions and 10 deletions

View File

@ -809,12 +809,7 @@ func (cs *ChainStore) GetGenesis() (*types.BlockHeader, error) {
return nil, err return nil, err
} }
genb, err := cs.bs.Get(c) return cs.GetBlock(c)
if err != nil {
return nil, err
}
return types.DecodeBlock(genb.RawData())
} }
func (cs *ChainStore) GetCMessage(c cid.Cid) (types.ChainMsg, error) { func (cs *ChainStore) GetCMessage(c cid.Cid) (types.ChainMsg, error) {

View File

@ -149,10 +149,10 @@ func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, parent *Runti
rt.Abortf(exitcode.SysErrForbidden, "message execution exceeds call depth") rt.Abortf(exitcode.SysErrForbidden, "message execution exceeds call depth")
} }
rt.cst = &cbor.BasicIpldStore{ cbb := &gasChargingBlocks{rt.chargeGasFunc(2), rt.pricelist, vm.cst.Blocks}
Blocks: &gasChargingBlocks{rt.chargeGasFunc(2), rt.pricelist, vm.cst.Blocks}, cst := cbor.NewCborStore(cbb)
Atlas: vm.cst.Atlas, cst.Atlas = vm.cst.Atlas // associate the atlas.
} rt.cst = cst
vmm := *msg vmm := *msg
resF, ok := rt.ResolveAddress(msg.From) resF, ok := rt.ResolveAddress(msg.From)