x/{distribution, staking, bank, mint, crisis} genesis protobuf migration (#6835)

* distribution genesis types migrated to proto

* removed types from types/genesis.go

* fix lint

* added new line proto

* staking genesis migrated to proto

* fix lint

* x/bank: genesis types migrated to proto

* fix lint

* x/mint: genesis types changed to proto

* x/crisis: genesis types changed to proto

* Migrate genesis state of x/crisis

* add new lines

* whitespace

* Fix bad merge

* added missing field

* fixed error

Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
This commit is contained in:
atheeshp 2020-07-28 14:50:17 +05:30 committed by GitHub
parent 2651427ab4
commit b33b1e9052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 5713 additions and 107 deletions

View File

@ -0,0 +1,45 @@
syntax = "proto3";
package cosmos.bank;
import "gogoproto/gogo.proto";
import "cosmos/cosmos.proto";
import "cosmos/bank/bank.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
// GenesisState defines the bank module's genesis state.
message GenesisState {
Params params = 1 [
(gogoproto.casttype) = "Params",
(gogoproto.nullable) = false
];
repeated Balance balances = 2 [
(gogoproto.casttype) = "Balance",
(gogoproto.nullable) = false
];
repeated cosmos.Coin supply = 3 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
repeated Metadata denom_metadata = 4 [
(gogoproto.casttype) = "Metadata",
(gogoproto.moretags) = "yaml:\"denom_metadata\"",
(gogoproto.nullable) = false
];
}
// Balance defines an account address and balance pair used in the bank module's
// genesis state.
message Balance {
option (gogoproto.goproto_getters) = false;
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
repeated cosmos.Coin coins = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.nullable) = false
];
}

View File

@ -0,0 +1,16 @@
syntax = "proto3";
package cosmos.crisis;
option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types";
import "gogoproto/gogo.proto";
import "cosmos/cosmos.proto";
// GenesisState - genesis state of x/crisis
message GenesisState {
cosmos.Coin constant_fee = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"constant_fee\""
];
}

View File

@ -0,0 +1,186 @@
syntax = "proto3";
package cosmos.distribution;
option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types";
option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "cosmos/cosmos.proto";
import "cosmos/distribution/distribution.proto";
// genesis types
// DelegatorWithdrawInfo
// the address for where distributions rewards are withdrawn to by default
// this struct is only used at genesis to feed in default withdraw addresses
message DelegatorWithdrawInfo {
bytes delegator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
(gogoproto.moretags) = "yaml:\"delegator_address\""
];
bytes withdraw_address = 2 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
(gogoproto.moretags) = "yaml:\"withdraw_address\""
];
}
// ValidatorOutstandingRewardsRecord
// used for import/export via genesis json
message ValidatorOutstandingRewardsRecord {
bytes validator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress",
(gogoproto.moretags) = "yaml:\"validator_address\""
];
repeated cosmos.DecCoin outstanding_rewards = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"outstanding_rewards\""
];
}
// ValidatorAccumulatedCommissionRecord
// used for import / export via genesis json
message ValidatorAccumulatedCommissionRecord {
bytes validator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress",
(gogoproto.moretags) = "yaml:\"validator_address\""
];
ValidatorAccumulatedCommission accumulated = 2 [
(gogoproto.casttype) = "ValidatorAccumulatedCommission",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"accumulated\""
];
}
// ValidatorHistoricalRewardsRecord
// used for import / export via genesis json
message ValidatorHistoricalRewardsRecord {
bytes validator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress",
(gogoproto.moretags) = "yaml:\"validator_address\""
];
uint64 period = 2;
ValidatorHistoricalRewards rewards = 3[
(gogoproto.casttype) = "ValidatorHistoricalRewards",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"rewards\""
];
}
// ValidatorCurrentRewardsRecord
// used for import / export via genesis json
message ValidatorCurrentRewardsRecord {
bytes validator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress",
(gogoproto.moretags) = "yaml:\"validator_address\""
];
ValidatorCurrentRewards rewards = 2[
(gogoproto.casttype) = "ValidatorCurrentRewards",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"rewards\""
];
}
// DelegatorStartingInfoRecord
// used for import / export via genesis json
message DelegatorStartingInfoRecord {
bytes delegator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
(gogoproto.moretags) = "yaml:\"delegator_address\""
];
bytes validator_address = 2 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress",
(gogoproto.moretags) = "yaml:\"validator_address\""
];
DelegatorStartingInfo starting_info = 3 [
(gogoproto.casttype) = "DelegatorStartingInfo",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"starting_info\""
];
}
// ValidatorSlashEventRecord
// used for import / export via genesis json
message ValidatorSlashEventRecord {
bytes validator_address = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress",
(gogoproto.moretags) = "yaml:\"validator_address\""
];
uint64 height = 2;
uint64 period = 3;
ValidatorSlashEvent event = 4 [
(gogoproto.casttype) = "ValidatorSlashEvent",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"event\""
];
}
// GenesisState - all distribution state that must be provided at genesis
message GenesisState {
Params params = 1 [
(gogoproto.casttype) = "Params",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"params\""
];
FeePool fee_pool = 2 [
(gogoproto.casttype) = "FeePool",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"fee_pool\""
];
repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 [
(gogoproto.casttype) = "DelegatorWithdrawInfo",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"delegator_withdraw_infos\""
];
bytes previous_proposer = 4 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress",
(gogoproto.moretags) = "yaml:\"previous_proposer\""
];
repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 [
(gogoproto.casttype) = "ValidatorOutstandingRewardsRecord",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"outstanding_rewards\""
];
repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 [
(gogoproto.casttype) = "ValidatorAccumulatedCommissionRecord",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"validator_accumulated_commissions\""
];
repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 [
(gogoproto.casttype) = "ValidatorHistoricalRewardsRecord",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"validator_historical_rewards\""
];
repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 [
(gogoproto.casttype) = "ValidatorCurrentRewardsRecord",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"validator_current_rewards\""
];
repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 [
(gogoproto.casttype) = "DelegatorStartingInfoRecord",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"delegator_starting_infos\""
];
repeated ValidatorSlashEventRecord validator_slash_events = 10 [
(gogoproto.casttype) = "ValidatorSlashEventRecord",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"validator_slash_events\""
];
}

View File

@ -0,0 +1,20 @@
syntax = "proto3";
package cosmos.mint;
import "gogoproto/gogo.proto";
import "cosmos/mint/mint.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types";
// GenesisState - minter state
message GenesisState {
Minter minter = 1 [
(gogoproto.casttype) = "Minter",
(gogoproto.nullable) = false
];
Params params = 2 [
(gogoproto.casttype) = "Params",
(gogoproto.nullable) = false
];
}

View File

@ -0,0 +1,52 @@
syntax = "proto3";
package cosmos.staking;
option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";
import "gogoproto/gogo.proto";
import "cosmos/staking/staking.proto";
// GenesisState - all staking state that must be provided at genesis
message GenesisState {
Params params = 1 [(gogoproto.casttype) = "Params", (gogoproto.nullable) = false];
bytes last_total_power = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"last_total_power\"",
(gogoproto.nullable) = false
];
repeated LastValidatorPower last_validator_powers = 3 [
(gogoproto.casttype) = "LastValidatorPower",
(gogoproto.moretags) = "yaml:\"last_validator_powers\"",
(gogoproto.nullable) = false
];
repeated Validator validators = 4 [
(gogoproto.casttype) = "Validator",
(gogoproto.nullable) = false
];
repeated Delegation delegations = 5 [
(gogoproto.casttype) = "Delegation",
(gogoproto.nullable) = false
];
repeated UnbondingDelegation unbonding_delegations = 6 [
(gogoproto.casttype) = "UnbondingDelegation",
(gogoproto.moretags) = "yaml:\"unbonding_delegations\"",
(gogoproto.nullable) = false
];
repeated Redelegation redelegations = 7 [
(gogoproto.casttype) = "Redelegation",
(gogoproto.nullable) = false
];
bool exported = 8;
}
// LastValidatorPower required for validator set update logic
message LastValidatorPower {
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress"];
int64 power = 2;
}

View File

@ -9,12 +9,13 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
"github.com/cosmos/cosmos-sdk/testutil/network"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
)
type IntegrationTestSuite struct {

View File

@ -12,21 +12,6 @@ import (
var _ exported.GenesisBalance = (*Balance)(nil)
// GenesisState defines the bank module's genesis state.
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
Balances []Balance `json:"balances" yaml:"balances"`
Supply sdk.Coins `json:"supply" yaml:"supply"`
DenomMetadata []Metadata `json:"denom_metadata" yaml:"denom_metadata"`
}
// Balance defines an account address and balance pair used in the bank module's
// genesis state.
type Balance struct {
Address sdk.AccAddress `json:"address" yaml:"address"`
Coins sdk.Coins `json:"coins" yaml:"coins"`
}
// GetAddress returns the account address of the Balance object.
func (b Balance) GetAddress() sdk.AccAddress {
return b.Address

749
x/bank/types/genesis.pb.go Normal file
View File

@ -0,0 +1,749 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/bank/genesis.proto
package types
import (
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the bank module's genesis state.
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3,casttype=Params" json:"params"`
Balances []Balance `protobuf:"bytes,2,rep,name=balances,proto3,casttype=Balance" json:"balances"`
Supply github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=supply,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supply"`
DenomMetadata []Metadata `protobuf:"bytes,4,rep,name=denom_metadata,json=denomMetadata,proto3,casttype=Metadata" json:"denom_metadata" yaml:"denom_metadata"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_f22ff2f01147af72, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func (m *GenesisState) GetBalances() []Balance {
if m != nil {
return m.Balances
}
return nil
}
func (m *GenesisState) GetSupply() github_com_cosmos_cosmos_sdk_types.Coins {
if m != nil {
return m.Supply
}
return nil
}
func (m *GenesisState) GetDenomMetadata() []Metadata {
if m != nil {
return m.DenomMetadata
}
return nil
}
// Balance defines an account address and balance pair used in the bank module's
// genesis state.
type Balance struct {
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"`
}
func (m *Balance) Reset() { *m = Balance{} }
func (m *Balance) String() string { return proto.CompactTextString(m) }
func (*Balance) ProtoMessage() {}
func (*Balance) Descriptor() ([]byte, []int) {
return fileDescriptor_f22ff2f01147af72, []int{1}
}
func (m *Balance) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Balance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Balance.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Balance) XXX_Merge(src proto.Message) {
xxx_messageInfo_Balance.Merge(m, src)
}
func (m *Balance) XXX_Size() int {
return m.Size()
}
func (m *Balance) XXX_DiscardUnknown() {
xxx_messageInfo_Balance.DiscardUnknown(m)
}
var xxx_messageInfo_Balance proto.InternalMessageInfo
func init() {
proto.RegisterType((*GenesisState)(nil), "cosmos.bank.GenesisState")
proto.RegisterType((*Balance)(nil), "cosmos.bank.Balance")
}
func init() { proto.RegisterFile("cosmos/bank/genesis.proto", fileDescriptor_f22ff2f01147af72) }
var fileDescriptor_f22ff2f01147af72 = []byte{
// 391 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xce, 0x2f, 0xce,
0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0xcc, 0xcb, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6,
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x48, 0xe9, 0x81, 0xa4, 0xa4, 0x44, 0xd2, 0xf3,
0xd3, 0xf3, 0xc1, 0xe2, 0xfa, 0x20, 0x16, 0x44, 0x89, 0x94, 0x30, 0x54, 0x37, 0x54, 0x25, 0x44,
0x50, 0x0c, 0xd9, 0x48, 0x10, 0x01, 0x11, 0x57, 0x3a, 0xcf, 0xc4, 0xc5, 0xe3, 0x0e, 0xb1, 0x21,
0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x9a, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0x82,
0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x58, 0x0f, 0xc9, 0x46, 0xbd, 0x00, 0xb0, 0x94, 0x13, 0xdf,
0x89, 0x7b, 0xf2, 0x0c, 0xbf, 0xee, 0xc9, 0xb3, 0x41, 0xf8, 0x41, 0x50, 0x2d, 0x42, 0x8e, 0x5c,
0x1c, 0x49, 0x89, 0x39, 0x89, 0x79, 0xc9, 0xa9, 0xc5, 0x12, 0x4c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46,
0x22, 0x28, 0xda, 0x9d, 0x20, 0x92, 0x4e, 0xfc, 0x50, 0xfd, 0xec, 0x50, 0x81, 0x20, 0xb8, 0x36,
0xa1, 0x30, 0x2e, 0xb6, 0xe2, 0xd2, 0x82, 0x82, 0x9c, 0x4a, 0x09, 0x66, 0xb0, 0x01, 0x3c, 0x30,
0x03, 0x9c, 0xf3, 0x33, 0xf3, 0x9c, 0x0c, 0x40, 0x1a, 0x57, 0xdd, 0x97, 0xd7, 0x48, 0xcf, 0x2c,
0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x47, 0xf1, 0xae, 0x6e, 0x71, 0x4a, 0xb6, 0x7e,
0x49, 0x65, 0x41, 0x2a, 0x44, 0x43, 0x71, 0x10, 0xd4, 0x34, 0xa1, 0x74, 0x2e, 0xbe, 0x94, 0xd4,
0xbc, 0xfc, 0xdc, 0xf8, 0xdc, 0xd4, 0x92, 0xc4, 0x94, 0xc4, 0x92, 0x44, 0x09, 0x16, 0xb0, 0xf9,
0xa2, 0x28, 0x0e, 0xf4, 0x85, 0x4a, 0x3a, 0x69, 0x82, 0x2c, 0xfa, 0x74, 0x4f, 0x5e, 0xb4, 0x32,
0x31, 0x37, 0xc7, 0x4a, 0x09, 0x55, 0xab, 0xd2, 0xaf, 0x7b, 0xf2, 0x1c, 0x30, 0xa5, 0x41, 0xbc,
0x60, 0x49, 0x18, 0x57, 0x69, 0x13, 0x23, 0x17, 0xcc, 0x5b, 0x42, 0xde, 0x5c, 0xec, 0x89, 0x29,
0x29, 0x45, 0xa9, 0xc5, 0x90, 0xd0, 0xe4, 0x71, 0x32, 0xfc, 0x75, 0x4f, 0x5e, 0x97, 0x08, 0xb7,
0x3b, 0x26, 0x27, 0x3b, 0x42, 0x34, 0x06, 0xc1, 0x4c, 0x10, 0x0a, 0xe1, 0x62, 0x4d, 0x06, 0x79,
0x09, 0x1a, 0xb2, 0x94, 0x06, 0x0c, 0xc4, 0x30, 0x2b, 0x96, 0x8e, 0x05, 0xf2, 0x0c, 0x4e, 0xce,
0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72,
0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x89, 0xd7, 0xc0, 0x0a, 0x48,
0x82, 0x02, 0x9b, 0x9b, 0xc4, 0x06, 0x4e, 0x52, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6f,
0xbb, 0xec, 0xe0, 0xbf, 0x02, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.DenomMetadata) > 0 {
for iNdEx := len(m.DenomMetadata) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.DenomMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if len(m.Supply) > 0 {
for iNdEx := len(m.Supply) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Supply[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
if len(m.Balances) > 0 {
for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Balances[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *Balance) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Balance) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Balance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Coins) > 0 {
for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
if len(m.Balances) > 0 {
for _, e := range m.Balances {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.Supply) > 0 {
for _, e := range m.Supply {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.DenomMetadata) > 0 {
for _, e := range m.DenomMetadata {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func (m *Balance) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
if len(m.Coins) > 0 {
for _, e := range m.Coins {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Balances", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balances = append(m.Balances, Balance{})
if err := m.Balances[len(m.Balances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Supply = append(m.Supply, types.Coin{})
if err := m.Supply[len(m.Supply)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DenomMetadata", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DenomMetadata = append(m.DenomMetadata, Metadata{})
if err := m.DenomMetadata[len(m.DenomMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Balance) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Balance: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Balance: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
if m.Address == nil {
m.Address = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Coins = append(m.Coins, types.Coin{})
if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -6,11 +6,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GenesisState - crisis genesis state
type GenesisState struct {
ConstantFee sdk.Coin `json:"constant_fee" yaml:"constant_fee"`
}
// NewGenesisState creates a new GenesisState object
func NewGenesisState(constantFee sdk.Coin) GenesisState {
return GenesisState{

View File

@ -0,0 +1,320 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/crisis/genesis.proto
package types
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState - genesis state of x/crisis
type GenesisState struct {
ConstantFee github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,3,opt,name=constant_fee,json=constantFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"constant_fee" yaml:"constant_fee"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_174b7a013a29fb57, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func init() {
proto.RegisterType((*GenesisState)(nil), "cosmos.crisis.GenesisState")
}
func init() { proto.RegisterFile("cosmos/crisis/genesis.proto", fileDescriptor_174b7a013a29fb57) }
var fileDescriptor_174b7a013a29fb57 = []byte{
// 222 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xce, 0x2f, 0xce,
0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xca, 0x2c, 0xce, 0x2c, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce,
0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x48, 0xea, 0x41, 0x24, 0xa5, 0x44,
0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x32, 0xfa, 0x20, 0x16, 0x44, 0x91, 0x94, 0x30, 0xcc, 0x04, 0x88,
0x5a, 0xb0, 0xa0, 0x52, 0x3b, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xac, 0xe0, 0x92, 0xc4, 0x92, 0x54,
0xa1, 0x72, 0x2e, 0x9e, 0xe4, 0xfc, 0xbc, 0xe2, 0x92, 0xc4, 0xbc, 0x92, 0xf8, 0xb4, 0xd4, 0x54,
0x09, 0x66, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x1e, 0x3d, 0xa8, 0x2e, 0xe7, 0xfc, 0xcc, 0x3c, 0x27,
0xb7, 0x13, 0xf7, 0xe4, 0x19, 0x6e, 0xdd, 0x93, 0x57, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2,
0x4b, 0xce, 0xcf, 0xd5, 0x47, 0x31, 0x5c, 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0xa4, 0xb2, 0x20, 0x15,
0xa2, 0xe1, 0xd3, 0x3d, 0x79, 0xe1, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0x64, 0xa3, 0x95, 0x82,
0xb8, 0x61, 0x5c, 0xb7, 0xd4, 0x54, 0x27, 0xd7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63,
0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96,
0x63, 0x88, 0xd2, 0xc6, 0x6b, 0x4d, 0x05, 0x2c, 0x48, 0xc0, 0xf6, 0x25, 0xb1, 0x81, 0xfd, 0x65,
0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x7d, 0x6a, 0xff, 0x30, 0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.ConstantFee.Size()
i -= size
if _, err := m.ConstantFee.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.ConstantFee.Size()
n += 1 + l + sovGenesis(uint64(l))
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ConstantFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ConstantFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -4,67 +4,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// the address for where distributions rewards are withdrawn to by default
// this struct is only used at genesis to feed in default withdraw addresses
type DelegatorWithdrawInfo struct {
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"`
}
// used for import/export via genesis json
type ValidatorOutstandingRewardsRecord struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
OutstandingRewards sdk.DecCoins `json:"outstanding_rewards" yaml:"outstanding_rewards"`
}
// used for import / export via genesis json
type ValidatorAccumulatedCommissionRecord struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
Accumulated ValidatorAccumulatedCommission `json:"accumulated" yaml:"accumulated"`
}
// used for import / export via genesis json
type ValidatorHistoricalRewardsRecord struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
Period uint64 `json:"period" yaml:"period"`
Rewards ValidatorHistoricalRewards `json:"rewards" yaml:"rewards"`
}
// used for import / export via genesis json
type ValidatorCurrentRewardsRecord struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
Rewards ValidatorCurrentRewards `json:"rewards" yaml:"rewards"`
}
// used for import / export via genesis json
type DelegatorStartingInfoRecord struct {
DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
StartingInfo DelegatorStartingInfo `json:"starting_info" yaml:"starting_info"`
}
// used for import / export via genesis json
type ValidatorSlashEventRecord struct {
ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
Height uint64 `json:"height" yaml:"height"`
Period uint64 `json:"period" yaml:"period"`
Event ValidatorSlashEvent `json:"validator_slash_event" yaml:"validator_slash_event"`
}
// GenesisState - all distribution state that must be provided at genesis
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
FeePool FeePool `json:"fee_pool" yaml:"fee_pool"`
DelegatorWithdrawInfos []DelegatorWithdrawInfo `json:"delegator_withdraw_infos" yaml:"delegator_withdraw_infos"`
PreviousProposer sdk.ConsAddress `json:"previous_proposer" yaml:"previous_proposer"`
OutstandingRewards []ValidatorOutstandingRewardsRecord `json:"outstanding_rewards" yaml:"outstanding_rewards"`
ValidatorAccumulatedCommissions []ValidatorAccumulatedCommissionRecord `json:"validator_accumulated_commissions" yaml:"validator_accumulated_commissions"`
ValidatorHistoricalRewards []ValidatorHistoricalRewardsRecord `json:"validator_historical_rewards" yaml:"validator_historical_rewards"`
ValidatorCurrentRewards []ValidatorCurrentRewardsRecord `json:"validator_current_rewards" yaml:"validator_current_rewards"`
DelegatorStartingInfos []DelegatorStartingInfoRecord `json:"delegator_starting_infos" yaml:"delegator_starting_infos"`
ValidatorSlashEvents []ValidatorSlashEventRecord `json:"validator_slash_events" yaml:"validator_slash_events"`
}
func NewGenesisState(
params Params, fp FeePool, dwis []DelegatorWithdrawInfo, pp sdk.ConsAddress, r []ValidatorOutstandingRewardsRecord,
acc []ValidatorAccumulatedCommissionRecord, historical []ValidatorHistoricalRewardsRecord,

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,5 @@
package types
// GenesisState - minter state
type GenesisState struct {
Minter Minter `json:"minter" yaml:"minter"` // minter object
Params Params `json:"params" yaml:"params"` // inflation params
}
// NewGenesisState creates a new GenesisState object
func NewGenesisState(minter Minter, params Params) GenesisState {
return GenesisState{

378
x/mint/types/genesis.pb.go Normal file
View File

@ -0,0 +1,378 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/mint/genesis.proto
package types
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState - minter state
type GenesisState struct {
Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3,casttype=Minter" json:"minter"`
Params Params `protobuf:"bytes,2,opt,name=params,proto3,casttype=Params" json:"params"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_7127215efb5183f0, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetMinter() Minter {
if m != nil {
return m.Minter
}
return Minter{}
}
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func init() {
proto.RegisterType((*GenesisState)(nil), "cosmos.mint.GenesisState")
}
func init() { proto.RegisterFile("cosmos/mint/genesis.proto", fileDescriptor_7127215efb5183f0) }
var fileDescriptor_7127215efb5183f0 = []byte{
// 214 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xce, 0x2f, 0xce,
0xcd, 0x2f, 0xd6, 0xcf, 0xcd, 0xcc, 0x2b, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6,
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x48, 0xe9, 0x81, 0xa4, 0xa4, 0x44, 0xd2, 0xf3,
0xd3, 0xf3, 0xc1, 0xe2, 0xfa, 0x20, 0x16, 0x44, 0x89, 0x94, 0x18, 0xb2, 0x6e, 0x10, 0x01, 0x11,
0x57, 0xea, 0x60, 0xe4, 0xe2, 0x71, 0x87, 0x18, 0x16, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xcd,
0xc5, 0x06, 0x92, 0x4e, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd6, 0x43, 0x32,
0x5c, 0xcf, 0x17, 0x2c, 0xe5, 0xc4, 0x77, 0xe2, 0x9e, 0x3c, 0xc3, 0xaf, 0x7b, 0xf2, 0x6c, 0x10,
0x7e, 0x10, 0x54, 0x0b, 0x48, 0x73, 0x41, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x04, 0x13, 0x16, 0xcd,
0x01, 0x60, 0x29, 0x84, 0x66, 0x08, 0x3f, 0x08, 0xaa, 0xc5, 0xc9, 0xf9, 0xc4, 0x23, 0x39, 0xc6,
0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39,
0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x34, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3,
0x73, 0xf5, 0xa1, 0xfe, 0x80, 0x50, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x15, 0x10, 0x4f, 0x95, 0x54,
0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xbd, 0x65, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x48, 0xae,
0x44, 0x6c, 0x2e, 0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
{
size, err := m.Minter.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Minter.Size()
n += 1 + l + sovGenesis(uint64(l))
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Minter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -4,27 +4,8 @@ import (
"encoding/json"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GenesisState - all staking state that must be provided at genesis
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
LastTotalPower sdk.Int `json:"last_total_power" yaml:"last_total_power"`
LastValidatorPowers []LastValidatorPower `json:"last_validator_powers" yaml:"last_validator_powers"`
Validators Validators `json:"validators" yaml:"validators"`
Delegations Delegations `json:"delegations" yaml:"delegations"`
UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations" yaml:"unbonding_delegations"`
Redelegations []Redelegation `json:"redelegations" yaml:"redelegations"`
Exported bool `json:"exported" yaml:"exported"`
}
// LastValidatorPower required for validator set update logic
type LastValidatorPower struct {
Address sdk.ValAddress
Power int64
}
// NewGenesisState creates a new GenesisState instanc e
func NewGenesisState(params Params, validators []Validator, delegations []Delegation) GenesisState {
return GenesisState{

View File

@ -0,0 +1,953 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cosmos/staking/genesis.proto
package types
import (
fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState - all staking state that must be provided at genesis
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3,casttype=Params" json:"params"`
LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power" yaml:"last_total_power"`
LastValidatorPowers []LastValidatorPower `protobuf:"bytes,3,rep,name=last_validator_powers,json=lastValidatorPowers,proto3,casttype=LastValidatorPower" json:"last_validator_powers" yaml:"last_validator_powers"`
Validators []Validator `protobuf:"bytes,4,rep,name=validators,proto3,casttype=Validator" json:"validators"`
Delegations []Delegation `protobuf:"bytes,5,rep,name=delegations,proto3,casttype=Delegation" json:"delegations"`
UnbondingDelegations []UnbondingDelegation `protobuf:"bytes,6,rep,name=unbonding_delegations,json=unbondingDelegations,proto3,casttype=UnbondingDelegation" json:"unbonding_delegations" yaml:"unbonding_delegations"`
Redelegations []Redelegation `protobuf:"bytes,7,rep,name=redelegations,proto3,casttype=Redelegation" json:"redelegations"`
Exported bool `protobuf:"varint,8,opt,name=exported,proto3" json:"exported,omitempty"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_10c2ca02caf42801, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func (m *GenesisState) GetLastValidatorPowers() []LastValidatorPower {
if m != nil {
return m.LastValidatorPowers
}
return nil
}
func (m *GenesisState) GetValidators() []Validator {
if m != nil {
return m.Validators
}
return nil
}
func (m *GenesisState) GetDelegations() []Delegation {
if m != nil {
return m.Delegations
}
return nil
}
func (m *GenesisState) GetUnbondingDelegations() []UnbondingDelegation {
if m != nil {
return m.UnbondingDelegations
}
return nil
}
func (m *GenesisState) GetRedelegations() []Redelegation {
if m != nil {
return m.Redelegations
}
return nil
}
func (m *GenesisState) GetExported() bool {
if m != nil {
return m.Exported
}
return false
}
// LastValidatorPower required for validator set update logic
type LastValidatorPower struct {
Address github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"address,omitempty"`
Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"`
}
func (m *LastValidatorPower) Reset() { *m = LastValidatorPower{} }
func (m *LastValidatorPower) String() string { return proto.CompactTextString(m) }
func (*LastValidatorPower) ProtoMessage() {}
func (*LastValidatorPower) Descriptor() ([]byte, []int) {
return fileDescriptor_10c2ca02caf42801, []int{1}
}
func (m *LastValidatorPower) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LastValidatorPower) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LastValidatorPower.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LastValidatorPower) XXX_Merge(src proto.Message) {
xxx_messageInfo_LastValidatorPower.Merge(m, src)
}
func (m *LastValidatorPower) XXX_Size() int {
return m.Size()
}
func (m *LastValidatorPower) XXX_DiscardUnknown() {
xxx_messageInfo_LastValidatorPower.DiscardUnknown(m)
}
var xxx_messageInfo_LastValidatorPower proto.InternalMessageInfo
func (m *LastValidatorPower) GetAddress() github_com_cosmos_cosmos_sdk_types.ValAddress {
if m != nil {
return m.Address
}
return nil
}
func (m *LastValidatorPower) GetPower() int64 {
if m != nil {
return m.Power
}
return 0
}
func init() {
proto.RegisterType((*GenesisState)(nil), "cosmos.staking.GenesisState")
proto.RegisterType((*LastValidatorPower)(nil), "cosmos.staking.LastValidatorPower")
}
func init() { proto.RegisterFile("cosmos/staking/genesis.proto", fileDescriptor_10c2ca02caf42801) }
var fileDescriptor_10c2ca02caf42801 = []byte{
// 517 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x8b, 0xd3, 0x40,
0x14, 0xc7, 0x3b, 0xd6, 0xcd, 0xd6, 0x69, 0x2d, 0x3a, 0xdb, 0xd5, 0x58, 0x4a, 0x52, 0x22, 0x48,
0x0f, 0x6e, 0x82, 0xeb, 0x6d, 0x05, 0xc1, 0x20, 0xca, 0xe2, 0x1e, 0xca, 0xa8, 0x8b, 0x78, 0x29,
0xd3, 0xcd, 0x10, 0xc3, 0xa6, 0x99, 0x90, 0x99, 0xba, 0xbb, 0x5f, 0xc0, 0xb3, 0x08, 0x7e, 0xa7,
0x3d, 0xee, 0x51, 0x3c, 0x04, 0x69, 0xbf, 0xc1, 0x1e, 0x7b, 0x92, 0xcc, 0xa4, 0xd9, 0x34, 0x2d,
0xe2, 0x29, 0x9d, 0xff, 0x7b, 0xff, 0xdf, 0xfb, 0x67, 0x9a, 0x07, 0x7b, 0x27, 0x8c, 0x4f, 0x18,
0x77, 0xb8, 0x20, 0xa7, 0x41, 0xe4, 0x3b, 0x3e, 0x8d, 0x28, 0x0f, 0xb8, 0x1d, 0x27, 0x4c, 0x30,
0xd4, 0x56, 0x55, 0x3b, 0xaf, 0x76, 0x3b, 0x3e, 0xf3, 0x99, 0x2c, 0x39, 0xd9, 0x2f, 0xd5, 0xd5,
0xad, 0x32, 0xf2, 0xa7, 0xaa, 0x5a, 0xdf, 0x34, 0xd8, 0x7a, 0xab, 0xa8, 0xef, 0x05, 0x11, 0x14,
0xbd, 0x84, 0x5a, 0x4c, 0x12, 0x32, 0xe1, 0x3a, 0xe8, 0x83, 0x41, 0x73, 0xff, 0x81, 0xbd, 0x3a,
0xc5, 0x1e, 0xca, 0xaa, 0xdb, 0xbe, 0x4c, 0xcd, 0xda, 0x22, 0x35, 0x35, 0x75, 0xc6, 0xb9, 0x0b,
0x71, 0x78, 0x2f, 0x24, 0x5c, 0x8c, 0x04, 0x13, 0x24, 0x1c, 0xc5, 0xec, 0x8c, 0x26, 0xfa, 0xad,
0x3e, 0x18, 0xb4, 0xdc, 0xc3, 0xcc, 0xf1, 0x3b, 0x35, 0x9f, 0xf8, 0x81, 0xf8, 0x32, 0x1d, 0xdb,
0x27, 0x6c, 0xe2, 0xe4, 0xd9, 0xd4, 0x63, 0x8f, 0x7b, 0xa7, 0x8e, 0xb8, 0x88, 0x29, 0xb7, 0x0f,
0x23, 0x71, 0x9d, 0x9a, 0x0f, 0x2f, 0xc8, 0x24, 0x3c, 0xb0, 0xaa, 0x3c, 0x0b, 0xb7, 0x33, 0xe9,
0x43, 0xa6, 0x0c, 0x33, 0x01, 0xfd, 0x00, 0x70, 0x57, 0x76, 0x7d, 0x25, 0x61, 0xe0, 0x11, 0xc1,
0x12, 0xd5, 0xc9, 0xf5, 0x7a, 0xbf, 0x3e, 0x68, 0xee, 0x5b, 0xd5, 0x97, 0x38, 0x22, 0x5c, 0x1c,
0x2f, 0x7b, 0x25, 0xc3, 0x3d, 0xc8, 0xe2, 0x5d, 0xa7, 0x66, 0xaf, 0x34, 0xb4, 0x8a, 0xb3, 0x16,
0xa9, 0x89, 0xd6, 0xbd, 0x78, 0x27, 0x5c, 0xd3, 0x38, 0x3a, 0x82, 0xb0, 0xf0, 0x73, 0xfd, 0xb6,
0x0c, 0xf2, 0xa8, 0x1a, 0xa4, 0x30, 0xb9, 0xf7, 0xf3, 0x0b, 0xbd, 0x53, 0x48, 0xb8, 0xe4, 0x47,
0x43, 0xd8, 0xf4, 0x68, 0x48, 0x7d, 0x22, 0x02, 0x16, 0x71, 0x7d, 0x4b, 0xe2, 0xba, 0x55, 0xdc,
0xeb, 0xa2, 0xc5, 0x45, 0x39, 0x0f, 0xde, 0x68, 0xb8, 0x8c, 0x40, 0x3f, 0x01, 0xdc, 0x9d, 0x46,
0x63, 0x16, 0x79, 0x41, 0xe4, 0x8f, 0xca, 0x70, 0x4d, 0xc2, 0x1f, 0x57, 0xe1, 0x1f, 0x97, 0xcd,
0xa5, 0x29, 0x2f, 0x56, 0x6f, 0x6d, 0x23, 0x2f, 0xbb, 0xb5, 0x9d, 0x0d, 0x66, 0xdc, 0x99, 0xae,
0x8b, 0x1c, 0x7d, 0x82, 0x77, 0x13, 0x5a, 0x8e, 0xb3, 0x2d, 0xe3, 0xf4, 0xaa, 0x71, 0x70, 0xa9,
0xc9, 0xed, 0xe4, 0x6f, 0xdb, 0x2a, 0xab, 0x78, 0x15, 0x84, 0xba, 0xb0, 0x41, 0xcf, 0x63, 0x96,
0x08, 0xea, 0xe9, 0x8d, 0x3e, 0x18, 0x34, 0x70, 0x71, 0xb6, 0xce, 0xe0, 0x86, 0x3f, 0x16, 0xbd,
0x83, 0xdb, 0xc4, 0xf3, 0x12, 0xca, 0xd5, 0x3a, 0xb4, 0xdc, 0x67, 0x8b, 0xd4, 0xdc, 0xfb, 0x8f,
0x0f, 0xf8, 0x98, 0x84, 0xaf, 0x94, 0x11, 0x2f, 0x09, 0xa8, 0x03, 0xb7, 0x6e, 0xf6, 0xa1, 0x8e,
0xd5, 0xc1, 0x7d, 0x73, 0x39, 0x33, 0xc0, 0xd5, 0xcc, 0x00, 0x7f, 0x66, 0x06, 0xf8, 0x3e, 0x37,
0x6a, 0x57, 0x73, 0xa3, 0xf6, 0x6b, 0x6e, 0xd4, 0x3e, 0x3f, 0xfd, 0xe7, 0x9c, 0xf3, 0x62, 0xa3,
0xe5, 0xc4, 0xb1, 0x26, 0x17, 0xfa, 0xf9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xd7, 0x71,
0x39, 0x34, 0x04, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Exported {
i--
if m.Exported {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x40
}
if len(m.Redelegations) > 0 {
for iNdEx := len(m.Redelegations) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Redelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
}
}
if len(m.UnbondingDelegations) > 0 {
for iNdEx := len(m.UnbondingDelegations) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.UnbondingDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
}
if len(m.Delegations) > 0 {
for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
}
if len(m.Validators) > 0 {
for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if len(m.LastValidatorPowers) > 0 {
for iNdEx := len(m.LastValidatorPowers) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.LastValidatorPowers[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
{
size := m.LastTotalPower.Size()
i -= size
if _, err := m.LastTotalPower.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *LastValidatorPower) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LastValidatorPower) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LastValidatorPower) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Power != 0 {
i = encodeVarintGenesis(dAtA, i, uint64(m.Power))
i--
dAtA[i] = 0x10
}
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
l = m.LastTotalPower.Size()
n += 1 + l + sovGenesis(uint64(l))
if len(m.LastValidatorPowers) > 0 {
for _, e := range m.LastValidatorPowers {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.Validators) > 0 {
for _, e := range m.Validators {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.Delegations) > 0 {
for _, e := range m.Delegations {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.UnbondingDelegations) > 0 {
for _, e := range m.UnbondingDelegations {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.Redelegations) > 0 {
for _, e := range m.Redelegations {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if m.Exported {
n += 2
}
return n
}
func (m *LastValidatorPower) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Address)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
if m.Power != 0 {
n += 1 + sovGenesis(uint64(m.Power))
}
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastTotalPower", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.LastTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LastValidatorPowers", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LastValidatorPowers = append(m.LastValidatorPowers, LastValidatorPower{})
if err := m.LastValidatorPowers[len(m.LastValidatorPowers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Validators = append(m.Validators, Validator{})
if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Delegations", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Delegations = append(m.Delegations, Delegation{})
if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UnbondingDelegations", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.UnbondingDelegations = append(m.UnbondingDelegations, UnbondingDelegation{})
if err := m.UnbondingDelegations[len(m.UnbondingDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Redelegations", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Redelegations = append(m.Redelegations, Redelegation{})
if err := m.Redelegations[len(m.Redelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Exported", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Exported = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *LastValidatorPower) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LastValidatorPower: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LastValidatorPower: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
if m.Address == nil {
m.Address = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType)
}
m.Power = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Power |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)