Skip to content

Commit

Permalink
Add ValidatorSigningInfo protobuf implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
anilcse committed Feb 11, 2020
1 parent ba3ee92 commit d90bb3e
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 24 deletions.
10 changes: 0 additions & 10 deletions x/slashing/internal/types/signing_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// ValidatorSigningInfo defines the signing info for a validator
type ValidatorSigningInfo struct {
Address sdk.ConsAddress `json:"address" yaml:"address"` // validator consensus address
StartHeight int64 `json:"start_height" yaml:"start_height"` // height at which validator was first a candidate OR was unjailed
IndexOffset int64 `json:"index_offset" yaml:"index_offset"` // index offset into signed block bit array
JailedUntil time.Time `json:"jailed_until" yaml:"jailed_until"` // timestamp validator cannot be unjailed until
Tombstoned bool `json:"tombstoned" yaml:"tombstoned"` // whether or not a validator has been tombstoned (killed out of validator set)
MissedBlocksCounter int64 `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time)
}

// NewValidatorSigningInfo creates a new ValidatorSigningInfo instance
func NewValidatorSigningInfo(
condAddr sdk.ConsAddress, startHeight, indexOffset int64,
Expand Down
126 changes: 112 additions & 14 deletions x/slashing/internal/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions x/slashing/internal/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package cosmos_sdk.x.slashing.v1;
option go_package = "types";

import "third_party/proto/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

// MsgUnjail - struct for unjailing jailed validator
message MsgUnjail {
Expand All @@ -12,3 +13,20 @@ message MsgUnjail {
(gogoproto.moretags) = "yaml:\"validator_address\""
];
}

// ValidatorSigningInfo defines the signing info for a validator
message ValidatorSigningInfo {
bytes address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress",
(gogoproto.moretags) = "yaml:\"address\"" // validator consensus address
];
int64 start_height = 2 [(gogoproto.moretags) = "yaml:\"start_height\""]; // height at which validator was first a candidate OR was unjailed
int64 index_offset = 3 [(gogoproto.moretags) = "yaml:\"index_offset\""]; // index offset into signed block bit array
google.protobuf.Timestamp jailed_until = 4 [
(gogoproto.moretags) = "yaml:\"jailed_until\"",
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
]; // timestamp validator cannot be unjailed until
bool tombstoned = 5 [(gogoproto.moretags) = "yaml:\"tombstoned\""]; // whether or not a validator has been tombstoned (killed out of validator set)
int64 missed_blocks_counter = 6 [(gogoproto.moretags) = "yaml:\"missed_blocks_counter\""]; // missed blocks counter (to avoid scanning the array every time)
}

0 comments on commit d90bb3e

Please sign in to comment.