Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Testing] refractor: param update E2E tests as integration tests #826

Merged
merged 121 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
3a7315c
test: make stake_supplier.feature idempotent
bryanchriswhite Sep 11, 2024
9706877
test: speed up stake_supplier.feature
bryanchriswhite Sep 11, 2024
f2ec505
chore: simplification
bryanchriswhite Sep 11, 2024
e5672c1
chore: fix typos
bryanchriswhite Sep 11, 2024
597f75f
refactor: supplier feature steps
bryanchriswhite Sep 12, 2024
f90c752
refactor: rename paramsAnyMap type
bryanchriswhite Sep 12, 2024
526113b
chore: add comment
bryanchriswhite Sep 12, 2024
054d906
chore: add missing param update assertions
bryanchriswhite Sep 12, 2024
8b703c0
refactor: event waiting test helpers
bryanchriswhite Sep 12, 2024
ba1893c
feat: add supplier staking events
bryanchriswhite Sep 12, 2024
d3d51be
fix: test assertion expectation type
bryanchriswhite Sep 12, 2024
adfe8b8
refactor: integration app's base app & db construction
bryanchriswhite Sep 13, 2024
7aeb2e9
refactor: expose integration app's PreGeneratedAccountsIterator
bryanchriswhite Sep 13, 2024
f8cfdbe
refactor: add WithErrorAssertion run config option for integration app
bryanchriswhite Sep 13, 2024
dbd2402
refactor: add authz to integration app
bryanchriswhite Sep 13, 2024
e3725e4
test: begin refactoring update params E2E tests as integration tests
bryanchriswhite Sep 13, 2024
e842a09
wip: refactor: integraiton test suites to improve composability & reu…
bryanchriswhite Sep 13, 2024
8c94aec
wip: refactor: MsgUpdateParam E2E suite as integration suite
bryanchriswhite Sep 13, 2024
2833b6c
wip: test: debugging
bryanchriswhite Sep 13, 2024
98db79c
refactor: integration app base app construction
bryanchriswhite Sep 16, 2024
1908e10
fix: set default params for all poktroll modules
bryanchriswhite Sep 16, 2024
fdb2b91
chore: expose integration app's pre-generated account iterator
bryanchriswhite Sep 16, 2024
03f2de8
chore: add faucet account to integration app
bryanchriswhite Sep 16, 2024
9f38fb1
chore: add error assertion run option to integration app
bryanchriswhite Sep 16, 2024
61e5598
chore: add authz & bank modules to integration app
bryanchriswhite Sep 16, 2024
da70a08
feat: add IntegrationAppSuite & base implementation
bryanchriswhite Sep 16, 2024
942d381
Merge branch 'main' into issues/799/e2e/idempotent-stake-supplier
bryanchriswhite Sep 16, 2024
d5be66d
chore: rename paramsAnyMap type to mitigate variable name shadowing
bryanchriswhite Sep 16, 2024
36dc18d
chore: rename var
bryanchriswhite Sep 16, 2024
4f3664e
Merge branch 'main' into issues/799/e2e/idempotent-stake-supplier
Olshansk Sep 18, 2024
64c5a83
refactor: integration app to support txResult events
bryanchriswhite Sep 18, 2024
e73aa98
chore: extend IntegrationAppSuite
bryanchriswhite Sep 18, 2024
6e7832a
refactor: add IntegrationAppConfig/Options & genesis support
bryanchriswhite Sep 18, 2024
45730d2
fixup: HEAD^
bryanchriswhite Sep 18, 2024
06aa65e
chore: improvements & godoc comments
bryanchriswhite Sep 19, 2024
907b5c3
fix: tokenomics tests, RunMsgs, & NextBlock()
bryanchriswhite Sep 19, 2024
fb1c61b
chore: self-review improvements
bryanchriswhite Sep 19, 2024
d9e9c28
Merge remote-tracking branch 'pokt/main' into issues/799/refactor/int…
bryanchriswhite Sep 19, 2024
21e306e
fix: linter errors
bryanchriswhite Sep 19, 2024
1daf42c
fix: linter errors
bryanchriswhite Sep 19, 2024
2f1af15
Merge remote-tracking branch 'pokt/main' into issues/799/e2e/idempote…
bryanchriswhite Sep 19, 2024
7e71c38
fix: failing E2E test
bryanchriswhite Sep 19, 2024
ba7aaa7
chore: sync shared module default params
bryanchriswhite Sep 19, 2024
5c46e3d
chore: add comment
bryanchriswhite Sep 19, 2024
a2ee2c2
Merge branch 'issues/799/e2e/idempotent-stake-supplier' into issues/7…
bryanchriswhite Sep 19, 2024
3324d17
chore: review feedback improvements
bryanchriswhite Sep 19, 2024
8546244
Merge branch 'issues/799/e2e/param-helpers' into issues/799/feat/supp…
bryanchriswhite Sep 19, 2024
dfb5c05
Merge branch 'issues/799/feat/supplier-stake-events' into issues/799/…
bryanchriswhite Sep 19, 2024
7d4caf9
Merge branch 'issues/799/refactor/integration-app' into issues/799/me…
bryanchriswhite Sep 19, 2024
ba5e052
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 19, 2024
4c1c962
fix: update_param e2e test
bryanchriswhite Sep 19, 2024
5f0750a
Merge branch 'issues/799/e2e/idempotent-stake-supplier' into issues/7…
bryanchriswhite Sep 19, 2024
392a23b
Merge branch 'issues/799/e2e/param-helpers' into issues/799/feat/supp…
bryanchriswhite Sep 19, 2024
7cfb00c
chore: add unbonding_height fields & missing JSON tags
bryanchriswhite Sep 19, 2024
08c9b5d
chore: review improvements
bryanchriswhite Sep 19, 2024
8b98715
fix: failing tests
bryanchriswhite Sep 20, 2024
bedc05c
fix: failing tests
bryanchriswhite Sep 20, 2024
8d27279
Merge branch 'issues/799/e2e/idempotent-stake-supplier' into issues/7…
bryanchriswhite Sep 20, 2024
2877614
fix: failing tests
bryanchriswhite Sep 20, 2024
3effa0b
Merge branch 'issues/799/e2e/idempotent-stake-supplier' into issues/7…
bryanchriswhite Sep 20, 2024
68a0805
Merge branch 'issues/799/e2e/param-helpers' into issues/799/feat/supp…
bryanchriswhite Sep 20, 2024
ccced85
Merge branch 'issues/799/feat/supplier-stake-events' into issues/799/…
bryanchriswhite Sep 20, 2024
8fa1be4
chore: regenerate protobufs
bryanchriswhite Sep 20, 2024
0a0ad4e
Merge branch 'issues/799/feat/supplier-stake-events' into issues/799/…
bryanchriswhite Sep 20, 2024
18dbd04
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 20, 2024
53d5fcb
chore: review feedback improvements
bryanchriswhite Sep 20, 2024
836bbe3
fixup: HEAD^
bryanchriswhite Sep 20, 2024
55da2e3
Merge branch 'issues/799/refactor/integration-app' into issues/799/me…
bryanchriswhite Sep 20, 2024
0e3941f
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 20, 2024
912c09e
fix: post-merge
bryanchriswhite Sep 20, 2024
c0847c2
fix: bugs discovered
bryanchriswhite Sep 20, 2024
f32d585
Merge remote-tracking branch 'pokt/issues/799/refactor/integration-ap…
bryanchriswhite Sep 20, 2024
51cc9fe
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 20, 2024
79b18da
chore: add missing build constraint
bryanchriswhite Sep 20, 2024
e05979b
Merge branch 'main' into issues/799/e2e/idempotent-stake-supplier
bryanchriswhite Sep 23, 2024
cbbef67
chore: review feedback improvements
bryanchriswhite Sep 23, 2024
34776cb
Merge remote-tracking branch 'pokt/main' into issues/799/refactor/int…
bryanchriswhite Sep 23, 2024
cf3e04c
resolve: merge conflict
bryanchriswhite Sep 23, 2024
2cda72a
wip: improvements...
bryanchriswhite Sep 23, 2024
24e7234
Empty commit
bryanchriswhite Sep 23, 2024
695ce7c
Merge branch 'issues/799/e2e/idempotent-stake-supplier' into issues/7…
bryanchriswhite Sep 23, 2024
4808996
Merge branch 'main' into issues/799/e2e/param-helpers
bryanchriswhite Sep 23, 2024
463b474
chore: cleanup & comment
bryanchriswhite Sep 23, 2024
a70a084
chore: delete E2E params tests
bryanchriswhite Sep 23, 2024
b77d6a1
Merge remote-tracking branch 'pokt/issues/799/refactor/integration-ap…
bryanchriswhite Sep 23, 2024
9ced306
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 23, 2024
730d19f
Merge remote-tracking branch 'pokt/main' into issues/799/e2e/param-he…
bryanchriswhite Sep 23, 2024
21f822b
fix: add missing steps and update module name for moved param
bryanchriswhite Sep 23, 2024
fa8a9b6
Merge branch 'issues/799/e2e/param-helpers' into issues/799/feat/supp…
bryanchriswhite Sep 23, 2024
d4d0014
Merge branch 'issues/799/feat/supplier-stake-events' into issues/799/…
bryanchriswhite Sep 23, 2024
43e5737
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 23, 2024
52003cd
fixup: HEAD^
bryanchriswhite Sep 23, 2024
97ed69c
Merge branch 'issues/799/e2e/param-helpers' into issues/799/feat/supp…
bryanchriswhite Sep 23, 2024
268d102
Merge branch 'issues/799/feat/supplier-stake-events' into issues/799/…
bryanchriswhite Sep 23, 2024
e848711
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 23, 2024
52902d9
chore: self-review improvements
bryanchriswhite Sep 23, 2024
8baccfc
Merge branch 'main' into issues/799/refactor/integration-app
Olshansk Sep 23, 2024
afd9a60
revert: unintentional unfactoring
bryanchriswhite Sep 23, 2024
1372cd3
chore: review feedback improvements
bryanchriswhite Sep 24, 2024
c77a0a8
chore: review feedback improvements
bryanchriswhite Sep 24, 2024
c9ab047
Merge branch 'main' into issues/799/refactor/integration-app
bryanchriswhite Sep 24, 2024
01ded7f
Merge branch 'issues/799/refactor/integration-app' into issues/799/me…
bryanchriswhite Sep 24, 2024
54b7a8c
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 24, 2024
05f0ba6
chore: remove integration build constraints
bryanchriswhite Sep 24, 2024
8783b17
chore: reconcile upstream
bryanchriswhite Sep 24, 2024
e0e757b
fix: linter errors
bryanchriswhite Sep 24, 2024
6590f76
fixup! HEAD^
bryanchriswhite Sep 24, 2024
c914a89
Merge branch 'issues/799/refactor/integration-app' into issues/799/me…
bryanchriswhite Sep 24, 2024
5965522
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 24, 2024
d3563f5
fix: linter errors
bryanchriswhite Sep 24, 2024
f4945c4
chore: unexport params test suites
bryanchriswhite Sep 24, 2024
a6c35a9
Merge branch 'main' into issues/799/refactor/integration-app
bryanchriswhite Sep 25, 2024
a995747
chore: review feedback improvements
bryanchriswhite Sep 25, 2024
c6e4fd7
fix: typo
bryanchriswhite Sep 25, 2024
0201369
chore: review feedback improvements
bryanchriswhite Sep 25, 2024
a821cf4
chore: code review improvements
bryanchriswhite Sep 25, 2024
27837ca
chore: review feedback improvements
bryanchriswhite Sep 25, 2024
4dfa301
chore: consolidate param docs
bryanchriswhite Sep 25, 2024
337ea68
Merge branch 'issues/799/refactor/integration-app' into issues/799/me…
bryanchriswhite Sep 25, 2024
09ed9a7
Merge branch 'issues/799/merge/integration-app_x_sup-stake-evts' into…
bryanchriswhite Sep 25, 2024
445b2f7
Merge remote-tracking branch 'pokt/main' into issues/799/tests/params
bryanchriswhite Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ docusaurus_start: check_npm check_node ## Start the Docusaurus server

.PHONY: docs_update_gov_params_page
docs_update_gov_params_page: ## Update the page in Docusaurus documenting all the governance parameters
go run tools/scripts/generate_docs_params.go
go run tools/scripts/docusaurus/generate_docs_params.go

######################
### Ignite Helpers ###
Expand Down
81 changes: 3 additions & 78 deletions docusaurus/docs/develop/developer_guide/adding_params.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,88 +56,13 @@ message Params {
}
```

### 2 Update the Parameter E2E Tests

Update the E2E test files (e.g., `update_params.feature` and `update_params_test.go`)
to include scenarios that test the new parameter.

#### 2.1 Scenario Example

```gherkin
# NB: If you are reading this and the proof module has parameters
# that are not being updated in this test, please update the test.
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 exists
When the "pnf" account sends an authz exec message to update all "proof" module params
| name | value | type |
| new_parameter_name | 100 | int64 |
Then all "proof" module params should be updated
```

#### 2.2 Scenario Outline Example

```gherkin
# NB: If you are reading this and any module has parameters that
# are not being updated in this test, please update the test.
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 exists
When the "pnf" account 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 | message_type | param_name | param_value | param_type |
| proof | /poktroll.proof.MsgUpdateParam | new_parameter_name | 100 | int64 |
```

#### 2.3 Step Definition Helpers Example

The related changes to the step definition, presented below via an example,
should be made in `e2e/tests/parse_params_test.go`.

```go
func (s *suite) newProofMsgUpdateParams(params paramsMap) cosmostypes.Msg {
msgUpdateParams := &prooftypes.MsgUpdateParam{
Params: &prooftypes.Params{},
}

for paramName, paramValue := range params {
switch paramName {
case prooftypes.ParamNewParameterName:
msgUpdateParams.Params.NewParameterName = uint64(paramValue.value.(int64))
default:
s.Fatalf("unexpected %q type param name %q", paramValue.typeStr, paramName)
}
}
### 2 Update the Parameter Integration Tests

return msgUpdateParams
}
```

#### 2.4 Update switch statement to support new param

The related changes to the step definition, presented below via an example,
should be made in `e2e/tests/parse_params_test.go`.

```go
case prooftypes.ModuleName:
params := prooftypes.DefaultParams()
paramsMap := s.expectedModuleParams[moduleName]

newParameter, ok := paramsMap[prooftypes.ParamNewParameterName]
if ok {
params.NewParameter = uint64(newParameter.value.(int64))
}
```
// TODO_DOCUMENT(@bryanchriswhite, #826)

### 3. Update the Default Parameter Values

In the corresponding Go file (e.g., `params.go`), define the default value, key, and parameter name for the
In the corresponding Go file (e.g., `x/<module>/types/params.go`), define the default value, key, and parameter name for the
new parameter and include the default in the `NewParams` and `DefaultParams` functions.

```go
Expand Down
6 changes: 6 additions & 0 deletions docusaurus/docs/develop/developer_guide/test_suites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
sidebar_position: 5
title: Test Suites
---

// TODO_DOCUMENT(@bryanchriswhite)
15 changes: 10 additions & 5 deletions docusaurus/docs/protocol/governance/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ DO NOT EDIT: this file was generated by make docs_update_gov_params_page
- [Adding a new parameter](#adding-a-new-parameter)
- [Parameters](#parameters)

## Access Control

// TODO_DOCUMENT(@bryanchriswhite) tl;dr, authz.

## Updating governance parameter values

// TODO_DOCUMENT(@bryanchriswhite)

## Updating this page

```
Expand All @@ -27,12 +35,9 @@ Please follow the instructions in [this guide](../../develop/developer_guide/add


|Module | Field Type | Field Name |Comment |
|-------|------------|------------|--------|
| `application` | `uint64 ` | `max_delegated_gateways` | max_delegated_gateways defines the maximum number of gateways that a single application can delegate to. This is used to prevent performance issues in case the relay ring signature becomes too large. |
|-------|------------|------------|--------|| `application` | `uint64 ` | `max_delegated_gateways` | max_delegated_gateways defines the maximum number of gateways that a single application can delegate to. This is used to prevent performance issues in case the relay ring signature becomes too large. |
| `proof ` | `bytes ` | `relay_difficulty_target_hash` | TODO_FOLLOWUP(@olshansk, #690): Either delete this or change it to be named "minimum" relay_difficulty_target_hash is the maximum value a relay hash must be less than to be volume/reward applicable. |
| `proof ` | `float ` | `proof_request_probability` | proof_request_probability is the probability of a session requiring a proof if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. |
| `proof ` | `uint64 ` | `proof_requirement_threshold` | proof_requirement_threshold is the session cost (i.e. compute unit consumption) threshold which asserts that a session MUST have a corresponding proof when its cost is equal to or above the threshold. This is in contrast to the this requirement being determined probabilistically via ProofRequestProbability. TODO_MAINNET: Consider renaming this to `proof_requirement_threshold_compute_units`. |
| `service ` | `uint64 ` | `add_service_fee` | The amount of uPOKT required to add a new service. This will be deducted from the signer's account balance, and transferred to the pocket network foundation. |
| `shared ` | `uint64 ` | `num_blocks_per_session` | num_blocks_per_session is the number of blocks between the session start & end heights. |
| `shared ` | `uint64 ` | `grace_period_end_offset_blocks` | grace_period_end_offset_blocks is the number of blocks, after the session end height, during which the supplier can still service payable relays. Suppliers will need to recreate a claim for the previous session (if already created) to get paid for the additional relays. |
| `shared ` | `uint64 ` | `claim_window_open_offset_blocks` | claim_window_open_offset_blocks is the number of blocks after the session grace period height, at which the claim window opens. |
Expand All @@ -41,4 +46,4 @@ Please follow the instructions in [this guide](../../develop/developer_guide/add
| `shared ` | `uint64 ` | `proof_window_close_offset_blocks` | proof_window_close_offset_blocks is the number of blocks after the proof window open height, at which the proof window closes. |
| `shared ` | `uint64 ` | `supplier_unbonding_period_sessions` | supplier_unbonding_period_sessions is the number of sessions that a supplier must wait after unstaking before their staked assets are moved to their account balance. On-chain business logic requires, and ensures, that the corresponding block count of the unbonding period will exceed the end of any active claim & proof lifecycles. |
| `shared ` | `uint64 ` | `application_unbonding_period_sessions` | application_unbonding_period_sessions is the number of sessions that an application must wait after unstaking before their staked assets are moved to their account balance. On-chain business logic requires, and ensures, that the corresponding block count of the application unbonding period will exceed the end of its corresponding proof window close height. |
| `tokenomics` | `uint64 ` | `compute_units_to_tokens_multiplier` | The amount of upokt that a compute unit should translate to when settling a session. |
| `shared ` | `uint64 ` | `compute_units_to_tokens_multiplier` | The amount of upokt that a compute unit should translate to when settling a session. DEV_NOTE: This used to be under x/tokenomics but has been moved here to avoid cyclic dependencies. |
4 changes: 4 additions & 0 deletions docusaurus/docs/protocol/upgrades/module_params.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Pocket Network utilizes an off-chain governance mechanism that enables the commu
- [Examples](#examples)
- [Block Size Change](#block-size-change)

## Access Control

// TODO_DOCUMENT(@bryanchriswhite) tl;dr, authz.

## Examples

### Block Size Change
Expand Down
16 changes: 8 additions & 8 deletions docusaurus/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1810,10 +1810,15 @@
dependencies:
"@types/mdx" "^2.0.0"

"@node-rs/jieba-darwin-arm64@1.10.0":
"@node-rs/jieba-linux-x64-gnu@1.10.0":
version "1.10.0"
resolved "https://registry.npmjs.org/@node-rs/jieba-darwin-arm64/-/jieba-darwin-arm64-1.10.0.tgz"
integrity sha512-IhR5r+XxFcfhVsF93zQ3uCJy8ndotRntXzoW/JCyKqOahUo/ITQRT6vTKHKMyD9xNmjl222OZonBSo2+mlI2fQ==
resolved "https://registry.npmjs.org/@node-rs/jieba-linux-x64-gnu/-/jieba-linux-x64-gnu-1.10.0.tgz"
integrity sha512-rS5Shs8JITxJjFIjoIZ5a9O+GO21TJgKu03g2qwFE3QaN5ZOvXtz+/AqqyfT4GmmMhCujD83AGqfOGXDmItF9w==

"@node-rs/[email protected]":
version "1.10.0"
resolved "https://registry.npmjs.org/@node-rs/jieba-linux-x64-musl/-/jieba-linux-x64-musl-1.10.0.tgz"
integrity sha512-BvSiF2rR8Birh2oEVHcYwq0WGC1cegkEdddWsPrrSmpKmukJE2zyjcxaOOggq2apb8fIRsjyeeUh6X3R5AgjvA==

"@node-rs/jieba@^1.6.0":
version "1.10.0"
Expand Down Expand Up @@ -4614,11 +4619,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

fsevents@~2.3.2:
version "2.3.3"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==

function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
Expand Down
25 changes: 2 additions & 23 deletions e2e/tests/stake_supplier_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ package e2e

import (
"reflect"
"strings"
"unicode"

"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/testutil/cases"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

Expand Down Expand Up @@ -61,7 +60,7 @@ func paramsAnyMapFromParamsStruct(paramStruct any) paramsAnyMap {
for i := 0; i < paramsReflectValue.NumField(); i++ {
fieldValue := paramsReflectValue.Field(i)
fieldStruct := paramsReflectValue.Type().Field(i)
paramName := toSnakeCase(fieldStruct.Name)
paramName := cases.ToSnakeCase(fieldStruct.Name)

fieldTypeName := fieldStruct.Type.Name()
// TODO_IMPROVE: MsgUpdateParam currently only supports int64 and not uint64 value types.
Expand All @@ -78,23 +77,3 @@ func paramsAnyMapFromParamsStruct(paramStruct any) paramsAnyMap {
}
return paramsMap
}

func toSnakeCase(str string) string {
var result strings.Builder

for i, runeValue := range str {
if unicode.IsUpper(runeValue) {
// If it's not the first letter, add an underscore
if i > 0 {
result.WriteRune('_')
}
// Convert to lowercase
result.WriteRune(unicode.ToLower(runeValue))
} else {
// Otherwise, just append the rune as-is
result.WriteRune(runeValue)
}
}

return result.String()
}
95 changes: 0 additions & 95 deletions e2e/tests/update_params.feature

This file was deleted.

Loading
Loading