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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,32 @@ func SlashConsensusFault(block1, block2 BlockHeader) {

miner := AuthorOf(block1)

// TODO: Some of the slashed collateral should be paid to the slasher

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

// Check if miner has been slashed
// miner should be removed upon consensus fault slashing
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.

Fatal("miner has been slashed")
}

// Burn miner pledge collateral
// TODO determine amount to slash if not the entire balance
// Tentatively, consensus fault should slash all pledge collateral
// only the balance is slashed if balance is less than collateral
// consensusFaultSlashAmount can return the Min for now
const requiredPledgeCollateral = PledgeCollateralForPower(miner.Power)
const slashedCollateral = consensusFaultSlashAmount(requiredPledgeCollateral, miner.Balance)

// Some of the slashed collateral should be paid to the slasher
// GROWTH_RATE determines how fast the slasher share of slashed collateral will increase as block elapses
// current GROWTH_RATE results in SLASHER_SHARE reaches 1 after 30 blocks
// TODO: parameter selection on GROWTH_RATE and INITIAL_SHARE
// TODO: define arithmetic precision and rounding for this operation
const blockElapsed = VM.CurrentBlockHeight() - block1.Height
const GROWTH_RATE = 1.26
const INITIAL_SHARE = 0.001
const SLASHER_SHARE = Min(INITIAL_SHARE * Pow(GROWTH_RATE, blockElapsed), 1.0)
VM.TransferFunds(SLASHER_SHARE * slashedCollateral, msg.From)
self.BurnFunds((1.0 - SLASHER_SHARE) * slashedCollateral)

// Remove the miner from the list of network miners
self.Miners.Remove(miner)
self.UpdateStorage(-1 * miner.Power)
Expand Down
2 changes: 1 addition & 1 deletion pledge-collateral.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ minerPerCapitaCollateral := totalPerCapitaCollateral / numMiners

Putting all these variables together, we have each miner's individual collateral requirement:
```go
minerPlegeCollateral := availableFil * ( POWER_COLLATERAL_PROPORTION * minerPower / totalNetworkPower PER_CAPITA_COLLATERAL_PROPORTION / numMiners)
minerPledgeCollateral := availableFil * ( POWER_COLLATERAL_PROPORTION * minerPower / totalNetworkPower PER_CAPITA_COLLATERAL_PROPORTION / numMiners)
```

## Dealing with Undercollateralization
Expand Down