Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Restrict election eligibility on min power #1058

Merged
merged 2 commits into from
Aug 31, 2020
Merged

Conversation

ZenGround0
Copy link
Contributor

Closes #887

  • Election eligibility depends on the power state check for minimum power
  • Fix obo in that power state check (zero power should not be eligible)
  • Test

@ZenGround0
Copy link
Contributor Author

FYI @magik6k MinerEligibleForElection should now wrap all state machine election eligibility checks. This PR introduces power state as a parameter. I haven't been following what power table lookback you are using for checking min miner power. In case there is any confusion this function assumes the power state you pass in is coming from that lookback.

Related heads up: another PR just moved min power from ~1 TiB to ~100 TiB

@@ -1110,7 +1111,16 @@ func (st *State) AdvanceDeadline(store adt.Store, currEpoch abi.ChainEpoch) (*Ad
}, nil
}

func MinerEligibleForElection(store adt.Store, mSt *State, thisEpochReward abi.TokenAmount, currEpoch abi.ChainEpoch) (bool, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this doesn't really belong with the miner actor any more, though I won't object much if you land it here.

I think it belongs directly under the builtin package, either in one of the existing files like shared.go, network.go, or a new one for node state utility functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed in #1061 since this is something we can do post mainnet launch no problem. I would have just cut and pasted but I remember from trying to write tests without the miner actor unit test harness that there is a bit of extra state juggling that isn't worth it right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add static state methods for miner election eligibility
2 participants