-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Supplier] Add
MsgUpdateParam
to application module (#849)
## Summary ```bash ignite scaffold message update-param --module supplier --signer authority name as_type --response params ``` Adds the `MsgUpdateParam` message so that the supplier module may update individual parameters following section 0 from the updated docs (see #839). ## Dependencies - #809 - #843 - #844 - #845 - #847 - #848 ## Dependents - #850 - #857 - #852 - #861 - #851 - #863 ## Issue - #612 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [x] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [x] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache <[email protected]> Co-authored-by: Daniel Olshansky <[email protected]> Co-authored-by: red-0ne <[email protected]>
- Loading branch information
1 parent
b60dac9
commit b975a2a
Showing
15 changed files
with
2,128 additions
and
106 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" | ||
) | ||
|
||
// UpdateParam updates a single parameter in the proof module and returns | ||
// all active parameters. | ||
func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdateParam) (*suppliertypes.MsgUpdateParamResponse, error) { | ||
if err := msg.ValidateBasic(); err != nil { | ||
return nil, err | ||
} | ||
|
||
if k.GetAuthority() != msg.Authority { | ||
return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) | ||
} | ||
|
||
// TODO_UPNEXT(@bryanchriswhite, #612): uncomment & add a min_stake case. | ||
|
||
//params := k.GetParams(ctx) | ||
|
||
switch msg.Name { | ||
default: | ||
return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) | ||
} | ||
|
||
//if err := k.SetParams(ctx, params); err != nil { | ||
// return nil, err | ||
//} | ||
// | ||
//updatedParams := k.GetParams(ctx) | ||
//return &suppliertypes.MsgUpdateParamResponse{ | ||
// Params: &updatedParams, | ||
//}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package simulation | ||
|
||
import ( | ||
"math/rand" | ||
|
||
"github.com/cosmos/cosmos-sdk/baseapp" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation" | ||
|
||
"github.com/pokt-network/poktroll/x/supplier/keeper" | ||
"github.com/pokt-network/poktroll/x/supplier/types" | ||
) | ||
|
||
func SimulateMsgUpdateParam( | ||
ak types.AccountKeeper, | ||
bk types.BankKeeper, | ||
k keeper.Keeper, | ||
) simtypes.Operation { | ||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, | ||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { | ||
simAccount, _ := simtypes.RandomAcc(r, accs) | ||
msg := &types.MsgUpdateParam{ | ||
Authority: simAccount.Address.String(), | ||
} | ||
|
||
// TODO: Handling the UpdateParam simulation | ||
|
||
return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UpdateParam simulation not implemented"), nil, nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.