Skip to content

Commit

Permalink
[Tokenomics] Post-scaffold cleanup & parameter updates foundation (#287)
Browse files Browse the repository at this point in the history
- Scaffolded the `MsgUpdateParams` in the `tokenomics` module with tests
- Researched `x/gov`, `x/upgrade` and `x/authz` to set a pattern that follows Cosmos SDK best practices
   for governance parameter maintenance
- Reviewers: Please look through the description in this ticket to get some context as well #322 
- Deferring all imports and lining errors to the tooling we have today: `make go_lint && make go_imports`
- A few minor documentation NITs outside the scope of this PR that made it in accidently

---

Co-authored-by: Redouane Lakrache <[email protected]>
Co-authored-by: Dima Kniazev <[email protected]>
Co-authored-by: Bryan White <[email protected]>
  • Loading branch information
4 people authored Jan 23, 2024
1 parent eca7a52 commit 95838cb
Show file tree
Hide file tree
Showing 48 changed files with 1,121 additions and 178 deletions.
36 changes: 35 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ POCKET_ADDR_PREFIX = pokt

# TODO: Add other dependencies (ignite, docker, k8s, etc) here
.PHONY: install_ci_deps
install_ci_deps: ## Installs `mockgen`
install_ci_deps: ## Installs `mockgen` and other go tools
go install "github.com/golang/mock/[email protected]" && mockgen --version
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version
go install golang.org/x/tools/cmd/goimports@latest
Expand All @@ -38,6 +38,9 @@ help: ## Prints all the targets in all the Makefiles
### Checks ###
##############

# TODO_DOCUMENT: All of the `check_` helpers can be installed differently depending
# on the user's OS and enviornment.

.PHONY: check_go_version
# Internal helper target - check go version
check_go_version:
Expand Down Expand Up @@ -102,6 +105,17 @@ check_npm:
fi; \
}

.PHONY: check_jq
# Internal helper target - check if jq is installed
check_jq:
{ \
if ( ! ( command -v jq >/dev/null )); then \
echo "Seems like you don't have jq installed. Make sure you install it before continuing"; \
exit 1; \
fi; \
}


.PHONY: check_node
# Internal helper target - check if node is installed
check_node:
Expand Down Expand Up @@ -214,6 +228,7 @@ go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all
go generate ./x/gateway/types/
go generate ./x/supplier/types/
go generate ./x/session/types/
go generate ./x/tokenomics/types/
go generate ./pkg/client/interface.go
go generate ./pkg/miner/interface.go
go generate ./pkg/relayer/interface.go
Expand Down Expand Up @@ -540,6 +555,25 @@ claim_list_height_5: ## List all the claims at height 5
claim_list_session: ## List all the claims ending at a specific session (specified via SESSION variable)
poktrolld --home=$(POKTROLLD_HOME) q supplier list-claims --session-id $(SESSION) --node $(POCKET_NODE)

##############
### Params ###
##############

MODULES := application gateway pocket service session supplier tokenomics

# TODO_IMPROVE(#322): Improve once we decide how to handle parameter updates
.PHONY: update_tokenomics_params
update_tokenomics_params: ## Update the tokenomics module params
poktrolld --home=$(POKTROLLD_HOME) tx tokenomics update-params 43 --keyring-backend test --from pnf --node $(POCKET_NODE)

.PHONY: query_all_params
query_all_params: check_jq ## Query the params from all available modules
@for module in $(MODULES); do \
echo "~~~ Querying $$module module params ~~~"; \
poktrolld query $$module params --node $(POCKET_NODE) --output json | jq; \
echo ""; \
done

######################
### Ignite Helpers ###
######################
Expand Down
10 changes: 8 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"os"
"path/filepath"

// this line is used by starport scaffolding # stargate/app/moduleImport

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
dbm "github.com/cometbft/cometbft-db"
Expand Down Expand Up @@ -218,6 +216,7 @@ var (
servicemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
applicationmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
gatewaymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
tokenomicsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -347,6 +346,11 @@ func New(
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)

// TODO_BLOCKER(#322): Change this to `authtypes.NewModuleAddress(govtypes.ModuleName)`
// once we figure out the MVP for on-chain parameter governance.
pnfAddress := "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw"
authority := pnfAddress

app := &App{
BaseApp: bApp,
cdc: cdc,
Expand Down Expand Up @@ -646,6 +650,8 @@ func New(
keys[tokenomicsmoduletypes.StoreKey],
keys[tokenomicsmoduletypes.MemStoreKey],
app.GetSubspace(tokenomicsmoduletypes.ModuleName),
app.BankKeeper,
authority,
)
tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper)

Expand Down
4 changes: 2 additions & 2 deletions cmd/signals/on_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
)

// GoOnExitSignal calls the given callback when the process receives an interrupt
// or kill signal.
// or terminate signal.
func GoOnExitSignal(onInterrupt func()) {
go func() {
// Set up sigCh to receive when this process receives an interrupt or
// kill signal.
// terminate signal.
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)

Expand Down
5 changes: 5 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ accounts:
mnemonic: "baby advance work soap slow exclude blur humble lucky rough teach wide chuckle captain rack laundry butter main very cannon donate armor dress follow"
coins:
- 999999999999999999upokt
# PNF represents the multisig address that acts on behalf of the DAO
- name: pnf
mnemonic: "crumble shrimp south strategy speed kick green topic stool seminar track stand rhythm almost bubble pet knock steel pull flag weekend country major blade"
coins:
- 69000000000000000000042upokt
- name: sequencer1
mnemonic: "creek path rule retire evolve vehicle bargain champion roof whisper prize endorse unknown anchor fashion energy club sauce elder parent cotton old affair visa"
coins:
Expand Down
Loading

0 comments on commit 95838cb

Please sign in to comment.