-
Notifications
You must be signed in to change notification settings - Fork 547
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
feat(network
): param-change apply to genesis
#3208
Conversation
network
: param-change apply to genesisnetwork
): param-change apply to genesis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, running some tests right now
@aljo242
Am I using the correct format for JSON value? |
Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>
Yes, actually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there is now an issue with string value
ignite n request change-param 11 staking bond_denom bar --from alice
Source code fetched
Blockchain set up
Genesis initialized
Invalid parameter change requested: Error: error reading GenesisDoc at /Users/lucas/spn/11/config/genesis.json: invalid character 'b' looking for beginning of value. Make sure that you have correctly migrated all Tendermint consensus params, please see the chain migration guide at https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md for more info
Usage:
exampled validate-genesis [file] [flags]
Flags:
-h, --help help for validate-genesis
Global Flags:
--home string directory for config and data (default "/Users/lucas/.example")
--log_format string The logging format (json|plain) (default "plain")
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
--trace print out full stack trace on errors
: exit status 1
Yes, you just have to wrap the string in quotations:
Its because we are treating everything as a |
Ok thanks, I was surprised as I used it without the quotes in previous tests |
@Pantani can you take some time to have a look at this one? |
@@ -179,6 +182,16 @@ func TestJSONFile_Update(t *testing.T) { | |||
), | |||
}, | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test case for:
WithKeyValueByte(
"app_state.crisis.params.constant_fee ",
[]bytes("newValue"),
),
Maybe this case should fail because it will miss the "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I understand. Why would this test fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the value is a string and don't have the "
in the begin and the end of the value, the JSON will break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How we handle to add string to JSON:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it's a corner case. We don't need to cover if you think don't make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in this specific test nothing will fail. We are just updating some generic []byte
value here and there is no way to test if it is valid until we run validate-genesis
later. So here at least, []byte("newValue")
and []byte("\"newValue\"")
are valid.
Co-authored-by: Danilo Pantani <danpantani@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT
@jeronimoalbi will merge if you approve |
* update spn * import * fix * update mocks * rename test * feat(`network`): `param-change` (#3142) * utd * add command * typo * add test * changelog * format * Update ignite/cmd/network_request_param_change.go Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> * Update changelog.md Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> * refactor: rename command `param-change` into `change-param` (#3169) * change name * rename file * chore: upgrade `spn` (#3177) * gomod * gosum * endpoints (#3196) * format * request list * feat: add `ParamChange` to `ignite n request list/show` (#3233) * chore: go formatting (#3232) Co-authored-by: aljo242 <aljo242@users.noreply.github.com> * request list * format * ascii Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: aljo242 <aljo242@users.noreply.github.com> * format * feat(`network`): param-change apply to genesis (#3208) * stub out * prepare logic * fix test * Update ignite/services/network/networkchain/prepare.go Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> * refactor WithKeyValueByte * add detail to error message * const format string * format * add integration test and fix * add check to command * format * finish check code * improve error msg * wip * fix * format * remove incorrect test * Update ignite/pkg/cosmosutil/genesis/genesis.go Co-authored-by: Danilo Pantani <danpantani@gmail.com> * rename according to review * optimize appylParamChanges * basic ModuleParamField test * format * revert errors Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> Co-authored-by: Danilo Pantani <danpantani@gmail.com> * add test * add test * flesh out genesis information tests * format Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: aljo242 <aljo242@users.noreply.github.com> Co-authored-by: Danilo Pantani <danpantani@gmail.com>
* update spn * import * fix * update mocks * rename test * feat(`network`): `param-change` (ignite#3142) * utd * add command * typo * add test * changelog * format * Update ignite/cmd/network_request_param_change.go Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> * Update changelog.md Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> * refactor: rename command `param-change` into `change-param` (ignite#3169) * change name * rename file * chore: upgrade `spn` (ignite#3177) * gomod * gosum * endpoints (ignite#3196) * format * request list * feat: add `ParamChange` to `ignite n request list/show` (ignite#3233) * chore: go formatting (ignite#3232) Co-authored-by: aljo242 <aljo242@users.noreply.github.com> * request list * format * ascii Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: aljo242 <aljo242@users.noreply.github.com> * format * feat(`network`): param-change apply to genesis (ignite#3208) * stub out * prepare logic * fix test * Update ignite/services/network/networkchain/prepare.go Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> * refactor WithKeyValueByte * add detail to error message * const format string * format * add integration test and fix * add check to command * format * finish check code * improve error msg * wip * fix * format * remove incorrect test * Update ignite/pkg/cosmosutil/genesis/genesis.go Co-authored-by: Danilo Pantani <danpantani@gmail.com> * rename according to review * optimize appylParamChanges * basic ModuleParamField test * format * revert errors Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> Co-authored-by: Danilo Pantani <danpantani@gmail.com> * add test * add test * flesh out genesis information tests * format Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: aljo242 <aljo242@users.noreply.github.com> Co-authored-by: Danilo Pantani <danpantani@gmail.com>
Closes #2899
Closes #3156
Adds check to verify param change before it is broadcast to the network.