Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Jul 14, 2023
1 parent 109aa26 commit bc853b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tests/integration/throttle_retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@ func (s *CCVTestSuite) TestSlashRetries() {
},
)
consumerKeeper.UpdateSlashRecordOnSend(s.consumerCtx())
slashRecord, found := consumerKeeper.GetSlashRecord(s.consumerCtx())
s.Require().True(found)
s.Require().True(slashRecord.WaitingOnReply)
s.Require().Len(consumerKeeper.GetPendingPackets(s.consumerCtx()), 1)

// Recv packet on provider and assert ack. Provider should return v1 result.
ack := providerModule.OnRecvPacket(s.providerCtx(), packet1, nil)
expectedv1Ack := channeltypes.NewResultAcknowledgement([]byte(ccvtypes.V1Result))
s.Require().Equal(expectedv1Ack.Acknowledgement(), ack.Acknowledgement())

// Couple blocks pass on provider for staking keeper to process jailing
// Couple blocks pass on provider for provider staking keeper to process jailing
s.providerChain.NextBlock()
s.providerChain.NextBlock()

Expand Down Expand Up @@ -110,7 +113,7 @@ func (s *CCVTestSuite) TestSlashRetries() {
},
)
consumerKeeper.UpdateSlashRecordOnSend(s.consumerCtx())
slashRecord, found := consumerKeeper.GetSlashRecord(s.consumerCtx())
slashRecord, found = consumerKeeper.GetSlashRecord(s.consumerCtx())
s.Require().True(found)
s.Require().True(slashRecord.WaitingOnReply)
s.Require().Len(consumerKeeper.GetPendingPackets(s.consumerCtx()), 1)
Expand All @@ -137,7 +140,7 @@ func (s *CCVTestSuite) TestSlashRetries() {
err = consumerKeeper.OnAcknowledgementPacket(s.consumerCtx(), packet2, ackForConsumer)
s.Require().NoError(err)

// TODO: when provider changes are made, slashRecord.WaitingOnReply should have been updated to false. Packet still in queue
// TODO: when provider changes are made, slashRecord.WaitingOnReply should have been updated to false on consumer. Slash Packet will still be in consumer's pending packets queue.

// Slash record should have been deleted, head of pending packets should have been popped
// Since provider has handled the packet
Expand Down
2 changes: 1 addition & 1 deletion x/ccv/consumer/keeper/throttle_retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
)

// TODO: will need good integration tests making sure this state is properly init, cleared, etc.
// TODO: e2e tests

//
// Throttling with retries follows a FSM design:
Expand Down

0 comments on commit bc853b3

Please sign in to comment.