[slash][quorum][consensus] Extend existing data structures for slashing needs (#2148)
* [slashing] Add Slashing fields in header, only available from v3 onward * [slashing] Add Banned field to validator struct * [consensus] Remove dead code * [node] Use named value for shardID of beaconchain * [consensus] No need to memory thrash Buffer * [slashing] Add slash record type, stub out BroadcastSlash * [cmd] Bump 2019 -> 2020 * [votepower] Add ballot results structs * [quorum][slash] Refactor quorum to accomdate extra data points needed for slashing * [consensus] Begin refactor of consensus leader messages * [consensus] Accomdate consensus for changed method signatures in quorum * [project] Whitespace and helper function * [block] More comments and logs for fields that do not make sense in earlier v version * [slashing] More comments, field renames, tag Edgar TODO * [quorum] Undo name change of Prepare to Announce, was mislead by other existing codepull/2161/head
parent
e87b338ddc
commit
44c5704fc3
@ -0,0 +1,30 @@ |
||||
package slash |
||||
|
||||
import ( |
||||
"math/big" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
"github.com/harmony-one/harmony/consensus/quorum" |
||||
"github.com/harmony-one/harmony/shard" |
||||
) |
||||
|
||||
// Slasher ..
|
||||
type Slasher interface { |
||||
ShouldSlash(shard.BlsPublicKey) bool |
||||
} |
||||
|
||||
// Record is an proof of a slashing made by a witness of a double-signing event
|
||||
type Record struct { |
||||
BlockHash common.Hash |
||||
BlockNumber *big.Int |
||||
Signature [96]byte // (aggregated) signature
|
||||
Bitmap []byte // corresponding bitmap mask for agg signature
|
||||
ShardID uint32 |
||||
Epoch *big.Int |
||||
Beneficiary common.Address // the reporter who will get rewarded
|
||||
} |
||||
|
||||
// DidAnyoneDoubleSign ..
|
||||
func DidAnyoneDoubleSign(d quorum.Decider) bool { |
||||
return false |
||||
} |
@ -0,0 +1,12 @@ |
||||
package slash |
||||
|
||||
import ( |
||||
"testing" |
||||
|
||||
"github.com/harmony-one/harmony/consensus/quorum" |
||||
) |
||||
|
||||
func TestDidAnyoneDoubleSign(t *testing.T) { |
||||
d := quorum.NewDecider(quorum.SuperMajorityStake) |
||||
t.Log("Unimplemented", d) |
||||
} |
@ -1,19 +0,0 @@ |
||||
package slash |
||||
|
||||
import "github.com/harmony-one/harmony/shard" |
||||
|
||||
const ( |
||||
// UnavailabilityInConsecutiveBlockSigning is how many blocks in a row
|
||||
// before "slashing by unavailability" occurs
|
||||
UnavailabilityInConsecutiveBlockSigning = 1380 |
||||
) |
||||
|
||||
// Slasher ..
|
||||
type Slasher interface { |
||||
ShouldSlash(shard.BlsPublicKey) bool |
||||
} |
||||
|
||||
// ThresholdDecider ..
|
||||
type ThresholdDecider interface { |
||||
SlashThresholdMet(shard.BlsPublicKey) bool |
||||
} |
Loading…
Reference in new issue