Skip to content

Commit

Permalink
test: adjusted abci_protocol_split_test.go in bundles module
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Oct 27, 2023
1 parent e6878b9 commit 79df55e
Show file tree
Hide file tree
Showing 27 changed files with 624 additions and 513 deletions.
6 changes: 3 additions & 3 deletions testutil/integration/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func (suite *KeeperTestSuite) GetNextUploader() (nextStaker string, nextValaddre
switch bundleProposal.NextUploader {
case STAKER_0:
nextStaker = STAKER_0
nextValaddress = VALADDRESS_0
nextValaddress = VALADDRESS_0_A
case STAKER_1:
nextStaker = STAKER_1
nextValaddress = VALADDRESS_1
nextValaddress = VALADDRESS_1_A
case STAKER_2:
nextStaker = STAKER_2
nextValaddress = VALADDRESS_2
nextValaddress = VALADDRESS_2_A
default:
nextStaker = ""
nextValaddress = ""
Expand Down
24 changes: 15 additions & 9 deletions testutil/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ const (
BOB = "kyve1hvg7zsnrj6h29q9ss577mhrxa04rn94h7zjugq"
CHARLIE = "kyve1ay22rr3kz659fupu0tcswlagq4ql6rwm4nuv0s"

STAKER_0 = "kyve1htgfatqevuvfzvl0sxp97ywteqhg5leha9emf4"
VALADDRESS_0 = "kyve1qnf86dkvvtpdukx30r3vajav7rdq8snktm90hm"
STAKER_0 = "kyve1htgfatqevuvfzvl0sxp97ywteqhg5leha9emf4"
VALADDRESS_0_A = "kyve1qnf86dkvvtpdukx30r3vajav7rdq8snktm90hm"
VALADDRESS_0_B = "kyve10t8gnqjnem7tsu09erzswj3zm8599lsnex79rz"
VALADDRESS_0_C = "kyve13ztkcm2pket6mrmxj8rrmwc6supw7aqakg3uu3"

STAKER_1 = "kyve1gnr35rwn8rmflnlzs6nn5hhkmzzkxg9ap8xepw"
VALADDRESS_1 = "kyve1hpjgzljglmv00nstk3jvcw0zzq94nu0cuxv5ga"
STAKER_1 = "kyve1gnr35rwn8rmflnlzs6nn5hhkmzzkxg9ap8xepw"
VALADDRESS_1_A = "kyve1hpjgzljglmv00nstk3jvcw0zzq94nu0cuxv5ga"
VALADDRESS_1_B = "kyve14runw9qkltpz2mcx3gsfmlqyyvdzkt3rq3w6fm"
VALADDRESS_1_C = "kyve15w9m7zpq9ctsxsveqaqkp4uuvw98z5vct6s9g9"

STAKER_2 = "kyve1xsemlxghgvusumhqzm2ztjw7dz9krvu3de54e2"
VALADDRESS_2 = "kyve1u0870dkae6ql63hxvy9y7g65c0y8csfh8allzl"
STAKER_2 = "kyve1xsemlxghgvusumhqzm2ztjw7dz9krvu3de54e2"
VALADDRESS_2_A = "kyve1u0870dkae6ql63hxvy9y7g65c0y8csfh8allzl"
VALADDRESS_2_B = "kyve16g3utghkvvlz53jk0fq96zwrhxmqfu36ue965q"
VALADDRESS_2_C = "kyve18gjtzsn6jme3qsczj9q7wefymlkfu7ngyq5f9c"

// To avoid giving burner permissions to a module for the tests
BURNER = "kyve1ld23ktfwc9zstaq8aanwkkj8cf0ru6adtz59y5"
Expand Down Expand Up @@ -73,13 +79,13 @@ func (suite *KeeperTestSuite) initDummyAccounts() {
_ = suite.Mint(CHARLIE, 1000*KYVE)

_ = suite.Mint(STAKER_0, 1000*KYVE)
_ = suite.Mint(VALADDRESS_0, 1000*KYVE)
_ = suite.Mint(VALADDRESS_0_A, 1000*KYVE)

_ = suite.Mint(STAKER_1, 1000*KYVE)
_ = suite.Mint(VALADDRESS_1, 1000*KYVE)
_ = suite.Mint(VALADDRESS_1_A, 1000*KYVE)

_ = suite.Mint(STAKER_2, 1000*KYVE)
_ = suite.Mint(VALADDRESS_2, 1000*KYVE)
_ = suite.Mint(VALADDRESS_2_A, 1000*KYVE)

DUMMY = make([]string, 50)

Expand Down
48 changes: 41 additions & 7 deletions x/bundles/keeper/abci_protocol_split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,18 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
Valaddress: i.VALADDRESS_0,
Valaddress: i.VALADDRESS_0_A,
})

s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{
Creator: i.STAKER_1,
Amount: 100 * i.KYVE,
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
Valaddress: i.VALADDRESS_1_A,
})

b1, b2 := uint64(0), uint64(0)
Expand Down Expand Up @@ -119,21 +130,33 @@ var _ = Describe("abci.go", Ordered, func() {
Amount: 100 * i.KYVE,
})

s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{
Creator: i.STAKER_1,
Amount: 100 * i.KYVE,
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
Valaddress: i.VALADDRESS_0,
Valaddress: i.VALADDRESS_0_A,
})

s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{
Creator: i.STAKER_1,
Amount: 100 * i.KYVE,
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
Valaddress: i.VALADDRESS_1_A,
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 1,
Valaddress: i.VALADDRESS_0_B,
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 1,
Valaddress: i.VALADDRESS_1,
Valaddress: i.VALADDRESS_1_B,
})

// ACT
Expand Down Expand Up @@ -174,7 +197,18 @@ var _ = Describe("abci.go", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
Valaddress: i.VALADDRESS_0,
Valaddress: i.VALADDRESS_0_A,
})

s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{
Creator: i.STAKER_1,
Amount: 100 * i.KYVE,
})

s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
Valaddress: i.VALADDRESS_1_A,
})

// ACT
Expand Down
16 changes: 8 additions & 8 deletions x/bundles/keeper/keeper_suite_dropped_bundles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ var _ = Describe("dropped bundles", Ordered, func() {
s := i.NewCleanChain()

initialBalanceStaker0 := s.GetBalanceFromAddress(i.STAKER_0)
initialBalanceValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0)
initialBalanceValaddress0 := s.GetBalanceFromAddress(i.VALADDRESS_0_A)

initialBalanceStaker1 := s.GetBalanceFromAddress(i.STAKER_1)
initialBalanceValaddress1 := s.GetBalanceFromAddress(i.VALADDRESS_1)
initialBalanceValaddress1 := s.GetBalanceFromAddress(i.VALADDRESS_1_A)

BeforeEach(func() {
// init new clean chain
Expand Down Expand Up @@ -60,20 +60,20 @@ var _ = Describe("dropped bundles", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_0,
PoolId: 0,
Valaddress: i.VALADDRESS_0,
Valaddress: i.VALADDRESS_0_A,
})

s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{
Creator: i.VALADDRESS_0,
Creator: i.VALADDRESS_0_A,
Staker: i.STAKER_0,
PoolId: 0,
})

initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0)
initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0)
initialBalanceValaddress0 = s.GetBalanceFromAddress(i.VALADDRESS_0_A)

initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1)
initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1)
initialBalanceValaddress1 = s.GetBalanceFromAddress(i.VALADDRESS_1_A)

s.CommitAfterSeconds(60)
})
Expand All @@ -93,13 +93,13 @@ var _ = Describe("dropped bundles", Ordered, func() {
s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{
Creator: i.STAKER_1,
PoolId: 0,
Valaddress: i.VALADDRESS_1,
Valaddress: i.VALADDRESS_1_A,
})

initialBalanceStaker1 = s.GetBalanceFromAddress(i.STAKER_1)

s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{
Creator: i.VALADDRESS_0,
Creator: i.VALADDRESS_0_A,
Staker: i.STAKER_0,
PoolId: 0,
StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI",
Expand Down
Loading

0 comments on commit 79df55e

Please sign in to comment.