From 42f6c1fbd8c527f9a115ddd318b522f8e0a0e5f8 Mon Sep 17 00:00:00 2001 From: tnasu Date: Thu, 28 Jul 2022 03:33:43 +0900 Subject: [PATCH 1/5] Swap StakingPower and VotingPower --- abci/cmd/abci-cli/abci-cli.go | 10 +- .../kvstore/tool/make_val_set_change_tx.go | 4 +- .../kvstore/tool/make_val_set_change_tx.sh | 9 +- abci/types/types.pb.go | 384 +++++++++--------- blockchain/v0/reactor_test.go | 2 +- blockchain/v1/reactor_test.go | 2 +- blockchain/v2/reactor_test.go | 2 +- consensus/common_test.go | 12 +- consensus/reactor_test.go | 28 +- consensus/state.go | 14 +- consensus/state_test.go | 24 +- evidence/pool_test.go | 2 +- evidence/reactor_test.go | 4 +- evidence/verify.go | 18 +- evidence/verify_test.go | 8 +- light/detector.go | 4 +- light/errors.go | 2 +- light/helpers_test.go | 6 +- light/verifier.go | 2 +- light/verifier_test.go | 8 +- proto/ostracon/abci/types.proto | 4 +- proto/ostracon/types/evidence.pb.go | 92 ++--- proto/ostracon/types/evidence.proto | 2 +- proto/ostracon/types/validator.pb.go | 131 +++--- proto/ostracon/types/validator.proto | 10 +- proto/ostracon/types/voter.pb.go | 60 +-- proto/ostracon/types/voter.proto | 2 +- rpc/client/rpc_test.go | 4 +- rpc/core/consensus.go | 2 +- rpc/core/status.go | 10 +- rpc/core/types/responses.go | 6 +- state/execution_test.go | 8 +- state/helpers_test.go | 2 +- state/state.go | 4 +- state/state_test.go | 94 ++--- state/store_test.go | 2 +- test/e2e/tests/validator_test.go | 8 +- test/maverick/consensus/state.go | 8 +- types/evidence.go | 25 +- types/evidence_test.go | 8 +- types/priv_validator.go | 8 +- types/protobuf.go | 8 +- types/validator.go | 44 +- types/validator_set.go | 124 +++--- types/validator_set_test.go | 102 ++--- types/vote_set.go | 10 +- types/voter_set.go | 228 ++++++----- types/voter_set_test.go | 189 +++++---- 48 files changed, 872 insertions(+), 868 deletions(-) diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 54e5b4e2a..8d9f54734 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -55,8 +55,8 @@ var ( // kvstore flagPersist string - // staking power for make validator_tx - flagStakingPower int64 + // voting power for make validator_tx + flagVotingPower123456 int64 ) var RootCmd = &cobra.Command{ @@ -154,8 +154,8 @@ func addKVStoreFlags() { } func addPersistKVStoreMakeValSetChangeTxFlags() { - kvstoreCmd.PersistentFlags().Int64VarP(&flagStakingPower, "staking_power", "p", int64(10), - "stakin power for ValSetChangeTx") + kvstoreCmd.PersistentFlags().Int64VarP(&flagVotingPower123456, "voting_power", "p", int64(10), + "voting power for ValSetChangeTx") } func addCommands() { @@ -731,7 +731,7 @@ func cmdPersistKVStoreMakeValSetChangeTx(cmd *cobra.Command, args []string) erro if err != nil { panic(err) } - pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, flagStakingPower) + pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, flagVotingPower123456) { fmt.Printf("DeliverTxSync: data=%s, tx=%s\n", pubStr, tx) res, err := client.DeliverTxSync(types.RequestDeliverTx{Tx: []byte(tx)}) diff --git a/abci/example/kvstore/tool/make_val_set_change_tx.go b/abci/example/kvstore/tool/make_val_set_change_tx.go index 8f9f554c6..0041ff356 100644 --- a/abci/example/kvstore/tool/make_val_set_change_tx.go +++ b/abci/example/kvstore/tool/make_val_set_change_tx.go @@ -21,7 +21,7 @@ func main() { c.SetRoot(filepath.Join(userHome, config.DefaultOstraconDir)) keyFilePath := c.PrivValidatorKeyFile() var flagKeyFilePath = flag.String("priv-key", keyFilePath, "priv val key file path") - var flagStakingPower = flag.Int64("staking", 10, "staking power for priv valedator") + var flagVotingPower = flag.Int64("voting", 10, "voting power for priv validator") flag.Parse() keyFile, err := kvstore.LoadPrivValidatorKeyFile(*flagKeyFilePath) if err != nil { @@ -31,7 +31,7 @@ func main() { if err != nil { panic(err) } - pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, *flagStakingPower) + pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, *flagVotingPower) { fmt.Println("\n# Send tx of ValSetChangeTx for persist_kvstore") fmt.Println("# See: persist_kvstore.go#DeliveredTx") diff --git a/abci/example/kvstore/tool/make_val_set_change_tx.sh b/abci/example/kvstore/tool/make_val_set_change_tx.sh index 565e7697c..bec840785 100644 --- a/abci/example/kvstore/tool/make_val_set_change_tx.sh +++ b/abci/example/kvstore/tool/make_val_set_change_tx.sh @@ -3,14 +3,17 @@ IFS_BACK=$IFS IFS=$'\r\n' -cd `dirname $0` +# shellcheck disable=SC2046 +# shellcheck disable=SC2006 +cd `dirname "$0"` || exit # updator validator with default parameter -commands=`go run make_val_set_change_tx.go --staking=10 --priv-key=${HOME}/.ostracon/config/priv_validator_key.json` +commands=`go run make_val_set_change_tx.go --voting=10 --priv-key=${HOME}/.ostracon/config/priv_validator_key.json` # remove validator tx -commands=`go run make_val_set_change_tx.go --staking=0` +commands=`go run make_val_set_change_tx.go --voting=0` # update validator tx commands=`go run make_val_set_change_tx.go` +# shellcheck disable=SC2068 for command in ${commands[@]}; do if [[ "$command" =~ \# ]]; then echo $command diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 737117f2d..f45aaee0f 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -3061,7 +3061,7 @@ type Validator struct { // PubKey pub_key = 2 [(gogoproto.nullable)=false]; Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` // *** Ostracon Extended Fields *** - VotingPower int64 `protobuf:"varint,1000,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` + StakingPower int64 `protobuf:"varint,1000,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` } func (m *Validator) Reset() { *m = Validator{} } @@ -3111,9 +3111,9 @@ func (m *Validator) GetPower() int64 { return 0 } -func (m *Validator) GetVotingPower() int64 { +func (m *Validator) GetStakingPower() int64 { if m != nil { - return m.VotingPower + return m.StakingPower } return 0 } @@ -3440,188 +3440,188 @@ func init() { func init() { proto.RegisterFile("ostracon/abci/types.proto", fileDescriptor_addf585b2317eb36) } var fileDescriptor_addf585b2317eb36 = []byte{ - // 2886 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0xcb, 0x73, 0x23, 0xd5, - 0xd5, 0xd7, 0xfb, 0x71, 0x6c, 0xc9, 0xf2, 0x1d, 0x33, 0xa3, 0xe9, 0x01, 0x7b, 0xbe, 0x9e, 0x8f, - 0x00, 0x13, 0xb0, 0x61, 0x86, 0x40, 0x20, 0x81, 0x20, 0x69, 0x04, 0x72, 0xec, 0xb1, 0x3d, 0x6d, - 0x31, 0x14, 0xaf, 0x34, 0xad, 0xd6, 0xb5, 0xd4, 0x19, 0xa9, 0xbb, 0x51, 0x5f, 0x19, 0x3b, 0xbb, - 0x24, 0x95, 0xaa, 0x14, 0x2b, 0xaa, 0x52, 0x95, 0x1d, 0xff, 0x47, 0x16, 0xa9, 0xca, 0x32, 0x2c, - 0x59, 0x66, 0x45, 0x52, 0xb0, 0xc8, 0x63, 0x9f, 0x4a, 0x65, 0x93, 0xa4, 0xee, 0xa3, 0x9f, 0xee, - 0x6e, 0x69, 0x20, 0xbb, 0xec, 0xfa, 0x9c, 0x7b, 0xce, 0xe9, 0xfb, 0x38, 0xf7, 0x9c, 0xdf, 0x39, - 0xdd, 0x70, 0xd5, 0x72, 0xc8, 0x4c, 0xd3, 0x2d, 0x73, 0x47, 0x1b, 0xe8, 0xc6, 0x0e, 0x39, 0xb7, - 0xb1, 0xb3, 0x6d, 0xcf, 0x2c, 0x62, 0xa1, 0x9a, 0x3b, 0xb4, 0x4d, 0x87, 0xa4, 0x6b, 0x9e, 0xa4, - 0x3e, 0x3b, 0xb7, 0x89, 0xb5, 0x63, 0xcf, 0x2c, 0xeb, 0x84, 0xcb, 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 0x27, 0xc0, 0x17, 0xae, 0x13, 0x81, 0xb8, 0xcf, 0x09, 0x88, 0x5b, 0x48, 0x7d, 0x51, 0x08, - 0xe3, 0xb6, 0x42, 0x18, 0xb7, 0x98, 0xba, 0xbc, 0x04, 0x90, 0xdb, 0x0a, 0x81, 0xdc, 0x52, 0xaa, - 0x89, 0x04, 0x94, 0xfb, 0xbc, 0x8b, 0x72, 0xcb, 0xa9, 0xcb, 0x8d, 0xc0, 0xdc, 0x3b, 0x61, 0x98, - 0xcb, 0x41, 0xea, 0xff, 0x25, 0xe8, 0x26, 0xe2, 0xdc, 0xef, 0x05, 0x70, 0x6e, 0x35, 0x01, 0x68, - 0x72, 0x13, 0x31, 0x40, 0xb7, 0x15, 0x02, 0xba, 0x90, 0xba, 0xf6, 0x04, 0xa4, 0xfb, 0x6a, 0x10, - 0xe9, 0xae, 0x24, 0x40, 0x65, 0xe1, 0x22, 0x71, 0x50, 0xf7, 0x45, 0x0f, 0xea, 0xae, 0x26, 0xa0, - 0x74, 0x31, 0xfb, 0x28, 0xd6, 0xbd, 0x7b, 0x01, 0xeb, 0xd6, 0x12, 0x30, 0x19, 0x37, 0xb0, 0x00, - 0xec, 0xde, 0xbd, 0x00, 0x76, 0xeb, 0xa9, 0xe6, 0x16, 0xa0, 0xdd, 0x77, 0xe2, 0xd1, 0x6e, 0x12, - 0x22, 0x15, 0x53, 0x5c, 0x0e, 0xee, 0xbe, 0x9f, 0x00, 0x77, 0x1b, 0xcc, 0xf8, 0x53, 0x09, 0xc6, - 0x97, 0xc6, 0xbb, 0x4a, 0x32, 0xde, 0x7d, 0x3c, 0xcd, 0x3b, 0xd3, 0x00, 0xef, 0x7e, 0x12, 0xe0, - 0xbd, 0x91, 0xec, 0x2b, 0x4b, 0x20, 0xde, 0xa7, 0x28, 0xb8, 0x88, 0x04, 0x2f, 0x1a, 0xaa, 0xf1, - 0x6c, 0x66, 0xcd, 0x04, 0x98, 0xe4, 0x84, 0xfc, 0x24, 0x85, 0x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xef, 0x50, 0x2c, 0xfa, 0x69, 0x41, 0x5a, 0xd8, 0xf0, 0x45, 0xf7, 0x00, - 0x02, 0x85, 0xf3, 0xc2, 0xbf, 0x11, 0xa4, 0xc5, 0x8d, 0x5c, 0xb4, 0x07, 0x15, 0xaf, 0x44, 0x5a, - 0xf0, 0x77, 0x80, 0xb4, 0xa8, 0xa7, 0x8a, 0xde, 0x81, 0x5a, 0xb8, 0x3a, 0x58, 0xe6, 0x9b, 0xbf, - 0xb4, 0x54, 0xb3, 0x94, 0xda, 0x0e, 0x17, 0x0a, 0xcb, 0xfc, 0x01, 0x20, 0x2d, 0xd5, 0x39, 0x45, - 0x27, 0xb0, 0x7e, 0x11, 0xc6, 0x2f, 0xfb, 0x3b, 0x80, 0xb4, 0x74, 0x27, 0x15, 0x19, 0x80, 0x62, - 0xa0, 0xff, 0xd2, 0xff, 0x06, 0x48, 0xcb, 0xb7, 0x55, 0xd1, 0xfb, 0x50, 0x8f, 0xa0, 0xe9, 0xa5, - 0xfe, 0x13, 0x90, 0x96, 0xeb, 0xae, 0xa2, 0xb7, 0x60, 0x35, 0x04, 0xbf, 0x97, 0xf8, 0x67, 0x40, - 0x5a, 0xa6, 0xcd, 0xda, 0x7e, 0xe5, 0xb3, 0x2f, 0x37, 0xb3, 0x9f, 0x7f, 0xb9, 0x99, 0xfd, 0xd3, - 0x97, 0x9b, 0xd9, 0x4f, 0xbe, 0xda, 0xcc, 0x7c, 0xfe, 0xd5, 0x66, 0xe6, 0x0f, 0x5f, 0x6d, 0x66, - 0xde, 0xb9, 0x31, 0x32, 0xc8, 0x78, 0x3e, 0xd8, 0xd6, 0xad, 0xe9, 0xce, 0xc4, 0x30, 0xf1, 0x4e, - 0xcc, 0x2f, 0x5d, 0x83, 0x12, 0x4b, 0x8e, 0xb7, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x40, - 0x0e, 0xc5, 0xf0, 0x25, 0x00, 0x00, + // 2890 bytes of a gzipped FileDescriptorPro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0x04, 0xbf, 0x81, 0xd1, 0x7d, 0x72, 0x45, 0x15, 0x4f, 0x90, + 0x5e, 0x3c, 0xea, 0xcc, 0xcc, 0x0b, 0x72, 0x6c, 0xda, 0x65, 0xcd, 0xb6, 0xbb, 0x9a, 0x33, 0x92, + 0x3f, 0x84, 0x66, 0x52, 0xf8, 0x8f, 0x2c, 0xa2, 0xe0, 0x39, 0xdf, 0x65, 0x28, 0x1d, 0x5b, 0xd3, + 0x89, 0x46, 0x98, 0xb1, 0x9a, 0x22, 0x28, 0xea, 0x94, 0x3c, 0x15, 0xe4, 0x19, 0x9b, 0x13, 0xb2, + 0x0a, 0x57, 0x13, 0x93, 0x00, 0x55, 0x31, 0xcc, 0x01, 0xe6, 0xbb, 0x59, 0x53, 0x38, 0xe1, 0x1b, + 0xe2, 0x93, 0xe5, 0x04, 0x7d, 0xad, 0x83, 0x4d, 0xea, 0xb3, 0x79, 0x76, 0x43, 0x04, 0x25, 0xdf, + 0x85, 0x47, 0x62, 0x53, 0x41, 0xc0, 0xc9, 0xb3, 0x8b, 0x3b, 0xb9, 0xfc, 0x2c, 0x5c, 0x8a, 0x49, + 0x04, 0x89, 0x27, 0xfa, 0x97, 0x2a, 0x54, 0x14, 0xec, 0xd8, 0x34, 0x0a, 0xa1, 0xd7, 0xa1, 0x8a, + 0xcf, 0x74, 0xcc, 0x41, 0x60, 0x36, 0x01, 0x4a, 0x71, 0xd9, 0x8e, 0x2b, 0x47, 0xb1, 0x8c, 0xa7, + 0x84, 0x9e, 0x17, 0x00, 0x37, 0x09, 0xad, 0x0a, 0xe5, 0x20, 0xc2, 0x7d, 0xc1, 0x45, 0xb8, 0xf9, + 0x04, 0xf8, 0xc2, 0x75, 0x22, 0x10, 0xf7, 0x79, 0x01, 0x71, 0x0b, 0xa9, 0x2f, 0x0a, 0x61, 0xdc, + 0x56, 0x08, 0xe3, 0x16, 0x53, 0x97, 0x97, 0x00, 0x72, 0x5b, 0x21, 0x90, 0x5b, 0x4a, 0x35, 0x91, + 0x80, 0x72, 0x5f, 0x70, 0x51, 0x6e, 0x39, 0x75, 0xb9, 0x11, 0x98, 0x7b, 0x27, 0x0c, 0x73, 0x39, + 0x48, 0xfd, 0x56, 0x82, 0x6e, 0x22, 0xce, 0xfd, 0x7e, 0x00, 0xe7, 0x56, 0x13, 0x80, 0x26, 0x37, + 0x11, 0x03, 0x74, 0x5b, 0x21, 0xa0, 0x0b, 0xa9, 0x6b, 0x4f, 0x40, 0xba, 0xaf, 0x05, 0x91, 0xee, + 0x52, 0x02, 0x54, 0x16, 0x2e, 0x12, 0x07, 0x75, 0x5f, 0xf2, 0xa0, 0xee, 0x72, 0x02, 0x4a, 0x17, + 0xb3, 0x8f, 0x62, 0xdd, 0xbb, 0x17, 0xb0, 0x6e, 0x2d, 0x01, 0x93, 0x71, 0x03, 0x73, 0xc0, 0xee, + 0xdd, 0x0b, 0x60, 0xb7, 0x9e, 0x6a, 0x6e, 0x0e, 0xda, 0x7d, 0x37, 0x1e, 0xed, 0x26, 0x21, 0x52, + 0x31, 0xc5, 0xc5, 0xe0, 0xee, 0x07, 0x09, 0x70, 0xb7, 0xc1, 0x8c, 0x3f, 0x9d, 0x60, 0x7c, 0x61, + 0xbc, 0xab, 0x24, 0xe3, 0xdd, 0x27, 0xd2, 0xbc, 0x33, 0x0d, 0xf0, 0xee, 0x25, 0x01, 0xde, 0x1b, + 0xc9, 0xbe, 0xb2, 0x00, 0xe2, 0x7d, 0x9a, 0x82, 0x8b, 0x48, 0xf0, 0xa2, 0xa1, 0x1a, 0x4f, 0xa7, + 0xd6, 0x54, 0x80, 0x49, 0x4e, 0xc8, 0x4f, 0x51, 0xb8, 0xe3, 0x87, 0xaa, 0x14, 0x74, 0xcc, 0x12, + 0x62, 0x20, 0x40, 0xc9, 0xbf, 0xcd, 0xfa, 0xba, 0x0c, 0x25, 0x04, 0xa1, 0x52, 0x55, 0x40, 0xa5, + 0x00, 0x68, 0xce, 0x85, 0x41, 0xf3, 0x06, 0x2c, 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 0xf9, 0x3f, 0x40, 0x9a, 0xd7, 0x55, 0x45, 0xef, 0x42, 0x2d, 0x5c, 0x1f, + 0x2c, 0xf2, 0xd5, 0x5f, 0x5a, 0xa8, 0x5d, 0x4a, 0x6d, 0x87, 0x4b, 0x85, 0x45, 0xfe, 0x01, 0x90, + 0x16, 0xea, 0x9d, 0xa2, 0x63, 0x58, 0xbd, 0x08, 0xe4, 0x17, 0xfd, 0x21, 0x40, 0x5a, 0xb8, 0x97, + 0x8a, 0x0c, 0x40, 0x31, 0xe0, 0x7f, 0xe1, 0xbf, 0x03, 0xa4, 0xc5, 0x1b, 0xab, 0xe8, 0x03, 0xa8, + 0x47, 0xf0, 0xf4, 0x42, 0x7f, 0x0a, 0x48, 0x8b, 0xf5, 0x57, 0xd1, 0xdb, 0xb0, 0x1c, 0x02, 0xe0, + 0x0b, 0xfc, 0x35, 0x20, 0x2d, 0xd2, 0x68, 0xdd, 0x7e, 0xf5, 0xf3, 0xaf, 0xd6, 0xb3, 0x5f, 0x7c, + 0xb5, 0x9e, 0xfd, 0xf3, 0x57, 0xeb, 0xd9, 0x4f, 0x1f, 0xac, 0x67, 0xbe, 0x78, 0xb0, 0x9e, 0xf9, + 0xe3, 0x83, 0xf5, 0xcc, 0xbb, 0x37, 0x86, 0x06, 0x19, 0xcd, 0xfa, 0x9b, 0xba, 0x35, 0xd9, 0x1a, + 0x1b, 0x26, 0xde, 0x8a, 0xf9, 0xa9, 0xab, 0x5f, 0x62, 0xc9, 0xf1, 0xf6, 0x7f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x6e, 0x64, 0x33, 0xdc, 0xf2, 0x25, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -6861,8 +6861,8 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.VotingPower != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.VotingPower)) + if m.StakingPower != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.StakingPower)) i-- dAtA[i] = 0x3e i-- @@ -8303,8 +8303,8 @@ func (m *Validator) Size() (n int) { if m.Power != 0 { n += 1 + sovTypes(uint64(m.Power)) } - if m.VotingPower != 0 { - n += 2 + sovTypes(uint64(m.VotingPower)) + if m.StakingPower != 0 { + n += 2 + sovTypes(uint64(m.StakingPower)) } return n } @@ -14836,9 +14836,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } case 1000: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) } - m.VotingPower = 0 + m.StakingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -14848,7 +14848,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VotingPower |= int64(b&0x7F) << shift + m.StakingPower |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/blockchain/v0/reactor_test.go b/blockchain/v0/reactor_test.go index 733ea119b..e0aff57fb 100644 --- a/blockchain/v0/reactor_test.go +++ b/blockchain/v0/reactor_test.go @@ -33,7 +33,7 @@ func randGenesisDoc(numValidators int, randPower bool, minPower int64) (*types.G val, privVal := types.RandValidator(randPower, minPower) validators[i] = types.GenesisValidator{ PubKey: val.PubKey, - Power: val.StakingPower, + Power: val.VotingPower, } privValidators[i] = privVal } diff --git a/blockchain/v1/reactor_test.go b/blockchain/v1/reactor_test.go index 696af5dc9..6f69d2c23 100644 --- a/blockchain/v1/reactor_test.go +++ b/blockchain/v1/reactor_test.go @@ -35,7 +35,7 @@ func randGenesisDoc(numValidators int, randPower bool, minPower int64) (*types.G val, privVal := types.RandValidator(randPower, minPower) validators[i] = types.GenesisValidator{ PubKey: val.PubKey, - Power: val.StakingPower, + Power: val.VotingPower, } privValidators[i] = privVal } diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index 0e69b6167..e48e7cd64 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -475,7 +475,7 @@ func randGenesisDoc(chainID string, numValidators int, randPower bool, minPower val, privVal := types.RandValidator(randPower, minPower) validators[i] = types.GenesisValidator{ PubKey: val.PubKey, - Power: val.StakingPower, + Power: val.VotingPower, } privValidators[i] = privVal } diff --git a/consensus/common_test.go b/consensus/common_test.go index 19c82dbca..e4f9977e6 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -984,7 +984,7 @@ func genesisDoc( val, privVal = createTestValidator(minPower, types.PrivKeyComposite) validators[i] = types.GenesisValidator{ PubKey: val.PubKey, - Power: val.StakingPower, + Power: val.VotingPower, } privValidators[i] = privVal } @@ -992,7 +992,7 @@ func genesisDoc( val, privVal = createTestValidator(minPower, types.PrivKeyEd25519) validators[i] = types.GenesisValidator{ PubKey: val.PubKey, - Power: val.StakingPower, + Power: val.VotingPower, } privValidators[i] = privVal } @@ -1018,7 +1018,7 @@ func randGenesisDoc( val, privVal := types.RandValidator(randPower, minPower) validators[i] = types.GenesisValidator{ PubKey: val.PubKey, - Power: val.StakingPower, + Power: val.VotingPower, } privValidators[i] = privVal } @@ -1123,13 +1123,13 @@ func signDataIsEqual(v1 *types.Vote, v2 *tmproto.Vote) bool { // Validator func createTestValidator(minPower int64, keytype types.PrivKeyType) (*types.Validator, types.PrivValidator) { privVal := types.NewMockPV(keytype) - stakingPower := minPower - stakingPower += 100 + votingPower := minPower + votingPower += 100 pubKey, err := privVal.GetPubKey() if err != nil { panic(fmt.Errorf("could not retrieve pubkey %w", err)) } - val := types.NewValidator(pubKey, stakingPower) + val := types.NewValidator(pubKey, votingPower) return val, privVal } diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index a11f22713..cde927b65 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -353,48 +353,48 @@ func TestReactorStakingPowerChange(t *testing.T) { val1PubKeyABCI, err := cryptoenc.PubKeyToProto(val1PubKey) require.NoError(t, err) updateValidatorTx := kvstore.MakeValSetChangeTx(val1PubKeyABCI, 25) - previousTotalVotingPower := css[0].GetRoundState().LastVoters.TotalVotingPower() + previousTotalVotingPower := css[0].GetRoundState().LastVoters.TotalStakingPower() waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlockWithTx(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) - if css[0].GetRoundState().LastVoters.TotalVotingPower() == previousTotalVotingPower { + if css[0].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { t.Fatalf( - "expected staking power to change (before: %d, after: %d)", + "expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, - css[0].GetRoundState().LastVoters.TotalVotingPower()) + css[0].GetRoundState().LastVoters.TotalStakingPower()) } updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 2) - previousTotalVotingPower = css[0].GetRoundState().LastVoters.TotalVotingPower() + previousTotalVotingPower = css[0].GetRoundState().LastVoters.TotalStakingPower() waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlockWithTx(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) - if css[0].GetRoundState().LastVoters.TotalVotingPower() == previousTotalVotingPower { + if css[0].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { t.Fatalf( "expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, - css[0].GetRoundState().LastVoters.TotalVotingPower()) + css[0].GetRoundState().LastVoters.TotalStakingPower()) } updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 26) - previousTotalVotingPower = css[0].GetRoundState().LastVoters.TotalVotingPower() + previousTotalVotingPower = css[0].GetRoundState().LastVoters.TotalStakingPower() waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlockWithTx(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) - if css[0].GetRoundState().LastVoters.TotalVotingPower() == previousTotalVotingPower { + if css[0].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { t.Fatalf( "expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, - css[0].GetRoundState().LastVoters.TotalVotingPower()) + css[0].GetRoundState().LastVoters.TotalStakingPower()) } } @@ -464,18 +464,18 @@ func TestReactorValidatorSetChanges(t *testing.T) { updatePubKey1ABCI, err := cryptoenc.PubKeyToProto(updateValidatorPubKey1) require.NoError(t, err) updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25) - previousTotalVotingPower := css[nVals].GetRoundState().LastVoters.TotalVotingPower() + previousTotalVotingPower := css[nVals].GetRoundState().LastVoters.TotalStakingPower() waitForAndValidateBlock(t, nPeers, activeVals, blocksSubs, css, updateValidatorTx1) waitForAndValidateBlockWithTx(t, nPeers, activeVals, blocksSubs, css, updateValidatorTx1) waitForAndValidateBlock(t, nPeers, activeVals, blocksSubs, css) waitForBlockWithUpdatedValsAndValidateIt(t, nPeers, activeVals, blocksSubs, css) - if css[nVals].GetRoundState().LastVoters.TotalVotingPower() == previousTotalVotingPower { + if css[nVals].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { t.Errorf( - "expected staking power to change (before: %d, after: %d)", + "expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, - css[nVals].GetRoundState().LastVoters.TotalVotingPower()) + css[nVals].GetRoundState().LastVoters.TotalStakingPower()) } //--------------------------------------------------------------------------- diff --git a/consensus/state.go b/consensus/state.go index 16bba66b6..0843ec50e 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1786,9 +1786,9 @@ func (cs *State) pruneBlocks(retainHeight int64) (uint64, error) { func (cs *State) recordMetrics(height int64, block *types.Block) { cs.metrics.Validators.Set(float64(cs.Validators.Size())) - cs.metrics.ValidatorsPower.Set(float64(cs.Validators.TotalStakingPower())) + cs.metrics.ValidatorsPower.Set(float64(cs.Validators.TotalVotingPower())) cs.metrics.Voters.Set(float64(cs.Voters.Size())) - cs.metrics.VotersPower.Set(float64(cs.Voters.TotalVotingPower())) + cs.metrics.VotersPower.Set(float64(cs.Voters.TotalStakingPower())) var ( missingVoters int @@ -1834,14 +1834,14 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { commitSig := block.LastCommit.Signatures[i] if commitSig.Absent() { missingVoters++ - missingVotersPower += val.VotingPower + missingVotersPower += val.StakingPower } if bytes.Equal(val.Address, address) { label := []string{ "validator_address", val.Address.String(), } - cs.metrics.VoterPower.With(label...).Set(float64(val.VotingPower)) + cs.metrics.VoterPower.With(label...).Set(float64(val.StakingPower)) selectedAsVoter = true if commitSig.ForBlock() { cs.metrics.VoterLastSignedHeight.With(label...).Set(float64(height)) @@ -1877,7 +1877,7 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { if dve, ok := ev.(*types.DuplicateVoteEvidence); ok { if _, val := cs.Voters.GetByAddress(dve.VoteA.ValidatorAddress); val != nil { byzantineVotersCount++ - byzantineVotersPower += val.VotingPower + byzantineVotersPower += val.StakingPower } } } @@ -2427,8 +2427,8 @@ func (cs *State) calculatePrevoteMessageDelayMetrics() { var votingPowerSeen int64 for _, v := range pl { _, voter := cs.Voters.GetByAddress(v.ValidatorAddress) - votingPowerSeen += voter.VotingPower - if votingPowerSeen >= cs.Voters.TotalVotingPower()*2/3+1 { + votingPowerSeen += voter.StakingPower + if votingPowerSeen >= cs.Voters.TotalStakingPower()*2/3+1 { cs.metrics.QuorumPrevoteMessageDelay.Set(v.Timestamp.Sub(cs.Proposal.Timestamp).Seconds()) break } diff --git a/consensus/state_test.go b/consensus/state_test.go index 611b1e626..e511ff9ab 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -2110,13 +2110,13 @@ func makeVssMap(vss []*validatorStub) map[string]*validatorStub { } func votersPrivVals(voterSet *types.VoterSet, vssMap map[string]*validatorStub) []*validatorStub { - totalVotingPower := voterSet.TotalVotingPower() - votingPower := int64(0) + totalStakingPower := voterSet.TotalStakingPower() + stakingPower := int64(0) voters := 0 for i, v := range voterSet.Voters { vssMap[v.PubKey.Address().String()].Index = int32(i) // NOTE: re-indexing for new voters - if votingPower < totalVotingPower*2/3+1 { - votingPower += v.VotingPower + if stakingPower < totalStakingPower*2/3+1 { + stakingPower += v.StakingPower voters++ } } @@ -2233,7 +2233,7 @@ func ensureVotingPowerOfVoteSet(t *testing.T, voteSet *types.VoteSet, votingPowe func TestStateBadVoterWithSelectedVoter(t *testing.T) { // if validators are 9, then selected voters are 4+ // if one of 4+ voters does not vote, the consensus state does not progress to next step - // making him having 1/3 + 1 voting power of total + // making him having 1/3 + 1 staking power of total cs, vss := randStateWithVoterParams(9, &types.VoterParams{ VoterElectionThreshold: 5, MaxTolerableByzantinePercentage: 20}) @@ -2255,9 +2255,9 @@ func TestStateBadVoterWithSelectedVoter(t *testing.T) { } } - // make the invalid voter having voting power of 1/3+1 of total - cs.Voters.Voters[nonMyIndex].VotingPower = - (cs.Voters.TotalVotingPower()-cs.Voters.Voters[nonMyIndex].VotingPower)/2 + 1 + // make the invalid voter having staking power of 1/3+1 of total + cs.Voters.Voters[nonMyIndex].StakingPower = + (cs.Voters.TotalStakingPower()-cs.Voters.Voters[nonMyIndex].StakingPower)/2 + 1 voters := cs.Voters.Copy() @@ -2265,8 +2265,8 @@ func TestStateBadVoterWithSelectedVoter(t *testing.T) { voters.Voters[nonMyIndex] = &types.Validator{ PubKey: notVoter.PubKey, Address: notVoter.Address, - StakingPower: cs.Voters.Voters[nonMyIndex].StakingPower, VotingPower: cs.Voters.Voters[nonMyIndex].VotingPower, + StakingPower: cs.Voters.Voters[nonMyIndex].StakingPower, } vss[0].Height = 1 // this is needed because of `incrementHeight(vss[1:]...)` of randStateWithVoterParams() @@ -2298,17 +2298,17 @@ func TestStateBadVoterWithSelectedVoter(t *testing.T) { signAddVotes(cs, tmproto.PrevoteType, propBlock.Hash(), propBlock.MakePartSet(types.BlockPartSizeBytes).Header(), voterPrivVals...) - sumVotingPower := int64(0) + sumStakingPower := int64(0) for i := range voterPrivVals { // one failed if i == nonMyIndex { continue } ensurePrevote(voteCh, height, round) // wait for prevote - sumVotingPower += voters.Voters[i].VotingPower + sumStakingPower += voters.Voters[i].StakingPower } // ensure we didn't get a vote for Voters[nonMyIndex] - ensureVotingPowerOfVoteSet(t, cs.Votes.Prevotes(round), sumVotingPower) + ensureVotingPowerOfVoteSet(t, cs.Votes.Prevotes(round), sumStakingPower) assert.False(t, cs.Votes.Prevotes(round).HasTwoThirdsMajority()) // add remain vote diff --git a/evidence/pool_test.go b/evidence/pool_test.go index 826f5c6da..8f696a640 100644 --- a/evidence/pool_test.go +++ b/evidence/pool_test.go @@ -412,7 +412,7 @@ func initializeStateFromValidatorSet(valSet *types.ValidatorSet, height int64) s func initializeValidatorState(privVal types.PrivValidator, height int64) sm.Store { pubKey, _ := privVal.GetPubKey() - validator := &types.Validator{Address: pubKey.Address(), StakingPower: 10, PubKey: pubKey} + validator := &types.Validator{Address: pubKey.Address(), VotingPower: 10, PubKey: pubKey} // create validator set and state valSet := &types.ValidatorSet{ diff --git a/evidence/reactor_test.go b/evidence/reactor_test.go index 03b71b69e..c67514c35 100644 --- a/evidence/reactor_test.go +++ b/evidence/reactor_test.go @@ -372,8 +372,8 @@ func exampleVote(t byte) *types.Vote { func TestEvidenceVectors(t *testing.T) { val := &types.Validator{ - Address: crypto.AddressHash([]byte("validator_address")), - StakingPower: 10, + Address: crypto.AddressHash([]byte("validator_address")), + VotingPower: 10, } voterSet := types.WrapValidatorsToVoterSet([]*types.Validator{val}) diff --git a/evidence/verify.go b/evidence/verify.go index 6d36a0267..78bf4d125 100644 --- a/evidence/verify.go +++ b/evidence/verify.go @@ -141,7 +141,7 @@ func VerifyLightClientAttack( } // Assert the correct amount of voting power of the validator set - if evTotal, votersTotal := e.TotalVotingPower, commonVoters.TotalVotingPower(); evTotal != votersTotal { + if evTotal, votersTotal := e.TotalVotingPower, commonVoters.TotalStakingPower(); evTotal != votersTotal { return fmt.Errorf("total voting power from the evidence and our voter set does not match (%d != %d)", evTotal, votersTotal) } @@ -207,13 +207,13 @@ func VerifyDuplicateVote(e *types.DuplicateVoteEvidence, chainID string, voterSe } // validator voting power and total voting power must match - if val.StakingPower != e.ValidatorPower { + if val.VotingPower != e.ValidatorPower { return fmt.Errorf("validator power from evidence and our voter set does not match (%d != %d)", - e.ValidatorPower, val.StakingPower) + e.ValidatorPower, val.VotingPower) } - if voterSet.TotalVotingPower() != e.TotalVotingPower { + if voterSet.TotalStakingPower() != e.TotalVotingPower { return fmt.Errorf("total voting power from the evidence and our voter set does not match (%d != %d)", - e.TotalVotingPower, voterSet.TotalVotingPower()) + e.TotalVotingPower, voterSet.TotalStakingPower()) } va := e.VoteA.ToProto() @@ -263,17 +263,17 @@ func validateABCIEvidence( ) } - if ev.ByzantineValidators[idx].StakingPower != val.StakingPower { + if ev.ByzantineValidators[idx].VotingPower != val.VotingPower { return fmt.Errorf( "evidence contained unexpected byzantine validator staking power; expected %d, got %d", - val.StakingPower, ev.ByzantineValidators[idx].StakingPower, + val.VotingPower, ev.ByzantineValidators[idx].VotingPower, ) } - if ev.ByzantineValidators[idx].VotingPower != val.VotingPower { + if ev.ByzantineValidators[idx].StakingPower != val.StakingPower { return fmt.Errorf( "evidence contained unexpected byzantine validator voting power; expected %d, got %d", - val.VotingPower, ev.ByzantineValidators[idx].VotingPower, + val.StakingPower, ev.ByzantineValidators[idx].StakingPower, ) } } diff --git a/evidence/verify_test.go b/evidence/verify_test.go index f7dcf2e0d..33cbced69 100644 --- a/evidence/verify_test.go +++ b/evidence/verify_test.go @@ -132,7 +132,7 @@ func TestVerifyLightClientAttack_validateABCIEvidence(t *testing.T) { // illegal byzantine validator staking power phantomVoterSet = types.ToVoterAll(ev.ConflictingBlock.VoterSet.Voters) - phantomVoterSet.Voters[0].StakingPower = votingPower + 1 + phantomVoterSet.Voters[0].VotingPower = votingPower + 1 ev.ByzantineValidators = phantomVoterSet.Voters err = evidence.VerifyLightClientAttack(ev, common.SignedHeader, trusted.SignedHeader, common.ValidatorSet, @@ -143,7 +143,7 @@ func TestVerifyLightClientAttack_validateABCIEvidence(t *testing.T) { // illegal byzantine validator voting power phantomVoterSet = types.ToVoterAll(ev.ConflictingBlock.VoterSet.Voters) - phantomVoterSet.Voters[0].VotingPower = votingPower + 1 + phantomVoterSet.Voters[0].StakingPower = votingPower + 1 ev.ByzantineValidators = phantomVoterSet.Voters err = evidence.VerifyLightClientAttack(ev, common.SignedHeader, trusted.SignedHeader, common.ValidatorSet, @@ -222,7 +222,7 @@ func TestVerify_LunaticAttackAgainstState(t *testing.T) { pool, err = evidence.NewPool(dbm.NewMemDB(), stateStore, blockStore) require.NoError(t, err) assert.Error(t, pool.AddEvidence(ev)) - ev.TotalVotingPower = common.VoterSet.TotalVotingPower() + ev.TotalVotingPower = common.VoterSet.TotalStakingPower() } func TestVerify_ForwardLunaticAttack(t *testing.T) { @@ -643,7 +643,7 @@ func makeLunaticEvidence( VoterSet: conflictingVoters, }, CommonHeight: commonHeight, - TotalVotingPower: commonVoterSet.TotalVotingPower(), + TotalVotingPower: commonVoterSet.TotalStakingPower(), ByzantineValidators: byzantineValidators, Timestamp: commonTime, } diff --git a/light/detector.go b/light/detector.go index 49226bdd4..0a9a58b84 100644 --- a/light/detector.go +++ b/light/detector.go @@ -411,11 +411,11 @@ func newLightClientAttackEvidence(conflicted, trusted, common *types.LightBlock) if ev.ConflictingHeaderIsInvalid(trusted.Header) { ev.CommonHeight = common.Height ev.Timestamp = common.Time - ev.TotalVotingPower = common.VoterSet.TotalVotingPower() + ev.TotalVotingPower = common.VoterSet.TotalStakingPower() } else { ev.CommonHeight = trusted.Height ev.Timestamp = trusted.Time - ev.TotalVotingPower = trusted.VoterSet.TotalVotingPower() + ev.TotalVotingPower = trusted.VoterSet.TotalStakingPower() } ev.ByzantineValidators = ev.GetByzantineValidators(common.VoterSet, trusted.SignedHeader) return ev diff --git a/light/errors.go b/light/errors.go index 6829bc294..a6f08f2ef 100644 --- a/light/errors.go +++ b/light/errors.go @@ -23,7 +23,7 @@ func (e ErrOldHeaderExpired) Error() string { // ErrNewValSetCantBeTrusted means the new validator set cannot be trusted // because < 1/3rd (+trustLevel+) of the old validator set has signed. type ErrNewValSetCantBeTrusted struct { - Reason types.ErrNotEnoughVotingPowerSigned + Reason types.ErrNotEnoughStakingPowerSigned } func (e ErrNewValSetCantBeTrusted) Error() string { diff --git a/light/helpers_test.go b/light/helpers_test.go index 67d20371a..7b2cf7d4f 100644 --- a/light/helpers_test.go +++ b/light/helpers_test.go @@ -64,7 +64,7 @@ func (pkz privKeys) Extend(n int) privKeys { // return append(pkz, extra...) // } -// ToValidators produces a voterset from the set of keys. +// ToValidators produces a voter set from the set of keys. // The first key has weight `init` and it increases by `inc` every step // so we can have all the same weight, or a simple linear distribution // (should be enough for testing). @@ -121,7 +121,7 @@ func (pkz privKeys) signHeaderByRate(header *types.Header, voterSet *types.Voter } // Fill in the votes we want. - until := int64(float64(voterSet.TotalVotingPower()) * rate) + until := int64(float64(voterSet.TotalStakingPower()) * rate) sum := int64(0) for i := 0; i < len(pkz); i++ { _, voter := voterSet.GetByAddress(pkz[i].PubKey().Address()) @@ -131,7 +131,7 @@ func (pkz privKeys) signHeaderByRate(header *types.Header, voterSet *types.Voter vote := makeVote(header, voterSet, pkz[i], blockID) commitSigs[vote.ValidatorIndex] = vote.CommitSig() - sum += voter.VotingPower + sum += voter.StakingPower if sum > until { break } diff --git a/light/verifier.go b/light/verifier.go index 07c8bc5f0..094769e03 100644 --- a/light/verifier.go +++ b/light/verifier.go @@ -59,7 +59,7 @@ func VerifyNonAdjacent( err := trustedVoters.VerifyCommitLightTrusting(trustedHeader.ChainID, untrustedHeader.Commit, trustLevel) if err != nil { switch e := err.(type) { - case types.ErrNotEnoughVotingPowerSigned: + case types.ErrNotEnoughStakingPowerSigned: return ErrNewValSetCantBeTrusted{e} default: return e diff --git a/light/verifier_test.go b/light/verifier_test.go index 9e91a3eda..77db9b6b8 100644 --- a/light/verifier_test.go +++ b/light/verifier_test.go @@ -138,7 +138,7 @@ func TestVerifyAdjacentHeaders(t *testing.T) { vals, 3 * time.Hour, bTime.Add(2 * time.Hour), - light.ErrInvalidHeader{Reason: types.ErrNotEnoughVotingPowerSigned{Got: 50, Needed: 93}}, + light.ErrInvalidHeader{Reason: types.ErrNotEnoughStakingPowerSigned{Got: 50, Needed: 93}}, "", }, // voters does not match with what we have -> error @@ -327,7 +327,7 @@ func TestVerifyAdjacentHeadersWithVoterSampling(t *testing.T) { 3 * time.Hour, bTime.Add(2 * time.Hour), nil, - "invalid commit -- insufficient voting power", + "invalid commit -- insufficient staking power", }, // vals does not match with what we have -> error 8: { @@ -457,7 +457,7 @@ func TestVerifyNonAdjacentHeaders(t *testing.T) { vals, 3 * time.Hour, bTime.Add(2 * time.Hour), - light.ErrInvalidHeader{types.ErrNotEnoughVotingPowerSigned{Got: 50, Needed: 93}}, + light.ErrInvalidHeader{types.ErrNotEnoughStakingPowerSigned{Got: 50, Needed: 93}}, "", }, // 3/3 new voters signed, 2/3 old voters present -> no error @@ -493,7 +493,7 @@ func TestVerifyNonAdjacentHeaders(t *testing.T) { lessThanOneThirdVals, 3 * time.Hour, bTime.Add(2 * time.Hour), - light.ErrNewValSetCantBeTrusted{types.ErrNotEnoughVotingPowerSigned{Got: 20, Needed: 46}}, + light.ErrNewValSetCantBeTrusted{types.ErrNotEnoughStakingPowerSigned{Got: 20, Needed: 46}}, "", }, } diff --git a/proto/ostracon/abci/types.proto b/proto/ostracon/abci/types.proto index 631a59d58..bb8ff51dd 100644 --- a/proto/ostracon/abci/types.proto +++ b/proto/ostracon/abci/types.proto @@ -356,10 +356,10 @@ message TxResult { message Validator { bytes address = 1; // The first 20 bytes of SHA256(public key) // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; // The staking power + int64 power = 3; // The voting power // *** Ostracon Extended Fields *** - int64 voting_power = 1000; // The voting power + int64 staking_power = 1000; // The staking power } // ValidatorUpdate diff --git a/proto/ostracon/types/evidence.pb.go b/proto/ostracon/types/evidence.pb.go index d01544a41..9ec2e6e54 100644 --- a/proto/ostracon/types/evidence.pb.go +++ b/proto/ostracon/types/evidence.pb.go @@ -120,7 +120,7 @@ type DuplicateVoteEvidence struct { ValidatorPower int64 `protobuf:"varint,4,opt,name=validator_power,json=validatorPower,proto3" json:"validator_power,omitempty"` Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` // *** Ostracon Extended Fields *** - VotingPower int64 `protobuf:"varint,1000,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` + StakingPower int64 `protobuf:"varint,1000,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` } func (m *DuplicateVoteEvidence) Reset() { *m = DuplicateVoteEvidence{} } @@ -191,9 +191,9 @@ func (m *DuplicateVoteEvidence) GetTimestamp() time.Time { return time.Time{} } -func (m *DuplicateVoteEvidence) GetVotingPower() int64 { +func (m *DuplicateVoteEvidence) GetStakingPower() int64 { if m != nil { - return m.VotingPower + return m.StakingPower } return 0 } @@ -329,42 +329,42 @@ func init() { func init() { proto.RegisterFile("ostracon/types/evidence.proto", fileDescriptor_97062afbc223b6b9) } var fileDescriptor_97062afbc223b6b9 = []byte{ - // 548 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0x38, 0xe9, 0x97, 0x6f, 0x13, 0x4a, 0x59, 0x52, 0x91, 0x44, 0xe0, 0x44, 0x41, - 0x88, 0x20, 0xc0, 0x96, 0x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 0x11, 0xf8, 0x18, 0xdc, 0xc1, 0x3c, 0x8a, 0x78, 0xec, 0x8f, 0x89, 0xe4, 0xd4, 0x64, 0x4d, 0xaf, - 0x91, 0x06, 0x4f, 0x55, 0x0c, 0x0e, 0x41, 0x33, 0xb8, 0xfc, 0x82, 0x62, 0x41, 0x63, 0xe2, 0xeb, - 0x79, 0x24, 0x2d, 0xb3, 0x67, 0x0e, 0xea, 0x47, 0xed, 0x3f, 0xb6, 0x90, 0x13, 0xde, 0x7d, 0x9d, - 0xa6, 0x63, 0xc9, 0x8e, 0xc5, 0x54, 0x76, 0x2c, 0xe6, 0x1f, 0xcc, 0xbb, 0xff, 0x1e, 0x34, 0xf2, - 0xc9, 0x0d, 0x69, 0x22, 0xe0, 0x6b, 0x50, 0x5b, 0x7b, 0xab, 0x64, 0x0f, 0xad, 0x62, 0x0f, 0xfa, - 0x06, 0x57, 0xe4, 0x81, 0x9e, 0xe6, 0xdd, 0x93, 0xeb, 0x85, 0x65, 0xdc, 0x2c, 0x2c, 0xe3, 0x76, - 0x61, 0x19, 0x57, 0x4b, 0xab, 0x74, 0xb3, 0xb4, 0x4a, 0xdf, 0x97, 0x56, 0xe9, 0xd3, 0xcb, 0x90, - 0x8a, 0xf1, 0x2c, 0xb0, 0x31, 0x8f, 0x1c, 0x46, 0x63, 0xe2, 0xe8, 0xf7, 0x3e, 0xfd, 0x9e, 0x6c, - 0x7e, 0x06, 0x82, 0x3d, 0x15, 0x7d, 0xf5, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x26, 0xaa, 0x27, 0x0c, - 0xa1, 0x04, 0x00, 0x00, + // 551 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x9b, 0xa6, 0xdd, 0xaf, 0x3f, 0xaf, 0x1b, 0xc3, 0x74, 0xa2, 0xad, 0x20, 0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, 0xe7, 0x4a, 0xc2, 0x3b, + 0x58, 0x4b, 0x52, 0x11, 0xf8, 0x08, 0xec, 0x61, 0x1e, 0x45, 0x3c, 0xf6, 0x47, 0x44, 0x72, 0x6a, + 0xb6, 0xa6, 0x57, 0x4f, 0x83, 0xa7, 0x2a, 0x06, 0x07, 0xa0, 0x11, 0x5c, 0x7c, 0x41, 0xb1, 0xa0, + 0x31, 0xf1, 0xf5, 0x44, 0x92, 0xa6, 0xd9, 0x35, 0xfb, 0xbb, 0x47, 0xad, 0x3f, 0xf6, 0x90, 0x13, + 0xde, 0x3d, 0x9d, 0xa6, 0x63, 0xc9, 0x96, 0xd5, 0x54, 0xb6, 0xac, 0xe6, 0x1f, 0x4c, 0xbc, 0xf7, + 0x1e, 0xd4, 0xf3, 0xc9, 0x0d, 0x68, 0x22, 0xe0, 0x6b, 0x50, 0x5b, 0xfb, 0xae, 0x64, 0x0f, 0xcd, + 0x62, 0x0f, 0xfa, 0x0c, 0x57, 0xe4, 0x0b, 0x3d, 0xcd, 0xbb, 0x27, 0x57, 0x0b, 0xcb, 0xb8, 0x5e, + 0x58, 0xc6, 0xcd, 0xc2, 0x32, 0x2e, 0x97, 0x56, 0xe9, 0x7a, 0x69, 0x95, 0xbe, 0x2f, 0xad, 0xd2, + 0xa7, 0x97, 0x21, 0x15, 0xa3, 0x59, 0x60, 0x63, 0x1e, 0x39, 0x8c, 0xc6, 0xc4, 0xd1, 0x5f, 0x7e, + 0x7a, 0xa3, 0xdc, 0xbe, 0x08, 0x82, 0x1d, 0x15, 0x7d, 0xf5, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xd8, + 0xea, 0x65, 0xfe, 0xa3, 0x04, 0x00, 0x00, } func (m *Evidence) Marshal() (dAtA []byte, err error) { @@ -461,8 +461,8 @@ func (m *DuplicateVoteEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.VotingPower != 0 { - i = encodeVarintEvidence(dAtA, i, uint64(m.VotingPower)) + if m.StakingPower != 0 { + i = encodeVarintEvidence(dAtA, i, uint64(m.StakingPower)) i-- dAtA[i] = 0x3e i-- @@ -686,8 +686,8 @@ func (m *DuplicateVoteEvidence) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovEvidence(uint64(l)) - if m.VotingPower != 0 { - n += 2 + sovEvidence(uint64(m.VotingPower)) + if m.StakingPower != 0 { + n += 2 + sovEvidence(uint64(m.StakingPower)) } return n } @@ -1034,9 +1034,9 @@ func (m *DuplicateVoteEvidence) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 1000: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) } - m.VotingPower = 0 + m.StakingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvidence @@ -1046,7 +1046,7 @@ func (m *DuplicateVoteEvidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VotingPower |= int64(b&0x7F) << shift + m.StakingPower |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/ostracon/types/evidence.proto b/proto/ostracon/types/evidence.proto index 54167efec..f7bf30d71 100644 --- a/proto/ostracon/types/evidence.proto +++ b/proto/ostracon/types/evidence.proto @@ -24,7 +24,7 @@ message DuplicateVoteEvidence { google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // *** Ostracon Extended Fields *** - int64 voting_power = 1000; + int64 staking_power = 1000; } // LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. diff --git a/proto/ostracon/types/validator.pb.go b/proto/ostracon/types/validator.pb.go index 0d29601f1..a8c12ff01 100644 --- a/proto/ostracon/types/validator.pb.go +++ b/proto/ostracon/types/validator.pb.go @@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ValidatorSet struct { Validators []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` // Validator proposer = 2; // This field has been removed in Ostracon. - TotalStakingPower int64 `protobuf:"varint,3,opt,name=total_staking_power,json=totalStakingPower,proto3" json:"total_staking_power,omitempty"` + TotalVotingPower int64 `protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` } func (m *ValidatorSet) Reset() { *m = ValidatorSet{} } @@ -70,9 +70,9 @@ func (m *ValidatorSet) GetValidators() []*Validator { return nil } -func (m *ValidatorSet) GetTotalStakingPower() int64 { +func (m *ValidatorSet) GetTotalVotingPower() int64 { if m != nil { - return m.TotalStakingPower + return m.TotalVotingPower } return 0 } @@ -80,10 +80,10 @@ func (m *ValidatorSet) GetTotalStakingPower() int64 { type Validator struct { Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` PubKey crypto.PublicKey `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` - StakingPower int64 `protobuf:"varint,3,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` + VotingPower int64 `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` ProposerPriority int64 `protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"` // *** Ostracon Extended Fields *** - VotingPower int64 `protobuf:"varint,1000,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` + StakingPower int64 `protobuf:"varint,1000,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` } func (m *Validator) Reset() { *m = Validator{} } @@ -133,9 +133,9 @@ func (m *Validator) GetPubKey() crypto.PublicKey { return crypto.PublicKey{} } -func (m *Validator) GetStakingPower() int64 { +func (m *Validator) GetVotingPower() int64 { if m != nil { - return m.StakingPower + return m.VotingPower } return 0 } @@ -147,16 +147,16 @@ func (m *Validator) GetProposerPriority() int64 { return 0 } -func (m *Validator) GetVotingPower() int64 { +func (m *Validator) GetStakingPower() int64 { if m != nil { - return m.VotingPower + return m.StakingPower } return 0 } type SimpleValidator struct { - PubKey *crypto.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` - StakingPower int64 `protobuf:"varint,2,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` + PubKey *crypto.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + VotingPower int64 `protobuf:"varint,2,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` } func (m *SimpleValidator) Reset() { *m = SimpleValidator{} } @@ -199,9 +199,9 @@ func (m *SimpleValidator) GetPubKey() *crypto.PublicKey { return nil } -func (m *SimpleValidator) GetStakingPower() int64 { +func (m *SimpleValidator) GetVotingPower() int64 { if m != nil { - return m.StakingPower + return m.VotingPower } return 0 } @@ -215,31 +215,30 @@ func init() { func init() { proto.RegisterFile("ostracon/types/validator.proto", fileDescriptor_eeeaf81579407bf3) } var fileDescriptor_eeeaf81579407bf3 = []byte{ - // 369 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xbf, 0x6e, 0xea, 0x30, - 0x18, 0xc5, 0x63, 0x40, 0xa0, 0x6b, 0x72, 0xff, 0xe0, 0xdb, 0x21, 0xcd, 0x90, 0x22, 0xba, 0x44, - 0xaa, 0x9a, 0x48, 0x30, 0xb1, 0xb2, 0x74, 0x60, 0x41, 0x41, 0xea, 0xd0, 0x25, 0x4a, 0x82, 0x95, - 0x5a, 0x09, 0xd8, 0xb2, 0x1d, 0x2a, 0xbf, 0x45, 0x1f, 0x8b, 0x91, 0xa9, 0xea, 0x54, 0x55, 0xb0, - 0xf4, 0x31, 0x2a, 0x92, 0x26, 0x01, 0xb5, 0x55, 0xb7, 0xe4, 0xfb, 0x1d, 0x9f, 0xef, 0x1c, 0xe9, - 0x83, 0x16, 0x15, 0x92, 0x07, 0x11, 0x5d, 0xb9, 0x52, 0x31, 0x2c, 0xdc, 0x75, 0x90, 0x92, 0x45, - 0x20, 0x29, 0x77, 0x18, 0xa7, 0x92, 0xa2, 0x3f, 0x25, 0x77, 0x72, 0x6e, 0x9e, 0xc5, 0x34, 0xa6, - 0x39, 0x72, 0x0f, 0x5f, 0x85, 0xca, 0x34, 0x2b, 0x97, 0x88, 0x2b, 0x26, 0xa9, 0x9b, 0x60, 0x25, - 0x0a, 0x36, 0x50, 0x50, 0xbf, 0x2d, 0x4d, 0xe7, 0x58, 0xa2, 0x31, 0x84, 0xd5, 0x12, 0x61, 0x80, - 0x7e, 0xd3, 0xee, 0x0e, 0xcf, 0x9d, 0xd3, 0x35, 0x4e, 0xf5, 0xc2, 0x3b, 0x12, 0x23, 0x07, 0xfe, - 0x97, 0x54, 0x06, 0xa9, 0x2f, 0x64, 0x90, 0x90, 0x55, 0xec, 0x33, 0xfa, 0x80, 0xb9, 0xd1, 0xec, - 0x03, 0xbb, 0xe9, 0xf5, 0x72, 0x34, 0x2f, 0xc8, 0xec, 0x00, 0x06, 0x4f, 0x00, 0xfe, 0xaa, 0x9c, - 0x90, 0x01, 0x3b, 0xc1, 0x62, 0xc1, 0xb1, 0x38, 0x6c, 0x05, 0xb6, 0xee, 0x95, 0xbf, 0x68, 0x0c, - 0x3b, 0x2c, 0x0b, 0xfd, 0x04, 0x2b, 0xa3, 0xd1, 0x07, 0x76, 0x77, 0x68, 0xd6, 0x79, 0x8a, 0x42, - 0xce, 0x2c, 0x0b, 0x53, 0x12, 0x4d, 0xb1, 0x9a, 0xb4, 0x36, 0x2f, 0x17, 0x9a, 0xd7, 0x66, 0x59, - 0x38, 0xc5, 0x0a, 0x5d, 0xc2, 0xdf, 0x5f, 0x85, 0xd1, 0xc5, 0x51, 0x0e, 0x74, 0x05, 0x7b, 0x8c, - 0x53, 0x46, 0x05, 0xe6, 0x3e, 0xe3, 0x84, 0x72, 0x22, 0x95, 0xd1, 0xca, 0x85, 0xff, 0x4a, 0x30, - 0xfb, 0x98, 0xa3, 0x01, 0xd4, 0xd7, 0x54, 0xd6, 0x86, 0x6f, 0x9d, 0x5c, 0xd8, 0x2d, 0x86, 0x45, - 0xb1, 0x04, 0xfe, 0x9d, 0x93, 0x25, 0x4b, 0x71, 0xdd, 0x6e, 0x54, 0x77, 0x00, 0x3f, 0x75, 0xf8, - 0x3e, 0x7d, 0xe3, 0x73, 0xfa, 0xc9, 0xcd, 0x66, 0x67, 0x81, 0xed, 0xce, 0x02, 0xaf, 0x3b, 0x0b, - 0x3c, 0xee, 0x2d, 0x6d, 0xbb, 0xb7, 0xb4, 0xe7, 0xbd, 0xa5, 0xdd, 0x5d, 0xc7, 0x44, 0xde, 0x67, - 0xa1, 0x13, 0xd1, 0xa5, 0x9b, 0x92, 0x15, 0x76, 0xab, 0x33, 0x28, 0x2e, 0xe4, 0xf4, 0xb6, 0xc2, - 0x76, 0x3e, 0x1d, 0xbd, 0x07, 0x00, 0x00, 0xff, 0xff, 0x14, 0xa3, 0xe5, 0xb9, 0x74, 0x02, 0x00, - 0x00, + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x6e, 0xb2, 0x40, + 0x14, 0xc5, 0x19, 0x35, 0x9a, 0x6f, 0xe4, 0xfb, 0x37, 0xe9, 0x82, 0xb2, 0xa0, 0xd6, 0x74, 0x41, + 0xd2, 0x16, 0x12, 0x5d, 0xb9, 0x75, 0xd3, 0x85, 0x1b, 0x83, 0x89, 0x8b, 0x6e, 0x08, 0xe0, 0x84, + 0x4e, 0x44, 0xef, 0x64, 0x18, 0x34, 0xbc, 0x45, 0x1f, 0xcb, 0xa5, 0xab, 0xa6, 0xab, 0xa6, 0xd1, + 0x4d, 0x1f, 0xa3, 0x11, 0x04, 0x6a, 0xda, 0xa6, 0x3b, 0x38, 0xbf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 0x10, 0x53, 0xe1, 0x72, 0xc1, 0x40, 0x30, 0x99, 0x6a, 0x8d, 0x3c, 0x72, 0x01, 0xc6, 0x47, + 0x9d, 0x5c, 0xe1, 0xdf, 0xb1, 0xf4, 0xe6, 0x95, 0xe1, 0x5b, 0x2b, 0x9b, 0x54, 0x8f, 0x6a, 0x5e, + 0x8c, 0xe1, 0xbf, 0x13, 0xb6, 0xe0, 0x11, 0xad, 0xda, 0xf5, 0xab, 0x0e, 0xe8, 0xa7, 0x0e, 0xdf, + 0xa6, 0xaf, 0x7d, 0x4a, 0x3f, 0xbc, 0xdb, 0xec, 0x0c, 0xb4, 0xdd, 0x19, 0xe8, 0x75, 0x67, 0xa0, + 0xc7, 0xbd, 0xa1, 0x6c, 0xf7, 0x86, 0xf2, 0xbc, 0x37, 0x94, 0xfb, 0xdb, 0x90, 0xc9, 0x87, 0xc4, + 0xb7, 0x02, 0x58, 0xd8, 0x11, 0x5b, 0x52, 0xbb, 0x3c, 0x81, 0xfc, 0x3a, 0x4e, 0xef, 0xca, 0x6f, + 0x66, 0x6a, 0xff, 0x3d, 0x00, 0x00, 0xff, 0xff, 0x68, 0x99, 0x53, 0xcf, 0x70, 0x02, 0x00, 0x00, } func (m *ValidatorSet) Marshal() (dAtA []byte, err error) { @@ -262,8 +261,8 @@ func (m *ValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TotalStakingPower != 0 { - i = encodeVarintValidator(dAtA, i, uint64(m.TotalStakingPower)) + if m.TotalVotingPower != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.TotalVotingPower)) i-- dAtA[i] = 0x18 } @@ -304,8 +303,8 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.VotingPower != 0 { - i = encodeVarintValidator(dAtA, i, uint64(m.VotingPower)) + if m.StakingPower != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.StakingPower)) i-- dAtA[i] = 0x3e i-- @@ -316,8 +315,8 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.StakingPower != 0 { - i = encodeVarintValidator(dAtA, i, uint64(m.StakingPower)) + if m.VotingPower != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.VotingPower)) i-- dAtA[i] = 0x18 } @@ -361,8 +360,8 @@ func (m *SimpleValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.StakingPower != 0 { - i = encodeVarintValidator(dAtA, i, uint64(m.StakingPower)) + if m.VotingPower != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.VotingPower)) i-- dAtA[i] = 0x10 } @@ -404,8 +403,8 @@ func (m *ValidatorSet) Size() (n int) { n += 1 + l + sovValidator(uint64(l)) } } - if m.TotalStakingPower != 0 { - n += 1 + sovValidator(uint64(m.TotalStakingPower)) + if m.TotalVotingPower != 0 { + n += 1 + sovValidator(uint64(m.TotalVotingPower)) } return n } @@ -422,14 +421,14 @@ func (m *Validator) Size() (n int) { } l = m.PubKey.Size() n += 1 + l + sovValidator(uint64(l)) - if m.StakingPower != 0 { - n += 1 + sovValidator(uint64(m.StakingPower)) + if m.VotingPower != 0 { + n += 1 + sovValidator(uint64(m.VotingPower)) } if m.ProposerPriority != 0 { n += 1 + sovValidator(uint64(m.ProposerPriority)) } - if m.VotingPower != 0 { - n += 2 + sovValidator(uint64(m.VotingPower)) + if m.StakingPower != 0 { + n += 2 + sovValidator(uint64(m.StakingPower)) } return n } @@ -444,8 +443,8 @@ func (m *SimpleValidator) Size() (n int) { l = m.PubKey.Size() n += 1 + l + sovValidator(uint64(l)) } - if m.StakingPower != 0 { - n += 1 + sovValidator(uint64(m.StakingPower)) + if m.VotingPower != 0 { + n += 1 + sovValidator(uint64(m.VotingPower)) } return n } @@ -521,9 +520,9 @@ func (m *ValidatorSet) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalStakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalVotingPower", wireType) } - m.TotalStakingPower = 0 + m.TotalVotingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowValidator @@ -533,7 +532,7 @@ func (m *ValidatorSet) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalStakingPower |= int64(b&0x7F) << shift + m.TotalVotingPower |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -657,9 +656,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) } - m.StakingPower = 0 + m.VotingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowValidator @@ -669,7 +668,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingPower |= int64(b&0x7F) << shift + m.VotingPower |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -695,9 +694,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } case 1000: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) } - m.VotingPower = 0 + m.StakingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowValidator @@ -707,7 +706,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VotingPower |= int64(b&0x7F) << shift + m.StakingPower |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -800,9 +799,9 @@ func (m *SimpleValidator) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) } - m.StakingPower = 0 + m.VotingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowValidator @@ -812,7 +811,7 @@ func (m *SimpleValidator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingPower |= int64(b&0x7F) << shift + m.VotingPower |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/ostracon/types/validator.proto b/proto/ostracon/types/validator.proto index 091faf075..7adfe895e 100644 --- a/proto/ostracon/types/validator.proto +++ b/proto/ostracon/types/validator.proto @@ -9,20 +9,20 @@ import "ostracon/crypto/keys.proto"; message ValidatorSet { repeated Validator validators = 1; // Validator proposer = 2; // This field has been removed in Ostracon. - int64 total_staking_power = 3; + int64 total_voting_power = 3; } message Validator { bytes address = 1; ostracon.crypto.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; - int64 staking_power = 3; + int64 voting_power = 3; int64 proposer_priority = 4; // *** Ostracon Extended Fields *** - int64 voting_power = 1000; + int64 staking_power = 1000; } message SimpleValidator { - ostracon.crypto.PublicKey pub_key = 1; - int64 staking_power = 2; + ostracon.crypto.PublicKey pub_key = 1; + int64 voting_power = 2; } diff --git a/proto/ostracon/types/voter.pb.go b/proto/ostracon/types/voter.pb.go index ca14f26fd..e31382755 100644 --- a/proto/ostracon/types/voter.pb.go +++ b/proto/ostracon/types/voter.pb.go @@ -23,8 +23,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type VoterSet struct { - Voters []*Validator `protobuf:"bytes,1,rep,name=voters,proto3" json:"voters,omitempty"` - TotalVotingPower int64 `protobuf:"varint,2,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` + Voters []*Validator `protobuf:"bytes,1,rep,name=voters,proto3" json:"voters,omitempty"` + TotalStakingPower int64 `protobuf:"varint,2,opt,name=total_staking_power,json=totalStakingPower,proto3" json:"total_staking_power,omitempty"` } func (m *VoterSet) Reset() { *m = VoterSet{} } @@ -67,9 +67,9 @@ func (m *VoterSet) GetVoters() []*Validator { return nil } -func (m *VoterSet) GetTotalVotingPower() int64 { +func (m *VoterSet) GetTotalStakingPower() int64 { if m != nil { - return m.TotalVotingPower + return m.TotalStakingPower } return 0 } @@ -135,25 +135,25 @@ func init() { proto.RegisterFile("ostracon/types/voter.proto", fileDescriptor_d9 var fileDescriptor_d9565f097e29c5b3 = []byte{ // 301 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xb1, 0x4e, 0x32, 0x41, - 0x14, 0x85, 0x99, 0x9f, 0x40, 0xfe, 0x0c, 0x89, 0x31, 0x53, 0x98, 0x95, 0x62, 0x24, 0x54, 0x14, - 0xba, 0x1b, 0xb5, 0xb1, 0x26, 0x31, 0x16, 0x36, 0x64, 0x25, 0x14, 0x36, 0x93, 0xd9, 0xe5, 0x06, - 0x26, 0xce, 0xce, 0xdd, 0xcc, 0x5e, 0x11, 0x7c, 0x0a, 0x0b, 0x1f, 0xca, 0x92, 0xd2, 0xd2, 0xc0, - 0x8b, 0x18, 0x26, 0x2c, 0x09, 0xb6, 0xf7, 0xfb, 0xce, 0x99, 0xc9, 0xe1, 0x5d, 0xac, 0xc8, 0xeb, - 0x1c, 0x5d, 0x42, 0xab, 0x12, 0xaa, 0x64, 0x81, 0x04, 0x3e, 0x2e, 0x3d, 0x12, 0x8a, 0x93, 0x9a, - 0xc5, 0x81, 0x75, 0xe5, 0x5f, 0x57, 0x5b, 0x33, 0xd5, 0x84, 0x7b, 0xbf, 0xff, 0xc2, 0xff, 0x4f, - 0x76, 0xf1, 0x27, 0x20, 0x71, 0xcd, 0xdb, 0xa1, 0xaa, 0x8a, 0x58, 0xaf, 0x39, 0xe8, 0xdc, 0x9c, - 0xc7, 0xc7, 0x65, 0xf1, 0xa4, 0x0e, 0xa7, 0x7b, 0x51, 0x5c, 0x72, 0x41, 0x48, 0xda, 0xaa,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x60, 0x04, 0x89, 0x1d, 0xce, 0xd2, 0xa9, 0x8b, 0x09, + 0xea, 0xe2, 0x5c, 0x10, 0x07, 0x97, 0x92, 0x96, 0x0e, 0x2e, 0xc7, 0x25, 0xfd, 0x68, 0x83, 0x97, + 0xfb, 0xc2, 0xdd, 0xa7, 0xb6, 0xfe, 0x0a, 0x07, 0x7f, 0x94, 0x63, 0x47, 0x47, 0x69, 0xff, 0x88, + 0xf4, 0x4c, 0x0a, 0x75, 0xbd, 0xe7, 0x79, 0xdf, 0xfb, 0x78, 0x79, 0x17, 0x1d, 0x59, 0x95, 0xa1, + 0x89, 0x69, 0x55, 0x82, 0x8b, 0x5f, 0x91, 0xc0, 0x46, 0xa5, 0x45, 0xc2, 0xe0, 0xa4, 0x66, 0x91, + 0x67, 0x5d, 0xf1, 0xdf, 0x55, 0x3a, 0x9f, 0x29, 0xc2, 0xca, 0xef, 0x17, 0xfc, 0x78, 0xba, 0x8b, + 0x8f, 0x81, 0x82, 0x6b, 0xde, 0xf6, 0x55, 0x2e, 0x64, 0xbd, 0xe6, 0xa0, 0x73, 0x73, 0x11, 0x1d, + 0x96, 0x45, 0xd3, 0x3a, 0x9c, 0x54, 0x62, 0x10, 0xf1, 0x33, 0x42, 0x52, 0x5a, 0x3a, 0x52, 0xcf, + 0xb9, 0x99, 0xcb, 0x12, 0xdf, 0xc0, 0x86, 0x47, 0x3d, 0x36, 0x68, 0x26, 0xa7, 0x1e, 0x8d, 0xff, + 0xc8, 0x68, 0x07, 0xfa, 0x9f, 0x8c, 0x77, 0xfc, 0x7f, 0x23, 0x65, 0x55, 0xe1, 0x82, 0x3b, 0x1e, + 0xfa, 0x26, 0x09, 0x1a, 0x32, 0xca, 0xd1, 0x48, 0x5a, 0x58, 0x70, 0x0b, 0xd4, 0xb3, 0x90, 0xf5, + 0xd8, 0xa0, 0x95, 0x9c, 0x7b, 0x7e, 0x5f, 0xe1, 0x49, 0x4d, 0x83, 0x47, 0xde, 0x2f, 0xd4, 0x52, + 0x12, 0x6a, 0xb0, 0x2a, 0xd5, 0x20, 0xd3, 0xd5, 0xbb, 0x32, 0x94, 0x1b, 0x90, 0x25, 0xd8, 0x0c, + 0x0c, 0xa9, 0x39, 0xf8, 0x43, 0x5a, 0xc9, 0x65, 0xa1, 0x96, 0x93, 0x5a, 0x1c, 0xd6, 0xde, 0x68, + 0xaf, 0x0d, 0x1f, 0xbe, 0x36, 0x82, 0xad, 0x37, 0x82, 0xfd, 0x6c, 0x04, 0xfb, 0xd8, 0x8a, 0xc6, + 0x7a, 0x2b, 0x1a, 0xdf, 0x5b, 0xd1, 0x78, 0xba, 0x9a, 0xe7, 0xb4, 0x78, 0x49, 0xa3, 0x0c, 0x8b, + 0x58, 0xe7, 0x06, 0xe2, 0xfd, 0x9e, 0x7e, 0xbf, 0xf8, 0x70, 0xde, 0xb4, 0xed, 0x5f, 0x6f, 0x7f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xf8, 0x30, 0xbe, 0xa3, 0x01, 0x00, 0x00, } func (m *VoterSet) Marshal() (dAtA []byte, err error) { @@ -176,8 +176,8 @@ func (m *VoterSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TotalVotingPower != 0 { - i = encodeVarintVoter(dAtA, i, uint64(m.TotalVotingPower)) + if m.TotalStakingPower != 0 { + i = encodeVarintVoter(dAtA, i, uint64(m.TotalStakingPower)) i-- dAtA[i] = 0x10 } @@ -254,8 +254,8 @@ func (m *VoterSet) Size() (n int) { n += 1 + l + sovVoter(uint64(l)) } } - if m.TotalVotingPower != 0 { - n += 1 + sovVoter(uint64(m.TotalVotingPower)) + if m.TotalStakingPower != 0 { + n += 1 + sovVoter(uint64(m.TotalStakingPower)) } return n } @@ -346,9 +346,9 @@ func (m *VoterSet) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalVotingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalStakingPower", wireType) } - m.TotalVotingPower = 0 + m.TotalStakingPower = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVoter @@ -358,7 +358,7 @@ func (m *VoterSet) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalVotingPower |= int64(b&0x7F) << shift + m.TotalStakingPower |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/ostracon/types/voter.proto b/proto/ostracon/types/voter.proto index 10b136f61..9ecf47009 100644 --- a/proto/ostracon/types/voter.proto +++ b/proto/ostracon/types/voter.proto @@ -7,7 +7,7 @@ import "ostracon/types/validator.proto"; message VoterSet { repeated ostracon.types.Validator voters = 1; - int64 total_voting_power = 2; + int64 total_staking_power = 2; } message VoterParams { diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 8ce61fcf0..ed7cb6445 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -189,9 +189,9 @@ func TestGenesisAndValidators(t *testing.T) { voter := voters.Voters[0] // make sure the current set is also the genesis set - assert.Equal(t, gval.Power, val.StakingPower) + assert.Equal(t, gval.Power, val.VotingPower) assert.Equal(t, gval.PubKey, val.PubKey) - assert.Equal(t, gval.Power, voter.StakingPower) + assert.Equal(t, gval.Power, voter.VotingPower) assert.Equal(t, gval.PubKey, voter.PubKey) } } diff --git a/rpc/core/consensus.go b/rpc/core/consensus.go index 8c78475e4..263bbdbcb 100644 --- a/rpc/core/consensus.go +++ b/rpc/core/consensus.go @@ -45,7 +45,7 @@ func Validators(ctx *rpctypes.Context, heightPtr *int64, pagePtr, perPagePtr *in idx, voter := voters.GetByAddress(v[i].Address) if idx >= 0 { votersIndices = append(votersIndices, int32(i)) - v[i] = voter // replace to preserve its VotingPower + v[i] = voter // replace to preserve its StakingPower } } diff --git a/rpc/core/status.go b/rpc/core/status.go index 78e141901..63d1a9870 100644 --- a/rpc/core/status.go +++ b/rpc/core/status.go @@ -46,9 +46,9 @@ func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) { // Return the very last voting power, not the voting power of this validator // during the last block. - var stakingPower int64 + var votingPower int64 if val := validatorAtHeight(latestUncommittedHeight()); val != nil { - stakingPower = val.StakingPower + votingPower = val.VotingPower } result := &ctypes.ResultStatus{ @@ -65,9 +65,9 @@ func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) { CatchingUp: env.ConsensusReactor.WaitSync(), }, ValidatorInfo: ctypes.ValidatorInfo{ - Address: env.PubKey.Address(), - PubKey: env.PubKey, - StakingPower: stakingPower, + Address: env.PubKey.Address(), + PubKey: env.PubKey, + VotingPower: votingPower, }, } diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index 2f8a8d07c..d2a6620e1 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -86,9 +86,9 @@ type SyncInfo struct { // Info about the node's validator type ValidatorInfo struct { - Address bytes.HexBytes `json:"address"` - PubKey crypto.PubKey `json:"pub_key"` - StakingPower int64 `json:"staking_power"` + Address bytes.HexBytes `json:"address"` + PubKey crypto.PubKey `json:"pub_key"` + VotingPower int64 `json:"voting_power"` } // Node Status diff --git a/state/execution_test.go b/state/execution_test.go index 33b8a1898..aaaa14ce0 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -136,7 +136,7 @@ func TestBeginBlockByzantineValidators(t *testing.T) { defer proxyApp.Stop() //nolint:errcheck // ignore for tests state, stateDB, privVals := makeState(2, 12) - state.Validators.Validators[0].VotingPower = 10 + state.Validators.Validators[0].StakingPower = 10 stateStore := sm.NewStore(stateDB) defaultEvidenceTime := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) @@ -162,7 +162,7 @@ func TestBeginBlockByzantineValidators(t *testing.T) { // we don't need to worry about validating the evidence as long as they pass validate basic dve := types.NewMockDuplicateVoteEvidenceWithValidator(3, defaultEvidenceTime, privVal, state.ChainID) dve.ValidatorPower = 1000 - dve.VotingPower = state.Validators.Validators[0].VotingPower + dve.StakingPower = state.Validators.Validators[0].StakingPower lcae := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ SignedHeader: &types.SignedHeader{ @@ -400,7 +400,7 @@ func TestUpdateValidators(t *testing.T) { assert.NoError(t, err) require.Equal(t, tc.resultingSet.Size(), tc.currentSet.Size()) - assert.Equal(t, tc.resultingSet.TotalStakingPower(), tc.currentSet.TotalStakingPower()) + assert.Equal(t, tc.resultingSet.TotalVotingPower(), tc.currentSet.TotalVotingPower()) assert.Equal(t, tc.resultingSet.Validators[0].Address, tc.currentSet.Validators[0].Address) if tc.resultingSet.Size() > 1 { @@ -472,7 +472,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) { require.True(t, ok, "Expected event of type EventDataValidatorSetUpdates, got %T", msg.Data()) if assert.NotEmpty(t, event.ValidatorUpdates) { assert.Equal(t, pubkey, event.ValidatorUpdates[0].PubKey) - assert.EqualValues(t, 10, event.ValidatorUpdates[0].StakingPower) + assert.EqualValues(t, 10, event.ValidatorUpdates[0].VotingPower) } case <-updatesSub.Cancelled(): t.Fatalf("updatesSub was cancelled (reason: %v)", updatesSub.Err()) diff --git a/state/helpers_test.go b/state/helpers_test.go index ce42eb926..60bb7d880 100644 --- a/state/helpers_test.go +++ b/state/helpers_test.go @@ -205,7 +205,7 @@ func makeHeaderPartsResponsesValPowerChange( // If the pubkey is new, remove the old and add the new. _, val := state.NextValidators.GetByIndex(0) - if val.StakingPower != power { + if val.VotingPower != power { abciResponses.EndBlock = &abci.ResponseEndBlock{ ValidatorUpdates: []abci.ValidatorUpdate{ types.OC2PB.NewValidatorUpdate(val.PubKey, power), diff --git a/state/state.go b/state/state.go index a2b0a4f50..8eaf3406c 100644 --- a/state/state.go +++ b/state/state.go @@ -315,8 +315,8 @@ func MedianTime(commit *types.Commit, voters *types.VoterSet) time.Time { _, validator := voters.GetByAddress(commitSig.ValidatorAddress) // If there's no condition, TestValidateBlockCommit panics; not needed normally. if validator != nil { - totalVotingPower += validator.VotingPower - weightedTimes[i] = tmtime.NewWeightedTime(commitSig.Timestamp, validator.VotingPower) + totalVotingPower += validator.StakingPower + weightedTimes[i] = tmtime.NewWeightedTime(commitSig.Timestamp, validator.StakingPower) } } diff --git a/state/state_test.go b/state/state_test.go index c1122b125..01d34d16b 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -266,7 +266,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { highestHeight := changeHeights[N-1] + 5 changeIndex := 0 _, val := state.Validators.GetByIndex(0) - power := val.StakingPower + power := val.VotingPower var err error var validatorUpdates []*types.Validator for i := int64(1); i < highestHeight; i++ { @@ -287,7 +287,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { // On each height change, increment the power by one. testCases := make([]int64, highestHeight) changeIndex = 0 - power = val.StakingPower + power = val.VotingPower for i := int64(1); i < highestHeight+1; i++ { // We get to the height after a change height use the next pubkey (note // our counter starts at 0 this time). @@ -305,7 +305,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { assert.Equal(t, v.Size(), 1, "validator set size is greater than 1: %d", v.Size()) _, val := v.GetByIndex(0) - assert.Equal(t, val.StakingPower, power, fmt.Sprintf(`unexpected powerat + assert.Equal(t, val.VotingPower, power, fmt.Sprintf(`unexpected powerat height %d`, i)) } @@ -317,7 +317,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { assert.Equal(t, v.Size(), 1, "voter set size is greater than 1: %d", v.Size()) _, val := v.GetByIndex(0) - assert.Equal(t, val.StakingPower, power, fmt.Sprintf(`unexpected powerat + assert.Equal(t, val.VotingPower, power, fmt.Sprintf(`unexpected powerat height %d`, i)) } } @@ -327,8 +327,8 @@ func mustBeSameVoterSet(t *testing.T, a, b *types.VoterSet) { for i, v := range a.Voters { assert.True(t, bytes.Equal(v.PubKey.Bytes(), b.Voters[i].PubKey.Bytes()), "voter public key is different") - assert.True(t, v.StakingPower == b.Voters[i].StakingPower, "voter staking power is different") assert.True(t, v.VotingPower == b.Voters[i].VotingPower, "voter voting power is different") + assert.True(t, v.StakingPower == b.Voters[i].StakingPower, "voter staking power is different") } } @@ -337,8 +337,8 @@ func mustBeSameValidatorSet(t *testing.T, a, b *types.ValidatorSet) { for i, v := range a.Validators { assert.True(t, bytes.Equal(v.PubKey.Bytes(), b.Validators[i].PubKey.Bytes()), "validator public key is different") - assert.True(t, v.StakingPower == b.Validators[i].StakingPower, "validator staking power is different") assert.True(t, v.VotingPower == b.Validators[i].VotingPower, "validator voting power is different") + assert.True(t, v.StakingPower == b.Validators[i].StakingPower, "validator staking power is different") } } @@ -478,7 +478,7 @@ func genValSetWithPowers(powers []int64) *types.ValidatorSet { // test a proposer appears as frequently as expected func testProposerFreq(t *testing.T, caseNum int, valSet *types.ValidatorSet) { N := valSet.Size() - totalPower := valSet.TotalStakingPower() + totalPower := valSet.TotalVotingPower() // run the proposer selection and track frequencies runMult := 1 @@ -496,7 +496,7 @@ func testProposerFreq(t *testing.T, caseNum int, valSet *types.ValidatorSet) { // assert frequencies match expected (max off by 1) for i, freq := range freqs { _, val := valSet.GetByIndex(int32(i)) - expectFreq := int(val.StakingPower) * runMult + expectFreq := int(val.VotingPower) * runMult gotFreq := freq abs := int(math.Abs(float64(expectFreq - gotFreq))) @@ -517,7 +517,7 @@ func testProposerFreq(t *testing.T, caseNum int, valSet *types.ValidatorSet) { chiSquareds := make([]ChiSquared, N) for i, freq := range freqs { _, val := valSet.GetByIndex(int32(i)) - expectFreq := val.StakingPower * int64(runMult) + expectFreq := val.VotingPower * int64(runMult) chiSquareds[i] = ChiSquared{int64(freq), expectFreq} } _, p := chiSquaredTest(chiSquareds) @@ -559,9 +559,9 @@ func chiSquaredTest(tests []ChiSquared) (float64, float64) { func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { tearDown, _, state := setupTestCase(t) defer tearDown(t) - val1StakingPower := int64(10) + val1VotingPower := int64(10) val1PubKey := ed25519.GenPrivKey().PubKey() - val1 := &types.Validator{Address: val1PubKey.Address(), PubKey: val1PubKey, StakingPower: val1StakingPower} + val1 := &types.Validator{Address: val1PubKey.Address(), PubKey: val1PubKey, VotingPower: val1VotingPower} state.Validators = types.NewValidatorSet([]*types.Validator{val1}) state.NextValidators = state.Validators @@ -579,17 +579,17 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { require.NoError(t, err) updatedState, err := sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) - curTotal := val1StakingPower + curTotal := val1VotingPower // one increment step and one validator: 0 + power - total_power == 0 - assert.Equal(t, 0+val1StakingPower-curTotal, updatedState.NextValidators.Validators[0].ProposerPriority) + assert.Equal(t, 0+val1VotingPower-curTotal, updatedState.NextValidators.Validators[0].ProposerPriority) // add a validator val2PubKey := ed25519.GenPrivKey().PubKey() - val2StakingPower := int64(100) + val2VotingPower := int64(100) fvp, err := cryptoenc.PubKeyToProto(val2PubKey) require.NoError(t, err) - updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val2StakingPower} + updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val2VotingPower} validatorUpdates, err = types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) updatedState2, err := sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) @@ -604,7 +604,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { // Steps from adding new validator: // 0 - val1 prio is 0, TVP after add: wantVal1Prio := int64(0) - totalPowerAfter := val1StakingPower + val2StakingPower + totalPowerAfter := val1VotingPower + val2VotingPower // 1. Add - Val2 should be initially added with (-123) => wantVal2Prio := -(totalPowerAfter + (totalPowerAfter >> 3)) // 2. Scale - noop @@ -615,22 +615,22 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { wantVal1Prio -= avg.Int64() // 62 // 4. Steps from IncrementProposerPriority - wantVal1Prio += val1StakingPower // 72 - wantVal2Prio += val2StakingPower // 39 - wantVal1Prio -= totalPowerAfter // -38 as val1 is proposer + wantVal1Prio += val1VotingPower // 72 + wantVal2Prio += val2VotingPower // 39 + wantVal1Prio -= totalPowerAfter // -38 as val1 is proposer assert.Equal(t, wantVal1Prio, updatedVal1.ProposerPriority) assert.Equal(t, wantVal2Prio, addedVal2.ProposerPriority) // Updating a validator does not reset the ProposerPriority to zero: - // 1. Add - Val2 StakingPower change to 1 => + // 1. Add - Val2 VotingPower change to 1 => updatedVotingPowVal2 := int64(1) updateVal := abci.ValidatorUpdate{PubKey: fvp, Power: updatedVotingPowVal2} validatorUpdates, err = types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{updateVal}) assert.NoError(t, err) // this will cause the diff of priorities (77) - // to be larger than threshold == 2*totalStakingPower (22): + // to be larger than threshold == 2*totalVotingPower (22): updatedState3, err := sm.UpdateState(updatedState2, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) @@ -646,7 +646,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { wantVal2Prio = prevVal2.ProposerPriority // scale to diffMax = 22 = 2 * tvp, diff=39-(-38)=77 // new totalPower - totalPower := updatedVal1.StakingPower + updatedVal2.StakingPower + totalPower := updatedVal1.VotingPower + updatedVal2.VotingPower dist := wantVal2Prio - wantVal1Prio // ratio := (dist + 2*totalPower - 1) / 2*totalPower = 98/22 = 4 ratio := (dist + 2*totalPower - 1) / (2 * totalPower) @@ -658,9 +658,9 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { // 4. IncrementProposerPriority() -> // v1(10):-9+10, v2(1):9+1 -> v2 proposer so subsract tvp(11) // v1(10):1, v2(1):-1 - wantVal2Prio += updatedVal2.StakingPower // 10 -> prop - wantVal1Prio += updatedVal1.StakingPower // 1 - wantVal2Prio -= totalPower // -1 + wantVal2Prio += updatedVal2.VotingPower // 10 -> prop + wantVal1Prio += updatedVal1.VotingPower // 1 + wantVal2Prio -= totalPower // -1 assert.Equal(t, wantVal2Prio, updatedVal2.ProposerPriority) assert.Equal(t, wantVal1Prio, updatedVal1.ProposerPriority) @@ -674,9 +674,9 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { // have the same voting power (and the 2nd was added later). tearDown, _, state := setupTestCase(t) defer tearDown(t) - val1StakingPower := int64(10) + val1VotingPower := int64(10) val1PubKey := ed25519.GenPrivKey().PubKey() - val1 := &types.Validator{Address: val1PubKey.Address(), PubKey: val1PubKey, StakingPower: val1StakingPower} + val1 := &types.Validator{Address: val1PubKey.Address(), PubKey: val1PubKey, VotingPower: val1VotingPower} // reset state validators to above validator state.Validators = types.NewValidatorSet([]*types.Validator{val1}) @@ -699,8 +699,8 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { assert.NoError(t, err) // 0 + 10 (initial prio) - 10 (avg) - 10 (mostest - total) = -10 - totalPower := val1StakingPower - wantVal1Prio := 0 + val1StakingPower - totalPower + totalPower := val1VotingPower + wantVal1Prio := 0 + val1VotingPower - totalPower assert.Equal(t, wantVal1Prio, updatedState.NextValidators.Validators[0].ProposerPriority) assert.Equal(t, val1PubKey.Address(), updatedState.NextValidators.Validators[0].Address) @@ -708,7 +708,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { val2PubKey := ed25519.GenPrivKey().PubKey() fvp, err := cryptoenc.PubKeyToProto(val2PubKey) require.NoError(t, err) - updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val1StakingPower} + updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val1VotingPower} validatorUpdates, err = types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) @@ -729,8 +729,8 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { _, updatedVal2 := updatedState2.NextValidators.GetByAddress(val2PubKey.Address()) // 1. Add - val2StakingPower := val1StakingPower - totalPower = val1StakingPower + val2StakingPower // 20 + val2VotingPower := val1VotingPower + totalPower = val1VotingPower + val2VotingPower // 20 v2PrioWhenAddedVal2 := -(totalPower + (totalPower >> 3)) // -22 // 2. Scale - noop // 3. Center @@ -739,9 +739,9 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { expectedVal2Prio := v2PrioWhenAddedVal2 - avg.Int64() // -11 expectedVal1Prio := oldVal1.ProposerPriority - avg.Int64() // 11 // 4. Increment - expectedVal2Prio += val2StakingPower // -11 + 10 = -1 - expectedVal1Prio += val1StakingPower // 11 + 10 == 21 - expectedVal1Prio -= totalPower // 1, val1 proposer + expectedVal2Prio += val2VotingPower // -11 + 10 = -1 + expectedVal1Prio += val1VotingPower // 11 + 10 == 21 + expectedVal1Prio -= totalPower // 1, val1 proposer assert.EqualValues(t, expectedVal1Prio, updatedVal1.ProposerPriority) assert.EqualValues( @@ -769,9 +769,9 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { // check if expected proposer prio is matched: // Increment - expectedVal2Prio2 := expectedVal2Prio + val2StakingPower // -1 + 10 = 9 - expectedVal1Prio2 := expectedVal1Prio + val1StakingPower // 1 + 10 == 11 - expectedVal1Prio2 -= totalPower // -9, val1 proposer + expectedVal2Prio2 := expectedVal2Prio + val2VotingPower // -1 + 10 = 9 + expectedVal1Prio2 := expectedVal1Prio + val1VotingPower // 1 + 10 == 11 + expectedVal1Prio2 -= totalPower // -9, val1 proposer assert.EqualValues( t, @@ -848,13 +848,13 @@ func TestLargeGenesisValidator(t *testing.T) { tearDown, _, state := setupTestCase(t) defer tearDown(t) - genesisStakingPower := types.MaxTotalStakingPower / 1000 + genesisVotingPower := types.MaxTotalVotingPower / 1000 genesisPubKey := ed25519.GenPrivKey().PubKey() // fmt.Println("genesis addr: ", genesisPubKey.Address()) genesisVal := &types.Validator{ - Address: genesisPubKey.Address(), - PubKey: genesisPubKey, - StakingPower: genesisStakingPower, + Address: genesisPubKey.Address(), + PubKey: genesisPubKey, + VotingPower: genesisVotingPower, } // reset state validators to above validator state.Validators = types.NewValidatorSet([]*types.Validator{genesisVal}) @@ -878,7 +878,7 @@ func TestLargeGenesisValidator(t *testing.T) { updatedState, err := sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) - // no changes in voting power (ProposerPrio += StakingPower == Voting in 1st round; than shiftByAvg == 0, + // no changes in voting power (ProposerPrio += VotingPower == Voting in 1st round; than shiftByAvg == 0, // than -Total == -Voting) // -> no change in ProposerPrio (stays zero): assert.EqualValues(t, oldState.NextValidators, updatedState.NextValidators) @@ -893,10 +893,10 @@ func TestLargeGenesisValidator(t *testing.T) { // see how long it takes until the effect wears off and both begin to alternate // see: https://github.com/tendermint/tendermint/issues/2960 firstAddedValPubKey := ed25519.GenPrivKey().PubKey() - firstAddedValStakingPower := int64(10) + firstAddedValVotingPower := int64(10) fvp, err := cryptoenc.PubKeyToProto(firstAddedValPubKey) require.NoError(t, err) - firstAddedVal := abci.ValidatorUpdate{PubKey: fvp, Power: firstAddedValStakingPower} + firstAddedVal := abci.ValidatorUpdate{PubKey: fvp, Power: firstAddedValVotingPower} validatorUpdates, err := types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{firstAddedVal}) assert.NoError(t, err) abciResponses := &tmstate.ABCIResponses{ @@ -943,7 +943,7 @@ func TestLargeGenesisValidator(t *testing.T) { addedPubKey := ed25519.GenPrivKey().PubKey() ap, err := cryptoenc.PubKeyToProto(addedPubKey) require.NoError(t, err) - addedVal := abci.ValidatorUpdate{PubKey: ap, Power: firstAddedValStakingPower} + addedVal := abci.ValidatorUpdate{PubKey: ap, Power: firstAddedValVotingPower} validatorUpdates, err := types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{addedVal}) assert.NoError(t, err) @@ -1285,7 +1285,7 @@ func TestMedianTime(t *testing.T) { voters := types.ToVoterAll(vals) for j, power := range tc.votingPowers { // reset voting power with a value that is not staking power - voters.Voters[j].VotingPower = power + voters.Voters[j].StakingPower = power commits[j] = types.NewCommitSigForBlock(tmrand.Bytes(10), voters.Voters[j].Address, tc.times[j]) } commit := types.NewCommit(10, 0, types.BlockID{Hash: []byte("0xDEADBEEF")}, commits) diff --git a/state/store_test.go b/state/store_test.go index 70e73f35d..7ab05689f 100644 --- a/state/store_test.go +++ b/state/store_test.go @@ -210,7 +210,7 @@ func TestPruneStates(t *testing.T) { // Generate a bunch of state data. Validators change for heights ending with 3, and // parameters when ending with 5. - validator := &types.Validator{Address: tmrand.Bytes(crypto.AddressSize), StakingPower: 100, PubKey: pk} + validator := &types.Validator{Address: tmrand.Bytes(crypto.AddressSize), VotingPower: 100, PubKey: pk} validatorSet := &types.ValidatorSet{ Validators: []*types.Validator{validator}, } diff --git a/test/e2e/tests/validator_test.go b/test/e2e/tests/validator_test.go index e49057f33..b0dcbe5ac 100644 --- a/test/e2e/tests/validator_test.go +++ b/test/e2e/tests/validator_test.go @@ -55,11 +55,11 @@ func TestValidator_Sets(t *testing.T) { "incorrect Address of validator set at height %v", h) require.Equal(t, expected.PubKey, actual.PubKey, "incorrect PubKey of validator set at height %v", h) - require.Equal(t, expected.StakingPower, actual.StakingPower, - "incorrect StakingPower of validator set at height %v", h) - // VotingPower is set StakingPower - require.Equal(t, expected.StakingPower, actual.VotingPower, + require.Equal(t, expected.VotingPower, actual.VotingPower, "incorrect VotingPower of validator set at height %v", h) + // StakingPower is set VotingPower + require.Equal(t, expected.VotingPower, actual.StakingPower, + "incorrect StakingPower of validator set at height %v", h) if expected.ProposerPriority == 0 { // ProposerPriority is not changed // the other value can ignore since we don't use it diff --git a/test/maverick/consensus/state.go b/test/maverick/consensus/state.go index 941144ddd..a89a41071 100644 --- a/test/maverick/consensus/state.go +++ b/test/maverick/consensus/state.go @@ -1573,7 +1573,7 @@ func (cs *State) pruneBlocks(retainHeight int64) (uint64, error) { func (cs *State) recordMetrics(height int64, block *types.Block) { cs.metrics.Voters.Set(float64(cs.Validators.Size())) - cs.metrics.VotersPower.Set(float64(cs.Validators.TotalStakingPower())) + cs.metrics.VotersPower.Set(float64(cs.Validators.TotalVotingPower())) var ( missingValidators int @@ -1608,14 +1608,14 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { commitSig := block.LastCommit.Signatures[i] if commitSig.Absent() { missingValidators++ - missingValidatorsPower += val.StakingPower + missingValidatorsPower += val.VotingPower } if bytes.Equal(val.Address, address) { label := []string{ "validator_address", val.Address.String(), } - cs.metrics.VoterPower.With(label...).Set(float64(val.StakingPower)) + cs.metrics.VoterPower.With(label...).Set(float64(val.VotingPower)) if commitSig.ForBlock() { cs.metrics.VoterLastSignedHeight.With(label...).Set(float64(height)) } else { @@ -1637,7 +1637,7 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { if dve, ok := ev.(*types.DuplicateVoteEvidence); ok { if _, val := cs.Validators.GetByAddress(dve.VoteA.ValidatorAddress); val != nil { byzantineValidatorsCount++ - byzantineValidatorsPower += val.StakingPower + byzantineValidatorsPower += val.VotingPower } } } diff --git a/types/evidence.go b/types/evidence.go index 020be3ebc..d4415c108 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -24,6 +24,7 @@ func MaxEvidenceBytes(ev Evidence) int64 { (1 + MaxVoteBytes(len(ev.VoteB.Signature)) + 2) + // VoteB (1 + 9) + // TotalVotingPower (1 + 9) + // ValidatorPower + //(1 + 9) + // StakingPower is not include (1 + 17 + 1) // Timestamp case *LightClientAttackEvidence: // FIXME 🏺 need this? @@ -53,9 +54,9 @@ type DuplicateVoteEvidence struct { VoteB *Vote `json:"vote_b"` // abci specific information - TotalVotingPower int64 // VoterSet.totalVotingPower - VotingPower int64 // Validator.VotingPower - ValidatorPower int64 // Validator.StakingPower + TotalVotingPower int64 // VoterSet.TotalStakingPower() + ValidatorPower int64 // Validator.VotingPower + StakingPower int64 // Validator.StakingPower Timestamp time.Time } @@ -83,9 +84,9 @@ func NewDuplicateVoteEvidence(vote1, vote2 *Vote, blockTime time.Time, voterSet return &DuplicateVoteEvidence{ VoteA: voteA, VoteB: voteB, - TotalVotingPower: voterSet.TotalVotingPower(), - VotingPower: val.VotingPower, - ValidatorPower: val.StakingPower, + TotalVotingPower: voterSet.TotalStakingPower(), + ValidatorPower: val.VotingPower, + StakingPower: val.StakingPower, Timestamp: blockTime, } } @@ -95,9 +96,9 @@ func (dve *DuplicateVoteEvidence) ABCI() []abci.Evidence { return []abci.Evidence{{ Type: abci.EvidenceType_DUPLICATE_VOTE, Validator: abci.Validator{ - Address: dve.VoteA.ValidatorAddress, - Power: dve.ValidatorPower, - VotingPower: dve.VotingPower, + Address: dve.VoteA.ValidatorAddress, + Power: dve.ValidatorPower, + StakingPower: dve.StakingPower, }, Height: dve.VoteA.Height, Time: dve.Timestamp, @@ -166,8 +167,8 @@ func (dve *DuplicateVoteEvidence) ToProto() *tmproto.DuplicateVoteEvidence { VoteA: voteA, VoteB: voteB, TotalVotingPower: dve.TotalVotingPower, - VotingPower: dve.VotingPower, ValidatorPower: dve.ValidatorPower, + StakingPower: dve.StakingPower, Timestamp: dve.Timestamp, } return &tp @@ -193,8 +194,8 @@ func DuplicateVoteEvidenceFromProto(pb *tmproto.DuplicateVoteEvidence) (*Duplica VoteA: vA, VoteB: vB, TotalVotingPower: pb.TotalVotingPower, - VotingPower: pb.VotingPower, ValidatorPower: pb.ValidatorPower, + StakingPower: pb.StakingPower, Timestamp: pb.Timestamp, } @@ -214,7 +215,7 @@ type LightClientAttackEvidence struct { // abci specific information ByzantineValidators []*Validator // validators in the validator set that misbehaved in creating the conflicting block - TotalVotingPower int64 // total voting power of the voter set at the common height + TotalVotingPower int64 // total staking power of the voter set at the common height Timestamp time.Time // timestamp of the block at the common height } diff --git a/types/evidence_test.go b/types/evidence_test.go index eaf66f0b1..c2a6eb455 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -215,7 +215,7 @@ func TestLightClientAttackEvidenceBasic(t *testing.T) { VoterSet: voterSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalVotingPower(), + TotalVotingPower: voterSet.TotalStakingPower(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } @@ -245,7 +245,7 @@ func TestLightClientAttackEvidenceBasic(t *testing.T) { ValidatorSet: valSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalVotingPower(), + TotalVotingPower: voterSet.TotalStakingPower(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } @@ -275,7 +275,7 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { VoterSet: voterSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalVotingPower(), + TotalVotingPower: voterSet.TotalStakingPower(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } @@ -315,7 +315,7 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { VoterSet: voterSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalVotingPower(), + TotalVotingPower: voterSet.TotalStakingPower(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } diff --git a/types/priv_validator.go b/types/priv_validator.go index 268438017..7cf2724a7 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -136,12 +136,12 @@ func (pv MockPV) SignProposal(chainID string, proposal *tmproto.Proposal) error return nil } -func (pv MockPV) ExtractIntoValidator(stakingPower int64) *Validator { +func (pv MockPV) ExtractIntoValidator(votingPower int64) *Validator { pubKey, _ := pv.GetPubKey() return &Validator{ - Address: pubKey.Address(), - PubKey: pubKey, - StakingPower: stakingPower, + Address: pubKey.Address(), + PubKey: pubKey, + VotingPower: votingPower, } } diff --git a/types/protobuf.go b/types/protobuf.go index 0ba4be606..0804c681f 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -63,9 +63,9 @@ func (oc2pb) Header(header *Header) tmproto.Header { func (oc2pb) Validator(val *Validator) abci.Validator { return abci.Validator{ - Address: val.PubKey.Address(), - Power: val.StakingPower, - VotingPower: val.VotingPower, + Address: val.PubKey.Address(), + Power: val.VotingPower, + StakingPower: val.StakingPower, } } @@ -91,7 +91,7 @@ func (oc2pb) ValidatorUpdate(val *Validator) abci.ValidatorUpdate { } return abci.ValidatorUpdate{ PubKey: pk, - Power: val.StakingPower, + Power: val.VotingPower, } } diff --git a/types/validator.go b/types/validator.go index 92a083dfe..08d337ead 100644 --- a/types/validator.go +++ b/types/validator.go @@ -13,28 +13,28 @@ import ( ) // Volatile state for each Validator -// NOTE: The ProposerPriority, VotingPower is not included in Validator.Hash(); +// NOTE: The ProposerPriority, StakingPower is not included in Validator.Hash(); // make sure to update that method if changes are made here -// StakingPower is the potential voting power proportional to the amount of stake, -// and VotingPower is the actual voting power granted by the election process. -// StakingPower is durable and can be changed by staking txs. -// VotingPower is volatile and can be changed at every height. +// VotingPower is the potential voting power proportional to the amount of stake, +// and StakingPower is the actual voting power granted by the election process. +// VotingPower is durable and can be changed by staking txs. +// StakingPower is volatile and can be changed at every height. type Validator struct { - Address Address `json:"address"` - PubKey crypto.PubKey `json:"pub_key"` - StakingPower int64 `json:"staking_power"` + Address Address `json:"address"` + PubKey crypto.PubKey `json:"pub_key"` + VotingPower int64 `json:"voting_power"` - VotingPower int64 `json:"voting_power"` + StakingPower int64 `json:"staking_power"` ProposerPriority int64 `json:"proposer_priority"` } // NewValidator returns a new validator with the given pubkey and staking power. -func NewValidator(pubKey crypto.PubKey, stakingPower int64) *Validator { +func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator { return &Validator{ Address: pubKey.Address(), PubKey: pubKey, - StakingPower: stakingPower, - VotingPower: 0, + VotingPower: votingPower, + StakingPower: 0, ProposerPriority: 0, } } @@ -48,7 +48,7 @@ func (v *Validator) ValidateBasic() error { return errors.New("validator does not have a public key") } - if v.StakingPower < 0 { + if v.VotingPower < 0 { return errors.New("validator has negative voting power") } @@ -102,7 +102,7 @@ func (v *Validator) String() string { return fmt.Sprintf("Validator{%v %v VP:%v A:%v}", v.Address, v.PubKey, - v.StakingPower, + v.VotingPower, v.ProposerPriority) } @@ -110,7 +110,7 @@ func (v *Validator) String() string { func ValidatorListString(vals []*Validator) string { chunks := make([]string, len(vals)) for i, val := range vals { - chunks[i] = fmt.Sprintf("%s:%d", val.Address, val.StakingPower) + chunks[i] = fmt.Sprintf("%s:%d", val.Address, val.VotingPower) } return strings.Join(chunks, ",") @@ -127,8 +127,8 @@ func (v *Validator) Bytes() []byte { } pbv := tmproto.SimpleValidator{ - PubKey: &pk, - StakingPower: v.StakingPower, + PubKey: &pk, + VotingPower: v.VotingPower, } bz, err := pbv.Marshal() @@ -152,8 +152,8 @@ func (v *Validator) ToProto() (*tmproto.Validator, error) { vp := tmproto.Validator{ Address: v.Address, PubKey: pk, - StakingPower: v.StakingPower, VotingPower: v.VotingPower, + StakingPower: v.StakingPower, ProposerPriority: v.ProposerPriority, } @@ -174,8 +174,8 @@ func ValidatorFromProto(vp *tmproto.Validator) (*Validator, error) { v := new(Validator) v.Address = vp.GetAddress() v.PubKey = pk - v.StakingPower = vp.GetStakingPower() v.VotingPower = vp.GetVotingPower() + v.StakingPower = vp.GetStakingPower() v.ProposerPriority = vp.GetProposerPriority() return v, nil @@ -192,14 +192,14 @@ func RandValidator(randPower bool, minPower int64) (*Validator, PrivValidator) { func RandValidatorForPrivKey(keyType PrivKeyType, randPower bool, minPower int64) (*Validator, PrivValidator) { privVal := NewMockPV(keyType) - stakingPower := minPower + votingPower := minPower if randPower { - stakingPower += int64(tmrand.Uint32()) + votingPower += int64(tmrand.Uint32()) } pubKey, err := privVal.GetPubKey() if err != nil { panic(fmt.Errorf("could not retrieve pubkey %w", err)) } - val := NewValidator(pubKey, stakingPower) + val := NewValidator(pubKey, votingPower) return val, privVal } diff --git a/types/validator_set.go b/types/validator_set.go index ed16f98dc..91f243938 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -15,27 +15,27 @@ import ( ) const ( - // MaxTotalStakingPower - the maximum allowed total voting power. + // MaxTotalVotingPower - the maximum allowed total voting power. // It needs to be sufficiently small to, in all cases: // 1. prevent clipping in incrementProposerPriority() // 2. let (diff+diffMax-1) not overflow in IncrementProposerPriority() // (Proof of 1 is tricky, left to the reader). // It could be higher, but this is sufficiently large for our purposes, // and leaves room for defensive purposes. - MaxTotalStakingPower = int64(math.MaxInt64) / 8 + MaxTotalVotingPower = int64(math.MaxInt64) / 8 - // MaxTotalVotingPower should be same to MaxTotalStakingPower theoretically, + // MaxTotalStakingPower should be same to MaxTotalVotingPower theoretically, // but the value can be higher when it is type-casted as float64 // because of the number of valid digits of float64. // This phenomenon occurs in the following computations. // // `winner.SetWinPoint(int64(float64(totalPriority) * winPoints[i] / totalWinPoint))` lib/rand/sampling.go // - // MaxTotalVotingPower can be as large as MaxTotalStakingPower+alpha + // MaxTotalStakingPower can be as large as MaxTotalVotingPower+alpha // but I don't know the exact alpha. 1000 seems to be enough by some examination. // Please refer TestMaxVotingPowerTest for this. // TODO: 1000 is temporary limit, we should remove float calculation and then we can fix this limit - MaxTotalVotingPower = MaxTotalStakingPower + 1000 + MaxTotalStakingPower = MaxTotalVotingPower + 1000 // PriorityWindowSizeFactor - is a constant that when multiplied with the // total voting power gives the maximum allowed distance between validator @@ -46,7 +46,7 @@ const ( // ErrTotalVotingPowerOverflow is returned if the total voting power of the // resulting validator set exceeds MaxTotalVotingPower. var ErrTotalVotingPowerOverflow = fmt.Errorf("total voting power of resulting valset exceeds max %d", - MaxTotalStakingPower) + MaxTotalVotingPower) // ValidatorSet represent a set of *Validator at a given height. // @@ -66,7 +66,7 @@ type ValidatorSet struct { Validators []*Validator `json:"validators"` // cached (unexported) - totalStakingPower int64 + totalVotingPower int64 } type candidate struct { @@ -133,7 +133,7 @@ func (vals *ValidatorSet) CopyIncrementProposerPriority(times int32) *ValidatorS return copy } -// TODO The current random selection by VRF uses StakingPower, so the processing on ProposerPriority can be removed, +// TODO The current random selection by VRF uses VotingPower, so the processing on ProposerPriority can be removed, // TODO but it remains for later verification of random selection based on ProposerPriority. // IncrementProposerPriority increments ProposerPriority of each validator and updates the // proposer. Panics if validator set is empty. @@ -148,8 +148,8 @@ func (vals *ValidatorSet) IncrementProposerPriority(times int32) { // Cap the difference between priorities to be proportional to 2*totalPower by // re-normalizing priorities, i.e., rescale all priorities by multiplying with: - // 2*totalStakingPower/(maxPriority - minPriority) - diffMax := PriorityWindowSizeFactor * vals.TotalStakingPower() + // 2*totalVotingPower/(maxPriority - minPriority) + diffMax := PriorityWindowSizeFactor * vals.TotalVotingPower() vals.RescalePriorities(diffMax) vals.shiftByAvgProposerPriority() @@ -187,13 +187,13 @@ func (vals *ValidatorSet) RescalePriorities(diffMax int64) { func (vals *ValidatorSet) incrementProposerPriority() *Validator { for _, val := range vals.Validators { // Check for overflow for sum. - newPrio := safeAddClip(val.ProposerPriority, val.StakingPower) + newPrio := safeAddClip(val.ProposerPriority, val.VotingPower) val.ProposerPriority = newPrio } // Decrement the validator with most ProposerPriority. mostest := vals.getValWithMostPriority() // Mind the underflow. - mostest.ProposerPriority = safeSubClip(mostest.ProposerPriority, vals.TotalStakingPower()) + mostest.ProposerPriority = safeSubClip(mostest.ProposerPriority, vals.TotalVotingPower()) return mostest } @@ -269,8 +269,8 @@ func validatorListCopy(valsList []*Validator) []*Validator { // Copy each validator into a new ValidatorSet. func (vals *ValidatorSet) Copy() *ValidatorSet { return &ValidatorSet{ - Validators: validatorListCopy(vals.Validators), - totalStakingPower: vals.totalStakingPower, + Validators: validatorListCopy(vals.Validators), + totalVotingPower: vals.totalVotingPower, } } @@ -315,29 +315,29 @@ func (vals *ValidatorSet) Size() int { // Forces recalculation of the set's total voting power. // Panics if total voting power is bigger than MaxTotalVotingPower. -func (vals *ValidatorSet) updateTotalStakingPower() { +func (vals *ValidatorSet) updateTotalVotingPower() { sum := int64(0) for _, val := range vals.Validators { // mind overflow - sum = safeAddClip(sum, val.StakingPower) - if sum > MaxTotalStakingPower { + sum = safeAddClip(sum, val.VotingPower) + if sum > MaxTotalVotingPower { panic(fmt.Sprintf( - "Total staking power should be guarded to not exceed %v; got: %v", - MaxTotalStakingPower, + "Total voting power should be guarded to not exceed %v; got: %v", + MaxTotalVotingPower, sum)) } } - vals.totalStakingPower = sum + vals.totalVotingPower = sum } -// TotalStakingPower returns the sum of the staking powers of all validators. -// It recomputes the total staking power if required. -func (vals *ValidatorSet) TotalStakingPower() int64 { - if vals.totalStakingPower == 0 { - vals.updateTotalStakingPower() +// TotalVotingPower returns the sum of the voting powers of all validators. +// It recomputes the total voting power if required. +func (vals *ValidatorSet) TotalVotingPower() int64 { + if vals.totalVotingPower == 0 { + vals.updateTotalVotingPower() } - return vals.totalStakingPower + return vals.totalVotingPower } // Hash returns the Merkle root hash build using validators (as leaves) in the @@ -385,14 +385,14 @@ func processChanges(origChanges []*Validator) (updates, removals []*Validator, e } switch { - case valUpdate.StakingPower < 0: - err = fmt.Errorf("voting power can't be negative: %d", valUpdate.StakingPower) + case valUpdate.VotingPower < 0: + err = fmt.Errorf("voting power can't be negative: %d", valUpdate.VotingPower) return nil, nil, err - case valUpdate.StakingPower > MaxTotalStakingPower: + case valUpdate.VotingPower > MaxTotalVotingPower: err = fmt.Errorf("to prevent clipping/overflow, voting power can't be higher than %d, got %d", - MaxTotalStakingPower, valUpdate.StakingPower) + MaxTotalVotingPower, valUpdate.VotingPower) return nil, nil, err - case valUpdate.StakingPower == 0: + case valUpdate.VotingPower == 0: removals = append(removals, valUpdate) default: updates = append(updates, valUpdate) @@ -415,7 +415,7 @@ func processChanges(origChanges []*Validator) (updates, removals []*Validator, e // // Returns: // tvpAfterUpdatesBeforeRemovals - the new total voting power if these updates would be applied without the removals. -// Note that this will be < 2 * MaxTotalStakingPower in case high power validators are removed and +// Note that this will be < 2 * MaxTotalVotingPower in case high power validators are removed and // validators are added/ updated with high power values. // // err - non-nil if the maximum allowed total voting power would be exceeded @@ -428,9 +428,9 @@ func verifyUpdates( delta := func(update *Validator, vals *ValidatorSet) int64 { _, val := vals.GetByAddress(update.Address) if val != nil { - return update.StakingPower - val.StakingPower + return update.VotingPower - val.VotingPower } - return update.StakingPower + return update.VotingPower } updatesCopy := validatorListCopy(updates) @@ -438,10 +438,10 @@ func verifyUpdates( return delta(updatesCopy[i], vals) < delta(updatesCopy[j], vals) }) - tvpAfterRemovals := vals.TotalStakingPower() - removedPower + tvpAfterRemovals := vals.TotalVotingPower() - removedPower for _, upd := range updatesCopy { tvpAfterRemovals += delta(upd, vals) - if tvpAfterRemovals > MaxTotalStakingPower { + if tvpAfterRemovals > MaxTotalVotingPower { return 0, ErrTotalVotingPowerOverflow } } @@ -459,30 +459,30 @@ func numNewValidators(updates []*Validator, vals *ValidatorSet) int { } // computeNewPriorities computes the proposer priority for the validators not present in the set based on -// 'updatedTotalStakingPower'. +// 'updatedTotalVotingPower'. // Leaves unchanged the priorities of validators that are changed. // // 'updates' parameter must be a list of unique validators to be added or updated. // -// 'updatedTotalStakingPower' is the total voting power of a set where all updates would be applied but -// not the removals. It must be < 2*MaxTotalStakingPower and may be close to this limit if close to -// MaxTotalStakingPower will be removed. This is still safe from overflow since MaxTotalStakingPower is maxInt64/8. +// 'updatedTotalVotingPower' is the total voting power of a set where all updates would be applied but +// not the removals. It must be < 2*MaxTotalVotingPower and may be close to this limit if close to +// MaxTotalVotingPower will be removed. This is still safe from overflow since MaxTotalVotingPower is maxInt64/8. // // No changes are made to the validator set 'vals'. -func computeNewPriorities(updates []*Validator, vals *ValidatorSet, updatedTotalStakingPower int64) { +func computeNewPriorities(updates []*Validator, vals *ValidatorSet, updatedTotalVotingPower int64) { for _, valUpdate := range updates { address := valUpdate.Address _, val := vals.GetByAddress(address) if val == nil { // add val - // Set ProposerPriority to -C*totalStakingPower (with C ~= 1.125) to make sure validators can't + // Set ProposerPriority to -C*totalVotingPower (with C ~= 1.125) to make sure validators can't // un-bond and then re-bond to reset their (potentially previously negative) ProposerPriority to zero. // - // Contract: updatedStakingPower < 2 * MaxTotalStakingPower to ensure ProposerPriority does + // Contract: updatedVotingPower < 2 * MaxTotalVotingPower to ensure ProposerPriority does // not exceed the bounds of int64. // - // Compute ProposerPriority = -1.125*totalStakingPower == -(updatedStakingPower + (updatedStakingPower >> 3)). - valUpdate.ProposerPriority = -(updatedTotalStakingPower + (updatedTotalStakingPower >> 3)) + // Compute ProposerPriority = -1.125*totalVotingPower == -(updatedVotingPower + (updatedVotingPower >> 3)). + valUpdate.ProposerPriority = -(updatedTotalVotingPower + (updatedTotalVotingPower >> 3)) } else { valUpdate.ProposerPriority = val.ProposerPriority } @@ -533,20 +533,20 @@ func (vals *ValidatorSet) applyUpdates(updates []*Validator) { // Checks that the validators to be removed are part of the validator set. // No changes are made to the validator set 'vals'. -func verifyRemovals(deletes []*Validator, vals *ValidatorSet) (staingPower int64, err error) { - removedStakingPower := int64(0) +func verifyRemovals(deletes []*Validator, vals *ValidatorSet) (votingPower int64, err error) { + removedVotingPower := int64(0) for _, valUpdate := range deletes { address := valUpdate.Address _, val := vals.GetByAddress(address) if val == nil { - return removedStakingPower, fmt.Errorf("failed to find validator %X to remove", address) + return removedVotingPower, fmt.Errorf("failed to find validator %X to remove", address) } - removedStakingPower += val.StakingPower + removedVotingPower += val.VotingPower } if len(deletes) > len(vals.Validators) { panic("more deletes than validators") } - return removedStakingPower, nil + return removedVotingPower, nil } // Removes the validators specified in 'deletes' from validator set 'vals'. @@ -604,14 +604,14 @@ func (vals *ValidatorSet) updateWithChangeSet(changes []*Validator, allowDeletes // Verify that applying the 'deletes' against 'vals' will not result in error. // Get the voting power that is going to be removed. - removedStakingPower, err := verifyRemovals(deletes, vals) + removedVotingPower, err := verifyRemovals(deletes, vals) if err != nil { return err } // Verify that applying the 'updates' against 'vals' will not result in error. - // Get the updated total voting power before removal. Note that this is < 2 * MaxTotalStakingPower - tvpAfterUpdatesBeforeRemovals, err := verifyUpdates(updates, vals, removedStakingPower) + // Get the updated total voting power before removal. Note that this is < 2 * MaxTotalVotingPower + tvpAfterUpdatesBeforeRemovals, err := verifyUpdates(updates, vals, removedVotingPower) if err != nil { return err } @@ -623,10 +623,10 @@ func (vals *ValidatorSet) updateWithChangeSet(changes []*Validator, allowDeletes vals.applyUpdates(updates) vals.applyRemovals(deletes) - vals.updateTotalStakingPower() // will panic if total voting power > MaxTotalStakingPower + vals.updateTotalVotingPower() // will panic if total voting power > MaxTotalVotingPower // Scale and center. - vals.RescalePriorities(PriorityWindowSizeFactor * vals.TotalStakingPower()) + vals.RescalePriorities(PriorityWindowSizeFactor * vals.TotalVotingPower()) vals.shiftByAvgProposerPriority() sort.Sort(ValidatorsByVotingPower(vals.Validators)) @@ -658,11 +658,11 @@ func (vals *ValidatorSet) SelectProposer(proofHash []byte, height int64, round i candidates := make([]tmrand.Candidate, len(vals.Validators)) for i, val := range vals.Validators { candidates[i] = &candidate{ - priority: uint64(val.StakingPower), + priority: uint64(val.VotingPower), val: val, // don't need to assign the copy } } - samples := tmrand.RandomSamplingWithPriority(seed, candidates, 1, uint64(vals.TotalStakingPower())) + samples := tmrand.RandomSamplingWithPriority(seed, candidates, 1, uint64(vals.TotalVotingPower())) return samples[0].(*candidate).val } @@ -705,10 +705,10 @@ type ValidatorsByVotingPower []*Validator func (valz ValidatorsByVotingPower) Len() int { return len(valz) } func (valz ValidatorsByVotingPower) Less(i, j int) bool { - if valz[i].StakingPower == valz[j].StakingPower { + if valz[i].VotingPower == valz[j].VotingPower { return bytes.Compare(valz[i].Address, valz[j].Address) == -1 } - return valz[i].StakingPower > valz[j].StakingPower + return valz[i].VotingPower > valz[j].VotingPower } func (valz ValidatorsByVotingPower) Swap(i, j int) { @@ -746,7 +746,7 @@ func (vals *ValidatorSet) ToProto() (*tmproto.ValidatorSet, error) { } vp.Validators = valsProto - vp.TotalStakingPower = vals.totalStakingPower + vp.TotalVotingPower = vals.totalVotingPower return vp, nil } @@ -770,7 +770,7 @@ func ValidatorSetFromProto(vp *tmproto.ValidatorSet) (*ValidatorSet, error) { } vals.Validators = valsProto - vals.totalStakingPower = vp.GetTotalStakingPower() + vals.totalVotingPower = vp.GetTotalVotingPower() return vals, vals.ValidateBasic() } @@ -793,7 +793,7 @@ func ValidatorSetFromExistingValidators(valz []*Validator) (*ValidatorSet, error vals := &ValidatorSet{ Validators: valz, } - vals.updateTotalStakingPower() + vals.updateTotalVotingPower() sort.Sort(ValidatorsByVotingPower(vals.Validators)) return vals, nil } diff --git a/types/validator_set_test.go b/types/validator_set_test.go index e2d387015..51bad6e43 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -21,7 +21,7 @@ import ( ) func TestMaxVotingPowerTest(t *testing.T) { - large := MaxTotalStakingPower + large := MaxTotalVotingPower maxDiff := int64(0) for i := 0; i < 8; i++ { for j := 0; j < 8; j++ { @@ -34,7 +34,7 @@ func TestMaxVotingPowerTest(t *testing.T) { } } t.Logf("max difference=%d", maxDiff) - assert.True(t, MaxTotalStakingPower+maxDiff <= MaxTotalVotingPower) + assert.True(t, MaxTotalVotingPower+maxDiff <= MaxTotalStakingPower) } func TestValidatorSetBasic(t *testing.T) { @@ -63,12 +63,12 @@ func TestValidatorSetBasic(t *testing.T) { assert.Nil(t, addr) assert.Nil(t, val) assert.Zero(t, vset.Size()) - assert.Equal(t, int64(0), vset.TotalStakingPower()) + assert.Equal(t, int64(0), vset.TotalVotingPower()) assert.Equal(t, []byte{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}, vset.Hash()) // add - val = randValidator(vset.TotalStakingPower()) + val = randValidator(vset.TotalVotingPower()) assert.NoError(t, vset.UpdateWithChangeSet([]*Validator{val})) assert.True(t, vset.HasAddress(val.Address)) @@ -77,17 +77,17 @@ func TestValidatorSetBasic(t *testing.T) { addr, _ = vset.GetByIndex(0) assert.Equal(t, []byte(val.Address), addr) assert.Equal(t, 1, vset.Size()) - assert.Equal(t, val.StakingPower, vset.TotalStakingPower()) + assert.Equal(t, val.VotingPower, vset.TotalVotingPower()) assert.NotNil(t, vset.Hash()) assert.NotPanics(t, func() { vset.IncrementProposerPriority(1) }) assert.Equal(t, val.Address, vset.SelectProposer([]byte{}, 1, 0).Address) // update - val = randValidator(vset.TotalStakingPower()) + val = randValidator(vset.TotalVotingPower()) assert.NoError(t, vset.UpdateWithChangeSet([]*Validator{val})) _, val = vset.GetByAddress(val.Address) - val.StakingPower += 100 + val.VotingPower += 100 proposerPriority := val.ProposerPriority val.ProposerPriority = 0 @@ -219,7 +219,7 @@ func verifyWinningRate(t *testing.T, vals *ValidatorSet, tries int, error float6 } for i := 0; i < len(actual); i++ { - expected := float64(vals.Validators[i].StakingPower) / float64(vals.TotalStakingPower()) + expected := float64(vals.Validators[i].VotingPower) / float64(vals.TotalVotingPower()) if math.Abs(expected-actual[i]) > expected*error { t.Errorf("The winning rate is too far off from expected: %f ∉ %f±%f", actual[i], expected, expected*error) @@ -372,7 +372,7 @@ func TestProposerSelection3(t *testing.T) { } func newValidator(address []byte, power int64) *Validator { - return &Validator{Address: address, StakingPower: power} + return &Validator{Address: address, VotingPower: power} } func randPubKey() crypto.PubKey { @@ -385,30 +385,30 @@ func defendLimit(a int64) int64 { if a <= 0 { return 1 } - if a > MaxTotalStakingPower/8 { - a = MaxTotalStakingPower / 8 + if a > MaxTotalVotingPower/8 { + a = MaxTotalVotingPower / 8 } return a } -func randValidator(totalStakingPower int64) *Validator { - // this modulo limits the ProposerPriority/StakingPower to stay in the - // bounds of MaxTotalStakingPower minus the already existing voting power: - stakingPower := defendLimit(int64(tmrand.Uint64() % uint64(MaxTotalStakingPower-totalStakingPower))) - val := NewValidator(randPubKey(), stakingPower) - val.ProposerPriority = stakingPower +func randValidator(totalVotingPower int64) *Validator { + // this modulo limits the ProposerPriority/VotingPower to stay in the + // bounds of MaxTotalVotingPower minus the already existing voting power: + votingPower := defendLimit(int64(tmrand.Uint64() % uint64(MaxTotalVotingPower-totalVotingPower))) + val := NewValidator(randPubKey(), votingPower) + val.ProposerPriority = votingPower return val } func randValidatorSet(numValidators int) *ValidatorSet { validators := make([]*Validator, numValidators) - totalStakingPower := int64(numValidators) // to depend for total staking power to be over MaxTotalStakingPower + totalVotingPower := int64(numValidators) // to depend for total staking power to be over MaxTotalStakingPower for i := 0; i < numValidators; i++ { - validators[i] = randValidator(totalStakingPower) - totalStakingPower += validators[i].StakingPower - if totalStakingPower >= MaxTotalStakingPower { + validators[i] = randValidator(totalVotingPower) + totalVotingPower += validators[i].VotingPower + if totalVotingPower >= MaxTotalVotingPower { // the remainder must have 1 of staking power - totalStakingPower = MaxTotalStakingPower - 1 + totalVotingPower = MaxTotalVotingPower - 1 } } return NewValidatorSet(validators) @@ -471,9 +471,9 @@ func TestValidatorSetTotalStakingPowerPanicsOnOverflow(t *testing.T) { // which should panic on overflows: shouldPanic := func() { NewValidatorSet([]*Validator{ - {Address: []byte("a"), StakingPower: math.MaxInt64, ProposerPriority: 0}, - {Address: []byte("b"), StakingPower: math.MaxInt64, ProposerPriority: 0}, - {Address: []byte("c"), StakingPower: math.MaxInt64, ProposerPriority: 0}, + {Address: []byte("a"), VotingPower: math.MaxInt64, ProposerPriority: 0}, + {Address: []byte("b"), VotingPower: math.MaxInt64, ProposerPriority: 0}, + {Address: []byte("c"), VotingPower: math.MaxInt64, ProposerPriority: 0}, }) } @@ -567,9 +567,9 @@ func TestAveragingInIncrementProposerPriorityWithStakingPower(t *testing.T) { total := vp0 + vp1 + vp2 avg := (vp0 + vp1 + vp2 - total) / 3 vals := ValidatorSet{Validators: []*Validator{ - {Address: []byte{0}, ProposerPriority: 0, StakingPower: vp0}, - {Address: []byte{1}, ProposerPriority: 0, StakingPower: vp1}, - {Address: []byte{2}, ProposerPriority: 0, StakingPower: vp2}}} + {Address: []byte{0}, ProposerPriority: 0, VotingPower: vp0}, + {Address: []byte{1}, ProposerPriority: 0, VotingPower: vp1}, + {Address: []byte{2}, ProposerPriority: 0, VotingPower: vp2}}} tcs := []struct { vals *ValidatorSet wantProposerPrioritys []int64 @@ -580,7 +580,7 @@ func TestAveragingInIncrementProposerPriorityWithStakingPower(t *testing.T) { 0: { vals.Copy(), []int64{ - // Acumm+StakingPower-Avg: + // Acumm+VotingPower-Avg: 0 + vp0 - total - avg, // mostest will be subtracted by total voting power (12) 0 + vp1, 0 + vp2}, @@ -810,9 +810,9 @@ func verifyValidatorSet(t *testing.T, valSet *ValidatorSet) { assert.Equal(t, len(valSet.Validators), cap(valSet.Validators)) // verify that the set's total voting power has been updated - tvp := valSet.totalStakingPower - valSet.updateTotalStakingPower() - expectedTvp := valSet.TotalStakingPower() + tvp := valSet.totalVotingPower + valSet.updateTotalVotingPower() + expectedTvp := valSet.TotalVotingPower() assert.Equal(t, expectedTvp, tvp, "expected TVP %d. Got %d, voterSet=%s", expectedTvp, tvp, valSet) @@ -832,7 +832,7 @@ func toTestValList(valList []*Validator) []testVal { testList := make([]testVal, len(valList)) for i, val := range valList { testList[i].name = string(val.Address) - testList[i].power = val.StakingPower + testList[i].power = val.VotingPower } return testList } @@ -924,7 +924,7 @@ func TestValSetUpdatesDuplicateEntries(t *testing.T) { } func TestValSetUpdatesOverflows(t *testing.T) { - maxVP := MaxTotalStakingPower + maxVP := MaxTotalVotingPower testCases := []valSetErrTestCase{ { // single update leading to overflow testValSet(2, 10), @@ -1032,7 +1032,7 @@ func TestValSetUpdatesBasicTestsExecute(t *testing.T) { // is changed in the list of validators previously passed as parameter to UpdateWithChangeSet. // this is to make sure copies of the validators are made by UpdateWithChangeSet. if len(valList) > 0 { - valList[0].StakingPower++ + valList[0].VotingPower++ assert.Equal(t, toTestValList(valListCopy), toTestValList(valSet.Validators), "test %v", i) } @@ -1345,39 +1345,39 @@ func TestValSetUpdateOverflowRelated(t *testing.T) { testCases := []testVSetCfg{ { name: "1 no false overflow error messages for updates", - startVals: []testVal{{"v2", MaxTotalStakingPower - 1}, {"v1", 1}}, - updatedVals: []testVal{{"v1", MaxTotalStakingPower - 1}, {"v2", 1}}, - expectedVals: []testVal{{"v1", MaxTotalStakingPower - 1}, {"v2", 1}}, + startVals: []testVal{{"v2", MaxTotalVotingPower - 1}, {"v1", 1}}, + updatedVals: []testVal{{"v1", MaxTotalVotingPower - 1}, {"v2", 1}}, + expectedVals: []testVal{{"v1", MaxTotalVotingPower - 1}, {"v2", 1}}, expErr: nil, }, { // this test shows that it is important to apply the updates in the order of the change in power // i.e. apply first updates with decreases in power, v2 change in this case. name: "2 no false overflow error messages for updates", - startVals: []testVal{{"v2", MaxTotalStakingPower - 1}, {"v1", 1}}, - updatedVals: []testVal{{"v1", MaxTotalStakingPower/2 - 1}, {"v2", MaxTotalStakingPower / 2}}, - expectedVals: []testVal{{"v2", MaxTotalStakingPower / 2}, {"v1", MaxTotalStakingPower/2 - 1}}, + startVals: []testVal{{"v2", MaxTotalVotingPower - 1}, {"v1", 1}}, + updatedVals: []testVal{{"v1", MaxTotalVotingPower/2 - 1}, {"v2", MaxTotalVotingPower / 2}}, + expectedVals: []testVal{{"v2", MaxTotalVotingPower / 2}, {"v1", MaxTotalVotingPower/2 - 1}}, expErr: nil, }, { name: "3 no false overflow error messages for deletes", - startVals: []testVal{{"v1", MaxTotalStakingPower - 2}, {"v2", 1}, {"v3", 1}}, + startVals: []testVal{{"v1", MaxTotalVotingPower - 2}, {"v2", 1}, {"v3", 1}}, deletedVals: []testVal{{"v1", 0}}, - addedVals: []testVal{{"v4", MaxTotalStakingPower - 2}}, - expectedVals: []testVal{{"v4", MaxTotalStakingPower - 2}, {"v2", 1}, {"v3", 1}}, + addedVals: []testVal{{"v4", MaxTotalVotingPower - 2}}, + expectedVals: []testVal{{"v4", MaxTotalVotingPower - 2}, {"v2", 1}, {"v3", 1}}, expErr: nil, }, { name: "4 no false overflow error messages for adds, updates and deletes", startVals: []testVal{ - {"v1", MaxTotalStakingPower / 4}, {"v2", MaxTotalStakingPower / 4}, - {"v3", MaxTotalStakingPower / 4}, {"v4", MaxTotalStakingPower / 4}}, + {"v1", MaxTotalVotingPower / 4}, {"v2", MaxTotalVotingPower / 4}, + {"v3", MaxTotalVotingPower / 4}, {"v4", MaxTotalVotingPower / 4}}, deletedVals: []testVal{{"v2", 0}}, updatedVals: []testVal{ - {"v1", MaxTotalStakingPower/2 - 2}, {"v3", MaxTotalStakingPower/2 - 3}, {"v4", 2}}, + {"v1", MaxTotalVotingPower/2 - 2}, {"v3", MaxTotalVotingPower/2 - 3}, {"v4", 2}}, addedVals: []testVal{{"v5", 3}}, expectedVals: []testVal{ - {"v1", MaxTotalStakingPower/2 - 2}, {"v3", MaxTotalStakingPower/2 - 3}, {"v5", 3}, {"v4", 2}}, + {"v1", MaxTotalVotingPower/2 - 2}, {"v3", MaxTotalVotingPower/2 - 3}, {"v5", 3}, {"v4", 2}}, expErr: nil, }, { @@ -1386,9 +1386,9 @@ func TestValSetUpdateOverflowRelated(t *testing.T) { {"v1", 1}, {"v2", 1}, {"v3", 1}, {"v4", 1}, {"v5", 1}, {"v6", 1}, {"v7", 1}, {"v8", 1}, {"v9", 1}}, updatedVals: []testVal{ - {"v1", MaxTotalStakingPower}, {"v2", MaxTotalStakingPower}, {"v3", MaxTotalStakingPower}, - {"v4", MaxTotalStakingPower}, {"v5", MaxTotalStakingPower}, {"v6", MaxTotalStakingPower}, - {"v7", MaxTotalStakingPower}, {"v8", MaxTotalStakingPower}, {"v9", 8}}, + {"v1", MaxTotalVotingPower}, {"v2", MaxTotalVotingPower}, {"v3", MaxTotalVotingPower}, + {"v4", MaxTotalVotingPower}, {"v5", MaxTotalVotingPower}, {"v6", MaxTotalVotingPower}, + {"v7", MaxTotalVotingPower}, {"v8", MaxTotalVotingPower}, {"v9", 8}}, expectedVals: []testVal{ {"v1", 1}, {"v2", 1}, {"v3", 1}, {"v4", 1}, {"v5", 1}, {"v6", 1}, {"v7", 1}, {"v8", 1}, {"v9", 1}}, diff --git a/types/vote_set.go b/types/vote_set.go index 8a53f6e92..3774ecfb0 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -237,7 +237,7 @@ func (voteSet *VoteSet) addVote(vote *Vote, execVoteVerify func(chainID string, } // Add vote and get conflicting vote if any. - added, conflicting := voteSet.addVerifiedVote(vote, blockKey, voter.VotingPower) + added, conflicting := voteSet.addVerifiedVote(vote, blockKey, voter.StakingPower) if conflicting != nil { return added, NewConflictingVoteError(conflicting, vote) } @@ -310,7 +310,7 @@ func (voteSet *VoteSet) addVerifiedVote( // Before adding to votesByBlock, see if we'll exceed quorum origSum := votesByBlock.sum - quorum := voteSet.voterSet.TotalVotingPower()*2/3 + 1 + quorum := voteSet.voterSet.TotalStakingPower()*2/3 + 1 // Add vote to votesByBlock votesByBlock.addVerifiedVote(vote, votingPower) @@ -462,7 +462,7 @@ func (voteSet *VoteSet) HasTwoThirdsAny() bool { } voteSet.mtx.Lock() defer voteSet.mtx.Unlock() - return voteSet.sum > voteSet.voterSet.TotalVotingPower()*2/3 + return voteSet.sum > voteSet.voterSet.TotalStakingPower()*2/3 } func (voteSet *VoteSet) HasAll() bool { @@ -471,7 +471,7 @@ func (voteSet *VoteSet) HasAll() bool { } voteSet.mtx.Lock() defer voteSet.mtx.Unlock() - return voteSet.sum == voteSet.voterSet.TotalVotingPower() + return voteSet.sum == voteSet.voterSet.TotalStakingPower() } // If there was a +2/3 majority for blockID, return blockID and true. @@ -626,7 +626,7 @@ func (voteSet *VoteSet) LogString() string { // return the power voted, the total, and the fraction func (voteSet *VoteSet) sumTotalFrac() (int64, int64, float64) { - voted, total := voteSet.sum, voteSet.voterSet.TotalVotingPower() + voted, total := voteSet.sum, voteSet.voterSet.TotalStakingPower() fracVoted := float64(voted) / float64(total) return voted, total, fracVoted } diff --git a/types/voter_set.go b/types/voter_set.go index 596fdf9b6..53f9f7ef1 100644 --- a/types/voter_set.go +++ b/types/voter_set.go @@ -24,13 +24,13 @@ type VoterSet struct { Voters []*Validator `json:"voters"` // cached (unexported) - totalVotingPower int64 + totalStakingPower int64 } func WrapValidatorsToVoterSet(vals []*Validator) *VoterSet { sort.Sort(ValidatorsByVotingPower(vals)) - voterSet := &VoterSet{Voters: vals, totalVotingPower: 0} - voterSet.updateTotalVotingPower() + voterSet := &VoterSet{Voters: vals, totalStakingPower: 0} + voterSet.updateTotalStakingPower() return voterSet } @@ -103,33 +103,33 @@ func (voters *VoterSet) Copy() *VoterSet { return nil } return &VoterSet{ - Voters: copyValidatorListShallow(voters.Voters), - totalVotingPower: voters.totalVotingPower, + Voters: copyValidatorListShallow(voters.Voters), + totalStakingPower: voters.totalStakingPower, } } -// Forces recalculation of the set's total voting power. -// Panics if total voting power is bigger than MaxTotalStakingPower. -func (voters *VoterSet) updateTotalVotingPower() { +// Forces recalculation of the set's total staking power. +// Panics if total staking power is bigger than MaxTotalStakingPower. +func (voters *VoterSet) updateTotalStakingPower() { sum := int64(0) for _, val := range voters.Voters { // mind overflow - sum = safeAddClip(sum, val.VotingPower) - if sum > MaxTotalVotingPower { + sum = safeAddClip(sum, val.StakingPower) + if sum > MaxTotalStakingPower { panic(fmt.Sprintf( - "Total voting power should be guarded to not exceed %v; got: %v", - MaxTotalVotingPower, + "Total staking power should be guarded to not exceed %v; got: %v", + MaxTotalStakingPower, sum)) } } - voters.totalVotingPower = sum + voters.totalStakingPower = sum } -func (voters *VoterSet) TotalVotingPower() int64 { - if voters.totalVotingPower == 0 { - voters.updateTotalVotingPower() +func (voters *VoterSet) TotalStakingPower() int64 { + if voters.totalStakingPower == 0 { + voters.updateTotalStakingPower() } - return voters.totalVotingPower + return voters.totalStakingPower } // Hash returns the Merkle root hash build using voters (as leaves) in the @@ -167,8 +167,8 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int blockID, commit.BlockID) } - talliedVotingPower := int64(0) - votingPowerNeeded := voters.TotalVotingPower() * 2 / 3 // FIXME: 🏺 arithmetic overflow + talliedStakingPower := int64(0) + stakingPowerNeeded := voters.TotalStakingPower() * 2 / 3 // FIXME: 🏺 arithmetic overflow blsPubKeys := make([]bls.PubKey, 0, len(commit.Signatures)) messages := make([][]byte, 0, len(commit.Signatures)) for idx, commitSig := range commit.Signatures { @@ -182,7 +182,7 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int // Validate signature. voteSignBytes := commit.VoteSignBytes(chainID, int32(idx)) - verifiedVotingPower, unverifiedVotingPower, err := verifySignatureOrCollectBlsPubKeysAndGetVotingPower( + verifiedStakingPower, unverifiedStakingPower, err := verifySignatureOrCollectBlsPubKeysAndGetStakingPower( idx, commitSig, voter, voteSignBytes, &blsPubKeys, &messages) if err != nil { return err @@ -190,7 +190,7 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int // Good! if commitSig.ForBlock() { - talliedVotingPower += verifiedVotingPower + unverifiedVotingPower + talliedStakingPower += verifiedStakingPower + unverifiedStakingPower } // else { @@ -199,13 +199,14 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int // } } - // Validate signature. + // Validate aggregate signature if err := bls.VerifyAggregatedSignature(commit.AggregatedSignature, blsPubKeys, messages); err != nil { return fmt.Errorf("wrong aggregated signature: %X; %s", commit.AggregatedSignature, err) } - if got, needed := talliedVotingPower, votingPowerNeeded; got <= needed { - return ErrNotEnoughVotingPowerSigned{Got: got, Needed: needed} + // add staking power for BLS batch verification and return without error if trust-level of the signatures are verified + if got, needed := talliedStakingPower, stakingPowerNeeded; got <= needed { + return ErrNotEnoughStakingPowerSigned{Got: got, Needed: needed} } return nil @@ -233,9 +234,9 @@ func (voters *VoterSet) VerifyCommitLight(chainID string, blockID BlockID, blockID, commit.BlockID) } - talliedVotingPower := int64(0) - talliedUnverifiedVotingPower := int64(0) - votingPowerNeeded := voters.TotalVotingPower() * 2 / 3 // FIXME: 🏺 arithmetic overflow + talliedStakingPower := int64(0) + talliedUnverifiedStakingPower := int64(0) + stakingPowerNeeded := voters.TotalStakingPower() * 2 / 3 // FIXME: 🏺 arithmetic overflow blsPubKeys := make([]bls.PubKey, 0, len(commit.Signatures)) messages := make([][]byte, 0, len(commit.Signatures)) for idx, commitSig := range commit.Signatures { @@ -254,31 +255,32 @@ func (voters *VoterSet) VerifyCommitLight(chainID string, blockID BlockID, // Validate signature. voteSignBytes := commit.VoteSignBytes(chainID, int32(idx)) - verifiedVootingPower, unverifiedVotingPower, err := verifySignatureOrCollectBlsPubKeysAndGetVotingPower( + verifiedStakingPower, unverifiedStakingPower, err := verifySignatureOrCollectBlsPubKeysAndGetStakingPower( idx, commitSig, voter, voteSignBytes, &blsPubKeys, &messages) if err != nil { return err } - talliedVotingPower += verifiedVootingPower - talliedUnverifiedVotingPower += unverifiedVotingPower + talliedStakingPower += verifiedStakingPower + talliedUnverifiedStakingPower += unverifiedStakingPower // return as soon as +2/3 of the signatures are verified by individual verification - if talliedVotingPower > votingPowerNeeded { + if talliedStakingPower > stakingPowerNeeded { return nil } } - // add voting power for BLS batch verification and return without error if +2/3 of the signatures are verified + // Validate aggregate signature if err := bls.VerifyAggregatedSignature(commit.AggregatedSignature, blsPubKeys, messages); err != nil { return fmt.Errorf("wrong aggregated signature: %X; %s", commit.AggregatedSignature, err) } - talliedVotingPower += talliedUnverifiedVotingPower - if talliedVotingPower > votingPowerNeeded { + // add staking power for BLS batch verification and return without error if +2/3 of the signatures are verified + talliedStakingPower += talliedUnverifiedStakingPower + if talliedStakingPower > stakingPowerNeeded { return nil } - return ErrNotEnoughVotingPowerSigned{Got: talliedVotingPower, Needed: votingPowerNeeded} + return ErrNotEnoughStakingPowerSigned{Got: talliedStakingPower, Needed: stakingPowerNeeded} } // VerifyCommitLightTrusting verifies that trustLevel of the voter set signed @@ -296,17 +298,18 @@ func (voters *VoterSet) VerifyCommitLightTrusting(chainID string, commit *Commit } var ( - talliedVotingPower int64 - talliedUnverifiedVotingPower int64 - seenVoters = make(map[int32]int, len(commit.Signatures)) // voter index -> commit index + talliedStakingPower int64 + talliedUnverifiedStakingPower int64 + seenVoters = make(map[int32]int, len(commit.Signatures)) // voter index -> commit index ) - // Safely calculate voting power needed. - totalVotingPowerMulByNumerator, overflow := safeMul(voters.TotalVotingPower(), int64(trustLevel.Numerator)) + // Safely calculate staking power needed. + totalStakingPowerMulByNumerator, overflow := safeMul(voters.TotalStakingPower(), int64(trustLevel.Numerator)) if overflow { - return errors.New("int64 overflow while calculating voting power needed. please provide smaller trustLevel numerator") + return errors.New("int64 overflow while calculating staking power needed. " + + "please provide smaller trustLevel numerator") } - votingPowerNeeded := totalVotingPowerMulByNumerator / int64(trustLevel.Denominator) + stakingPowerNeeded := totalStakingPowerMulByNumerator / int64(trustLevel.Denominator) blsPubKeys := make([]bls.PubKey, 0, len(commit.Signatures)) messages := make([][]byte, 0, len(commit.Signatures)) @@ -330,60 +333,61 @@ func (voters *VoterSet) VerifyCommitLightTrusting(chainID string, commit *Commit // Verify Signature voteSignBytes := commit.VoteSignBytes(chainID, int32(idx)) - verifiedVotingPower, unverifiedVotingPower, err := verifySignatureOrCollectBlsPubKeysAndGetVotingPower( + verifiedStakingPower, unverifiedStakingPower, err := verifySignatureOrCollectBlsPubKeysAndGetStakingPower( idx, commitSig, voter, voteSignBytes, &blsPubKeys, &messages) if err != nil { return err } - talliedVotingPower += verifiedVotingPower - talliedUnverifiedVotingPower += unverifiedVotingPower + talliedStakingPower += verifiedStakingPower + talliedUnverifiedStakingPower += unverifiedStakingPower - if talliedVotingPower > votingPowerNeeded { + if talliedStakingPower > stakingPowerNeeded { return nil } } } - // add voting power for BLS batch verification and return without error if trust-level of the signatures are verified + // Validate aggregate signature if err := bls.VerifyAggregatedSignature(commit.AggregatedSignature, blsPubKeys, messages); err != nil { return fmt.Errorf("wrong aggregated signature: %X; %s", commit.AggregatedSignature, err) } - talliedVotingPower += talliedUnverifiedVotingPower - if talliedVotingPower > votingPowerNeeded { + // add staking power for BLS batch verification and return without error if trust-level of the signatures are verified + talliedStakingPower += talliedUnverifiedStakingPower + if talliedStakingPower > stakingPowerNeeded { return nil } - return ErrNotEnoughVotingPowerSigned{Got: talliedVotingPower, Needed: votingPowerNeeded} + return ErrNotEnoughStakingPowerSigned{Got: talliedStakingPower, Needed: stakingPowerNeeded} } -func verifySignatureOrCollectBlsPubKeysAndGetVotingPower( +func verifySignatureOrCollectBlsPubKeysAndGetStakingPower( idx int, commitSig CommitSig, val *Validator, voteSignBytes []byte, blsPubKeys *[]bls.PubKey, messages *[][]byte) (int64, int64, error) { - verifiedVotingPower := int64(0) - unverifiedVotingPower := int64(0) + verifiedStakingPower := int64(0) + unverifiedStakingPower := int64(0) if commitSig.Signature != nil { if !val.PubKey.VerifySignature(voteSignBytes, commitSig.Signature) { - return verifiedVotingPower, unverifiedVotingPower, fmt.Errorf( + return verifiedStakingPower, unverifiedStakingPower, fmt.Errorf( "wrong signature (#%d): %X", idx, commitSig.Signature, ) } - verifiedVotingPower = val.VotingPower + verifiedStakingPower = val.StakingPower } else { blsPubKey := GetSignatureKey(val.PubKey) if blsPubKey == nil { - return verifiedVotingPower, unverifiedVotingPower, fmt.Errorf( + return verifiedStakingPower, unverifiedStakingPower, fmt.Errorf( "signature %d has been omitted, even though it is not a BLS key", idx, ) } *blsPubKeys = append(*blsPubKeys, *blsPubKey) *messages = append(*messages, voteSignBytes) - unverifiedVotingPower = val.VotingPower + unverifiedStakingPower = val.StakingPower } - return verifiedVotingPower, unverifiedVotingPower, nil + return verifiedStakingPower, unverifiedStakingPower, nil } // ToProto converts VoterSet to protobuf @@ -402,7 +406,7 @@ func (voters *VoterSet) ToProto() (*tmproto.VoterSet, error) { votersProto[i] = voterp } vsp.Voters = votersProto - vsp.TotalVotingPower = voters.totalVotingPower + vsp.TotalStakingPower = voters.totalStakingPower return vsp, nil } @@ -425,29 +429,29 @@ func VoterSetFromProto(vp *tmproto.VoterSet) (*VoterSet, error) { valsProto[i] = v } voters.Voters = valsProto - voters.totalVotingPower = vp.GetTotalVotingPower() + voters.totalStakingPower = vp.GetTotalStakingPower() return voters, voters.ValidateBasic() } //----------------- -// IsErrNotEnoughVotingPowerSigned returns true if err is -// ErrNotEnoughVotingPowerSigned. -func IsErrNotEnoughVotingPowerSigned(err error) bool { - _, ok := errors.Cause(err).(ErrNotEnoughVotingPowerSigned) +// IsErrNotEnoughStakingPowerSigned returns true if err is +// ErrNotEnoughStakingPowerSigned. +func IsErrNotEnoughStakingPowerSigned(err error) bool { + _, ok := errors.Cause(err).(ErrNotEnoughStakingPowerSigned) return ok } -// ErrNotEnoughVotingPowerSigned is returned when not enough voters signed +// ErrNotEnoughStakingPowerSigned is returned when not enough voters signed // a commit. -type ErrNotEnoughVotingPowerSigned struct { +type ErrNotEnoughStakingPowerSigned struct { Got int64 Needed int64 } -func (e ErrNotEnoughVotingPowerSigned) Error() string { - return fmt.Sprintf("invalid commit -- insufficient voting power: got %d, needed more than %d", e.Got, e.Needed) +func (e ErrNotEnoughStakingPowerSigned) Error() string { + return fmt.Sprintf("invalid commit -- insufficient staking power: got %d, needed more than %d", e.Got, e.Needed) } //---------------- @@ -499,15 +503,15 @@ func SelectVoter(validators *ValidatorSet, proofHash []byte, voterParams *VoterP func ToVoterAll(validators []*Validator) *VoterSet { newVoters := make([]*Validator, 0, len(validators)) for _, val := range validators { - if val.StakingPower == 0 { - // remove the validator with the staking power of 0 from the voter set + if val.VotingPower == 0 { + // remove the validator with the voting power of 0 from the voter set continue } newVoters = append(newVoters, &Validator{ Address: val.Address, PubKey: val.PubKey, - StakingPower: val.StakingPower, - VotingPower: val.StakingPower, + VotingPower: val.VotingPower, + StakingPower: val.VotingPower, ProposerPriority: val.ProposerPriority, }) } @@ -563,13 +567,13 @@ func electVoter( found := false cumulativePriority := int64(0) for i, candidate := range candidates[:len(candidates)-voterNum] { - if threshold < uint64(cumulativePriority+candidate.StakingPower) { + if threshold < uint64(cumulativePriority+candidate.VotingPower) { winner = candidates[i] winnerIdx = i found = true break } - cumulativePriority += candidate.StakingPower + cumulativePriority += candidate.VotingPower } if !found { @@ -597,58 +601,58 @@ func electVotersNonDup(validators []*Validator, seed uint64, tolerableByzantineP } candidates := validatorListCopy(validators) - totalStakingPower := getTotalStakingPower(candidates) - tolerableByzantinePower := getTolerableByzantinePower(totalStakingPower, tolerableByzantinePercent) + totalVotingPower := getTotalVotingPower(candidates) + tolerableByzantinePower := getTolerableByzantinePower(totalVotingPower, tolerableByzantinePercent) voters := make([]*voter, 0) sortValidators(candidates) zeroValidators := 0 - for i := len(candidates); candidates[i-1].StakingPower == 0; i-- { + for i := len(candidates); candidates[i-1].VotingPower == 0; i-- { zeroValidators++ } - losersStakingPower := totalStakingPower + losersVotingPower := totalVotingPower for { // accumulateWinPoints(voters) for _, voter := range voters { // i = v1 ... vt - // stakingPower(i) * 1000 / (stakingPower(vt+1 ... vn) + stakingPower(i)) - additionalWinPoint := new(big.Int).Mul(big.NewInt(voter.val.StakingPower), + // votingPower(i) * 1000 / (votingPower(vt+1 ... vn) + votingPower(i)) + additionalWinPoint := new(big.Int).Mul(big.NewInt(voter.val.VotingPower), big.NewInt(precisionForSelection)) - additionalWinPoint.Div(additionalWinPoint, new(big.Int).Add(big.NewInt(losersStakingPower), - big.NewInt(voter.val.StakingPower))) + additionalWinPoint.Div(additionalWinPoint, new(big.Int).Add(big.NewInt(losersVotingPower), + big.NewInt(voter.val.VotingPower))) voter.winPoint.Add(voter.winPoint, additionalWinPoint) } // electVoter - winnerIdx, winner := electVoter(&seed, candidates, len(voters)+zeroValidators, losersStakingPower) + winnerIdx, winner := electVoter(&seed, candidates, len(voters)+zeroValidators, losersVotingPower) moveWinnerToLast(candidates, winnerIdx) voters = append(voters, &voter{ val: winner, winPoint: big.NewInt(precisionForSelection), }) - losersStakingPower -= winner.StakingPower + losersVotingPower -= winner.VotingPower - // calculateVotingPowers(voters) + // calculateStakingPowers(voters) totalWinPoint := new(big.Int) for _, voter := range voters { totalWinPoint.Add(totalWinPoint, voter.winPoint) } - totalVotingPower := int64(0) + totalStakingPower := int64(0) for _, voter := range voters { winPoint := new(big.Int).Mul(voter.winPoint, big.NewInt(precisionForSelection)) - bigVotingPower := new(big.Int).Div(new(big.Int).Mul(winPoint, big.NewInt(totalStakingPower)), totalWinPoint) - votingPower := new(big.Int).Div(bigVotingPower, big.NewInt(precisionCorrectionForSelection)).Int64() - voter.val.VotingPower = votingPower - totalVotingPower += votingPower + bigStakingPower := new(big.Int).Div(new(big.Int).Mul(winPoint, big.NewInt(totalVotingPower)), totalWinPoint) + stakingPower := new(big.Int).Div(bigStakingPower, big.NewInt(precisionCorrectionForSelection)).Int64() + voter.val.StakingPower = stakingPower + totalStakingPower += stakingPower } if len(voters) >= minVoters { - // sort voters in ascending votingPower/stakingPower + // sort voters in ascending stakingPower/votingPower sortVoters(voters) - topFVotersVotingPower := getTopByzantineVotingPower(voters, tolerableByzantinePower) - if topFVotersVotingPower < totalVotingPower/3 { + topFVotersStakingPower := getTopByzantineStakingPower(voters, tolerableByzantinePower) + if topFVotersStakingPower < totalStakingPower/3 { break } } @@ -657,7 +661,7 @@ func electVotersNonDup(validators []*Validator, seed uint64, tolerableByzantineP // there is no voter group satisfying the finality // cannot do sampling voters for _, c := range candidates { - c.VotingPower = c.StakingPower + c.StakingPower = c.VotingPower } return candidates } @@ -669,43 +673,43 @@ func electVotersNonDup(validators []*Validator, seed uint64, tolerableByzantineP return result } -func getTotalStakingPower(validators []*Validator) int64 { - totalStaking := int64(0) +func getTotalVotingPower(validators []*Validator) int64 { + totalVoting := int64(0) for _, v := range validators { - totalStaking += v.StakingPower + totalVoting += v.VotingPower } - return totalStaking + return totalVoting } -func getTopByzantineVotingPower(voters []*voter, tolerableByzantinePower int64) int64 { - topFVotersStakingPower := int64(0) +func getTopByzantineStakingPower(voters []*voter, tolerableByzantinePower int64) int64 { topFVotersVotingPower := int64(0) + topFVotersStakingPower := int64(0) for _, voter := range voters { - prev := topFVotersStakingPower - topFVotersStakingPower += voter.val.StakingPower + prev := topFVotersVotingPower topFVotersVotingPower += voter.val.VotingPower - if prev < tolerableByzantinePower && topFVotersStakingPower >= tolerableByzantinePower { + topFVotersStakingPower += voter.val.StakingPower + if prev < tolerableByzantinePower && topFVotersVotingPower >= tolerableByzantinePower { break } } - return topFVotersVotingPower + return topFVotersStakingPower } // sort validators in-place func sortValidators(validators []*Validator) { sort.Slice(validators, func(i, j int) bool { - if validators[i].StakingPower == validators[j].StakingPower { + if validators[i].VotingPower == validators[j].VotingPower { return bytes.Compare(validators[i].Address, validators[j].Address) == -1 } - return validators[i].StakingPower > validators[j].StakingPower + return validators[i].VotingPower > validators[j].VotingPower }) } -// sortVoters is function to sort voters in descending votingPower/stakingPower in-place +// sortVoters is function to sort voters in descending stakingPower/votingPower in-place func sortVoters(candidates []*voter) { sort.Slice(candidates, func(i, j int) bool { - bigA := new(big.Int).Mul(big.NewInt(candidates[i].val.VotingPower), big.NewInt(candidates[j].val.StakingPower)) - bigB := new(big.Int).Mul(big.NewInt(candidates[j].val.VotingPower), big.NewInt(candidates[i].val.StakingPower)) + bigA := new(big.Int).Mul(big.NewInt(candidates[i].val.StakingPower), big.NewInt(candidates[j].val.VotingPower)) + bigB := new(big.Int).Mul(big.NewInt(candidates[j].val.StakingPower), big.NewInt(candidates[i].val.VotingPower)) compareResult := bigA.Cmp(bigB) if compareResult == 0 { return bytes.Compare(candidates[i].val.Address, candidates[j].val.Address) == -1 @@ -720,9 +724,9 @@ func moveWinnerToLast(candidates []*Validator, winner int) { candidates[len(candidates)-1] = winnerCandidate } -func getTolerableByzantinePower(totalStakingPower int64, tolerableByzantinePercent int) int64 { - // `totalStakingPower * tolerableByzantinePercent` may be overflow for int64 type - bigMultiplied := new(big.Int).Mul(big.NewInt(totalStakingPower), big.NewInt(int64(tolerableByzantinePercent))) +func getTolerableByzantinePower(totalVotingPower int64, tolerableByzantinePercent int) int64 { + // `totalVotingPower * tolerableByzantinePercent` may be overflow for int64 type + bigMultiplied := new(big.Int).Mul(big.NewInt(totalVotingPower), big.NewInt(int64(tolerableByzantinePercent))) tolerableByzantinePower := new(big.Int).Div(bigMultiplied, big.NewInt(100)) // ceiling diff --git a/types/voter_set_test.go b/types/voter_set_test.go index 144ef8fc8..a676a7e99 100644 --- a/types/voter_set_test.go +++ b/types/voter_set_test.go @@ -72,7 +72,7 @@ func TestVoterSet_VerifyCommit_All(t *testing.T) { NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{vote.CommitSig(), {BlockIDFlag: BlockIDFlagAbsent}}), true}, - {"insufficient voting power: got 0, needed more than 666", chainID, vote.BlockID, vote.Height, + {"insufficient staking power: got 0, needed more than 666", chainID, vote.BlockID, vote.Height, NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{{BlockIDFlag: BlockIDFlagAbsent}}), true}, {"wrong signature (#0)", chainID, vote.BlockID, vote.Height, @@ -128,7 +128,7 @@ func TestVoterSet_VerifyCommit_CheckAllSignatures(t *testing.T) { } } -func TestVoterSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingPowerSigned(t *testing.T) { +func TestVoterSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfStakingPowerSigned(t *testing.T) { var ( chainID = "test_chain_id" h = int64(3) @@ -159,7 +159,7 @@ func TestVoterSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingPowerSigned(t assert.NoError(t, err) } -func TestVoterSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfVotingPowerSigned(t *testing.T) { +func TestVoterSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfStakingPowerSigned(t *testing.T) { var ( chainID = "test_chain_id" h = int64(3) @@ -234,7 +234,7 @@ func TestVoterSet_VerifyCommitLightTrusting(t *testing.T) { func TestVoterSet_VerifyCommitLightTrustingErrorsOnOverflow(t *testing.T) { var ( blockID = makeBlockIDRandom() - voteSet, _, voterSet, vals = randVoteSet(1, 1, tmproto.PrecommitType, 1, MaxTotalStakingPower) + voteSet, _, voterSet, vals = randVoteSet(1, 1, tmproto.PrecommitType, 1, MaxTotalVotingPower) commit, err = MakeCommit(blockID, 1, 1, voteSet, vals, time.Now()) ) require.NoError(t, err) @@ -246,10 +246,10 @@ func TestVoterSet_VerifyCommitLightTrustingErrorsOnOverflow(t *testing.T) { } } -func countZeroStakingPower(vals []*Validator) int { +func countZeroVotingPower(vals []*Validator) int { count := 0 for _, v := range vals { - if v.StakingPower == 0 { + if v.VotingPower == 0 { count++ } } @@ -261,8 +261,8 @@ func verifyVoterSetSame(t *testing.T, vset1, vset2 *VoterSet) { for i, v1 := range vset1.Voters { v2 := vset2.Voters[i] assert.True(t, v1.Address.String() == v2.Address.String()) - assert.True(t, v1.VotingPower == v2.VotingPower) assert.True(t, v1.StakingPower == v2.StakingPower) + assert.True(t, v1.VotingPower == v2.VotingPower) } } @@ -272,8 +272,8 @@ func verifyVoterSetDifferent(t *testing.T, vset1, vset2 *VoterSet) { for i, v1 := range vset1.Voters { v2 := vset2.Voters[i] if v1.Address.String() != v2.Address.String() || - v1.StakingPower != v2.StakingPower || - v1.VotingPower != v2.VotingPower { + v1.VotingPower != v2.VotingPower || + v1.StakingPower != v2.StakingPower { result = true break } @@ -284,9 +284,9 @@ func verifyVoterSetDifferent(t *testing.T, vset1, vset2 *VoterSet) { func TestSelectVoter(t *testing.T) { valSet := newValidatorSet(30, func(i int) int64 { return int64(rand.Int()%10000 + 100) }) - valSet.Validators[0].StakingPower = 0 + valSet.Validators[0].VotingPower = 0 - zeroVals := countZeroStakingPower(valSet.Validators) + zeroVals := countZeroVotingPower(valSet.Validators) genDoc := &GenesisDoc{ GenesisTime: tmtime.Now(), ChainID: "ostracon-test", @@ -306,7 +306,7 @@ func TestSelectVoter(t *testing.T) { verifyVoterSetDifferent(t, voterSet1, voterSet3) // verifying zero-staking removed - assert.True(t, countZeroStakingPower(voterSet1.Voters) == 0) + assert.True(t, countZeroVotingPower(voterSet1.Voters) == 0) // case that all validators are voters voterSet := SelectVoter(valSet, hash, &VoterParams{30, 1}) @@ -317,7 +317,7 @@ func TestSelectVoter(t *testing.T) { func zeroIncluded(valSet *ValidatorSet) bool { for _, v := range valSet.Validators { - if v.StakingPower == 0 { + if v.VotingPower == 0 { return true } } @@ -335,7 +335,7 @@ func areSame(a *ValidatorSet, b *VoterSet) bool { if v.Address.String() != b.Voters[i].Address.String() { return false } - if v.StakingPower != b.Voters[i].StakingPower { + if v.VotingPower != b.Voters[i].VotingPower { return false } } @@ -345,17 +345,17 @@ func areSame(a *ValidatorSet, b *VoterSet) bool { func TestToVoterAll(t *testing.T) { valSet := randValidatorSet(30) vals := valSet.Validators - vals[0].StakingPower = 0 - vals[5].StakingPower = 0 - vals[28].StakingPower = 0 + vals[0].VotingPower = 0 + vals[5].VotingPower = 0 + vals[28].VotingPower = 0 zeroRemovedVoters := ToVoterAll(vals) assert.True(t, zeroRemovedVoters.Size() == 27) valSet = randValidatorSet(3) vals = valSet.Validators - vals[0].StakingPower = 0 - vals[1].StakingPower = 0 - vals[2].StakingPower = 0 + vals[0].VotingPower = 0 + vals[1].VotingPower = 0 + vals[2].VotingPower = 0 zeroRemovedVoters = ToVoterAll(vals) assert.True(t, zeroRemovedVoters.Size() == 0) @@ -372,7 +372,7 @@ func TestToVoterAll(t *testing.T) { func toGenesisValidators(vals []*Validator) []GenesisValidator { genVals := make([]GenesisValidator, len(vals)) for i, val := range vals { - genVals[i] = GenesisValidator{Address: val.Address, PubKey: val.PubKey, Power: val.StakingPower, Name: "name"} + genVals[i] = GenesisValidator{Address: val.Address, PubKey: val.PubKey, Power: val.VotingPower, Name: "name"} } return genVals } @@ -419,7 +419,7 @@ func findLargestStakingPowerGap(b *testing.B, loopCount int, minMaxRate int, max for i := 0; i < loopCount; i++ { voterSet := SelectVoter(valSet, hash, genDoc.VoterParams) for _, voter := range voterSet.Voters { - accumulation[voter.Address.String()] += voter.StakingPower + accumulation[voter.Address.String()] += voter.VotingPower } proposer := valSet.SelectProposer(hash, int64(i), 0) message := MakeRoundHash(hash, int64(i), 0) @@ -431,8 +431,8 @@ func findLargestStakingPowerGap(b *testing.B, loopCount int, minMaxRate int, max largestGap := float64(0) for _, val := range valSet.Validators { acc := accumulation[val.Address.String()] / int64(loopCount) - if math.Abs(float64(val.StakingPower-acc))/float64(val.StakingPower) > largestGap { - largestGap = math.Abs(float64(val.StakingPower-acc)) / float64(val.StakingPower) + if math.Abs(float64(val.VotingPower-acc))/float64(val.VotingPower) > largestGap { + largestGap = math.Abs(float64(val.VotingPower-acc)) / float64(val.VotingPower) } } b.Logf("<< min power=100, max power=%d, actual average voters=%d, max voters=%d >> largest gap: %f", @@ -502,7 +502,7 @@ func TestVoterSetProtoBuf(t *testing.T) { } } -func testVotingPower(t *testing.T, valSet *ValidatorSet) { +func testStakingPower(t *testing.T, valSet *ValidatorSet) { voterParams := &VoterParams{ VoterElectionThreshold: 100, MaxTolerableByzantinePercentage: 20, @@ -510,7 +510,7 @@ func testVotingPower(t *testing.T, valSet *ValidatorSet) { voterSetNoSampling := SelectVoter(valSet, []byte{0}, voterParams) for _, v := range voterSetNoSampling.Voters { - assert.True(t, v.StakingPower == v.VotingPower) + assert.True(t, v.VotingPower == v.StakingPower) } for i := 90; i > 50; i-- { @@ -518,53 +518,50 @@ func testVotingPower(t *testing.T, valSet *ValidatorSet) { voterSetSampling := SelectVoter(valSet, []byte{0}, voterParams) allSame := true for _, v := range voterSetSampling.Voters { - if v.StakingPower != v.VotingPower { + if v.VotingPower != v.StakingPower { allSame = false break } } assert.False(t, allSame) - assert.True(t, valSet.TotalStakingPower() > voterSetSampling.TotalVotingPower()) - // total voting power can not be less than total staking power - precisionForSelection(1000) - - //TODO: make test code for new voting power - // assert.True(t, valSet.TotalStakingPower()-voterSetSampling.TotalVotingPower() <= 1000) + assert.True(t, valSet.TotalVotingPower() > voterSetSampling.TotalStakingPower()) + assert.True(t, valSet.TotalVotingPower()-voterSetSampling.TotalStakingPower() <= precisionForSelection) } } -func TestVotingPower(t *testing.T) { +func TestStakingPower(t *testing.T) { vals := make([]*Validator, 100) for i := 0; i < len(vals); i++ { vals[i] = newValidator(rand.Bytes(32), 100) } - testVotingPower(t, NewValidatorSet(vals)) + testStakingPower(t, NewValidatorSet(vals)) vals2 := make([]*Validator, 100) for i := 0; i < len(vals2); i++ { - vals2[i] = newValidator(rand.Bytes(32), MaxTotalStakingPower/100) + vals2[i] = newValidator(rand.Bytes(32), MaxTotalVotingPower/100) } - testVotingPower(t, NewValidatorSet(vals2)) + testStakingPower(t, NewValidatorSet(vals2)) } func resetPoints(validators *ValidatorSet) { for _, v := range validators.Validators { - v.VotingPower = 0 + v.StakingPower = 0 } } func isByzantineTolerable(validators []*Validator, tolerableByzantinePercentage int) bool { - totalStakingPower := int64(0) totalVotingPower := int64(0) + totalStakingPower := int64(0) for _, v := range validators { - totalStakingPower += v.StakingPower totalVotingPower += v.VotingPower + totalStakingPower += v.StakingPower } voters := make([]*voter, len(validators)) for i, v := range validators { voters[i] = &voter{val: v} } - tolerableByzantinePower := getTolerableByzantinePower(totalStakingPower, tolerableByzantinePercentage) - topFVotersVotingPower := getTopByzantineVotingPower(voters, tolerableByzantinePower) - return topFVotersVotingPower < totalVotingPower/3 + tolerableByzantinePower := getTolerableByzantinePower(totalVotingPower, tolerableByzantinePercentage) + topFVotersStakingPower := getTopByzantineStakingPower(voters, tolerableByzantinePower) + return topFVotersStakingPower < totalStakingPower/3 } func pickRandomVoter(voters []*Validator) (target *Validator, remain []*Validator) { @@ -592,29 +589,29 @@ func TestElectVotersNonDupByzantineTolerable(t *testing.T) { // this test has no mean if all validators are elected as voters. // So limit the maximum to 15% not to elect all validators as voters tolerableByzantinePercentage := int(rand.Uint() % 15) - tolerableByzantinePower := getTolerableByzantinePower(validatorSet.TotalStakingPower(), tolerableByzantinePercentage) + tolerableByzantinePower := getTolerableByzantinePower(validatorSet.TotalVotingPower(), tolerableByzantinePercentage) voters := electVotersNonDup(validatorSet.Validators, rand.Uint64(), tolerableByzantinePercentage, int(rand.Uint()%100)) - totalVoting := int64(0) + totalStaking := int64(0) for _, v := range voters { - totalVoting += v.VotingPower + totalStaking += v.StakingPower } for i := 0; i < 100; i++ { copied := copyValidatorListShallow(voters) - sumStaking := int64(0) sumVoting := int64(0) + sumStaking := int64(0) for { var one *Validator one, copied = pickRandomVoter(copied) if one == nil { break } - sumStaking += one.StakingPower sumVoting += one.VotingPower - if sumStaking >= tolerableByzantinePower { + sumStaking += one.StakingPower + if sumVoting >= tolerableByzantinePower { break } } - assert.True(t, sumVoting < totalVoting/3) + assert.True(t, sumStaking < totalStaking/3) } } @@ -784,8 +781,8 @@ func TestElectVotersNonDupIncludingZeroStakingPower(t *testing.T) { func TestElectVotersNonDupOverflow(t *testing.T) { number := 98 - candidates := newValidatorSet(number, func(i int) int64 { return MaxTotalStakingPower / int64(number+2) }) - totalPriority := candidates.totalStakingPower + candidates := newValidatorSet(number, func(i int) int64 { return MaxTotalVotingPower / int64(number+2) }) + totalPriority := candidates.totalVotingPower assert.True(t, totalPriority < math.MaxInt64) winners := electVotersNonDup(candidates.Validators, rand.Uint64(), 20, 0) assert.True(t, isByzantineTolerable(winners, 20)) @@ -794,8 +791,8 @@ func TestElectVotersNonDupOverflow(t *testing.T) { func accumulateAndResetReward(voters []*Validator, acc map[string]int64) int64 { total := int64(0) for _, v := range voters { - acc[v.Address.String()] += v.VotingPower - total += v.VotingPower + acc[v.Address.String()] += v.StakingPower + total += v.StakingPower } return total } @@ -831,9 +828,9 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { // good condition candidates := newValidatorSet(100, func(i int) int64 { return 1000000 + rand.Int64()&0xFFFFF }) - totalStaking := int64(0) + totalVoting := int64(0) for _, c := range candidates.Validators { - totalStaking += c.StakingPower + totalVoting += c.VotingPower } accumulatedRewards := make(map[string]int64, 100) @@ -845,8 +842,8 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { for i := 0; i < 99; i++ { rewardRate := float64(accumulatedRewards[candidates.Validators[i].Address.String()]) / float64(totalAccumulateRewards) - stakingRate := float64(candidates.Validators[i].StakingPower) / float64(totalStaking) - rate := rewardRate / stakingRate + votingRate := float64(candidates.Validators[i].VotingPower) / float64(totalVoting) + rate := rewardRate / votingRate rewardPerStakingDiff := math.Abs(1 - rate) b.Log("rewardPerStakingDiff", rewardPerStakingDiff) // @@ -871,7 +868,7 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { for i := 0; i < 99; i++ { rewardPerStakingDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ - float64(candidates.Validators[i].StakingPower)/float64(loopCount) - 1) + float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) if maxRewardPerStakingDiff < rewardPerStakingDiff { maxRewardPerStakingDiff = rewardPerStakingDiff } @@ -889,7 +886,7 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { for i := 0; i < 99; i++ { rewardPerStakingDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ - float64(candidates.Validators[i].StakingPower)/float64(loopCount) - 1) + float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) if maxRewardPerStakingDiff < rewardPerStakingDiff { maxRewardPerStakingDiff = rewardPerStakingDiff } @@ -907,7 +904,7 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { for i := 0; i < 99; i++ { rewardPerStakingDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ - float64(candidates.Validators[i].StakingPower)/float64(loopCount) - 1) + float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) if maxRewardPerStakingDiff < rewardPerStakingDiff { maxRewardPerStakingDiff = rewardPerStakingDiff } @@ -926,7 +923,7 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { for i := 0; i < 99; i++ { rewardPerStakingDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ - float64(candidates.Validators[i].StakingPower)/float64(loopCount) - 1) + float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) if maxRewardPerStakingDiff < rewardPerStakingDiff { maxRewardPerStakingDiff = rewardPerStakingDiff } @@ -936,20 +933,20 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { func newValidatorSet(length int, prio func(int) int64) *ValidatorSet { validators := make([]*Validator, length) - totalStakingPower := int64(0) + totalVotingPower := int64(0) for i := 0; i < length; i++ { - stakingPower := prio(i) + votingPower := prio(i) validators[i] = &Validator{ Address: crypto.AddressHash([]byte(strconv.Itoa(i))), - StakingPower: stakingPower, - VotingPower: 0, + VotingPower: votingPower, + StakingPower: 0, } - totalStakingPower += stakingPower + totalVotingPower += votingPower } return &ValidatorSet{ - Validators: validators, - totalStakingPower: totalStakingPower, + Validators: validators, + totalVotingPower: totalVotingPower, } } @@ -967,10 +964,10 @@ func sameVoters(c1 []*Validator, c2 []*Validator) bool { if bytes.Compare(c1[i].Address.Bytes(), c2[i].Address.Bytes()) == 1 { return false } - if c1[i].StakingPower != c2[i].StakingPower { + if c1[i].VotingPower != c2[i].VotingPower { return false } - if c1[i].VotingPower != c2[i].VotingPower { + if c1[i].StakingPower != c2[i].StakingPower { return false } } @@ -998,7 +995,7 @@ func BenchmarkElectVotersNonDup(b *testing.B) { if !isByzantineTolerable(winners, 30) { for i, v := range winners { - fmt.Printf("%d: voting power: %d, staking power: %d\n", i, v.VotingPower, v.StakingPower) + fmt.Printf("%d: staking power: %d, voting power: %d\n", i, v.StakingPower, v.VotingPower) } break } @@ -1006,9 +1003,9 @@ func BenchmarkElectVotersNonDup(b *testing.B) { } } -func TestElectVotersNonDupStaticVotingPower(t *testing.T) { +func TestElectVotersNonDupStaticStakingPower(t *testing.T) { candidates := newValidatorSet(5, func(i int) int64 { return 10 }) - expectedVotingPower := []int64{ + expectedStakingPower := []int64{ 13, 11, 10, @@ -1021,7 +1018,7 @@ func TestElectVotersNonDupStaticVotingPower(t *testing.T) { assert.True(t, isByzantineTolerable(voters, byzantinePercent)) for i, voter := range voters { - assert.True(t, expectedVotingPower[i] == voter.VotingPower) + assert.True(t, expectedStakingPower[i] == voter.StakingPower) } } @@ -1030,7 +1027,7 @@ func TestElectVoter(t *testing.T) { validators := newValidatorSet(10, func(i int) int64 { return int64(i + 1) }) total := int64(0) for _, val := range validators.Validators { - total += val.StakingPower + total += val.VotingPower } seed := uint64(0) @@ -1039,7 +1036,7 @@ func TestElectVoter(t *testing.T) { // if fail to voting, panic for i := range validators.Validators { idx, winner := electVoter(&seed, candidates, i, total) - total -= winner.StakingPower + total -= winner.VotingPower moveWinnerToLast(candidates, idx) } } @@ -1076,7 +1073,7 @@ func TestElectVotersNonDupValidatorsNotSorting(t *testing.T) { assert.True(t, sameVoters(winners, shuffledWinners)) } -func TestElectVotersNonDupVotingPower(t *testing.T) { +func TestElectVotersNonDupStakingPower(t *testing.T) { validators := newValidatorSet(100, func(i int) int64 { return 1000 }) @@ -1088,7 +1085,7 @@ func TestElectVotersNonDupVotingPower(t *testing.T) { totalWinPoint := new(big.Int) for n := 0; n < len(winners); n++ { for i := range winPoints { - winPoint := big.NewInt(validators.totalStakingPower - total + 1000) + winPoint := big.NewInt(validators.totalVotingPower - total + 1000) winPoint.Div(big.NewInt(1000*precisionForSelection), winPoint) totalWinPoint.Add(totalWinPoint, winPoint) winPoints[i] = new(big.Int).Add(winPoints[i], winPoint) @@ -1100,16 +1097,16 @@ func TestElectVotersNonDupVotingPower(t *testing.T) { for i, w := range winners { winPoint := new(big.Int).Mul(winPoints[i], big.NewInt(precisionForSelection)) - votingPower := new(big.Int).Mul(winPoint, big.NewInt(validators.totalStakingPower)) + votingPower := new(big.Int).Mul(winPoint, big.NewInt(validators.totalVotingPower)) votingPower.Div(votingPower, totalWinPoint) votingPower.Div(votingPower, big.NewInt(precisionCorrectionForSelection)) - assert.True(t, w.VotingPower == votingPower.Int64()) + assert.True(t, w.StakingPower == votingPower.Int64()) } } func TestElectVotersNonDupWithOverflow(t *testing.T) { - expectedPanic := "Total staking power should be guarded to not exceed" + expectedPanic := "Total voting power should be guarded to not exceed" validators := newValidatorSet(101, func(i int) int64 { return math.MaxInt64 / 100 }) @@ -1122,7 +1119,7 @@ func TestElectVotersNonDupWithOverflow(t *testing.T) { t.Fatal("panic expected, but doesn't panic") } }() - validators.updateTotalStakingPower() // it will be panic + validators.updateTotalVotingPower() // it will be panic // electVotersNonDup does not call updateTotalStakingPower() any more electVotersNonDup(validators.Validators, 0, 30, 0) } @@ -1156,7 +1153,7 @@ func TestElectVoterPanic(t *testing.T) { validators := newValidatorSet(10, func(i int) int64 { return int64(i + 1) }) total := int64(0) for _, val := range validators.Validators { - total += val.StakingPower + total += val.VotingPower } seed := uint64(0) @@ -1175,23 +1172,23 @@ func TestElectVoterPanic(t *testing.T) { }() for i := 0; i < 11; i++ { idx, winner := electVoter(&seed, candidates, i, total) - total -= winner.StakingPower + total -= winner.VotingPower moveWinnerToLast(candidates, idx) } } -func newVotersWithRandomVotingPowerDescending(seed, max, numerator, stakingPower int64) []*voter { +func newVotersWithRandomStakingPowerDescending(seed, max, numerator, votingPower int64) []*voter { voters := make([]*voter, 0) // random voters descending random := int64(0) rand.Seed(seed) - for votingPower := max; votingPower > 0; votingPower -= random { + for stakingPower := max; stakingPower > 0; stakingPower -= random { random = rand.Int63n(max/numerator) + 1 voters = append(voters, &voter{ val: &Validator{ - StakingPower: stakingPower, VotingPower: votingPower, + StakingPower: stakingPower, }, }) } @@ -1202,7 +1199,7 @@ func TestSortVoters(t *testing.T) { for n := int64(0); n < 100; n++ { // random voters descending - voters := newVotersWithRandomVotingPowerDescending(n, 100000, 100, 10) + voters := newVotersWithRandomStakingPowerDescending(n, 100000, 100, 10) // shuffle the voters shuffled := make([]*voter, len(voters)) @@ -1214,9 +1211,9 @@ func TestSortVoters(t *testing.T) { sortVoters(shuffled) for i := range shuffled { - assert.True(t, shuffled[i].val.VotingPower == voters[i].val.VotingPower) + assert.True(t, shuffled[i].val.StakingPower == voters[i].val.StakingPower) if i > 0 { - assert.True(t, shuffled[i-1].val.VotingPower >= voters[i].val.VotingPower) + assert.True(t, shuffled[i-1].val.StakingPower >= voters[i].val.StakingPower) } } } @@ -1231,19 +1228,19 @@ func TestSortVotersWithSameValue(t *testing.T) { random := int64(0) rand.Seed(int64(n)) n := 0 - for votingPower := int64(100000); votingPower > 0; votingPower -= random { + for stakingPower := int64(100000); stakingPower > 0; stakingPower -= random { random = rand.Int63n(100000/100) + 1 voters = append(voters, &voter{ val: &Validator{ - StakingPower: 10, - VotingPower: votingPower, + VotingPower: 10, + StakingPower: stakingPower, Address: []byte(strconv.Itoa(n)), }, }) voters = append(voters, &voter{ val: &Validator{ - StakingPower: 10, - VotingPower: votingPower, + VotingPower: 10, + StakingPower: stakingPower, Address: []byte(strconv.Itoa(n + 1)), }, }) @@ -1263,7 +1260,7 @@ func TestSortVotersWithSameValue(t *testing.T) { a := shuffled[i].val b := voters[i].val assert.True(t, bytes.Equal(a.Address, b.Address)) - assert.True(t, a.VotingPower == b.VotingPower) + assert.True(t, a.StakingPower == b.StakingPower) } } } From 3c086058e790c37a890ec2e4dbcdbb02881b1559 Mon Sep 17 00:00:00 2001 From: tnasu Date: Thu, 28 Jul 2022 15:20:58 +0900 Subject: [PATCH 2/5] Modify from StakingPower to VotingWeight --- abci/types/types.pb.go | 384 +++++++++++++-------------- consensus/reactor_test.go | 46 ++-- consensus/state.go | 14 +- consensus/state_test.go | 24 +- evidence/verify.go | 14 +- evidence/verify_test.go | 14 +- light/detector.go | 4 +- light/errors.go | 2 +- light/helpers_test.go | 4 +- light/verifier.go | 2 +- light/verifier_test.go | 8 +- proto/ostracon/abci/types.proto | 6 +- proto/ostracon/types/evidence.pb.go | 92 +++---- proto/ostracon/types/evidence.proto | 8 +- proto/ostracon/types/validator.pb.go | 71 ++--- proto/ostracon/types/validator.proto | 6 +- proto/ostracon/types/voter.pb.go | 56 ++-- proto/ostracon/types/voter.proto | 4 +- rpc/core/consensus.go | 2 +- state/execution_test.go | 4 +- state/state.go | 8 +- state/state_test.go | 42 +-- test/e2e/tests/validator_test.go | 6 +- types/evidence.go | 18 +- types/evidence_test.go | 8 +- types/protobuf.go | 2 +- types/validator.go | 18 +- types/validator_set.go | 6 +- types/validator_set_test.go | 14 +- types/vote_set.go | 10 +- types/voter_set.go | 173 ++++++------ types/voter_set_test.go | 176 ++++++------ 32 files changed, 625 insertions(+), 621 deletions(-) diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index f45aaee0f..4a0c642e6 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -3061,7 +3061,7 @@ type Validator struct { // PubKey pub_key = 2 [(gogoproto.nullable)=false]; Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` // *** Ostracon Extended Fields *** - StakingPower int64 `protobuf:"varint,1000,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` + VotingWeight int64 `protobuf:"varint,1000,opt,name=voting_weight,json=votingWeight,proto3" json:"voting_weight,omitempty"` } func (m *Validator) Reset() { *m = Validator{} } @@ -3111,9 +3111,9 @@ func (m *Validator) GetPower() int64 { return 0 } -func (m *Validator) GetStakingPower() int64 { +func (m *Validator) GetVotingWeight() int64 { if m != nil { - return m.StakingPower + return m.VotingWeight } return 0 } @@ -3440,188 +3440,188 @@ func init() { func init() { proto.RegisterFile("ostracon/abci/types.proto", fileDescriptor_addf585b2317eb36) } var fileDescriptor_addf585b2317eb36 = []byte{ - // 2890 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0xcb, 0x73, 0x23, 0xe5, - 0x11, 0xd7, 0xfb, 0xd1, 0xb6, 0x64, 0xf9, 0x5b, 0xb3, 0xab, 0x9d, 0x05, 0x7b, 0x33, 0x0b, 0x01, - 0x36, 0x60, 0xc3, 0x2e, 0x81, 0x40, 0x02, 0x41, 0xd6, 0x0a, 0xe4, 0xd8, 0x6b, 0x7b, 0xc7, 0x62, - 0x29, 0x5e, 0x19, 0x46, 0xa3, 0xcf, 0xd2, 0xc4, 0xd2, 0xcc, 0xa0, 0xf9, 0x64, 0xec, 0xdc, 0x92, - 0x54, 0xaa, 0x52, 0x9c, 0xa8, 0x4a, 0x55, 0x6e, 0xfc, 0x1f, 0x39, 0xa4, 0x2a, 0xc7, 0x70, 0xe4, - 0x98, 0x13, 0x49, 0xb1, 0x87, 0x3c, 0xee, 0xa9, 0x54, 0x2e, 0x49, 0xea, 0x7b, 0xcc, 0xd3, 0x33, - 0x23, 0x2d, 0xe4, 0x96, 0xdb, 0x74, 0x7f, 0xdd, 0x3d, 0xdf, 0xa3, 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c, 0x62, 0x58, 0x66, 0xb3, 0xc0, 0xf4, 0x36, 0xe2, 0xf5, 0x8e, 0x30, 0x39, 0x60, 0x62, 0xdd, - 0x8c, 0x52, 0x75, 0x5c, 0x82, 0x5a, 0x30, 0x4c, 0x83, 0xa8, 0xfa, 0x48, 0x33, 0xcc, 0x66, 0x31, - 0xcd, 0xc2, 0x8e, 0x69, 0x90, 0x36, 0x15, 0xa3, 0x16, 0x0c, 0x97, 0xa0, 0x4b, 0xfd, 0x68, 0x86, - 0xa7, 0xe7, 0xcd, 0x52, 0xda, 0x52, 0xef, 0x51, 0x11, 0xba, 0x54, 0x26, 0x8b, 0xda, 0xb0, 0xd4, - 0xc7, 0x43, 0xc3, 0x54, 0xfb, 0x63, 0x4b, 0x3f, 0x69, 0x96, 0x99, 0xea, 0xf5, 0x78, 0xd5, 0x6d, - 0x2a, 0xb8, 0x4d, 0xe5, 0xba, 0x19, 0x05, 0xfa, 0x1e, 0x85, 0x5e, 0x81, 0x8a, 0x3e, 0xc2, 0xfa, - 0x89, 0x4a, 0xce, 0x9a, 0x15, 0x66, 0xe1, 0xb1, 0x78, 0x0b, 0x6d, 0x2a, 0xd5, 0x3b, 0xeb, 0x66, - 0x94, 0xb2, 0xce, 0x1f, 0xe9, 0xba, 0x07, 0x78, 0x6c, 0x9c, 0xe2, 0x29, 0xd5, 0xae, 0xa6, 0xad, - 0xfb, 0x0e, 0x97, 0x63, 0xfa, 0xd5, 0x81, 0x4b, 0xa0, 0x57, 0xa1, 0x8a, 0xcd, 0x81, 0x58, 0x00, - 0x30, 0x03, 0xeb, 0x09, 0x9e, 0x61, 0x0e, 0xdc, 0xe9, 0x57, 0xb0, 0x78, 0x46, 0x2f, 0x42, 0x49, - 0xb7, 0x26, 0x13, 0x83, 0x34, 0x97, 0x98, 0xee, 0xa3, 0x09, 0x53, 0x67, 0x32, 0xdd, 0x8c, 0x22, - 0xa4, 0xd1, 0x1e, 0xd4, 0xc7, 0x86, 0x43, 0x54, 0xc7,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91, 0x0f, 0xa1, 0x1e, 0x4e, - 0x34, 0xa8, 0x0e, 0x39, 0x72, 0x26, 0x96, 0x9e, 0x23, 0x67, 0x68, 0x13, 0x0a, 0x74, 0x81, 0x6c, - 0xd9, 0xf5, 0x0b, 0x99, 0x5d, 0x68, 0xf5, 0xce, 0x6d, 0xac, 0x30, 0x39, 0x59, 0xf6, 0x6e, 0x80, - 0x97, 0x7c, 0xa2, 0x36, 0xe5, 0xa7, 0x61, 0x25, 0x92, 0x5f, 0x02, 0xe7, 0x96, 0x0d, 0x9e, 0x9b, - 0xbc, 0x02, 0xb5, 0x50, 0x3a, 0x91, 0x2f, 0xc3, 0x5a, 0x5c, 0x7e, 0x90, 0x8f, 0x3d, 0x7e, 0x28, - 0xd2, 0xa3, 0xdb, 0x50, 0xf1, 0x12, 0x04, 0xbf, 0x81, 0xd1, 0x7d, 0x72, 0x45, 0x15, 0x4f, 0x90, - 0x5e, 0x3c, 0xea, 0xcc, 0xcc, 0x0b, 0x72, 0x6c, 0xda, 0x65, 0xcd, 0xb6, 0xbb, 0x9a, 0x33, 0x92, - 0x3f, 0x84, 0x66, 0x52, 0xf8, 0x8f, 0x2c, 0xa2, 0xe0, 0x39, 0xdf, 0x65, 0x28, 0x1d, 0x5b, 0xd3, - 0x89, 0x46, 0x98, 0xb1, 0x9a, 0x22, 0x28, 0xea, 0x94, 0x3c, 0x15, 0xe4, 0x19, 0x9b, 0x13, 0xb2, - 0x0a, 0x57, 0x13, 0x93, 0x00, 0x55, 0x31, 0xcc, 0x01, 0xe6, 0xbb, 0x59, 0x53, 0x38, 0xe1, 0x1b, - 0xe2, 0x93, 0xe5, 0x04, 0x7d, 0xad, 0x83, 0x4d, 0xea, 0xb3, 0x79, 0x76, 0x43, 0x04, 0x25, 0xdf, - 0x85, 0x47, 0x62, 0x53, 0x41, 0xc0, 0xc9, 0xb3, 0x8b, 0x3b, 0xb9, 0xfc, 0x2c, 0x5c, 0x8a, 0x49, - 0x04, 0x89, 0x27, 0xfa, 0x97, 0x2a, 0x54, 0x14, 0xec, 0xd8, 0x34, 0x0a, 0xa1, 0xd7, 0xa1, 0x8a, - 0xcf, 0x74, 0xcc, 0x41, 0x60, 0x36, 0x01, 0x4a, 0x71, 0xd9, 0x8e, 0x2b, 0x47, 0xb1, 0x8c, 0xa7, - 0x84, 0x9e, 0x17, 0x00, 0x37, 0x09, 0xad, 0x0a, 0xe5, 0x20, 0xc2, 0x7d, 0xc1, 0x45, 0xb8, 0xf9, - 0x04, 0xf8, 0xc2, 0x75, 0x22, 0x10, 0xf7, 0x79, 0x01, 0x71, 0x0b, 0xa9, 0x2f, 0x0a, 0x61, 0xdc, - 0x56, 0x08, 0xe3, 0x16, 0x53, 0x97, 0x97, 0x00, 0x72, 0x5b, 0x21, 0x90, 0x5b, 0x4a, 0x35, 0x91, - 0x80, 0x72, 0x5f, 0x70, 0x51, 0x6e, 0x39, 0x75, 0xb9, 0x11, 0x98, 0x7b, 0x27, 0x0c, 0x73, 0x39, - 0x48, 0xfd, 0x56, 0x82, 0x6e, 0x22, 0xce, 0xfd, 0x7e, 0x00, 0xe7, 0x56, 0x13, 0x80, 0x26, 0x37, - 0x11, 0x03, 0x74, 0x5b, 0x21, 0xa0, 0x0b, 0xa9, 0x6b, 0x4f, 0x40, 0xba, 0xaf, 0x05, 0x91, 0xee, - 0x52, 0x02, 0x54, 0x16, 0x2e, 0x12, 0x07, 0x75, 0x5f, 0xf2, 0xa0, 0xee, 0x72, 0x02, 0x4a, 0x17, - 0xb3, 0x8f, 0x62, 0xdd, 0xbb, 0x17, 0xb0, 0x6e, 0x2d, 0x01, 0x93, 0x71, 0x03, 0x73, 0xc0, 0xee, - 0xdd, 0x0b, 0x60, 0xb7, 0x9e, 0x6a, 0x6e, 0x0e, 0xda, 0x7d, 0x37, 0x1e, 0xed, 0x26, 0x21, 0x52, - 0x31, 0xc5, 0xc5, 0xe0, 0xee, 0x07, 0x09, 0x70, 0xb7, 0xc1, 0x8c, 0x3f, 0x9d, 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0x18, 0xd0, 0x06, 0x83, - 0x29, 0x76, 0x1c, 0xb1, 0x32, 0x97, 0x64, 0x5d, 0x52, 0xeb, 0x63, 0xd1, 0x30, 0xca, 0x2b, 0x9c, - 0x40, 0x8f, 0x43, 0xcd, 0x21, 0xda, 0x89, 0x61, 0x0e, 0x55, 0x3e, 0xca, 0xea, 0xad, 0xbc, 0xb2, - 0x2c, 0xb8, 0x87, 0x94, 0x29, 0xf7, 0x61, 0x25, 0x92, 0x1e, 0xd1, 0xcb, 0x50, 0xb6, 0x67, 0x7d, - 0xd5, 0xdd, 0xc2, 0xd0, 0xa5, 0x72, 0x21, 0xe4, 0xac, 0x3f, 0x36, 0xf4, 0x5d, 0x7c, 0xee, 0x4e, - 0xd8, 0x9e, 0xf5, 0x77, 0xf9, 0x3e, 0xf3, 0x77, 0xe5, 0x02, 0x33, 0x91, 0x09, 0x54, 0x5c, 0xa7, - 0x41, 0x3f, 0x08, 0xde, 0x20, 0x6e, 0xbe, 0x99, 0x94, 0xae, 0x85, 0xf1, 0xc0, 0x05, 0xba, 0x09, - 0xab, 0x8e, 0x31, 0x34, 0xf1, 0x40, 0xf5, 0x0b, 0x16, 0xf6, 0xae, 0x8a, 0xb2, 0xc2, 0x07, 0xf6, - 0xdc, 0x6a, 0x45, 0xfe, 0x57, 0x16, 0x2a, 0xee, 0x45, 0x46, 0x5b, 0x01, 0xaf, 0xac, 0x5f, 0x68, - 0x03, 0xb9, 0x62, 0x7e, 0x43, 0x34, 0x3c, 0xcf, 0xdc, 0xc3, 0xce, 0x33, 0xa9, 0x9f, 0xed, 0x7e, - 0x54, 0x28, 0x3c, 0xf4, 0x47, 0x85, 0x67, 0x00, 0x11, 0x8b, 0x68, 0x63, 0xf5, 0xd4, 0x22, 0xfe, - 0x91, 0x72, 0xb4, 0xd6, 0x60, 0x23, 0xf7, 0xd9, 0x00, 0x3f, 0xd5, 0x9f, 0x67, 0xa1, 0xe2, 0x65, - 0xe0, 0x87, 0xed, 0x6f, 0x5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, 0x9e, 0xf9, - 0xe3, 0x83, 0xf5, 0xcc, 0xbb, 0x37, 0x86, 0x06, 0x19, 0xcd, 0xfa, 0x9b, 0xba, 0x35, 0xd9, 0x1a, - 0x1b, 0x26, 0xde, 0x8a, 0xf9, 0xa9, 0xab, 0x5f, 0x62, 0xc9, 0xf1, 0xf6, 0x7f, 0x03, 0x00, 0x00, - 0xff, 0xff, 0x6e, 0x64, 0x33, 0xdc, 0xf2, 0x25, 0x00, 0x00, + // 2892 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0xcd, 0x73, 0xdb, 0xd6, + 0x11, 0xe7, 0xf7, 0xc7, 0x4a, 0xa4, 0xa8, 0x67, 0xc5, 0xa6, 0xe1, 0x44, 0x72, 0xe1, 0xa4, 0x49, + 0xdc, 0x44, 0x4a, 0xec, 0x34, 0x69, 0xd2, 0x26, 0x0d, 0x45, 0x33, 0xa1, 0x2a, 0x59, 0x92, 0x21, + 0xc6, 0x9e, 0x7c, 0x15, 0x01, 0xc1, 0x27, 0x12, 0x35, 0x09, 0x20, 0xc4, 0xa3, 0x2c, 0xf5, 0xd6, + 0x76, 0x3a, 0xd3, 0xc9, 0x29, 0x33, 0x9d, 0xe9, 0x2d, 0xff, 0x47, 0x0f, 0x9d, 0xe9, 0xb1, 0x39, + 0xe6, 0xd8, 0x53, 0xda, 0x89, 0x0f, 0xfd, 0xb8, 0x77, 0x3a, 0xbd, 0xb4, 0x9d, 0xf7, 0x81, 0x4f, + 0x01, 0x20, 0x9d, 0xf4, 0xd6, 0x1b, 0xde, 0xbe, 0xdd, 0xc5, 0x7b, 0xfb, 0xf6, 0xed, 0xfe, 0x76, + 0x01, 0xb8, 0x6c, 0x39, 0x64, 0xaa, 0xe9, 0x96, 0xb9, 0xa5, 0xf5, 0x75, 0x63, 0x8b, 0x9c, 0xd9, + 0xd8, 0xd9, 0xb4, 0xa7, 0x16,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0xb1, 0x8c, 0x27, 0x84, 0x5e, 0x14, 0x00, 0x37, 0x09, 0xad, 0x0a, 0xe1, 0x20, 0xc2, 0x7d, 0xc9, + 0x45, 0xb8, 0xf9, 0x04, 0xf8, 0xc2, 0x65, 0x22, 0x10, 0xf7, 0x45, 0x01, 0x71, 0x0b, 0xa9, 0x2f, + 0x0a, 0x61, 0xdc, 0x56, 0x08, 0xe3, 0x16, 0x53, 0xb7, 0x97, 0x00, 0x72, 0x5b, 0x21, 0x90, 0x5b, + 0x4a, 0x55, 0x91, 0x80, 0x72, 0x5f, 0x72, 0x51, 0x6e, 0x39, 0x75, 0xbb, 0x11, 0x98, 0x7b, 0x2b, + 0x0c, 0x73, 0x39, 0x48, 0xfd, 0x56, 0x82, 0x6c, 0x22, 0xce, 0xfd, 0x7e, 0x00, 0xe7, 0x56, 0x13, + 0x80, 0x26, 0x57, 0x11, 0x03, 0x74, 0x5b, 0x21, 0xa0, 0x0b, 0xa9, 0x7b, 0x4f, 0x40, 0xba, 0x6f, + 0x04, 0x91, 0xee, 0x52, 0x02, 0x54, 0x16, 0x2e, 0x12, 0x07, 0x75, 0x5f, 0xf1, 0xa0, 0xee, 0x72, + 0x02, 0x4a, 0x17, 0xab, 0x8f, 0x62, 0xdd, 0xdb, 0xe7, 0xb0, 0x6e, 0x2d, 0x01, 0x93, 0x71, 0x05, + 0x73, 0xc0, 0xee, 0xed, 0x73, 0x60, 0xb7, 0x9e, 0xaa, 0x6e, 0x0e, 0xda, 0x7d, 0x2f, 0x1e, 0xed, + 0x26, 0x21, 0x52, 0xb1, 0xc4, 0xc5, 0xe0, 0xee, 0x87, 0x09, 0x70, 0xb7, 0xc1, 0x94, 0x3f, 0x9b, + 0xa0, 0x7c, 0x61, 0xbc, 0xab, 0x24, 0xe3, 0xdd, 0xa7, 0xd2, 0xbc, 0x33, 0x0d, 0xf0, 0xee, 0x25, + 0x01, 0xde, 0x6b, 0xc9, 0xbe, 0xb2, 0x00, 0xe2, 0x7d, 0x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 0x96, 0x1c, 0x6f, 0xfe, 0x37, + 0x00, 0x00, 0xff, 0xff, 0x07, 0x62, 0x97, 0xcc, 0xf2, 0x25, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -6861,8 +6861,8 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.StakingPower != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.StakingPower)) + if m.VotingWeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.VotingWeight)) i-- dAtA[i] = 0x3e i-- @@ -8303,8 +8303,8 @@ func (m *Validator) Size() (n int) { if m.Power != 0 { n += 1 + sovTypes(uint64(m.Power)) } - if m.StakingPower != 0 { - n += 2 + sovTypes(uint64(m.StakingPower)) + if m.VotingWeight != 0 { + n += 2 + sovTypes(uint64(m.VotingWeight)) } return n } @@ -14836,9 +14836,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } case 1000: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingWeight", wireType) } - m.StakingPower = 0 + m.VotingWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -14848,7 +14848,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingPower |= int64(b&0x7F) << shift + m.VotingWeight |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index cde927b65..c1185f55b 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -318,12 +318,12 @@ func TestReactorRecordsVotesAndBlockParts(t *testing.T) { //------------------------------------------------------------- // ensure we can make blocks despite cycling a validator set -func TestReactorStakingPowerChange(t *testing.T) { +func TestReactorVotingWeightChange(t *testing.T) { nVals := 4 logger := log.TestingLogger() css, cleanup := randConsensusNet( nVals, - "consensus_voting_power_changes_test", + "consensus_voting_weight_changes_test", newMockTickerFunc(true), newPersistentKVStore) defer cleanup() @@ -345,7 +345,7 @@ func TestReactorStakingPowerChange(t *testing.T) { }, css) //--------------------------------------------------------------------------- - logger.Debug("---------------------------- Testing changing the voting power of one validator a few times") + logger.Debug("---------------------------- Testing changing the voting weight of one validator a few times") val1PubKey, err := css[0].privValidator.GetPubKey() require.NoError(t, err) @@ -353,48 +353,48 @@ func TestReactorStakingPowerChange(t *testing.T) { val1PubKeyABCI, err := cryptoenc.PubKeyToProto(val1PubKey) require.NoError(t, err) updateValidatorTx := kvstore.MakeValSetChangeTx(val1PubKeyABCI, 25) - previousTotalVotingPower := css[0].GetRoundState().LastVoters.TotalStakingPower() + previousTotalVotingWeight := css[0].GetRoundState().LastVoters.TotalVotingWeight() waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlockWithTx(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) - if css[0].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { + if css[0].GetRoundState().LastVoters.TotalVotingWeight() == previousTotalVotingWeight { t.Fatalf( - "expected voting power to change (before: %d, after: %d)", - previousTotalVotingPower, - css[0].GetRoundState().LastVoters.TotalStakingPower()) + "expected voting weight to change (before: %d, after: %d)", + previousTotalVotingWeight, + css[0].GetRoundState().LastVoters.TotalVotingWeight()) } updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 2) - previousTotalVotingPower = css[0].GetRoundState().LastVoters.TotalStakingPower() + previousTotalVotingWeight = css[0].GetRoundState().LastVoters.TotalVotingWeight() waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlockWithTx(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) - if css[0].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { + if css[0].GetRoundState().LastVoters.TotalVotingWeight() == previousTotalVotingWeight { t.Fatalf( - "expected voting power to change (before: %d, after: %d)", - previousTotalVotingPower, - css[0].GetRoundState().LastVoters.TotalStakingPower()) + "expected voting weight to change (before: %d, after: %d)", + previousTotalVotingWeight, + css[0].GetRoundState().LastVoters.TotalVotingWeight()) } updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 26) - previousTotalVotingPower = css[0].GetRoundState().LastVoters.TotalStakingPower() + previousTotalVotingWeight = css[0].GetRoundState().LastVoters.TotalVotingWeight() waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlockWithTx(t, nVals, activeVals, blocksSubs, css, updateValidatorTx) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) - if css[0].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { + if css[0].GetRoundState().LastVoters.TotalVotingWeight() == previousTotalVotingWeight { t.Fatalf( - "expected voting power to change (before: %d, after: %d)", - previousTotalVotingPower, - css[0].GetRoundState().LastVoters.TotalStakingPower()) + "expected voting weight to change (before: %d, after: %d)", + previousTotalVotingWeight, + css[0].GetRoundState().LastVoters.TotalVotingWeight()) } } @@ -464,18 +464,18 @@ func TestReactorValidatorSetChanges(t *testing.T) { updatePubKey1ABCI, err := cryptoenc.PubKeyToProto(updateValidatorPubKey1) require.NoError(t, err) updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25) - previousTotalVotingPower := css[nVals].GetRoundState().LastVoters.TotalStakingPower() + previousTotalVotingWeight := css[nVals].GetRoundState().LastVoters.TotalVotingWeight() waitForAndValidateBlock(t, nPeers, activeVals, blocksSubs, css, updateValidatorTx1) waitForAndValidateBlockWithTx(t, nPeers, activeVals, blocksSubs, css, updateValidatorTx1) waitForAndValidateBlock(t, nPeers, activeVals, blocksSubs, css) waitForBlockWithUpdatedValsAndValidateIt(t, nPeers, activeVals, blocksSubs, css) - if css[nVals].GetRoundState().LastVoters.TotalStakingPower() == previousTotalVotingPower { + if css[nVals].GetRoundState().LastVoters.TotalVotingWeight() == previousTotalVotingWeight { t.Errorf( - "expected voting power to change (before: %d, after: %d)", - previousTotalVotingPower, - css[nVals].GetRoundState().LastVoters.TotalStakingPower()) + "expected voting weight to change (before: %d, after: %d)", + previousTotalVotingWeight, + css[nVals].GetRoundState().LastVoters.TotalVotingWeight()) } //--------------------------------------------------------------------------- diff --git a/consensus/state.go b/consensus/state.go index 0843ec50e..299e8dc61 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1788,7 +1788,7 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { cs.metrics.Validators.Set(float64(cs.Validators.Size())) cs.metrics.ValidatorsPower.Set(float64(cs.Validators.TotalVotingPower())) cs.metrics.Voters.Set(float64(cs.Voters.Size())) - cs.metrics.VotersPower.Set(float64(cs.Voters.TotalStakingPower())) + cs.metrics.VotersPower.Set(float64(cs.Voters.TotalVotingWeight())) var ( missingVoters int @@ -1834,14 +1834,14 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { commitSig := block.LastCommit.Signatures[i] if commitSig.Absent() { missingVoters++ - missingVotersPower += val.StakingPower + missingVotersPower += val.VotingWeight } if bytes.Equal(val.Address, address) { label := []string{ "validator_address", val.Address.String(), } - cs.metrics.VoterPower.With(label...).Set(float64(val.StakingPower)) + cs.metrics.VoterPower.With(label...).Set(float64(val.VotingWeight)) selectedAsVoter = true if commitSig.ForBlock() { cs.metrics.VoterLastSignedHeight.With(label...).Set(float64(height)) @@ -1877,7 +1877,7 @@ func (cs *State) recordMetrics(height int64, block *types.Block) { if dve, ok := ev.(*types.DuplicateVoteEvidence); ok { if _, val := cs.Voters.GetByAddress(dve.VoteA.ValidatorAddress); val != nil { byzantineVotersCount++ - byzantineVotersPower += val.StakingPower + byzantineVotersPower += val.VotingWeight } } } @@ -2424,11 +2424,11 @@ func (cs *State) calculatePrevoteMessageDelayMetrics() { return pl[i].Timestamp.Before(pl[j].Timestamp) }) - var votingPowerSeen int64 + var totalVotingWeight int64 for _, v := range pl { _, voter := cs.Voters.GetByAddress(v.ValidatorAddress) - votingPowerSeen += voter.StakingPower - if votingPowerSeen >= cs.Voters.TotalStakingPower()*2/3+1 { + totalVotingWeight += voter.VotingWeight + if totalVotingWeight >= cs.Voters.TotalVotingWeight()*2/3+1 { cs.metrics.QuorumPrevoteMessageDelay.Set(v.Timestamp.Sub(cs.Proposal.Timestamp).Seconds()) break } diff --git a/consensus/state_test.go b/consensus/state_test.go index e511ff9ab..32aeb94f1 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -2110,13 +2110,13 @@ func makeVssMap(vss []*validatorStub) map[string]*validatorStub { } func votersPrivVals(voterSet *types.VoterSet, vssMap map[string]*validatorStub) []*validatorStub { - totalStakingPower := voterSet.TotalStakingPower() - stakingPower := int64(0) + totalVotingWeight := voterSet.TotalVotingWeight() + votingWeight := int64(0) voters := 0 for i, v := range voterSet.Voters { vssMap[v.PubKey.Address().String()].Index = int32(i) // NOTE: re-indexing for new voters - if stakingPower < totalStakingPower*2/3+1 { - stakingPower += v.StakingPower + if votingWeight < totalVotingWeight*2/3+1 { + votingWeight += v.VotingWeight voters++ } } @@ -2233,7 +2233,7 @@ func ensureVotingPowerOfVoteSet(t *testing.T, voteSet *types.VoteSet, votingPowe func TestStateBadVoterWithSelectedVoter(t *testing.T) { // if validators are 9, then selected voters are 4+ // if one of 4+ voters does not vote, the consensus state does not progress to next step - // making him having 1/3 + 1 staking power of total + // making him having 1/3 + 1 voting weight of total cs, vss := randStateWithVoterParams(9, &types.VoterParams{ VoterElectionThreshold: 5, MaxTolerableByzantinePercentage: 20}) @@ -2255,9 +2255,9 @@ func TestStateBadVoterWithSelectedVoter(t *testing.T) { } } - // make the invalid voter having staking power of 1/3+1 of total - cs.Voters.Voters[nonMyIndex].StakingPower = - (cs.Voters.TotalStakingPower()-cs.Voters.Voters[nonMyIndex].StakingPower)/2 + 1 + // make the invalid voter having voting weight of 1/3+1 of total + cs.Voters.Voters[nonMyIndex].VotingWeight = + (cs.Voters.TotalVotingWeight()-cs.Voters.Voters[nonMyIndex].VotingWeight)/2 + 1 voters := cs.Voters.Copy() @@ -2266,7 +2266,7 @@ func TestStateBadVoterWithSelectedVoter(t *testing.T) { PubKey: notVoter.PubKey, Address: notVoter.Address, VotingPower: cs.Voters.Voters[nonMyIndex].VotingPower, - StakingPower: cs.Voters.Voters[nonMyIndex].StakingPower, + VotingWeight: cs.Voters.Voters[nonMyIndex].VotingWeight, } vss[0].Height = 1 // this is needed because of `incrementHeight(vss[1:]...)` of randStateWithVoterParams() @@ -2298,17 +2298,17 @@ func TestStateBadVoterWithSelectedVoter(t *testing.T) { signAddVotes(cs, tmproto.PrevoteType, propBlock.Hash(), propBlock.MakePartSet(types.BlockPartSizeBytes).Header(), voterPrivVals...) - sumStakingPower := int64(0) + sumVotingWeight := int64(0) for i := range voterPrivVals { // one failed if i == nonMyIndex { continue } ensurePrevote(voteCh, height, round) // wait for prevote - sumStakingPower += voters.Voters[i].StakingPower + sumVotingWeight += voters.Voters[i].VotingWeight } // ensure we didn't get a vote for Voters[nonMyIndex] - ensureVotingPowerOfVoteSet(t, cs.Votes.Prevotes(round), sumStakingPower) + ensureVotingPowerOfVoteSet(t, cs.Votes.Prevotes(round), sumVotingWeight) assert.False(t, cs.Votes.Prevotes(round).HasTwoThirdsMajority()) // add remain vote diff --git a/evidence/verify.go b/evidence/verify.go index 78bf4d125..83d4daf2c 100644 --- a/evidence/verify.go +++ b/evidence/verify.go @@ -141,7 +141,7 @@ func VerifyLightClientAttack( } // Assert the correct amount of voting power of the validator set - if evTotal, votersTotal := e.TotalVotingPower, commonVoters.TotalStakingPower(); evTotal != votersTotal { + if evTotal, votersTotal := e.TotalVotingPower, commonVoters.TotalVotingWeight(); evTotal != votersTotal { return fmt.Errorf("total voting power from the evidence and our voter set does not match (%d != %d)", evTotal, votersTotal) } @@ -211,9 +211,9 @@ func VerifyDuplicateVote(e *types.DuplicateVoteEvidence, chainID string, voterSe return fmt.Errorf("validator power from evidence and our voter set does not match (%d != %d)", e.ValidatorPower, val.VotingPower) } - if voterSet.TotalStakingPower() != e.TotalVotingPower { + if voterSet.TotalVotingWeight() != e.TotalVotingPower { return fmt.Errorf("total voting power from the evidence and our voter set does not match (%d != %d)", - e.TotalVotingPower, voterSet.TotalStakingPower()) + e.TotalVotingPower, voterSet.TotalVotingWeight()) } va := e.VoteA.ToProto() @@ -265,15 +265,15 @@ func validateABCIEvidence( if ev.ByzantineValidators[idx].VotingPower != val.VotingPower { return fmt.Errorf( - "evidence contained unexpected byzantine validator staking power; expected %d, got %d", + "evidence contained unexpected byzantine validator voting power; expected %d, got %d", val.VotingPower, ev.ByzantineValidators[idx].VotingPower, ) } - if ev.ByzantineValidators[idx].StakingPower != val.StakingPower { + if ev.ByzantineValidators[idx].VotingWeight != val.VotingWeight { return fmt.Errorf( - "evidence contained unexpected byzantine validator voting power; expected %d, got %d", - val.StakingPower, ev.ByzantineValidators[idx].StakingPower, + "evidence contained unexpected byzantine validator voting weight; expected %d, got %d", + val.VotingWeight, ev.ByzantineValidators[idx].VotingWeight, ) } } diff --git a/evidence/verify_test.go b/evidence/verify_test.go index 33cbced69..d8a3b5fbc 100644 --- a/evidence/verify_test.go +++ b/evidence/verify_test.go @@ -130,7 +130,7 @@ func TestVerifyLightClientAttack_validateABCIEvidence(t *testing.T) { require.Error(t, err) require.Contains(t, err.Error(), "evidence contained an unexpected byzantine validator address;") - // illegal byzantine validator staking power + // illegal byzantine validator voting power phantomVoterSet = types.ToVoterAll(ev.ConflictingBlock.VoterSet.Voters) phantomVoterSet.Voters[0].VotingPower = votingPower + 1 ev.ByzantineValidators = phantomVoterSet.Voters @@ -139,18 +139,18 @@ func TestVerifyLightClientAttack_validateABCIEvidence(t *testing.T) { ev.ConflictingBlock.VoterSet, // Should use correct VoterSet for bls.VerifyAggregatedSignature defaultEvidenceTime.Add(2*time.Hour), 3*time.Hour, types.DefaultVoterParams()) require.Error(t, err) - require.Contains(t, err.Error(), "evidence contained unexpected byzantine validator staking power;") + require.Contains(t, err.Error(), "evidence contained unexpected byzantine validator voting power;") - // illegal byzantine validator voting power + // illegal byzantine validator voting weight phantomVoterSet = types.ToVoterAll(ev.ConflictingBlock.VoterSet.Voters) - phantomVoterSet.Voters[0].StakingPower = votingPower + 1 + phantomVoterSet.Voters[0].VotingWeight = votingPower + 1 ev.ByzantineValidators = phantomVoterSet.Voters err = evidence.VerifyLightClientAttack(ev, common.SignedHeader, trusted.SignedHeader, common.ValidatorSet, ev.ConflictingBlock.VoterSet, // Should use correct VoterSet for bls.VerifyAggregatedSignature defaultEvidenceTime.Add(2*time.Hour), 3*time.Hour, types.DefaultVoterParams()) require.Error(t, err) - require.Contains(t, err.Error(), "evidence contained unexpected byzantine validator voting power;") + require.Contains(t, err.Error(), "evidence contained unexpected byzantine validator voting weight;") } func TestVerify_LunaticAttackAgainstState(t *testing.T) { @@ -222,7 +222,7 @@ func TestVerify_LunaticAttackAgainstState(t *testing.T) { pool, err = evidence.NewPool(dbm.NewMemDB(), stateStore, blockStore) require.NoError(t, err) assert.Error(t, pool.AddEvidence(ev)) - ev.TotalVotingPower = common.VoterSet.TotalStakingPower() + ev.TotalVotingPower = common.VoterSet.TotalVotingWeight() } func TestVerify_ForwardLunaticAttack(t *testing.T) { @@ -643,7 +643,7 @@ func makeLunaticEvidence( VoterSet: conflictingVoters, }, CommonHeight: commonHeight, - TotalVotingPower: commonVoterSet.TotalStakingPower(), + TotalVotingPower: commonVoterSet.TotalVotingWeight(), ByzantineValidators: byzantineValidators, Timestamp: commonTime, } diff --git a/light/detector.go b/light/detector.go index 0a9a58b84..fe95e6d73 100644 --- a/light/detector.go +++ b/light/detector.go @@ -411,11 +411,11 @@ func newLightClientAttackEvidence(conflicted, trusted, common *types.LightBlock) if ev.ConflictingHeaderIsInvalid(trusted.Header) { ev.CommonHeight = common.Height ev.Timestamp = common.Time - ev.TotalVotingPower = common.VoterSet.TotalStakingPower() + ev.TotalVotingPower = common.VoterSet.TotalVotingWeight() } else { ev.CommonHeight = trusted.Height ev.Timestamp = trusted.Time - ev.TotalVotingPower = trusted.VoterSet.TotalStakingPower() + ev.TotalVotingPower = trusted.VoterSet.TotalVotingWeight() } ev.ByzantineValidators = ev.GetByzantineValidators(common.VoterSet, trusted.SignedHeader) return ev diff --git a/light/errors.go b/light/errors.go index a6f08f2ef..c0a069a81 100644 --- a/light/errors.go +++ b/light/errors.go @@ -23,7 +23,7 @@ func (e ErrOldHeaderExpired) Error() string { // ErrNewValSetCantBeTrusted means the new validator set cannot be trusted // because < 1/3rd (+trustLevel+) of the old validator set has signed. type ErrNewValSetCantBeTrusted struct { - Reason types.ErrNotEnoughStakingPowerSigned + Reason types.ErrNotEnoughVotingWeightSigned } func (e ErrNewValSetCantBeTrusted) Error() string { diff --git a/light/helpers_test.go b/light/helpers_test.go index 7b2cf7d4f..587d284d3 100644 --- a/light/helpers_test.go +++ b/light/helpers_test.go @@ -121,7 +121,7 @@ func (pkz privKeys) signHeaderByRate(header *types.Header, voterSet *types.Voter } // Fill in the votes we want. - until := int64(float64(voterSet.TotalStakingPower()) * rate) + until := int64(float64(voterSet.TotalVotingWeight()) * rate) sum := int64(0) for i := 0; i < len(pkz); i++ { _, voter := voterSet.GetByAddress(pkz[i].PubKey().Address()) @@ -131,7 +131,7 @@ func (pkz privKeys) signHeaderByRate(header *types.Header, voterSet *types.Voter vote := makeVote(header, voterSet, pkz[i], blockID) commitSigs[vote.ValidatorIndex] = vote.CommitSig() - sum += voter.StakingPower + sum += voter.VotingWeight if sum > until { break } diff --git a/light/verifier.go b/light/verifier.go index 094769e03..b24e866ab 100644 --- a/light/verifier.go +++ b/light/verifier.go @@ -59,7 +59,7 @@ func VerifyNonAdjacent( err := trustedVoters.VerifyCommitLightTrusting(trustedHeader.ChainID, untrustedHeader.Commit, trustLevel) if err != nil { switch e := err.(type) { - case types.ErrNotEnoughStakingPowerSigned: + case types.ErrNotEnoughVotingWeightSigned: return ErrNewValSetCantBeTrusted{e} default: return e diff --git a/light/verifier_test.go b/light/verifier_test.go index 77db9b6b8..85412ab8f 100644 --- a/light/verifier_test.go +++ b/light/verifier_test.go @@ -138,7 +138,7 @@ func TestVerifyAdjacentHeaders(t *testing.T) { vals, 3 * time.Hour, bTime.Add(2 * time.Hour), - light.ErrInvalidHeader{Reason: types.ErrNotEnoughStakingPowerSigned{Got: 50, Needed: 93}}, + light.ErrInvalidHeader{Reason: types.ErrNotEnoughVotingWeightSigned{Got: 50, Needed: 93}}, "", }, // voters does not match with what we have -> error @@ -327,7 +327,7 @@ func TestVerifyAdjacentHeadersWithVoterSampling(t *testing.T) { 3 * time.Hour, bTime.Add(2 * time.Hour), nil, - "invalid commit -- insufficient staking power", + "invalid commit -- insufficient voting weight", }, // vals does not match with what we have -> error 8: { @@ -457,7 +457,7 @@ func TestVerifyNonAdjacentHeaders(t *testing.T) { vals, 3 * time.Hour, bTime.Add(2 * time.Hour), - light.ErrInvalidHeader{types.ErrNotEnoughStakingPowerSigned{Got: 50, Needed: 93}}, + light.ErrInvalidHeader{types.ErrNotEnoughVotingWeightSigned{Got: 50, Needed: 93}}, "", }, // 3/3 new voters signed, 2/3 old voters present -> no error @@ -493,7 +493,7 @@ func TestVerifyNonAdjacentHeaders(t *testing.T) { lessThanOneThirdVals, 3 * time.Hour, bTime.Add(2 * time.Hour), - light.ErrNewValSetCantBeTrusted{types.ErrNotEnoughStakingPowerSigned{Got: 20, Needed: 46}}, + light.ErrNewValSetCantBeTrusted{types.ErrNotEnoughVotingWeightSigned{Got: 20, Needed: 46}}, "", }, } diff --git a/proto/ostracon/abci/types.proto b/proto/ostracon/abci/types.proto index bb8ff51dd..b8075d0b9 100644 --- a/proto/ostracon/abci/types.proto +++ b/proto/ostracon/abci/types.proto @@ -359,13 +359,13 @@ message Validator { int64 power = 3; // The voting power // *** Ostracon Extended Fields *** - int64 staking_power = 1000; // The staking power + int64 voting_weight = 1000; // The voting weight } // ValidatorUpdate message ValidatorUpdate { ostracon.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; - int64 power = 2; // The staking power + int64 power = 2; // The voting power } // VoteInfo @@ -394,7 +394,7 @@ message Evidence { // Total voting power of the validator set in case the ABCI application does // not store historical validators. // https://github.com/tendermint/tendermint/issues/4581 - int64 total_voting_power = 5; + int64 total_voting_power = 5; // total voting weight } //---------------------------------------- diff --git a/proto/ostracon/types/evidence.pb.go b/proto/ostracon/types/evidence.pb.go index 9ec2e6e54..2ede2ec3b 100644 --- a/proto/ostracon/types/evidence.pb.go +++ b/proto/ostracon/types/evidence.pb.go @@ -120,7 +120,7 @@ type DuplicateVoteEvidence struct { ValidatorPower int64 `protobuf:"varint,4,opt,name=validator_power,json=validatorPower,proto3" json:"validator_power,omitempty"` Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` // *** Ostracon Extended Fields *** - StakingPower int64 `protobuf:"varint,1000,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` + VotingWeight int64 `protobuf:"varint,1000,opt,name=voting_weight,json=votingWeight,proto3" json:"voting_weight,omitempty"` } func (m *DuplicateVoteEvidence) Reset() { *m = DuplicateVoteEvidence{} } @@ -191,9 +191,9 @@ func (m *DuplicateVoteEvidence) GetTimestamp() time.Time { return time.Time{} } -func (m *DuplicateVoteEvidence) GetStakingPower() int64 { +func (m *DuplicateVoteEvidence) GetVotingWeight() int64 { if m != nil { - return m.StakingPower + return m.VotingWeight } return 0 } @@ -329,42 +329,42 @@ func init() { func init() { proto.RegisterFile("ostracon/types/evidence.proto", fileDescriptor_97062afbc223b6b9) } var fileDescriptor_97062afbc223b6b9 = []byte{ - // 551 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,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, 0xad, 0xad, 0x63, 0x87, 0x27, 0xe0, 0x2e, 0xe6, 0xf1, 0x39, - 0xa3, 0x58, 0x75, 0x17, 0x30, 0x8e, 0xc7, 0xd9, 0x0c, 0xdb, 0x1b, 0x97, 0xe7, 0x4a, 0xc2, 0x3b, - 0x58, 0x4b, 0x52, 0x11, 0xf8, 0x08, 0xec, 0x61, 0x1e, 0x45, 0x3c, 0xf6, 0x47, 0x44, 0x72, 0x6a, - 0xb6, 0xa6, 0x57, 0x4f, 0x83, 0xa7, 0x2a, 0x06, 0x07, 0xa0, 0x11, 0x5c, 0x7c, 0x41, 0xb1, 0xa0, - 0x31, 0xf1, 0xf5, 0x44, 0x92, 0xa6, 0xd9, 0x35, 0xfb, 0xbb, 0x47, 0xad, 0x3f, 0xf6, 0x90, 0x13, - 0xde, 0x3d, 0x9d, 0xa6, 0x63, 0xc9, 0x96, 0xd5, 0x54, 0xb6, 0xac, 0xe6, 0x1f, 0x4c, 0xbc, 0xf7, - 0x1e, 0xd4, 0xf3, 0xc9, 0x0d, 0x68, 0x22, 0xe0, 0x6b, 0x50, 0x5b, 0xfb, 0xae, 0x64, 0x0f, 0xcd, - 0x62, 0x0f, 0xfa, 0x0c, 0x57, 0xe4, 0x0b, 0x3d, 0xcd, 0xbb, 0x27, 0x57, 0x0b, 0xcb, 0xb8, 0x5e, - 0x58, 0xc6, 0xcd, 0xc2, 0x32, 0x2e, 0x97, 0x56, 0xe9, 0x7a, 0x69, 0x95, 0xbe, 0x2f, 0xad, 0xd2, - 0xa7, 0x97, 0x21, 0x15, 0xa3, 0x59, 0x60, 0x63, 0x1e, 0x39, 0x8c, 0xc6, 0xc4, 0xd1, 0x5f, 0x7e, - 0x7a, 0xa3, 0xdc, 0xbe, 0x08, 0x82, 0x1d, 0x15, 0x7d, 0xf5, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xd8, - 0xea, 0x65, 0xfe, 0xa3, 0x04, 0x00, 0x00, + // 552 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xf3, 0xd3, 0x2f, 0xdf, 0xf4, 0x87, 0x32, 0xa4, 0xc2, 0x89, 0xc0, 0x89, 0x02, 0x88, + 0x20, 0xc0, 0x96, 0xca, 0x8e, 0x5d, 0x0d, 0xa8, 0x15, 0xca, 0x02, 0x59, 0xa8, 0x48, 0x6c, 0xac, + 0xf1, 0x64, 0xea, 0x8c, 0x3a, 0xf6, 0x58, 0xf1, 0x24, 0x55, 0x79, 0x8a, 0x3e, 0x0b, 0x4f, 0x51, + 0x76, 0x5d, 0xb2, 0x82, 0x2a, 0xd9, 0xf0, 0x18, 0x68, 0xc6, 0xf6, 0x34, 0x35, 0x09, 0x2b, 0x36, + 0x51, 0x7c, 0xce, 0xb9, 0x73, 0xcf, 0x3d, 0x77, 0x6c, 0xf0, 0x90, 0xa7, 0x62, 0x82, 0x30, 0x8f, + 0x1d, 0x71, 0x9e, 0x90, 0xd4, 0x21, 0x33, 0x3a, 0x22, 0x31, 0x26, 0x76, 0x32, 0xe1, 0x82, 0xc3, + 0x9d, 0x82, 0xb6, 0x15, 0xdd, 0x69, 0x85, 0x3c, 0xe4, 0x8a, 0x72, 0xe4, 0xbf, 0x4c, 0xd5, 0xe9, + 0x86, 0x9c, 0x87, 0x8c, 0x38, 0xea, 0x29, 0x98, 0x9e, 0x38, 0x82, 0x46, 0x24, 0x15, 0x28, 0x4a, + 0x72, 0x41, 0xa7, 0xd4, 0x45, 0xfd, 0xe6, 0x9c, 0x55, 0xe2, 0x66, 0x88, 0xd1, 0x11, 0x12, 0x7c, + 0x92, 0xf1, 0xfd, 0x6b, 0x03, 0x34, 0xdf, 0xe5, 0xae, 0xa0, 0x0f, 0xee, 0x8f, 0xa6, 0x09, 0xa3, + 0x18, 0x09, 0xe2, 0xcf, 0xb8, 0x20, 0x7e, 0x61, 0xd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 0x04, 0x00, 0x00, } func (m *Evidence) Marshal() (dAtA []byte, err error) { @@ -461,8 +461,8 @@ func (m *DuplicateVoteEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.StakingPower != 0 { - i = encodeVarintEvidence(dAtA, i, uint64(m.StakingPower)) + if m.VotingWeight != 0 { + i = encodeVarintEvidence(dAtA, i, uint64(m.VotingWeight)) i-- dAtA[i] = 0x3e i-- @@ -686,8 +686,8 @@ func (m *DuplicateVoteEvidence) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovEvidence(uint64(l)) - if m.StakingPower != 0 { - n += 2 + sovEvidence(uint64(m.StakingPower)) + if m.VotingWeight != 0 { + n += 2 + sovEvidence(uint64(m.VotingWeight)) } return n } @@ -1034,9 +1034,9 @@ func (m *DuplicateVoteEvidence) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 1000: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingWeight", wireType) } - m.StakingPower = 0 + m.VotingWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvidence @@ -1046,7 +1046,7 @@ func (m *DuplicateVoteEvidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingPower |= int64(b&0x7F) << shift + m.VotingWeight |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/ostracon/types/evidence.proto b/proto/ostracon/types/evidence.proto index f7bf30d71..64bfe5160 100644 --- a/proto/ostracon/types/evidence.proto +++ b/proto/ostracon/types/evidence.proto @@ -19,12 +19,12 @@ message Evidence { message DuplicateVoteEvidence { ostracon.types.Vote vote_a = 1; ostracon.types.Vote vote_b = 2; - int64 total_voting_power = 3; - int64 validator_power = 4; + int64 total_voting_power = 3; // total voting weight + int64 validator_power = 4; // voting power google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // *** Ostracon Extended Fields *** - int64 staking_power = 1000; + int64 voting_weight = 1000; } // LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. @@ -32,7 +32,7 @@ message LightClientAttackEvidence { ostracon.types.LightBlock conflicting_block = 1; int64 common_height = 2; repeated ostracon.types.Validator byzantine_validators = 3; - int64 total_voting_power = 4; + int64 total_voting_power = 4; // total voting weight google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/ostracon/types/validator.pb.go b/proto/ostracon/types/validator.pb.go index a8c12ff01..052b12135 100644 --- a/proto/ostracon/types/validator.pb.go +++ b/proto/ostracon/types/validator.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ValidatorSet struct { Validators []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` - // Validator proposer = 2; // This field has been removed in Ostracon. + // Validator proposer = 2; // This field has been removed in Ostracon. TotalVotingPower int64 `protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` } @@ -83,7 +83,7 @@ type Validator struct { VotingPower int64 `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` ProposerPriority int64 `protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"` // *** Ostracon Extended Fields *** - StakingPower int64 `protobuf:"varint,1000,opt,name=staking_power,json=stakingPower,proto3" json:"staking_power,omitempty"` + VotingWeight int64 `protobuf:"varint,1000,opt,name=voting_weight,json=votingWeight,proto3" json:"voting_weight,omitempty"` } func (m *Validator) Reset() { *m = Validator{} } @@ -147,9 +147,9 @@ func (m *Validator) GetProposerPriority() int64 { return 0 } -func (m *Validator) GetStakingPower() int64 { +func (m *Validator) GetVotingWeight() int64 { if m != nil { - return m.StakingPower + return m.VotingWeight } return 0 } @@ -215,30 +215,31 @@ func init() { func init() { proto.RegisterFile("ostracon/types/validator.proto", fileDescriptor_eeeaf81579407bf3) } var fileDescriptor_eeeaf81579407bf3 = []byte{ - // 368 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x6e, 0xb2, 0x40, - 0x14, 0xc5, 0x19, 0x35, 0x9a, 0x6f, 0xe4, 0xfb, 0x37, 0xe9, 0x82, 0xb2, 0xa0, 0xd6, 0x74, 0x41, - 0xd2, 0x16, 0x12, 0x5d, 0xb9, 0x75, 0xd3, 0x85, 0x1b, 0x83, 0x89, 0x8b, 0x6e, 0x08, 0xe0, 0x84, - 0x4e, 0x44, 0xef, 0x64, 0x18, 0x34, 0xbc, 0x45, 0x1f, 0xcb, 0xa5, 0xab, 0xa6, 0xab, 0xa6, 0xd1, - 0x4d, 0x1f, 0xa3, 0x11, 0x04, 0x6a, 0xda, 0xa6, 0x3b, 0x38, 0xbf, 0x3b, 0xe7, 0x9e, 0x93, 0x5c, - 0x6c, 0x40, 0x2c, 0x85, 0x17, 0xc0, 0xd2, 0x96, 0x29, 0xa7, 0xb1, 0xbd, 0xf2, 0x22, 0x36, 0xf3, - 0x24, 0x08, 0x8b, 0x0b, 0x90, 0x40, 0xfe, 0x14, 0xdc, 0xca, 0xb8, 0x7e, 0x16, 0x42, 0x08, 0x19, - 0xb2, 0x0f, 0x5f, 0xf9, 0x94, 0xae, 0x97, 0x2e, 0x81, 0x48, 0xb9, 0x04, 0x7b, 0x4e, 0xd3, 0x38, - 0x67, 0xdd, 0x35, 0x56, 0xa7, 0x85, 0xe9, 0x84, 0x4a, 0x32, 0xc0, 0xb8, 0x5c, 0x12, 0x6b, 0xa8, - 0x53, 0x37, 0xdb, 0xbd, 0x73, 0xeb, 0x74, 0x8d, 0x55, 0xbe, 0x70, 0x3e, 0x0c, 0x93, 0x1b, 0x4c, - 0x24, 0x48, 0x2f, 0x72, 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x3c, 0x81, 0xfc, 0x3a, 0x4e, 0xef, 0xca, 0x6f, - 0x66, 0x6a, 0xff, 0x3d, 0x00, 0x00, 0xff, 0xff, 0x68, 0x99, 0x53, 0xcf, 0x70, 0x02, 0x00, 0x00, + // 371 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x3f, 0x6b, 0xfa, 0x40, + 0x18, 0xc7, 0x73, 0x2a, 0xca, 0xef, 0xf4, 0xf7, 0xef, 0xe8, 0x90, 0x66, 0x48, 0xad, 0x74, 0x08, + 0xb4, 0x4d, 0x40, 0x27, 0x57, 0x97, 0x0e, 0x2e, 0x12, 0xc1, 0x42, 0x97, 0x90, 0xc4, 0x23, 0x1e, + 0x46, 0x9f, 0xe3, 0x72, 0x51, 0xf2, 0x2e, 0xfa, 0xb2, 0x1c, 0x9d, 0x4a, 0xa7, 0x52, 0x74, 0xe9, + 0xcb, 0x28, 0x26, 0x26, 0xa9, 0xb4, 0xa5, 0x5b, 0xf2, 0x7c, 0x9e, 0xfb, 0xfe, 0x81, 0x07, 0xeb, + 0x10, 0x49, 0xe1, 0xfa, 0xb0, 0xb4, 0x64, 0xc2, 0x69, 0x64, 0xad, 0xdc, 0x90, 0x4d, 0x5d, 0x09, + 0xc2, 0xe4, 0x02, 0x24, 0x90, 0x3f, 0x39, 0x37, 0x53, 0xae, 0x9d, 0x05, 0x10, 0x40, 0x8a, 0xac, + 0xc3, 0x57, 0xb6, 0xa5, 0x69, 0x85, 0x8a, 0x2f, 0x12, 0x2e, 0xc1, 0x9a, 0xd3, 0x24, 0xca, 0x58, + 0x67, 0x8d, 0x5b, 0x93, 0x5c, 0x74, 0x4c, 0x25, 0xe9, 0x63, 0x5c, 0x98, 0x44, 0x2a, 0x6a, 0x57, + 0x8d, 0x66, 0xf7, 0xdc, 0x3c, 0xb5, 0x31, 0x8b, 0x17, 0xf6, 0x87, 0x65, 0x72, 0x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cf, 0xf4, 0x61, 0x61, 0x85, 0x6c, 0x49, 0xad, 0xe2, 0x04, 0xb2, 0xeb, 0x38, 0xbd, + 0x2b, 0xaf, 0x9e, 0x4e, 0x7b, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x79, 0x1d, 0x26, 0x70, + 0x02, 0x00, 0x00, } func (m *ValidatorSet) Marshal() (dAtA []byte, err error) { @@ -303,8 +304,8 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.StakingPower != 0 { - i = encodeVarintValidator(dAtA, i, uint64(m.StakingPower)) + if m.VotingWeight != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.VotingWeight)) i-- dAtA[i] = 0x3e i-- @@ -427,8 +428,8 @@ func (m *Validator) Size() (n int) { if m.ProposerPriority != 0 { n += 1 + sovValidator(uint64(m.ProposerPriority)) } - if m.StakingPower != 0 { - n += 2 + sovValidator(uint64(m.StakingPower)) + if m.VotingWeight != 0 { + n += 2 + sovValidator(uint64(m.VotingWeight)) } return n } @@ -694,9 +695,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } case 1000: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingWeight", wireType) } - m.StakingPower = 0 + m.VotingWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowValidator @@ -706,7 +707,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingPower |= int64(b&0x7F) << shift + m.VotingWeight |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/ostracon/types/validator.proto b/proto/ostracon/types/validator.proto index 7adfe895e..d4e57f37f 100644 --- a/proto/ostracon/types/validator.proto +++ b/proto/ostracon/types/validator.proto @@ -8,8 +8,8 @@ import "ostracon/crypto/keys.proto"; message ValidatorSet { repeated Validator validators = 1; - // Validator proposer = 2; // This field has been removed in Ostracon. - int64 total_voting_power = 3; + // Validator proposer = 2; // This field has been removed in Ostracon. + int64 total_voting_power = 3; } message Validator { @@ -19,7 +19,7 @@ message Validator { int64 proposer_priority = 4; // *** Ostracon Extended Fields *** - int64 staking_power = 1000; + int64 voting_weight = 1000; } message SimpleValidator { diff --git a/proto/ostracon/types/voter.pb.go b/proto/ostracon/types/voter.pb.go index e31382755..1a86cb42e 100644 --- a/proto/ostracon/types/voter.pb.go +++ b/proto/ostracon/types/voter.pb.go @@ -24,7 +24,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type VoterSet struct { Voters []*Validator `protobuf:"bytes,1,rep,name=voters,proto3" json:"voters,omitempty"` - TotalStakingPower int64 `protobuf:"varint,2,opt,name=total_staking_power,json=totalStakingPower,proto3" json:"total_staking_power,omitempty"` + TotalVotingWeight int64 `protobuf:"varint,2,opt,name=total_voting_weight,json=totalVotingWeight,proto3" json:"total_voting_weight,omitempty"` } func (m *VoterSet) Reset() { *m = VoterSet{} } @@ -67,9 +67,9 @@ func (m *VoterSet) GetVoters() []*Validator { return nil } -func (m *VoterSet) GetTotalStakingPower() int64 { +func (m *VoterSet) GetTotalVotingWeight() int64 { if m != nil { - return m.TotalStakingPower + return m.TotalVotingWeight } return 0 } @@ -134,26 +134,26 @@ func init() { func init() { proto.RegisterFile("ostracon/types/voter.proto", fileDescriptor_d9565f097e29c5b3) } var fileDescriptor_d9565f097e29c5b3 = []byte{ - // 301 bytes of a gzipped FileDescriptorProto + // 300 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x31, 0x4b, 0xc3, 0x40, 0x18, 0x86, 0x7b, 0x96, 0x16, 0xb9, 0x82, 0x60, 0x04, 0x89, 0x1d, 0xce, 0xd2, 0xa9, 0x8b, 0x09, - 0xea, 0xe2, 0x5c, 0x10, 0x07, 0x97, 0x92, 0x96, 0x0e, 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x24, 0x65, 0xe4, 0x12, 0x49, + 0xdb, 0x5c, 0xbe, 0x81, 0xce, 0x0b, 0x0a, 0x8f, 0x06, 0x6c, 0xd4, 0x4e, 0x4e, 0x3d, 0x9a, 0x79, + 0xf2, 0xec, 0xc1, 0xf0, 0x93, 0xf1, 0x9e, 0xff, 0x6f, 0xa2, 0x9c, 0x2a, 0xab, 0xe0, 0x8e, 0x87, + 0xbe, 0x49, 0x82, 0x81, 0x8c, 0x34, 0x5a, 0x49, 0x85, 0x83, 0xaa, 0x40, 0x33, 0x0f, 0xd9, 0x80, + 0x8d, 0x3a, 0xc9, 0xb9, 0xe7, 0xf7, 0x35, 0x9e, 0x36, 0x34, 0x78, 0xe4, 0xc3, 0x52, 0xad, 0x24, + 0xa1, 0x01, 0xa7, 0x52, 0x03, 0x32, 0x5d, 0xbf, 0x2b, 0x4b, 0xda, 0x82, 0x5c, 0x80, 0xcb, 0xc0, + 0x92, 0xca, 0xc1, 0x1f, 0xd2, 0x49, 0x2e, 0x4b, 0xb5, 0x9a, 0x36, 0xe2, 0xb8, 0xf1, 0x26, 0x7b, + 0x6d, 0xfc, 0xf0, 0xb5, 0x15, 0x6c, 0xb3, 0x15, 0xec, 0x67, 0x2b, 0xd8, 0xc7, 0x4e, 0xb4, 0x36, + 0x3b, 0xd1, 0xfa, 0xde, 0x89, 0xd6, 0xcb, 0x55, 0xae, 0xa9, 0x78, 0x4d, 0xa3, 0x0c, 0xcb, 0xd8, + 0x68, 0x0b, 0xf1, 0x7e, 0x4f, 0xbf, 0x5f, 0x7c, 0x38, 0x6f, 0xda, 0xf5, 0xaf, 0xb7, 0xbf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xeb, 0xe6, 0xa1, 0xc7, 0xa3, 0x01, 0x00, 0x00, } func (m *VoterSet) Marshal() (dAtA []byte, err error) { @@ -176,8 +176,8 @@ func (m *VoterSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TotalStakingPower != 0 { - i = encodeVarintVoter(dAtA, i, uint64(m.TotalStakingPower)) + if m.TotalVotingWeight != 0 { + i = encodeVarintVoter(dAtA, i, uint64(m.TotalVotingWeight)) i-- dAtA[i] = 0x10 } @@ -254,8 +254,8 @@ func (m *VoterSet) Size() (n int) { n += 1 + l + sovVoter(uint64(l)) } } - if m.TotalStakingPower != 0 { - n += 1 + sovVoter(uint64(m.TotalStakingPower)) + if m.TotalVotingWeight != 0 { + n += 1 + sovVoter(uint64(m.TotalVotingWeight)) } return n } @@ -346,9 +346,9 @@ func (m *VoterSet) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalStakingPower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalVotingWeight", wireType) } - m.TotalStakingPower = 0 + m.TotalVotingWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVoter @@ -358,7 +358,7 @@ func (m *VoterSet) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalStakingPower |= int64(b&0x7F) << shift + m.TotalVotingWeight |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/ostracon/types/voter.proto b/proto/ostracon/types/voter.proto index 9ecf47009..9f57fb525 100644 --- a/proto/ostracon/types/voter.proto +++ b/proto/ostracon/types/voter.proto @@ -6,8 +6,8 @@ option go_package = "github.com/line/ostracon/proto/ostracon/types"; import "ostracon/types/validator.proto"; message VoterSet { - repeated ostracon.types.Validator voters = 1; - int64 total_staking_power = 2; + repeated ostracon.types.Validator voters = 1; + int64 total_voting_weight = 2; } message VoterParams { diff --git a/rpc/core/consensus.go b/rpc/core/consensus.go index 263bbdbcb..dc38eabb2 100644 --- a/rpc/core/consensus.go +++ b/rpc/core/consensus.go @@ -45,7 +45,7 @@ func Validators(ctx *rpctypes.Context, heightPtr *int64, pagePtr, perPagePtr *in idx, voter := voters.GetByAddress(v[i].Address) if idx >= 0 { votersIndices = append(votersIndices, int32(i)) - v[i] = voter // replace to preserve its StakingPower + v[i] = voter // replace to preserve its VotingWeight } } diff --git a/state/execution_test.go b/state/execution_test.go index aaaa14ce0..3ce00559f 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -136,7 +136,7 @@ func TestBeginBlockByzantineValidators(t *testing.T) { defer proxyApp.Stop() //nolint:errcheck // ignore for tests state, stateDB, privVals := makeState(2, 12) - state.Validators.Validators[0].StakingPower = 10 + state.Validators.Validators[0].VotingWeight = 10 stateStore := sm.NewStore(stateDB) defaultEvidenceTime := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) @@ -162,7 +162,7 @@ func TestBeginBlockByzantineValidators(t *testing.T) { // we don't need to worry about validating the evidence as long as they pass validate basic dve := types.NewMockDuplicateVoteEvidenceWithValidator(3, defaultEvidenceTime, privVal, state.ChainID) dve.ValidatorPower = 1000 - dve.StakingPower = state.Validators.Validators[0].StakingPower + dve.VotingWeight = state.Validators.Validators[0].VotingWeight lcae := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ SignedHeader: &types.SignedHeader{ diff --git a/state/state.go b/state/state.go index 8eaf3406c..5fd80d391 100644 --- a/state/state.go +++ b/state/state.go @@ -306,7 +306,7 @@ func (state State) MakeBlock( // computed value. func MedianTime(commit *types.Commit, voters *types.VoterSet) time.Time { weightedTimes := make([]*tmtime.WeightedTime, len(commit.Signatures)) - totalVotingPower := int64(0) + totalVotingWeight := int64(0) for i, commitSig := range commit.Signatures { if commitSig.Absent() { @@ -315,12 +315,12 @@ func MedianTime(commit *types.Commit, voters *types.VoterSet) time.Time { _, validator := voters.GetByAddress(commitSig.ValidatorAddress) // If there's no condition, TestValidateBlockCommit panics; not needed normally. if validator != nil { - totalVotingPower += validator.StakingPower - weightedTimes[i] = tmtime.NewWeightedTime(commitSig.Timestamp, validator.StakingPower) + totalVotingWeight += validator.VotingWeight + weightedTimes[i] = tmtime.NewWeightedTime(commitSig.Timestamp, validator.VotingWeight) } } - return tmtime.WeightedMedian(weightedTimes, totalVotingPower) + return tmtime.WeightedMedian(weightedTimes, totalVotingWeight) } //------------------------------------------------------------------------ diff --git a/state/state_test.go b/state/state_test.go index 01d34d16b..532eab7f9 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -328,7 +328,7 @@ func mustBeSameVoterSet(t *testing.T, a, b *types.VoterSet) { assert.True(t, bytes.Equal(v.PubKey.Bytes(), b.Voters[i].PubKey.Bytes()), "voter public key is different") assert.True(t, v.VotingPower == b.Voters[i].VotingPower, "voter voting power is different") - assert.True(t, v.StakingPower == b.Voters[i].StakingPower, "voter staking power is different") + assert.True(t, v.VotingWeight == b.Voters[i].VotingWeight, "voter voting weight is different") } } @@ -338,7 +338,7 @@ func mustBeSameValidatorSet(t *testing.T, a, b *types.ValidatorSet) { assert.True(t, bytes.Equal(v.PubKey.Bytes(), b.Validators[i].PubKey.Bytes()), "validator public key is different") assert.True(t, v.VotingPower == b.Validators[i].VotingPower, "validator voting power is different") - assert.True(t, v.StakingPower == b.Validators[i].StakingPower, "validator staking power is different") + assert.True(t, v.VotingWeight == b.Validators[i].VotingWeight, "validator voting weight is different") } } @@ -1250,42 +1250,42 @@ func TestState_MakeHashMessage(t *testing.T) { func TestMedianTime(t *testing.T) { now := tmtime.Now() cases := []struct { - votingPowers []int64 - times []time.Time - expectedMid time.Time + votingWeights []int64 + times []time.Time + expectedMid time.Time }{ { - votingPowers: []int64{10, 10, 10, 10, 10}, // mid = 50/2 = 25 - times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, - expectedMid: now.Add(2), + votingWeights: []int64{10, 10, 10, 10, 10}, // mid = 50/2 = 25 + times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, + expectedMid: now.Add(2), }, { - votingPowers: []int64{10, 20, 30, 40, 50}, // mid = 150/2 = 75 - times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, - expectedMid: now.Add(3), + votingWeights: []int64{10, 20, 30, 40, 50}, // mid = 150/2 = 75 + times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, + expectedMid: now.Add(3), }, { - votingPowers: []int64{10, 20, 30, 40, 1000}, // mid = 1100/2 = 550 - times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, - expectedMid: now.Add(4), + votingWeights: []int64{10, 20, 30, 40, 1000}, // mid = 1100/2 = 550 + times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, + expectedMid: now.Add(4), }, { - votingPowers: []int64{10, 2000, 2001, 2002, 2003}, // mid = 8016/2 = 4008 - times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, - expectedMid: now.Add(2), + votingWeights: []int64{10, 2000, 2001, 2002, 2003}, // mid = 8016/2 = 4008 + times: []time.Time{now, now.Add(1), now.Add(2), now.Add(3), now.Add(4)}, + expectedMid: now.Add(2), }, } for i, tc := range cases { vals := make([]*types.Validator, len(tc.times)) commits := make([]types.CommitSig, len(tc.times)) - for j := range tc.votingPowers { + for j := range tc.votingWeights { vals[j] = types.NewValidator(ed25519.GenPrivKey().PubKey(), 10) } voters := types.ToVoterAll(vals) - for j, power := range tc.votingPowers { - // reset voting power with a value that is not staking power - voters.Voters[j].StakingPower = power + for j, votingWeight := range tc.votingWeights { + // reset voting weight + voters.Voters[j].VotingWeight = votingWeight commits[j] = types.NewCommitSigForBlock(tmrand.Bytes(10), voters.Voters[j].Address, tc.times[j]) } commit := types.NewCommit(10, 0, types.BlockID{Hash: []byte("0xDEADBEEF")}, commits) diff --git a/test/e2e/tests/validator_test.go b/test/e2e/tests/validator_test.go index b0dcbe5ac..2682c506e 100644 --- a/test/e2e/tests/validator_test.go +++ b/test/e2e/tests/validator_test.go @@ -57,9 +57,9 @@ func TestValidator_Sets(t *testing.T) { "incorrect PubKey of validator set at height %v", h) require.Equal(t, expected.VotingPower, actual.VotingPower, "incorrect VotingPower of validator set at height %v", h) - // StakingPower is set VotingPower - require.Equal(t, expected.VotingPower, actual.StakingPower, - "incorrect StakingPower of validator set at height %v", h) + // VotingWeight is set VotingPower + require.Equal(t, expected.VotingPower, actual.VotingWeight, + "incorrect VotingWeight of validator set at height %v", h) if expected.ProposerPriority == 0 { // ProposerPriority is not changed // the other value can ignore since we don't use it diff --git a/types/evidence.go b/types/evidence.go index d4415c108..3239d6cf6 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -24,7 +24,7 @@ func MaxEvidenceBytes(ev Evidence) int64 { (1 + MaxVoteBytes(len(ev.VoteB.Signature)) + 2) + // VoteB (1 + 9) + // TotalVotingPower (1 + 9) + // ValidatorPower - //(1 + 9) + // StakingPower is not include + //(1 + 9) + // VotingWeight is not include (1 + 17 + 1) // Timestamp case *LightClientAttackEvidence: // FIXME 🏺 need this? @@ -54,9 +54,9 @@ type DuplicateVoteEvidence struct { VoteB *Vote `json:"vote_b"` // abci specific information - TotalVotingPower int64 // VoterSet.TotalStakingPower() + TotalVotingPower int64 // VoterSet.TotalVotingWeight() ValidatorPower int64 // Validator.VotingPower - StakingPower int64 // Validator.StakingPower + VotingWeight int64 // Validator.VotingWeight Timestamp time.Time } @@ -84,9 +84,9 @@ func NewDuplicateVoteEvidence(vote1, vote2 *Vote, blockTime time.Time, voterSet return &DuplicateVoteEvidence{ VoteA: voteA, VoteB: voteB, - TotalVotingPower: voterSet.TotalStakingPower(), + TotalVotingPower: voterSet.TotalVotingWeight(), ValidatorPower: val.VotingPower, - StakingPower: val.StakingPower, + VotingWeight: val.VotingWeight, Timestamp: blockTime, } } @@ -98,7 +98,7 @@ func (dve *DuplicateVoteEvidence) ABCI() []abci.Evidence { Validator: abci.Validator{ Address: dve.VoteA.ValidatorAddress, Power: dve.ValidatorPower, - StakingPower: dve.StakingPower, + VotingWeight: dve.VotingWeight, }, Height: dve.VoteA.Height, Time: dve.Timestamp, @@ -168,7 +168,7 @@ func (dve *DuplicateVoteEvidence) ToProto() *tmproto.DuplicateVoteEvidence { VoteB: voteB, TotalVotingPower: dve.TotalVotingPower, ValidatorPower: dve.ValidatorPower, - StakingPower: dve.StakingPower, + VotingWeight: dve.VotingWeight, Timestamp: dve.Timestamp, } return &tp @@ -195,7 +195,7 @@ func DuplicateVoteEvidenceFromProto(pb *tmproto.DuplicateVoteEvidence) (*Duplica VoteB: vB, TotalVotingPower: pb.TotalVotingPower, ValidatorPower: pb.ValidatorPower, - StakingPower: pb.StakingPower, + VotingWeight: pb.VotingWeight, Timestamp: pb.Timestamp, } @@ -215,7 +215,7 @@ type LightClientAttackEvidence struct { // abci specific information ByzantineValidators []*Validator // validators in the validator set that misbehaved in creating the conflicting block - TotalVotingPower int64 // total staking power of the voter set at the common height + TotalVotingPower int64 // total voting weight of the voter set at the common height Timestamp time.Time // timestamp of the block at the common height } diff --git a/types/evidence_test.go b/types/evidence_test.go index c2a6eb455..73b198386 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -215,7 +215,7 @@ func TestLightClientAttackEvidenceBasic(t *testing.T) { VoterSet: voterSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalStakingPower(), + TotalVotingPower: voterSet.TotalVotingWeight(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } @@ -245,7 +245,7 @@ func TestLightClientAttackEvidenceBasic(t *testing.T) { ValidatorSet: valSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalStakingPower(), + TotalVotingPower: voterSet.TotalVotingWeight(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } @@ -275,7 +275,7 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { VoterSet: voterSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalStakingPower(), + TotalVotingPower: voterSet.TotalVotingWeight(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } @@ -315,7 +315,7 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { VoterSet: voterSet, }, CommonHeight: commonHeight, - TotalVotingPower: voterSet.TotalStakingPower(), + TotalVotingPower: voterSet.TotalVotingWeight(), Timestamp: header.Time, ByzantineValidators: valSet.Validators[:nValidators/2], } diff --git a/types/protobuf.go b/types/protobuf.go index 0804c681f..978d4472b 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -65,7 +65,7 @@ func (oc2pb) Validator(val *Validator) abci.Validator { return abci.Validator{ Address: val.PubKey.Address(), Power: val.VotingPower, - StakingPower: val.StakingPower, + VotingWeight: val.VotingWeight, } } diff --git a/types/validator.go b/types/validator.go index 08d337ead..468d20558 100644 --- a/types/validator.go +++ b/types/validator.go @@ -13,28 +13,28 @@ import ( ) // Volatile state for each Validator -// NOTE: The ProposerPriority, StakingPower is not included in Validator.Hash(); +// NOTE: The ProposerPriority, VotingWeight is not included in Validator.Hash(); // make sure to update that method if changes are made here // VotingPower is the potential voting power proportional to the amount of stake, -// and StakingPower is the actual voting power granted by the election process. -// VotingPower is durable and can be changed by staking txs. -// StakingPower is volatile and can be changed at every height. +// and VotingWeight is the actual voting power granted by the election process. +// VotingPower is durable and can be changed by updating Validator via txs. +// VotingWeight is volatile and can be changed at every height. type Validator struct { Address Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` VotingPower int64 `json:"voting_power"` - StakingPower int64 `json:"staking_power"` + VotingWeight int64 `json:"voting_weight"` ProposerPriority int64 `json:"proposer_priority"` } -// NewValidator returns a new validator with the given pubkey and staking power. +// NewValidator returns a new validator with the given pubkey and voting power. func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator { return &Validator{ Address: pubKey.Address(), PubKey: pubKey, VotingPower: votingPower, - StakingPower: 0, + VotingWeight: 0, ProposerPriority: 0, } } @@ -153,7 +153,7 @@ func (v *Validator) ToProto() (*tmproto.Validator, error) { Address: v.Address, PubKey: pk, VotingPower: v.VotingPower, - StakingPower: v.StakingPower, + VotingWeight: v.VotingWeight, ProposerPriority: v.ProposerPriority, } @@ -175,7 +175,7 @@ func ValidatorFromProto(vp *tmproto.Validator) (*Validator, error) { v.Address = vp.GetAddress() v.PubKey = pk v.VotingPower = vp.GetVotingPower() - v.StakingPower = vp.GetStakingPower() + v.VotingWeight = vp.GetVotingWeight() v.ProposerPriority = vp.GetProposerPriority() return v, nil diff --git a/types/validator_set.go b/types/validator_set.go index 91f243938..d2496f763 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -24,18 +24,18 @@ const ( // and leaves room for defensive purposes. MaxTotalVotingPower = int64(math.MaxInt64) / 8 - // MaxTotalStakingPower should be same to MaxTotalVotingPower theoretically, + // MaxTotalVotingWeight should be same to MaxTotalVotingPower theoretically, // but the value can be higher when it is type-casted as float64 // because of the number of valid digits of float64. // This phenomenon occurs in the following computations. // // `winner.SetWinPoint(int64(float64(totalPriority) * winPoints[i] / totalWinPoint))` lib/rand/sampling.go // - // MaxTotalStakingPower can be as large as MaxTotalVotingPower+alpha + // MaxTotalVotingWeight can be as large as MaxTotalVotingPower+alpha // but I don't know the exact alpha. 1000 seems to be enough by some examination. // Please refer TestMaxVotingPowerTest for this. // TODO: 1000 is temporary limit, we should remove float calculation and then we can fix this limit - MaxTotalStakingPower = MaxTotalVotingPower + 1000 + MaxTotalVotingWeight = MaxTotalVotingPower + 1000 // PriorityWindowSizeFactor - is a constant that when multiplied with the // total voting power gives the maximum allowed distance between validator diff --git a/types/validator_set_test.go b/types/validator_set_test.go index 51bad6e43..7cf0cb6f0 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -34,7 +34,7 @@ func TestMaxVotingPowerTest(t *testing.T) { } } t.Logf("max difference=%d", maxDiff) - assert.True(t, MaxTotalVotingPower+maxDiff <= MaxTotalStakingPower) + assert.True(t, MaxTotalVotingPower+maxDiff <= MaxTotalVotingWeight) } func TestValidatorSetBasic(t *testing.T) { @@ -402,12 +402,12 @@ func randValidator(totalVotingPower int64) *Validator { func randValidatorSet(numValidators int) *ValidatorSet { validators := make([]*Validator, numValidators) - totalVotingPower := int64(numValidators) // to depend for total staking power to be over MaxTotalStakingPower + totalVotingPower := int64(numValidators) // to depend for total voting power to be over MaxTotalVotingWeight for i := 0; i < numValidators; i++ { validators[i] = randValidator(totalVotingPower) totalVotingPower += validators[i].VotingPower if totalVotingPower >= MaxTotalVotingPower { - // the remainder must have 1 of staking power + // the remainder must have 1 of voting power totalVotingPower = MaxTotalVotingPower - 1 } } @@ -466,8 +466,8 @@ func (vals *ValidatorSet) fromBytes(b []byte) *ValidatorSet { //------------------------------------------------------------------- -func TestValidatorSetTotalStakingPowerPanicsOnOverflow(t *testing.T) { - // NewValidatorSet calls IncrementProposerPriority which calls TotalStakingPower() +func TestValidatorSetTotalVotingPowerPanicsOnOverflow(t *testing.T) { + // NewValidatorSet calls IncrementProposerPriority which calls TotalVotingPower() // which should panic on overflows: shouldPanic := func() { NewValidatorSet([]*Validator{ @@ -557,7 +557,7 @@ func TestAveragingInIncrementProposerPriority(t *testing.T) { } } -func TestAveragingInIncrementProposerPriorityWithStakingPower(t *testing.T) { +func TestAveragingInIncrementProposerPriorityWithVotingPower(t *testing.T) { // Other than TestAveragingInIncrementProposerPriority this is a more complete test showing // how each ProposerPriority changes in relation to the validator's voting power respectively. // average is zero in each round: @@ -614,7 +614,7 @@ func TestAveragingInIncrementProposerPriorityWithStakingPower(t *testing.T) { vals.Copy(), []int64{ 0 + 4*(vp0-total) + vp0, // 4 iters was mostest - 0 + 5*vp1 - total, // now this val is mostest for the 1st time (hence -12==totalStakingPower) + 0 + 5*vp1 - total, // now this val is mostest for the 1st time (hence -12==totalVotingPower) 0 + 5*vp2}, 5, vals.Validators[2]}, diff --git a/types/vote_set.go b/types/vote_set.go index 3774ecfb0..1cff55806 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -237,7 +237,7 @@ func (voteSet *VoteSet) addVote(vote *Vote, execVoteVerify func(chainID string, } // Add vote and get conflicting vote if any. - added, conflicting := voteSet.addVerifiedVote(vote, blockKey, voter.StakingPower) + added, conflicting := voteSet.addVerifiedVote(vote, blockKey, voter.VotingWeight) if conflicting != nil { return added, NewConflictingVoteError(conflicting, vote) } @@ -310,7 +310,7 @@ func (voteSet *VoteSet) addVerifiedVote( // Before adding to votesByBlock, see if we'll exceed quorum origSum := votesByBlock.sum - quorum := voteSet.voterSet.TotalStakingPower()*2/3 + 1 + quorum := voteSet.voterSet.TotalVotingWeight()*2/3 + 1 // Add vote to votesByBlock votesByBlock.addVerifiedVote(vote, votingPower) @@ -462,7 +462,7 @@ func (voteSet *VoteSet) HasTwoThirdsAny() bool { } voteSet.mtx.Lock() defer voteSet.mtx.Unlock() - return voteSet.sum > voteSet.voterSet.TotalStakingPower()*2/3 + return voteSet.sum > voteSet.voterSet.TotalVotingWeight()*2/3 } func (voteSet *VoteSet) HasAll() bool { @@ -471,7 +471,7 @@ func (voteSet *VoteSet) HasAll() bool { } voteSet.mtx.Lock() defer voteSet.mtx.Unlock() - return voteSet.sum == voteSet.voterSet.TotalStakingPower() + return voteSet.sum == voteSet.voterSet.TotalVotingWeight() } // If there was a +2/3 majority for blockID, return blockID and true. @@ -626,7 +626,7 @@ func (voteSet *VoteSet) LogString() string { // return the power voted, the total, and the fraction func (voteSet *VoteSet) sumTotalFrac() (int64, int64, float64) { - voted, total := voteSet.sum, voteSet.voterSet.TotalStakingPower() + voted, total := voteSet.sum, voteSet.voterSet.TotalVotingWeight() fracVoted := float64(voted) / float64(total) return voted, total, fracVoted } diff --git a/types/voter_set.go b/types/voter_set.go index 53f9f7ef1..931a4ce85 100644 --- a/types/voter_set.go +++ b/types/voter_set.go @@ -24,13 +24,13 @@ type VoterSet struct { Voters []*Validator `json:"voters"` // cached (unexported) - totalStakingPower int64 + totalVotingWeight int64 } func WrapValidatorsToVoterSet(vals []*Validator) *VoterSet { sort.Sort(ValidatorsByVotingPower(vals)) - voterSet := &VoterSet{Voters: vals, totalStakingPower: 0} - voterSet.updateTotalStakingPower() + voterSet := &VoterSet{Voters: vals, totalVotingWeight: 0} + voterSet.updateTotalVotingWeight() return voterSet } @@ -104,32 +104,32 @@ func (voters *VoterSet) Copy() *VoterSet { } return &VoterSet{ Voters: copyValidatorListShallow(voters.Voters), - totalStakingPower: voters.totalStakingPower, + totalVotingWeight: voters.totalVotingWeight, } } -// Forces recalculation of the set's total staking power. -// Panics if total staking power is bigger than MaxTotalStakingPower. -func (voters *VoterSet) updateTotalStakingPower() { +// Forces recalculation of the set's total voting weight. +// Panics if total voting weight is bigger than MaxTotalVotingWeight. +func (voters *VoterSet) updateTotalVotingWeight() { sum := int64(0) for _, val := range voters.Voters { // mind overflow - sum = safeAddClip(sum, val.StakingPower) - if sum > MaxTotalStakingPower { + sum = safeAddClip(sum, val.VotingWeight) + if sum > MaxTotalVotingWeight { panic(fmt.Sprintf( - "Total staking power should be guarded to not exceed %v; got: %v", - MaxTotalStakingPower, + "total voting weight should be guarded to not exceed %v; got: %v", + MaxTotalVotingWeight, sum)) } } - voters.totalStakingPower = sum + voters.totalVotingWeight = sum } -func (voters *VoterSet) TotalStakingPower() int64 { - if voters.totalStakingPower == 0 { - voters.updateTotalStakingPower() +func (voters *VoterSet) TotalVotingWeight() int64 { + if voters.totalVotingWeight == 0 { + voters.updateTotalVotingWeight() } - return voters.totalStakingPower + return voters.totalVotingWeight } // Hash returns the Merkle root hash build using voters (as leaves) in the @@ -167,8 +167,8 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int blockID, commit.BlockID) } - talliedStakingPower := int64(0) - stakingPowerNeeded := voters.TotalStakingPower() * 2 / 3 // FIXME: 🏺 arithmetic overflow + talliedVotingWeight := int64(0) + requiredVotingWeight := voters.TotalVotingWeight() * 2 / 3 // FIXME: 🏺 arithmetic overflow blsPubKeys := make([]bls.PubKey, 0, len(commit.Signatures)) messages := make([][]byte, 0, len(commit.Signatures)) for idx, commitSig := range commit.Signatures { @@ -182,7 +182,7 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int // Validate signature. voteSignBytes := commit.VoteSignBytes(chainID, int32(idx)) - verifiedStakingPower, unverifiedStakingPower, err := verifySignatureOrCollectBlsPubKeysAndGetStakingPower( + verifiedVotingWeight, unverifiedVotingWeight, err := verifySignatureOrCollectBlsPubKeysAndGetVotingWeight( idx, commitSig, voter, voteSignBytes, &blsPubKeys, &messages) if err != nil { return err @@ -190,7 +190,7 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int // Good! if commitSig.ForBlock() { - talliedStakingPower += verifiedStakingPower + unverifiedStakingPower + talliedVotingWeight += verifiedVotingWeight + unverifiedVotingWeight } // else { @@ -204,9 +204,9 @@ func (voters *VoterSet) VerifyCommit(chainID string, blockID BlockID, height int return fmt.Errorf("wrong aggregated signature: %X; %s", commit.AggregatedSignature, err) } - // add staking power for BLS batch verification and return without error if trust-level of the signatures are verified - if got, needed := talliedStakingPower, stakingPowerNeeded; got <= needed { - return ErrNotEnoughStakingPowerSigned{Got: got, Needed: needed} + // add voting weight for BLS batch verification and return without error if trust-level of the signatures are verified + if got, needed := talliedVotingWeight, requiredVotingWeight; got <= needed { + return ErrNotEnoughVotingWeightSigned{Got: got, Needed: needed} } return nil @@ -234,9 +234,9 @@ func (voters *VoterSet) VerifyCommitLight(chainID string, blockID BlockID, blockID, commit.BlockID) } - talliedStakingPower := int64(0) - talliedUnverifiedStakingPower := int64(0) - stakingPowerNeeded := voters.TotalStakingPower() * 2 / 3 // FIXME: 🏺 arithmetic overflow + talliedVotingWeight := int64(0) + talliedUnverifiedVotingWeight := int64(0) + requiredVotingWeight := voters.TotalVotingWeight() * 2 / 3 // FIXME: 🏺 arithmetic overflow blsPubKeys := make([]bls.PubKey, 0, len(commit.Signatures)) messages := make([][]byte, 0, len(commit.Signatures)) for idx, commitSig := range commit.Signatures { @@ -255,17 +255,17 @@ func (voters *VoterSet) VerifyCommitLight(chainID string, blockID BlockID, // Validate signature. voteSignBytes := commit.VoteSignBytes(chainID, int32(idx)) - verifiedStakingPower, unverifiedStakingPower, err := verifySignatureOrCollectBlsPubKeysAndGetStakingPower( + verifiedVotingWeight, unverifiedVotingWeight, err := verifySignatureOrCollectBlsPubKeysAndGetVotingWeight( idx, commitSig, voter, voteSignBytes, &blsPubKeys, &messages) if err != nil { return err } - talliedStakingPower += verifiedStakingPower - talliedUnverifiedStakingPower += unverifiedStakingPower + talliedVotingWeight += verifiedVotingWeight + talliedUnverifiedVotingWeight += unverifiedVotingWeight // return as soon as +2/3 of the signatures are verified by individual verification - if talliedStakingPower > stakingPowerNeeded { + if talliedVotingWeight > requiredVotingWeight { return nil } } @@ -274,13 +274,13 @@ func (voters *VoterSet) VerifyCommitLight(chainID string, blockID BlockID, if err := bls.VerifyAggregatedSignature(commit.AggregatedSignature, blsPubKeys, messages); err != nil { return fmt.Errorf("wrong aggregated signature: %X; %s", commit.AggregatedSignature, err) } - // add staking power for BLS batch verification and return without error if +2/3 of the signatures are verified - talliedStakingPower += talliedUnverifiedStakingPower - if talliedStakingPower > stakingPowerNeeded { + // add voting weight for BLS batch verification and return without error if +2/3 of the signatures are verified + talliedVotingWeight += talliedUnverifiedVotingWeight + if talliedVotingWeight > requiredVotingWeight { return nil } - return ErrNotEnoughStakingPowerSigned{Got: talliedStakingPower, Needed: stakingPowerNeeded} + return ErrNotEnoughVotingWeightSigned{Got: talliedVotingWeight, Needed: requiredVotingWeight} } // VerifyCommitLightTrusting verifies that trustLevel of the voter set signed @@ -298,18 +298,18 @@ func (voters *VoterSet) VerifyCommitLightTrusting(chainID string, commit *Commit } var ( - talliedStakingPower int64 - talliedUnverifiedStakingPower int64 + talliedVotingWeight int64 + talliedUnverifiedVotingWeight int64 seenVoters = make(map[int32]int, len(commit.Signatures)) // voter index -> commit index ) - // Safely calculate staking power needed. - totalStakingPowerMulByNumerator, overflow := safeMul(voters.TotalStakingPower(), int64(trustLevel.Numerator)) + // Safely calculate voting weight needed. + totalVotingWeightMulByNumerator, overflow := safeMul(voters.TotalVotingWeight(), int64(trustLevel.Numerator)) if overflow { - return errors.New("int64 overflow while calculating staking power needed. " + + return errors.New("int64 overflow while calculating voting weight needed. " + "please provide smaller trustLevel numerator") } - stakingPowerNeeded := totalStakingPowerMulByNumerator / int64(trustLevel.Denominator) + requiredVotingWeight := totalVotingWeightMulByNumerator / int64(trustLevel.Denominator) blsPubKeys := make([]bls.PubKey, 0, len(commit.Signatures)) messages := make([][]byte, 0, len(commit.Signatures)) @@ -333,16 +333,16 @@ func (voters *VoterSet) VerifyCommitLightTrusting(chainID string, commit *Commit // Verify Signature voteSignBytes := commit.VoteSignBytes(chainID, int32(idx)) - verifiedStakingPower, unverifiedStakingPower, err := verifySignatureOrCollectBlsPubKeysAndGetStakingPower( + verifiedVotingWeight, unverifiedVotingWeight, err := verifySignatureOrCollectBlsPubKeysAndGetVotingWeight( idx, commitSig, voter, voteSignBytes, &blsPubKeys, &messages) if err != nil { return err } - talliedStakingPower += verifiedStakingPower - talliedUnverifiedStakingPower += unverifiedStakingPower + talliedVotingWeight += verifiedVotingWeight + talliedUnverifiedVotingWeight += unverifiedVotingWeight - if talliedStakingPower > stakingPowerNeeded { + if talliedVotingWeight > requiredVotingWeight { return nil } } @@ -352,42 +352,42 @@ func (voters *VoterSet) VerifyCommitLightTrusting(chainID string, commit *Commit if err := bls.VerifyAggregatedSignature(commit.AggregatedSignature, blsPubKeys, messages); err != nil { return fmt.Errorf("wrong aggregated signature: %X; %s", commit.AggregatedSignature, err) } - // add staking power for BLS batch verification and return without error if trust-level of the signatures are verified - talliedStakingPower += talliedUnverifiedStakingPower - if talliedStakingPower > stakingPowerNeeded { + // add voting weight for BLS batch verification and return without error if trust-level of the signatures are verified + talliedVotingWeight += talliedUnverifiedVotingWeight + if talliedVotingWeight > requiredVotingWeight { return nil } - return ErrNotEnoughStakingPowerSigned{Got: talliedStakingPower, Needed: stakingPowerNeeded} + return ErrNotEnoughVotingWeightSigned{Got: talliedVotingWeight, Needed: requiredVotingWeight} } -func verifySignatureOrCollectBlsPubKeysAndGetStakingPower( +func verifySignatureOrCollectBlsPubKeysAndGetVotingWeight( idx int, commitSig CommitSig, val *Validator, voteSignBytes []byte, blsPubKeys *[]bls.PubKey, messages *[][]byte) (int64, int64, error) { - verifiedStakingPower := int64(0) - unverifiedStakingPower := int64(0) + verifiedVotingWeight := int64(0) + unverifiedVotingWeight := int64(0) if commitSig.Signature != nil { if !val.PubKey.VerifySignature(voteSignBytes, commitSig.Signature) { - return verifiedStakingPower, unverifiedStakingPower, fmt.Errorf( + return verifiedVotingWeight, unverifiedVotingWeight, fmt.Errorf( "wrong signature (#%d): %X", idx, commitSig.Signature, ) } - verifiedStakingPower = val.StakingPower + verifiedVotingWeight = val.VotingWeight } else { blsPubKey := GetSignatureKey(val.PubKey) if blsPubKey == nil { - return verifiedStakingPower, unverifiedStakingPower, fmt.Errorf( + return verifiedVotingWeight, unverifiedVotingWeight, fmt.Errorf( "signature %d has been omitted, even though it is not a BLS key", idx, ) } *blsPubKeys = append(*blsPubKeys, *blsPubKey) *messages = append(*messages, voteSignBytes) - unverifiedStakingPower = val.StakingPower + unverifiedVotingWeight = val.VotingWeight } - return verifiedStakingPower, unverifiedStakingPower, nil + return verifiedVotingWeight, unverifiedVotingWeight, nil } // ToProto converts VoterSet to protobuf @@ -406,7 +406,7 @@ func (voters *VoterSet) ToProto() (*tmproto.VoterSet, error) { votersProto[i] = voterp } vsp.Voters = votersProto - vsp.TotalStakingPower = voters.totalStakingPower + vsp.TotalVotingWeight = voters.totalVotingWeight return vsp, nil } @@ -429,29 +429,29 @@ func VoterSetFromProto(vp *tmproto.VoterSet) (*VoterSet, error) { valsProto[i] = v } voters.Voters = valsProto - voters.totalStakingPower = vp.GetTotalStakingPower() + voters.totalVotingWeight = vp.GetTotalVotingWeight() return voters, voters.ValidateBasic() } //----------------- -// IsErrNotEnoughStakingPowerSigned returns true if err is -// ErrNotEnoughStakingPowerSigned. -func IsErrNotEnoughStakingPowerSigned(err error) bool { - _, ok := errors.Cause(err).(ErrNotEnoughStakingPowerSigned) - return ok -} +//// IsErrNotEnoughVotingWeightSigned returns true if err is +//// ErrNotEnoughVotingWeightSigned. +//func IsErrNotEnoughVotingWeightSigned(err error) bool { +// _, ok := errors.Cause(err).(ErrNotEnoughVotingWeightSigned) +// return ok +//} -// ErrNotEnoughStakingPowerSigned is returned when not enough voters signed +// ErrNotEnoughVotingWeightSigned is returned when not enough voters signed // a commit. -type ErrNotEnoughStakingPowerSigned struct { +type ErrNotEnoughVotingWeightSigned struct { Got int64 Needed int64 } -func (e ErrNotEnoughStakingPowerSigned) Error() string { - return fmt.Sprintf("invalid commit -- insufficient staking power: got %d, needed more than %d", e.Got, e.Needed) +func (e ErrNotEnoughVotingWeightSigned) Error() string { + return fmt.Sprintf("invalid commit -- insufficient voting weight: got %d, needed more than %d", e.Got, e.Needed) } //---------------- @@ -511,7 +511,7 @@ func ToVoterAll(validators []*Validator) *VoterSet { Address: val.Address, PubKey: val.PubKey, VotingPower: val.VotingPower, - StakingPower: val.VotingPower, + VotingWeight: val.VotingPower, ProposerPriority: val.ProposerPriority, }) } @@ -633,26 +633,27 @@ func electVotersNonDup(validators []*Validator, seed uint64, tolerableByzantineP }) losersVotingPower -= winner.VotingPower - // calculateStakingPowers(voters) + // calculate VotingWeight + // calculate VotingWeight totalWinPoint := new(big.Int) for _, voter := range voters { totalWinPoint.Add(totalWinPoint, voter.winPoint) } - totalStakingPower := int64(0) + totalVotingWeight := int64(0) for _, voter := range voters { winPoint := new(big.Int).Mul(voter.winPoint, big.NewInt(precisionForSelection)) - bigStakingPower := new(big.Int).Div(new(big.Int).Mul(winPoint, big.NewInt(totalVotingPower)), totalWinPoint) - stakingPower := new(big.Int).Div(bigStakingPower, big.NewInt(precisionCorrectionForSelection)).Int64() - voter.val.StakingPower = stakingPower - totalStakingPower += stakingPower + bigVotingWeight := new(big.Int).Div(new(big.Int).Mul(winPoint, big.NewInt(totalVotingPower)), totalWinPoint) + votingWeight := new(big.Int).Div(bigVotingWeight, big.NewInt(precisionCorrectionForSelection)).Int64() + voter.val.VotingWeight = votingWeight + totalVotingWeight += votingWeight } if len(voters) >= minVoters { - // sort voters in ascending stakingPower/votingPower + // sort voters in ascending votingWeight/votingPower sortVoters(voters) - topFVotersStakingPower := getTopByzantineStakingPower(voters, tolerableByzantinePower) - if topFVotersStakingPower < totalStakingPower/3 { + topFVotersVotingWeight := getTopByzantineVotingWeight(voters, tolerableByzantinePower) + if topFVotersVotingWeight < totalVotingWeight/3 { break } } @@ -661,7 +662,7 @@ func electVotersNonDup(validators []*Validator, seed uint64, tolerableByzantineP // there is no voter group satisfying the finality // cannot do sampling voters for _, c := range candidates { - c.StakingPower = c.VotingPower + c.VotingWeight = c.VotingPower } return candidates } @@ -681,18 +682,18 @@ func getTotalVotingPower(validators []*Validator) int64 { return totalVoting } -func getTopByzantineStakingPower(voters []*voter, tolerableByzantinePower int64) int64 { +func getTopByzantineVotingWeight(voters []*voter, tolerableByzantinePower int64) int64 { topFVotersVotingPower := int64(0) - topFVotersStakingPower := int64(0) + topFVotersVotingWeight := int64(0) for _, voter := range voters { prev := topFVotersVotingPower topFVotersVotingPower += voter.val.VotingPower - topFVotersStakingPower += voter.val.StakingPower + topFVotersVotingWeight += voter.val.VotingWeight if prev < tolerableByzantinePower && topFVotersVotingPower >= tolerableByzantinePower { break } } - return topFVotersStakingPower + return topFVotersVotingWeight } // sort validators in-place @@ -705,11 +706,11 @@ func sortValidators(validators []*Validator) { }) } -// sortVoters is function to sort voters in descending stakingPower/votingPower in-place +// sortVoters is function to sort voters in descending votingWeight/votingPower in-place func sortVoters(candidates []*voter) { sort.Slice(candidates, func(i, j int) bool { - bigA := new(big.Int).Mul(big.NewInt(candidates[i].val.StakingPower), big.NewInt(candidates[j].val.VotingPower)) - bigB := new(big.Int).Mul(big.NewInt(candidates[j].val.StakingPower), big.NewInt(candidates[i].val.VotingPower)) + bigA := new(big.Int).Mul(big.NewInt(candidates[i].val.VotingWeight), big.NewInt(candidates[j].val.VotingPower)) + bigB := new(big.Int).Mul(big.NewInt(candidates[j].val.VotingWeight), big.NewInt(candidates[i].val.VotingPower)) compareResult := bigA.Cmp(bigB) if compareResult == 0 { return bytes.Compare(candidates[i].val.Address, candidates[j].val.Address) == -1 diff --git a/types/voter_set_test.go b/types/voter_set_test.go index a676a7e99..0ed71640b 100644 --- a/types/voter_set_test.go +++ b/types/voter_set_test.go @@ -72,7 +72,7 @@ func TestVoterSet_VerifyCommit_All(t *testing.T) { NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{vote.CommitSig(), {BlockIDFlag: BlockIDFlagAbsent}}), true}, - {"insufficient staking power: got 0, needed more than 666", chainID, vote.BlockID, vote.Height, + {"insufficient voting weight: got 0, needed more than 666", chainID, vote.BlockID, vote.Height, NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{{BlockIDFlag: BlockIDFlagAbsent}}), true}, {"wrong signature (#0)", chainID, vote.BlockID, vote.Height, @@ -128,7 +128,7 @@ func TestVoterSet_VerifyCommit_CheckAllSignatures(t *testing.T) { } } -func TestVoterSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfStakingPowerSigned(t *testing.T) { +func TestVoterSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingWeightSigned(t *testing.T) { var ( chainID = "test_chain_id" h = int64(3) @@ -159,7 +159,7 @@ func TestVoterSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfStakingPowerSigned( assert.NoError(t, err) } -func TestVoterSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfStakingPowerSigned(t *testing.T) { +func TestVoterSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfVotingWeightSigned(t *testing.T) { var ( chainID = "test_chain_id" h = int64(3) @@ -261,7 +261,7 @@ func verifyVoterSetSame(t *testing.T, vset1, vset2 *VoterSet) { for i, v1 := range vset1.Voters { v2 := vset2.Voters[i] assert.True(t, v1.Address.String() == v2.Address.String()) - assert.True(t, v1.StakingPower == v2.StakingPower) + assert.True(t, v1.VotingWeight == v2.VotingWeight) assert.True(t, v1.VotingPower == v2.VotingPower) } } @@ -273,7 +273,7 @@ func verifyVoterSetDifferent(t *testing.T, vset1, vset2 *VoterSet) { v2 := vset2.Voters[i] if v1.Address.String() != v2.Address.String() || v1.VotingPower != v2.VotingPower || - v1.StakingPower != v2.StakingPower { + v1.VotingWeight != v2.VotingWeight { result = true break } @@ -305,7 +305,7 @@ func TestSelectVoter(t *testing.T) { voterSet3 := SelectVoter(valSet, hash, genDoc.VoterParams) verifyVoterSetDifferent(t, voterSet1, voterSet3) - // verifying zero-staking removed + // verifying zero-VotingPower removed assert.True(t, countZeroVotingPower(voterSet1.Voters) == 0) // case that all validators are voters @@ -393,19 +393,19 @@ The result when we set LoopCount to 10000 << min power=100, max power=100000000, actual average voters=29, max voters=29 >> largest gap: 0.147867 for testing: -go test -bench BenchmarkSelectVoterReasonableStakingPower github.com/line/ostracon/types -run ^$ -count 1 -benchmem -v +go test -bench BenchmarkSelectVoterReasonableVotingWeight github.com/line/ostracon/types -run ^$ -count 1 -benchmem -v */ -func BenchmarkSelectVoterReasonableStakingPower(b *testing.B) { +func BenchmarkSelectVoterReasonableVotingWeight(b *testing.B) { // Raise LoopCount to get smaller gap over 10000. But large LoopCount takes a lot of time const LoopCount = 100 for minMaxRate := 1; minMaxRate <= 1000000; minMaxRate *= 100 { - findLargestStakingPowerGap(b, LoopCount, minMaxRate, 10) - findLargestStakingPowerGap(b, LoopCount, minMaxRate, 20) - findLargestStakingPowerGap(b, LoopCount, minMaxRate, 29) + findLargestVotingWeightGap(b, LoopCount, minMaxRate, 10) + findLargestVotingWeightGap(b, LoopCount, minMaxRate, 20) + findLargestVotingWeightGap(b, LoopCount, minMaxRate, 29) } } -func findLargestStakingPowerGap(b *testing.B, loopCount int, minMaxRate int, maxVoters int) { +func findLargestVotingWeightGap(b *testing.B, loopCount int, minMaxRate int, maxVoters int) { valSet, privMap := randValidatorSetWithMinMax(PrivKeyEd25519, 30, 100, 100*int64(minMaxRate)) genDoc := &GenesisDoc{ GenesisTime: tmtime.Now(), @@ -502,7 +502,7 @@ func TestVoterSetProtoBuf(t *testing.T) { } } -func testStakingPower(t *testing.T, valSet *ValidatorSet) { +func testVotingWeight(t *testing.T, valSet *ValidatorSet) { voterParams := &VoterParams{ VoterElectionThreshold: 100, MaxTolerableByzantinePercentage: 20, @@ -510,7 +510,7 @@ func testStakingPower(t *testing.T, valSet *ValidatorSet) { voterSetNoSampling := SelectVoter(valSet, []byte{0}, voterParams) for _, v := range voterSetNoSampling.Voters { - assert.True(t, v.VotingPower == v.StakingPower) + assert.True(t, v.VotingPower == v.VotingWeight) } for i := 90; i > 50; i-- { @@ -518,50 +518,50 @@ func testStakingPower(t *testing.T, valSet *ValidatorSet) { voterSetSampling := SelectVoter(valSet, []byte{0}, voterParams) allSame := true for _, v := range voterSetSampling.Voters { - if v.VotingPower != v.StakingPower { + if v.VotingPower != v.VotingWeight { allSame = false break } } assert.False(t, allSame) - assert.True(t, valSet.TotalVotingPower() > voterSetSampling.TotalStakingPower()) - assert.True(t, valSet.TotalVotingPower()-voterSetSampling.TotalStakingPower() <= precisionForSelection) + assert.True(t, valSet.TotalVotingPower() > voterSetSampling.TotalVotingWeight()) + assert.True(t, valSet.TotalVotingPower()-voterSetSampling.TotalVotingWeight() <= precisionForSelection) } } -func TestStakingPower(t *testing.T) { +func TestVotingWeight(t *testing.T) { vals := make([]*Validator, 100) for i := 0; i < len(vals); i++ { vals[i] = newValidator(rand.Bytes(32), 100) } - testStakingPower(t, NewValidatorSet(vals)) + testVotingWeight(t, NewValidatorSet(vals)) vals2 := make([]*Validator, 100) for i := 0; i < len(vals2); i++ { vals2[i] = newValidator(rand.Bytes(32), MaxTotalVotingPower/100) } - testStakingPower(t, NewValidatorSet(vals2)) + testVotingWeight(t, NewValidatorSet(vals2)) } func resetPoints(validators *ValidatorSet) { for _, v := range validators.Validators { - v.StakingPower = 0 + v.VotingWeight = 0 } } func isByzantineTolerable(validators []*Validator, tolerableByzantinePercentage int) bool { totalVotingPower := int64(0) - totalStakingPower := int64(0) + totalVotingWeight := int64(0) for _, v := range validators { totalVotingPower += v.VotingPower - totalStakingPower += v.StakingPower + totalVotingWeight += v.VotingWeight } voters := make([]*voter, len(validators)) for i, v := range validators { voters[i] = &voter{val: v} } tolerableByzantinePower := getTolerableByzantinePower(totalVotingPower, tolerableByzantinePercentage) - topFVotersStakingPower := getTopByzantineStakingPower(voters, tolerableByzantinePower) - return topFVotersStakingPower < totalStakingPower/3 + topFVotersVotingWeight := getTopByzantineVotingWeight(voters, tolerableByzantinePower) + return topFVotersVotingWeight < totalVotingWeight/3 } func pickRandomVoter(voters []*Validator) (target *Validator, remain []*Validator) { @@ -591,27 +591,27 @@ func TestElectVotersNonDupByzantineTolerable(t *testing.T) { tolerableByzantinePercentage := int(rand.Uint() % 15) tolerableByzantinePower := getTolerableByzantinePower(validatorSet.TotalVotingPower(), tolerableByzantinePercentage) voters := electVotersNonDup(validatorSet.Validators, rand.Uint64(), tolerableByzantinePercentage, int(rand.Uint()%100)) - totalStaking := int64(0) + totalVotingWeight := int64(0) for _, v := range voters { - totalStaking += v.StakingPower + totalVotingWeight += v.VotingWeight } for i := 0; i < 100; i++ { copied := copyValidatorListShallow(voters) - sumVoting := int64(0) - sumStaking := int64(0) + sumVotingPower := int64(0) + sumVotingWeight := int64(0) for { var one *Validator one, copied = pickRandomVoter(copied) if one == nil { break } - sumVoting += one.VotingPower - sumStaking += one.StakingPower - if sumVoting >= tolerableByzantinePower { + sumVotingPower += one.VotingPower + sumVotingWeight += one.VotingWeight + if sumVotingPower >= tolerableByzantinePower { break } } - assert.True(t, sumStaking < totalStaking/3) + assert.True(t, sumVotingWeight < totalVotingWeight/3) } } @@ -676,13 +676,14 @@ func TestElectVotersNonDupVoterCountHardCode(t *testing.T) { assert.True(t, len(voters) == expected3[j-1]) } - staking := []int64{150000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, 10000, 10000, 10000, 10000, + votingPowerFunc := []int64{ + 150000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 4200, 4200, 4000, 3800, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3200, 3200, 3200, 3200, 400, 300, 200, 100} - validatorSet = newValidatorSet(100, func(i int) int64 { return staking[i] }) + validatorSet = newValidatorSet(100, func(i int) int64 { return votingPowerFunc[i] }) expected4 := []int{9, 13, 17, 21, 26, 29, 34, 37, 40, 44, 46, 51, 55, 58, 61, 64, 70, 72, 76, 82, 87, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100} for j := 1; j <= 33; j++ { @@ -690,7 +691,8 @@ func TestElectVotersNonDupVoterCountHardCode(t *testing.T) { assert.True(t, len(voters) == expected4[j-1]) } - cosmosStaking := []int64{1234042, 31110, 246201, 1831691, 1523490, 107361, 1236356, 161896, 19927, 938209, 3272742, + votingPowerFuncCosmos := []int64{ + 1234042, 31110, 246201, 1831691, 1523490, 107361, 1236356, 161896, 19927, 938209, 3272742, 100307, 12304849, 94597, 31575, 324626, 133737, 4312343, 2194691, 6972384, 692945, 1286209, 4798646, 1570259, 5898004, 386084, 429788, 178651, 3665192, 2552662, 532779, 445203, 109041, 5194266, 1093331, 35002, 1090943, 1134566, 10149041, 897491, 458723, 1382301, 112657, 661520, 181534, 4734863, 385250, 2680449, 298927, 110777, @@ -700,7 +702,7 @@ func TestElectVotersNonDupVoterCountHardCode(t *testing.T) { 26882, 586028, 542899, 594937, 517893, 487137, 5962613, 781432, 20063, 763681, 665929, 194212, 439620, 3295816, 3738661, 520012, 185377, 520152, 801032, 162559, 785938, 250053, 608602, 245002, 300770, 117118, 595488, 111634, 1753346, 345997, 25211, 68514, 1004207, 11955082, 525223, 276736} - validatorSet = newValidatorSet(len(cosmosStaking), func(i int) int64 { return cosmosStaking[i] }) + validatorSet = newValidatorSet(len(votingPowerFuncCosmos), func(i int) int64 { return votingPowerFuncCosmos[i] }) expected5 := []int{9, 14, 19, 23, 26, 31, 34, 38, 41, 43, 45, 48, 54, 55, 60, 61, 66, 73, 78, 78, 82, 90, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125} for j := 1; j <= 33; j++ { @@ -733,7 +735,7 @@ func TestElectVotersNonDupSamplingThreshold(t *testing.T) { func TestElectVotersNonDupDownscale(t *testing.T) { candidates := newValidatorSet(10, func(i int) int64 { if i == 0 { - return MaxTotalStakingPower >> 1 + return MaxTotalVotingWeight >> 1 } if i == 1 { return 1 << 55 @@ -762,7 +764,7 @@ func TestElectVotersNonDupDeterministic(t *testing.T) { } } -func TestElectVotersNonDupIncludingZeroStakingPower(t *testing.T) { +func TestElectVotersNonDupIncludingZeroVotingWeight(t *testing.T) { // first candidate's priority is 0 candidates1 := newValidatorSet(100, func(i int) int64 { return int64(i) }) winners1 := electVotersNonDup(candidates1.Validators, 0, 20, 0) @@ -791,8 +793,8 @@ func TestElectVotersNonDupOverflow(t *testing.T) { func accumulateAndResetReward(voters []*Validator, acc map[string]int64) int64 { total := int64(0) for _, v := range voters { - acc[v.Address.String()] += v.StakingPower - total += v.StakingPower + acc[v.Address.String()] += v.VotingWeight + total += v.VotingWeight } return total } @@ -815,8 +817,8 @@ func TestElectVotersNonDupReward(t *testing.T) { /** conditions for fair reward -1. even staking power(less difference between min staking and max staking) -2. large total staking(a small total staking power makes a large error when converting float into int) +1. flat voting weight(less difference between min voting weight and max voting weight) +2. large total voting weight(a small total voting weight makes a large error when converting float into int) 3. many sampling count 4. loop count @@ -844,13 +846,13 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { float64(totalAccumulateRewards) votingRate := float64(candidates.Validators[i].VotingPower) / float64(totalVoting) rate := rewardRate / votingRate - rewardPerStakingDiff := math.Abs(1 - rate) - b.Log("rewardPerStakingDiff", rewardPerStakingDiff) + rewardPerVotingWeightDiff := math.Abs(1 - rate) + b.Log("rewardPerVotingWeightDiff", rewardPerVotingWeightDiff) // - // rewardPerStakingDiff: guarantees the fairness of rewards - // if false, then we should consider `rewardPerStakingDiff` value + // rewardPerVotingWeightDiff: guarantees the fairness of rewards + // if false, then we should consider `rewardPerVotingWeightDiff` value // - assert.True(b, rewardPerStakingDiff < 0.02) + assert.True(b, rewardPerVotingWeightDiff < 0.02) } // ======================================================================================================= @@ -864,16 +866,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 20, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerStakingDiff := float64(0) + maxRewardPerVotingWeightDiff := float64(0) for i := 0; i < 99; i++ { - rewardPerStakingDiff := + rewardPerVotingWeightDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerStakingDiff < rewardPerStakingDiff { - maxRewardPerStakingDiff = rewardPerStakingDiff + if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { + maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff } } - b.Logf("[! condition 1] max reward per staking difference: %f", maxRewardPerStakingDiff) + b.Logf("[! condition 1] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) // violation of condition 2 candidates = newValidatorSet(100, func(i int) int64 { return rand.Int64() & 0xFFFFF }) @@ -882,16 +884,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 20, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerStakingDiff = float64(0) + maxRewardPerVotingWeightDiff = float64(0) for i := 0; i < 99; i++ { - rewardPerStakingDiff := + rewardPerVotingWeightDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerStakingDiff < rewardPerStakingDiff { - maxRewardPerStakingDiff = rewardPerStakingDiff + if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { + maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff } } - b.Logf("[! condition 2] max reward per staking difference: %f", maxRewardPerStakingDiff) + b.Logf("[! condition 2] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) // violation of condition 3 candidates = newValidatorSet(100, func(i int) int64 { return 1000000 + rand.Int64()&0xFFFFF }) @@ -900,16 +902,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 20, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerStakingDiff = float64(0) + maxRewardPerVotingWeightDiff = float64(0) for i := 0; i < 99; i++ { - rewardPerStakingDiff := + rewardPerVotingWeightDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerStakingDiff < rewardPerStakingDiff { - maxRewardPerStakingDiff = rewardPerStakingDiff + if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { + maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff } } - b.Logf("[! condition 3] max reward per staking difference: %f", maxRewardPerStakingDiff) + b.Logf("[! condition 3] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) // violation of condition 4 loopCount = 100 @@ -919,16 +921,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 33, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerStakingDiff = float64(0) + maxRewardPerVotingWeightDiff = float64(0) for i := 0; i < 99; i++ { - rewardPerStakingDiff := + rewardPerVotingWeightDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerStakingDiff < rewardPerStakingDiff { - maxRewardPerStakingDiff = rewardPerStakingDiff + if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { + maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff } } - b.Logf("[! condition 4] max reward per staking difference: %f", maxRewardPerStakingDiff) + b.Logf("[! condition 4] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) } func newValidatorSet(length int, prio func(int) int64) *ValidatorSet { @@ -939,7 +941,7 @@ func newValidatorSet(length int, prio func(int) int64) *ValidatorSet { validators[i] = &Validator{ Address: crypto.AddressHash([]byte(strconv.Itoa(i))), VotingPower: votingPower, - StakingPower: 0, + VotingWeight: 0, } totalVotingPower += votingPower } @@ -967,7 +969,7 @@ func sameVoters(c1 []*Validator, c2 []*Validator) bool { if c1[i].VotingPower != c2[i].VotingPower { return false } - if c1[i].StakingPower != c2[i].StakingPower { + if c1[i].VotingWeight != c2[i].VotingWeight { return false } } @@ -995,7 +997,7 @@ func BenchmarkElectVotersNonDup(b *testing.B) { if !isByzantineTolerable(winners, 30) { for i, v := range winners { - fmt.Printf("%d: staking power: %d, voting power: %d\n", i, v.StakingPower, v.VotingPower) + fmt.Printf("%d: voting weight: %d, voting power: %d\n", i, v.VotingWeight, v.VotingPower) } break } @@ -1003,9 +1005,9 @@ func BenchmarkElectVotersNonDup(b *testing.B) { } } -func TestElectVotersNonDupStaticStakingPower(t *testing.T) { +func TestElectVotersNonDupStaticVotingWeight(t *testing.T) { candidates := newValidatorSet(5, func(i int) int64 { return 10 }) - expectedStakingPower := []int64{ + expectedVotingWeight := []int64{ 13, 11, 10, @@ -1018,7 +1020,7 @@ func TestElectVotersNonDupStaticStakingPower(t *testing.T) { assert.True(t, isByzantineTolerable(voters, byzantinePercent)) for i, voter := range voters { - assert.True(t, expectedStakingPower[i] == voter.StakingPower) + assert.True(t, expectedVotingWeight[i] == voter.VotingWeight) } } @@ -1073,7 +1075,7 @@ func TestElectVotersNonDupValidatorsNotSorting(t *testing.T) { assert.True(t, sameVoters(winners, shuffledWinners)) } -func TestElectVotersNonDupStakingPower(t *testing.T) { +func TestElectVotersNonDupVotingWeight(t *testing.T) { validators := newValidatorSet(100, func(i int) int64 { return 1000 }) @@ -1101,7 +1103,7 @@ func TestElectVotersNonDupStakingPower(t *testing.T) { votingPower.Div(votingPower, totalWinPoint) votingPower.Div(votingPower, big.NewInt(precisionCorrectionForSelection)) - assert.True(t, w.StakingPower == votingPower.Int64()) + assert.True(t, w.VotingWeight == votingPower.Int64()) } } @@ -1120,7 +1122,7 @@ func TestElectVotersNonDupWithOverflow(t *testing.T) { } }() validators.updateTotalVotingPower() // it will be panic - // electVotersNonDup does not call updateTotalStakingPower() any more + // electVotersNonDup does not call updateTotalVotingWeight() any more electVotersNonDup(validators.Validators, 0, 30, 0) } @@ -1177,18 +1179,18 @@ func TestElectVoterPanic(t *testing.T) { } } -func newVotersWithRandomStakingPowerDescending(seed, max, numerator, votingPower int64) []*voter { +func newVotersWithRandomVotingWeightDescending(seed, max, numerator, votingPower int64) []*voter { voters := make([]*voter, 0) // random voters descending random := int64(0) rand.Seed(seed) - for stakingPower := max; stakingPower > 0; stakingPower -= random { + for votingWeight := max; votingWeight > 0; votingWeight -= random { random = rand.Int63n(max/numerator) + 1 voters = append(voters, &voter{ val: &Validator{ VotingPower: votingPower, - StakingPower: stakingPower, + VotingWeight: votingWeight, }, }) } @@ -1199,7 +1201,7 @@ func TestSortVoters(t *testing.T) { for n := int64(0); n < 100; n++ { // random voters descending - voters := newVotersWithRandomStakingPowerDescending(n, 100000, 100, 10) + voters := newVotersWithRandomVotingWeightDescending(n, 100000, 100, 10) // shuffle the voters shuffled := make([]*voter, len(voters)) @@ -1211,9 +1213,9 @@ func TestSortVoters(t *testing.T) { sortVoters(shuffled) for i := range shuffled { - assert.True(t, shuffled[i].val.StakingPower == voters[i].val.StakingPower) + assert.True(t, shuffled[i].val.VotingWeight == voters[i].val.VotingWeight) if i > 0 { - assert.True(t, shuffled[i-1].val.StakingPower >= voters[i].val.StakingPower) + assert.True(t, shuffled[i-1].val.VotingWeight >= voters[i].val.VotingWeight) } } } @@ -1228,19 +1230,19 @@ func TestSortVotersWithSameValue(t *testing.T) { random := int64(0) rand.Seed(int64(n)) n := 0 - for stakingPower := int64(100000); stakingPower > 0; stakingPower -= random { + for votingWeight := int64(100000); votingWeight > 0; votingWeight -= random { random = rand.Int63n(100000/100) + 1 voters = append(voters, &voter{ val: &Validator{ VotingPower: 10, - StakingPower: stakingPower, + VotingWeight: votingWeight, Address: []byte(strconv.Itoa(n)), }, }) voters = append(voters, &voter{ val: &Validator{ VotingPower: 10, - StakingPower: stakingPower, + VotingWeight: votingWeight, Address: []byte(strconv.Itoa(n + 1)), }, }) @@ -1260,7 +1262,7 @@ func TestSortVotersWithSameValue(t *testing.T) { a := shuffled[i].val b := voters[i].val assert.True(t, bytes.Equal(a.Address, b.Address)) - assert.True(t, a.StakingPower == b.StakingPower) + assert.True(t, a.VotingWeight == b.VotingWeight) } } } From feba108bf0182f8724e3a29048d46c9cd2d2eef3 Mon Sep 17 00:00:00 2001 From: tnasu Date: Thu, 28 Jul 2022 20:17:07 +0900 Subject: [PATCH 3/5] (fixup) flagVotingPower123456 --- abci/cmd/abci-cli/abci-cli.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 8d9f54734..6b0e80fd0 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -56,7 +56,7 @@ var ( flagPersist string // voting power for make validator_tx - flagVotingPower123456 int64 + flagVotingPower int64 ) var RootCmd = &cobra.Command{ @@ -154,7 +154,7 @@ func addKVStoreFlags() { } func addPersistKVStoreMakeValSetChangeTxFlags() { - kvstoreCmd.PersistentFlags().Int64VarP(&flagVotingPower123456, "voting_power", "p", int64(10), + kvstoreCmd.PersistentFlags().Int64VarP(&flagVotingPower, "voting_power", "p", int64(10), "voting power for ValSetChangeTx") } @@ -731,7 +731,7 @@ func cmdPersistKVStoreMakeValSetChangeTx(cmd *cobra.Command, args []string) erro if err != nil { panic(err) } - pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, flagVotingPower123456) + pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, flagVotingPower) { fmt.Printf("DeliverTxSync: data=%s, tx=%s\n", pubStr, tx) res, err := client.DeliverTxSync(types.RequestDeliverTx{Tx: []byte(tx)}) From 749fce7d6dd5c15ae3e6f2f98436f9d95fba0cfa Mon Sep 17 00:00:00 2001 From: tnasu Date: Fri, 29 Jul 2022 12:14:44 +0900 Subject: [PATCH 4/5] (fixup) Rollback the wrong changes from VotingPower to VotingWeight --- types/voter_set_test.go | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/types/voter_set_test.go b/types/voter_set_test.go index 0ed71640b..f095929c8 100644 --- a/types/voter_set_test.go +++ b/types/voter_set_test.go @@ -393,19 +393,19 @@ The result when we set LoopCount to 10000 << min power=100, max power=100000000, actual average voters=29, max voters=29 >> largest gap: 0.147867 for testing: -go test -bench BenchmarkSelectVoterReasonableVotingWeight github.com/line/ostracon/types -run ^$ -count 1 -benchmem -v +go test -bench BenchmarkSelectVoterReasonableVotingPower github.com/line/ostracon/types -run ^$ -count 1 -benchmem -v */ -func BenchmarkSelectVoterReasonableVotingWeight(b *testing.B) { +func BenchmarkSelectVoterReasonableVotingPower(b *testing.B) { // Raise LoopCount to get smaller gap over 10000. But large LoopCount takes a lot of time const LoopCount = 100 for minMaxRate := 1; minMaxRate <= 1000000; minMaxRate *= 100 { - findLargestVotingWeightGap(b, LoopCount, minMaxRate, 10) - findLargestVotingWeightGap(b, LoopCount, minMaxRate, 20) - findLargestVotingWeightGap(b, LoopCount, minMaxRate, 29) + findLargestVotingPowerGap(b, LoopCount, minMaxRate, 10) + findLargestVotingPowerGap(b, LoopCount, minMaxRate, 20) + findLargestVotingPowerGap(b, LoopCount, minMaxRate, 29) } } -func findLargestVotingWeightGap(b *testing.B, loopCount int, minMaxRate int, maxVoters int) { +func findLargestVotingPowerGap(b *testing.B, loopCount int, minMaxRate int, maxVoters int) { valSet, privMap := randValidatorSetWithMinMax(PrivKeyEd25519, 30, 100, 100*int64(minMaxRate)) genDoc := &GenesisDoc{ GenesisTime: tmtime.Now(), @@ -846,13 +846,13 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { float64(totalAccumulateRewards) votingRate := float64(candidates.Validators[i].VotingPower) / float64(totalVoting) rate := rewardRate / votingRate - rewardPerVotingWeightDiff := math.Abs(1 - rate) - b.Log("rewardPerVotingWeightDiff", rewardPerVotingWeightDiff) + rewardPerVotingPowerDiff := math.Abs(1 - rate) + b.Log("rewardPerVotingPowerDiff", rewardPerVotingPowerDiff) // - // rewardPerVotingWeightDiff: guarantees the fairness of rewards - // if false, then we should consider `rewardPerVotingWeightDiff` value + // rewardPerVotingPowerDiff: guarantees the fairness of rewards + // if false, then we should consider `rewardPerVotingPowerDiff` value // - assert.True(b, rewardPerVotingWeightDiff < 0.02) + assert.True(b, rewardPerVotingPowerDiff < 0.02) } // ======================================================================================================= @@ -866,16 +866,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 20, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerVotingWeightDiff := float64(0) + maxRewardPerVotingPowerDiff := float64(0) for i := 0; i < 99; i++ { - rewardPerVotingWeightDiff := + rewardPerVotingPowerDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { - maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff + if maxRewardPerVotingPowerDiff < rewardPerVotingPowerDiff { + maxRewardPerVotingPowerDiff = rewardPerVotingPowerDiff } } - b.Logf("[! condition 1] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) + b.Logf("[! condition 1] max reward per voting power difference: %f", maxRewardPerVotingPowerDiff) // violation of condition 2 candidates = newValidatorSet(100, func(i int) int64 { return rand.Int64() & 0xFFFFF }) @@ -884,16 +884,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 20, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerVotingWeightDiff = float64(0) + maxRewardPerVotingPowerDiff = float64(0) for i := 0; i < 99; i++ { - rewardPerVotingWeightDiff := + rewardPerVotingPowerDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { - maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff + if maxRewardPerVotingPowerDiff < rewardPerVotingPowerDiff { + maxRewardPerVotingPowerDiff = rewardPerVotingPowerDiff } } - b.Logf("[! condition 2] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) + b.Logf("[! condition 2] max reward per voting power difference: %f", maxRewardPerVotingPowerDiff) // violation of condition 3 candidates = newValidatorSet(100, func(i int) int64 { return 1000000 + rand.Int64()&0xFFFFF }) @@ -902,16 +902,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 20, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerVotingWeightDiff = float64(0) + maxRewardPerVotingPowerDiff = float64(0) for i := 0; i < 99; i++ { - rewardPerVotingWeightDiff := + rewardPerVotingPowerDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { - maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff + if maxRewardPerVotingPowerDiff < rewardPerVotingPowerDiff { + maxRewardPerVotingPowerDiff = rewardPerVotingPowerDiff } } - b.Logf("[! condition 3] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) + b.Logf("[! condition 3] max reward per voting weight difference: %f", maxRewardPerVotingPowerDiff) // violation of condition 4 loopCount = 100 @@ -921,16 +921,16 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { winners := electVotersNonDup(candidates.Validators, uint64(i), 33, 0) accumulateAndResetReward(winners, accumulatedRewards) } - maxRewardPerVotingWeightDiff = float64(0) + maxRewardPerVotingPowerDiff = float64(0) for i := 0; i < 99; i++ { - rewardPerVotingWeightDiff := + rewardPerVotingPowerDiff := math.Abs(float64(accumulatedRewards[candidates.Validators[i].Address.String()])/ float64(candidates.Validators[i].VotingPower)/float64(loopCount) - 1) - if maxRewardPerVotingWeightDiff < rewardPerVotingWeightDiff { - maxRewardPerVotingWeightDiff = rewardPerVotingWeightDiff + if maxRewardPerVotingPowerDiff < rewardPerVotingPowerDiff { + maxRewardPerVotingPowerDiff = rewardPerVotingPowerDiff } } - b.Logf("[! condition 4] max reward per voting weight difference: %f", maxRewardPerVotingWeightDiff) + b.Logf("[! condition 4] max reward per voting power difference: %f", maxRewardPerVotingPowerDiff) } func newValidatorSet(length int, prio func(int) int64) *ValidatorSet { From 5673e418c251956aad929662f6d9a06628621c36 Mon Sep 17 00:00:00 2001 From: tnasu Date: Fri, 29 Jul 2022 12:46:34 +0900 Subject: [PATCH 5/5] (fixup) voting weight to voting power --- types/voter_set_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/voter_set_test.go b/types/voter_set_test.go index f095929c8..6401cd275 100644 --- a/types/voter_set_test.go +++ b/types/voter_set_test.go @@ -911,7 +911,7 @@ func BenchmarkElectVotersNonDupEquity(b *testing.B) { maxRewardPerVotingPowerDiff = rewardPerVotingPowerDiff } } - b.Logf("[! condition 3] max reward per voting weight difference: %f", maxRewardPerVotingPowerDiff) + b.Logf("[! condition 3] max reward per voting power difference: %f", maxRewardPerVotingPowerDiff) // violation of condition 4 loopCount = 100