Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gusin13 committed Sep 12, 2024
1 parent 50060fc commit 443c7ef
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions test/e2e/bcd_consumer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,24 +352,31 @@ func (s *BCDConsumerIntegrationTestSuite) Test6SubmitFinalitySig() {
consumerFp := consumerFps[0]

// Query and assert finality provider voting power
var fpsByPower *cosmwasm.ConsumerFpsByPowerResponse
s.Eventually(func() bool {
fpsByPower, err = s.cosmwasmController.QueryFinalityProvidersByPower()
return err == nil && fpsByPower != nil && len(fpsByPower.Fps) > 0
}, time.Second*20, time.Second)
fpsByPower, err := s.cosmwasmController.QueryFinalityProvidersByPower()
if err != nil {
s.T().Logf("Error querying finality providers by power: %v", err)
return false
}
if fpsByPower == nil || len(fpsByPower.Fps) == 0 {
return false
}

// Create a map of BTC public keys to ConsumerFpInfoResponse
fpMap := make(map[string]cosmwasm.ConsumerFpInfoResponse)
for _, fp := range fpsByPower.Fps {
fpMap[fp.BtcPkHex] = fp
}
// Create a map of BTC public keys to ConsumerFpInfoResponse
fpMap := make(map[string]cosmwasm.ConsumerFpInfoResponse)
for _, fp := range fpsByPower.Fps {
fpMap[fp.BtcPkHex] = fp
}

// Check if the consumerFp's BTC public key exists in the map
consumerFpBtcPkHex := consumerFp.BtcPk.MarshalHex()
fpInfo, exists := fpMap[consumerFpBtcPkHex]
s.True(exists)
s.Equal(consumerFp.BtcPk.MarshalHex(), fpInfo.BtcPkHex)
s.Equal(uint64(0), fpInfo.Power)
// Check if the consumerFp's BTC public key exists in the map
consumerFpBtcPkHex := consumerFp.BtcPk.MarshalHex()
fpInfo, exists := fpMap[consumerFpBtcPkHex]
if !exists {
return false
}

return fpInfo.BtcPkHex == consumerFp.BtcPk.MarshalHex() && fpInfo.Power == 0
}, time.Minute, time.Second*5)

// s.Equal(consumerFp.BtcPk.MarshalHex(), fpsByPower.Fps[0].BtcPkHex)

Expand Down

0 comments on commit 443c7ef

Please sign in to comment.