-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: ExpectedRewardForPower
builtin utility function
#13138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the ExpectedRewardForPower builtin utility function and ties it into the CLI via a new "expected-reward" command for miners. Key changes include:
- Adding the minerExpectedRewardCmd to the CLI commands in cmd/lotus-shed/miner.go.
- Updating miner-fees-related code to import the required reward package and parse the qapower argument.
- Implementing the ExpectedRewardForPower function in the miner actor code and updating the actor code template to support actor versions ≥13.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
cmd/lotus-shed/miner.go | Added new CLI command for expected reward computation |
cmd/lotus-shed/miner-fees.go | Updated imports and added logic for the new CLI command |
chain/actors/builtin/miner/miner.go | Added ExpectedRewardForPower utility function supporting multiple versions |
chain/actors/builtin/miner/actor.go.template | Updated template to utilize the new ExpectedRewardForPower function |
9996fa5
to
47d0bc5
Compare
ExpectedRewardForPower
builtin utility function
PR title now matches the required format.
47d0bc5
to
f6ae68e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new ExpectedRewardForPower
utility in the miner actor package and exposes it via a lotus-shed miner expected-reward
CLI command to project miner rewards over a given epoch window.
- Introduce
ExpectedRewardForPower
function with version‐aware dispatch inchain/actors/builtin/miner
- Add
miner expected-reward
CLI command incmd/lotus-shed/miner-fees.go
and register it inminer.go
- Update actor code template and changelog
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
cmd/lotus-shed/miner.go | Registered minerExpectedRewardCmd under the miner commands |
cmd/lotus-shed/miner-fees.go | Implemented the expected-reward command and tipset/flag parsing |
chain/actors/builtin/miner/miner.go | Added ExpectedRewardForPower utility with version switch |
chain/actors/builtin/miner/actor.go.template | Updated template to generate ExpectedRewardForPower for v13+ |
CHANGELOG.md | Documented the new utility and CLI command |
Comments suppressed due to low confidence (2)
chain/actors/builtin/miner/miner.go:488
- No unit tests were added for
ExpectedRewardForPower
; consider adding tests that cover multiple network versions and edge cases to prevent regressions.
func ExpectedRewardForPower(
cmd/lotus-shed/miner-fees.go:676
- [nitpick] The variable name
rew
is ambiguous; renaming it toexpectedReward
would improve clarity.
rew, err := minertypes.ExpectedRewardForPower(nv, rewardSmoothed, powerSmoothed, qapower, projectionPeriod)
f6ae68e
to
98d8505
Compare
|
And `lotus-shed miner expected-reward` CLI command Ref: #13137
98d8505
to
1d295f4
Compare
@rvagg : I assume you'll merge? |
And
lotus-shed miner expected-reward
CLI commandRef: #13137