From 82d0be5f197849426ee3bde6a919b9f1f208dbd8 Mon Sep 17 00:00:00 2001 From: Zhijie Shen <35021395+zjshen14@users.noreply.github.com> Date: Thu, 7 Mar 2019 13:40:00 -0800 Subject: [PATCH] Improve the way to hash genesis config (#691) --- api/api_test.go | 6 +- blockchain/blockchain.go | 4 +- blockchain/genesis/genesis.go | 83 ++++- proto/types/genesis.proto | 59 ++++ protogen/iotextypes/genesis.pb.go | 495 ++++++++++++++++++++++++++++++ 5 files changed, 631 insertions(+), 16 deletions(-) create mode 100644 proto/types/genesis.proto create mode 100644 protogen/iotextypes/genesis.pb.go diff --git a/api/api_test.go b/api/api_test.go index 73df45ee91..75b27e749c 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -1017,8 +1017,9 @@ func TestServer_GetProductivity(t *testing.T) { bc, _, err := setupChain(cfg) require.NoError(err) require.NoError(bc.Start(context.Background())) + genesisDigest := cfg.Genesis.Hash() require.NoError(addTestingDummyBlocks(bc, test.blockProducers, test.blockProducerKeys, test.numSubEpochs, - test.failedBlockProducer)) + test.failedBlockProducer, genesisDigest)) svr.bc = bc res, err := svr.GetProductivity(context.Background(), &iotexapi.GetProductivityRequest{EpochNumber: test.epochNumber}) @@ -1189,9 +1190,10 @@ func addTestingDummyBlocks( blockProducerKeys []keypair.PrivateKey, numSubEpochs uint64, failedBlockProducer genesis.Delegate, + genesisDigest hash.Hash256, ) error { failedIndex := rand.Intn(int(numSubEpochs)) - prevBlkHash := hash.ZeroHash256 + prevBlkHash := genesisDigest var prevBlkHeight uint64 for i := 0; i < int(numSubEpochs); i++ { for j, bp := range blockProducers { diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index 59504a81e1..1eeebf379f 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -719,7 +719,7 @@ func (bc *blockchain) MintNewBlock( // The first block's previous block hash is pointing to the digest of genesis config. This is to guarantee all nodes // could verify that they start from the same genesis if newblockHeight == 1 { - prevBlkHash = bc.config.Genesis.Digest + prevBlkHash = bc.config.Genesis.Hash() } blk, err := block.NewBuilder(ra). SetPrevBlockHash(prevBlkHash). @@ -1009,7 +1009,7 @@ func (bc *blockchain) validateBlock(blk *block.Block) error { validateTimer := bc.timerFactory.NewTimer("validate") prevBlkHash := bc.tipHash if blk.Height() == 1 { - prevBlkHash = bc.config.Genesis.Digest + prevBlkHash = bc.config.Genesis.Hash() } err := bc.validator.Validate(blk, bc.tipHeight, prevBlkHash) validateTimer.End() diff --git a/blockchain/genesis/genesis.go b/blockchain/genesis/genesis.go index 21ae2f1523..da16322315 100644 --- a/blockchain/genesis/genesis.go +++ b/blockchain/genesis/genesis.go @@ -8,20 +8,20 @@ package genesis import ( "flag" - "io/ioutil" "math/big" "sort" "time" - "github.com/iotexproject/iotex-core/pkg/hash" - + "github.com/golang/protobuf/proto" "github.com/pkg/errors" "go.uber.org/config" "go.uber.org/zap" "github.com/iotexproject/iotex-core/address" + "github.com/iotexproject/iotex-core/pkg/hash" "github.com/iotexproject/iotex-core/pkg/log" "github.com/iotexproject/iotex-core/pkg/unit" + "github.com/iotexproject/iotex-core/protogen/iotextypes" "github.com/iotexproject/iotex-core/test/identityset" ) @@ -84,8 +84,6 @@ type ( Account `ymal:"account"` Poll `yaml:"poll"` Rewarding `yaml:"rewarding"` - // Digest is the digest of genesis config file - Digest hash.Hash256 } // Blockchain contains blockchain level configs Blockchain struct { @@ -159,14 +157,8 @@ type ( func New() (Genesis, error) { opts := make([]config.YAMLOption, 0) opts = append(opts, config.Static(Default)) - genesisDigest := hash.ZeroHash256 if genesisPath != "" { opts = append(opts, config.File(genesisPath)) - genesisCfgBytes, err := ioutil.ReadFile(genesisPath) - if err != nil { - return Genesis{}, err - } - genesisDigest = hash.Hash256b(genesisCfgBytes) } yaml, err := config.NewYAML(opts...) if err != nil { @@ -177,10 +169,77 @@ func New() (Genesis, error) { if err := yaml.Get(config.Root).Populate(&genesis); err != nil { return Genesis{}, errors.Wrap(err, "failed to unmarshal yaml genesis to struct") } - genesis.Digest = genesisDigest return genesis, nil } +// Hash is the hash of genesis config +func (g *Genesis) Hash() hash.Hash256 { + gbProto := iotextypes.GenesisBlockchain{ + Timestamp: g.Timestamp, + BlockGasLimit: g.BlockGasLimit, + ActionGasLimit: g.ActionGasLimit, + BlockInterval: g.BlockInterval.Nanoseconds(), + NumSubEpochs: g.NumSubEpochs, + NumDelegates: g.NumDelegates, + NumCandidateDelegates: g.NumCandidateDelegates, + TimeBasedRotation: g.TimeBasedRotation, + } + + initBalanceAddrs := make([]string, 0) + for initBalanceAddr := range g.InitBalanceMap { + initBalanceAddrs = append(initBalanceAddrs, initBalanceAddr) + } + sort.Strings(initBalanceAddrs) + initBalances := make([]string, 0) + for _, initBalanceAddr := range initBalanceAddrs { + initBalances = append(initBalances, g.InitBalanceMap[initBalanceAddr]) + } + aProto := iotextypes.GenesisAccount{ + InitBalanceAddrs: initBalanceAddrs, + InitBalances: initBalances, + } + + dProtos := make([]*iotextypes.GenesisDelegate, 0) + for _, d := range g.Delegates { + dProto := iotextypes.GenesisDelegate{ + OperatorAddr: d.OperatorAddrStr, + RewardAddr: d.RewardAddrStr, + Votes: d.VotesStr, + } + dProtos = append(dProtos, &dProto) + } + pProto := iotextypes.GenesisPoll{ + EnableGravityChainVoting: g.EnableGravityChainVoting, + GravityChainStartHeight: g.GravityChainStartHeight, + RegisterContractAddress: g.RegisterContractAddress, + StakingContractAddress: g.StakingContractAddress, + VoteThreshold: g.VoteThreshold, + ScoreThreshold: g.ScoreThreshold, + SelfStakingThreshold: g.SelfStakingThreshold, + Delegates: dProtos, + } + + rProto := iotextypes.GenesisRewarding{ + InitAdminAddr: g.InitAdminAddrStr, + InitBalance: g.InitBalanceStr, + BlockReward: g.BlockRewardStr, + EpochReward: g.EpochRewardStr, + NumDelegatesForEpochReward: g.NumDelegatesForEpochReward, + } + + gProto := iotextypes.Genesis{ + Blockchain: &gbProto, + Account: &aProto, + Poll: &pProto, + Rewarding: &rProto, + } + b, err := proto.Marshal(&gProto) + if err != nil { + log.L().Panic("Error when marshaling genesis proto", zap.Error(err)) + } + return hash.Hash256b(b) +} + // InitBalances returns the address that have initial balances and the corresponding amounts. The i-th amount is the // i-th address' balance. func (a *Account) InitBalances() ([]address.Address, []*big.Int) { diff --git a/proto/types/genesis.proto b/proto/types/genesis.proto new file mode 100644 index 0000000000..e2e00b89c1 --- /dev/null +++ b/proto/types/genesis.proto @@ -0,0 +1,59 @@ +// Copyright (c) 2019 IoTeX +// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no +// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent +// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache +// License 2.0 that can be found in the LICENSE file. + +// To compile the proto, run: +// protoc --go_out=plugins=grpc:$GOPATH/src *.proto +syntax = "proto3"; +package iotextypes; +option go_package = "github.com/iotexproject/iotex-core/protogen/iotextypes"; + +message Genesis { + GenesisBlockchain blockchain = 1; + GenesisAccount account = 2; + GenesisPoll poll = 3; + GenesisRewarding rewarding = 4; +} + +message GenesisBlockchain { + int64 timestamp = 1; + uint64 blockGasLimit = 2; + uint64 actionGasLimit = 3; + int64 blockInterval = 4; + uint64 numSubEpochs = 5; + uint64 numDelegates = 6; + uint64 numCandidateDelegates = 7; + bool timeBasedRotation = 8; +} + +message GenesisAccount { + repeated string initBalanceAddrs = 1; + repeated string initBalances = 2; +} + +message GenesisPoll { + bool enableGravityChainVoting = 1; + uint64 gravityChainStartHeight = 2; + string registerContractAddress = 3; + string stakingContractAddress = 4; + string voteThreshold = 5; + string scoreThreshold = 6; + string selfStakingThreshold = 7; + repeated GenesisDelegate delegates = 8; +} + +message GenesisDelegate { + string operatorAddr = 1; + string rewardAddr = 2; + string votes = 3; +} + +message GenesisRewarding { + string initAdminAddr = 1; + string initBalance = 2; + string blockReward = 3; + string epochReward = 4; + uint64 numDelegatesForEpochReward = 5; +} \ No newline at end of file diff --git a/protogen/iotextypes/genesis.pb.go b/protogen/iotextypes/genesis.pb.go new file mode 100644 index 0000000000..c6aea4ec7a --- /dev/null +++ b/protogen/iotextypes/genesis.pb.go @@ -0,0 +1,495 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: genesis.proto + +package iotextypes // import "github.com/iotexproject/iotex-core/protogen/iotextypes" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// 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.ProtoPackageIsVersion2 // please upgrade the proto package + +type Genesis struct { + Blockchain *GenesisBlockchain `protobuf:"bytes,1,opt,name=blockchain,proto3" json:"blockchain,omitempty"` + Account *GenesisAccount `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"` + Poll *GenesisPoll `protobuf:"bytes,3,opt,name=poll,proto3" json:"poll,omitempty"` + Rewarding *GenesisRewarding `protobuf:"bytes,4,opt,name=rewarding,proto3" json:"rewarding,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Genesis) Reset() { *m = Genesis{} } +func (m *Genesis) String() string { return proto.CompactTextString(m) } +func (*Genesis) ProtoMessage() {} +func (*Genesis) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_06026e1851d8d2a6, []int{0} +} +func (m *Genesis) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Genesis.Unmarshal(m, b) +} +func (m *Genesis) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Genesis.Marshal(b, m, deterministic) +} +func (dst *Genesis) XXX_Merge(src proto.Message) { + xxx_messageInfo_Genesis.Merge(dst, src) +} +func (m *Genesis) XXX_Size() int { + return xxx_messageInfo_Genesis.Size(m) +} +func (m *Genesis) XXX_DiscardUnknown() { + xxx_messageInfo_Genesis.DiscardUnknown(m) +} + +var xxx_messageInfo_Genesis proto.InternalMessageInfo + +func (m *Genesis) GetBlockchain() *GenesisBlockchain { + if m != nil { + return m.Blockchain + } + return nil +} + +func (m *Genesis) GetAccount() *GenesisAccount { + if m != nil { + return m.Account + } + return nil +} + +func (m *Genesis) GetPoll() *GenesisPoll { + if m != nil { + return m.Poll + } + return nil +} + +func (m *Genesis) GetRewarding() *GenesisRewarding { + if m != nil { + return m.Rewarding + } + return nil +} + +type GenesisBlockchain struct { + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + BlockGasLimit uint64 `protobuf:"varint,2,opt,name=blockGasLimit,proto3" json:"blockGasLimit,omitempty"` + ActionGasLimit uint64 `protobuf:"varint,3,opt,name=actionGasLimit,proto3" json:"actionGasLimit,omitempty"` + BlockInterval int64 `protobuf:"varint,4,opt,name=blockInterval,proto3" json:"blockInterval,omitempty"` + NumSubEpochs uint64 `protobuf:"varint,5,opt,name=numSubEpochs,proto3" json:"numSubEpochs,omitempty"` + NumDelegates uint64 `protobuf:"varint,6,opt,name=numDelegates,proto3" json:"numDelegates,omitempty"` + NumCandidateDelegates uint64 `protobuf:"varint,7,opt,name=numCandidateDelegates,proto3" json:"numCandidateDelegates,omitempty"` + TimeBasedRotation bool `protobuf:"varint,8,opt,name=timeBasedRotation,proto3" json:"timeBasedRotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GenesisBlockchain) Reset() { *m = GenesisBlockchain{} } +func (m *GenesisBlockchain) String() string { return proto.CompactTextString(m) } +func (*GenesisBlockchain) ProtoMessage() {} +func (*GenesisBlockchain) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_06026e1851d8d2a6, []int{1} +} +func (m *GenesisBlockchain) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GenesisBlockchain.Unmarshal(m, b) +} +func (m *GenesisBlockchain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GenesisBlockchain.Marshal(b, m, deterministic) +} +func (dst *GenesisBlockchain) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisBlockchain.Merge(dst, src) +} +func (m *GenesisBlockchain) XXX_Size() int { + return xxx_messageInfo_GenesisBlockchain.Size(m) +} +func (m *GenesisBlockchain) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisBlockchain.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisBlockchain proto.InternalMessageInfo + +func (m *GenesisBlockchain) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +func (m *GenesisBlockchain) GetBlockGasLimit() uint64 { + if m != nil { + return m.BlockGasLimit + } + return 0 +} + +func (m *GenesisBlockchain) GetActionGasLimit() uint64 { + if m != nil { + return m.ActionGasLimit + } + return 0 +} + +func (m *GenesisBlockchain) GetBlockInterval() int64 { + if m != nil { + return m.BlockInterval + } + return 0 +} + +func (m *GenesisBlockchain) GetNumSubEpochs() uint64 { + if m != nil { + return m.NumSubEpochs + } + return 0 +} + +func (m *GenesisBlockchain) GetNumDelegates() uint64 { + if m != nil { + return m.NumDelegates + } + return 0 +} + +func (m *GenesisBlockchain) GetNumCandidateDelegates() uint64 { + if m != nil { + return m.NumCandidateDelegates + } + return 0 +} + +func (m *GenesisBlockchain) GetTimeBasedRotation() bool { + if m != nil { + return m.TimeBasedRotation + } + return false +} + +type GenesisAccount struct { + InitBalanceAddrs []string `protobuf:"bytes,1,rep,name=initBalanceAddrs,proto3" json:"initBalanceAddrs,omitempty"` + InitBalances []string `protobuf:"bytes,2,rep,name=initBalances,proto3" json:"initBalances,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GenesisAccount) Reset() { *m = GenesisAccount{} } +func (m *GenesisAccount) String() string { return proto.CompactTextString(m) } +func (*GenesisAccount) ProtoMessage() {} +func (*GenesisAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_06026e1851d8d2a6, []int{2} +} +func (m *GenesisAccount) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GenesisAccount.Unmarshal(m, b) +} +func (m *GenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GenesisAccount.Marshal(b, m, deterministic) +} +func (dst *GenesisAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisAccount.Merge(dst, src) +} +func (m *GenesisAccount) XXX_Size() int { + return xxx_messageInfo_GenesisAccount.Size(m) +} +func (m *GenesisAccount) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisAccount proto.InternalMessageInfo + +func (m *GenesisAccount) GetInitBalanceAddrs() []string { + if m != nil { + return m.InitBalanceAddrs + } + return nil +} + +func (m *GenesisAccount) GetInitBalances() []string { + if m != nil { + return m.InitBalances + } + return nil +} + +type GenesisPoll struct { + EnableGravityChainVoting bool `protobuf:"varint,1,opt,name=enableGravityChainVoting,proto3" json:"enableGravityChainVoting,omitempty"` + GravityChainStartHeight uint64 `protobuf:"varint,2,opt,name=gravityChainStartHeight,proto3" json:"gravityChainStartHeight,omitempty"` + RegisterContractAddress string `protobuf:"bytes,3,opt,name=registerContractAddress,proto3" json:"registerContractAddress,omitempty"` + StakingContractAddress string `protobuf:"bytes,4,opt,name=stakingContractAddress,proto3" json:"stakingContractAddress,omitempty"` + VoteThreshold string `protobuf:"bytes,5,opt,name=voteThreshold,proto3" json:"voteThreshold,omitempty"` + ScoreThreshold string `protobuf:"bytes,6,opt,name=scoreThreshold,proto3" json:"scoreThreshold,omitempty"` + SelfStakingThreshold string `protobuf:"bytes,7,opt,name=selfStakingThreshold,proto3" json:"selfStakingThreshold,omitempty"` + Delegates []*GenesisDelegate `protobuf:"bytes,8,rep,name=delegates,proto3" json:"delegates,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GenesisPoll) Reset() { *m = GenesisPoll{} } +func (m *GenesisPoll) String() string { return proto.CompactTextString(m) } +func (*GenesisPoll) ProtoMessage() {} +func (*GenesisPoll) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_06026e1851d8d2a6, []int{3} +} +func (m *GenesisPoll) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GenesisPoll.Unmarshal(m, b) +} +func (m *GenesisPoll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GenesisPoll.Marshal(b, m, deterministic) +} +func (dst *GenesisPoll) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisPoll.Merge(dst, src) +} +func (m *GenesisPoll) XXX_Size() int { + return xxx_messageInfo_GenesisPoll.Size(m) +} +func (m *GenesisPoll) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisPoll.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisPoll proto.InternalMessageInfo + +func (m *GenesisPoll) GetEnableGravityChainVoting() bool { + if m != nil { + return m.EnableGravityChainVoting + } + return false +} + +func (m *GenesisPoll) GetGravityChainStartHeight() uint64 { + if m != nil { + return m.GravityChainStartHeight + } + return 0 +} + +func (m *GenesisPoll) GetRegisterContractAddress() string { + if m != nil { + return m.RegisterContractAddress + } + return "" +} + +func (m *GenesisPoll) GetStakingContractAddress() string { + if m != nil { + return m.StakingContractAddress + } + return "" +} + +func (m *GenesisPoll) GetVoteThreshold() string { + if m != nil { + return m.VoteThreshold + } + return "" +} + +func (m *GenesisPoll) GetScoreThreshold() string { + if m != nil { + return m.ScoreThreshold + } + return "" +} + +func (m *GenesisPoll) GetSelfStakingThreshold() string { + if m != nil { + return m.SelfStakingThreshold + } + return "" +} + +func (m *GenesisPoll) GetDelegates() []*GenesisDelegate { + if m != nil { + return m.Delegates + } + return nil +} + +type GenesisDelegate struct { + OperatorAddr string `protobuf:"bytes,1,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"` + RewardAddr string `protobuf:"bytes,2,opt,name=rewardAddr,proto3" json:"rewardAddr,omitempty"` + Votes string `protobuf:"bytes,3,opt,name=votes,proto3" json:"votes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GenesisDelegate) Reset() { *m = GenesisDelegate{} } +func (m *GenesisDelegate) String() string { return proto.CompactTextString(m) } +func (*GenesisDelegate) ProtoMessage() {} +func (*GenesisDelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_06026e1851d8d2a6, []int{4} +} +func (m *GenesisDelegate) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GenesisDelegate.Unmarshal(m, b) +} +func (m *GenesisDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GenesisDelegate.Marshal(b, m, deterministic) +} +func (dst *GenesisDelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisDelegate.Merge(dst, src) +} +func (m *GenesisDelegate) XXX_Size() int { + return xxx_messageInfo_GenesisDelegate.Size(m) +} +func (m *GenesisDelegate) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisDelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisDelegate proto.InternalMessageInfo + +func (m *GenesisDelegate) GetOperatorAddr() string { + if m != nil { + return m.OperatorAddr + } + return "" +} + +func (m *GenesisDelegate) GetRewardAddr() string { + if m != nil { + return m.RewardAddr + } + return "" +} + +func (m *GenesisDelegate) GetVotes() string { + if m != nil { + return m.Votes + } + return "" +} + +type GenesisRewarding struct { + InitAdminAddr string `protobuf:"bytes,1,opt,name=initAdminAddr,proto3" json:"initAdminAddr,omitempty"` + InitBalance string `protobuf:"bytes,2,opt,name=initBalance,proto3" json:"initBalance,omitempty"` + BlockReward string `protobuf:"bytes,3,opt,name=blockReward,proto3" json:"blockReward,omitempty"` + EpochReward string `protobuf:"bytes,4,opt,name=epochReward,proto3" json:"epochReward,omitempty"` + NumDelegatesForEpochReward uint64 `protobuf:"varint,5,opt,name=numDelegatesForEpochReward,proto3" json:"numDelegatesForEpochReward,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GenesisRewarding) Reset() { *m = GenesisRewarding{} } +func (m *GenesisRewarding) String() string { return proto.CompactTextString(m) } +func (*GenesisRewarding) ProtoMessage() {} +func (*GenesisRewarding) Descriptor() ([]byte, []int) { + return fileDescriptor_genesis_06026e1851d8d2a6, []int{5} +} +func (m *GenesisRewarding) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GenesisRewarding.Unmarshal(m, b) +} +func (m *GenesisRewarding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GenesisRewarding.Marshal(b, m, deterministic) +} +func (dst *GenesisRewarding) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisRewarding.Merge(dst, src) +} +func (m *GenesisRewarding) XXX_Size() int { + return xxx_messageInfo_GenesisRewarding.Size(m) +} +func (m *GenesisRewarding) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisRewarding.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisRewarding proto.InternalMessageInfo + +func (m *GenesisRewarding) GetInitAdminAddr() string { + if m != nil { + return m.InitAdminAddr + } + return "" +} + +func (m *GenesisRewarding) GetInitBalance() string { + if m != nil { + return m.InitBalance + } + return "" +} + +func (m *GenesisRewarding) GetBlockReward() string { + if m != nil { + return m.BlockReward + } + return "" +} + +func (m *GenesisRewarding) GetEpochReward() string { + if m != nil { + return m.EpochReward + } + return "" +} + +func (m *GenesisRewarding) GetNumDelegatesForEpochReward() uint64 { + if m != nil { + return m.NumDelegatesForEpochReward + } + return 0 +} + +func init() { + proto.RegisterType((*Genesis)(nil), "iotextypes.Genesis") + proto.RegisterType((*GenesisBlockchain)(nil), "iotextypes.GenesisBlockchain") + proto.RegisterType((*GenesisAccount)(nil), "iotextypes.GenesisAccount") + proto.RegisterType((*GenesisPoll)(nil), "iotextypes.GenesisPoll") + proto.RegisterType((*GenesisDelegate)(nil), "iotextypes.GenesisDelegate") + proto.RegisterType((*GenesisRewarding)(nil), "iotextypes.GenesisRewarding") +} + +func init() { proto.RegisterFile("genesis.proto", fileDescriptor_genesis_06026e1851d8d2a6) } + +var fileDescriptor_genesis_06026e1851d8d2a6 = []byte{ + // 653 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0x5f, 0x6f, 0xd3, 0x3c, + 0x14, 0xc6, 0xd5, 0xa6, 0x5b, 0x97, 0xd3, 0x77, 0x7b, 0x37, 0x6b, 0xb0, 0x68, 0x0c, 0x54, 0x45, + 0x08, 0x55, 0xfc, 0xe9, 0xa4, 0x31, 0x4d, 0x63, 0x12, 0x48, 0xeb, 0x18, 0x03, 0x89, 0x0b, 0xe4, + 0x21, 0x2e, 0xb8, 0xc2, 0x4d, 0x0e, 0xa9, 0x59, 0x62, 0x47, 0xb6, 0x3b, 0xd8, 0xd7, 0xe2, 0x9b, + 0xf0, 0x05, 0xb8, 0xe5, 0x6b, 0x20, 0x3b, 0x6d, 0x93, 0x74, 0x2d, 0x97, 0x79, 0xce, 0xef, 0xb1, + 0xfb, 0xf8, 0x9c, 0x53, 0x58, 0x4f, 0x50, 0xa0, 0xe6, 0xba, 0x9f, 0x2b, 0x69, 0x24, 0x01, 0x2e, + 0x0d, 0xfe, 0x30, 0x37, 0x39, 0xea, 0xf0, 0x4f, 0x03, 0xda, 0x17, 0x45, 0x95, 0xbc, 0x04, 0x18, + 0xa6, 0x32, 0xba, 0x8a, 0x46, 0x8c, 0x8b, 0xa0, 0xd1, 0x6d, 0xf4, 0x3a, 0x07, 0xf7, 0xfb, 0x25, + 0xdc, 0x9f, 0x80, 0x83, 0x19, 0x44, 0x2b, 0x06, 0x72, 0x08, 0x6d, 0x16, 0x45, 0x72, 0x2c, 0x4c, + 0xd0, 0x74, 0xde, 0xdd, 0x05, 0xde, 0xd3, 0x82, 0xa0, 0x53, 0x94, 0x3c, 0x81, 0x56, 0x2e, 0xd3, + 0x34, 0xf0, 0x9c, 0x65, 0x67, 0x81, 0xe5, 0x83, 0x4c, 0x53, 0xea, 0x20, 0x72, 0x02, 0xbe, 0xc2, + 0xef, 0x4c, 0xc5, 0x5c, 0x24, 0x41, 0xcb, 0x39, 0xf6, 0x16, 0x38, 0xe8, 0x94, 0xa1, 0x25, 0x1e, + 0xfe, 0x6a, 0xc2, 0xd6, 0xad, 0x00, 0x64, 0x0f, 0x7c, 0xc3, 0x33, 0xd4, 0x86, 0x65, 0xb9, 0x8b, + 0xec, 0xd1, 0x52, 0x20, 0x0f, 0x61, 0xdd, 0x05, 0xbc, 0x60, 0xfa, 0x3d, 0xcf, 0x78, 0x11, 0xac, + 0x45, 0xeb, 0x22, 0x79, 0x04, 0x1b, 0x2c, 0x32, 0x5c, 0x8a, 0x19, 0xe6, 0x39, 0x6c, 0x4e, 0x9d, + 0x9d, 0xf6, 0x4e, 0x18, 0x54, 0xd7, 0x2c, 0x75, 0x09, 0x3c, 0x5a, 0x17, 0x49, 0x08, 0xff, 0x89, + 0x71, 0x76, 0x39, 0x1e, 0x9e, 0xe7, 0x32, 0x1a, 0xe9, 0x60, 0xc5, 0x9d, 0x55, 0xd3, 0x26, 0xcc, + 0x6b, 0x4c, 0x31, 0x61, 0x06, 0x75, 0xb0, 0x3a, 0x63, 0x66, 0x1a, 0x39, 0x84, 0x3b, 0x62, 0x9c, + 0x9d, 0x31, 0x11, 0xf3, 0x98, 0x19, 0x2c, 0xe1, 0xb6, 0x83, 0x17, 0x17, 0xc9, 0x53, 0xd8, 0xb2, + 0xf1, 0x07, 0x4c, 0x63, 0x4c, 0xa5, 0x61, 0x36, 0x40, 0xb0, 0xd6, 0x6d, 0xf4, 0xd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