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

Slashing Mechanism #383

Closed
wants to merge 5 commits into from
Closed

Slashing Mechanism #383

wants to merge 5 commits into from

Conversation

zixuanzh
Copy link
Contributor

@zixuanzh zixuanzh commented Jul 8, 2019

Not exactly sure for the following,

  • add/remove collateral for a specific miner address
  • function call for burning a specific amount of collateral
  • parameter selection for how fast slasher share goes to 1

actors.md Outdated Show resolved Hide resolved
miner := AuthorOf(block1)

// TODO: Some of the slashed collateral should be paid to the slasher
// Check if miner has been slashed
if !self.Miners.Has(miner) {
Copy link
Contributor

Choose a reason for hiding this comment

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

a miner is removed from the pool on slashing? this surprises me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is what it currently is in the spec but likely to be changed. cc @whyrusleeping

Copy link
Member

Choose a reason for hiding this comment

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

For consensus slashing, yes. the miner is removed from the set of valid miners.

Copy link
Member

Choose a reason for hiding this comment

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

for storage fault slashing however, this should not be the case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@decentralion since we are slashing for consensus fault, a miner is removed from the pool in this case.

actors.md Outdated

// Burn all of the miners collateral
miner.BurnCollateral()

// const slashedCollateral = self.GetCollateral(miner)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove commented code

Copy link
Contributor Author

@zixuanzh zixuanzh Jul 9, 2019

Choose a reason for hiding this comment

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

will do after @anorth confirms that miner.Balance is the right way to get its value and we can directly set miner.Balance.

Copy link
Member

Choose a reason for hiding this comment

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

self.Balance should be fine for accessing it, but in order to remove funds, they need to be moved somewhere. If burning funds, use BurnFunds

Copy link
Member

Choose a reason for hiding this comment

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

The balance is not the same as the collateral requirement. If a miner has more balance than required for collateral, only the collateral amount should be burnt. This should use CollateralForPower(miner.power)

actors.md Outdated
miner.BurnCollateral()

// const slashedCollateral = self.GetCollateral(miner)
const slashedCollateral = miner.Balance
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we weren't slashing the entire balance on a fault? Can we leave a placeholder here for the amount slashed, e.g. something like:

miner.Balance -= slashingAmountForFault(fault)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@decentralion I think we might be slashing the entire amount here if it is consensus fault. Otherwise, we have to decide how much to slash. cc @whyrusleeping

Copy link
Member

Choose a reason for hiding this comment

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

A miner's balance probably be greater than their collateral requirements, but could be less. We should slash the min of those two. IMO we should not burn more than the miner's collateral requirement just because they happen to have that on balance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anorth resolved in latest commit

actors.md Outdated Show resolved Hide resolved
@teamdandelion teamdandelion requested a review from anorth July 9, 2019 15:57
actors.md Outdated Show resolved Hide resolved
Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Thanks!

actors.md Outdated Show resolved Hide resolved
actors.md Outdated

// Burn all of the miners collateral
miner.BurnCollateral()

// const slashedCollateral = self.GetCollateral(miner)
Copy link
Member

Choose a reason for hiding this comment

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

The balance is not the same as the collateral requirement. If a miner has more balance than required for collateral, only the collateral amount should be burnt. This should use CollateralForPower(miner.power)

actors.md Outdated Show resolved Hide resolved
actors.md Outdated Show resolved Hide resolved
actors.md Outdated Show resolved Hide resolved
actors.md Outdated Show resolved Hide resolved
@zixuanzh zixuanzh changed the title [WIP] Slashing Mechanism Slashing Mechanism Jul 27, 2019
@pooja pooja mentioned this pull request Jul 30, 2019
18 tasks
@pooja pooja mentioned this pull request Aug 27, 2019
22 tasks
actors.md Outdated
const blockElapsed = VM.CurrentBlockHeight() - block1.Height
const GROWTH_RATE = 1.26
const INITIAL_SHARE = 0.001
const SLASHER_SHARE = Min(Pow(INITIAL_SHARE, GROWTH_RATE), 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.

I think this should be:

slasherSlash = min( INITIAL_SHARE * Pow(growthRate, blockElapsed), 1.0)

right?

Copy link
Member

Choose a reason for hiding this comment

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

(blockElapsed should definitely be involved somehow)

Copy link
Member

Choose a reason for hiding this comment

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

We're also going to have to be careful here, floating point precision and rounding needs to be very explicitly defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly sure on the right floating point precision and rounding here though

@mishmosh
Copy link
Contributor

mishmosh commented Jan 6, 2020

@zixuanzh The last updates were in Sept, around the time of the big spec overhaul. Is this PR stale or still active?

@zixuanzh
Copy link
Contributor Author

zixuanzh commented Jan 7, 2020

I was under the impression that this has been added to the current spec but looks like it was left as a TODO. I will author the change here into the current spec. cc @sternhenri @jzimmerman

@zixuanzh zixuanzh mentioned this pull request Jan 8, 2020
4 tasks
@zixuanzh
Copy link
Contributor Author

zixuanzh commented Jan 9, 2020

Added in #789

@zixuanzh zixuanzh closed this Jan 9, 2020
@zixuanzh zixuanzh deleted the slashing-spec branch January 9, 2020 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants