fix: address expensive fork review

This commit is contained in:
Steven Allen 2021-08-30 16:20:23 -07:00
parent 165735d01a
commit e6902304d5
2 changed files with 4 additions and 6 deletions

View File

@ -211,11 +211,9 @@ func (sm *StateManager) handleStateForks(ctx context.Context, root cid.Cid, heig
return retCid, nil
}
// Returns true if executing the current tipset would trigger an expensive fork.
//
// - If the tipset is the genesis, this function always returns false.
// - If inclusive is true, this function will also return true if applying a message on-top-of the
// tipset would trigger a fork.
// Returns true executing tipsets between the specified heights would trigger an expensive
// migration. NOTE: migrations occuring _at_ the target height are not included, as they're executed
// _after_ the target height.
func (sm *StateManager) hasExpensiveForkBetween(parent, height abi.ChainEpoch) bool {
for h := parent; h < height; h++ {
if _, ok := sm.expensiveUpgrades[h]; ok {

View File

@ -310,7 +310,7 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
nullStart := abi.ChainEpoch(testForkHeight - nullsBefore)
nullLength := abi.ChainEpoch(nullsBefore + nullsAfter)
for i := 0; i < 50; i++ {
for i := 0; i < testForkHeight*2; i++ {
pts := cg.CurTipset.TipSet()
skip := abi.ChainEpoch(0)
if pts.Height() == nullStart {