From ba881eb4cf77ee0982533eead5ffdeaa8d29550d Mon Sep 17 00:00:00 2001 From: austinabell Date: Tue, 1 Sep 2020 15:48:16 -0400 Subject: [PATCH] Remove height from chain rand --- chain/stmgr/call.go | 4 ++-- chain/stmgr/stmgr.go | 2 +- chain/stmgr/utils.go | 2 +- chain/store/store.go | 4 +--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/chain/stmgr/call.go b/chain/stmgr/call.go index 291f1c3a7..b21fb75f2 100644 --- a/chain/stmgr/call.go +++ b/chain/stmgr/call.go @@ -95,7 +95,7 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types. state := ts.ParentState() - r := store.NewChainRand(sm.cs, ts.Cids(), ts.Height()) + r := store.NewChainRand(sm.cs, ts.Cids()) return sm.CallRaw(ctx, msg, state, r, ts.Height()) } @@ -113,7 +113,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri return nil, xerrors.Errorf("computing tipset state: %w", err) } - r := store.NewChainRand(sm.cs, ts.Cids(), ts.Height()) + r := store.NewChainRand(sm.cs, ts.Cids()) if span.IsRecordingEvents() { span.AddAttributes( diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index 55b562231..e041fe088 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -338,7 +338,7 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, ts *types.TipSet cids[i] = v.Cid() } - r := store.NewChainRand(sm.cs, cids, blks[0].Height) + r := store.NewChainRand(sm.cs, cids) blkmsgs, err := sm.cs.BlockMsgsForTipset(ts) if err != nil { diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index a95374b69..db6157b09 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -432,7 +432,7 @@ func ComputeState(ctx context.Context, sm *StateManager, height abi.ChainEpoch, return cid.Undef, nil, err } - r := store.NewChainRand(sm.cs, ts.Cids(), height) + r := store.NewChainRand(sm.cs, ts.Cids()) vmopt := &vm.VMOpts{ StateBase: base, Epoch: height, diff --git a/chain/store/store.go b/chain/store/store.go index b71e7d4df..01e8b6a71 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -1282,14 +1282,12 @@ func (cs *ChainStore) GetLatestBeaconEntry(ts *types.TipSet) (*types.BeaconEntry type chainRand struct { cs *ChainStore blks []cid.Cid - bh abi.ChainEpoch } -func NewChainRand(cs *ChainStore, blks []cid.Cid, bheight abi.ChainEpoch) vm.Rand { +func NewChainRand(cs *ChainStore, blks []cid.Cid) vm.Rand { return &chainRand{ cs: cs, blks: blks, - bh: bheight, } }