Created
September 16, 2024 12:36
-
-
Save toschdev/d4cf15900a9109cdb8a7ebd44095095b to your computer and use it in GitHub Desktop.
ICS Makefile
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
.PHONY: all setup provider consumer proposal clean stop | |
# Define binary and home directory variables for easy customization | |
PROVIDER_BINARY=interchain-security-pd | |
CONSUMER_BINARY=interchain-security-cd | |
PROVIDER_HOME=$(HOME)/.provider | |
CONSUMER_HOME=$(HOME)/.consumer | |
PROVIDER_CHAIN_ID=provider | |
CONSUMER_CHAIN_ID=consumer | |
# Default make target to run everything | |
all: setup provider consumer proposal vote | |
# Install ICS and Ignite CLI binaries | |
setup: | |
@echo "Setting up Interchain Security and dependencies..." | |
git clone https://github.com/cosmos/interchain-security && cd interchain-security && git checkout v5.1.1 && make install | |
ignite version || curl https://get.ignite.com/cli! | bash | |
# Provider chain setup - run the existing script | |
provider: | |
@echo "Setting up and starting the provider chain..." | |
bash provider/create_and_start.sh | |
# Consumer chain scaffolding using Ignite CLI | |
consumer: | |
@echo "Scaffolding the consumer chain..." | |
ignite s chain ccv --consumer --skip-proto --no-module | |
# Proposal submission - using an existing script | |
proposal: | |
@echo "Creating and submitting consumer chain proposal..." | |
bash provider/create_proposal.sh | |
# Automatic vote submission after proposal is created | |
vote: | |
@echo "Voting on the consumer chain proposal..." | |
# Wait a few seconds to ensure the proposal is registered in governance | |
sleep 5 | |
# Retrieve the latest proposal ID and automatically vote "yes" | |
proposal_id=$$($(PROVIDER_BINARY) q gov proposals --output json | jq -r '.proposals[-1].proposal_id'); \ | |
$(PROVIDER_BINARY) tx gov vote $$proposal_id yes --from validator --chain-id $(PROVIDER_CHAIN_ID) --node tcp://localhost:26658 --keyring-backend test -y | |
@echo "Vote cast for proposal $$proposal_id" | |
# Stop the provider chain | |
stop: | |
@echo "Stopping the provider chain..." | |
bash provider/stop.sh | |
# Clean up previous setups | |
clean: | |
@echo "Cleaning up environment..." | |
rm -rf $(PROVIDER_HOME) $(CONSUMER_HOME) | |
killall $(PROVIDER_BINARY) $(CONSUMER_BINARY) || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment