From 01cfbca9838a7de14af07fccd3f3844200500a19 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 30 Sep 2024 14:58:04 +0200 Subject: [PATCH 1/5] nits --- tests/e2e/state.go | 5 - tests/e2e/steps_democracy.go | 178 +++++++++++------------ tests/e2e/test_runner.go | 2 +- tests/e2e/testnet-scripts/start-chain.sh | 4 +- 4 files changed, 92 insertions(+), 97 deletions(-) diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 55db1789d7..089c026192 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -289,9 +289,6 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u denomCondition := fmt.Sprintf(`total.#(%%"*%s*")`, denom) amount := strings.Split(gjson.Get(string(bz), denomCondition).String(), denom)[0] - fmt.Println("denomCondition:", denomCondition) - fmt.Println("json:", gjson.Parse(string(bz))) - res := float64(0) if amount != "" { res, err = strconv.ParseFloat(amount, 64) @@ -300,8 +297,6 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u } } - fmt.Println("res", res) - return res } diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 604f724ad8..7d08514a63 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -265,8 +265,8 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool ValidatorID("bob"): false, ValidatorID("carol"): false, }, - IsIncrementalReward: true, - Denom: "stake", + IsIncrementalReward: false, + Denom: consumerRewardDenoms[1], }, }, }, @@ -331,94 +331,94 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool }, }, }, - { - Action: RelayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 0, - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - // Downtime jailing and corresponding voting power change are processed by provider - ValidatorID("bob"): 0, - ValidatorID("carol"): 500, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - }, - }, + // { + // Action: RelayPacketsAction{ + // ChainA: ChainID("provi"), + // ChainB: ChainID(consumerName), + // Port: "provider", + // Channel: 0, + // }, + // State: State{ + // ChainID("provi"): ChainState{ + // ValPowers: &map[ValidatorID]uint{ + // ValidatorID("alice"): 511, + // // Downtime jailing and corresponding voting power change are processed by provider + // ValidatorID("bob"): 0, + // ValidatorID("carol"): 500, + // }, + // }, + // ChainID(consumerName): ChainState{ + // ValPowers: &map[ValidatorID]uint{ + // ValidatorID("alice"): 511, + // ValidatorID("bob"): 500, + // ValidatorID("carol"): 500, + // }, + // }, + // }, + // }, // A block is incremented each action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer - { - Action: RelayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 0, - }, - State: State{ - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - // VSC now seen on consumer - ValidatorID("bob"): 0, - ValidatorID("carol"): 500, - }, - }, - }, - }, - { - Action: UnjailValidatorAction{ - Provider: ChainID("provi"), - Validator: ValidatorID("bob"), - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 0, - ValidatorID("carol"): 500, - }, - }, - }, - }, - { - Action: RelayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 0, - }, - State: State{ - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators - StakedTokens: &map[ValidatorID]uint{ - ValidatorID("alice"): 100500000, - ValidatorID("bob"): 40000000, - }, - }, - }, - }, + // { + // Action: RelayPacketsAction{ + // ChainA: ChainID("provi"), + // ChainB: ChainID(consumerName), + // Port: "provider", + // Channel: 0, + // }, + // State: State{ + // ChainID(consumerName): ChainState{ + // ValPowers: &map[ValidatorID]uint{ + // ValidatorID("alice"): 511, + // // VSC now seen on consumer + // ValidatorID("bob"): 0, + // ValidatorID("carol"): 500, + // }, + // }, + // }, + // }, + // { + // Action: UnjailValidatorAction{ + // Provider: ChainID("provi"), + // Validator: ValidatorID("bob"), + // }, + // State: State{ + // ChainID("provi"): ChainState{ + // ValPowers: &map[ValidatorID]uint{ + // ValidatorID("alice"): 511, + // ValidatorID("bob"): 500, + // ValidatorID("carol"): 500, + // }, + // }, + // ChainID(consumerName): ChainState{ + // ValPowers: &map[ValidatorID]uint{ + // ValidatorID("alice"): 511, + // ValidatorID("bob"): 0, + // ValidatorID("carol"): 500, + // }, + // }, + // }, + // }, + // { + // Action: RelayPacketsAction{ + // ChainA: ChainID("provi"), + // ChainB: ChainID(consumerName), + // Port: "provider", + // Channel: 0, + // }, + // State: State{ + // ChainID(consumerName): ChainState{ + // ValPowers: &map[ValidatorID]uint{ + // ValidatorID("alice"): 511, + // ValidatorID("bob"): 500, + // ValidatorID("carol"): 500, + // }, + // // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators + // StakedTokens: &map[ValidatorID]uint{ + // ValidatorID("alice"): 100500000, + // ValidatorID("bob"): 40000000, + // }, + // }, + // }, + // }, } } diff --git a/tests/e2e/test_runner.go b/tests/e2e/test_runner.go index e07360954e..18ebf340fc 100644 --- a/tests/e2e/test_runner.go +++ b/tests/e2e/test_runner.go @@ -94,7 +94,7 @@ func (tr *TestRunner) Run() error { } tr.result.Passed() - err = tr.teardownEnvironment() + // err = tr.teardownEnvironment() fmt.Printf("==========================================\n") return err } diff --git a/tests/e2e/testnet-scripts/start-chain.sh b/tests/e2e/testnet-scripts/start-chain.sh index 23a5ca3c94..20b05d7538 100644 --- a/tests/e2e/testnet-scripts/start-chain.sh +++ b/tests/e2e/testnet-scripts/start-chain.sh @@ -243,7 +243,7 @@ do P2P_ADDRESS="--p2p.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26656" # LOG_LEVEL="--log_level trace" # switch to trace to see panic messages and rich and all debug msgs LOG_LEVEL="--log_level info" - ENABLE_WEBGRPC="--grpc-web.enable=false" + ENABLE_WEBGRPC="--grpc-web.enable=true" PERSISTENT_PEERS="" @@ -329,7 +329,7 @@ QUERY_LISTEN_ADDRESS="--address tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26655" QUERY_P2P_ADDRESS="--p2p.laddr tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26656" # QUERY_LOG_LEVEL="--log_level trace" # switch to trace to see panic messages and rich and all debug msgs QUERY_LOG_LEVEL="--log_level info" -QUERY_ENABLE_WEBGRPC="--grpc-web.enable=false" +QUERY_ENABLE_WEBGRPC="--grpc-web.enable=true" QUERY_PERSISTENT_PEERS="" From e4eb7e6933cad1c6cb387d386c91f2f272ff3341 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 30 Sep 2024 15:57:07 +0200 Subject: [PATCH 2/5] remove democ test print and fix state --- tests/e2e/steps_democracy.go | 174 +++++++++++++++++------------------ 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 7d08514a63..0e92fc933b 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -331,94 +331,94 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool }, }, }, - // { - // Action: RelayPacketsAction{ - // ChainA: ChainID("provi"), - // ChainB: ChainID(consumerName), - // Port: "provider", - // Channel: 0, - // }, - // State: State{ - // ChainID("provi"): ChainState{ - // ValPowers: &map[ValidatorID]uint{ - // ValidatorID("alice"): 511, - // // Downtime jailing and corresponding voting power change are processed by provider - // ValidatorID("bob"): 0, - // ValidatorID("carol"): 500, - // }, - // }, - // ChainID(consumerName): ChainState{ - // ValPowers: &map[ValidatorID]uint{ - // ValidatorID("alice"): 511, - // ValidatorID("bob"): 500, - // ValidatorID("carol"): 500, - // }, - // }, - // }, - // }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + // Downtime jailing and corresponding voting power change are processed by provider + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, + }, + }, + }, + }, // A block is incremented each action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer - // { - // Action: RelayPacketsAction{ - // ChainA: ChainID("provi"), - // ChainB: ChainID(consumerName), - // Port: "provider", - // Channel: 0, - // }, - // State: State{ - // ChainID(consumerName): ChainState{ - // ValPowers: &map[ValidatorID]uint{ - // ValidatorID("alice"): 511, - // // VSC now seen on consumer - // ValidatorID("bob"): 0, - // ValidatorID("carol"): 500, - // }, - // }, - // }, - // }, - // { - // Action: UnjailValidatorAction{ - // Provider: ChainID("provi"), - // Validator: ValidatorID("bob"), - // }, - // State: State{ - // ChainID("provi"): ChainState{ - // ValPowers: &map[ValidatorID]uint{ - // ValidatorID("alice"): 511, - // ValidatorID("bob"): 500, - // ValidatorID("carol"): 500, - // }, - // }, - // ChainID(consumerName): ChainState{ - // ValPowers: &map[ValidatorID]uint{ - // ValidatorID("alice"): 511, - // ValidatorID("bob"): 0, - // ValidatorID("carol"): 500, - // }, - // }, - // }, - // }, - // { - // Action: RelayPacketsAction{ - // ChainA: ChainID("provi"), - // ChainB: ChainID(consumerName), - // Port: "provider", - // Channel: 0, - // }, - // State: State{ - // ChainID(consumerName): ChainState{ - // ValPowers: &map[ValidatorID]uint{ - // ValidatorID("alice"): 511, - // ValidatorID("bob"): 500, - // ValidatorID("carol"): 500, - // }, - // // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators - // StakedTokens: &map[ValidatorID]uint{ - // ValidatorID("alice"): 100500000, - // ValidatorID("bob"): 40000000, - // }, - // }, - // }, - // }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + // VSC now seen on consumer + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, + }, + // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 100500000, + ValidatorID("bob"): 40000000, + }, + }, + }, + }, } } From 35ec4618767d4d6dd1c7a71a9db5a64d180724f7 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 30 Sep 2024 16:19:36 +0200 Subject: [PATCH 3/5] nits --- tests/e2e/test_runner.go | 2 +- tests/e2e/testnet-scripts/start-chain.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/test_runner.go b/tests/e2e/test_runner.go index 18ebf340fc..e07360954e 100644 --- a/tests/e2e/test_runner.go +++ b/tests/e2e/test_runner.go @@ -94,7 +94,7 @@ func (tr *TestRunner) Run() error { } tr.result.Passed() - // err = tr.teardownEnvironment() + err = tr.teardownEnvironment() fmt.Printf("==========================================\n") return err } diff --git a/tests/e2e/testnet-scripts/start-chain.sh b/tests/e2e/testnet-scripts/start-chain.sh index 20b05d7538..23a5ca3c94 100644 --- a/tests/e2e/testnet-scripts/start-chain.sh +++ b/tests/e2e/testnet-scripts/start-chain.sh @@ -243,7 +243,7 @@ do P2P_ADDRESS="--p2p.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26656" # LOG_LEVEL="--log_level trace" # switch to trace to see panic messages and rich and all debug msgs LOG_LEVEL="--log_level info" - ENABLE_WEBGRPC="--grpc-web.enable=true" + ENABLE_WEBGRPC="--grpc-web.enable=false" PERSISTENT_PEERS="" @@ -329,7 +329,7 @@ QUERY_LISTEN_ADDRESS="--address tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26655" QUERY_P2P_ADDRESS="--p2p.laddr tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26656" # QUERY_LOG_LEVEL="--log_level trace" # switch to trace to see panic messages and rich and all debug msgs QUERY_LOG_LEVEL="--log_level info" -QUERY_ENABLE_WEBGRPC="--grpc-web.enable=true" +QUERY_ENABLE_WEBGRPC="--grpc-web.enable=false" QUERY_PERSISTENT_PEERS="" From f46b76f5e06fe9b2cac368fc796684329de5a202 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 30 Sep 2024 17:14:10 +0200 Subject: [PATCH 4/5] docs --- tests/e2e/steps_democracy.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 0e92fc933b..4b3b192517 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -273,7 +273,9 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool }, // Transfer tokens from the consumer to the consumer reward pool // of the provider via the transfer channel-2 using the correct memo - // to identify the consumer + // to identify the consumer. + // Note that in this case, the consumer reward denoms aren't filtered by the `provider_reward_denoms` + // consumer parameter since the rewards are sent without going through the consumer distribution logic. { Action: TransferIbcTokenAction{ Chain: ChainID(consumerName), @@ -298,9 +300,11 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool ChainID("provi"): ChainState{ Rewards: &Rewards{ IsRewarded: map[ValidatorID]bool{ - ValidatorID("alice"): expectRegisteredRewardDistribution, - ValidatorID("bob"): expectRegisteredRewardDistribution, - ValidatorID("carol"): expectRegisteredRewardDistribution, + // rewards are distributed regardless whitelisted `provider_reward_denoms` + // consumer parameter + ValidatorID("alice"): true, + ValidatorID("bob"): true, + ValidatorID("carol"): true, }, IsIncrementalReward: false, Denom: consumerRewardDenoms[1], From ae522757128f2013e2abca459216bf36e891400d Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 30 Sep 2024 17:26:55 +0200 Subject: [PATCH 5/5] fix docs --- tests/e2e/steps_democracy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 4b3b192517..f8b34f1001 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -300,8 +300,8 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool ChainID("provi"): ChainState{ Rewards: &Rewards{ IsRewarded: map[ValidatorID]bool{ - // rewards are distributed regardless whitelisted `provider_reward_denoms` - // consumer parameter + // rewards should be distributed regardless + // of the `provider_reward_denoms` consumer parameter ValidatorID("alice"): true, ValidatorID("bob"): true, ValidatorID("carol"): true,