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

[Migration review - DO NOT MERGE] Supplier + proof modules #385

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
98c4633
scaffold: module supplier --dep bank
bryanchriswhite Feb 14, 2024
432042b
scaffold: map supplier --module supplier --no-message address stake:c…
bryanchriswhite Feb 14, 2024
0be76bd
chore: move supplier.proto to shared
bryanchriswhite Feb 8, 2024
0541b66
reconcile: `SupplierServiceConfig` & dep proto types
bryanchriswhite Feb 8, 2024
1d684ad
reconcile: `Suppler` proto type
bryanchriswhite Feb 8, 2024
0fcc1af
reconcile: types genesis
bryanchriswhite Feb 13, 2024
6502735
reconcile: error types
bryanchriswhite Feb 13, 2024
b14d518
reconcile: shared service helpers (1/2)
bryanchriswhite Feb 13, 2024
2fc2f37
reconcile: module genesis
bryanchriswhite Feb 13, 2024
c5c6e98
reconcile: supplier store (map)
bryanchriswhite Feb 13, 2024
074575b
reconcile: suppliers query
bryanchriswhite Feb 13, 2024
47c6d4a
scaffold: message stake-supplier --module supplier --signer address s…
bryanchriswhite Feb 14, 2024
f2bb384
reconcile: stake supplier message
bryanchriswhite Feb 14, 2024
d82daac
reconcile: mock bank keeper
bryanchriswhite Feb 14, 2024
4d34fd8
scaffold: message unstake-supplier --module supplier --signer address
bryanchriswhite Feb 14, 2024
5ba7353
reconcile: unstake supplier message
bryanchriswhite Feb 14, 2024
0b8245b
reconcile: supplier CLI configs
bryanchriswhite Feb 14, 2024
82c6a4b
reconcile: in-memory network
bryanchriswhite Feb 14, 2024
d00fc0f
chore: override autocli tx commands
bryanchriswhite Feb 14, 2024
7487784
reconcile: stake supplier CLI commands
bryanchriswhite Feb 14, 2024
e956d3c
reconcile: unstake supplier CLI commands
bryanchriswhite Feb 14, 2024
9faa010
fix: linter errors
bryanchriswhite Feb 14, 2024
65e2ac8
chore: supplier module review improvements
red-0ne Feb 20, 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
85 changes: 39 additions & 46 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.SILENT:

SHELL = /bin/sh
POKTROLLD_HOME ?= ./localnet/poktrolld
POCKET_NODE ?= tcp://127.0.0.1:36657 # The pocket rollup node (full node and sequencer in the localnet context)
APPGATE_SERVER ?= http://localhost:42069
POKTROLLD_HOME := ./localnet/poktrolld
POCKET_NODE = tcp://127.0.0.1:36657 # The pocket rollup node (full node and sequencer in the localnet context)
APPGATE_SERVER = http://localhost:42069
POCKET_ADDR_PREFIX = pokt

####################
Expand All @@ -16,6 +15,7 @@ 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
go install github.com/mikefarah/yq/v4@latest

########################
### Makefile Helpers ###
Expand Down Expand Up @@ -50,8 +50,8 @@ check_go_version:
MAJOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 1) && \
MINOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 2) && \
\
if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -ge 21 ] || [ "$$MINOR_VERSION" -le 18 ] ; then \
echo "Invalid Go version. Expected 1.19.x or 1.20.x but found $$GO_VERSION"; \
if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -le 20 ] ; then \
echo "Invalid Go version. Expected 1.21.x or newer but found $$GO_VERSION"; \
exit 1; \
fi

Expand Down Expand Up @@ -141,6 +141,13 @@ proto_regen: ## Delete existing protobuf artifacts and regenerate them
find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm
ignite generate proto-go --yes

.PHONY: proto_clean_pulsar
proto_clean_pulsar: ## TODO: explain...
@find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,'
find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm
ignite generate proto-go --yes
find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,'

#######################
### Docker Helpers ###
#######################
Expand All @@ -164,16 +171,27 @@ localnet_up: ## Starts localnet
.PHONY: localnet_down
localnet_down: ## Delete resources created by localnet
tilt down
kubectl delete secret celestia-secret || exit 1

.PHONY: localnet_regenesis
localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file
localnet_regenesis: ## Regenerate the localnet genesis file
# NOTE: intentionally not using --home <dir> flag to avoid overwriting the test keyring
ignite chain init
mkdir -p $(POKTROLLD_HOME)/config/
cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME)
cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/
cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/
# NB: Currently the stake => power calculation is constant; however, cosmos-sdk
# intends to make this parameterizable in the future.
@echo "Initializing chain..."
@set -e ;\
ignite chain init ;\
mkdir -p $(POKTROLLD_HOME)/config/ ;\
cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) ;\
cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ ;\
ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\
PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\
POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\
NAME=$$(yq ".validators[0].name" ./config.yml) ;\
echo "Regenerating genesis file with new validator..." ;\
jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' ${HOME}/.poktroll/config/genesis.json > temp.json ;\
mv temp.json ${HOME}/.poktroll/config/genesis.json ;\
cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ ;\


# TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state.
# cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml
Expand All @@ -196,7 +214,7 @@ go_imports: check_go_version ## Run goimports on all go files
#############

.PHONY: test_e2e
test_e2e: acc_initialize_pubkeys_warn_message ## Run all E2E tests
test_e2e: ## Run all E2E tests
export POCKET_NODE=$(POCKET_NODE) && \
export APPGATE_SERVER=$(APPGATE_SERVER) && \
POKTROLLD_HOME=../../$(POKTROLLD_HOME) && \
Expand Down Expand Up @@ -225,12 +243,12 @@ itest: check_go_version ## Run tests iteratively (see usage for more)
.PHONY: go_mockgen
go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all the modules.
find . -name "*_mock.go" | xargs --no-run-if-empty rm
go generate ./x/application/types/
go generate ./x/gateway/types/
# go generate ./x/application/types/
# go generate ./x/gateway/types/
go generate ./x/supplier/types/
go generate ./x/session/types/
# go generate ./x/session/types/
go generate ./x/service/types/
go generate ./x/tokenomics/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 All @@ -251,7 +269,7 @@ go_develop: proto_regen go_mockgen ## Generate protos and mocks
go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests

.PHONY: load_test_simple
load_test_simple: ## Runs the simpliest load test through the whole stack (appgate -> relayminer -> anvil)
load_test_simple: ## Runs the simplest load test through the whole stack (appgate -> relayminer -> anvil)
k6 run load-testing/tests/appGateServerEtherium.js

#############
Expand Down Expand Up @@ -358,6 +376,7 @@ app_list: ## List all the staked applications
app_stake: ## Stake tokens for the application specified (must specify the APP and SERVICES env vars)
poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config $(POKTROLLD_HOME)/config/$(SERVICES) --keyring-backend test --from $(APP) --node $(POCKET_NODE)

# TODO_IMPROVE(#180): Make sure genesis-staked actors are available via AccountKeeper
.PHONY: app1_stake
app1_stake: ## Stake app1 (also staked in genesis)
APP=app1 SERVICES=application1_stake_config.yaml make app_stake
Expand Down Expand Up @@ -517,32 +536,6 @@ acc_balance_query_app1: ## Query the balance of app1
acc_balance_total_supply: ## Query the total supply of the network
poktrolld --home=$(POKTROLLD_HOME) q bank total --node $(POCKET_NODE)

# NB: Ignite does not populate `pub_key` in `accounts` within `genesis.json` leading
# to queries like this to fail: `poktrolld query account pokt1<addr> --node $(POCKET_NODE).
# We attempted using a `tx multi-send` from the `faucet` to all accounts, but
# that also did not solve this problem because the account itself must sign the
# transaction for its public key to be populated in the account keeper. As such,
# the solution is to send funds from every account in genesis to some address
# (PNF was selected ambigously) to make sure their public keys are populated.

.PHONY: acc_initialize_pubkeys
acc_initialize_pubkeys: ## Make sure the account keeper has public keys for all available accounts
$(eval ADDRESSES=$(shell make -s ignite_acc_list | grep pokt | awk '{printf "%s ", $$2}' | sed 's/.$$//'))
$(eval PNF_ADDR=pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw)
# @printf "Addresses: ${ADDRESSES}"
$(foreach addr, $(ADDRESSES),\
echo $(addr);\
poktrolld tx bank send \
$(addr) $(PNF_ADDR) 1000upokt \
--yes \
--home=$(POKTROLLD_HOME) \
--node $(POCKET_NODE);)

.PHONY: acc_initialize_pubkeys_warn_message
acc_initialize_pubkeys_warn_message: ## Print a warning message about the need to run `make acc_initialize_pubkeys`
@printf "!!! YOU MUST RUN THE FOLLOWING COMMAND ONCE FOR E2E TESTS TO WORK AFTER THE NETWORK HAS STARTED!!!\n"\
"\t\tmake acc_initialize_pubkeys\n"

##############
### Claims ###
##############
Expand Down Expand Up @@ -670,4 +663,4 @@ act_list: check_act ## List all github actions that can be executed locally with
act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so: `GITHUB_TOKEN=$(gh auth token) make act_reviewdog`
$(eval CONTAINER_ARCH := $(shell make -s detect_arch))
@echo "Detected architecture: $(CONTAINER_ARCH)"
act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH)
act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH)
Loading
Loading