Skip to content

Commit

Permalink
tests: adapt old tests to support validation after rebase
Browse files Browse the repository at this point in the history
tests: adapt TestMultiConsumerSlashPacketThrottling

tests: fix broken VSC packets in integration tests (TestLeadingVSCMaturedAreDequeued)

tests: add missing e2e conflict resolution
  • Loading branch information
MSalopek committed Dec 1, 2023
1 parent 0d82030 commit a5f0123
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 0 additions & 3 deletions tests/e2e/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,6 @@ func (tr TestConfig) curlJsonRPCRequest(method, params, address string) {
verbosity := false
executeCommandWithVerbosity(cmd, "curlJsonRPCRequest", verbosity)
}
<<<<<<< HEAD
=======

// getClientFrozenHeight returns the frozen height for a client with the given client ID
// by querying the hosting chain with the given chainID
Expand Down Expand Up @@ -874,4 +872,3 @@ func (tr TestConfig) getProposedConsumerChains(chain ChainID) []string {
func uintPtr(i uint) *uint {
return &i
}
>>>>>>> 1e8512a0 (feat!: add cryptographic equivocation (#1340))
5 changes: 5 additions & 0 deletions tests/integration/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ func (s *CCVTestSuite) constructVSCMaturedPacketFromConsumer(bundle icstestingut
valsetUpdateId := bundle.GetKeeper().GetHeightValsetUpdateID(
bundle.GetCtx(), uint64(bundle.GetCtx().BlockHeight()))

// HACK: valsetUpdateId is invalid, so set it to 1
if valsetUpdateId == 0 {
valsetUpdateId = 1
}

return ccv.ConsumerPacketData{
Type: ccv.VscMaturedPacket,
Data: &ccv.ConsumerPacketData_VscMaturedPacketData{
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,13 @@ func (suite *CCVTestSuite) TestOnRecvSlashPacketErrors() {
providerKeeper.SetSlashMeter(ctx, sdk.NewInt(-1))
ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData)
suite.Require().NoError(err, "no error expected")
suite.Require().Equal(ccv.SlashPacketBouncedResult, ackResult, "expected successful ack")
suite.Require().Equal(ccv.V1Result, ackResult, "expected successful ack")

// Expect the packet to be handled if the slash meter is positive
providerKeeper.SetSlashMeter(ctx, sdk.NewInt(0))
ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData)
suite.Require().NoError(err, "no error expected")
suite.Require().Equal(ccv.SlashPacketHandledResult, ackResult, "expected successful ack")
suite.Require().Equal(ccv.V1Result, ackResult, "expected successful ack")
}

// TestValidatorDowntime tests if a slash packet is sent
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,10 @@ func (s *CCVTestSuite) TestLeadingVSCMaturedAreDequeued() {
packetData, err := provider.UnmarshalConsumerPacketData(data) // Same func used by provider's OnRecvPacket
s.Require().NoError(err)
packet := s.newPacketFromConsumer(data, ibcSeqNum, bundle.Path, timeoutHeight, timeoutTimestamp)
providerKeeper.OnRecvSlashPacket(s.providerCtx(),
_, err = providerKeeper.OnRecvSlashPacket(s.providerCtx(),
packet, *packetData.GetSlashPacketData())
s.Require().NoError(err)

}
}

Expand All @@ -875,8 +877,9 @@ func (s *CCVTestSuite) TestLeadingVSCMaturedAreDequeued() {
packetData := ccvtypes.ConsumerPacketData{}
ccvtypes.ModuleCdc.MustUnmarshalJSON(data, &packetData)
packet := s.newPacketFromConsumer(data, ibcSeqNum, bundle.Path, timeoutHeight, timeoutTimestamp)
providerKeeper.OnRecvVSCMaturedPacket(s.providerCtx(),
err := providerKeeper.OnRecvVSCMaturedPacket(s.providerCtx(),
packet, *packetData.GetVscMaturedPacketData())
s.Require().NoError(err)
}
}

Expand Down

0 comments on commit a5f0123

Please sign in to comment.