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

Regen Network/Slashing protobuf #5627

Merged
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
76757e0
Add protobuf def
anilcse Feb 7, 2020
a0eaa7a
Add proto msg type for MsgUnJail
anilcse Feb 7, 2020
0c6ca19
gofmt
anilcse Feb 7, 2020
ab7fc9e
Merge pull request #21 from regen-network/vw/slashing_protobuf_migration
anilcse Feb 7, 2020
fbf33e8
Merge branch 'master' of github.com:cosmos/cosmos-sdk into vw/slashin…
anilcse Feb 7, 2020
e8617dc
Remove ModuleCodec
anilcse Feb 7, 2020
3b7110b
Merge branch 'regen-network/slashing_protobuf' of github.com:regen-ne…
anilcse Feb 7, 2020
89b5834
Add changelog
anilcse Feb 11, 2020
1cb8cc8
Fix naming
anilcse Feb 11, 2020
2909f11
Fix undefined errors
anilcse Feb 11, 2020
c9ddfbd
Add ValidatorSigningInfo protobuf implementation
anilcse Feb 11, 2020
d286da4
Revert unnecessary codec migration
anilcse Feb 11, 2020
c601f08
Add protobuf def
anilcse Feb 7, 2020
af6b876
Add proto msg type for MsgUnJail
anilcse Feb 7, 2020
5fb7442
gofmt
anilcse Feb 7, 2020
25f7f97
Remove ModuleCodec
anilcse Feb 7, 2020
12111ae
Add changelog
anilcse Feb 11, 2020
af95b29
Fix naming
anilcse Feb 11, 2020
ba3ee92
Fix undefined errors
anilcse Feb 11, 2020
d90bb3e
Add ValidatorSigningInfo protobuf implementation
anilcse Feb 11, 2020
2ca862f
Revert unnecessary codec migration
anilcse Feb 11, 2020
5395ce8
Merge branch 'regen-network/slashing_protobuf' of github.com:regen-ne…
anilcse Feb 11, 2020
21b9cba
Add ValidatorSigningInfo proto codec
anilcse Feb 11, 2020
5a5fd73
Fix keeper init in tests
anilcse Feb 11, 2020
bdd9368
Add TODO
anilcse Feb 11, 2020
525ad52
Fix signing-info migration
anilcse Feb 11, 2020
c6bb9ae
Change query to use protobuf codec
anilcse Feb 11, 2020
486e7a1
Fix unjail testscript
anilcse Feb 11, 2020
d035a18
Fix go-imports
anilcse Feb 11, 2020
5130ecd
Merge branch 'master' of github.com:cosmos/cosmos-sdk into regen-netw…
anilcse Feb 11, 2020
bb6d8c8
Migrate all slashing queries to use protobuf
anilcse Feb 11, 2020
3dac3b6
Fix typecast
anilcse Feb 11, 2020
6d62019
Fix gofmt
anilcse Feb 11, 2020
ef7cb62
Gofmt
anilcse Feb 11, 2020
9ce0db2
Use protobuf types
anilcse Feb 12, 2020
ae47cb7
Revert
anilcse Feb 12, 2020
30673c0
Revert query params
anilcse Feb 12, 2020
1480c46
Revert query, tx
anilcse Feb 12, 2020
606dd29
Fix lint issue
anilcse Feb 12, 2020
07815e1
Update changelog
anilcse Feb 12, 2020
247af97
Fix lint issues
anilcse Feb 12, 2020
4628a98
Fix lint issues
anilcse Feb 12, 2020
24addfa
Merge pull request #24 from regen-network/regen-network/slashing_prot…
anilcse Feb 12, 2020
b111389
Removed new line
sahith-narahari Feb 12, 2020
e870c7b
Merge pull request #25 from regen-network/anil/fix_slashing_simulatio…
anilcse Feb 12, 2020
e3897cf
Fix golint
anilcse Feb 12, 2020
8fbc455
Fix use json and yaml tags the same as before
anilcse Feb 12, 2020
32aa41b
Merge branch 'regen-network/slashing_protobuf' of github.com:regen-ne…
anilcse Feb 12, 2020
cd0b99d
Merge pull request #26 from regen-network/regen-network/slashing_prot…
anilcse Feb 12, 2020
fb1a0da
Merge branch 'master' of github.com:cosmos/cosmos-sdk into regen-netw…
anilcse Feb 12, 2020
33bc104
Merge branch 'regen-network/slashing_protobuf' of github.com:regen-ne…
anilcse Feb 12, 2020
750e613
Fix gofmt
anilcse Feb 12, 2020
53b45e0
Merge branch 'master' of github.com:cosmos/cosmos-sdk into regen-netw…
anilcse Feb 16, 2020
5b9cc9f
Gofmt
anilcse Feb 16, 2020
ae52ace
Fix test-sim-import-export issue
anilcse Feb 16, 2020
28e2556
Fix gofmt
anilcse Feb 16, 2020
7e34c0c
Merge branch 'master' into regen-network/slashing_protobuf
anilcse Feb 16, 2020
e68f3f0
- Rebase to cosmos:master
anilcse Feb 18, 2020
4360aee
Fix typo
anilcse Feb 18, 2020
04ff0b5
Merge branch 'master' of github.com:cosmos/cosmos-sdk into regen-netw…
anilcse Feb 18, 2020
85b3a20
Revert str conv
anilcse Feb 18, 2020
47c5fb5
Fix gofmt
anilcse Feb 18, 2020
65b5622
Merge branch 'master' into regen-network/slashing_protobuf
anilcse Feb 18, 2020
9e7b6ed
Fix review changes
anilcse Feb 19, 2020
a836c0e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into regen-netw…
anilcse Feb 19, 2020
db992df
Remove unused codec alias
anilcse Feb 19, 2020
73271ff
Merge branch 'regen-network/slashing_protobuf' of github.com:regen-ne…
anilcse Feb 19, 2020
e5f10e1
Revert
anilcse Feb 19, 2020
4c5e070
fix import
anilcse Feb 19, 2020
44559dd
Merge branch 'master' of github.com:cosmos/cosmos-sdk into regen-netw…
anilcse Feb 19, 2020
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ for JSON encoding.
* Every reference of `crypto.Pubkey` in context of a `Validator` is now of type string. `GetPubKeyFromBech32` must be used to get the `crypto.Pubkey`.
* The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type
provided is specified by `ModuleCdc`.
* (x/slashing) [\#5627](https://github.com/cosmos/cosmos-sdk/pull/5627) Migrate the `x/slashing` module to use Protocol Buffer for state
serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino
for JSON encoding.
* The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type
provided is specified by `ModuleCdc`.
* (distr) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffer for state
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this line added?

serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino
for JSON encoding.
Expand Down
2 changes: 1 addition & 1 deletion simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func NewSimApp(
app.SupplyKeeper, auth.FeeCollectorName, app.ModuleAccountAddrs(),
)
app.SlashingKeeper = slashing.NewKeeper(
app.cdc, keys[slashing.StoreKey], &stakingKeeper, app.subspaces[slashing.ModuleName],
appCodec.Slashing, keys[slashing.StoreKey], &stakingKeeper, app.subspaces[slashing.ModuleName],
)
app.CrisisKeeper = crisis.NewKeeper(
app.subspaces[crisis.ModuleName], invCheckPeriod, app.SupplyKeeper, auth.FeeCollectorName,
Expand Down
3 changes: 3 additions & 0 deletions simapp/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
)

Expand All @@ -15,6 +16,7 @@ type AppCodec struct {
amino *codec.Codec

Params *params.Codec
Slashing *slashing.Codec
Copy link
Member

Choose a reason for hiding this comment

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

I do think we should have something more generic when modules don't actually do anything special with their codec. What do you think @alexanderbez ?

Copy link
Member

Choose a reason for hiding this comment

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

this file should be removed as the new design does not contain this struct. you can see here: https://github.com/cosmos/cosmos-sdk/blob/08502d6d98bff3872916f8b69cde2d255351d3fb/simapp/codec/codec.go

Staking *staking.Codec
Distribution *distr.Codec
}
Expand All @@ -26,6 +28,7 @@ func NewAppCodec() *AppCodec {
amino: amino,
Params: params.NewCodec(amino),
Staking: staking.NewCodec(amino),
Slashing: slashing.NewCodec(amino),
Distribution: distr.NewCodec(amino),
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/proto.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

import (
_ "github.com/gogo/protobuf/gogoproto" // nolint
_ "github.com/gogo/protobuf/gogoproto" // nolint
_ "github.com/regen-network/cosmos-proto" // nolint
)

Expand Down
3 changes: 3 additions & 0 deletions x/slashing/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (

var (
// functions aliases

NewKeeper = keeper.NewKeeper
NewQuerier = keeper.NewQuerier
RegisterCodec = types.RegisterCodec
Expand Down Expand Up @@ -62,6 +63,7 @@ var (
NewValidatorSigningInfo = types.NewValidatorSigningInfo

// variable aliases
NewCodec = types.NewCodec
ModuleCdc = types.ModuleCdc
ValidatorSigningInfoKey = types.ValidatorSigningInfoKey
ValidatorMissedBlockBitArrayKey = types.ValidatorMissedBlockBitArrayKey
Expand All @@ -79,6 +81,7 @@ var (
type (
Hooks = keeper.Hooks
Keeper = keeper.Keeper
Codec = types.Codec
GenesisState = types.GenesisState
MissedBlock = types.MissedBlock
MsgUnjail = types.MsgUnjail
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ func TestSlashingMsgs(t *testing.T) {
require.Error(t, err)
require.Nil(t, res)
require.True(t, errors.Is(slashing.ErrValidatorNotJailed, err))
}
}
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion x/slashing/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ $ <appcli> query slashing signing-info cosmosvalconspub1zcjduepqfhvwcmt7p06fvdge
}

var signingInfo types.ValidatorSigningInfo
cdc.MustUnmarshalBinaryLengthPrefixed(res, &signingInfo)
signingInfo, err = types.UnmarshalValSigningInfo(types.ModuleCdc, res)
if err != nil {
return err
}

return cliCtx.PrintOutput(signingInfo)
},
}
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func handleMsgUnjail(ctx sdk.Context, msg MsgUnjail, k Keeper) (*sdk.Result, err
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.ValidatorAddr.String()),
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

sdk.NewAttribute(sdk.AttributeKeySender, string(msg.ValidatorAddr)),
),
)

Expand Down
30 changes: 23 additions & 7 deletions x/slashing/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package keeper
import (
"fmt"

gogotypes "github.com/gogo/protobuf/types"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"

Expand All @@ -14,13 +16,13 @@ import (
// Keeper of the slashing store
type Keeper struct {
storeKey sdk.StoreKey
cdc *codec.Codec
cdc codec.Marshaler
sk types.StakingKeeper
paramspace types.ParamSubspace
}

// NewKeeper creates a slashing keeper
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, sk types.StakingKeeper, paramspace types.ParamSubspace) Keeper {
func NewKeeper(cdc codec.Marshaler, key sdk.StoreKey, sk types.StakingKeeper, paramspace types.ParamSubspace) Keeper {
return Keeper{
storeKey: key,
cdc: cdc,
Expand All @@ -37,18 +39,31 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
// AddPubkey sets a address-pubkey relation
func (k Keeper) AddPubkey(ctx sdk.Context, pubkey crypto.PubKey) {
addr := pubkey.Address()
k.setAddrPubkeyRelation(ctx, addr, pubkey)

pkStr, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pubkey)
if err != nil {
panic(fmt.Errorf("error while setting address-pubkey relation: %s", addr))
}

k.setAddrPubkeyRelation(ctx, addr, pkStr)
}

// GetPubkey returns the pubkey from the adddress-pubkey relation
func (k Keeper) GetPubkey(ctx sdk.Context, address crypto.Address) (crypto.PubKey, error) {
store := ctx.KVStore(k.storeKey)
var pubkey crypto.PubKey

var pubkey gogotypes.StringValue
err := k.cdc.UnmarshalBinaryLengthPrefixed(store.Get(types.GetAddrPubkeyRelationKey(address)), &pubkey)
if err != nil {
return nil, fmt.Errorf("address %s not found", sdk.ConsAddress(address))
}
return pubkey, nil

pkStr, err := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, pubkey.Value)
if err != nil {
return pkStr, err
}

return pkStr, nil
}

// Slash attempts to slash a validator. The slash is delegated to the staking
Expand Down Expand Up @@ -79,9 +94,10 @@ func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress) {
k.sk.Jail(ctx, consAddr)
}

func (k Keeper) setAddrPubkeyRelation(ctx sdk.Context, addr crypto.Address, pubkey crypto.PubKey) {
func (k Keeper) setAddrPubkeyRelation(ctx sdk.Context, addr crypto.Address, pubkey string) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshalBinaryLengthPrefixed(pubkey)

bz := k.cdc.MustMarshalBinaryLengthPrefixed(&gogotypes.StringValue{Value: pubkey})
store.Set(types.GetAddrPubkeyRelationKey(addr), bz)
}

Expand Down
2 changes: 1 addition & 1 deletion x/slashing/internal/keeper/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func querySigningInfos(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte
return false
})

start, end := client.Paginate(len(signingInfos), params.Page, params.Limit, int(k.sk.MaxValidators(ctx)))
start, end := client.Paginate(len(signingInfos), int(params.Page), int(params.Limit), int(k.sk.MaxValidators(ctx)))
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary conversion (from unconvert)

if start < 0 || end < 0 {
signingInfos = []types.ValidatorSigningInfo{}
} else {
Expand Down
17 changes: 10 additions & 7 deletions x/slashing/internal/keeper/signing_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package keeper
import (
"time"

gogotypes "github.com/gogo/protobuf/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/slashing/internal/types"
)
Expand Down Expand Up @@ -31,7 +33,7 @@ func (k Keeper) HasValidatorSigningInfo(ctx sdk.Context, consAddr sdk.ConsAddres
// SetValidatorSigningInfo sets the validator signing info to a consensus address key
func (k Keeper) SetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress, info types.ValidatorSigningInfo) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshalBinaryLengthPrefixed(info)
bz := k.cdc.MustMarshalBinaryLengthPrefixed(&info)
store.Set(types.GetValidatorSigningInfoKey(address), bz)
}

Expand All @@ -53,16 +55,17 @@ func (k Keeper) IterateValidatorSigningInfos(ctx sdk.Context,
}

// GetValidatorMissedBlockBitArray gets the bit for the missed blocks array
func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) (missed bool) {
func (k Keeper) GetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64) bool {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.GetValidatorMissedBlockBitArrayKey(address, index))
var missed gogotypes.BoolValue
if bz == nil {
// lazy: treat empty key as not missed
missed = false
return
return false
}
k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &missed)
return

return missed.Value
}

// IterateValidatorMissedBlockBitArray iterates over the signed blocks window
Expand All @@ -79,7 +82,7 @@ func (k Keeper) IterateValidatorMissedBlockBitArray(ctx sdk.Context,
if bz == nil {
continue
}
k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &missed)
k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &gogotypes.BoolValue{Value: missed})
if handler(index, missed) {
break
}
Expand Down Expand Up @@ -128,7 +131,7 @@ func (k Keeper) IsTombstoned(ctx sdk.Context, consAddr sdk.ConsAddress) bool {
// missed a block in the current window
func (k Keeper) SetValidatorMissedBlockBitArray(ctx sdk.Context, address sdk.ConsAddress, index int64, missed bool) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshalBinaryLengthPrefixed(missed)
bz := k.cdc.MustMarshalBinaryLengthPrefixed(&gogotypes.BoolValue{Value: missed})
store.Set(types.GetValidatorMissedBlockBitArrayKey(address, index), bz)
}

Expand Down
2 changes: 1 addition & 1 deletion x/slashing/internal/keeper/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func CreateTestInput(t *testing.T, defaults types.Params) (sdk.Context, bank.Kee
}

paramstore := paramsKeeper.Subspace(types.DefaultParamspace)
keeper := NewKeeper(cdc, keySlashing, &sk, paramstore)
keeper := NewKeeper(types.ModuleCdc, keySlashing, &sk, paramstore)

keeper.SetParams(ctx, defaults)
sk.SetHooks(keeper.Hooks())
Expand Down
22 changes: 16 additions & 6 deletions x/slashing/internal/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(MsgUnjail{}, "cosmos-sdk/MsgUnjail", nil)
}

// ModuleCdc defines the module codec
var ModuleCdc *codec.Codec
type Codec struct {
codec.Marshaler
// Keep reference to the amino codec to allow backwards compatibility along
// with type, and interface registration.

amino *codec.Codec
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
amino *codec.Codec
amino *codec.Codec

}

func NewCodec(amino *codec.Codec) *Codec {
return &Codec{Marshaler: codec.NewHybridCodec(amino), amino: amino}
}

var ModuleCdc *Codec

func init() {
ModuleCdc = codec.New()
RegisterCodec(ModuleCdc)
codec.RegisterCrypto(ModuleCdc)
ModuleCdc.Seal()
ModuleCdc = NewCodec(codec.New())
Copy link
Contributor

Choose a reason for hiding this comment

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

clean/remove comments

RegisterCodec(ModuleCdc.amino)
ModuleCdc.amino.Seal()
}
6 changes: 1 addition & 5 deletions x/slashing/internal/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ import (
// verify interface at compile time
var _ sdk.Msg = &MsgUnjail{}

// MsgUnjail - struct for unjailing jailed validator
type MsgUnjail struct {
ValidatorAddr sdk.ValAddress `json:"address" yaml:"address"` // address of the validator operator
}

// NewMsgUnjail creates a new MsgUnjail instance
func NewMsgUnjail(validatorAddr sdk.ValAddress) MsgUnjail {
return MsgUnjail{
Expand All @@ -37,5 +32,6 @@ func (msg MsgUnjail) ValidateBasic() error {
if msg.ValidatorAddr.Empty() {
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

return ErrBadValidatorAddr
}

return nil
}
18 changes: 8 additions & 10 deletions x/slashing/internal/types/signing_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@ import (
"fmt"
"time"

"github.com/cosmos/cosmos-sdk/codec"

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 Expand Up @@ -45,3 +37,9 @@ func (i ValidatorSigningInfo) String() string {
i.Address, i.StartHeight, i.IndexOffset, i.JailedUntil,
i.Tombstoned, i.MissedBlocksCounter)
}

// unmarshal a validator signing info from a store value
func UnmarshalValSigningInfo(cdc codec.Marshaler, value []byte) (signingInfo ValidatorSigningInfo, err error) {
err = cdc.UnmarshalBinaryLengthPrefixed(value, &signingInfo)
return signingInfo, err
}
Loading