Skip to content

Commit

Permalink
chore: finished valaccount renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Dec 23, 2024
1 parent 71e7a13 commit 891e515
Show file tree
Hide file tree
Showing 37 changed files with 1,094 additions and 1,098 deletions.
2 changes: 1 addition & 1 deletion proto/kyve/stakers/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
// staker_list ...
repeated Staker staker_list = 2 [(gogoproto.nullable) = false];
// valaccount_list ...
// pool_account_list ...
repeated PoolAccount pool_account_list = 3 [(gogoproto.nullable) = false];
// commission_change_entries ...
repeated CommissionChangeEntry commission_change_entries = 4 [(gogoproto.nullable) = false];
Expand Down
4 changes: 2 additions & 2 deletions testutil/integration/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() {
Expect(poolByIdQuery.Pool.TotalDelegation).To(Equal(totalDelegationState))

// test stakers by pool
valaccounts := suite.App().StakersKeeper.GetAllPoolAccountsOfPool(suite.Ctx(), poolsState[i].Id)
poolAccounts := suite.App().StakersKeeper.GetAllPoolAccountsOfPool(suite.Ctx(), poolsState[i].Id)
stakersByPoolState := make([]querytypes.FullStaker, 0)

for _, poolAccount := range valaccounts {
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))
}
Expand Down
10 changes: 5 additions & 5 deletions testutil/integration/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 31 additions & 31 deletions testutil/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down
16 changes: 8 additions & 8 deletions x/bundles/keeper/abci_protocol_split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
PoolAddress: i.VALADDRESS_0_A,
PoolAddress: i.POOL_ADDRESS_0_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})
Expand All @@ -93,7 +93,7 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
PoolAddress: i.VALADDRESS_1_A,
PoolAddress: i.POOL_ADDRESS_1_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})
Expand Down Expand Up @@ -139,31 +139,31 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
PoolAddress: i.VALADDRESS_0_A,
PoolAddress: i.POOL_ADDRESS_0_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
PoolAddress: i.VALADDRESS_1_A,
PoolAddress: i.POOL_ADDRESS_1_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 1,
PoolAddress: 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,
PoolAddress: i.VALADDRESS_1_B,
PoolAddress: i.POOL_ADDRESS_1_B,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})
Expand Down Expand Up @@ -206,7 +206,7 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
PoolAddress: i.VALADDRESS_0_A,
PoolAddress: i.POOL_ADDRESS_0_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})
Expand All @@ -216,7 +216,7 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
PoolAddress: i.VALADDRESS_1_A,
PoolAddress: i.POOL_ADDRESS_1_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})
Expand Down
38 changes: 19 additions & 19 deletions x/bundles/keeper/keeper_suite_dropped_bundles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,7 +70,7 @@ var _ = Describe("dropped bundles", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
PoolAddress: i.VALADDRESS_0_A,
PoolAddress: i.POOL_ADDRESS_0_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})
Expand All @@ -80,22 +80,22 @@ var _ = Describe("dropped bundles", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
PoolAddress: 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)
})
Expand All @@ -111,15 +111,15 @@ var _ = Describe("dropped bundles", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_2,
PoolId: 0,
PoolAddress: i.VALADDRESS_2_A,
PoolAddress: i.POOL_ADDRESS_2_A,
Commission: math.LegacyMustNewDecFromStr("0.1"),
StakeFraction: math.LegacyMustNewDecFromStr("1"),
})

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",
Expand Down Expand Up @@ -171,25 +171,25 @@ var _ = Describe("dropped bundles", Ordered, func() {
Expect(bundleProposal.VotersAbstain).To(BeEmpty())

// check uploader status
valaccountUploader, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 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.PoolAddress)
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.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
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.PoolAddress)
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))
Expand Down
Loading

0 comments on commit 891e515

Please sign in to comment.