From 8a76d5385e8f59c77d85f3630cf9367bb02815ec Mon Sep 17 00:00:00 2001 From: Troy Kessler Date: Mon, 23 Dec 2024 11:41:34 +0100 Subject: [PATCH] chore: started refactoring pool accounts --- proto/kyve/stakers/v1beta1/genesis.proto | 2 +- proto/kyve/stakers/v1beta1/stakers.proto | 16 +- x/bundles/keeper/logic_bundles_test.go | 4 +- x/bundles/types/expected_keepers.go | 2 +- x/delegation/types/expected_keepers.go | 2 +- x/query/keeper/grpc_query_can_propose_test.go | 2 +- x/query/keeper/grpc_query_can_vote_test.go | 2 +- x/stakers/keeper/exported_functions.go | 53 ++--- ..._valaccount.go => getters_pool_account.go} | 88 ++++----- x/stakers/keeper/getters_staker.go | 36 ++-- x/stakers/types/errors.go | 2 +- x/stakers/types/genesis.go | 8 +- x/stakers/types/genesis.pb.go | 82 ++++---- x/stakers/types/keys.go | 14 +- x/stakers/types/stakers.pb.go | 181 +++++++++--------- 15 files changed, 252 insertions(+), 242 deletions(-) rename x/stakers/keeper/{getters_valaccount.go => getters_pool_account.go} (50%) diff --git a/proto/kyve/stakers/v1beta1/genesis.proto b/proto/kyve/stakers/v1beta1/genesis.proto index 01c285e8..8de9b6f2 100644 --- a/proto/kyve/stakers/v1beta1/genesis.proto +++ b/proto/kyve/stakers/v1beta1/genesis.proto @@ -15,7 +15,7 @@ message GenesisState { // staker_list ... repeated Staker staker_list = 2 [(gogoproto.nullable) = false]; // valaccount_list ... - repeated Valaccount valaccount_list = 3 [(gogoproto.nullable) = false]; + 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/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index e527a3ba..64e248ab 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -557,7 +557,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { err := s.App().BundlesKeeper.AssertCanVote(s.Ctx(), 0, i.STAKER_2, i.VALADDRESS_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() { @@ -899,7 +899,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_2, i.VALADDRESS_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() { diff --git a/x/bundles/types/expected_keepers.go b/x/bundles/types/expected_keepers.go index e4d64802..b6e24525 100644 --- a/x/bundles/types/expected_keepers.go +++ b/x/bundles/types/expected_keepers.go @@ -31,7 +31,7 @@ type StakerKeeper interface { GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) AssertValaccountAuthorized(ctx sdk.Context, poolId uint64, stakerAddress string, valaddress string) error - GetValaccount(ctx sdk.Context, poolId uint64, stakerAddress string) (valaccount stakersTypes.Valaccount, active bool) + GetValaccount(ctx sdk.Context, poolId uint64, stakerAddress string) (valaccount stakersTypes.PoolAccount, active bool) LeavePool(ctx sdk.Context, staker string, poolId uint64) diff --git a/x/delegation/types/expected_keepers.go b/x/delegation/types/expected_keepers.go index 4fc092c4..f6ee7689 100644 --- a/x/delegation/types/expected_keepers.go +++ b/x/delegation/types/expected_keepers.go @@ -35,7 +35,7 @@ type UpgradeKeeper interface { type StakersKeeper interface { DoesStakerExist(ctx sdk.Context, staker string) bool GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) - GetValaccountsFromStaker(ctx sdk.Context, stakerAddress string) (val []*stakerstypes.Valaccount) + GetValaccountsFromStaker(ctx sdk.Context, stakerAddress string) (val []*stakerstypes.PoolAccount) GetPoolCount(ctx sdk.Context, stakerAddress string) (poolCount uint64) GetActiveStakers(ctx sdk.Context) []string } diff --git a/x/query/keeper/grpc_query_can_propose_test.go b/x/query/keeper/grpc_query_can_propose_test.go index 37db7135..ddbb7d9f 100644 --- a/x/query/keeper/grpc_query_can_propose_test.go +++ b/x/query/keeper/grpc_query_can_propose_test.go @@ -293,7 +293,7 @@ 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, diff --git a/x/query/keeper/grpc_query_can_vote_test.go b/x/query/keeper/grpc_query_can_vote_test.go index 465f71e5..6502a75a 100644 --- a/x/query/keeper/grpc_query_can_vote_test.go +++ b/x/query/keeper/grpc_query_can_vote_test.go @@ -259,7 +259,7 @@ 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, diff --git a/x/stakers/keeper/exported_functions.go b/x/stakers/keeper/exported_functions.go index ded6c72f..59986098 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 @@ -177,21 +178,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 @@ -244,11 +245,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 1ff6ba1a..4b5e86dd 100644 --- a/x/stakers/keeper/getters_staker.go +++ b/x/stakers/keeper/getters_staker.go @@ -21,15 +21,15 @@ import ( "google.golang.org/grpc/status" ) -// 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, }) @@ -39,15 +39,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) k.removeActiveStaker(ctx, stakerAddress) } @@ -58,12 +58,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/types/errors.go b/x/stakers/types/errors.go index c68a8119..28dbcc89 100644 --- a/x/stakers/types/errors.go +++ b/x/stakers/types/errors.go @@ -20,7 +20,7 @@ var ( 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, "valaccount unauthorized") ErrValidatorJailed = errors.Register(ModuleName, 1119, "validator jailed") ErrNoValaccount = errors.Register(ModuleName, 1120, "sender has no valaccount") ) diff --git a/x/stakers/types/genesis.go b/x/stakers/types/genesis.go index a17aca21..d10dd005 100644 --- a/x/stakers/types/genesis.go +++ b/x/stakers/types/genesis.go @@ -18,8 +18,8 @@ func (gs GenesisState) Validate() error { // Valaccounts valaccountMap := make(map[string]struct{}) - for _, elem := range gs.ValaccountList { - index := string(ValaccountKey(elem.PoolId, elem.Staker)) + for _, elem := range gs.PoolAccountList { + index := string(PoolAccountKey(elem.PoolId, elem.Staker)) if _, ok := valaccountMap[index]; ok { return fmt.Errorf("duplicated index for valaccount %v", elem) } @@ -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..4608fcd7 100644 --- a/x/stakers/types/genesis.pb.go +++ b/x/stakers/types/genesis.pb.go @@ -30,7 +30,7 @@ type GenesisState struct { // 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"` + 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, 0x58, 0xa2, 0x20, 0xac, 0x7e, 0xd5, - 0x5a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c, 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 6607fef1..0213d9d0 100644 --- a/x/stakers/types/keys.go +++ b/x/stakers/types/keys.go @@ -28,11 +28,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 valaccount for each staker and pool + // PoolAccountPrefix | | + PoolAccountPrefix = []byte{2, 0} + // PoolAccountPrefixIndex2 | | + PoolAccountPrefixIndex2 = []byte{2, 1} // CommissionChangeEntryKeyPrefix | CommissionChangeEntryKeyPrefix = []byte{4, 0} @@ -75,11 +75,11 @@ func StakerKey(staker string) []byte { return util.GetByteKey(staker) } -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/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, 0x8f, 0x2c, 0x9b, 0x7a, 0x1c, 0xd9, 0x5c, 0x4d, 0xc9, 0x35, 0xb3, 0x63, 0xbe, 0x18, 0xd0, - 0xa2, 0x81, 0x83, 0x39, 0x22, 0x2e, 0x53, 0xd3, 0x41, 0x83, 0x10, 0xc2, 0xe7, 0x00, 0x5e, 0x6e, - 0xd1, 0xf2, 0xf1, 0x10, 0xf9, 0x0e, 0x53, 0x33, 0xab, 0x89, 0xf5, 0x3f, 0xee, 0xfc, 0xa3, 0x07, - 0xa3, 0xe9, 0x22, 0xd1, 0x71, 0xf2, 0x7a, 0x91, 0x12, 0x6f, 0xfb, 0x9e, 0x18, 0xfe, 0xed, 0xa7, - 0x95, 0xf5, 0x16, 0xe1, 0xed,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7f, 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, 0x06, 0x47, 0xd4, 0x53, 0xd5, 0x03, 0xad, 0xe0, 0xd0, 0x5f, 0x51, + 0xa9, 0x9a, 0xb1, 0x13, 0x4c, 0x69, 0x25, 0x84, 0xda, 0x4b, 0x32, 0xcf, 0xfb, 0xcc, 0xfb, 0xbc, + 0xf3, 0x3e, 0xef, 0x68, 0x0c, 0xf2, 0x9d, 0xd1, 0x31, 0x36, 0x18, 0x47, 0x1d, 0xec, 0x31, 0xe3, + 0x78, 0xab, 0x89, 0x39, 0xda, 0x1a, 0x63, 0xbd, 0xef, 0x51, 0x4e, 0xe1, 0xa2, 0xd8, 0xa3, 0x8f, + 0x63, 0xc1, 0x9e, 0xdc, 0x02, 0xea, 0x11, 0x97, 0x1a, 0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xbf, 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 {