From 73ba96f3111d09dd41326e490a85950b9515b06c Mon Sep 17 00:00:00 2001
From: Philip Offtermatt
Date: Fri, 15 Dec 2023 11:36:23 +0100
Subject: [PATCH] Minor fixes based on PR comments
---
tests/mbt/driver/core.go | 7 ++-----
tests/mbt/driver/model_viewer.go | 6 +++---
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/tests/mbt/driver/core.go b/tests/mbt/driver/core.go
index c98ee3335c..9fe803b2d0 100644
--- a/tests/mbt/driver/core.go
+++ b/tests/mbt/driver/core.go
@@ -123,8 +123,7 @@ func (s *Driver) consumerPower(i int64, chain ChainId) (int64, error) {
return v.Power, nil
}
-// consumerTokens returns the number of tokens that the validator with
-// id (ix) i has delegated to it in total on the provider chain
+// providerPower returns the power(=number of bonded tokens) of the i-th validator on the provider.
func (s *Driver) providerPower(i int64) (int64, error) {
v, found := s.providerStakingKeeper().GetValidator(s.ctx(PROVIDER), s.validator(i))
if !found {
@@ -181,9 +180,8 @@ func (s *Driver) packetQueue(sender, receiver ChainId) []simibc.Packet {
res, ok := outboxPackets[string(sender)]
if !ok {
return []simibc.Packet{}
- } else {
- return res
}
+ return res
}
func (s *Driver) getStateString() string {
@@ -345,7 +343,6 @@ func (s *Driver) endAndBeginBlock(chain ChainId, timeAdvancement time.Duration)
}
func (s *Driver) runningConsumers() []providertypes.Chain {
- // consumers that are still consumers on the provider
consumersOnProvider := s.providerKeeper().GetAllConsumerChains(s.providerCtx())
consumersWithIntactChannel := make([]providertypes.Chain, 0)
diff --git a/tests/mbt/driver/model_viewer.go b/tests/mbt/driver/model_viewer.go
index 9976a40980..ed090b2b86 100644
--- a/tests/mbt/driver/model_viewer.go
+++ b/tests/mbt/driver/model_viewer.go
@@ -85,9 +85,9 @@ func GetSendingTimeForPacket(packetExpr itf.MapExprType) int64 {
func VscSendTimestamps(curStateExpr itf.MapExprType, consumer string) []int64 {
sentVscPackets := ProviderState(curStateExpr)["sentVscPacketsToConsumer"].Value.(itf.MapExprType)[consumer].Value.(itf.ListExprType)
- res := make([]int64, 0)
- for _, packetExpr := range sentVscPackets {
- res = append(res, GetSendingTimeForPacket(packetExpr.Value.(itf.MapExprType)))
+ res := make([]int64, len(sentVscPackets))
+ for i, packetExpr := range sentVscPackets {
+ res[i] = GetSendingTimeForPacket(packetExpr.Value.(itf.MapExprType))
}
return res
}