Skip to content

Commit

Permalink
[Supplier] Add min_stake supplier module param (#850)
Browse files Browse the repository at this point in the history
## Summary

- Adds the `min_stake` param to the supplier module following section 0
from the updated docs (see
#839).
- Adds missing validation unit test coverage around existing application
module param, max_delegated_gateways.
- Pushes validation from the MsgUpdateParam handler down into
MsgUpdateParam#ValidateBasic().
- Ensures Params#Valid() is called prior to setting params in
MsgUpdateParam handler.
- Updates error returns in the same handler to ensure all error paths
return appropriate gRPC status errors.

## Dependencies

- #809
- #843 
- #844 
- #845
- #847
- #848
- #849

## Dependents
  
- #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
- [ ] **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
4 people authored Oct 14, 2024
1 parent b975a2a commit c8f5230
Show file tree
Hide file tree
Showing 18 changed files with 544 additions and 99 deletions.
147 changes: 124 additions & 23 deletions api/poktroll/supplier/params.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ genesis:
amount: "100000068" # ~100 POKT
denom: upokt
supplier:
params:
# TODO_MAINNET: Determine realistic amount for minimum gateway stake amount.
min_stake:
amount: "1000000" # 1 POKT
denom: upokt
supplierList:
- owner_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
operator_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
Expand Down
15 changes: 14 additions & 1 deletion makefiles/params.mk
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ params_get_gateway: ## Get the gateway module params
poktrolld query gateway params --node $(POCKET_NODE)

.PHONY: params_update_gateway_all
params_update_gateway_all: ## Update the session module params
params_update_gateway_all: ## Update the gateway module params
poktrolld tx authz exec ./tools/scripts/params/gateway_all.json $(PARAM_FLAGS)

.PHONY: params_update_gateway_min_stake
Expand All @@ -135,6 +135,19 @@ params_update_application_max_delegated_gateways: ## Update the application modu
params_update_application_min_stake: ## Update the application module min_stake param
poktrolld tx authz exec ./tools/scripts/params/application_min_stake.json $(PARAM_FLAGS)

### Supplier Module Params ###
.PHONY: params_get_supplier
params_get_supplier: ## Get the supplier module params
poktrolld query supplier params --node $(POCKET_NODE)

.PHONY: params_update_supplier_all
params_update_supplier_all: ## Update the supplier module params
poktrolld tx authz exec ./tools/scripts/params/supplier_all.json $(PARAM_FLAGS)

.PHONY: params_update_supplier_min_stake
params_update_supplier_min_stake: ## Update the supplier module min_stake param
poktrolld tx authz exec ./tools/scripts/params/supplier_min_stake.json $(PARAM_FLAGS)

.PHONY: params_query_all
params_query_all: check_jq ## Query the params from all available modules
@for module in $(MODULES); do \
Expand Down
5 changes: 5 additions & 0 deletions proto/poktroll/supplier/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ option (gogoproto.stable_marshaler_all) = true;

import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

// Params defines the parameters for the module.
message Params {
option (amino.name) = "poktroll/x/supplier/Params";
option (gogoproto.equal) = true;

// min_stake is the minimum amount of uPOKT that a supplier must stake to be
// included in network sessions and remain staked.
cosmos.base.v1beta1.Coin min_stake = 1 [(gogoproto.jsontag) = "min_stake", (gogoproto.moretags) = "yaml:\"min_stake\""];
}
7 changes: 6 additions & 1 deletion testutil/integration/suites/param_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ var (
QueryParamsRequest: suppliertypes.QueryParamsRequest{},
QueryParamsResponse: suppliertypes.QueryParamsResponse{},
},
ValidParams: suppliertypes.Params{},
ValidParams: suppliertypes.Params{
MinStake: &ValidActorMinStake,
},
ParamTypes: map[ParamType]any{
ParamTypeCoin: suppliertypes.MsgUpdateParam_AsCoin{},
},
DefaultParams: suppliertypes.DefaultParams(),
NewParamClientFn: suppliertypes.NewQueryClient,
}
Expand Down
16 changes: 16 additions & 0 deletions tools/scripts/params/supplier_all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"body": {
"messages": [
{
"@type": "/poktroll.supplier.MsgUpdateParams",
"authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t",
"params": {
"min_stake": {
"amount": "1000000",
"denom": "upokt"
}
}
}
]
}
}
15 changes: 15 additions & 0 deletions tools/scripts/params/supplier_min_stake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"body": {
"messages": [
{
"@type": "/poktroll.supplier.MsgUpdateParam",
"authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t",
"name": "min_stake",
"as_coin": {
"amount": "1000000",
"denom": "upokt"
}
}
]
}
}
Loading

0 comments on commit c8f5230

Please sign in to comment.