@ -13,6 +13,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/internal/jsontypes"
tmjson "github.com/tendermint/tendermint/libs/json"
tmjson "github.com/tendermint/tendermint/libs/json"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
@ -28,6 +29,9 @@ type Evidence interface {
String ( ) string // string format of the evidence
String ( ) string // string format of the evidence
Time ( ) time . Time // time of the infraction
Time ( ) time . Time // time of the infraction
ValidateBasic ( ) error // basic consistency check
ValidateBasic ( ) error // basic consistency check
// Implementations must support tagged encoding in JSON.
jsontypes . Tagged
}
}
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
@ -38,11 +42,14 @@ type DuplicateVoteEvidence struct {
VoteB * Vote ` json:"vote_b" `
VoteB * Vote ` json:"vote_b" `
// abci specific information
// abci specific information
TotalVotingPower int64
ValidatorPower int64
TotalVotingPower int64 ` json:",string" `
ValidatorPower int64 ` json:",string" `
Timestamp time . Time
Timestamp time . Time
}
}
// TypeTag implements the jsontypes.Tagged interface.
func ( * DuplicateVoteEvidence ) TypeTag ( ) string { return "tendermint/DuplicateVoteEvidence" }
var _ Evidence = & DuplicateVoteEvidence { }
var _ Evidence = & DuplicateVoteEvidence { }
// NewDuplicateVoteEvidence creates DuplicateVoteEvidence with right ordering given
// NewDuplicateVoteEvidence creates DuplicateVoteEvidence with right ordering given
@ -236,14 +243,17 @@ func DuplicateVoteEvidenceFromProto(pb *tmproto.DuplicateVoteEvidence) (*Duplica
// height, then nodes will treat this as of the Lunatic form, else it is of the Equivocation form.
// height, then nodes will treat this as of the Lunatic form, else it is of the Equivocation form.
type LightClientAttackEvidence struct {
type LightClientAttackEvidence struct {
ConflictingBlock * LightBlock
ConflictingBlock * LightBlock
CommonHeight int64
CommonHeight int64 ` json:",string" `
// abci specific information
// abci specific information
ByzantineValidators [ ] * Validator // validators in the validator set that misbehaved in creating the conflicting block
ByzantineValidators [ ] * Validator // validators in the validator set that misbehaved in creating the conflicting block
TotalVotingPower int64 // total voting power of the validator set at the common height
TotalVotingPower int64 ` json:",string" ` // total voting power of the validator set at the common height
Timestamp time . Time // timestamp of the block at the common height
Timestamp time . Time // timestamp of the block at the common height
}
}
// TypeTag implements the jsontypes.Tagged interface.
func ( * LightClientAttackEvidence ) TypeTag ( ) string { return "tendermint/LightClientAttackEvidence" }
var _ Evidence = & LightClientAttackEvidence { }
var _ Evidence = & LightClientAttackEvidence { }
// ABCI forms an array of abci evidence for each byzantine validator
// ABCI forms an array of abci evidence for each byzantine validator
@ -365,10 +375,10 @@ func (l *LightClientAttackEvidence) Height() int64 {
// String returns a string representation of LightClientAttackEvidence
// String returns a string representation of LightClientAttackEvidence
func ( l * LightClientAttackEvidence ) String ( ) string {
func ( l * LightClientAttackEvidence ) String ( ) string {
return fmt . Sprintf ( ` LightClientAttackEvidence {
return fmt . Sprintf ( ` LightClientAttackEvidence {
ConflictingBlock : % v ,
CommonHeight : % d ,
ByzatineValidators : % v ,
TotalVotingPower : % d ,
ConflictingBlock : % v ,
CommonHeight : % d ,
ByzatineValidators : % v ,
TotalVotingPower : % d ,
Timestamp : % v } # % X ` ,
Timestamp : % v } # % X ` ,
l . ConflictingBlock . String ( ) , l . CommonHeight , l . ByzantineValidators ,
l . ConflictingBlock . String ( ) , l . CommonHeight , l . ByzantineValidators ,
l . TotalVotingPower , l . Timestamp , l . Hash ( ) )
l . TotalVotingPower , l . Timestamp , l . Hash ( ) )
@ -630,6 +640,9 @@ func EvidenceFromProto(evidence *tmproto.Evidence) (Evidence, error) {
func init ( ) {
func init ( ) {
tmjson . RegisterType ( & DuplicateVoteEvidence { } , "tendermint/DuplicateVoteEvidence" )
tmjson . RegisterType ( & DuplicateVoteEvidence { } , "tendermint/DuplicateVoteEvidence" )
tmjson . RegisterType ( & LightClientAttackEvidence { } , "tendermint/LightClientAttackEvidence" )
tmjson . RegisterType ( & LightClientAttackEvidence { } , "tendermint/LightClientAttackEvidence" )
jsontypes . MustRegister ( ( * DuplicateVoteEvidence ) ( nil ) )
jsontypes . MustRegister ( ( * LightClientAttackEvidence ) ( nil ) )
}
}
//-------------------------------------------- ERRORS --------------------------------------
//-------------------------------------------- ERRORS --------------------------------------