Skip to content
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

Storage Power actor #308

Merged
merged 16 commits into from
Mar 31, 2020
Merged

Storage Power actor #308

merged 16 commits into from
Mar 31, 2020

Conversation

austinabell
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

  • Implements storage power actor

Sorry for big PR, not much I could do to break up lol

Some logic is changed a bit with this due to the reliance on negative token amounts for logic within the go/spec impl. I also had to clean up some other small auxiliary things, I tried to keep very contained and they should be very unopinionated.

If you notice the deref and ref of the lazy static items, that is because the intended way to access the underlying value is through the deref (cleaner to denote specifically what is happening instead of an implicit deref through the let binding, I should have read the docs before using lol)

Reference issue to close (if applicable)

Closes #161

Other information and links

pub static ref CONSENSUS_MINER_MIN_POWER: StoragePower = StoragePower::from(2 << 30); // placeholder

}

Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment: "Penalty to pledge collateral for the termination of an individual sector."

fault_type: ConsensusFaultType,
) -> TokenAmount {
// PARAM_FINISH: always penalise the entire pledge.
match fault_type {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we need a catch-all statement here if nothing is hit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, because that would fail in serialization. All patterns are matched (rust doesn't let otherwise)

// PARAM_FINISH
TokenAmount::new(0)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems pledgePenaltyForWindowedPoStFailureis missing? See here in policy.go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch ! I mistakenly referenced the other temporary function

pub const SECTOR_TERMINATION_MANUAL: SectorTermination = 1;

#[derive(Clone)]
pub struct SectorStorageWeightDesc {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth adding comments to each of these types, I'll leave that to your judgment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just don't know enough about them yet to add comments on all of them, I will make a pass through later when more specifics are ironed out

})
.map_err(|e| ActorError::new(ExitCode::ErrIllegalState, e))?;

// TODO switch 6 to OnDeleteMiner on miner actor impl
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you do this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to keep changes contained, those method definitions don't exist in the miner actor (it's empty rn)

This was referenced Mar 29, 2020
// PARAM_FINISH
// var growthRate = SLASHER_SHARE_GROWTH_RATE_NUM / SLASHER_SHARE_GROWTH_RATE_DENOM
// var multiplier = growthRate^elapsed_epoch
// var slasherProportion = min(INITIAL_SLASHER_SHARE * multiplier, 1.0)
Copy link
Member

Choose a reason for hiding this comment

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

Did you forget to remove these comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was just to give context based on the spec impl, but I removed

}
}

lazy_static! {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why these arent just declared inside the function? Doesnt look like youre using them anywhere else. Do you think they will in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better to have them in a static context and as variables that can more easily be modified in future, are you saying function referring to reward_for_consensus_slash_report ?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, thats the function I'm referring to. I'm ok with them being static, though. Doesn't have much impact, and you might be right about future modifications.

@austinabell austinabell merged commit 618cf4a into master Mar 31, 2020
@austinabell austinabell deleted the austin/actors/power branch March 31, 2020 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Basic Storage Power Actor
3 participants