Skip to content

Commit

Permalink
wip: test: update params E2E is green
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed May 6, 2024
1 parent 07840c8 commit 009e2d3
Show file tree
Hide file tree
Showing 7 changed files with 402 additions and 154 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ claim_list_session: ## List all the claims ending at a specific session (specifi
##############

# TODO_CONSIDERATION: additional factoring (e.g. POKTROLLD_FLAGS).
PARAM_FLAGS = --home=$(POKTROLLD_HOME) --keyring-backend test --from $(PNF_ADDRESS) --node $(POCKET_NODE) --chain-id $(CHAIN_ID)
PARAM_FLAGS = --home=$(POKTROLLD_HOME) --keyring-backend test --from $(PNF_ADDRESS) --node $(POCKET_NODE)

.PHONY: update_tokenomics_params_all
params_update_tokenomics_all: ## Update the tokenomics module params
Expand Down
8 changes: 8 additions & 0 deletions e2e/tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package e2e

import (
"context"
"flag"
"fmt"
"log"
Expand All @@ -12,6 +13,7 @@ import (
"regexp"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -69,6 +71,8 @@ func TestMain(m *testing.M) {

type suite struct {
gocuke.TestingT
ctx context.Context
once sync.Once
// TODO_TECHDEBT: rename to `poktrolld`.
pocketd *pocketdBin
scenarioState map[string]any // temporary state for each scenario
Expand All @@ -79,9 +83,13 @@ type suite struct {
// https://docs.cosmos.network/main/build/modules/authz
granterName string
granteeName string

// moduleParamsMap is a map of module names to a map of parameter names to parameter values & types.
expectedModuleParamsMap map[string]map[string]anyMap
}

func (s *suite) Before() {
s.ctx = context.Background()
s.pocketd = new(pocketdBin)
s.scenarioState = make(map[string]any)
deps := depinject.Configs(
Expand Down
52 changes: 23 additions & 29 deletions e2e/tests/update_params.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,29 @@ Feature: Params Namespace
And all "tokenomics" module params are set to their default values
And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "/poktroll.tokenomics.MsgUpdateParams" message
When the user sends an authz exec message to update all "tokenomics" module params
| name | value | type |
| "compute_units_to_tokens_multiplier" | "420" | "int64" |
Then all "tokenomics" module params should be updated
| name | value | type |
| "compute_units_to_tokens_multiplier" | "420" | "int64" |
| name | value | type |
| compute_units_to_tokens_multiplier | 420 | int64 |
Then all "tokenomics" module params should be updated

Scenario: An authorized user updates all "proof" module params
Given the user has the pocketd binary installed
And all "proof" module params are set to their default values
And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "/poktroll.proof.MsgUpdateParams" message
When the user sends an authz exec message to update all "tokenomics" module params
| name | value | type |
| "min_relay_difficulty_bits" | "8" | "int64" |
Then all "proof" module params should be updated
| name | value | type |
| "min_relay_difficulty_bits" | "8" | "int64" |
Scenario: An authorized user updates all "proof" module params
Given the user has the pocketd binary installed
And all "proof" module params are set to their default values
And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "/poktroll.proof.MsgUpdateParams" message
When the user sends an authz exec message to update all "proof" module params
| name | value | type |
| min_relay_difficulty_bits | 8 | int64 |
Then all "proof" module params should be updated

Scenario Outline: An authorized user updates individual <module> module params
Given the user has the pocketd binary installed
And all <module> module params are set to their default values
And an authz grant from the <granter> "module" account to the <grantee> "user" account for the <message_type> message
When the user sends an authz exec message to update <module> module param <param_name>
| value | type |
| <param_value> | <param_type> |
Then the <module> module param <param_name> should be updated
| value | type |
| <param_value> | <param_type> |
Scenario Outline: An authorized user updates individual <module> module params
Given the user has the pocketd binary installed
And all "<module>" module params are set to their default values
And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "<message_type>" message
When the user sends an authz exec message to update "<module>" the module param
| name | value | type |
| <param_name> | <param_value> | <param_type> |
Then the "<module>" module param "<param_name>" should be updated

Examples:
| module | granter | grantee | message_type | param_name | param_value | param_type |
| "tokenomics" | "gov" | "pnf" | "/poktroll.tokenomics.MsgUpdateParam" | "compute_units_to_tokens_multiplier" | "69" | "int64" |
| "proof" | "gov" | "pnf" | "/poktroll.proof.MsgUpdateParam" | "min_relay_difficulty_bits" | "12" | "int64" |
Examples:
| module | message_type | param_name | param_value | param_type |
| tokenomics | /poktroll.tokenomics.MsgUpdateParam | compute_units_to_tokens_multiplier | 68 | int64 |
| proof | /poktroll.proof.MsgUpdateParam | min_relay_difficulty_bits | 12 | int64 |
Loading

0 comments on commit 009e2d3

Please sign in to comment.