diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 43503528..6062ba36 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -988,7 +988,7 @@ paths: format: uint64 tags: - QueryBundles - /kyve/query/v1beta1/can_validate/{pool_id}/{valaddress}: + /kyve/query/v1beta1/can_validate/{pool_id}/{pool_address}: get: summary: CanValidate ... operationId: CanValidate @@ -1205,8 +1205,8 @@ paths: required: true type: string format: uint64 - - name: valaddress - description: valaddress ... + - name: pool_address + description: pool_address ... in: path required: true type: string @@ -4524,24 +4524,24 @@ paths: is_leaving indicates if a user has scheduled a a PoolLeave entry. After the leave-time is over the staker will no longer participate in that pool - valaddress: + pool_address: type: string description: >- - Valaddress is the address which is authorized to + pool address is the address which is authorized to vote and submit bundles. If the server gets compromised - the staker can just change the valaddress. + the staker can just change the pool address . balance: type: string format: uint64 title: >- - balance is the valaddress account balance and + balance is the pool address account balance and indicates - whether or not the valaccount needs additional funds - to + whether or not the pool account needs additional + funds to pay for gas fees commission: @@ -5186,23 +5186,23 @@ paths: is_leaving indicates if a user has scheduled a a PoolLeave entry. After the leave-time is over the staker will no longer participate in that pool - valaddress: + pool_address: type: string description: >- - Valaddress is the address which is authorized to + pool address is the address which is authorized to vote and submit bundles. If the server gets compromised - the staker can just change the valaddress. + the staker can just change the pool address . balance: type: string format: uint64 title: >- - balance is the valaddress account balance and + balance is the pool address account balance and indicates - whether or not the valaccount needs additional + whether or not the pool account needs additional funds to pay for gas fees @@ -5952,23 +5952,23 @@ paths: is_leaving indicates if a user has scheduled a a PoolLeave entry. After the leave-time is over the staker will no longer participate in that pool - valaddress: + pool_address: type: string description: >- - Valaddress is the address which is authorized to + pool address is the address which is authorized to vote and submit bundles. If the server gets compromised - the staker can just change the valaddress. + the staker can just change the pool address . balance: type: string format: uint64 title: >- - balance is the valaddress account balance and + balance is the pool address account balance and indicates - whether or not the valaccount needs additional + whether or not the pool account needs additional funds to pay for gas fees @@ -6627,23 +6627,23 @@ paths: is_leaving indicates if a user has scheduled a a PoolLeave entry. After the leave-time is over the staker will no longer participate in that pool - valaddress: + pool_address: type: string description: >- - Valaddress is the address which is authorized to + pool address is the address which is authorized to vote and submit bundles. If the server gets compromised - the staker can just change the valaddress. + the staker can just change the pool address . balance: type: string format: uint64 title: >- - balance is the valaddress account balance and + balance is the pool address account balance and indicates - whether or not the valaccount needs additional + whether or not the pool account needs additional funds to pay for gas fees diff --git a/proto/kyve/query/v1beta1/bundles.proto b/proto/kyve/query/v1beta1/bundles.proto index d9dd219a..7990127d 100644 --- a/proto/kyve/query/v1beta1/bundles.proto +++ b/proto/kyve/query/v1beta1/bundles.proto @@ -27,7 +27,7 @@ service QueryBundles { // CanValidate ... rpc CanValidate(QueryCanValidateRequest) returns (QueryCanValidateResponse) { - option (google.api.http).get = "/kyve/query/v1beta1/can_validate/{pool_id}/{valaddress}"; + option (google.api.http).get = "/kyve/query/v1beta1/can_validate/{pool_id}/{pool_address}"; } // CanPropose ... @@ -182,15 +182,15 @@ message QueryCurrentVoteStatusResponse { } // =================================== -// can_validate/{pool_id}/{valaddress} +// can_validate/{pool_id}/{pool_address} // =================================== // QueryCanProposeRequest is the request type for the Query/CanPropose RPC method. message QueryCanValidateRequest { // pool_id defines the unique ID of the pool. uint64 pool_id = 1; - // valaddress ... - string valaddress = 2; + // pool_address ... + string pool_address = 2; } // QueryCanProposeResponse is the response type for the Query/CanPropose RPC method. diff --git a/proto/kyve/query/v1beta1/query.proto b/proto/kyve/query/v1beta1/query.proto index dc35d847..c1e9d51f 100644 --- a/proto/kyve/query/v1beta1/query.proto +++ b/proto/kyve/query/v1beta1/query.proto @@ -131,13 +131,13 @@ message PoolMembership { // the staker will no longer participate in that pool bool is_leaving = 3; - // Valaddress is the address which is authorized to vote + // pool address is the address which is authorized to vote // and submit bundles. If the server gets compromised - // the staker can just change the valaddress. - string valaddress = 4; + // the staker can just change the pool address . + string pool_address = 4; - // balance is the valaddress account balance and indicates - // whether or not the valaccount needs additional funds to + // balance is the pool address account balance and indicates + // whether or not the pool account needs additional funds to // pay for gas fees uint64 balance = 5; diff --git a/proto/kyve/stakers/v1beta1/events.proto b/proto/kyve/stakers/v1beta1/events.proto index 9abf0df3..9a04bc4d 100644 --- a/proto/kyve/stakers/v1beta1/events.proto +++ b/proto/kyve/stakers/v1beta1/events.proto @@ -63,10 +63,10 @@ message EventJoinPool { uint64 pool_id = 1; // staker is the address of the staker string staker = 2; - // valaddress is the address of the protocol node which + // pool_address is the address of the protocol node which // votes in favor of the staker - string valaddress = 3; - // amount is the amount of funds transferred to the valaddress + string pool_address = 3; + // amount is the amount of funds transferred to the pool address uint64 amount = 4; // commission ... string commission = 5 [ diff --git a/proto/kyve/stakers/v1beta1/genesis.proto b/proto/kyve/stakers/v1beta1/genesis.proto index 01c285e8..e8d7442a 100644 --- a/proto/kyve/stakers/v1beta1/genesis.proto +++ b/proto/kyve/stakers/v1beta1/genesis.proto @@ -14,8 +14,8 @@ message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; // staker_list ... repeated Staker staker_list = 2 [(gogoproto.nullable) = false]; - // valaccount_list ... - repeated Valaccount valaccount_list = 3 [(gogoproto.nullable) = false]; + // pool_account_list ... + repeated PoolAccount pool_account_list = 3 [(gogoproto.nullable) = false]; // commission_change_entries ... repeated CommissionChangeEntry commission_change_entries = 4 [(gogoproto.nullable) = false]; // queue_state_commission ... diff --git a/proto/kyve/stakers/v1beta1/stakers.proto b/proto/kyve/stakers/v1beta1/stakers.proto index af25cb08..74c09985 100644 --- a/proto/kyve/stakers/v1beta1/stakers.proto +++ b/proto/kyve/stakers/v1beta1/stakers.proto @@ -37,17 +37,21 @@ message Staker { ]; } -// Valaccount gets authorized by a staker to -// vote in a given pool by favor of the staker. -message Valaccount { +// PoolAccount gets authorized by a validator to +// vote in a given pool by favor of the validator. +// The pool account basically acts like an operator +// here so the validator private key can be stored +// securely and not on a remote server where +// the pool account will operate +message PoolAccount { // pool_id defines the pool in which the address // is allowed to vote in. uint64 pool_id = 1; - // staker is the address the valaccount is voting for. + // staker is the address validator string staker = 2; - // valaddress is the account stored on the protocol + // pool_address is the account stored on the protocol // node which votes for the staker in the given pool - string valaddress = 3; + string pool_address = 3; // When a node is inactive (does not vote at all) // A point is added, after a certain amount of points // is reached the node gets kicked out. diff --git a/proto/kyve/stakers/v1beta1/tx.proto b/proto/kyve/stakers/v1beta1/tx.proto index d765a2e2..0eff77a0 100644 --- a/proto/kyve/stakers/v1beta1/tx.proto +++ b/proto/kyve/stakers/v1beta1/tx.proto @@ -67,8 +67,8 @@ message MsgJoinPool { string creator = 1; // pool_id ... uint64 pool_id = 2; - // valaddress ... - string valaddress = 3; + // pool_address ... + string pool_address = 3; // amount ... uint64 amount = 4; // commission ... diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 81c2029e..c1fb42ce 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -118,12 +118,12 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() { Expect(poolByIdQuery.Pool.TotalDelegation).To(Equal(totalDelegationState)) // test stakers by pool - valaccounts := suite.App().StakersKeeper.GetAllValaccountsOfPool(suite.Ctx(), poolsState[i].Id) + poolAccounts := suite.App().StakersKeeper.GetAllPoolAccountsOfPool(suite.Ctx(), poolsState[i].Id) stakersByPoolState := make([]querytypes.FullStaker, 0) - for _, valaccount := range valaccounts { - if _, stakerFound := suite.App().StakersKeeper.GetValidator(suite.Ctx(), valaccount.Staker); stakerFound { - stakersByPoolState = append(stakersByPoolState, *suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), valaccount.Staker)) + for _, poolAccount := range poolAccounts { + if _, stakerFound := suite.App().StakersKeeper.GetValidator(suite.Ctx(), poolAccount.Staker); stakerFound { + stakersByPoolState = append(stakersByPoolState, *suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), poolAccount.Staker)) } } @@ -440,14 +440,14 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker, for _, poolMembership := range fullStaker.Pools { poolIds[poolMembership.Pool.Id] = true - valaccount, active := suite.App().StakersKeeper.GetValaccount(suite.Ctx(), poolMembership.Pool.Id, stakerAddress) + poolAccount, active := suite.App().StakersKeeper.GetPoolAccount(suite.Ctx(), stakerAddress, poolMembership.Pool.Id) Expect(active).To(BeTrue()) - Expect(poolMembership.Valaddress).To(Equal(valaccount.Valaddress)) - Expect(poolMembership.IsLeaving).To(Equal(valaccount.IsLeaving)) - Expect(poolMembership.Points).To(Equal(valaccount.Points)) + Expect(poolMembership.PoolAddress).To(Equal(poolAccount.PoolAddress)) + Expect(poolMembership.IsLeaving).To(Equal(poolAccount.IsLeaving)) + Expect(poolMembership.Points).To(Equal(poolAccount.Points)) - pool, found := suite.App().PoolKeeper.GetPool(suite.Ctx(), valaccount.PoolId) + pool, found := suite.App().PoolKeeper.GetPool(suite.Ctx(), poolAccount.PoolId) Expect(found).To(BeTrue()) Expect(poolMembership.Pool.Id).To(Equal(pool.Id)) Expect(poolMembership.Pool.Logo).To(Equal(pool.Logo)) @@ -462,8 +462,8 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker, } // Reverse check the pool memberships - for _, valaccount := range suite.App().StakersKeeper.GetValaccountsFromStaker(suite.Ctx(), stakerAddress) { - Expect(poolIds[valaccount.PoolId]).To(BeTrue()) + for _, poolAccount := range suite.App().StakersKeeper.GetPoolAccountsFromStaker(suite.Ctx(), stakerAddress) { + Expect(poolIds[poolAccount.PoolId]).To(BeTrue()) } } diff --git a/testutil/integration/helpers.go b/testutil/integration/helpers.go index afe0ab59..1f70f2e7 100644 --- a/testutil/integration/helpers.go +++ b/testutil/integration/helpers.go @@ -66,22 +66,22 @@ func (suite *KeeperTestSuite) GetCoinsFromModule(moduleName string) sdk.Coins { return suite.App().BankKeeper.GetAllBalances(suite.Ctx(), moduleAcc) } -func (suite *KeeperTestSuite) GetNextUploader() (nextStaker string, nextValaddress string) { +func (suite *KeeperTestSuite) GetNextUploader() (nextStaker string, nextPoolAddress string) { bundleProposal, _ := suite.App().BundlesKeeper.GetBundleProposal(suite.Ctx(), 0) switch bundleProposal.NextUploader { case STAKER_0: nextStaker = STAKER_0 - nextValaddress = VALADDRESS_0_A + nextPoolAddress = POOL_ADDRESS_0_A case STAKER_1: nextStaker = STAKER_1 - nextValaddress = VALADDRESS_1_A + nextPoolAddress = POOL_ADDRESS_1_A case STAKER_2: nextStaker = STAKER_2 - nextValaddress = VALADDRESS_2_A + nextPoolAddress = POOL_ADDRESS_2_A default: nextStaker = "" - nextValaddress = "" + nextPoolAddress = "" } return diff --git a/testutil/integration/integration.go b/testutil/integration/integration.go index 20dc25d9..366fd8bc 100644 --- a/testutil/integration/integration.go +++ b/testutil/integration/integration.go @@ -30,25 +30,25 @@ const ( CHARLIE = "kyve1ay22rr3kz659fupu0tcswlagq4ql6rwm4nuv0s" DAVID = "kyve1jxa7kp37jlm8hzwgc5qprquv9k7vawq79qhctt" - STAKER_0 = "kyve1htgfatqevuvfzvl0sxp97ywteqhg5leha9emf4" - VALADDRESS_0_A = "kyve1qnf86dkvvtpdukx30r3vajav7rdq8snktm90hm" - VALADDRESS_0_B = "kyve10t8gnqjnem7tsu09erzswj3zm8599lsnex79rz" - VALADDRESS_0_C = "kyve13ztkcm2pket6mrmxj8rrmwc6supw7aqakg3uu3" - - STAKER_1 = "kyve1gnr35rwn8rmflnlzs6nn5hhkmzzkxg9ap8xepw" - VALADDRESS_1_A = "kyve1hpjgzljglmv00nstk3jvcw0zzq94nu0cuxv5ga" - VALADDRESS_1_B = "kyve14runw9qkltpz2mcx3gsfmlqyyvdzkt3rq3w6fm" - VALADDRESS_1_C = "kyve15w9m7zpq9ctsxsveqaqkp4uuvw98z5vct6s9g9" - - STAKER_2 = "kyve1xsemlxghgvusumhqzm2ztjw7dz9krvu3de54e2" - VALADDRESS_2_A = "kyve1u0870dkae6ql63hxvy9y7g65c0y8csfh8allzl" - VALADDRESS_2_B = "kyve16g3utghkvvlz53jk0fq96zwrhxmqfu36ue965q" - VALADDRESS_2_C = "kyve18gjtzsn6jme3qsczj9q7wefymlkfu7ngyq5f9c" - - STAKER_3 = "kyve1ca7rzyrxfpdm7j8jgccq4rduuf4sxpq0dhmwm4" - VALADDRESS_3_A = "kyve1d2clkfrw0r99ctgmkjvluzn6xm98yls06mnxv8" - VALADDRESS_3_B = "kyve1f36cvde6jnygcrz2yas4acp0akn9cw7vp5ze0w" - VALADDRESS_3_C = "kyve1gcnd8gya2ysfur6d6z4wpl9z54zadg7qzk8uyc" + STAKER_0 = "kyve1htgfatqevuvfzvl0sxp97ywteqhg5leha9emf4" + POOL_ADDRESS_0_A = "kyve1qnf86dkvvtpdukx30r3vajav7rdq8snktm90hm" + POOL_ADDRESS_0_B = "kyve10t8gnqjnem7tsu09erzswj3zm8599lsnex79rz" + POOL_ADDRESS_0_C = "kyve13ztkcm2pket6mrmxj8rrmwc6supw7aqakg3uu3" + + STAKER_1 = "kyve1gnr35rwn8rmflnlzs6nn5hhkmzzkxg9ap8xepw" + POOL_ADDRESS_1_A = "kyve1hpjgzljglmv00nstk3jvcw0zzq94nu0cuxv5ga" + POOL_ADDRESS_1_B = "kyve14runw9qkltpz2mcx3gsfmlqyyvdzkt3rq3w6fm" + POOL_ADDRESS_1_C = "kyve15w9m7zpq9ctsxsveqaqkp4uuvw98z5vct6s9g9" + + STAKER_2 = "kyve1xsemlxghgvusumhqzm2ztjw7dz9krvu3de54e2" + POOL_ADDRESS_2_A = "kyve1u0870dkae6ql63hxvy9y7g65c0y8csfh8allzl" + POOL_ADDRESS_2_B = "kyve16g3utghkvvlz53jk0fq96zwrhxmqfu36ue965q" + POOL_ADDRESS_2_C = "kyve18gjtzsn6jme3qsczj9q7wefymlkfu7ngyq5f9c" + + STAKER_3 = "kyve1ca7rzyrxfpdm7j8jgccq4rduuf4sxpq0dhmwm4" + POOL_ADDRESS_3_A = "kyve1d2clkfrw0r99ctgmkjvluzn6xm98yls06mnxv8" + POOL_ADDRESS_3_B = "kyve1f36cvde6jnygcrz2yas4acp0akn9cw7vp5ze0w" + POOL_ADDRESS_3_C = "kyve1gcnd8gya2ysfur6d6z4wpl9z54zadg7qzk8uyc" // To avoid giving burner permissions to a module for the tests BURNER = "kyve1ld23ktfwc9zstaq8aanwkkj8cf0ru6adtz59y5" @@ -124,24 +124,24 @@ func (suite *KeeperTestSuite) initDummyAccounts() { _ = suite.MintCoins(DAVID, 1000*KYVE) _ = suite.MintCoins(STAKER_0, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_0_A, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_0_B, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_0_C, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_0_A, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_0_B, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_0_C, 1000*KYVE) _ = suite.MintCoins(STAKER_1, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_1_A, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_1_B, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_1_C, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_1_A, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_1_B, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_1_C, 1000*KYVE) _ = suite.MintCoins(STAKER_2, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_2_A, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_2_B, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_2_C, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_2_A, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_2_B, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_2_C, 1000*KYVE) _ = suite.MintCoins(STAKER_3, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_3_A, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_3_B, 1000*KYVE) - _ = suite.MintCoins(VALADDRESS_3_C, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_3_A, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_3_B, 1000*KYVE) + _ = suite.MintCoins(POOL_ADDRESS_3_C, 1000*KYVE) DUMMY = make([]string, 50) diff --git a/x/bundles/keeper/abci_protocol_split_test.go b/x/bundles/keeper/abci_protocol_split_test.go index e88ee831..5d746003 100644 --- a/x/bundles/keeper/abci_protocol_split_test.go +++ b/x/bundles/keeper/abci_protocol_split_test.go @@ -83,7 +83,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -93,7 +93,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -139,7 +139,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -147,7 +147,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -155,7 +155,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -163,7 +163,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 1, - Valaddress: i.VALADDRESS_1_B, + PoolAddress: i.POOL_ADDRESS_1_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -206,7 +206,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -216,7 +216,7 @@ var _ = Describe("abci.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) diff --git a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go index 0dd6d57b..4479a236 100644 --- a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go @@ -24,10 +24,10 @@ var _ = Describe("dropped bundles", Ordered, func() { var s *i.KeeperTestSuite initialBalanceStaker0 := s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 := s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 := s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 := s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) BeforeEach(func() { // init new clean chain @@ -70,7 +70,7 @@ var _ = Describe("dropped bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -80,22 +80,22 @@ var _ = Describe("dropped bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) s.CommitAfterSeconds(60) }) @@ -111,7 +111,7 @@ var _ = Describe("dropped bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -119,7 +119,7 @@ var _ = Describe("dropped bundles", Ordered, func() { initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_2) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -171,25 +171,25 @@ var _ = Describe("dropped bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceValaddress := s.GetBalanceFromAddress(valaccountUploader.Valaddress) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(poolAccountUploader.PoolAddress) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) - balanceUploader := s.GetBalanceFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetBalanceFromAddress(poolAccountUploader.Staker) Expect(balanceUploader).To(Equal(initialBalanceStaker0)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeEmpty()) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(Equal(uint64(1))) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(Equal(uint64(1))) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 728e34c3..79be2cf4 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -109,7 +109,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -119,13 +119,13 @@ var _ = Describe("funding bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -147,7 +147,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -161,7 +161,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -172,7 +172,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -228,7 +228,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -242,7 +242,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -253,7 +253,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -315,7 +315,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -329,7 +329,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -340,7 +340,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -402,7 +402,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -416,7 +416,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -427,7 +427,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -483,7 +483,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -497,7 +497,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -508,7 +508,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -564,7 +564,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -578,7 +578,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -589,7 +589,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -643,7 +643,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -657,7 +657,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -668,7 +668,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -710,7 +710,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -724,7 +724,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -741,7 +741,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -780,7 +780,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -794,7 +794,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -805,7 +805,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -861,7 +861,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -875,7 +875,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -886,7 +886,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -941,7 +941,7 @@ var _ = Describe("funding bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -955,7 +955,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -966,7 +966,7 @@ var _ = Describe("funding bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", diff --git a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go index c3f3b87d..7a6e8d95 100644 --- a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go +++ b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go @@ -130,7 +130,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -140,13 +140,13 @@ var _ = Describe("inflation splitting", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -177,7 +177,7 @@ var _ = Describe("inflation splitting", Ordered, func() { } s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -191,7 +191,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -205,7 +205,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -261,7 +261,7 @@ var _ = Describe("inflation splitting", Ordered, func() { } s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -275,7 +275,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -288,7 +288,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -348,7 +348,7 @@ var _ = Describe("inflation splitting", Ordered, func() { } s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -362,7 +362,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -375,7 +375,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -448,7 +448,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -462,7 +462,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -476,7 +476,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -552,7 +552,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -566,7 +566,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -579,7 +579,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -650,7 +650,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -664,7 +664,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -677,7 +677,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -747,7 +747,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -761,7 +761,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -775,7 +775,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -850,7 +850,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -864,7 +864,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -877,7 +877,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -948,7 +948,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -962,7 +962,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -975,7 +975,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1046,7 +1046,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1060,7 +1060,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1074,7 +1074,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1149,7 +1149,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1163,7 +1163,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1176,7 +1176,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1247,7 +1247,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1261,7 +1261,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1274,7 +1274,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1345,7 +1345,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1359,7 +1359,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1373,7 +1373,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1448,7 +1448,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1462,7 +1462,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1476,7 +1476,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1558,7 +1558,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1572,7 +1572,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1586,7 +1586,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1658,7 +1658,7 @@ var _ = Describe("inflation splitting", Ordered, func() { } s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1672,7 +1672,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1685,7 +1685,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1764,14 +1764,14 @@ var _ = Describe("inflation splitting", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 1, - Valaddress: i.VALADDRESS_1_B, + PoolAddress: i.POOL_ADDRESS_1_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -1783,7 +1783,7 @@ var _ = Describe("inflation splitting", Ordered, func() { } s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1797,7 +1797,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1810,7 +1810,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1922,7 +1922,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -1930,7 +1930,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 1, - Valaddress: i.VALADDRESS_1_B, + PoolAddress: i.POOL_ADDRESS_1_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -1945,7 +1945,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // Prepare bundle proposal s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1959,7 +1959,7 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1972,7 +1972,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", diff --git a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go index 64827c21..11387899 100644 --- a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go @@ -30,19 +30,19 @@ TEST CASES - invalid bundles var _ = Describe("invalid bundles", Ordered, func() { var s *i.KeeperTestSuite - var initialBalanceStaker0, initialBalanceValaddress0, initialBalanceStaker1, initialBalanceValaddress1, initialBalanceStaker2, initialBalanceValaddress2 uint64 + var initialBalanceStaker0, initialBalancePoolAddress0, initialBalanceStaker1, initialBalancePoolAddress1, initialBalanceStaker2, initialBalancePoolAddress2 uint64 BeforeEach(func() { // init new clean chain s = i.NewCleanChain() initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() @@ -79,13 +79,13 @@ var _ = Describe("invalid bundles", Ordered, func() { }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) }) AfterEach(func() { @@ -99,7 +99,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -109,7 +109,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -117,7 +117,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -135,23 +135,23 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -159,7 +159,7 @@ var _ = Describe("invalid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -169,7 +169,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -216,11 +216,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - _, uploaderActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, uploaderActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(uploaderActive).To(BeFalse()) - balanceValaddress := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) @@ -238,25 +238,25 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(200 * i.KYVE)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeEmpty()) // check voter 2 status - valaccountVoter, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress = s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress = s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter = s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter = s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.STAKER_2)).To(BeEmpty()) @@ -276,7 +276,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -286,7 +286,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -308,7 +308,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -322,7 +322,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -336,17 +336,17 @@ var _ = Describe("invalid bundles", Ordered, func() { }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -354,7 +354,7 @@ var _ = Describe("invalid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -364,7 +364,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -411,11 +411,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - _, uploaderActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, uploaderActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(uploaderActive).To(BeFalse()) - balanceValaddress := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) _, uploaderFound := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_0) @@ -437,25 +437,25 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(400 * i.KYVE)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeEmpty()) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeEmpty()) // check voter 2 status - valaccountVoter, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress = s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress = s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter = s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter = s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeEmpty()) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeEmpty()) @@ -475,7 +475,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -485,7 +485,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -507,7 +507,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -523,7 +523,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_3, PoolId: 0, - Valaddress: i.VALADDRESS_3_A, + PoolAddress: i.POOL_ADDRESS_3_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -538,7 +538,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -552,17 +552,17 @@ var _ = Describe("invalid bundles", Ordered, func() { }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -570,7 +570,7 @@ var _ = Describe("invalid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -578,7 +578,7 @@ var _ = Describe("invalid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_3_A, + Creator: i.POOL_ADDRESS_3_A, Staker: i.STAKER_3, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -588,7 +588,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -635,11 +635,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - _, uploaderActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, uploaderActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(uploaderActive).To(BeFalse()) - balanceValaddress := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) _, uploaderFound := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_0) @@ -669,11 +669,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(450 * i.KYVE)) // check voter status - _, voterActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) + _, voterActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) Expect(voterActive).To(BeFalse()) - balanceVoterValaddress := s.GetBalanceFromAddress(i.VALADDRESS_1_A) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress2)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress2)) balanceVoter := s.GetBalanceFromAddress(i.STAKER_1) Expect(balanceVoter).To(Equal(initialBalanceStaker2)) @@ -681,25 +681,25 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeEmpty()) // check voter2 status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress = s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress = s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter = s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter = s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.STAKER_2)).To(BeEmpty()) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.CHARLIE)).To(BeEmpty()) // check voter3 status - valaccountVoter, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_3) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_3, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress = s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress = s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter = s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter = s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_3, i.STAKER_3)).To(BeEmpty()) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_3, i.DAVID)).To(BeEmpty()) @@ -719,7 +719,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.5"), }) @@ -729,7 +729,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -737,7 +737,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -755,23 +755,23 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -779,7 +779,7 @@ var _ = Describe("invalid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -789,7 +789,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -836,11 +836,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - _, uploaderActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, uploaderActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(uploaderActive).To(BeFalse()) - balanceValaddress := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) @@ -858,25 +858,25 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(200 * i.KYVE)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeEmpty()) // check voter 2 status - valaccountVoter, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress = s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress = s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter = s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter = s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.STAKER_2)).To(BeEmpty()) @@ -902,7 +902,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.5"), }) @@ -912,7 +912,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -920,7 +920,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -938,23 +938,23 @@ var _ = Describe("invalid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetBalanceFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetBalanceFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetBalanceFromAddress(i.POOL_ADDRESS_2_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -962,7 +962,7 @@ var _ = Describe("invalid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -972,7 +972,7 @@ var _ = Describe("invalid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1019,11 +1019,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - _, uploaderActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, uploaderActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(uploaderActive).To(BeFalse()) - balanceValaddress := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) @@ -1043,25 +1043,25 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(200 * i.KYVE)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeEmpty()) // check voter 2 status - valaccountVoter, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress = s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress = s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter = s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter = s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.STAKER_2)).To(BeEmpty()) diff --git a/x/bundles/keeper/keeper_suite_points_test.go b/x/bundles/keeper/keeper_suite_points_test.go index 0f0f23a9..5e47129b 100644 --- a/x/bundles/keeper/keeper_suite_points_test.go +++ b/x/bundles/keeper/keeper_suite_points_test.go @@ -70,7 +70,7 @@ var _ = Describe("points", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -80,7 +80,7 @@ var _ = Describe("points", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -90,7 +90,7 @@ var _ = Describe("points", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -103,7 +103,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), pool) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -117,7 +117,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -136,7 +136,7 @@ var _ = Describe("points", Ordered, func() { // do not vote s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -150,8 +150,8 @@ var _ = Describe("points", Ordered, func() { }) // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(Equal(uint64(1))) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(Equal(uint64(1))) }) It("One validator votes after having not voted previously", func() { @@ -159,7 +159,7 @@ var _ = Describe("points", Ordered, func() { // do not vote s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -174,7 +174,7 @@ var _ = Describe("points", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -184,7 +184,7 @@ var _ = Describe("points", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -198,8 +198,8 @@ var _ = Describe("points", Ordered, func() { }) // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(BeZero()) }) It("One validator does not vote for multiple proposals in a row", func() { @@ -211,7 +211,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -225,7 +225,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -238,8 +238,8 @@ var _ = Describe("points", Ordered, func() { } // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(Equal(uint64(3))) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(Equal(uint64(3))) }) It("One validator votes after having not voted previously multiple times", func() { @@ -251,7 +251,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -265,7 +265,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -279,7 +279,7 @@ var _ = Describe("points", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -289,7 +289,7 @@ var _ = Describe("points", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -303,8 +303,8 @@ var _ = Describe("points", Ordered, func() { }) // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(BeZero()) }) It("One validator does not vote for multiple proposals and reaches max points", func() { @@ -319,7 +319,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -333,7 +333,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -352,8 +352,8 @@ var _ = Describe("points", Ordered, func() { _, stakerFound := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_2) Expect(stakerFound).To(BeTrue()) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountActive).To(BeFalse()) // check if voter got slashed slashAmountRatio := s.App().StakersKeeper.GetTimeoutSlash(s.Ctx()) @@ -371,7 +371,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -385,7 +385,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -404,7 +404,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -418,9 +418,9 @@ var _ = Describe("points", Ordered, func() { }) // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) // points are instantly 1 because node did not vote on this bundle, too - Expect(valaccountVoter.Points).To(Equal(uint64(1))) + Expect(poolAccountVoter.Points).To(Equal(uint64(1))) }) It("One validator does not vote for multiple proposals and skip the uploader role", func() { @@ -432,7 +432,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -446,7 +446,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -465,15 +465,15 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, FromIndex: 400, }) // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) }) It("One validator submits a bundle proposal where he reaches max points because he did not vote before", func() { @@ -487,7 +487,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -501,7 +501,7 @@ var _ = Describe("points", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -520,7 +520,7 @@ var _ = Describe("points", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -534,8 +534,8 @@ var _ = Describe("points", Ordered, func() { }) // ASSERT - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) // points are instantly 1 because node did not vote on this bundle, too - Expect(valaccountVoter.Points).To(Equal(uint64(1))) + Expect(poolAccountVoter.Points).To(Equal(uint64(1))) }) }) diff --git a/x/bundles/keeper/keeper_suite_stakers_leave_test.go b/x/bundles/keeper/keeper_suite_stakers_leave_test.go index f42c26d1..b056d4e6 100644 --- a/x/bundles/keeper/keeper_suite_stakers_leave_test.go +++ b/x/bundles/keeper/keeper_suite_stakers_leave_test.go @@ -77,7 +77,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -87,13 +87,13 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -113,7 +113,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -122,7 +122,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) // leave pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_0) + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_0, 0) s.CommitAfterSeconds(s.App().BundlesKeeper.GetUploadTimeout(s.Ctx())) s.CommitAfterSeconds(1) @@ -137,8 +137,8 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) Expect(poolStakers[0]).To(Equal(i.STAKER_1)) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountActive).To(BeFalse()) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(200 * i.KYVE)) @@ -153,7 +153,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -161,7 +161,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -175,7 +175,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -183,7 +183,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -191,7 +191,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) // leave pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_0) + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_0, 0) // overwrite next uploader for test purposes bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) @@ -202,7 +202,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -225,8 +225,8 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) Expect(poolStakers[0]).To(Equal(i.STAKER_1)) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountActive).To(BeFalse()) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(200 * i.KYVE)) @@ -264,7 +264,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -272,7 +272,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -286,7 +286,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -294,7 +294,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -302,7 +302,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) // leave pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_0) + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_0, 0) // overwrite next uploader for test purposes bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) @@ -313,7 +313,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -336,8 +336,8 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) Expect(poolStakers[0]).To(Equal(i.STAKER_1)) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountActive).To(BeFalse()) // check if next uploader got slashed fraction := s.App().StakersKeeper.GetUploadSlash(s.Ctx()) @@ -362,7 +362,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -370,7 +370,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -386,7 +386,7 @@ var _ = Describe("stakers leave", Ordered, func() { initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -394,7 +394,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -402,7 +402,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) // leave pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_1) + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0) // overwrite next uploader for test purposes bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) @@ -413,7 +413,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -436,8 +436,8 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) Expect(poolStakers[0]).To(Equal(i.STAKER_0)) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountActive).To(BeFalse()) // check if voter got slashed fraction := s.App().StakersKeeper.GetVoteSlash(s.Ctx()) @@ -462,7 +462,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -470,7 +470,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -484,7 +484,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -494,7 +494,7 @@ var _ = Describe("stakers leave", Ordered, func() { initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) // leave pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_1) + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0) // do not vote @@ -507,7 +507,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -530,8 +530,8 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) Expect(poolStakers[0]).To(Equal(i.STAKER_0)) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountActive).To(BeFalse()) // check if voter status @@ -554,7 +554,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -570,7 +570,7 @@ var _ = Describe("stakers leave", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -584,7 +584,7 @@ var _ = Describe("stakers leave", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -599,11 +599,11 @@ var _ = Describe("stakers leave", Ordered, func() { initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) // leave pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_1) + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "18SRvVuCrB8vy_OCLBaNbXONMVGeflGcw4gGTZ1oUt4", @@ -626,8 +626,8 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) Expect(poolStakers[0]).To(Equal(i.STAKER_0)) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountActive).To(BeFalse()) // check if voter not got slashed Expect(s.App().StakersKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(Equal(100 * i.KYVE)) diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 69804fec..c5870acd 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -36,7 +36,7 @@ TEST CASES - valid bundles var _ = Describe("valid bundles", Ordered, func() { var s *i.KeeperTestSuite - var initialBalanceStaker0, initialBalanceValaddress0, initialBalanceStaker1, initialBalanceValaddress1, initialBalanceStaker2, initialBalanceValaddress2 sdk.Coins + var initialBalanceStaker0, initialBalancePoolAddress0, initialBalanceStaker1, initialBalancePoolAddress1, initialBalanceStaker2, initialBalancePoolAddress2 sdk.Coins amountPerBundle := int64(10_000) BeforeEach(func() { @@ -44,13 +44,13 @@ var _ = Describe("valid bundles", Ordered, func() { s = i.NewCleanChain() initialBalanceStaker0 = s.GetCoinsFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetCoinsFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetCoinsFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) initialBalanceStaker2 = s.GetCoinsFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetCoinsFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetCoinsFromAddress(i.POOL_ADDRESS_2_A) // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() @@ -122,7 +122,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -132,22 +132,22 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) initialBalanceStaker0 = s.GetCoinsFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetCoinsFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetCoinsFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) s.CommitAfterSeconds(60) }) @@ -159,7 +159,7 @@ var _ = Describe("valid bundles", Ordered, func() { It("Produce a valid bundle with multiple validators and no foreign delegations", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -173,7 +173,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -181,7 +181,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -189,7 +189,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -249,24 +249,24 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) @@ -277,7 +277,7 @@ var _ = Describe("valid bundles", Ordered, func() { // assert commission rewards // (total_bundle_payout - treasury_reward - storage_cost) * commission + storage_cost // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * 0.1 + (100 * 0.5) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -305,7 +305,7 @@ var _ = Describe("valid bundles", Ordered, func() { )) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -319,7 +319,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -327,7 +327,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -335,7 +335,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -395,30 +395,30 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * 0.1 + (100 * 0.5) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) // assert uploader self delegation rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * (1 - 0.1) * (1/4) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(i.ACoins(2216).String())) @@ -459,7 +459,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -471,7 +471,7 @@ var _ = Describe("valid bundles", Ordered, func() { )) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -485,7 +485,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -493,7 +493,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -501,7 +501,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -561,30 +561,30 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccountVoter.Points).To(Equal(uint64(1))) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccountVoter.Points).To(Equal(uint64(1))) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * 0.1 + (100 * 0.5) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) // assert uploader self delegation rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * (1 - 0.1) * (1/4) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(i.ACoins(2216).String())) @@ -625,7 +625,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -637,7 +637,7 @@ var _ = Describe("valid bundles", Ordered, func() { )) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -651,7 +651,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -659,7 +659,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -667,7 +667,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -675,7 +675,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -735,30 +735,30 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * 0.1 + (100 * 0.5) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) // assert uploader self delegation rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * (1 - 0.1) * (1/4) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(i.ACoins(2216).String())) @@ -799,7 +799,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -811,7 +811,7 @@ var _ = Describe("valid bundles", Ordered, func() { )) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -825,7 +825,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -833,7 +833,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -841,7 +841,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker2 = s.GetCoinsFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetCoinsFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetCoinsFromAddress(i.POOL_ADDRESS_2_A) c1 := s.GetCoinsFromCommunityPool() @@ -849,7 +849,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -909,11 +909,11 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // calculate voter slashes fraction := s.App().StakersKeeper.GetVoteSlash(s.Ctx()) @@ -926,23 +926,23 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(800 * i.KYVE)) // check voter status - _, voterActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) + _, voterActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) Expect(voterActive).To(BeFalse()) - balanceVoterValaddress := s.GetCoinsFromAddress(i.VALADDRESS_2_A) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress2)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(i.POOL_ADDRESS_2_A) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress2)) balanceVoter := s.GetCoinsFromAddress(i.STAKER_2) Expect(balanceVoter).To(Equal(initialBalanceStaker2)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * 0.1 + (100 * 0.5) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) // assert uploader self delegation rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * (1 - 0.1) * (1/4) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(i.ACoins(2216).String())) @@ -973,7 +973,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -990,13 +990,13 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_3, PoolId: 0, - Valaddress: i.VALADDRESS_3_A, + PoolAddress: i.POOL_ADDRESS_3_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -1004,7 +1004,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1018,7 +1018,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1026,7 +1026,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1034,7 +1034,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_3_A, + Creator: i.POOL_ADDRESS_3_A, Staker: i.STAKER_3, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1042,7 +1042,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker2 = s.GetCoinsFromAddress(i.STAKER_2) - initialBalanceValaddress2 = s.GetCoinsFromAddress(i.VALADDRESS_2_A) + initialBalancePoolAddress2 = s.GetCoinsFromAddress(i.POOL_ADDRESS_2_A) c1 := s.GetCoinsFromCommunityPool() @@ -1051,7 +1051,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT // TODO: why is staker 2 selected as next uploader? s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1111,11 +1111,11 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // calculate voter slashes (due to maximum vote power only 200 kyve out of 400 where at risk for slashing) fraction := s.App().StakersKeeper.GetVoteSlash(s.Ctx()).Mul(math.LegacyMustNewDecFromStr("0.5")) // 200 / 400 @@ -1128,23 +1128,23 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(300 * i.KYVE)) // check voter status - _, voterActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) + _, voterActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) Expect(voterActive).To(BeFalse()) - balanceVoterValaddress := s.GetCoinsFromAddress(i.VALADDRESS_2_A) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress2)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(i.POOL_ADDRESS_2_A) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress2)) balanceVoter := s.GetCoinsFromAddress(i.STAKER_2) Expect(balanceVoter).To(Equal(initialBalanceStaker2)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * 0.1 + (100 * 0.5) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1035).String())) // assert uploader self delegation rewards // (10_000 - (10_000 * 0.01) - (100 * 0.5)) * (1 - 0.1) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(i.ACoins(8865).String())) @@ -1176,7 +1176,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.App().PoolKeeper.SetPool(s.Ctx(), pool) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1190,7 +1190,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1198,7 +1198,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -1206,7 +1206,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1266,24 +1266,24 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) @@ -1292,7 +1292,7 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(i.ACoins(8829).String())) // assert commission rewards // (10_000 - (10_000 * 0.01) - (100 * 0.9)) * 0.1 + (100 * 0.9) - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(i.ACoins(1071).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(i.ACoins(1071).String())) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -1315,7 +1315,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1329,7 +1329,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1337,7 +1337,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -1345,7 +1345,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1405,30 +1405,30 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards (here we round down since the result of commission rewards gets truncated) // (coin_amount_per_bundle - (coin_amount_per_bundle * 0.01) - _((100 * 0.5) / (3 * coin_weight))_) * 0.1 + _((100 * 0.5) / (3 * coin_weight))_ - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.ACoin(1004), i.BCoin(1987), i.CCoin(2974)).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.ACoin(1004), i.BCoin(1987), i.CCoin(2974)).String())) // assert uploader self delegation rewards (here we round up since the result of delegation rewards is the remainder minus the truncated commission rewards) // (coin_amount_per_bundle - (coin_amount_per_bundle * 0.01) - _((100 * 0.5) / (3 * coin_weight))_) * (1 - 0.1) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(sdk.NewCoins(i.ACoin(8896), i.BCoin(17813), i.CCoin(26726)).String())) @@ -1484,7 +1484,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1498,7 +1498,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1506,7 +1506,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -1514,7 +1514,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1574,30 +1574,30 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards (here we round down since the result of commission rewards gets truncated) // (10_000 - (10_000 * 0.01) - _((100 * 0.5) / (3 * coin_weight))_) * 0.1 + _((100 * 0.5) / (3 * coin_weight))_ - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.ACoin(1004), i.BCoin(997), i.CCoin(9900)).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.ACoin(1004), i.BCoin(997), i.CCoin(9900)).String())) // assert uploader self delegation rewards (here we round up since the result of delegation rewards is the remainder minus the truncated commission rewards) // (10_000 - (10_000 * 0.01) - _((100 * 0.5) / (3 * coin_weight))_) * (1 - 0.1) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(sdk.NewCoins(i.ACoin(8896), i.BCoin(8903)).String())) @@ -1647,7 +1647,7 @@ var _ = Describe("valid bundles", Ordered, func() { }, 0)) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1661,7 +1661,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1669,7 +1669,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -1677,7 +1677,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1737,30 +1737,30 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) // assert commission rewards (here we round down since the result of commission rewards gets truncated) // (10_000 - (10_000 * 0.01) - _((100 * 0.5) / (2 * coin_weight))_) * 0.1 + _((100 * 0.5) / (2 * coin_weight))_ - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.ACoin(1012), i.BCoin(1000)).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.ACoin(1012), i.BCoin(1000)).String())) // assert uploader self delegation rewards (here we round up since the result of delegation rewards is the remainder minus the truncated commission rewards) // (10_000 - (10_000 * 0.01) - _((100 * 0.5) / (2 * coin_weight))_) * (1 - 0.1) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(sdk.NewCoins(i.ACoin(8888), i.BCoin(8900)).String())) @@ -1842,7 +1842,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1856,7 +1856,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1864,7 +1864,7 @@ var _ = Describe("valid bundles", Ordered, func() { }) initialBalanceStaker1 = s.GetCoinsFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetCoinsFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetCoinsFromAddress(i.POOL_ADDRESS_1_A) c1 := s.GetCoinsFromCommunityPool() @@ -1872,7 +1872,7 @@ var _ = Describe("valid bundles", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1932,24 +1932,24 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetCoinsFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetCoinsFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetCoinsFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetCoinsFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetCoinsFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetCoinsFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // check uploader rewards - balanceUploader := s.GetCoinsFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetCoinsFromAddress(poolAccountUploader.Staker) // assert payout transfer Expect(balanceUploader.String()).To(Equal(initialBalanceStaker0.String())) @@ -1957,7 +1957,7 @@ var _ = Describe("valid bundles", Ordered, func() { // (amount_per_bundle - treasury_reward - storage_cost) * uploader_commission + storage_cost // storage_cost = 1MB * storage_price / coin_length * coin_price // (amount_per_bundle - (amount_per_bundle * 0.01) - _((1048576 * 0.000000006288 * 10**coin_decimals) / (4 * coin_weight))_) * 0.1 + _((1048576 * 0.000000006288) / (4 * coin_weight))_ - Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), valaccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.KYVECoin(125_973_187), i.ACoin(99_143), i.BCoin(116_661_015_771_428_571), i.CCoin(100_765)).String())) + Expect(s.App().StakersKeeper.GetOutstandingCommissionRewards(s.Ctx(), poolAccountUploader.Staker).String()).To(Equal(sdk.NewCoins(i.KYVECoin(125_973_187), i.ACoin(99_143), i.BCoin(116_661_015_771_428_571), i.CCoin(100_765)).String())) // assert uploader self delegation rewards (here we round up since the result of delegation rewards is the remainder minus the truncated commission rewards) // (amount_per_bundle - (amount_per_bundle * 0.01) - _((29970208 * 0.000000006288 * 1**coin_decimals) / (4 * coin_weight))_) * (1 - 0.1) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).String()).To(Equal(sdk.NewCoins(i.KYVECoin(864_026_813), i.ACoin(890_857), i.BCoin(873_338_984_228_571_429), i.CCoin(889_235)).String())) diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index d6134c86..70714bc1 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -27,7 +27,7 @@ TEST CASES - zero delegation var _ = Describe("zero delegation", Ordered, func() { var s *i.KeeperTestSuite - var initialBalanceStaker0, initialBalanceValaddress0, initialBalanceStaker1, initialBalanceValaddress1 uint64 + var initialBalanceStaker0, initialBalancePoolAddress0, initialBalanceStaker1, initialBalancePoolAddress1 uint64 amountPerBundle := uint64(10_000) @@ -36,10 +36,10 @@ var _ = Describe("zero delegation", Ordered, func() { s = i.NewCleanChain() initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() @@ -93,7 +93,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -103,13 +103,13 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -117,7 +117,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -131,7 +131,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -144,14 +144,14 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -167,7 +167,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -194,7 +194,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -204,13 +204,13 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -218,7 +218,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -237,14 +237,14 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -252,7 +252,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -268,7 +268,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -302,7 +302,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -313,7 +313,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -324,7 +324,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -337,7 +337,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -351,7 +351,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -359,7 +359,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -369,14 +369,14 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -434,22 +434,22 @@ var _ = Describe("zero delegation", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - valaccountUploader, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccountUploader.Points).To(BeZero()) + poolAccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccountUploader.Points).To(BeZero()) - balanceUploaderValaddress := s.GetBalanceFromAddress(valaccountUploader.Valaddress) - Expect(balanceUploaderValaddress).To(Equal(initialBalanceValaddress0)) + balanceUploaderValaddress := s.GetBalanceFromAddress(poolAccountUploader.PoolAddress) + Expect(balanceUploaderValaddress).To(Equal(initialBalancePoolAddress0)) - balanceUploader := s.GetBalanceFromAddress(valaccountUploader.Staker) + balanceUploader := s.GetBalanceFromAddress(poolAccountUploader.Staker) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) // calculate uploader rewards @@ -480,7 +480,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -491,7 +491,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -502,7 +502,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -515,7 +515,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -529,7 +529,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -537,7 +537,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -547,14 +547,14 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_1_A) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -601,11 +601,11 @@ var _ = Describe("zero delegation", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // check uploader status - _, uploaderActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, uploaderActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(uploaderActive).To(BeFalse()) - balanceValaddress := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - Expect(balanceValaddress).To(Equal(initialBalanceValaddress0)) + balancePoolAddress := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + Expect(balancePoolAddress).To(Equal(initialBalancePoolAddress0)) balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) _, uploaderFound := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_0) @@ -622,13 +622,13 @@ var _ = Describe("zero delegation", Ordered, func() { Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(200*i.KYVE - slashAmount)) // check voter status - valaccountVoter, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountVoter.Points).To(BeZero()) + poolAccountVoter, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountVoter.Points).To(BeZero()) - balanceVoterValaddress := s.GetBalanceFromAddress(valaccountVoter.Valaddress) - Expect(balanceVoterValaddress).To(Equal(initialBalanceValaddress1)) + balanceVoterPoolAddress := s.GetBalanceFromAddress(poolAccountVoter.PoolAddress) + Expect(balanceVoterPoolAddress).To(Equal(initialBalancePoolAddress1)) - balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) + balanceVoter := s.GetBalanceFromAddress(poolAccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().StakersKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeEmpty()) @@ -648,7 +648,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -659,7 +659,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -670,7 +670,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -683,7 +683,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -697,7 +697,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -716,7 +716,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -730,7 +730,7 @@ var _ = Describe("zero delegation", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -749,8 +749,8 @@ var _ = Describe("zero delegation", Ordered, func() { _, stakerFound := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_1) Expect(stakerFound).To(BeTrue()) - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccountActive).To(BeFalse()) // check if voter got slashed slashAmountRatio := s.App().StakersKeeper.GetTimeoutSlash(s.Ctx()) @@ -766,7 +766,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -776,7 +776,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -789,7 +789,7 @@ var _ = Describe("zero delegation", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index e2a18130..efe19348 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -59,7 +59,7 @@ func (k Keeper) AssertCanVote(ctx sdk.Context, poolId uint64, staker string, vot } // Check if sender is a staker in pool - if err := k.stakerKeeper.AssertValaccountAuthorized(ctx, poolId, staker, voter); err != nil { + if err := k.stakerKeeper.AssertPoolAccountAuthorized(ctx, staker, poolId, voter); err != nil { return err } @@ -99,7 +99,7 @@ func (k Keeper) AssertCanPropose(ctx sdk.Context, poolId uint64, staker string, } // Check if sender is a staker in pool - if err := k.stakerKeeper.AssertValaccountAuthorized(ctx, poolId, staker, proposer); err != nil { + if err := k.stakerKeeper.AssertPoolAccountAuthorized(ctx, staker, poolId, proposer); err != nil { return err } @@ -162,16 +162,16 @@ func (k Keeper) validateSubmitBundleArgs(ctx sdk.Context, bundleProposal *types. // slashDelegatorsAndRemoveStaker slashes a staker with a certain slashType and all including // delegators and removes him from the storage pool -func (k Keeper) slashDelegatorsAndRemoveStaker(ctx sdk.Context, poolId uint64, stakerAddress string, slashType stakersTypes.SlashType) { +func (k Keeper) slashDelegatorsAndRemoveStaker(ctx sdk.Context, stakerAddress string, poolId uint64, slashType stakersTypes.SlashType) { k.stakerKeeper.Slash(ctx, poolId, stakerAddress, slashType) k.stakerKeeper.LeavePool(ctx, stakerAddress, poolId) } -// resetPoints resets the points from a valaccount to zero -func (k Keeper) resetPoints(ctx sdk.Context, poolId uint64, stakerAddress string) { - previousPoints := k.stakerKeeper.ResetPoints(ctx, poolId, stakerAddress) +// resetPoints resets the points from a pool account to zero +func (k Keeper) resetPoints(ctx sdk.Context, stakerAddress string, poolId uint64) { + previousPoints := k.stakerKeeper.ResetPoints(ctx, stakerAddress, poolId) - // only reset points if valaccount has at least a point + // only reset points if pool account has at least a point if previousPoints > 0 { _ = ctx.EventManager().EmitTypedEvent(&types.EventPointsReset{ PoolId: poolId, @@ -180,11 +180,11 @@ func (k Keeper) resetPoints(ctx sdk.Context, poolId uint64, stakerAddress string } } -// addPoint increases the points of a valaccount with one and automatically +// addPoint increases the points of a pool account with one and automatically // slashes and removes the staker once he reaches max points -func (k Keeper) addPoint(ctx sdk.Context, poolId uint64, stakerAddress string) { +func (k Keeper) addPoint(ctx sdk.Context, stakerAddress string, poolId uint64) { // Add one point to staker in given pool - points := k.stakerKeeper.IncrementPoints(ctx, poolId, stakerAddress) + points := k.stakerKeeper.IncrementPoints(ctx, stakerAddress, poolId) _ = ctx.EventManager().EmitTypedEvent(&types.EventPointIncreased{ PoolId: poolId, @@ -194,8 +194,8 @@ func (k Keeper) addPoint(ctx sdk.Context, poolId uint64, stakerAddress string) { if points >= k.GetMaxPoints(ctx) { // slash all delegators with a timeout slash and remove staker from pool. - // points are reset due to the valaccount being deleted while leaving the pool - k.slashDelegatorsAndRemoveStaker(ctx, poolId, stakerAddress, stakersTypes.SLASH_TYPE_TIMEOUT) + // points are reset due to the pool account being deleted while leaving the pool + k.slashDelegatorsAndRemoveStaker(ctx, stakerAddress, poolId, stakersTypes.SLASH_TYPE_TIMEOUT) } } @@ -221,7 +221,7 @@ func (k Keeper) handleNonVoters(ctx sdk.Context, poolId uint64) { for _, staker := range k.stakerKeeper.GetAllStakerAddressesOfPool(ctx, poolId) { if !voters[staker] { - k.addPoint(ctx, poolId, staker) + k.addPoint(ctx, staker, poolId) } } } @@ -583,7 +583,7 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle // slash stakers who voted incorrectly for _, voter := range bundleProposal.VotersInvalid { - k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, stakersTypes.SLASH_TYPE_VOTE) + k.slashDelegatorsAndRemoveStaker(ctx, voter, poolId, stakersTypes.SLASH_TYPE_VOTE) } return types.TallyResult{ @@ -602,9 +602,9 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle // slash stakers who voted incorrectly - uploader receives upload slash for _, voter := range bundleProposal.VotersValid { if voter == bundleProposal.Uploader { - k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, stakersTypes.SLASH_TYPE_UPLOAD) + k.slashDelegatorsAndRemoveStaker(ctx, voter, poolId, stakersTypes.SLASH_TYPE_UPLOAD) } else { - k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, stakersTypes.SLASH_TYPE_VOTE) + k.slashDelegatorsAndRemoveStaker(ctx, voter, poolId, stakersTypes.SLASH_TYPE_VOTE) } } diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index e527a3ba..9fa3dca1 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -105,7 +105,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -116,7 +116,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -136,7 +136,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -147,7 +147,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -172,7 +172,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -183,7 +183,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -221,7 +221,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -232,7 +232,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -270,7 +270,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -281,7 +281,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -292,7 +292,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -332,7 +332,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -343,7 +343,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -354,7 +354,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -394,7 +394,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -414,7 +414,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -425,7 +425,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -463,7 +463,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -474,7 +474,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -510,7 +510,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -521,14 +521,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -536,7 +536,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -554,10 +554,10 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CreateValidator(i.STAKER_2, "Staker-2", int64(100*i.KYVE)) // ACT - err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_2, i.VALADDRESS_2_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") + err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_2, i.POOL_ADDRESS_2_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") // ASSERT - Expect(err).To(Equal(stakertypes.ErrValaccountUnauthorized)) + Expect(err).To(Equal(stakertypes.ErrPoolAccountUnauthorized)) }) It("Assert can vote if bundle is dropped", func() { @@ -567,7 +567,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -578,14 +578,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -593,7 +593,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -611,7 +611,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(1) // ACT - err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.VALADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") + err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.POOL_ADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") // ASSERT Expect(err).To(Equal(bundlesTypes.ErrBundleDropped)) @@ -624,7 +624,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -635,14 +635,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -651,7 +651,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "another_storage_id", @@ -667,7 +667,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.Commit() // ACT - err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.VALADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") + err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.POOL_ADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") // ASSERT Expect(err).To(Equal(bundlesTypes.ErrInvalidStorageId)) @@ -680,7 +680,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -691,14 +691,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -707,7 +707,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -724,7 +724,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -732,7 +732,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) // ACT - err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.VALADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") + err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.POOL_ADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") // ASSERT Expect(err).To(Equal(bundlesTypes.ErrAlreadyVotedValid)) @@ -745,7 +745,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -756,14 +756,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -772,7 +772,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -789,7 +789,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -797,7 +797,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) // ACT - err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.VALADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") + err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.POOL_ADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") // ASSERT Expect(err).To(Equal(bundlesTypes.ErrAlreadyVotedInvalid)) @@ -810,7 +810,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -821,14 +821,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -837,7 +837,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -854,7 +854,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) // ACT - err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.VALADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") + err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_1, i.POOL_ADDRESS_1_A, "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI") // ASSERT Expect(err).NotTo(HaveOccurred()) @@ -869,7 +869,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -880,14 +880,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -896,10 +896,10 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) // ACT - err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_2, i.VALADDRESS_2_A, 0) + err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_2, i.POOL_ADDRESS_2_A, 0) // ASSERT - Expect(err).To(Equal(stakertypes.ErrValaccountUnauthorized)) + Expect(err).To(Equal(stakertypes.ErrPoolAccountUnauthorized)) }) It("Assert can propose if sender is not next uploader", func() { @@ -909,7 +909,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -920,14 +920,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -936,7 +936,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) // ACT - err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_1, i.VALADDRESS_1_A, 0) + err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_1, i.POOL_ADDRESS_1_A, 0) // ASSERT Expect(err.Error()).To(Equal(errors.Wrapf(bundlesTypes.ErrNotDesignatedUploader, "expected %v received %v", i.STAKER_0, i.STAKER_1).Error())) @@ -949,7 +949,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -960,14 +960,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -976,7 +976,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(30) // ACT - err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.VALADDRESS_0_A, 0) + err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.POOL_ADDRESS_0_A, 0) // ASSERT pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) @@ -992,7 +992,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -1003,14 +1003,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -1019,7 +1019,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) // ACT - err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.VALADDRESS_0_A, 1000) + err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.POOL_ADDRESS_0_A, 1000) // ASSERT Expect(err).To(HaveOccurred()) @@ -1032,7 +1032,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -1043,14 +1043,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -1059,7 +1059,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.WaitSeconds(60) // ACT - err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.VALADDRESS_0_A, 0) + err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.POOL_ADDRESS_0_A, 0) // ASSERT Expect(err).NotTo(HaveOccurred()) diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout.go index 338b3e5b..0523994d 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout.go @@ -111,10 +111,10 @@ func (k Keeper) HandleUploadTimeout(goCtx context.Context) { k.SetBundleProposal(ctx, bundleProposal) } - // Now we increase the points of the valaccount + // Now we increase the points of the pool account // (if he is still active in the pool) - if _, active := k.stakerKeeper.GetValaccount(ctx, pool.Id, timedoutUploader); active { - k.addPoint(ctx, pool.Id, timedoutUploader) + if _, active := k.stakerKeeper.GetPoolAccount(ctx, timedoutUploader, pool.Id); active { + k.addPoint(ctx, timedoutUploader, pool.Id) } } } diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index 847aa16d..8e70d9ef 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -97,7 +97,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -105,7 +105,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -118,7 +118,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Next uploader can stay although pool ran out of funds", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -173,7 +173,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Next uploader gets removed due to pool upgrading", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -212,7 +212,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Next uploader gets removed due to pool being disabled", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -244,7 +244,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Next uploader gets removed due to pool not reaching min delegation", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -284,7 +284,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Next uploader gets removed due to pool having validators with too much voting power", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -314,7 +314,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of genesis bundle and upload interval and timeout does not pass", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -342,7 +342,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of genesis bundle and upload timeout does not pass but upload interval passes", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -371,7 +371,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of genesis bundle and upload timeout does pass together with upload interval", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -391,8 +391,8 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) // check if next uploader received a point - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Points).To(Equal(uint64(1))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Points).To(Equal(uint64(1))) _, found := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_0) Expect(found).To(BeTrue()) @@ -407,7 +407,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of bundle proposal and upload interval does not pass", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -415,7 +415,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -429,7 +429,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -459,7 +459,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of bundle proposal and upload timeout does not pass", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -467,7 +467,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -481,7 +481,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -512,7 +512,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of bundle proposal and upload timeout passes with the previous bundle being valid", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -520,7 +520,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -534,7 +534,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -561,12 +561,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) // check that staker 0 has no points - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Points).To(Equal(uint64(0))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Points).To(Equal(uint64(0))) // check that staker 1 (next uploader) received a point for not uploading - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccount.Points).To(Equal(uint64(1))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccount.Points).To(Equal(uint64(1))) // check that nobody got slashed expectedBalance := 100 * i.KYVE @@ -580,7 +580,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker is next uploader of bundle proposal and upload timeout passes with the previous bundle not reaching quorum", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -588,7 +588,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -621,12 +621,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(poolStakers).To(ContainElements(i.STAKER_0, i.STAKER_1)) // check that staker 0 (uploader) has no points - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Points).To(Equal(uint64(0))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Points).To(Equal(uint64(0))) // check that staker 1 received a point for not voting - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccount.Points).To(Equal(uint64(1))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccount.Points).To(Equal(uint64(1))) // check that nobody got slashed expectedBalance := 100 * i.KYVE @@ -650,13 +650,13 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -664,7 +664,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -678,7 +678,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -686,7 +686,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -715,12 +715,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(poolStakers).To(ContainElements(i.STAKER_1, i.STAKER_2)) // check that staker 1 (next uploader) received a point for missing the upload - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccount.Points).To(Equal(uint64(1))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccount.Points).To(Equal(uint64(1))) // check that staker 2 has a no points - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccount.Points).To(Equal(uint64(0))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccount.Points).To(Equal(uint64(0))) // check that staker 0 (uploader) got slashed expectedBalance := 100*i.KYVE - uint64(s.App().StakersKeeper.GetUploadSlash(s.Ctx()).Mul(math.LegacyNewDec(int64(100*i.KYVE))).TruncateInt64()) @@ -747,13 +747,13 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -761,7 +761,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -775,7 +775,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -793,7 +793,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -807,7 +807,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -845,12 +845,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(poolStakers).To(ContainElements(i.STAKER_0, i.STAKER_1)) // check that staker 0 (uploader) has no points - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_1) - Expect(valaccount.Points).To(Equal(uint64(0))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0) + Expect(poolAccount.Points).To(Equal(uint64(0))) // check that staker 2 has a no points - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_2) - Expect(valaccount.Points).To(Equal(uint64(0))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0) + Expect(poolAccount.Points).To(Equal(uint64(0))) // check that staker 0 (uploader) didn't get slashed expectedBalance := 100 * i.KYVE @@ -871,7 +871,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("A bundle proposal with no quorum does not reach the upload interval", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -879,7 +879,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -915,7 +915,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("A bundle proposal with no quorum does reach the upload interval", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -923,7 +923,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -977,13 +977,13 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -991,7 +991,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1004,8 +1004,8 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { BundleSummary: "test_value", }) - // remove valaccount directly from pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_1) + // remove pool account directly from pool + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0) // ACT s.CommitAfterSeconds(60) @@ -1043,13 +1043,13 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -1057,7 +1057,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1071,7 +1071,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1079,15 +1079,15 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", Vote: bundletypes.VOTE_TYPE_VALID, }) - // remove valaccount directly from pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_1) + // remove pool account directly from pool + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0) // ACT s.CommitAfterSeconds(s.App().BundlesKeeper.GetUploadTimeout(s.Ctx())) @@ -1131,13 +1131,13 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -1145,7 +1145,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1159,7 +1159,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1167,15 +1167,15 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", Vote: bundletypes.VOTE_TYPE_INVALID, }) - // remove valaccount directly from pool - s.App().StakersKeeper.RemoveValaccountFromPool(s.Ctx(), 0, i.STAKER_0) + // remove pool account directly from pool + s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_0, 0) // ACT s.CommitAfterSeconds(s.App().BundlesKeeper.GetUploadTimeout(s.Ctx()) + 60) @@ -1239,7 +1239,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -1247,7 +1247,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 1, - Valaddress: i.VALADDRESS_1_B, + PoolAddress: i.POOL_ADDRESS_1_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -1261,13 +1261,13 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 1, - Valaddress: i.VALADDRESS_2_B, + PoolAddress: i.POOL_ADDRESS_2_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_1_B, + Creator: i.POOL_ADDRESS_1_B, Staker: i.STAKER_1, PoolId: 1, }) @@ -1275,7 +1275,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_B, + Creator: i.POOL_ADDRESS_1_B, Staker: i.STAKER_1, PoolId: 1, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1289,7 +1289,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_0_B, + Creator: i.POOL_ADDRESS_0_B, Staker: i.STAKER_0, PoolId: 1, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -1307,7 +1307,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s.App().BundlesKeeper.SetBundleProposal(s.Ctx(), bundleProposal) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_B, + Creator: i.POOL_ADDRESS_1_B, Staker: i.STAKER_1, PoolId: 1, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1321,7 +1321,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_0_B, + Creator: i.POOL_ADDRESS_0_B, Staker: i.STAKER_0, PoolId: 1, StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", @@ -1357,8 +1357,8 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(poolStakers).To(HaveLen(2)) // check if next uploader received a point - _, valaccountActive := s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_2) - Expect(valaccountActive).To(BeFalse()) + _, poolAccountActive := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 1) + Expect(poolAccountActive).To(BeFalse()) _, found = s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_2) Expect(found).To(BeTrue()) diff --git a/x/bundles/keeper/logic_round_robin_test.go b/x/bundles/keeper/logic_round_robin_test.go index 2cb3c442..470661fa 100644 --- a/x/bundles/keeper/logic_round_robin_test.go +++ b/x/bundles/keeper/logic_round_robin_test.go @@ -43,7 +43,7 @@ func joinDummyWithStakeFraction(s *i.KeeperTestSuite, index, kyveAmount uint64, s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.DUMMY[index], PoolId: 0, - Valaddress: i.VALDUMMY[index], + PoolAddress: i.VALDUMMY[index], Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: stakeFraction, diff --git a/x/bundles/keeper/msg_server_claim_uploader_role.go b/x/bundles/keeper/msg_server_claim_uploader_role.go index f0cf3985..1aeccdc7 100644 --- a/x/bundles/keeper/msg_server_claim_uploader_role.go +++ b/x/bundles/keeper/msg_server_claim_uploader_role.go @@ -24,7 +24,7 @@ func (k msgServer) ClaimUploaderRole( return nil, poolErr } - if err := k.stakerKeeper.AssertValaccountAuthorized(ctx, msg.PoolId, msg.Staker, msg.Creator); err != nil { + if err := k.stakerKeeper.AssertPoolAccountAuthorized(ctx, msg.Staker, msg.PoolId, msg.Creator); err != nil { return nil, err } diff --git a/x/bundles/keeper/msg_server_claim_uploader_role_test.go b/x/bundles/keeper/msg_server_claim_uploader_role_test.go index 3698692b..3cc05aff 100644 --- a/x/bundles/keeper/msg_server_claim_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_claim_uploader_role_test.go @@ -19,8 +19,8 @@ TEST CASES - msg_server_claim_uploader_role.go * Try to claim uploader role without pool being funded * Try to claim uploader role without being a staker * Try to claim uploader role if the next uploader is not set yet -* Try to claim uploader role with non-existing valaccount -* Try to claim uploader role with valaccount that belongs to another pool +* Try to claim uploader role with non-existing pool account +* Try to claim uploader role with pool account that belongs to another pool */ @@ -63,7 +63,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -73,7 +73,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -88,7 +88,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -109,7 +109,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, }) @@ -130,7 +130,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -155,7 +155,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) }) - It("Try to claim uploader role with non existing valaccount", func() { + It("Try to claim uploader role with non existing pool account", func() { // ARRANGE s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ Creator: i.ALICE, @@ -166,7 +166,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -176,7 +176,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { Expect(found).To(BeFalse()) }) - It("Try to claim uploader role with valaccount that belongs to another pool", func() { + It("Try to claim uploader role with pool account that belongs to another pool", func() { // ARRANGE s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ Creator: i.ALICE, @@ -206,14 +206,14 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ACT s.RunTxBundlesError(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_B, + Creator: i.POOL_ADDRESS_0_B, Staker: i.STAKER_0, PoolId: 0, }) @@ -233,14 +233,14 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) // ACT s.RunTxBundlesError(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, }) diff --git a/x/bundles/keeper/msg_server_skip_uploader_role.go b/x/bundles/keeper/msg_server_skip_uploader_role.go index 66da8df7..14df948f 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role.go @@ -18,7 +18,7 @@ func (k msgServer) SkipUploaderRole(goCtx context.Context, msg *types.MsgSkipUpl bundleProposal, _ := k.GetBundleProposal(ctx, msg.PoolId) // reset points of uploader as node has proven to be active - k.resetPoints(ctx, msg.PoolId, msg.Staker) + k.resetPoints(ctx, msg.Staker, msg.PoolId) // If previous bundle was dropped just skip uploader role // No previous round needs to be evaluated diff --git a/x/bundles/keeper/msg_server_skip_uploader_role_test.go b/x/bundles/keeper/msg_server_skip_uploader_role_test.go index ef6fac03..9d7ed2c3 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role_test.go @@ -67,7 +67,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -77,13 +77,13 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -93,7 +93,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -102,7 +102,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -123,7 +123,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { It("Skip uploader role on data bundle if staker is next uploader", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -131,7 +131,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -143,7 +143,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, FromIndex: 100, @@ -176,16 +176,16 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(found).To(BeFalse()) // check that no validator got a point for the second round - valaccounts := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) - for _, valaccount := range valaccounts { - Expect(valaccount.Points).To(BeZero()) + poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) + for _, poolAccount := range poolAccounts { + Expect(poolAccount.Points).To(BeZero()) } }) It("Skip uploader on data bundle after uploader role has already been skipped", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -193,7 +193,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -204,7 +204,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { s.WaitSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, FromIndex: 100, @@ -215,7 +215,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, FromIndex: 100, @@ -248,9 +248,9 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(found).To(BeFalse()) // check that no validator got a point for the second round - valaccounts := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) - for _, valaccount := range valaccounts { - Expect(valaccount.Points).To(BeZero()) + poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) + for _, poolAccount := range poolAccounts { + Expect(poolAccount.Points).To(BeZero()) } }) @@ -265,7 +265,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, FromIndex: 0, @@ -297,13 +297,13 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(found).To(BeFalse()) // check that no validator got a point for the second round - valaccounts := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) - for _, valaccount := range valaccounts { - if valaccount.Staker == i.STAKER_0 { - Expect(valaccount.Points).To(BeZero()) + poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) + for _, poolAccount := range poolAccounts { + if poolAccount.Staker == i.STAKER_0 { + Expect(poolAccount.Points).To(BeZero()) } else { // All others have one point because they did not vote at all - Expect(valaccount.Points).To(Equal(uint64(1))) + Expect(poolAccount.Points).To(Equal(uint64(1))) } } }) @@ -311,7 +311,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { It("Skip uploader role on data bundle with current round containing a valid bundle", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -319,7 +319,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -331,7 +331,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, FromIndex: 100, @@ -364,16 +364,16 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(finalizedBundle.Uploader).To(Equal(i.STAKER_0)) // check if no validator got a point for the second round - valaccounts := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) - for _, valaccount := range valaccounts { - Expect(valaccount.Points).To(BeZero()) + poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) + for _, poolAccount := range poolAccounts { + Expect(poolAccount.Points).To(BeZero()) } }) It("Skip uploader role on data bundle with current round containing an invalid bundle", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -381,7 +381,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -393,7 +393,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, FromIndex: 100, @@ -423,9 +423,9 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(found).To(BeFalse()) // check that no validator got a point - valaccounts := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) - for _, valaccount := range valaccounts { - Expect(valaccount.Points).To(BeZero()) + poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) + for _, poolAccount := range poolAccounts { + Expect(poolAccount.Points).To(BeZero()) } }) }) diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal.go b/x/bundles/keeper/msg_server_submit_bundle_proposal.go index b37ffd48..d9c183aa 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal.go @@ -23,7 +23,7 @@ func (k msgServer) SubmitBundleProposal(goCtx context.Context, msg *types.MsgSub } // Reset points of uploader as node has proven to be active. - k.resetPoints(ctx, msg.PoolId, msg.Staker) + k.resetPoints(ctx, msg.Staker, msg.PoolId) // If previous bundle was dropped just register the new bundle. // No previous round needs to be evaluated diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go index 22299c1d..b7a04f32 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go @@ -73,7 +73,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -83,13 +83,13 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -105,7 +105,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "", @@ -131,7 +131,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -157,7 +157,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -183,7 +183,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -209,7 +209,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -235,7 +235,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -261,7 +261,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -300,7 +300,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -339,7 +339,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -378,7 +378,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", diff --git a/x/bundles/keeper/msg_server_vote_bundle_proposal.go b/x/bundles/keeper/msg_server_vote_bundle_proposal.go index f2978713..b020861f 100644 --- a/x/bundles/keeper/msg_server_vote_bundle_proposal.go +++ b/x/bundles/keeper/msg_server_vote_bundle_proposal.go @@ -46,7 +46,7 @@ func (k msgServer) VoteBundleProposal( k.SetBundleProposal(ctx, bundleProposal) // reset points as user has now proven to be active - k.resetPoints(ctx, msg.PoolId, msg.Staker) + k.resetPoints(ctx, msg.Staker, msg.PoolId) // Emit a vote event. _ = ctx.EventManager().EmitTypedEvent(&types.EventBundleVote{ diff --git a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go index a21c2480..1379a43e 100644 --- a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go @@ -71,7 +71,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -81,19 +81,19 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -114,7 +114,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { It("Try to vote abstain on proposal again", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -123,7 +123,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesError(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -141,7 +141,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { It("Try to vote valid on proposal after abstain vote", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -150,7 +150,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -168,7 +168,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { It("Try to vote invalid on proposal after abstain vote", func() { // ARRANGE s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -177,7 +177,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -195,7 +195,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { It("Try to vote unspecified on proposal", func() { // ACT s.RunTxBundlesError(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -222,13 +222,13 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", @@ -237,7 +237,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { // ACT s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_2_A, + Creator: i.POOL_ADDRESS_2_A, Staker: i.STAKER_2, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", diff --git a/x/bundles/types/expected_keepers.go b/x/bundles/types/expected_keepers.go index e4d64802..44341f38 100644 --- a/x/bundles/types/expected_keepers.go +++ b/x/bundles/types/expected_keepers.go @@ -29,16 +29,16 @@ type PoolKeeper interface { type StakerKeeper interface { GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) - AssertValaccountAuthorized(ctx sdk.Context, poolId uint64, stakerAddress string, valaddress string) error + AssertPoolAccountAuthorized(ctx sdk.Context, stakerAddress string, poolId uint64, poolAddress string) error - GetValaccount(ctx sdk.Context, poolId uint64, stakerAddress string) (valaccount stakersTypes.Valaccount, active bool) + GetPoolAccount(ctx sdk.Context, stakerAddress string, poolId uint64) (poolAccount stakersTypes.PoolAccount, active bool) - LeavePool(ctx sdk.Context, staker string, poolId uint64) + LeavePool(ctx sdk.Context, stakerAddress string, poolId uint64) - IncrementPoints(ctx sdk.Context, poolId uint64, stakerAddress string) (newPoints uint64) - ResetPoints(ctx sdk.Context, poolId uint64, stakerAddress string) (previousPoints uint64) + IncrementPoints(ctx sdk.Context, stakerAddress string, poolId uint64) (newPoints uint64) + ResetPoints(ctx sdk.Context, stakerAddress string, poolId uint64) (previousPoints uint64) - GetValidator(ctx sdk.Context, staker string) (stakingtypes.Validator, bool) + GetValidator(ctx sdk.Context, stakerAddress string) (stakingtypes.Validator, bool) GetValidatorPoolCommission(ctx sdk.Context, staker string, poolId uint64) math.LegacyDec GetValidatorPoolStake(ctx sdk.Context, staker string, poolId uint64) uint64 GetTotalStakeOfPool(ctx sdk.Context, poolId uint64) (totalStake uint64) diff --git a/x/pool/keeper/msg_server_disable_pool_test.go b/x/pool/keeper/msg_server_disable_pool_test.go index 21245f67..c2d086d4 100644 --- a/x/pool/keeper/msg_server_disable_pool_test.go +++ b/x/pool/keeper/msg_server_disable_pool_test.go @@ -370,7 +370,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -381,7 +381,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -392,7 +392,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { Id: 0, } - Expect(s.App().StakersKeeper.GetAllValaccounts(s.Ctx())).To(HaveLen(2)) + Expect(s.App().StakersKeeper.GetAllPoolAccounts(s.Ctx())).To(HaveLen(2)) p, v := BuildGovernanceTxs(s, []sdk.Msg{msgFirstPool}) @@ -411,7 +411,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { // ASSERT proposal, _ := s.App().GovKeeper.Proposals.Get(s.Ctx(), 1) - Expect(s.App().StakersKeeper.GetAllValaccounts(s.Ctx())).To(HaveLen(0)) + Expect(s.App().StakersKeeper.GetAllPoolAccounts(s.Ctx())).To(HaveLen(0)) firstPool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) @@ -434,7 +434,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -443,7 +443,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -454,7 +454,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -465,7 +465,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { Id: 0, } - Expect(s.App().StakersKeeper.GetAllValaccounts(s.Ctx())).To(HaveLen(3)) + Expect(s.App().StakersKeeper.GetAllPoolAccounts(s.Ctx())).To(HaveLen(3)) p, v := BuildGovernanceTxs(s, []sdk.Msg{msgFirstPool}) @@ -484,7 +484,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { // ASSERT proposal, _ := s.App().GovKeeper.Proposals.Get(s.Ctx(), 1) - Expect(s.App().StakersKeeper.GetAllValaccounts(s.Ctx())).To(HaveLen(1)) + Expect(s.App().StakersKeeper.GetAllPoolAccounts(s.Ctx())).To(HaveLen(1)) firstPool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) @@ -507,7 +507,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -518,14 +518,14 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -533,7 +533,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", diff --git a/x/query/client/cli/query_can_validate.go b/x/query/client/cli/query_can_validate.go index b2f42171..a7c1fda7 100644 --- a/x/query/client/cli/query_can_validate.go +++ b/x/query/client/cli/query_can_validate.go @@ -14,8 +14,8 @@ var _ = strconv.Itoa(0) func CmdCanValidate() *cobra.Command { cmd := &cobra.Command{ - Use: "can-validate [pool_id] [valaddress]", - Short: "Query if current valaddress can vote in pool", + Use: "can-validate [pool_id] [pool_address]", + Short: "Query if current pool address can vote in pool", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { reqId, err := cast.ToUint64E(args[0]) @@ -31,8 +31,8 @@ func CmdCanValidate() *cobra.Command { queryClient := types.NewQueryBundlesClient(clientCtx) params := &types.QueryCanValidateRequest{ - PoolId: reqId, - Valaddress: args[1], + PoolId: reqId, + PoolAddress: args[1], } res, err := queryClient.CanValidate(cmd.Context(), params) diff --git a/x/query/keeper/grpc_query_can_propose_test.go b/x/query/keeper/grpc_query_can_propose_test.go index 37db7135..5bd521ab 100644 --- a/x/query/keeper/grpc_query_can_propose_test.go +++ b/x/query/keeper/grpc_query_can_propose_test.go @@ -27,7 +27,7 @@ TEST CASES - grpc_query_can_propose.go * Call can propose if pool is disabled * Call can propose if pool is out of funds * Call can propose if pool has not reached the minimum stake -* Call can propose with a valaccount which does not exist +* Call can propose with a pool account which does not exist * Call can propose as a staker who is not the next uploader * Call can propose before the upload interval passed * Call can propose with an invalid from height @@ -70,7 +70,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -81,14 +81,14 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -96,7 +96,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", @@ -110,7 +110,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { }) s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -129,7 +129,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 1, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -140,7 +140,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(Equal(errors.Wrapf(errorsTypes.ErrNotFound, pooltypes.ErrPoolNotFound.Error(), 1).Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 1, StorageId: "test_storage_id", @@ -173,7 +173,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -184,7 +184,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(Equal(bundletypes.ErrPoolCurrentlyUpgrading.Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -212,7 +212,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -223,7 +223,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(Equal(bundletypes.ErrPoolDisabled.Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -252,7 +252,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -263,7 +263,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(Equal(bundletypes.ErrMinDelegationNotReached.Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -280,12 +280,12 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(txErr.Error()).To(Equal(canPropose.Reason)) }) - It("Call can propose with a valaccount which does not exist", func() { + It("Call can propose with a pool account which does not exist", func() { // ACT canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_0, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -293,10 +293,10 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(err).To(BeNil()) Expect(canPropose.Possible).To(BeFalse()) - Expect(canPropose.Reason).To(Equal(stakertypes.ErrValaccountUnauthorized.Error())) + Expect(canPropose.Reason).To(Equal(stakertypes.ErrPoolAccountUnauthorized.Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", @@ -325,14 +325,14 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err = s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) } else { canPropose, err = s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_0, - Proposer: i.VALADDRESS_0_A, + Proposer: i.POOL_ADDRESS_0_A, FromIndex: 100, }) } @@ -352,7 +352,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { if bundleProposal.NextUploader == i.STAKER_0 { _, txErr = s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -366,7 +366,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { }) } else { _, txErr = s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", @@ -396,7 +396,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -409,7 +409,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(Equal(errors.Wrapf(bundletypes.ErrUploadInterval, "expected %v < %v", s.Ctx().BlockTime().Unix(), bundleProposal.UpdatedAt+pool.UploadInterval).Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -431,14 +431,14 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose_1, err_1 := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 99, }) canPropose_2, err_2 := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 101, }) @@ -456,7 +456,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose_2.Reason).To(Equal(errors.Wrapf(bundletypes.ErrFromIndex, "expected %v received %v", pool.CurrentIndex+bundleProposal.BundleSize, 101).Error())) _, txErr_1 := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -473,7 +473,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(txErr_1.Error()).To(Equal(canPropose_1.Reason)) _, txErr_2 := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -495,7 +495,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -506,7 +506,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(BeEmpty()) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -534,7 +534,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{ PoolId: 0, Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1_A, + Proposer: i.POOL_ADDRESS_1_A, FromIndex: 100, }) @@ -545,7 +545,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(BeEmpty()) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", diff --git a/x/query/keeper/grpc_query_can_validate.go b/x/query/keeper/grpc_query_can_validate.go index 9617ea48..b1ade1c8 100644 --- a/x/query/keeper/grpc_query_can_validate.go +++ b/x/query/keeper/grpc_query_can_validate.go @@ -25,10 +25,10 @@ func (k Keeper) CanValidate(c context.Context, req *types.QueryCanValidateReques var staker string - // Check if valaddress has a valaccount in pool - for _, valaccount := range k.stakerKeeper.GetAllValaccountsOfPool(ctx, req.PoolId) { - if valaccount.Valaddress == req.Valaddress { - staker = valaccount.Staker + // Check if pool address has a pool account in pool + for _, poolAccount := range k.stakerKeeper.GetAllPoolAccountsOfPool(ctx, req.PoolId) { + if poolAccount.PoolAddress == req.PoolAddress { + staker = poolAccount.Staker break } } @@ -36,7 +36,7 @@ func (k Keeper) CanValidate(c context.Context, req *types.QueryCanValidateReques if staker == "" { return &types.QueryCanValidateResponse{ Possible: false, - Reason: "no valaccount found", + Reason: "no pool account found", }, nil } diff --git a/x/query/keeper/grpc_query_can_validate_test.go b/x/query/keeper/grpc_query_can_validate_test.go index 4900c805..69dc544f 100644 --- a/x/query/keeper/grpc_query_can_validate_test.go +++ b/x/query/keeper/grpc_query_can_validate_test.go @@ -17,9 +17,9 @@ import ( TEST CASES - grpc_query_can_validate.go * Call can validate if pool does not exist -* Call can validate if valaddress does not exist -* Call can validate with a valaddress which belongs to another pool -* Call can validate with a valid valaddress +* Call can validate if pool address does not exist +* Call can validate with a pool address which belongs to another pool +* Call can validate with a valid pool address */ @@ -47,7 +47,7 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -58,7 +58,7 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 1, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -72,8 +72,8 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { It("Call can validate if pool does not exist", func() { // ACT canValidate, err := s.App().QueryKeeper.CanValidate(s.Ctx(), &querytypes.QueryCanValidateRequest{ - PoolId: 2, - Valaddress: i.VALADDRESS_0_A, + PoolId: 2, + PoolAddress: i.POOL_ADDRESS_0_A, }) // ASSERT @@ -83,39 +83,39 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { Expect(canValidate.Reason).To(Equal(errors.Wrapf(errorsTypes.ErrNotFound, pooltypes.ErrPoolNotFound.Error(), 2).Error())) }) - It("Call can validate if valaddress does not exist", func() { + It("Call can validate if pool address does not exist", func() { // ACT canValidate, err := s.App().QueryKeeper.CanValidate(s.Ctx(), &querytypes.QueryCanValidateRequest{ - PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolId: 0, + PoolAddress: i.POOL_ADDRESS_2_A, }) // ASSERT Expect(err).To(BeNil()) Expect(canValidate.Possible).To(BeFalse()) - Expect(canValidate.Reason).To(Equal("no valaccount found")) + Expect(canValidate.Reason).To(Equal("no pool account found")) }) - It("Call can validate with a valaddress which belongs to another pool", func() { + It("Call can validate with a pool address which belongs to another pool", func() { // ACT canValidate, err := s.App().QueryKeeper.CanValidate(s.Ctx(), &querytypes.QueryCanValidateRequest{ - PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolId: 0, + PoolAddress: i.POOL_ADDRESS_1_A, }) // ASSERT Expect(err).To(BeNil()) Expect(canValidate.Possible).To(BeFalse()) - Expect(canValidate.Reason).To(Equal("no valaccount found")) + Expect(canValidate.Reason).To(Equal("no pool account found")) }) - It("Call can validate with a valid valaddress", func() { + It("Call can validate with a valid pool address", func() { // ACT canValidate, err := s.App().QueryKeeper.CanValidate(s.Ctx(), &querytypes.QueryCanValidateRequest{ - PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolId: 0, + PoolAddress: i.POOL_ADDRESS_0_A, }) // ASSERT diff --git a/x/query/keeper/grpc_query_can_vote_test.go b/x/query/keeper/grpc_query_can_vote_test.go index 465f71e5..5f88eaa6 100644 --- a/x/query/keeper/grpc_query_can_vote_test.go +++ b/x/query/keeper/grpc_query_can_vote_test.go @@ -26,7 +26,7 @@ TEST CASES - grpc_query_can_vote.go * Call can vote if pool is currently upgrading * Call can vote if pool is disabled * Call can vote if pool has not reached the minimum stake -* Call can vote with a valaccount which does not exist +* Call can vote with a pool account which does not exist * Call can vote if current bundle was dropped * Call can vote with a different storage id than the current one * Call can vote if voter has already voted valid @@ -71,7 +71,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -82,14 +82,14 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, }) @@ -97,7 +97,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { s.CommitAfterSeconds(60) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, + Creator: i.POOL_ADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", @@ -119,7 +119,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 1, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -130,7 +130,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(errors.Wrapf(errorsTypes.ErrNotFound, pooltypes.ErrPoolNotFound.Error(), 1).Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 1, StorageId: "test_storage_id", @@ -157,7 +157,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -168,7 +168,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrPoolCurrentlyUpgrading.Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -190,7 +190,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -201,7 +201,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrPoolDisabled.Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -224,7 +224,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -235,7 +235,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrMinDelegationNotReached.Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -246,12 +246,12 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(txErr.Error()).To(Equal(canVote.Reason)) }) - It("Call can vote with a valaccount which does not exist", func() { + It("Call can vote with a pool account which does not exist", func() { // ACT canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_0, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -259,10 +259,10 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(err).To(BeNil()) Expect(canVote.Possible).To(BeFalse()) - Expect(canVote.Reason).To(Equal(stakertypes.ErrValaccountUnauthorized.Error())) + Expect(canVote.Reason).To(Equal(stakertypes.ErrPoolAccountUnauthorized.Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", @@ -283,7 +283,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -294,7 +294,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrBundleDropped.Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -310,7 +310,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "another_test_storage_id", }) @@ -321,7 +321,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrInvalidStorageId.Error())) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "another_test_storage_id", @@ -335,7 +335,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { It("Call can vote if voter has already voted valid", func() { // ARRANGE _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -348,7 +348,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -359,7 +359,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrAlreadyVotedValid.Error())) _, txErr = s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -373,7 +373,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { It("Call can vote if voter has already voted invalid", func() { // ARRANGE _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -386,7 +386,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -397,7 +397,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal(bundletypes.ErrAlreadyVotedInvalid.Error())) _, txErr = s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -411,7 +411,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { It("Call can vote if voter has already voted abstain", func() { // ARRANGE _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -424,7 +424,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -435,7 +435,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(Equal("KYVE_VOTE_NO_ABSTAIN_ALLOWED")) _, txErr = s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -450,7 +450,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -461,7 +461,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(BeEmpty()) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", @@ -483,7 +483,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { canVote, err := s.App().QueryKeeper.CanVote(s.Ctx(), &querytypes.QueryCanVoteRequest{ PoolId: 0, Staker: i.STAKER_1, - Voter: i.VALADDRESS_1_A, + Voter: i.POOL_ADDRESS_1_A, StorageId: "test_storage_id", }) @@ -494,7 +494,7 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { Expect(canVote.Reason).To(BeEmpty()) _, txErr := s.RunTx(&bundletypes.MsgVoteBundleProposal{ - Creator: i.VALADDRESS_1_A, + Creator: i.POOL_ADDRESS_1_A, Staker: i.STAKER_1, PoolId: 0, StorageId: "test_storage_id", diff --git a/x/query/keeper/grpc_query_stakers_by_pool.go b/x/query/keeper/grpc_query_stakers_by_pool.go index d62aa750..b89b1af4 100644 --- a/x/query/keeper/grpc_query_stakers_by_pool.go +++ b/x/query/keeper/grpc_query_stakers_by_pool.go @@ -24,9 +24,9 @@ func (k Keeper) StakersByPool(c context.Context, req *types.QueryStakersByPoolRe stakers := make([]types.FullStaker, 0) - valaccounts := k.stakerKeeper.GetAllValaccountsOfPool(ctx, req.PoolId) - for _, valaccount := range valaccounts { - stakers = append(stakers, *k.GetFullStaker(ctx, valaccount.Staker)) + poolAccounts := k.stakerKeeper.GetAllPoolAccountsOfPool(ctx, req.PoolId) + for _, poolAccount := range poolAccounts { + stakers = append(stakers, *k.GetFullStaker(ctx, poolAccount.Staker)) } stakes := k.stakerKeeper.GetValidatorPoolStakes(ctx, req.PoolId) diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index 0105ff2f..a52e3620 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -13,13 +13,13 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full var poolMemberships []*types.PoolMembership totalPoolStake := uint64(0) - for _, valaccount := range k.stakerKeeper.GetValaccountsFromStaker(ctx, stakerAddress) { - pool, _ := k.poolKeeper.GetPool(ctx, valaccount.PoolId) + for _, poolAccount := range k.stakerKeeper.GetPoolAccountsFromStaker(ctx, stakerAddress) { + pool, _ := k.poolKeeper.GetPool(ctx, poolAccount.PoolId) - accountValaddress, _ := sdk.AccAddressFromBech32(valaccount.Valaddress) - balanceValaccount := k.bankKeeper.GetBalance(ctx, accountValaddress, globalTypes.Denom).Amount.Uint64() + poolAddressAccount, _ := sdk.AccAddressFromBech32(poolAccount.PoolAddress) + balancePoolAddress := k.bankKeeper.GetBalance(ctx, poolAddressAccount, globalTypes.Denom).Amount.Uint64() - commissionChange, found := k.stakerKeeper.GetCommissionChangeEntryByIndex2(ctx, stakerAddress, valaccount.PoolId) + commissionChange, found := k.stakerKeeper.GetCommissionChangeEntryByIndex2(ctx, stakerAddress, poolAccount.PoolId) var commissionChangeEntry *types.CommissionChangeEntry = nil if found { commissionChangeEntry = &types.CommissionChangeEntry{ @@ -28,7 +28,7 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full } } - stakeFractionChange, found := k.stakerKeeper.GetStakeFractionChangeEntryByIndex2(ctx, stakerAddress, valaccount.PoolId) + stakeFractionChange, found := k.stakerKeeper.GetStakeFractionChangeEntryByIndex2(ctx, stakerAddress, poolAccount.PoolId) var stakeFractionChangeEntry *types.StakeFractionChangeEntry = nil if found { stakeFractionChangeEntry = &types.StakeFractionChangeEntry{ @@ -53,13 +53,13 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full TotalStake: k.stakerKeeper.GetTotalStakeOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool), }, - Points: valaccount.Points, - IsLeaving: valaccount.IsLeaving, - Valaddress: valaccount.Valaddress, - Balance: balanceValaccount, - Commission: valaccount.Commission, + Points: poolAccount.Points, + IsLeaving: poolAccount.IsLeaving, + PoolAddress: poolAccount.PoolAddress, + Balance: balancePoolAddress, + Commission: poolAccount.Commission, PendingCommissionChange: commissionChangeEntry, - StakeFraction: valaccount.StakeFraction, + StakeFraction: poolAccount.StakeFraction, PendingStakeFractionChange: stakeFractionChangeEntry, PoolStake: poolStake, }, diff --git a/x/query/types/bundles.pb.go b/x/query/types/bundles.pb.go index 67a13817..5ee44df5 100644 --- a/x/query/types/bundles.pb.go +++ b/x/query/types/bundles.pb.go @@ -747,8 +747,8 @@ func (m *QueryCurrentVoteStatusResponse) GetTotal() uint64 { type QueryCanValidateRequest struct { // pool_id defines the unique ID of the pool. PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // valaddress ... - Valaddress string `protobuf:"bytes,2,opt,name=valaddress,proto3" json:"valaddress,omitempty"` + // pool_address ... + PoolAddress string `protobuf:"bytes,2,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` } func (m *QueryCanValidateRequest) Reset() { *m = QueryCanValidateRequest{} } @@ -791,9 +791,9 @@ func (m *QueryCanValidateRequest) GetPoolId() uint64 { return 0 } -func (m *QueryCanValidateRequest) GetValaddress() string { +func (m *QueryCanValidateRequest) GetPoolAddress() string { if m != nil { - return m.Valaddress + return m.PoolAddress } return "" } @@ -1130,83 +1130,82 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/bundles.proto", fileDescriptor_b49b126c38ac815c) } var fileDescriptor_b49b126c38ac815c = []byte{ - // 1201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xba, 0x8e, 0x7f, 0x3c, 0x37, 0xf9, 0xb6, 0xd3, 0x24, 0xdd, 0xba, 0xa9, 0x93, 0xee, - 0x57, 0x90, 0x28, 0x45, 0xde, 0x26, 0x3d, 0x40, 0x4f, 0x88, 0xb4, 0x84, 0xba, 0x2d, 0x55, 0xd8, - 0x48, 0x91, 0xe0, 0x80, 0x35, 0xf6, 0x4e, 0xec, 0x55, 0xec, 0x9d, 0xed, 0xce, 0xd8, 0xad, 0x89, - 0x2c, 0x21, 0xc4, 0x89, 0x13, 0x12, 0x42, 0x88, 0x1b, 0x82, 0x13, 0xdc, 0x39, 0x70, 0xe3, 0xd8, - 0x63, 0x25, 0x2e, 0x88, 0x43, 0x85, 0x12, 0xf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, 0xf9, - 0xe1, 0x78, 0xeb, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xab, 0x99, 0xc4, 0xd0, 0x0e, 0x00, - 0x00, + // 1199 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xba, 0x8e, 0x3f, 0x9e, 0x93, 0xd0, 0x4e, 0xd3, 0x76, 0xeb, 0xa6, 0x4e, 0xb2, 0x08, + 0x12, 0xa5, 0x68, 0xb7, 0x49, 0x2f, 0x54, 0x9c, 0x92, 0x96, 0x50, 0xb7, 0xa5, 0x0a, 0x1b, 0x11, + 0x09, 0x0e, 0x58, 0x63, 0xef, 0xc4, 0x5e, 0xc5, 0xde, 0xd9, 0xee, 0x8c, 0xdd, 0x9a, 0x28, 0x12, + 0x42, 0x9c, 0x38, 0x21, 0x21, 0x84, 0xb8, 0x21, 0x24, 0x2e, 0x70, 0xe6, 0xc0, 0x8d, 0x63, 0x8f, + 0x95, 0xb8, 0x20, 0x0e, 0x15, 0x4a, 0xf8, 0x43, 0xd0, 0x7c, 0x78, 0xbd, 0x71, 0xec, 0x38, 0x2d, + 0x47, 0xb8, 0xf9, 0x7d, 0xff, 0xde, 0xdb, 0xf7, 0x7e, 0xde, 0x85, 0x85, 0xbd, 0x6e, 0x87, 0x38, + 0x8f, 0xdb, 0x24, 0xea, 0x3a, 0x9d, 0xd5, 0x2a, 0xe1, 0x78, 0xd5, 0xa9, 0xb6, 0x03, 0xaf, 0x49, + 0x98, 0x1d, 0x46, 0x94, 0x53, 0x84, 0x84, 0x87, 0x2d, 0x3d, 0x6c, 0xed, 0x51, 0x5c, 0xa9, 0x51, + 0xd6, 0xa2, 0xcc, 0xa9, 0x62, 0x36, 0x18, 0x1c, 0xe2, 0xba, 0x1f, 0x60, 0xee, 0xd3, 0x40, 0xc5, + 0x17, 0x67, 0xeb, 0xb4, 0x4e, 0xe5, 0x4f, 0x47, 0xfc, 0xd2, 0xda, 0xb9, 0x3a, 0xa5, 0xf5, 0x26, + 0x71, 0x70, 0xe8, 0x3b, 0x38, 0x08, 0x28, 0x97, 0x21, 0xba, 0xa6, 0xf5, 0x65, 0x1a, 0x5e, 0xdb, + 0xf4, 0x03, 0xdc, 0xf4, 0x3f, 0x25, 0xde, 0x86, 0x84, 0x83, 0xae, 0x40, 0x36, 0xa4, 0xb4, 0x59, + 0xf1, 0x3d, 0xd3, 0x58, 0x30, 0x96, 0xd3, 0x6e, 0x46, 0x88, 0x65, 0x0f, 0xcd, 0x40, 0xca, 0xf7, + 0xcc, 0x94, 0xd4, 0xa5, 0x7c, 0x0f, 0x5d, 0x07, 0x60, 0x9c, 0x46, 0xb8, 0x4e, 0x84, 0xef, 0xb9, + 0x05, 0x63, 0x39, 0xef, 0xe6, 0xb5, 0xa6, 0xec, 0xa1, 0x22, 0xe4, 0xda, 0x61, 0x93, 0x62, 0x8f, + 0x44, 0x66, 0x5a, 0x1a, 0x63, 0x59, 0x84, 0xee, 0x46, 0xb4, 0x55, 0xf1, 0x03, 0x8f, 0x3c, 0x35, + 0x27, 0x65, 0xca, 0xbc, 0xd0, 0x94, 0x85, 0x02, 0x5d, 0x85, 0x1c, 0xa7, 0xda, 0x98, 0x91, 0xc6, + 0x2c, 0xa7, 0xb1, 0x49, 0x46, 0xee, 0x91, 0xae, 0x59, 0x90, 0x59, 0xb3, 0x42, 0x7e, 0x40, 0xba, + 0xe8, 0x12, 0x64, 0x38, 0x95, 0x86, 0xac, 0x34, 0x4c, 0x72, 0x2a, 0xd4, 0x6f, 0xc0, 0x8c, 0x1a, + 0x74, 0x85, 0xb5, 0x5b, 0x2d, 0x1c, 0x75, 0xcd, 0x9c, 0x34, 0x4f, 0x2b, 0xed, 0xb6, 0x52, 0xa2, + 0x6b, 0x90, 0xf7, 0x30, 0xc7, 0x95, 0x06, 0x66, 0x0d, 0x33, 0xa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0x55, + 0x27, 0x2e, 0x20, 0x6b, 0x8e, 0x3a, 0x70, 0xf6, 0xfb, 0x14, 0x75, 0x80, 0x7e, 0x32, 0x20, 0xab, + 0x4f, 0x18, 0x2d, 0x9d, 0x3a, 0xb8, 0x3e, 0xc3, 0x14, 0x97, 0xc7, 0x3b, 0x6a, 0xc8, 0x0f, 0x25, + 0xe4, 0x4d, 0x74, 0x77, 0xe4, 0x74, 0x29, 0x1f, 0x8e, 0x57, 0x92, 0x90, 0x54, 0xf4, 0x38, 0xe8, + 0x60, 0xe3, 0xee, 0xb3, 0xc3, 0x92, 0xf1, 0xfc, 0xb0, 0x64, 0xfc, 0x75, 0x58, 0x32, 0xbe, 0x3a, + 0x2a, 0x4d, 0x3c, 0x3f, 0x2a, 0x4d, 0xfc, 0x71, 0x54, 0x9a, 0xf8, 0x78, 0xa5, 0xee, 0xf3, 0x46, + 0xbb, 0x6a, 0xd7, 0x68, 0xcb, 0x79, 0xf0, 0xd1, 0xce, 0xbb, 0x8f, 0x08, 0x7f, 0x42, 0xa3, 0x3d, + 0xa7, 0xd6, 0xc0, 0x7e, 0xe0, 0x3c, 0xd5, 0x85, 0x79, 0x37, 0x24, 0xac, 0x9a, 0x91, 0x5f, 0x8f, + 0xb7, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x2b, 0x1b, 0x05, 0xd5, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2029,10 +2028,10 @@ func (m *QueryCanValidateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if len(m.Valaddress) > 0 { - i -= len(m.Valaddress) - copy(dAtA[i:], m.Valaddress) - i = encodeVarintBundles(dAtA, i, uint64(len(m.Valaddress))) + if len(m.PoolAddress) > 0 { + i -= len(m.PoolAddress) + copy(dAtA[i:], m.PoolAddress) + i = encodeVarintBundles(dAtA, i, uint64(len(m.PoolAddress))) i-- dAtA[i] = 0x12 } @@ -2519,7 +2518,7 @@ func (m *QueryCanValidateRequest) Size() (n int) { if m.PoolId != 0 { n += 1 + sovBundles(uint64(m.PoolId)) } - l = len(m.Valaddress) + l = len(m.PoolAddress) if l > 0 { n += 1 + l + sovBundles(uint64(l)) } @@ -4313,7 +4312,7 @@ func (m *QueryCanValidateRequest) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valaddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4341,7 +4340,7 @@ func (m *QueryCanValidateRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Valaddress = string(dAtA[iNdEx:postIndex]) + m.PoolAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/query/types/bundles.pb.gw.go b/x/query/types/bundles.pb.gw.go index a9b34985..6b47b48e 100644 --- a/x/query/types/bundles.pb.gw.go +++ b/x/query/types/bundles.pb.gw.go @@ -257,15 +257,15 @@ func request_QueryBundles_CanValidate_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) } - val, ok = pathParams["valaddress"] + val, ok = pathParams["pool_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "valaddress") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_address") } - protoReq.Valaddress, err = runtime.String(val) + protoReq.PoolAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "valaddress", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_address", err) } msg, err := client.CanValidate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -295,15 +295,15 @@ func local_request_QueryBundles_CanValidate_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) } - val, ok = pathParams["valaddress"] + val, ok = pathParams["pool_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "valaddress") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_address") } - protoReq.Valaddress, err = runtime.String(val) + protoReq.PoolAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "valaddress", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_address", err) } msg, err := server.CanValidate(ctx, &protoReq) @@ -866,7 +866,7 @@ var ( pattern_QueryBundles_CurrentVoteStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kyve", "query", "v1beta1", "current_vote_status", "pool_id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_QueryBundles_CanValidate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"kyve", "query", "v1beta1", "can_validate", "pool_id", "valaddress"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_QueryBundles_CanValidate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"kyve", "query", "v1beta1", "can_validate", "pool_id", "pool_address"}, "", runtime.AssumeColonVerbOpt(true))) pattern_QueryBundles_CanPropose_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6, 1, 0, 4, 1, 5, 7}, []string{"kyve", "query", "v1beta1", "can_propose", "pool_id", "staker", "proposer", "from_index"}, "", runtime.AssumeColonVerbOpt(true))) diff --git a/x/query/types/query.pb.go b/x/query/types/query.pb.go index 40a905af..cbc2597a 100644 --- a/x/query/types/query.pb.go +++ b/x/query/types/query.pb.go @@ -336,12 +336,12 @@ type PoolMembership struct { // a PoolLeave entry. After the leave-time is over // the staker will no longer participate in that pool IsLeaving bool `protobuf:"varint,3,opt,name=is_leaving,json=isLeaving,proto3" json:"is_leaving,omitempty"` - // Valaddress is the address which is authorized to vote + // pool address is the address which is authorized to vote // and submit bundles. If the server gets compromised - // the staker can just change the valaddress. - Valaddress string `protobuf:"bytes,4,opt,name=valaddress,proto3" json:"valaddress,omitempty"` - // balance is the valaddress account balance and indicates - // whether or not the valaccount needs additional funds to + // the staker can just change the pool address . + PoolAddress string `protobuf:"bytes,4,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` + // balance is the pool address account balance and indicates + // whether or not the pool account needs additional funds to // pay for gas fees Balance uint64 `protobuf:"varint,5,opt,name=balance,proto3" json:"balance,omitempty"` // commission is the commission the validator has chosen for @@ -423,9 +423,9 @@ func (m *PoolMembership) GetIsLeaving() bool { return false } -func (m *PoolMembership) GetValaddress() string { +func (m *PoolMembership) GetPoolAddress() string { if m != nil { - return m.Valaddress + return m.PoolAddress } return "" } @@ -469,59 +469,59 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/query.proto", fileDescriptor_6b41255feae93a15) } var fileDescriptor_6b41255feae93a15 = []byte{ - // 825 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0x1b, 0x6f, 0x5a, 0x4f, 0xd8, 0x00, 0xa3, 0x65, 0xf1, 0x16, 0xea, 0x84, 0x2c, 0x12, - 0x61, 0x05, 0xb6, 0x5a, 0xb4, 0x12, 0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x1f, - 0x2e, 0x83, 0xc6, 0xd9, 0x65, 0xd0, 0xf8, 0xfd, 0x32, 0x68, 0x7c, 0xf3, 0x64, 0xe5, 0xb7, 0xec, - 0xf3, 0x97, 0x2f, 0x9e, 0x7d, 0x89, 0xc5, 0x09, 0xab, 0xa7, 0x51, 0x3a, 0x41, 0x84, 0x46, 0xdf, - 0x9a, 0x4f, 0x98, 0xfa, 0x4d, 0x1b, 0xb7, 0xd4, 0xa7, 0xe1, 0xa3, 0x7f, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x32, 0x03, 0xb7, 0x13, 0xdd, 0x06, 0x00, 0x00, + // 831 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x41, 0x6f, 0xdc, 0x44, + 0x14, 0x8e, 0xb3, 0xee, 0x26, 0x9e, 0x6d, 0x17, 0x18, 0x95, 0xe2, 0x06, 0xe2, 0xa4, 0x5b, 0x24, + 0x96, 0x0a, 0x6c, 0x25, 0xa8, 0x12, 0x37, 0x44, 0x92, 0x46, 0x02, 0x0a, 0x42, 0x8e, 0x54, 0x54, + 0x2e, 0xd6, 0xac, 0x3d, 0xf1, 0x8e, 0xd6, 0x9e, 0x71, 0x3d, 0xb3, 0x5b, 0xf6, 0xc8, 0x99, 0x0b, + 0x3f, 0x03, 0x21, 0x0e, 0xfc, 0x03, 0xae, 0x95, 0xb8, 0xf4, 0x88, 0x38, 0x14, 0x94, 0x1c, 0xf8, + 0x1b, 0x68, 0xde, 0xcc, 0x6c, 0x37, 0x61, 0x91, 0xda, 0x5e, 0x92, 0x79, 0xef, 0x7d, 0xf3, 0xde, + 0xf7, 0xde, 0xf7, 0x66, 0x8d, 0xa2, 0xc9, 0x7c, 0x46, 0x93, 0x47, 0x53, 0xda, 0xce, 0x93, 0xd9, + 0xde, 0x88, 0x2a, 0xb2, 0x67, 0xac, 0xb8, 0x69, 0x85, 0x12, 0x18,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0xa9, 0x5d, + 0xab, 0x10, 0x6d, 0x8c, 0x48, 0x45, 0x78, 0x4e, 0xe1, 0xfd, 0xfa, 0xa9, 0x33, 0x2f, 0x29, 0xd6, + 0x7d, 0x35, 0xc5, 0x28, 0xba, 0xd9, 0x50, 0x5e, 0x30, 0x5e, 0x66, 0xcf, 0xbd, 0x59, 0x0e, 0x8a, + 0x84, 0x1b, 0x30, 0x80, 0xf7, 0x57, 0x0d, 0x60, 0xe5, 0x12, 0xa5, 0x6f, 0xd9, 0x5c, 0x97, 0xa3, + 0x2b, 0x64, 0xdd, 0x7c, 0x65, 0x59, 0x05, 0xda, 0x76, 0x94, 0x2f, 0xe6, 0x74, 0xb4, 0x03, 0xa0, + 0xfd, 0xc1, 0x2a, 0xda, 0xff, 0xb7, 0x77, 0xe9, 0x96, 0x4d, 0xb9, 0x02, 0xa0, 0x45, 0x5c, 0x7a, + 0x92, 0x08, 0x54, 0x08, 0x1a, 0xf7, 0x1a, 0x0f, 0x8e, 0x9e, 0x9c, 0x45, 0xde, 0xd3, 0xb3, 0xc8, + 0xfb, 0xfb, 0x2c, 0xf2, 0x7e, 0x3c, 0x8f, 0xd6, 0x9e, 0x9e, 0x47, 0x6b, 0x7f, 0x9c, 0x47, 0x6b, + 0xdf, 0xde, 0x59, 0xfa, 0x39, 0xfb, 0xe2, 0xe1, 0x83, 0x7b, 0x5f, 0x51, 0xf5, 0x58, 0xb4, 0x93, + 0x24, 0x1f, 0x13, 0xc6, 0x93, 0xef, 0xec, 0x57, 0x0c, 0x7e, 0xd6, 0x46, 0x5d, 0xf8, 0x3a, 0x7c, + 0xf4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x38, 0x7d, 0xd3, 0x35, 0xe0, 0x06, 0x00, 0x00, } func (m *BasicPool) Marshal() (dAtA []byte, err error) { @@ -823,10 +823,10 @@ func (m *PoolMembership) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - if len(m.Valaddress) > 0 { - i -= len(m.Valaddress) - copy(dAtA[i:], m.Valaddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Valaddress))) + if len(m.PoolAddress) > 0 { + i -= len(m.PoolAddress) + copy(dAtA[i:], m.PoolAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PoolAddress))) i-- dAtA[i] = 0x22 } @@ -982,7 +982,7 @@ func (m *PoolMembership) Size() (n int) { if m.IsLeaving { n += 2 } - l = len(m.Valaddress) + l = len(m.PoolAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1786,7 +1786,7 @@ func (m *PoolMembership) Unmarshal(dAtA []byte) error { m.IsLeaving = bool(v != 0) case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valaddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1814,7 +1814,7 @@ func (m *PoolMembership) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Valaddress = string(dAtA[iNdEx:postIndex]) + m.PoolAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 0 { diff --git a/x/stakers/client/cli/tx_join_pool.go b/x/stakers/client/cli/tx_join_pool.go index 85bf1988..1c838a9c 100644 --- a/x/stakers/client/cli/tx_join_pool.go +++ b/x/stakers/client/cli/tx_join_pool.go @@ -12,7 +12,7 @@ import ( func CmdJoinPool() *cobra.Command { cmd := &cobra.Command{ - Use: "join-pool [pool_id] [valaddress] [amount] [commission] [stake_fraction]", + Use: "join-pool [pool_id] [pool_address] [amount] [commission] [stake_fraction]", Short: "Broadcast message join-pool", Args: cobra.ExactArgs(5), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -21,7 +21,7 @@ func CmdJoinPool() *cobra.Command { return err } - argValaddress := args[1] + argPoolAddress := args[1] argAmount, err := cast.ToUint64E(args[2]) if err != nil { @@ -46,7 +46,7 @@ func CmdJoinPool() *cobra.Command { msg := types.MsgJoinPool{ Creator: clientCtx.GetFromAddress().String(), PoolId: argPoolId, - Valaddress: argValaddress, + PoolAddress: argPoolAddress, Amount: argAmount, Commission: argCommission, StakeFraction: argStakeFraction, diff --git a/x/stakers/genesis.go b/x/stakers/genesis.go index a30b5bdf..3ecc59f2 100644 --- a/x/stakers/genesis.go +++ b/x/stakers/genesis.go @@ -11,8 +11,8 @@ import ( func InitGenesis(ctx sdk.Context, k *keeper.Keeper, genState types.GenesisState) { k.SetParams(ctx, genState.Params) - for _, entry := range genState.ValaccountList { - k.SetValaccount(ctx, entry) + for _, entry := range genState.PoolAccountList { + k.SetPoolAccount(ctx, entry) k.AddOneToCount(ctx, entry.PoolId) } @@ -38,7 +38,7 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.ValaccountList = k.GetAllValaccounts(ctx) + genesis.PoolAccountList = k.GetAllPoolAccounts(ctx) genesis.CommissionChangeEntries = k.GetAllCommissionChangeEntries(ctx) diff --git a/x/stakers/keeper/exported_functions.go b/x/stakers/keeper/exported_functions.go index 16df10bf..c0369461 100644 --- a/x/stakers/keeper/exported_functions.go +++ b/x/stakers/keeper/exported_functions.go @@ -27,21 +27,22 @@ import ( // LeavePool removes a staker from a pool and emits the corresponding event. // The staker is no longer able to participate in the given pool. // All points the staker had in that pool are deleted. -func (k Keeper) LeavePool(ctx sdk.Context, staker string, poolId uint64) { - k.RemoveValaccountFromPool(ctx, poolId, staker) +func (k Keeper) LeavePool(ctx sdk.Context, stakerAddress string, poolId uint64) { + k.RemovePoolAccountFromPool(ctx, stakerAddress, poolId) _ = ctx.EventManager().EmitTypedEvent(&stakertypes.EventLeavePool{ PoolId: poolId, - Staker: staker, + Staker: stakerAddress, }) } // GetAllStakerAddressesOfPool returns a list of all stakers -// which have currently a valaccount registered for the given pool +// which have currently a pool account registered for the given pool // and are therefore allowed to participate in that pool. func (k Keeper) GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) { - for _, valaccount := range k.GetAllValaccountsOfPool(ctx, poolId) { - stakers = append(stakers, valaccount.Staker) + poolAccounts := k.GetAllPoolAccountsOfPool(ctx, poolId) + for _, poolAccount := range poolAccounts { + stakers = append(stakers, poolAccount.Staker) } return stakers @@ -58,11 +59,11 @@ func (k Keeper) GetPaginatedStakersByPoolStake(ctx sdk.Context, pagination *quer for _, validator := range validators { address := util.MustAccountAddressFromValAddress(validator.OperatorAddress) - if stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_ACTIVE && len(k.GetValaccountsFromStaker(ctx, address)) == 0 { + if stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_ACTIVE && len(k.GetPoolAccountsFromStaker(ctx, address)) == 0 { continue } - if stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_INACTIVE && len(k.GetValaccountsFromStaker(ctx, address)) > 0 { + if stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_INACTIVE && len(k.GetPoolAccountsFromStaker(ctx, address)) > 0 { continue } @@ -105,7 +106,7 @@ func (k Keeper) GetPaginatedStakersByPoolCount(ctx sdk.Context, pagination *quer } sort.Slice(addresses, func(i, j int) bool { - return len(k.GetValaccountsFromStaker(ctx, addresses[i])) > len(k.GetValaccountsFromStaker(ctx, addresses[j])) + return len(k.GetPoolAccountsFromStaker(ctx, addresses[i])) > len(k.GetPoolAccountsFromStaker(ctx, addresses[j])) }) pageRes, err := arrayPaginationAccumulator(addresses, pagination, accumulator) @@ -116,18 +117,18 @@ func (k Keeper) GetPaginatedStakersByPoolCount(ctx sdk.Context, pagination *quer return pageRes, nil } -// AssertValaccountAuthorized checks if the given `valaddress` is allowed to vote in pool +// AssertPoolAccountAuthorized checks if the given `pool address` is allowed to vote in pool // with id `poolId` to vote in favor of `stakerAddress`. -// If the valaddress is not authorized the appropriate error is returned. +// If the pool address is not authorized the appropriate error is returned. // Otherwise, it returns `nil` -func (k Keeper) AssertValaccountAuthorized(ctx sdk.Context, poolId uint64, stakerAddress string, valaddress string) error { - valaccount, active := k.GetValaccount(ctx, poolId, stakerAddress) +func (k Keeper) AssertPoolAccountAuthorized(ctx sdk.Context, stakerAddress string, poolId uint64, poolAddress string) error { + poolAccount, active := k.GetPoolAccount(ctx, stakerAddress, poolId) if !active { - return stakertypes.ErrValaccountUnauthorized + return stakertypes.ErrPoolAccountUnauthorized } - if valaccount.Valaddress != valaddress { - return stakertypes.ErrValaccountUnauthorized + if poolAccount.PoolAddress != poolAddress { + return stakertypes.ErrPoolAccountUnauthorized } return nil @@ -157,8 +158,8 @@ func (k Keeper) IsVotingPowerTooHigh(ctx sdk.Context, poolId uint64) bool { } // GetValidator returns the Cosmos-validator for a given kyve-address. -func (k Keeper) GetValidator(ctx sdk.Context, staker string) (stakingTypes.Validator, bool) { - valAddress, err := sdk.ValAddressFromBech32(util.MustValaddressFromOperatorAddress(staker)) +func (k Keeper) GetValidator(ctx sdk.Context, stakerAddress string) (stakingTypes.Validator, bool) { + valAddress, err := sdk.ValAddressFromBech32(util.MustValaddressFromOperatorAddress(stakerAddress)) if err != nil { return stakingTypes.Validator{}, false } @@ -171,21 +172,21 @@ func (k Keeper) GetValidator(ctx sdk.Context, staker string) (stakingTypes.Valid } // GetValidatorPoolCommission returns the commission a validator has inside the pool -func (k Keeper) GetValidatorPoolCommission(ctx sdk.Context, staker string, poolId uint64) math.LegacyDec { - valaccount, _ := k.GetValaccount(ctx, poolId, staker) - return valaccount.Commission +func (k Keeper) GetValidatorPoolCommission(ctx sdk.Context, stakerAddress string, poolId uint64) math.LegacyDec { + poolAccount, _ := k.GetPoolAccount(ctx, stakerAddress, poolId) + return poolAccount.Commission } // GetValidatorPoolStake returns stake a validator has actively and at risk inside the pool -func (k Keeper) GetValidatorPoolStake(ctx sdk.Context, staker string, poolId uint64) uint64 { - return k.GetValidatorPoolStakes(ctx, poolId, staker)[staker] +func (k Keeper) GetValidatorPoolStake(ctx sdk.Context, stakerAddress string, poolId uint64) uint64 { + return k.GetValidatorPoolStakes(ctx, poolId, stakerAddress)[stakerAddress] } // GetValidatorTotalPoolStake returns the total stake the validator has combined in every pool func (k Keeper) GetValidatorTotalPoolStake(ctx sdk.Context, staker string) (totalStake uint64) { - valaccounts := k.GetValaccountsFromStaker(ctx, staker) - for _, valaccount := range valaccounts { - totalStake += k.GetValidatorPoolStake(ctx, valaccount.Staker, valaccount.PoolId) + poolAccounts := k.GetPoolAccountsFromStaker(ctx, staker) + for _, poolAccount := range poolAccounts { + totalStake += k.GetValidatorPoolStake(ctx, poolAccount.Staker, poolAccount.PoolId) } return @@ -238,11 +239,11 @@ func (k Keeper) GetValidatorPoolStakes(ctx sdk.Context, poolId uint64, mustInclu for _, address := range addresses { validator, _ := k.GetValidator(ctx, address) - valaccount, _ := k.GetValaccount(ctx, poolId, address) + poolAccount, _ := k.GetPoolAccount(ctx, address, poolId) // calculate the stake the validator has specifically chosen for this pool // with his stake fraction - stake := uint64(valaccount.StakeFraction.MulInt(validator.GetBondedTokens()).TruncateInt64()) + stake := uint64(poolAccount.StakeFraction.MulInt(validator.GetBondedTokens()).TruncateInt64()) stakes[address] = stake validators = append(validators, ValidatorStake{ diff --git a/x/stakers/keeper/getters_valaccount.go b/x/stakers/keeper/getters_pool_account.go similarity index 50% rename from x/stakers/keeper/getters_valaccount.go rename to x/stakers/keeper/getters_pool_account.go index 0535efb7..8ff51b8a 100644 --- a/x/stakers/keeper/getters_valaccount.go +++ b/x/stakers/keeper/getters_pool_account.go @@ -17,61 +17,61 @@ import ( // IncrementPoints increments to Points for a staker in a given pool. // Returns the amount of the current points (including the current incrementation) -func (k Keeper) IncrementPoints(ctx sdk.Context, poolId uint64, stakerAddress string) uint64 { - valaccount, found := k.GetValaccount(ctx, poolId, stakerAddress) +func (k Keeper) IncrementPoints(ctx sdk.Context, stakerAddress string, poolId uint64) uint64 { + poolAccount, found := k.GetPoolAccount(ctx, stakerAddress, poolId) if found { - valaccount.Points += 1 - k.SetValaccount(ctx, valaccount) + poolAccount.Points += 1 + k.SetPoolAccount(ctx, poolAccount) } - return valaccount.Points + return poolAccount.Points } // ResetPoints sets the point count for the staker in the given pool back to zero. // Returns the amount of points the staker had before the reset. -func (k Keeper) ResetPoints(ctx sdk.Context, poolId uint64, stakerAddress string) (previousPoints uint64) { - valaccount, found := k.GetValaccount(ctx, poolId, stakerAddress) +func (k Keeper) ResetPoints(ctx sdk.Context, stakerAddress string, poolId uint64) (previousPoints uint64) { + poolAccount, found := k.GetPoolAccount(ctx, stakerAddress, poolId) if found { - previousPoints = valaccount.Points - valaccount.Points = 0 - k.SetValaccount(ctx, valaccount) + previousPoints = poolAccount.Points + poolAccount.Points = 0 + k.SetPoolAccount(ctx, poolAccount) } return } -// GetAllValaccountsOfPool returns a list of all valaccount -func (k Keeper) GetAllValaccountsOfPool(ctx sdk.Context, poolId uint64) (val []*types.Valaccount) { +// GetAllPoolAccountsOfPool returns a list of all pool accounts +func (k Keeper) GetAllPoolAccountsOfPool(ctx sdk.Context, poolId uint64) (val []*types.PoolAccount) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.ValaccountPrefix) + store := prefix.NewStore(storeAdapter, types.PoolAccountPrefix) iterator := storeTypes.KVStorePrefixIterator(store, util.GetByteKey(poolId)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - valaccount := types.Valaccount{} - k.cdc.MustUnmarshal(iterator.Value(), &valaccount) + poolAccount := types.PoolAccount{} + k.cdc.MustUnmarshal(iterator.Value(), &poolAccount) - if valaccount.Valaddress != "" { - val = append(val, &valaccount) + if poolAccount.PoolAddress != "" { + val = append(val, &poolAccount) } } return } -// GetValaccountsFromStaker returns all pools the staker has valaccounts in -func (k Keeper) GetValaccountsFromStaker(ctx sdk.Context, stakerAddress string) (val []*types.Valaccount) { +// GetPoolAccountsFromStaker returns all pools the staker has pool accounts in +func (k Keeper) GetPoolAccountsFromStaker(ctx sdk.Context, stakerAddress string) (val []*types.PoolAccount) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - storeIndex2 := prefix.NewStore(storeAdapter, types.ValaccountPrefixIndex2) + storeIndex2 := prefix.NewStore(storeAdapter, types.PoolAccountPrefixIndex2) iterator := storeTypes.KVStorePrefixIterator(storeIndex2, util.GetByteKey(stakerAddress)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolId := binary.BigEndian.Uint64(iterator.Key()[len(stakerAddress) : len(stakerAddress)+8]) - valaccount, active := k.GetValaccount(ctx, poolId, stakerAddress) + poolAccount, active := k.GetPoolAccount(ctx, stakerAddress, poolId) if active { - val = append(val, &valaccount) + val = append(val, &poolAccount) } } @@ -82,7 +82,7 @@ func (k Keeper) GetValaccountsFromStaker(ctx sdk.Context, stakerAddress string) // currently participating. func (k Keeper) GetPoolCount(ctx sdk.Context, stakerAddress string) (poolCount uint64) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - storeIndex2 := prefix.NewStore(storeAdapter, types.ValaccountPrefixIndex2) + storeIndex2 := prefix.NewStore(storeAdapter, types.PoolAccountPrefixIndex2) iterator := storeTypes.KVStorePrefixIterator(storeIndex2, util.GetByteKey(stakerAddress)) defer iterator.Close() @@ -96,29 +96,29 @@ func (k Keeper) GetPoolCount(ctx sdk.Context, stakerAddress string) (poolCount u // # Raw KV-Store operations # // ############################# -// SetValaccount set a specific Valaccount in the store from its index -func (k Keeper) SetValaccount(ctx sdk.Context, valaccount types.Valaccount) { +// SetPoolAccount set a specific pool account in the store from its index +func (k Keeper) SetPoolAccount(ctx sdk.Context, poolAccount types.PoolAccount) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.ValaccountPrefix) - b := k.cdc.MustMarshal(&valaccount) - store.Set(types.ValaccountKey( - valaccount.PoolId, - valaccount.Staker, + store := prefix.NewStore(storeAdapter, types.PoolAccountPrefix) + b := k.cdc.MustMarshal(&poolAccount) + store.Set(types.PoolAccountKey( + poolAccount.PoolId, + poolAccount.Staker, ), b) - storeIndex2 := prefix.NewStore(storeAdapter, types.ValaccountPrefixIndex2) - storeIndex2.Set(types.ValaccountKeyIndex2( - valaccount.Staker, - valaccount.PoolId, + storeIndex2 := prefix.NewStore(storeAdapter, types.PoolAccountPrefixIndex2) + storeIndex2.Set(types.PoolAccountKeyIndex2( + poolAccount.Staker, + poolAccount.PoolId, ), []byte{}) } -// GetValaccount returns a Valaccount from its index -func (k Keeper) GetValaccount(ctx sdk.Context, poolId uint64, stakerAddress string) (val types.Valaccount, active bool) { +// GetPoolAccount returns a pool account from its index +func (k Keeper) GetPoolAccount(ctx sdk.Context, stakerAddress string, poolId uint64) (val types.PoolAccount, active bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.ValaccountPrefix) + store := prefix.NewStore(storeAdapter, types.PoolAccountPrefix) - b := store.Get(types.ValaccountKey( + b := store.Get(types.PoolAccountKey( poolId, stakerAddress, )) @@ -129,21 +129,21 @@ func (k Keeper) GetValaccount(ctx sdk.Context, poolId uint64, stakerAddress stri } k.cdc.MustUnmarshal(b, &val) - return val, val.Valaddress != "" + return val, val.PoolAddress != "" } -// GetAllValaccounts returns all active valaccounts -func (k Keeper) GetAllValaccounts(ctx sdk.Context) (list []types.Valaccount) { +// GetAllPoolAccounts returns all active pool accounts +func (k Keeper) GetAllPoolAccounts(ctx sdk.Context) (list []types.PoolAccount) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.ValaccountPrefix) + store := prefix.NewStore(storeAdapter, types.PoolAccountPrefix) iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Valaccount + var val types.PoolAccount k.cdc.MustUnmarshal(iterator.Value(), &val) - if val.Valaddress != "" { + if val.PoolAddress != "" { list = append(list, val) } } diff --git a/x/stakers/keeper/getters_staker.go b/x/stakers/keeper/getters_staker.go index 236bbde1..1d122e16 100644 --- a/x/stakers/keeper/getters_staker.go +++ b/x/stakers/keeper/getters_staker.go @@ -20,15 +20,15 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// AddValaccountToPool adds a valaccount to a pool. -// If valaccount already active in the to pool nothing happens. -func (k Keeper) AddValaccountToPool(ctx sdk.Context, poolId uint64, stakerAddress, valaddress string, commission, stakeFraction math.LegacyDec) { +// AddPoolAccountToPool adds a pool account to a pool. +// If pool account already active in the to pool nothing happens. +func (k Keeper) AddPoolAccountToPool(ctx sdk.Context, stakerAddress string, poolId uint64, poolAddress string, commission, stakeFraction math.LegacyDec) { if _, validatorExists := k.GetValidator(ctx, stakerAddress); validatorExists { - if _, active := k.GetValaccount(ctx, poolId, stakerAddress); !active { - k.SetValaccount(ctx, types.Valaccount{ + if _, active := k.GetPoolAccount(ctx, stakerAddress, poolId); !active { + k.SetPoolAccount(ctx, types.PoolAccount{ PoolId: poolId, Staker: stakerAddress, - Valaddress: valaddress, + PoolAddress: poolAddress, Commission: commission, StakeFraction: stakeFraction, }) @@ -37,15 +37,15 @@ func (k Keeper) AddValaccountToPool(ctx sdk.Context, poolId uint64, stakerAddres } } -// RemoveValaccountFromPool removes a valaccount from a given pool and updates -// all aggregated variables. If the valaccount is not in the pool nothing happens. -func (k Keeper) RemoveValaccountFromPool(ctx sdk.Context, poolId uint64, stakerAddress string) { - if valaccount, active := k.GetValaccount(ctx, poolId, stakerAddress); active { - // remove valaccount from pool by setting valaddress to zero address - valaccount.Valaddress = "" - valaccount.Points = 0 - valaccount.IsLeaving = false - k.SetValaccount(ctx, valaccount) +// RemovePoolAccountFromPool removes a pool account from a given pool and updates +// all aggregated variables. If the pool account is not in the pool nothing happens. +func (k Keeper) RemovePoolAccountFromPool(ctx sdk.Context, stakerAddress string, poolId uint64) { + if poolAccount, active := k.GetPoolAccount(ctx, stakerAddress, poolId); active { + // remove pool account from pool by setting pool address to zero address + poolAccount.PoolAddress = "" + poolAccount.Points = 0 + poolAccount.IsLeaving = false + k.SetPoolAccount(ctx, poolAccount) k.subtractOneFromCount(ctx, poolId) } } @@ -55,12 +55,12 @@ func (k Keeper) RemoveValaccountFromPool(ctx sdk.Context, poolId uint64, stakerA // ############################# func (k Keeper) getAllStakersOfPool(ctx sdk.Context, poolId uint64) []stakingTypes.Validator { - valaccounts := k.GetAllValaccountsOfPool(ctx, poolId) + poolAccounts := k.GetAllPoolAccountsOfPool(ctx, poolId) stakers := make([]stakingTypes.Validator, 0) - for _, valaccount := range valaccounts { - staker, _ := k.GetValidator(ctx, valaccount.Staker) + for _, poolAccount := range poolAccounts { + staker, _ := k.GetValidator(ctx, poolAccount.Staker) stakers = append(stakers, staker) } diff --git a/x/stakers/keeper/keeper.go b/x/stakers/keeper/keeper.go index 3efca1a6..4ab1b816 100644 --- a/x/stakers/keeper/keeper.go +++ b/x/stakers/keeper/keeper.go @@ -86,7 +86,8 @@ func (k Keeper) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddre func (k Keeper) AfterValidatorBeginUnbonding(goCtx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { ctx := sdk.UnwrapSDKContext(goCtx) - for _, v := range k.GetValaccountsFromStaker(ctx, valAddr.String()) { + poolAccounts := k.GetPoolAccountsFromStaker(ctx, valAddr.String()) + for _, v := range poolAccounts { k.LeavePool(ctx, v.Staker, v.PoolId) } return nil diff --git a/x/stakers/keeper/keeper_suite_effective_stake_test.go b/x/stakers/keeper/keeper_suite_effective_stake_test.go index 4fdc412c..12ed0d0a 100644 --- a/x/stakers/keeper/keeper_suite_effective_stake_test.go +++ b/x/stakers/keeper/keeper_suite_effective_stake_test.go @@ -63,7 +63,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -73,7 +73,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -83,7 +83,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -107,7 +107,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -117,7 +117,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -127,7 +127,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -151,7 +151,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -161,7 +161,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -171,7 +171,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -195,7 +195,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -205,7 +205,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -215,7 +215,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -233,7 +233,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -243,7 +243,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -253,7 +253,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -275,7 +275,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -285,7 +285,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -295,7 +295,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -315,7 +315,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -325,7 +325,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -335,7 +335,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -355,7 +355,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -375,7 +375,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -385,7 +385,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.5"), @@ -395,7 +395,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.2"), @@ -419,7 +419,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.5"), @@ -429,7 +429,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.9"), @@ -439,7 +439,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.2"), @@ -463,7 +463,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.8"), @@ -473,7 +473,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.7"), @@ -483,7 +483,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.2"), @@ -505,7 +505,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -515,7 +515,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0"), @@ -525,7 +525,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.5"), @@ -547,7 +547,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0"), @@ -557,7 +557,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0"), @@ -567,7 +567,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_2, PoolId: 0, - Valaddress: i.VALADDRESS_2_A, + PoolAddress: i.POOL_ADDRESS_2_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0"), diff --git a/x/stakers/keeper/logic_commission.go b/x/stakers/keeper/logic_commission.go index f0a6460c..ae6f7089 100644 --- a/x/stakers/keeper/logic_commission.go +++ b/x/stakers/keeper/logic_commission.go @@ -45,14 +45,14 @@ func (k Keeper) ProcessCommissionChangeQueue(ctx sdk.Context) { if queueEntry.CreationDate+int64(k.GetCommissionChangeTime(ctx)) <= ctx.BlockTime().Unix() { k.RemoveCommissionChangeEntry(ctx, &queueEntry) - valaccount, valaccountFound := k.GetValaccount(ctx, queueEntry.PoolId, queueEntry.Staker) - if !valaccountFound { + poolAccount, poolAccountFound := k.GetPoolAccount(ctx, queueEntry.Staker, queueEntry.PoolId) + if !poolAccountFound { // continue with the next entry return true } - valaccount.Commission = queueEntry.Commission - k.SetValaccount(ctx, valaccount) + poolAccount.Commission = queueEntry.Commission + k.SetPoolAccount(ctx, poolAccount) _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateCommission{ Staker: queueEntry.Staker, diff --git a/x/stakers/keeper/logic_stake_fraction.go b/x/stakers/keeper/logic_stake_fraction.go index 45cc9142..95ff41fc 100644 --- a/x/stakers/keeper/logic_stake_fraction.go +++ b/x/stakers/keeper/logic_stake_fraction.go @@ -45,14 +45,14 @@ func (k Keeper) ProcessStakeFractionChangeQueue(ctx sdk.Context) { if queueEntry.CreationDate+int64(k.GetStakeFractionChangeTime(ctx)) <= ctx.BlockTime().Unix() { k.RemoveStakeFractionEntry(ctx, &queueEntry) - valaccount, valaccountFound := k.GetValaccount(ctx, queueEntry.PoolId, queueEntry.Staker) - if !valaccountFound { + poolAccount, poolAccountFound := k.GetPoolAccount(ctx, queueEntry.Staker, queueEntry.PoolId) + if !poolAccountFound { // continue with the next entry return true } - valaccount.StakeFraction = queueEntry.StakeFraction - k.SetValaccount(ctx, valaccount) + poolAccount.StakeFraction = queueEntry.StakeFraction + k.SetPoolAccount(ctx, poolAccount) _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateStakeFraction{ Staker: queueEntry.Staker, diff --git a/x/stakers/keeper/migration.go b/x/stakers/keeper/migration.go index 39b119fb..10365c5a 100644 --- a/x/stakers/keeper/migration.go +++ b/x/stakers/keeper/migration.go @@ -28,8 +28,8 @@ func (k Keeper) migration_RemoveBranch(ctx sdk.Context, keyPrefix []byte) { func (k Keeper) Migration_ResetOldState(ctx sdk.Context) { k.migration_RemoveBranch(ctx, types.StakerKeyPrefix) - k.migration_RemoveBranch(ctx, types.ValaccountPrefix) - k.migration_RemoveBranch(ctx, types.ValaccountPrefixIndex2) + k.migration_RemoveBranch(ctx, types.PoolAccountPrefix) + k.migration_RemoveBranch(ctx, types.PoolAccountPrefixIndex2) k.migration_RemoveBranch(ctx, types.CommissionChangeEntryKeyPrefix) k.migration_RemoveBranch(ctx, types.CommissionChangeEntryKeyPrefixIndex2) diff --git a/x/stakers/keeper/msg_server_join_pool.go b/x/stakers/keeper/msg_server_join_pool.go index 0764430b..5870e836 100644 --- a/x/stakers/keeper/msg_server_join_pool.go +++ b/x/stakers/keeper/msg_server_join_pool.go @@ -13,7 +13,7 @@ import ( // JoinPool handles the SDK message of joining a pool. // For joining a pool the staker needs to exist and must not -// be in that pool (even with a different valaccount) +// be in that pool (even with a different pool account) // Second, there must be free slots available or the staker // must have more stake than the lowest staker in that pool. // After the staker joined the pool he is subject to slashing. @@ -44,12 +44,12 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ // Validators are not allowed to use their own address, to prevent // users from putting their validator private key on the protocol node server. - if msg.Creator == msg.Valaddress { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrValaddressSameAsStaker.Error()) + if msg.Creator == msg.PoolAddress { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrPoolAddressSameAsStaker.Error()) } // Validators are not allowed to join a pool twice. - if _, valaccountFound := k.GetValaccount(ctx, msg.PoolId, msg.Creator); valaccountFound { + if _, poolAccountFound := k.GetPoolAccount(ctx, msg.Creator, msg.PoolId); poolAccountFound { return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAlreadyJoinedPool.Error()) } @@ -58,34 +58,34 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ return nil, errFreeSlot } - // Every valaddress can only be used for one pool. It is not allowed - // to use the same valaddress for multiple pools. (to avoid account sequence errors, + // Every pool address can only be used for one pool. It is not allowed + // to use the same pool address for multiple pools. (to avoid account sequence errors, // when two processes try so submit transactions simultaneously) - for _, valaccount := range k.GetValaccountsFromStaker(ctx, msg.Creator) { - if valaccount.Valaddress == msg.Valaddress { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ValaddressAlreadyUsed.Error()) + for _, poolAccount := range k.GetPoolAccountsFromStaker(ctx, msg.Creator) { + if poolAccount.PoolAddress == msg.PoolAddress { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.PoolAddressAlreadyUsed.Error()) } } - // It is not allowed to use the valaddress of somebody else. + // It is not allowed to use the pool address of somebody else. for _, poolStaker := range k.GetAllStakerAddressesOfPool(ctx, msg.PoolId) { - valaccount, _ := k.GetValaccount(ctx, msg.PoolId, poolStaker) + poolAccount, _ := k.GetPoolAccount(ctx, poolStaker, msg.PoolId) - if valaccount.Valaddress == msg.Valaddress { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ValaddressAlreadyUsed.Error()) + if poolAccount.PoolAddress == msg.PoolAddress { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.PoolAddressAlreadyUsed.Error()) } } - k.AddValaccountToPool(ctx, msg.PoolId, msg.Creator, msg.Valaddress, msg.Commission, msg.StakeFraction) + k.AddPoolAccountToPool(ctx, msg.Creator, msg.PoolId, msg.PoolAddress, msg.Commission, msg.StakeFraction) - if err := util.TransferFromAddressToAddress(k.bankKeeper, ctx, msg.Creator, msg.Valaddress, msg.Amount); err != nil { + if err := util.TransferFromAddressToAddress(k.bankKeeper, ctx, msg.Creator, msg.PoolAddress, msg.Amount); err != nil { return nil, err } _ = ctx.EventManager().EmitTypedEvent(&types.EventJoinPool{ PoolId: msg.PoolId, Staker: msg.Creator, - Valaddress: msg.Valaddress, + PoolAddress: msg.PoolAddress, Amount: msg.Amount, Commission: msg.Commission, StakeFraction: msg.StakeFraction, diff --git a/x/stakers/keeper/msg_server_join_pool_test.go b/x/stakers/keeper/msg_server_join_pool_test.go index e2211e0f..99f11ed6 100644 --- a/x/stakers/keeper/msg_server_join_pool_test.go +++ b/x/stakers/keeper/msg_server_join_pool_test.go @@ -26,25 +26,25 @@ TEST CASES - msg_server_join_pool.go * Join disabled pool * Join a pool where other stakers have already joined * Self-Delegate more KYVE after joining a pool -* Join a pool with the same valaddress as the staker address -* Try to join the same pool with the same valaddress again -* Try to join the same pool with a different valaddress -* Try to join another pool with the same valaddress again -* Try to join another pool with a valaddress that is already used by another staker -* Try to join another pool with a different valaddress -* Try to join pool with empty valaddress +* Join a pool with the same pool address as the staker address +* Try to join the same pool with the same pool address again +* Try to join the same pool with a different pool address +* Try to join another pool with the same pool address again +* Try to join another pool with a pool address that is already used by another staker +* Try to join another pool with a different pool address +* Try to join pool with empty pool address * Try to join pool with empty commission * Try to join pool with empty stake fraction -* Join a pool with a valaddress which does not exist on chain yet -* Join a pool with a valaddress which does not exist on chain yet and send 0 funds -* Join a pool with an invalid valaddress -* Join a pool and fund the valaddress with more KYVE than available in balance +* Join a pool with a pool address which does not exist on chain yet +* Join a pool with a pool address which does not exist on chain yet and send 0 funds +* Join a pool with an invalid pool address +* Join a pool and fund the pool address with more KYVE than available in balance * Kick out lowest staker by joining a full pool * Fail to kick out lowest staker because not enough stake * Kick out lowest staker with respect to stake + delegation * Fail to kick out lowest staker because not enough stake + delegation -* Join pool again with same valaddress after staker has left pool -* Join pool again with different valaddress after staker has left pool +* Join pool again with same pool address after staker has left pool +* Join pool again with different pool address after staker has left pool */ @@ -52,8 +52,8 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s := i.NewCleanChain() initialBalanceStaker0 := uint64(0) - initialBalanceValaddress0 := uint64(0) - initialBalanceValaddress1 := uint64(0) + initialBalancePoolAddress0 := uint64(0) + initialBalancePoolAddress1 := uint64(0) gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() @@ -76,8 +76,8 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A) - initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_0_B) + initialBalancePoolAddress0 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + initialBalancePoolAddress1 = s.GetBalanceFromAddress(i.POOL_ADDRESS_0_B) }) AfterEach(func() { @@ -86,8 +86,8 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { It("Test if a newly created staker is participating in no pools yet", func() { // ASSERT - valaccounts := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccounts).To(HaveLen(0)) + poolAccounts := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccounts).To(HaveLen(0)) }) It("Join the first pool as the first staker to a newly created pool", func() { @@ -95,7 +95,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -103,28 +103,28 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { // ASSERT balanceAfterStaker0 := s.GetBalanceFromAddress(i.STAKER_0) - balanceAfterValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A) + balanceAfterPoolAddress0 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) Expect(initialBalanceStaker0 - balanceAfterStaker0).To(Equal(100 * i.KYVE)) - Expect(balanceAfterValaddress0 - initialBalanceValaddress0).To(Equal(100 * i.KYVE)) + Expect(balanceAfterPoolAddress0 - initialBalancePoolAddress0).To(Equal(100 * i.KYVE)) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) @@ -153,7 +153,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { _, err := s.RunTx(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -163,22 +163,22 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { // ASSERT balanceAfterStaker0 := s.GetBalanceFromAddress(i.STAKER_0) - balanceAfterValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A) + balanceAfterPoolAddress0 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) Expect(initialBalanceStaker0 - balanceAfterStaker0).To(Equal(0 * i.KYVE)) - Expect(balanceAfterValaddress0 - initialBalanceValaddress0).To(Equal(0 * i.KYVE)) + Expect(balanceAfterPoolAddress0 - initialBalancePoolAddress0).To(Equal(0 * i.KYVE)) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(0)) + Expect(poolAccountsOfStaker).To(HaveLen(0)) - _, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) + _, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) Expect(active).To(BeFalse()) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 1) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 1) - Expect(valaccountsOfPool).To(HaveLen(0)) + Expect(poolAccountsOfPool).To(HaveLen(0)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 1) @@ -194,7 +194,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -204,7 +204,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 0 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -212,28 +212,28 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { // ASSERT balanceAfterStaker0 := s.GetBalanceFromAddress(i.STAKER_0) - balanceAfterValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A) + balanceAfterPoolAddress0 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) Expect(initialBalanceStaker0 - balanceAfterStaker0).To(BeZero()) - Expect(balanceAfterValaddress0 - initialBalanceValaddress0).To(BeZero()) + Expect(balanceAfterPoolAddress0 - initialBalancePoolAddress0).To(BeZero()) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(2)) + Expect(poolAccountsOfPool).To(HaveLen(2)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) @@ -247,7 +247,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -264,23 +264,23 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { )) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool = s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) @@ -290,12 +290,12 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(s.App().StakersKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(totalStakeOfPool)) }) - It("Try to join the same pool with the same valaddress again", func() { + It("Try to join the same pool with the same pool address again", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -305,41 +305,41 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) }) - It("join a pool with the same valaddress as the staker address", func() { + It("join a pool with the same pool address as the staker address", func() { // ACT s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.STAKER_0, + PoolAddress: i.STAKER_0, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) - It("Try to join the same pool with a different valaddress", func() { + It("Try to join the same pool with a different pool address", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -349,24 +349,24 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) }) - It("Try to join another pool with the same valaddress again", func() { + It("Try to join another pool with the same pool address again", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -385,18 +385,18 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(HaveLen(1)) }) - It("Try to join pool with a valaddress that is already used by another staker", func() { + It("Try to join pool with a pool address that is already used by another staker", func() { // ARRANGE msg := &pooltypes.MsgCreatePool{ Authority: gov, @@ -412,7 +412,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 1, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -422,23 +422,23 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(HaveLen(1)) }) - It("Try to join pool with a valaddress that is already used by another staker", func() { + It("Try to join pool with a pool address that is already used by another staker", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -450,23 +450,23 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_1) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_1) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) - It("Try to join another pool with a different valaddress", func() { + It("Try to join another pool with a different pool address", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -485,30 +485,30 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(2)) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(HaveLen(2)) }) - It("Try to join pool with empty valaddress", func() { + It("Try to join pool with empty pool address", func() { // ACT s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: "", + PoolAddress: "", Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) It("Try to join pool with empty commission", func() { @@ -516,37 +516,37 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) It("Try to join pool with empty stake fraction", func() { // ACT s.RunTxStakersError(&stakerstypes.MsgJoinPool{ - Creator: i.STAKER_0, - PoolId: 0, - Valaddress: i.VALADDRESS_0_A, - Amount: 100 * i.KYVE, - Commission: math.LegacyMustNewDecFromStr("0.1"), + Creator: i.STAKER_0, + PoolId: 0, + PoolAddress: i.POOL_ADDRESS_0_A, + Amount: 100 * i.KYVE, + Commission: math.LegacyMustNewDecFromStr("0.1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) - It("Join a pool with a valaddress which does not exist on chain yet", func() { + It("Join a pool with a pool address which does not exist on chain yet", func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: "kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x", + PoolAddress: "kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x", Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -559,23 +559,23 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(initialBalanceStaker0 - balanceAfterStaker0).To(Equal(100 * i.KYVE)) Expect(balanceAfterUnknown).To(Equal(100 * i.KYVE)) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal("kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x")) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal("kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x")) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) Expect(totalStakeOfPool).To(Equal(100 * i.KYVE)) @@ -584,12 +584,12 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(s.App().StakersKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(totalStakeOfPool)) }) - It("Join a pool with a valaddress which does not exist on chain yet and send 0 funds", func() { + It("Join a pool with a pool address which does not exist on chain yet and send 0 funds", func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: "kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x", + PoolAddress: "kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x", Amount: 0 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -602,23 +602,23 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(initialBalanceStaker0 - balanceAfterStaker0).To(BeZero()) Expect(balanceAfterUnknown).To(BeZero()) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal("kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x")) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal("kyve1dx0nvx7y9d44jvr2dr6r2p636jea3f9827rn0x")) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) Expect(totalStakeOfPool).To(Equal(100 * i.KYVE)) @@ -627,38 +627,38 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(s.App().StakersKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(totalStakeOfPool)) }) - It("Join a pool with an invalid valaddress", func() { + It("Join a pool with an invalid pool address", func() { // ACT s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: "invalid_valaddress", + PoolAddress: "invalid_valaddress", Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) - It("Join a pool and fund the valaddress with more KYVE than available in balance", func() { + It("Join a pool and fund the pool address with more KYVE than available in balance", func() { // ACT s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: "invalid_valaddress", + PoolAddress: "invalid_valaddress", Amount: initialBalanceStaker0 + 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.ALICE) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.ALICE) - Expect(valaccountsOfStaker).To(BeEmpty()) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) It("Kick out lowest staker by joining a full pool", func() { @@ -668,7 +668,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -679,7 +679,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.DUMMY[k], PoolId: 0, - Valaddress: i.VALDUMMY[k], + PoolAddress: i.VALDUMMY[k], Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -695,7 +695,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -713,7 +713,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -724,7 +724,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.DUMMY[k], PoolId: 0, - Valaddress: i.VALDUMMY[k], + PoolAddress: i.VALDUMMY[k], Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -740,7 +740,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -759,7 +759,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 1 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -770,7 +770,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.DUMMY[k], PoolId: 0, - Valaddress: i.VALDUMMY[k], + PoolAddress: i.VALDUMMY[k], Amount: 1 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -792,7 +792,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -811,7 +811,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -822,7 +822,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.DUMMY[k], PoolId: 0, - Valaddress: i.VALDUMMY[k], + PoolAddress: i.VALDUMMY[k], Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -838,7 +838,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 1, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -857,7 +857,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 1 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -868,7 +868,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.DUMMY[k], PoolId: 0, - Valaddress: i.VALDUMMY[k], + PoolAddress: i.VALDUMMY[k], Amount: 1 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -890,7 +890,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.RunTxStakersError(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 0, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -902,12 +902,12 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(s.App().StakersKeeper.GetAllStakerAddressesOfPool(s.Ctx(), 0)).NotTo(ContainElement(i.STAKER_1)) }) - It("Join pool again with same valaddress after staker has left pool", func() { + It("Join pool again with same pool address after staker has left pool", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -922,14 +922,14 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - _, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeFalse()) // ACT s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 50 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.2"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -937,30 +937,30 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { // ASSERT balanceAfterStaker0 := s.GetBalanceFromAddress(i.STAKER_0) - balanceAfterValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A) + balanceAfterPoolAddress0 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) Expect(initialBalanceStaker0 - balanceAfterStaker0).To(Equal(150 * i.KYVE)) - Expect(balanceAfterValaddress0 - initialBalanceValaddress0).To(Equal(150 * i.KYVE)) + Expect(balanceAfterPoolAddress0 - initialBalancePoolAddress0).To(Equal(150 * i.KYVE)) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) @@ -970,12 +970,12 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Expect(s.App().StakersKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(totalStakeOfPool)) }) - It("Join pool again with different valaddress after staker has left pool", func() { + It("Join pool again with different pool address after staker has left pool", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -990,14 +990,14 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - _, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + _, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeFalse()) // ACT s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Amount: 50 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.2"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -1005,32 +1005,32 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { // ASSERT balanceAfterStaker0 := s.GetBalanceFromAddress(i.STAKER_0) - balanceAfterValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A) - balanceAfterValaddress1 := s.GetBalanceFromAddress(i.VALADDRESS_0_B) + balanceAfterPoolAddress0 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_A) + balanceAfterPoolAddress1 := s.GetBalanceFromAddress(i.POOL_ADDRESS_0_B) Expect(initialBalanceStaker0 - balanceAfterStaker0).To(Equal(150 * i.KYVE)) - Expect(balanceAfterValaddress0 - initialBalanceValaddress0).To(Equal(100 * i.KYVE)) - Expect(balanceAfterValaddress1 - initialBalanceValaddress1).To(Equal(50 * i.KYVE)) + Expect(balanceAfterPoolAddress0 - initialBalancePoolAddress0).To(Equal(100 * i.KYVE)) + Expect(balanceAfterPoolAddress1 - initialBalancePoolAddress1).To(Equal(50 * i.KYVE)) - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_B)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeFalse()) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_B)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeFalse()) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) diff --git a/x/stakers/keeper/msg_server_leave_pool.go b/x/stakers/keeper/msg_server_leave_pool.go index 75627d3c..177cb162 100644 --- a/x/stakers/keeper/msg_server_leave_pool.go +++ b/x/stakers/keeper/msg_server_leave_pool.go @@ -16,13 +16,13 @@ import ( func (k msgServer) LeavePool(goCtx context.Context, msg *types.MsgLeavePool) (*types.MsgLeavePoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - valaccount, active := k.GetValaccount(ctx, msg.PoolId, msg.Creator) + poolAccount, active := k.GetPoolAccount(ctx, msg.Creator, msg.PoolId) if !active { return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAlreadyLeftPool.Error()) } - valaccount.IsLeaving = true - k.SetValaccount(ctx, valaccount) + poolAccount.IsLeaving = true + k.SetPoolAccount(ctx, poolAccount) // Creates the queue entry to leave a pool. Does nothing further if err := k.orderLeavePool(ctx, msg.Creator, msg.PoolId); err != nil { diff --git a/x/stakers/keeper/msg_server_leave_pool_test.go b/x/stakers/keeper/msg_server_leave_pool_test.go index 045fdc7c..d2157822 100644 --- a/x/stakers/keeper/msg_server_leave_pool_test.go +++ b/x/stakers/keeper/msg_server_leave_pool_test.go @@ -49,7 +49,7 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -68,25 +68,25 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeTrue()) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeTrue()) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) @@ -100,24 +100,24 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccountsOfStaker = s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker = s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + Expect(poolAccountsOfStaker).To(BeEmpty()) - valaccount, active = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeFalse()) - valaccountsOfPool = s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool = s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(BeEmpty()) + Expect(poolAccountsOfPool).To(BeEmpty()) totalStakeOfPool = s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) Expect(totalStakeOfPool).To(BeZero()) // check if commission and stake fraction is still available - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) }) It("Leave a pool multiple other stakers have joined previously", func() { @@ -127,7 +127,7 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -141,25 +141,25 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(BeZero()) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_0_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeTrue()) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(BeZero()) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_0_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeTrue()) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(2)) + Expect(poolAccountsOfPool).To(HaveLen(2)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) @@ -173,24 +173,24 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccountsOfStaker = s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker = s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + Expect(poolAccountsOfStaker).To(BeEmpty()) - valaccount, active = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) + poolAccount, active = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) Expect(active).To(BeFalse()) - valaccountsOfPool = s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0) + poolAccountsOfPool = s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool = s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0) Expect(totalStakeOfPool).To(Equal(100 * i.KYVE)) // check if commission and stake fraction is still available - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) }) It("Try to leave a pool again", func() { @@ -208,15 +208,15 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(HaveLen(1)) // wait for leave pool s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccountsOfStaker = s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker = s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) + Expect(poolAccountsOfStaker).To(BeEmpty()) }) It("Leave one of multiple pools a staker has previously joined", func() { @@ -233,7 +233,7 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_1_A, + PoolAddress: i.POOL_ADDRESS_1_A, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), }) @@ -246,25 +246,25 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(2)) + Expect(poolAccountsOfStaker).To(HaveLen(2)) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) Expect(active).To(BeTrue()) - Expect(valaccount.Staker).To(Equal(i.STAKER_0)) - Expect(valaccount.PoolId).To(Equal(uint64(1))) - Expect(valaccount.Valaddress).To(Equal(i.VALADDRESS_1_A)) - Expect(valaccount.Points).To(BeZero()) - Expect(valaccount.IsLeaving).To(BeTrue()) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Staker).To(Equal(i.STAKER_0)) + Expect(poolAccount.PoolId).To(Equal(uint64(1))) + Expect(poolAccount.PoolAddress).To(Equal(i.POOL_ADDRESS_1_A)) + Expect(poolAccount.Points).To(BeZero()) + Expect(poolAccount.IsLeaving).To(BeTrue()) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) - valaccountsOfPool := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 1) + poolAccountsOfPool := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 1) - Expect(valaccountsOfPool).To(HaveLen(1)) + Expect(poolAccountsOfPool).To(HaveLen(1)) totalStakeOfPool := s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 1) Expect(totalStakeOfPool).To(Equal(100 * i.KYVE)) @@ -276,24 +276,24 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccountsOfStaker = s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_0) + poolAccountsOfStaker = s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_0) - Expect(valaccountsOfStaker).To(HaveLen(1)) + Expect(poolAccountsOfStaker).To(HaveLen(1)) - valaccount, active = s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) + poolAccount, active = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) Expect(active).To(BeFalse()) - valaccountsOfPool = s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 1) + poolAccountsOfPool = s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 1) - Expect(valaccountsOfPool).To(BeEmpty()) + Expect(poolAccountsOfPool).To(BeEmpty()) totalStakeOfPool = s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 1) Expect(totalStakeOfPool).To(BeZero()) // check if commission and stake fraction is still available - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) }) It("Leave a pool a staker has never joined", func() { @@ -307,22 +307,22 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { }) // ASSERT - valaccountsOfStaker := s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_1) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker := s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_1) + Expect(poolAccountsOfStaker).To(BeEmpty()) // wait for leave pool s.CommitAfterSeconds(s.App().StakersKeeper.GetLeavePoolTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccountsOfStaker = s.App().StakersKeeper.GetValaccountsFromStaker(s.Ctx(), i.STAKER_1) - Expect(valaccountsOfStaker).To(BeEmpty()) + poolAccountsOfStaker = s.App().StakersKeeper.GetPoolAccountsFromStaker(s.Ctx(), i.STAKER_1) + Expect(poolAccountsOfStaker).To(BeEmpty()) - valaccount, active := s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) + poolAccount, active := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) Expect(active).To(BeFalse()) // check if commission and stake fraction is still available - Expect(valaccount.Commission).To(Equal(math.LegacyZeroDec())) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyZeroDec())) + Expect(poolAccount.Commission).To(Equal(math.LegacyZeroDec())) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyZeroDec())) }) }) diff --git a/x/stakers/keeper/msg_server_update_commission.go b/x/stakers/keeper/msg_server_update_commission.go index 7b84fd63..3601612f 100644 --- a/x/stakers/keeper/msg_server_update_commission.go +++ b/x/stakers/keeper/msg_server_update_commission.go @@ -18,7 +18,7 @@ func (k msgServer) UpdateCommission(goCtx context.Context, msg *types.MsgUpdateC ctx := sdk.UnwrapSDKContext(goCtx) // Check if creator is active in the pool - if _, active := k.GetValaccount(ctx, msg.PoolId, msg.Creator); !active { + if _, active := k.GetPoolAccount(ctx, msg.Creator, msg.PoolId); !active { return nil, errors.Wrap(errorsTypes.ErrUnauthorized, types.ErrNoStaker.Error()) } diff --git a/x/stakers/keeper/msg_server_update_commission_test.go b/x/stakers/keeper/msg_server_update_commission_test.go index 89dac8e5..175b243c 100644 --- a/x/stakers/keeper/msg_server_update_commission_test.go +++ b/x/stakers/keeper/msg_server_update_commission_test.go @@ -50,7 +50,7 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -63,8 +63,8 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { It("Get the default commission from a newly joined pool", func() { // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) }) It("Update commission to 50% from previous commission", func() { @@ -77,15 +77,15 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) }) It("Update commission to 0% from previous commission", func() { @@ -98,15 +98,15 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyZeroDec())) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyZeroDec())) }) It("Update commission to 100% from previous commission", func() { @@ -119,15 +119,15 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyOneDec())) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyOneDec())) }) It("Update commission with a negative number from previous commission", func() { @@ -140,8 +140,8 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) }) It("Update commission with a too high number from previous commission", func() { @@ -154,8 +154,8 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) }) It("Update commission multiple times during the commission change time", func() { @@ -182,15 +182,15 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.3"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.3"))) }) It("Update commission multiple times during the commission change time with the same value", func() { @@ -215,15 +215,15 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) }) It("Update commission with multiple pools", func() { @@ -240,7 +240,7 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("1"), @@ -262,20 +262,20 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount0, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount0.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount0, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount0.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) - valaccount1, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) - Expect(valaccount1.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount1, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) + Expect(poolAccount1.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount0, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount0.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount0, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount0.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) - valaccount1, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) - Expect(valaccount1.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount1, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) + Expect(poolAccount1.Commission).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) }) }) diff --git a/x/stakers/keeper/msg_server_update_stake_fraction.go b/x/stakers/keeper/msg_server_update_stake_fraction.go index 8c10db46..29e928a3 100644 --- a/x/stakers/keeper/msg_server_update_stake_fraction.go +++ b/x/stakers/keeper/msg_server_update_stake_fraction.go @@ -18,14 +18,14 @@ import ( func (k msgServer) UpdateStakeFraction(goCtx context.Context, msg *types.MsgUpdateStakeFraction) (*types.MsgUpdateStakeFractionResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - valaccount, active := k.GetValaccount(ctx, msg.PoolId, msg.Creator) + poolAccount, active := k.GetPoolAccount(ctx, msg.Creator, msg.PoolId) if !active { - return nil, errors.Wrap(errorsTypes.ErrUnauthorized, types.ErrNoValaccount.Error()) + return nil, errors.Wrap(errorsTypes.ErrUnauthorized, types.ErrNoPoolAccount.Error()) } // if the validator wants to decrease their stake fraction in a pool we have // to do that in the bonding time - if msg.StakeFraction.LT(valaccount.StakeFraction) { + if msg.StakeFraction.LT(poolAccount.StakeFraction) { // Insert commission change into queue k.orderNewStakeFractionChange(ctx, msg.Creator, msg.PoolId, msg.StakeFraction) return &types.MsgUpdateStakeFractionResponse{}, nil @@ -38,8 +38,8 @@ func (k msgServer) UpdateStakeFraction(goCtx context.Context, msg *types.MsgUpda k.RemoveStakeFractionEntry(ctx, &queueEntry) } - valaccount.StakeFraction = msg.StakeFraction - k.SetValaccount(ctx, valaccount) + poolAccount.StakeFraction = msg.StakeFraction + k.SetPoolAccount(ctx, poolAccount) _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateStakeFraction{ Staker: msg.Creator, diff --git a/x/stakers/keeper/msg_server_update_stake_fraction_test.go b/x/stakers/keeper/msg_server_update_stake_fraction_test.go index 9e266a33..b46ab2a2 100644 --- a/x/stakers/keeper/msg_server_update_stake_fraction_test.go +++ b/x/stakers/keeper/msg_server_update_stake_fraction_test.go @@ -57,7 +57,7 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 0, - Valaddress: i.VALADDRESS_0_A, + PoolAddress: i.POOL_ADDRESS_0_A, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.1"), @@ -70,8 +70,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { It("Get the default stake fraction from a newly joined pool", func() { // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) }) @@ -86,8 +86,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(50 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(50 * i.KYVE)) }) @@ -102,16 +102,16 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) // wait for update s.CommitAfterSeconds(s.App().StakersKeeper.GetStakeFractionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(BeZero()) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(BeZero()) }) @@ -126,8 +126,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) @@ -135,8 +135,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetStakeFractionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.01"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.01"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(1 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(1 * i.KYVE)) }) @@ -151,8 +151,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(100 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(100 * i.KYVE)) }) @@ -167,8 +167,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) }) @@ -183,8 +183,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) }) @@ -199,8 +199,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) }) @@ -222,8 +222,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(20 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(20 * i.KYVE)) @@ -231,8 +231,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.2"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(20 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(20 * i.KYVE)) }) @@ -254,8 +254,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) @@ -263,8 +263,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.01"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.01"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(1 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(1 * i.KYVE)) }) @@ -277,8 +277,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { StakeFraction: math.LegacyMustNewDecFromStr("0.5"), }) - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(50 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(50 * i.KYVE)) @@ -292,8 +292,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { }) // ASSERT - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(50 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(50 * i.KYVE)) @@ -301,8 +301,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.02"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.02"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(2 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(2 * i.KYVE)) }) @@ -321,7 +321,7 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, PoolId: 1, - Valaddress: i.VALADDRESS_0_B, + PoolAddress: i.POOL_ADDRESS_0_B, Amount: 100 * i.KYVE, Commission: math.LegacyMustNewDecFromStr("0.1"), StakeFraction: math.LegacyMustNewDecFromStr("0.1"), @@ -343,13 +343,13 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.PerformValidityChecks() // ASSERT - valaccount0, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount0.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount0, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount0.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(50 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(50 * i.KYVE)) - valaccount1, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) - Expect(valaccount1.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount1, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) + Expect(poolAccount1.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 1)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 1)).To(Equal(10 * i.KYVE)) @@ -357,21 +357,21 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.CommitAfterSeconds(s.App().StakersKeeper.GetCommissionChangeTime(s.Ctx())) s.CommitAfterSeconds(1) - valaccount0, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount0.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) + poolAccount0, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount0.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.5"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(50 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(50 * i.KYVE)) - valaccount1, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 1, i.STAKER_0) - Expect(valaccount1.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.03"))) + poolAccount1, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 1) + Expect(poolAccount1.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.03"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 1)).To(Equal(3 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 1)).To(Equal(3 * i.KYVE)) }) It("Validator stake increases while stake fraction stays the same", func() { // ARRANGE - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) @@ -379,16 +379,16 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.SelfDelegateValidator(i.STAKER_0, 50*i.KYVE) // ASSERT - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(15 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(15 * i.KYVE)) }) It("Validator stake decreases while stake fraction stays the same", func() { // ARRANGE - valaccount, _ := s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(10 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(10 * i.KYVE)) @@ -401,8 +401,8 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { s.CommitAfterSeconds(1) // ASSERT - valaccount, _ = s.App().StakersKeeper.GetValaccount(s.Ctx(), 0, i.STAKER_0) - Expect(valaccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) + poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0) + Expect(poolAccount.StakeFraction).To(Equal(math.LegacyMustNewDecFromStr("0.1"))) Expect(s.App().StakersKeeper.GetValidatorPoolStake(s.Ctx(), i.STAKER_0, 0)).To(Equal(5 * i.KYVE)) Expect(s.App().StakersKeeper.GetTotalStakeOfPool(s.Ctx(), 0)).To(Equal(5 * i.KYVE)) }) diff --git a/x/stakers/spec/01_concepts.md b/x/stakers/spec/01_concepts.md index b163b81d..f941205f 100644 --- a/x/stakers/spec/01_concepts.md +++ b/x/stakers/spec/01_concepts.md @@ -7,7 +7,7 @@ order: 1 The stakers module manages all properties of the stakers except their stake (this is done by the delegation module). It handles staker creation, metadata (like moniker, logo, website and commission) and the joining and leaving of -pools using valaccounts. +pools using poolAccounts. ## Code Structure @@ -26,16 +26,16 @@ metadata which can be changed at any time. Additionally, a staker can specify a commission. However, this takes `CommissionChangeTime` seconds of time before the change is applied. -## Valaccounts -To join a pool the user creates a valaccount for this pool. -The existence of a valaccount (for a pool) means that the staker +## Pool Accounts +To join a pool the user creates a pool account for this pool. +The existence of a pool account (for a pool) means that the staker is a member of the given pool and needs to comply with the protocol in order to not get slashed. -A valaccount consists of the poolId a valaddress and a points counter. -The valaddress is the address of the protocol node which is allowed +A pool account consists of the poolId a pool account and a points counter. +The pool address is the address of the protocol node which is allowed to vote in favor of the staker. For certain types of misbehavior (e.g. being offline) a staker collects points. These are also -stored in the valaccount. +stored in the poolAccount. If a staker wants to leave a pool, a queue entry must be created. After `LeavePoolTime` seconds of time the actual leaving is performed and the diff --git a/x/stakers/spec/02_state.md b/x/stakers/spec/02_state.md index 493bb8fd..b8060f7c 100644 --- a/x/stakers/spec/02_state.md +++ b/x/stakers/spec/02_state.md @@ -24,30 +24,30 @@ type Staker struct { } ``` -## Valaccount -The Valaccount represents the membership of the staker in a given pool. +## PoolAccount +The PoolAccount represents the membership of the staker in a given pool. It contains the address of the protocol node which is allowed to vote in favor of the staker and stores the poolId as well as a counter for penalty-points. -- Valaccount: `0x02 | 0x00 | PoolId | StakerAddr -> ProtocolBuffer(valaccount)` +- PoolAccount: `0x02 | 0x00 | PoolId | StakerAddr -> ProtocolBuffer(poolAccount)` -One additional index is maintained to query for all valaccounts of a staker. +One additional index is maintained to query for all poolAccounts of a staker. For this index only the key is used as StakerAddr and PoolId contain all -information to fetch the valaccount using the main key. +information to fetch the pool account using the main key. -- ValaccountIndex2: `0x02 | 0x01 | StakerAddr | PoolId -> (empty)` +- PoolAccountIndex2: `0x02 | 0x01 | StakerAddr | PoolId -> (empty)` ```go -type Valaccount struct { +type PoolAccount struct { // PoolId defines the pool in which the address // is allowed to vote in. PoolId uint64 - // Staker is the address the valaccount is voting for. + // Staker is the address the pool account is voting for. Staker string - // valaddress is the account stored on the protocol + // pool address is the account stored on the protocol // node which votes for the staker in the given pool - Valaddress string + PoolAccount string // When a node is inactive (does not vote at all) // a point is added. After a certain amount of points // is reached, the node gets kicked out. diff --git a/x/stakers/spec/03_messages.md b/x/stakers/spec/03_messages.md index f9aac8df..660751cb 100644 --- a/x/stakers/spec/03_messages.md +++ b/x/stakers/spec/03_messages.md @@ -37,7 +37,7 @@ This message allows a staker to join a pool. For joining a pool, the staker must provide the poolId and an address which is operated by the protocol node. This address is allowed to vote in favor of the staker. If this address misbehaves, the staker will get slashed. The message also takes an amount as an argument -which is transferred to the valaddress. The valaddress needs a small balance to +which is transferred to the pool address. The pool address needs a small balance to pay for fees. ## `MsgLeavePoolResponse` @@ -47,5 +47,5 @@ pool queue. Nothing else happens after that. The upcoming pool leave is shown in the staker query. So that delegators can see that the given staker is about to leave the given pool. -After the `LeavePoolTime` has passed the valaccount is deleted and the staker +After the `LeavePoolTime` has passed the pool account is deleted and the staker can shut down the protocol node. \ No newline at end of file diff --git a/x/stakers/spec/05_events.md b/x/stakers/spec/05_events.md index eae7d6bf..e841c1e3 100644 --- a/x/stakers/spec/05_events.md +++ b/x/stakers/spec/05_events.md @@ -117,10 +117,10 @@ message EventJoinPool { uint64 pool_id = 1; // staker is the address of the staker string staker = 2; - // valaddress is the address of the protocol node which + // pool address is the address of the protocol node which // votes in favor of the staker - string valaddress = 3; - // amount is the amount of funds transferred to the valaddress + string pool address = 3; + // amount is the amount of funds transferred to the pool address uint64 amount = 4; } ``` diff --git a/x/stakers/spec/07_exported.md b/x/stakers/spec/07_exported.md index 89edc1b2..0b4a1f47 100644 --- a/x/stakers/spec/07_exported.md +++ b/x/stakers/spec/07_exported.md @@ -16,18 +16,18 @@ type StakersKeeper interface { LeavePool(ctx sdk.Context, staker string, poolId uint64) // GetAllStakerAddressesOfPool returns a list of all stakers - // which have currently a valaccount registered for the given pool + // which have currently a pool account registered for the given pool // and are therefore allowed to participate in that pool. GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) // GetCommission returns the commission of a staker as a parsed sdk.Dec GetCommission(ctx sdk.Context, stakerAddress string) sdk.Dec - // AssertValaccountAuthorized checks if the given `valaddress` is allowed to vote in pool + // AssertPoolAccountAuthorized checks if the given `pool address` is allowed to vote in pool // with id `poolId` to vote in favor of `stakerAddress`. - // If the valaddress is not authorized the appropriate error is returned. + // If the pool address is not authorized the appropriate error is returned. // Otherwise, it returns `nil` - AssertValaccountAuthorized(ctx sdk.Context, poolId uint64, stakerAddress string, valaddress string) error + AssertPoolAccountAuthorized(ctx sdk.Context, poolId uint64, stakerAddress string, pool address string) error // GetActiveStakers returns all staker-addresses that are // currently participating in at least one pool. @@ -56,10 +56,6 @@ type StakersKeeper interface { // Returns the amount of points the staker had before the reset. ResetPoints(ctx sdk.Context, poolId uint64, stakerAddress string) (previousPoints uint64) - // DoesValaccountExist only checks if the key is present in the KV-Store - // without loading and unmarshalling to full entry - DoesValaccountExist(ctx sdk.Context, poolId uint64, stakerAddress string) bool - DoesStakerExist(ctx sdk.Context, staker string) bool // IncreaseStakerCommissionRewards increases the commission rewards of a diff --git a/x/stakers/types/errors.go b/x/stakers/types/errors.go index c68a8119..ee8493d6 100644 --- a/x/stakers/types/errors.go +++ b/x/stakers/types/errors.go @@ -11,16 +11,16 @@ var ( ErrNoStaker = errors.Register(ModuleName, 1105, "sender is no staker") ErrAlreadyJoinedPool = errors.Register(ModuleName, 1106, "already joined pool") ErrAlreadyLeftPool = errors.Register(ModuleName, 1107, "already left pool") - ValaddressAlreadyUsed = errors.Register(ModuleName, 1108, "valaddress already used") + PoolAddressAlreadyUsed = errors.Register(ModuleName, 1108, "pool address already used") ErrStringMaxLengthExceeded = errors.Register(ModuleName, 1109, "String length exceeded: %d vs %d") ErrStakerAlreadyCreated = errors.Register(ModuleName, 1110, "Staker already created") - ErrValaddressSameAsStaker = errors.Register(ModuleName, 1111, "Valaddress has same address as Valaddress") + ErrPoolAddressSameAsStaker = errors.Register(ModuleName, 1111, "Pool address has same address as validator") ErrCanNotJoinDisabledPool = errors.Register(ModuleName, 1112, "can not join disabled pool") ErrInvalidIdentityString = errors.Register(ModuleName, 1113, "invalid identity: %s") ErrNotEnoughRewards = errors.Register(ModuleName, 1114, "claim amount is larger than current rewards") ErrPoolLeaveAlreadyInProgress = errors.Register(ModuleName, 1117, "Pool leave is already in progress") - ErrValaccountUnauthorized = errors.Register(ModuleName, 1118, "valaccount unauthorized") + ErrPoolAccountUnauthorized = errors.Register(ModuleName, 1118, "pool account unauthorized") ErrValidatorJailed = errors.Register(ModuleName, 1119, "validator jailed") - ErrNoValaccount = errors.Register(ModuleName, 1120, "sender has no valaccount") + ErrNoPoolAccount = errors.Register(ModuleName, 1120, "sender has no pool account") ) diff --git a/x/stakers/types/events.pb.go b/x/stakers/types/events.pb.go index 393ad404..2b61f47f 100644 --- a/x/stakers/types/events.pb.go +++ b/x/stakers/types/events.pb.go @@ -268,10 +268,10 @@ type EventJoinPool struct { PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // staker is the address of the staker Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` - // valaddress is the address of the protocol node which + // pool_address is the address of the protocol node which // votes in favor of the staker - Valaddress string `protobuf:"bytes,3,opt,name=valaddress,proto3" json:"valaddress,omitempty"` - // amount is the amount of funds transferred to the valaddress + PoolAddress string `protobuf:"bytes,3,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` + // amount is the amount of funds transferred to the pool address Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` // commission ... Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` @@ -326,9 +326,9 @@ func (m *EventJoinPool) GetStaker() string { return "" } -func (m *EventJoinPool) GetValaddress() string { +func (m *EventJoinPool) GetPoolAddress() string { if m != nil { - return m.Valaddress + return m.PoolAddress } return "" } @@ -486,41 +486,41 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/events.proto", fileDescriptor_7a1b3dc9634155a0) } var fileDescriptor_7a1b3dc9634155a0 = []byte{ - // 537 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xb3, 0x69, 0x9a, 0x28, 0x83, 0x1a, 0x89, 0xa8, 0x80, 0x95, 0x22, 0xa7, 0x98, 0x4b, - 0x0f, 0xc8, 0x56, 0xcb, 0x1d, 0xa9, 0x09, 0xad, 0x44, 0xa9, 0xa0, 0x72, 0x01, 0x09, 0x2e, 0xd1, - 0xc6, 0xbb, 0x24, 0x56, 0x6c, 0x8f, 0xe5, 0xdd, 0x26, 0xe4, 0x11, 0x38, 0x20, 0x71, 0xe3, 0x41, - 0x78, 0x89, 0x1e, 0x7b, 0x44, 0x1c, 0x2a, 0x48, 0x5e, 0x04, 0x79, 0x6d, 0x37, 0x0e, 0x32, 0x12, - 0xf5, 0x6d, 0xc7, 0xfa, 0xe7, 0x9b, 0x7f, 0xff, 0x91, 0x17, 0x1e, 0x4d, 0xe6, 0x53, 0x6e, 0x09, - 0x49, 0x27, 0x3c, 0x12, 0xd6, 0x74, 0x7f, 0xc8, 0x25, 0xdd, 0xb7, 0xf8, 0x94, 0x07, 0x52, 0x98, - 0x61, 0x84, 0x12, 0xdb, 0xdb, 0xb1, 0xc4, 0x4c, 0x25, 0x66, 0x2a, 0xe9, 0x6c, 0x8f, 0x70, 0x84, - 0x4a, 0x60, 0xc5, 0xa7, 0x44, 0xdb, 0x29, 0xc6, 0x85, 0x34, 0xa2, 0x7e, 0x8a, 0xeb, 0x18, 0x85, - 0x92, 0x0c, 0xaf, 0x34, 0xc6, 0x77, 0x02, 0x77, 0x8f, 0x62, 0x0f, 0x6f, 0x43, 0x46, 0x25, 0x3f, - 0x53, 0xfd, 0xed, 0x43, 0x00, 0xf4, 0xd8, 0x20, 0xa1, 0x69, 0x64, 0x97, 0xec, 0xdd, 0x39, 0x78, - 0x68, 0x16, 0xb9, 0x33, 0x93, 0x8e, 0x5e, 0xed, 0xf2, 0xba, 0x5b, 0xb1, 0x9b, 0xe8, 0xb1, 0x15, - 0x22, 0xe0, 0xb3, 0x0c, 0x51, 0xfd, 0x7f, 0x44, 0xc0, 0x67, 0x29, 0x42, 0x83, 0x46, 0x48, 0xe7, - 0x1e, 0x52, 0xa6, 0x6d, 0xec, 0x92, 0xbd, 0xa6, 0x9d, 0x95, 0xc6, 0x17, 0x02, 0xf7, 0x72, 0xae, - 0xfb, 0xe8, 0xfb, 0xae, 0x10, 0x2e, 0x06, 0xed, 0xfb, 0x50, 0x4f, 0xf0, 0xca, 0x75, 0xd3, 0x4e, - 0xab, 0xf6, 0x03, 0x68, 0x84, 0x88, 0xde, 0xc0, 0x65, 0xca, 0x4b, 0xcd, 0xae, 0xc7, 0xe5, 0x0b, - 0xd6, 0xee, 0x03, 0x38, 0x37, 0xed, 0xc9, 0x9c, 0xde, 0xe3, 0xd8, 0xc9, 0xcf, 0xeb, 0xee, 0x8e, - 0x83, 0xc2, 0x47, 0x21, 0xd8, 0xc4, 0x74, 0xd1, 0xf2, 0xa9, 0x1c, 0x9b, 0xa7, 0x7c, 0x44, 0x9d, - 0xf9, 0x73, 0xee, 0xd8, 0xb9, 0x36, 0xe3, 0x1b, 0x01, 0x2d, 0xe7, 0xe7, 0x3c, 0x9e, 0x79, 0x1c, - 0x51, 0x47, 0x96, 0xb2, 0x74, 0x02, 0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0x0c, 0x4d, 0x07, 0x7d, - 0xeb, 0xe5, 0xfb, 0x77, 0x47, 0xaf, 0xb8, 0x9c, 0x61, 0x34, 0xb1, 0x9c, 0x31, 0x75, 0x03, 0xeb, - 0xd3, 0xcd, 0xdb, 0x15, 0x5f, 0x42, 0x0c, 0xeb, 0xea, 0xc9, 0x7a, 0xfa, 0x27, 0x00, 0x00, 0xff, - 0xff, 0x4e, 0xa8, 0x49, 0x66, 0x4a, 0x05, 0x00, 0x00, + // 542 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4e, + 0x10, 0xc6, 0xb3, 0x69, 0x9a, 0x28, 0xd3, 0x7f, 0x23, 0xfd, 0xa3, 0x02, 0x56, 0x8a, 0x9c, 0xd6, + 0x5c, 0x7a, 0x40, 0xb6, 0x5a, 0xee, 0x48, 0x49, 0x68, 0x25, 0x4a, 0x05, 0x95, 0x0b, 0x48, 0x70, + 0x89, 0x36, 0xf6, 0x92, 0x58, 0xb1, 0x3d, 0x96, 0x77, 0x9b, 0x90, 0x77, 0x00, 0x89, 0x1b, 0x0f, + 0xc2, 0x4b, 0xf4, 0xd8, 0x23, 0xe2, 0x50, 0x41, 0xf2, 0x22, 0x68, 0x77, 0x9d, 0x26, 0x41, 0x46, + 0xa2, 0xb9, 0x79, 0x56, 0xdf, 0xfc, 0xe6, 0xdb, 0x6f, 0xe4, 0x85, 0xfd, 0xe1, 0x64, 0xc4, 0x1c, + 0x2e, 0xe8, 0x90, 0xa5, 0xdc, 0x19, 0x1d, 0xf6, 0x98, 0xa0, 0x87, 0x0e, 0x1b, 0xb1, 0x58, 0x70, + 0x3b, 0x49, 0x51, 0x60, 0x7d, 0x47, 0x4a, 0xec, 0x4c, 0x62, 0x67, 0x92, 0xc6, 0x4e, 0x1f, 0xfb, + 0xa8, 0x04, 0x8e, 0xfc, 0xd2, 0xda, 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0xb8, 0xec, 0xd9, 0x1e, 0x46, 0xce, 0x8b, 0x77, 0x6f, 0x8f, 0x5f, 0x32, 0x31, 0xc6, 0x74, 0xe8, + 0x78, 0x03, 0x1a, 0xc4, 0xce, 0xc7, 0xdb, 0xe7, 0x4b, 0x5e, 0x82, 0xf7, 0xca, 0xea, 0xd5, 0x7a, + 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x35, 0x72, 0x47, 0x82, 0x4d, 0x05, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -745,10 +745,10 @@ func (m *EventJoinPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.Valaddress) > 0 { - i -= len(m.Valaddress) - copy(dAtA[i:], m.Valaddress) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Valaddress))) + if len(m.PoolAddress) > 0 { + i -= len(m.PoolAddress) + copy(dAtA[i:], m.PoolAddress) + i = encodeVarintEvents(dAtA, i, uint64(len(m.PoolAddress))) i-- dAtA[i] = 0x1a } @@ -951,7 +951,7 @@ func (m *EventJoinPool) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Valaddress) + l = len(m.PoolAddress) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } @@ -1625,7 +1625,7 @@ func (m *EventJoinPool) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valaddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1653,7 +1653,7 @@ func (m *EventJoinPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Valaddress = string(dAtA[iNdEx:postIndex]) + m.PoolAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 { diff --git a/x/stakers/types/genesis.go b/x/stakers/types/genesis.go index a17aca21..e753aeb0 100644 --- a/x/stakers/types/genesis.go +++ b/x/stakers/types/genesis.go @@ -16,14 +16,14 @@ func (gs GenesisState) Validate() error { // Staker stakerLeaving := make(map[string]bool) - // Valaccounts - valaccountMap := make(map[string]struct{}) - for _, elem := range gs.ValaccountList { - index := string(ValaccountKey(elem.PoolId, elem.Staker)) - if _, ok := valaccountMap[index]; ok { - return fmt.Errorf("duplicated index for valaccount %v", elem) + // Pool accounts + poolAccountsMap := make(map[string]struct{}) + for _, elem := range gs.PoolAccountList { + index := string(PoolAccountKey(elem.PoolId, elem.Staker)) + if _, ok := poolAccountsMap[index]; ok { + return fmt.Errorf("duplicated index for pool account %v", elem) } - valaccountMap[index] = struct{}{} + poolAccountsMap[index] = struct{}{} stakerLeaving[index] = elem.IsLeaving } @@ -53,10 +53,10 @@ func (gs GenesisState) Validate() error { if elem.Index < gs.QueueStateLeave.LowIndex { return fmt.Errorf("unbonding stake entry index too low: %v", elem) } - if !stakerLeaving[string(ValaccountKey(elem.PoolId, elem.Staker))] { + if !stakerLeaving[string(PoolAccountKey(elem.PoolId, elem.Staker))] { return fmt.Errorf("inconsistent staker leave: %v", elem) } - stakerLeaving[string(ValaccountKey(elem.PoolId, elem.Staker))] = false + stakerLeaving[string(PoolAccountKey(elem.PoolId, elem.Staker))] = false } for staker, isLeaving := range stakerLeaving { diff --git a/x/stakers/types/genesis.pb.go b/x/stakers/types/genesis.pb.go index ea526ff1..0aa0ff82 100644 --- a/x/stakers/types/genesis.pb.go +++ b/x/stakers/types/genesis.pb.go @@ -29,8 +29,8 @@ type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // staker_list ... StakerList []Staker `protobuf:"bytes,2,rep,name=staker_list,json=stakerList,proto3" json:"staker_list"` - // valaccount_list ... - ValaccountList []Valaccount `protobuf:"bytes,3,rep,name=valaccount_list,json=valaccountList,proto3" json:"valaccount_list"` + // pool_account_list ... + PoolAccountList []PoolAccount `protobuf:"bytes,3,rep,name=pool_account_list,json=poolAccountList,proto3" json:"pool_account_list"` // commission_change_entries ... CommissionChangeEntries []CommissionChangeEntry `protobuf:"bytes,4,rep,name=commission_change_entries,json=commissionChangeEntries,proto3" json:"commission_change_entries"` // queue_state_commission ... @@ -92,9 +92,9 @@ func (m *GenesisState) GetStakerList() []Staker { return nil } -func (m *GenesisState) GetValaccountList() []Valaccount { +func (m *GenesisState) GetPoolAccountList() []PoolAccount { if m != nil { - return m.ValaccountList + return m.PoolAccountList } return nil } @@ -150,37 +150,37 @@ func init() { } var fileDescriptor_0deb2ee89d595051 = []byte{ - // 468 bytes of a gzipped FileDescriptorProto + // 471 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x1b, 0x36, 0x0a, 0x78, 0x88, 0x81, 0x55, 0xb1, 0x10, 0x41, 0x28, 0x13, 0x07, 0x24, - 0x50, 0xa2, 0xc1, 0x8d, 0xe3, 0xaa, 0x8d, 0x03, 0x13, 0x8c, 0x4d, 0x9a, 0x00, 0x21, 0x45, 0xae, - 0xf5, 0x48, 0xad, 0x26, 0x71, 0x17, 0x3b, 0x19, 0xfd, 0x16, 0x7c, 0x1d, 0xbe, 0xc1, 0x8e, 0x3b, - 0x72, 0x42, 0xa8, 0xfd, 0x22, 0x28, 0x2f, 0x6e, 0x12, 0x09, 0x6f, 0xd2, 0x2e, 0x56, 0xeb, 0xf7, - 0x7f, 0xbf, 0xf7, 0xff, 0xdb, 0x31, 0xd9, 0x9e, 0xce, 0x4b, 0x08, 0x95, 0x66, 0x53, 0xc8, 0x55, - 0x58, 0xee, 0x8c, 0x41, 0xb3, 0x9d, 0x30, 0x86, 0x0c, 0x94, 0x50, 0xc1, 0x2c, 0x97, 0x5a, 0xd2, - 0x41, 0xa5, 0x09, 0x8c, 0x26, 0x30, 0x1a, 0x6f, 0x10, 0xcb,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 0x87, 0xc7, 0x17, + 0x8b, 0xc8, 0xbb, 0x5c, 0x44, 0xde, 0x9f, 0x45, 0xe4, 0xfd, 0x58, 0x46, 0x9d, 0xcb, 0x65, 0xd4, + 0xf9, 0xb5, 0x8c, 0x3a, 0x5f, 0x9e, 0x67, 0x5c, 0x8d, 0xa7, 0xa3, 0x98, 0x89, 0x22, 0x79, 0xfb, + 0xf9, 0xe3, 0xd1, 0x3b, 0x50, 0xe7, 0xa2, 0x9e, 0x24, 0x6c, 0x4c, 0x79, 0x99, 0x7c, 0x5f, 0xbf, + 0x4b, 0x35, 0xaf, 0x40, 0x8e, 0xba, 0xf8, 0x1c, 0x5f, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xfc, + 0x43, 0xa3, 0xbe, 0x27, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -275,10 +275,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } } - if len(m.ValaccountList) > 0 { - for iNdEx := len(m.ValaccountList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.PoolAccountList) > 0 { + for iNdEx := len(m.PoolAccountList) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ValaccountList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PoolAccountList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -341,8 +341,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ValaccountList) > 0 { - for _, e := range m.ValaccountList { + if len(m.PoolAccountList) > 0 { + for _, e := range m.PoolAccountList { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -478,7 +478,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValaccountList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAccountList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -505,8 +505,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValaccountList = append(m.ValaccountList, Valaccount{}) - if err := m.ValaccountList[len(m.ValaccountList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PoolAccountList = append(m.PoolAccountList, PoolAccount{}) + if err := m.PoolAccountList[len(m.PoolAccountList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/stakers/types/keys.go b/x/stakers/types/keys.go index bb7be888..d7e86bb2 100644 --- a/x/stakers/types/keys.go +++ b/x/stakers/types/keys.go @@ -24,11 +24,11 @@ var ( // key -> StakerKeyPrefix | StakerKeyPrefix = []byte{1} - // ValaccountPrefix stores valaccount for each staker and pool - // ValaccountPrefix | | - ValaccountPrefix = []byte{2, 0} - // ValaccountPrefixIndex2 | | - ValaccountPrefixIndex2 = []byte{2, 1} + // PoolAccountPrefix stores pool account for each staker and pool + // PoolAccountPrefix | | + PoolAccountPrefix = []byte{2, 0} + // PoolAccountPrefixIndex2 | | + PoolAccountPrefixIndex2 = []byte{2, 1} // CommissionChangeEntryKeyPrefix | CommissionChangeEntryKeyPrefix = []byte{4, 0} @@ -64,11 +64,11 @@ var ( const MaxStakers = 50 -func ValaccountKey(poolId uint64, staker string) []byte { +func PoolAccountKey(poolId uint64, staker string) []byte { return util.GetByteKey(poolId, staker) } -func ValaccountKeyIndex2(staker string, poolId uint64) []byte { +func PoolAccountKeyIndex2(staker string, poolId uint64) []byte { return util.GetByteKey(staker, poolId) } diff --git a/x/stakers/types/message_join_pool.go b/x/stakers/types/message_join_pool.go index 54cee98d..45c4de63 100644 --- a/x/stakers/types/message_join_pool.go +++ b/x/stakers/types/message_join_pool.go @@ -40,8 +40,8 @@ func (msg *MsgJoinPool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } - if _, err := sdk.AccAddressFromBech32(msg.Valaddress); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid validator address: %s", err) + if _, err := sdk.AccAddressFromBech32(msg.PoolAddress); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid pool address: %s", err) } if util.ValidateNumber(msg.Amount) != nil { diff --git a/x/stakers/types/stakers.pb.go b/x/stakers/types/stakers.pb.go index b82f2d01..8b19dfb0 100644 --- a/x/stakers/types/stakers.pb.go +++ b/x/stakers/types/stakers.pb.go @@ -167,17 +167,21 @@ func (m *Staker) GetCommissionRewards() github_com_cosmos_cosmos_sdk_types.Coins return nil } -// Valaccount gets authorized by a staker to -// vote in a given pool by favor of the staker. -type Valaccount struct { +// PoolAccount gets authorized by a validator to +// vote in a given pool by favor of the validator. +// The pool account basically acts like an operator +// here so the validator private key can be stored +// securely and not on a remote server where +// the pool account will operate +type PoolAccount struct { // pool_id defines the pool in which the address // is allowed to vote in. PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // staker is the address the valaccount is voting for. + // staker is the address validator Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` - // valaddress is the account stored on the protocol + // pool_address is the account stored on the protocol // node which votes for the staker in the given pool - Valaddress string `protobuf:"bytes,3,opt,name=valaddress,proto3" json:"valaddress,omitempty"` + PoolAddress string `protobuf:"bytes,3,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` // When a node is inactive (does not vote at all) // A point is added, after a certain amount of points // is reached the node gets kicked out. @@ -190,18 +194,18 @@ type Valaccount struct { StakeFraction cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=stake_fraction,json=stakeFraction,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stake_fraction"` } -func (m *Valaccount) Reset() { *m = Valaccount{} } -func (m *Valaccount) String() string { return proto.CompactTextString(m) } -func (*Valaccount) ProtoMessage() {} -func (*Valaccount) Descriptor() ([]byte, []int) { +func (m *PoolAccount) Reset() { *m = PoolAccount{} } +func (m *PoolAccount) String() string { return proto.CompactTextString(m) } +func (*PoolAccount) ProtoMessage() {} +func (*PoolAccount) Descriptor() ([]byte, []int) { return fileDescriptor_d209d1a2a74d375d, []int{1} } -func (m *Valaccount) XXX_Unmarshal(b []byte) error { +func (m *PoolAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Valaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PoolAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Valaccount.Marshal(b, m, deterministic) + return xxx_messageInfo_PoolAccount.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -211,47 +215,47 @@ func (m *Valaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Valaccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_Valaccount.Merge(m, src) +func (m *PoolAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_PoolAccount.Merge(m, src) } -func (m *Valaccount) XXX_Size() int { +func (m *PoolAccount) XXX_Size() int { return m.Size() } -func (m *Valaccount) XXX_DiscardUnknown() { - xxx_messageInfo_Valaccount.DiscardUnknown(m) +func (m *PoolAccount) XXX_DiscardUnknown() { + xxx_messageInfo_PoolAccount.DiscardUnknown(m) } -var xxx_messageInfo_Valaccount proto.InternalMessageInfo +var xxx_messageInfo_PoolAccount proto.InternalMessageInfo -func (m *Valaccount) GetPoolId() uint64 { +func (m *PoolAccount) GetPoolId() uint64 { if m != nil { return m.PoolId } return 0 } -func (m *Valaccount) GetStaker() string { +func (m *PoolAccount) GetStaker() string { if m != nil { return m.Staker } return "" } -func (m *Valaccount) GetValaddress() string { +func (m *PoolAccount) GetPoolAddress() string { if m != nil { - return m.Valaddress + return m.PoolAddress } return "" } -func (m *Valaccount) GetPoints() uint64 { +func (m *PoolAccount) GetPoints() uint64 { if m != nil { return m.Points } return 0 } -func (m *Valaccount) GetIsLeaving() bool { +func (m *PoolAccount) GetIsLeaving() bool { if m != nil { return m.IsLeaving } @@ -560,7 +564,7 @@ func (m *QueueState) GetHighIndex() uint64 { func init() { proto.RegisterEnum("kyve.stakers.v1beta1.SlashType", SlashType_name, SlashType_value) proto.RegisterType((*Staker)(nil), "kyve.stakers.v1beta1.Staker") - proto.RegisterType((*Valaccount)(nil), "kyve.stakers.v1beta1.Valaccount") + proto.RegisterType((*PoolAccount)(nil), "kyve.stakers.v1beta1.PoolAccount") proto.RegisterType((*CommissionChangeEntry)(nil), "kyve.stakers.v1beta1.CommissionChangeEntry") proto.RegisterType((*StakeFractionChangeEntry)(nil), "kyve.stakers.v1beta1.StakeFractionChangeEntry") proto.RegisterType((*LeavePoolEntry)(nil), "kyve.stakers.v1beta1.LeavePoolEntry") @@ -572,54 +576,55 @@ func init() { } var fileDescriptor_d209d1a2a74d375d = []byte{ - // 750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x4f, 0xdb, 0x48, - 0x1c, 0x8d, 0x93, 0x90, 0x3f, 0xb3, 0x0b, 0x84, 0x59, 0x60, 0xbd, 0x41, 0x18, 0x14, 0x2e, 0x2c, - 0xda, 0xb5, 0x45, 0xab, 0x7e, 0x00, 0x48, 0x82, 0x48, 0x9b, 0x42, 0xea, 0x04, 0x24, 0x7a, 0xb1, - 0x26, 0xf6, 0x34, 0x19, 0xc5, 0xf1, 0xa4, 0x9e, 0x49, 0x42, 0xa4, 0x4a, 0xbd, 0xf6, 0xd8, 0xef, - 0x50, 0x55, 0xaa, 0x7a, 0xea, 0xc7, 0xe0, 0x88, 0x7a, 0xaa, 0x7a, 0xa0, 0x15, 0x1c, 0xfa, 0x29, - 0x2a, 0x55, 0x33, 0x76, 0x82, 0x29, 0xad, 0x84, 0x50, 0x7b, 0x49, 0xfc, 0xde, 0x9b, 0xdf, 0xfb, - 0xcd, 0xef, 0x8d, 0x35, 0x06, 0x85, 0xce, 0x68, 0x80, 0x0d, 0xc6, 0x51, 0x07, 0xfb, 0xcc, 0x18, - 0x6c, 0x36, 0x31, 0x47, 0x9b, 0x63, 0xac, 0xf7, 0x7c, 0xca, 0x29, 0x9c, 0x17, 0x6b, 0xf4, 0x31, - 0x17, 0xae, 0xc9, 0xcf, 0xa1, 0x2e, 0xf1, 0xa8, 0x21, 0x7f, 0x83, 0x85, 0x79, 0xcd, 0xa6, 0xac, - 0x4b, 0x99, 0xd1, 0x44, 0x0c, 0x4f, 0xbc, 0x6c, 0x4a, 0xbc, 0x50, 0x9f, 0x6f, 0xd1, 0x16, 0x95, - 0x8f, 0x86, 0x78, 0x0a, 0xd8, 0xc2, 0xd7, 0x38, 0x48, 0xd5, 0xa5, 0x39, 0x54, 0x41, 0x1a, 0x39, - 0x8e, 0x8f, 0x19, 0x53, 0x95, 0x55, 0x65, 0x3d, 0x6b, 0x8e, 0x21, 0x2c, 0x02, 0x60, 0xd3, 0x6e, - 0x97, 0x30, 0x46, 0xa8, 0xa7, 0xc6, 0x85, 0xb8, 0xbd, 0x76, 0x72, 0xb6, 0x12, 0xfb, 0x78, 0xb6, - 0xb2, 0x14, 0xb4, 0x65, 0x4e, 0x47, 0x27, 0xd4, 0xe8, 0x22, 0xde, 0xd6, 0xab, 0xb8, 0x85, 0xec, - 0x51, 0x09, 0xdb, 0x66, 0xa4, 0x4c, 0xd8, 0x77, 0xa9, 0x47, 0x3a, 0xd8, 0x57, 0x13, 0x81, 0x7d, - 0x08, 0x85, 0x32, 0xc4, 0x4d, 0x46, 0x38, 0x56, 0x93, 0x81, 0x12, 0x42, 0x98, 0x07, 0x19, 0xe2, - 0x60, 0x8f, 0x13, 0x3e, 0x52, 0xa7, 0xa4, 0x34, 0xc1, 0xf0, 0x5f, 0x90, 0x63, 0xd8, 0xee, 0xfb, - 0x84, 0x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0x29, - 0x17, 0x83, 0x8b, 0x00, 0x46, 0xb4, 0x46, 0xe5, 0x61, 0x79, 0xff, 0xa0, 0x91, 0x53, 0xe0, 0x5f, - 0x60, 0x36, 0xc2, 0x1f, 0xee, 0x37, 0xca, 0xb9, 0x38, 0x5c, 0x00, 0x73, 0x51, 0xa3, 0x5a, 0x75, - 0x7f, 0xab, 0x94, 0x4b, 0xe4, 0x93, 0x2f, 0x5e, 0x69, 0xb1, 0xed, 0x9d, 0x93, 0x73, 0x4d, 0x39, - 0x3d, 0xd7, 0x94, 0xcf, 0xe7, 0x9a, 0xf2, 0xf2, 0x42, 0x8b, 0x9d, 0x5e, 0x68, 0xb1, 0x0f, 0x17, - 0x5a, 0xec, 0xf1, 0x7f, 0x91, 0xeb, 0xe5, 0xc1, 0xd1, 0x61, 0x79, 0x0f, 0xf3, 0x21, 0xf5, 0x3b, - 0x86, 0xdd, 0x46, 0xc4, 0x33, 0x8e, 0x27, 0x5f, 0x0e, 0x79, 0xd1, 0x34, 0x53, 0xf2, 0x46, 0xbf, - 0xfb, 0x2d, 0x00, 0x00, 0xff, 0xff, 0x03, 0xe9, 0xa2, 0x1f, 0x56, 0x06, 0x00, 0x00, + // 756 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4d, 0x4f, 0xdb, 0x48, + 0x18, 0x8e, 0x93, 0x90, 0x8f, 0xe1, 0x2b, 0xcc, 0x42, 0xd6, 0x1b, 0x84, 0x61, 0xc3, 0x85, 0x45, + 0xbb, 0xb6, 0xd8, 0xd5, 0xfe, 0x80, 0x90, 0x04, 0x91, 0x36, 0x85, 0xd4, 0x09, 0x48, 0xf4, 0x62, + 0x4d, 0xec, 0x69, 0x32, 0x4a, 0xe2, 0x49, 0x3d, 0x13, 0x42, 0xa4, 0x4a, 0xbd, 0xf6, 0xd8, 0xff, + 0xd0, 0x4b, 0xdb, 0x53, 0x7f,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88, 0x48, 0x7a, 0xf3, 0x09, 0x48, 0xd7, 0xbb, 0x88, 0xb5, 0x1b, 0xa3, 0xbe, 0x78, + 0x82, 0xb2, 0xf5, 0x6a, 0xa1, 0xbe, 0x6b, 0x35, 0x8e, 0x6a, 0x65, 0xeb, 0x60, 0xaf, 0x5e, 0x2b, + 0x17, 0x2b, 0x3b, 0x95, 0x72, 0x29, 0x13, 0x81, 0x59, 0x00, 0x43, 0x5c, 0xa3, 0xf2, 0xa0, 0xbc, + 0x7f, 0xd0, 0xc8, 0x28, 0xf0, 0x37, 0x30, 0x1f, 0x8a, 0x1f, 0xee, 0x37, 0xca, 0x99, 0x28, 0x5c, + 0x02, 0x0b, 0x61, 0xa1, 0x5a, 0x75, 0xbf, 0x50, 0xca, 0xc4, 0x72, 0xf1, 0xe7, 0x2f, 0xb5, 0xc8, + 0xf6, 0xce, 0xe9, 0x85, 0xa6, 0x9c, 0x5d, 0x68, 0xca, 0xa7, 0x0b, 0x4d, 0x79, 0x71, 0xa9, 0x45, + 0xce, 0x2e, 0xb5, 0xc8, 0xfb, 0x4b, 0x2d, 0xf2, 0xe8, 0xef, 0xd0, 0x13, 0x73, 0xff, 0xe8, 0xb0, + 0xbc, 0x87, 0xf9, 0x90, 0x7a, 0x1d, 0xc3, 0x6e, 0x23, 0xe2, 0x1a, 0x27, 0x93, 0xaf, 0x87, 0x7c, + 0x6c, 0x9a, 0x09, 0xf9, 0xaa, 0xff, 0xf7, 0x35, 0x00, 0x00, 0xff, 0xff, 0x31, 0xd2, 0xb6, 0x78, + 0x5a, 0x06, 0x00, 0x00, } func (m *Staker) Marshal() (dAtA []byte, err error) { @@ -711,7 +716,7 @@ func (m *Staker) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Valaccount) Marshal() (dAtA []byte, err error) { +func (m *PoolAccount) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -721,12 +726,12 @@ func (m *Valaccount) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Valaccount) MarshalTo(dAtA []byte) (int, error) { +func (m *PoolAccount) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Valaccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PoolAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -766,10 +771,10 @@ func (m *Valaccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.Valaddress) > 0 { - i -= len(m.Valaddress) - copy(dAtA[i:], m.Valaddress) - i = encodeVarintStakers(dAtA, i, uint64(len(m.Valaddress))) + if len(m.PoolAddress) > 0 { + i -= len(m.PoolAddress) + copy(dAtA[i:], m.PoolAddress) + i = encodeVarintStakers(dAtA, i, uint64(len(m.PoolAddress))) i-- dAtA[i] = 0x1a } @@ -1028,7 +1033,7 @@ func (m *Staker) Size() (n int) { return n } -func (m *Valaccount) Size() (n int) { +func (m *PoolAccount) Size() (n int) { if m == nil { return 0 } @@ -1041,7 +1046,7 @@ func (m *Valaccount) Size() (n int) { if l > 0 { n += 1 + l + sovStakers(uint64(l)) } - l = len(m.Valaddress) + l = len(m.PoolAddress) if l > 0 { n += 1 + l + sovStakers(uint64(l)) } @@ -1459,7 +1464,7 @@ func (m *Staker) Unmarshal(dAtA []byte) error { } return nil } -func (m *Valaccount) Unmarshal(dAtA []byte) error { +func (m *PoolAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1482,10 +1487,10 @@ func (m *Valaccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Valaccount: wiretype end group for non-group") + return fmt.Errorf("proto: PoolAccount: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Valaccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PoolAccount: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1541,7 +1546,7 @@ func (m *Valaccount) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valaddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1569,7 +1574,7 @@ func (m *Valaccount) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Valaddress = string(dAtA[iNdEx:postIndex]) + m.PoolAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 { diff --git a/x/stakers/types/tx.pb.go b/x/stakers/types/tx.pb.go index 8a4695c8..69993a86 100644 --- a/x/stakers/types/tx.pb.go +++ b/x/stakers/types/tx.pb.go @@ -225,8 +225,8 @@ type MsgJoinPool struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` // pool_id ... PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // valaddress ... - Valaddress string `protobuf:"bytes,3,opt,name=valaddress,proto3" json:"valaddress,omitempty"` + // pool_address ... + PoolAddress string `protobuf:"bytes,3,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty"` // amount ... Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` // commission ... @@ -282,9 +282,9 @@ func (m *MsgJoinPool) GetPoolId() uint64 { return 0 } -func (m *MsgJoinPool) GetValaddress() string { +func (m *MsgJoinPool) GetPoolAddress() string { if m != nil { - return m.Valaddress + return m.PoolAddress } return "" } @@ -533,46 +533,46 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/tx.proto", fileDescriptor_f52b730e69b9fb06) } var fileDescriptor_f52b730e69b9fb06 = []byte{ - // 622 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xfb, 0x91, 0x92, 0xa1, 0x14, 0xe4, 0x86, 0xd6, 0x75, 0x55, 0xb7, 0x04, 0x21, 0x95, - 0xaa, 0xb5, 0x15, 0x40, 0x1c, 0x7a, 0x23, 0x85, 0x4a, 0x94, 0x06, 0x2a, 0x57, 0x20, 0x3e, 0x0e, - 0xd1, 0xc6, 0x5e, 0x1c, 0x2b, 0xb1, 0xd7, 0xf2, 0x6e, 0x42, 0x7d, 0x43, 0xfc, 0x02, 0x4e, 0x70, - 0xe0, 0xcc, 0xbd, 0x07, 0x7e, 0x44, 0x8f, 0x15, 0x27, 0xc4, 0xa1, 0x42, 0xc9, 0xa1, 0x7f, 0x03, - 0x39, 0x1b, 0x6f, 0xd2, 0x90, 0x2a, 0x6d, 0xc4, 0x29, 0x99, 0x9d, 0x37, 0xf3, 0xde, 0xbe, 0x5d, - 0xcf, 0xc2, 0x52, 0x35, 0x6a, 0x60, 0x83, 0x32, 0x54, 0xc5, 0x21, 0x35, 0x1a, 0xf9, 0x32, 0x66, - 0x28, 0x6f, 0xb0, 0x03, 0x3d, 0x08, 0x09, 0x23, 0x72, 0x36, 0x4e, 0xeb, 0x9d, 0xb4, 0xde, 0x49, - 0xab, 0xf3, 0x16, 0xa1, 0x1e, 0xa1, 0x86, 0x47, 0x1d, 0xa3, 0x91, 0x8f, 0x7f, 0x38, 0x5c, 0x5d, - 0xe0, 0x89, 0x52, 0x3b, 0x32, 0x78, 0xd0, 0x49, 0x65, 0x1d, 0xe2, 0x10, 0xbe, 0x1e, 0xff, 0xe3, - 0xab, 0xb9, 0x6f, 0x12, 0xcc, 0x16, 0xa9, 0xf3, 0x32, 0xb0, 0x11, 0xc3, 0x5b, 0xc4, 0xf3, 0x5c, - 0x4a, 0x5d, 0xe2,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 0xc3, 0x35, 0xa9, 0xb0, 0x7d, 0xd4, 0xd4, 0xa4, 0xe3, 0xa6, 0x26, 0xfd, 0x69, 0x6a, 0xd2, 0xe7, - 0x96, 0x96, 0x3a, 0x6e, 0x69, 0xa9, 0x5f, 0x2d, 0x2d, 0xf5, 0x76, 0xdd, 0x71, 0x59, 0xa5, 0x5e, - 0xd6, 0x2d, 0xe2, 0x19, 0xcf, 0xde, 0xbc, 0x7a, 0xf2, 0x1c, 0xb3, 0x0f, 0x24, 0xac, 0x1a, 0x56, - 0x05, 0xb9, 0xbe, 0x71, 0x20, 0x1e, 0x1f, 0x16, 0x05, 0x98, 0x96, 0xd3, 0xed, 0x87, 0xe1, 0xfe, - 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x79, 0x09, 0x6c, 0x2c, 0x99, 0x06, 0x00, 0x00, + // 624 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x41, + 0x14, 0xee, 0xf2, 0xa3, 0xd8, 0x47, 0x45, 0xb3, 0x54, 0x58, 0x96, 0xb0, 0x40, 0x8d, 0x09, 0x12, + 0xd8, 0x4d, 0xd5, 0x78, 0xe0, 0x26, 0x28, 0x89, 0x48, 0x95, 0x2c, 0xd1, 0xf8, 0xe3, 0x40, 0x86, + 0xdd, 0x71, 0xbb, 0x29, 0xbb, 0xb3, 0xd9, 0x99, 0x56, 0xf6, 0x66, 0xfc, 0x0b, 0x3c, 0x79, 0xd0, + 0xb3, 0x77, 0x0e, 0xfe, 0x11, 0x1c, 0x89, 0x27, 0xe3, 0x81, 0x98, 0xf6, 0xc0, 0xbf, 0x61, 0xb6, + 0xb3, 0x3b, 0x2d, 0xb5, 0xa4, 0xd0, 0x78, 0x6a, 0xdf, 0x7b, 0xdf, 0x7b, 0xdf, 0x37, 0xdf, 0xcc, + 0xce, 0xc0, 0x5c, 0x35, 0x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, 0xcc, 0xa2, 0xde, 0xeb, 0xa2, 0xd0, 0x3b, 0x7c, 0x53, 0xef, 0xf6, 0x85, 0xa4, 0x0c, + 0xf2, 0x3b, 0xc8, 0xb5, 0x7d, 0x2d, 0x5e, 0xd8, 0x27, 0x30, 0xea, 0x72, 0x7f, 0x8c, 0x18, 0x1e, + 0xc0, 0xcd, 0x7f, 0xae, 0x9b, 0x8b, 0xb5, 0x75, 0x43, 0xd5, 0xd2, 0xa5, 0xa1, 0x82, 0x31, 0x82, + 0xc9, 0x5e, 0x77, 0xc4, 0x4a, 0x9f, 0x49, 0xe7, 0xd0, 0xea, 0x83, 0xab, 0xa0, 0x05, 0xb5, 0x0d, + 0xf9, 0x73, 0x07, 0xe7, 0x4e, 0x9f, 0x29, 0x1c, 0xa6, 0xae, 0x5e, 0x0a, 0x96, 0xb2, 0xa8, 0xa3, + 0x1f, 0xcf, 0x8e, 0x96, 0xa5, 0xf5, 0xcd, 0xe3, 0x86, 0x26, 0x9d, 0x34, 0x34, 0xe9, 0x4f, 0x43, + 0x93, 0x3e, 0x37, 0xb5, 0xcc, 0x49, 0x53, 0xcb, 0xfc, 0x6a, 0x6a, 0x99, 0xb7, 0x2b, 0x8e, 0xcb, + 0x2a, 0xb5, 0x7d, 0xdd, 0x22, 0x9e, 0xf1, 0xec, 0xcd, 0xab, 0x27, 0xcf, 0x31, 0xfb, 0x40, 0xc2, + 0xaa, 0x61, 0x55, 0x90, 0xeb, 0x1b, 0x87, 0xe2, 0xfd, 0x61, 0x51, 0x80, 0xe9, 0x7e, 0xb6, 0xf5, + 0x36, 0xdc, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x48, 0xf2, 0xac, 0x26, 0x9c, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -993,10 +993,10 @@ func (m *MsgJoinPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.Valaddress) > 0 { - i -= len(m.Valaddress) - copy(dAtA[i:], m.Valaddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.Valaddress))) + if len(m.PoolAddress) > 0 { + i -= len(m.PoolAddress) + copy(dAtA[i:], m.PoolAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.PoolAddress))) i-- dAtA[i] = 0x1a } @@ -1234,7 +1234,7 @@ func (m *MsgJoinPool) Size() (n int) { if m.PoolId != 0 { n += 1 + sovTx(uint64(m.PoolId)) } - l = len(m.Valaddress) + l = len(m.PoolAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1766,7 +1766,7 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { } case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valaddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1794,7 +1794,7 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Valaddress = string(dAtA[iNdEx:postIndex]) + m.PoolAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 {