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] Gateway module #371

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 37 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.SILENT:

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
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
POCKET_ADDR_PREFIX = pokt

####################
Expand Down Expand Up @@ -166,9 +167,9 @@ localnet_down: ## Delete resources created by localnet
tilt down

.PHONY: localnet_regenesis
localnet_regenesis: ## Regenerate the localnet genesis file
localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file
# NOTE: intentionally not using --home <dir> flag to avoid overwriting the test keyring
# NB: Currently the stake => power calculation is constant; however, cosmos-sdk
# TODO_TECHDEBT: Currently the stake => power calculation is constant; however, cosmos-sdk
# intends to make this parameterizable in the future.
@echo "Initializing chain..."
@set -e ;\
Expand All @@ -178,8 +179,8 @@ localnet_regenesis: ## Regenerate the localnet genesis file
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) ;\
POWER=$$(yq -r ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\
NAME=$$(yq -r ".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 ;\
Expand Down Expand Up @@ -207,7 +208,7 @@ go_imports: check_go_version ## Run goimports on all go files
#############

.PHONY: test_e2e
test_e2e: ## Run all E2E tests
test_e2e: acc_initialize_pubkeys_warn_message ## Run all E2E tests
export POCKET_NODE=$(POCKET_NODE) && \
export APPGATE_SERVER=$(APPGATE_SERVER) && \
POKTROLLD_HOME=../../$(POKTROLLD_HOME) && \
Expand Down Expand Up @@ -237,7 +238,7 @@ itest: check_go_version ## Run tests iteratively (see usage for more)
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/gateway/types/
# go generate ./x/supplier/types/
# go generate ./x/session/types/
# go generate ./x/service/types/
Expand Down Expand Up @@ -369,7 +370,6 @@ 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 @@ -529,6 +529,32 @@ 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 @@ -656,4 +682,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