From 05efa5f528a0e5b54f496a7655d68378793c0505 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Wed, 13 Dec 2023 11:54:55 -0600 Subject: [PATCH 1/3] Added in DAO module cli flags --- testutil/integration/onomy_chain.go | 19 +++++++++++++++++++ x/dao/client/cli/tx.go | 12 +++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/testutil/integration/onomy_chain.go b/testutil/integration/onomy_chain.go index d09e653d..fa77707e 100644 --- a/testutil/integration/onomy_chain.go +++ b/testutil/integration/onomy_chain.go @@ -17,6 +17,7 @@ import ( "time" "unsafe" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" sdkTypes "github.com/cosmos/cosmos-sdk/types" @@ -150,6 +151,24 @@ func (oc *OnomyChain) GetAccountBalance(address string) ([]sdkTypes.Coin, error) return balances.Balances, nil } +// ExecuteValidatorTx executes the chain CLI tx command from validator account. +// Example of usage: +// onomyChain.ExecuteValidatorTx("tx dao fund-account onomy1qe082nde7s9jpcw02emkz8256frd86mazg007y 1anom --title=T --deposit=1anom --description=D") . +func (oc *OnomyChain) ExecuteValidatorTx(cmd string) { + argsSlice := make([]string, 0) + + argsSlice = append(argsSlice, []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, TestChainValidator1Name), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("%d%s", 1000, ChainDenom)), // nolint:gomnd //test constant + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + KeyRingFlag, + oc.homeFlag, + }...) + + ExecuteChainCmd(cmd, argsSlice...) +} + // ExecuteChainCmd executes any cmd on the onomyd cli. func ExecuteChainCmd(cmd string, args ...string) string { oldArgs := os.Args diff --git a/x/dao/client/cli/tx.go b/x/dao/client/cli/tx.go index 023b3ef4..afb21466 100644 --- a/x/dao/client/cli/tx.go +++ b/x/dao/client/cli/tx.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" @@ -23,6 +24,11 @@ type proposalGeneric struct { Deposit string } +func addTxFlags(cmd *cobra.Command) *cobra.Command { + flags.AddTxFlagsToCmd(cmd) + return cmd +} + // GetTxCmd returns the transaction commands for this module. func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ @@ -33,9 +39,9 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdFundTreasuryProposal()) - cmd.AddCommand(CmdExchangeWithTreasuryProposal()) - cmd.AddCommand(CmdFundAccountProposal()) + cmd.AddCommand(addTxFlags(CmdFundTreasuryProposal())) + cmd.AddCommand(addTxFlags(CmdExchangeWithTreasuryProposal())) + cmd.AddCommand(addTxFlags((CmdFundAccountProposal()))) return cmd } From 04197615ca4a5ce8e84bd59bd0236efcdf51f4c4 Mon Sep 17 00:00:00 2001 From: Du Nguyen <61083705+lichdu29@users.noreply.github.com> Date: Thu, 15 Feb 2024 17:55:08 +0700 Subject: [PATCH 2/3] Update init-mainnet-statesync.sh --- deploy/scripts/init-mainnet-statesync.sh | 55 ++++++++---------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/deploy/scripts/init-mainnet-statesync.sh b/deploy/scripts/init-mainnet-statesync.sh index 43ad33d9..e8fb7959 100644 --- a/deploy/scripts/init-mainnet-statesync.sh +++ b/deploy/scripts/init-mainnet-statesync.sh @@ -1,44 +1,25 @@ #!/bin/bash -set -eu +set -uxe -echo "Setting statesync config" +git clone https://github.com/onomyprotocol/onomy && cd onomy && git checkout v1.1.4 +make install -# Onomy home dir -ONOMY_HOME=$HOME/.onomy -# Config directories for onomy node -ONOMY_HOME_CONFIG="$ONOMY_HOME/config" -# Config file for onomy node -ONOMY_NODE_CONFIG="$ONOMY_HOME_CONFIG/config.toml" -# App config file for onomy node -# Statysync servers default IPs -ONOMY_STATESYNC_SERVERS_DEFAULT_IPS="52.70.182.125,44.195.221.88" +export GOPATH=~/go +export PATH=$PATH:~/go/bin -statesync_nodes= -blk_height= -blk_hash= +onomyd init test --chain-id onomy-mainnet-1 +wget -O ~/.onomy/config/genesis.json https://raw.githubusercontent.com/onomyprotocol/onomy/main/genesis/mainnet/genesis-mainnet-1.json -read -r -p "Enter IPs of statesync nodes (at least 2) [$ONOMY_STATESYNC_SERVERS_DEFAULT_IPS]:" statesync_ips -statesync_ips=${statesync_ips:-$ONOMY_STATESYNC_SERVERS_DEFAULT_IPS} -for statesync_ip in ${statesync_ips//,/ } ; do - latest_height=$(curl -s http://$statesync_ip:26657/block | jq -r .result.block.header.height); - trusted_height=$((latest_height - 2000)); +LATEST_HEIGHT=$(curl -s "https://rpc-mainnet.onomy.io:443/block" | jq -r .result.block.header.height); +BLOCK_HEIGHT=$(($LATEST_HEIGHT - 2000)) +TRUST_HASH=$(curl -s "https://rpc-mainnet.onomy.io:443/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) - blk_details=$(curl -s http://$statesync_ip:26657/block?height=$trusted_height | jq -r '.result.block.header.height + "\n" + .result.block_id.hash') - blk_height=$(echo $blk_details | cut -d$' ' -f1) +export ONOMYD_STATESYNC_ENABLE=true +export ONOMYD_P2P_MAX_NUM_OUTBOUND_PEERS=100 +export ONOMYD_P2P_MAX_NUM_INBOUND_PEERS=100 +export ONOMYD_STATESYNC_RPC_SERVERS="https://rpc-mainnet.onomy.io:443,http://35.224.118.71:26657" +export ONOMYD_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT +export ONOMYD_STATESYNC_TRUST_HASH=$TRUST_HASH +export ONOMYDD_P2P_SEEDS="211535f9b799bcc8d46023fa180f3359afd4c1d3@44.213.44.5:26656,00ce2f84f6b91639a7cedb2239e38ffddf9e36de@44.195.221.88:26656,cd9a47cebe8eef076a5795e1b8460a8e0b2384e5@3.210.0.126:26656,60194df601164a8b5852087d442038e392bf7470@180.131.222.74:26656,0dbe561f30862f386456734f12f431e534a3139c@34.133.228.142:26656,4737740b63d6ba9ebe93e8cc6c0e9197c426e9f4@195.189.96.106:52756" - blk_hash=$(echo $blk_details | cut -d$' ' -f2) - statesync_nodes="$statesync_nodes$statesync_ip:26657," -done - -echo "Setting up trusted block number $blk_height and hash $blk_hash" - -# Change statesync settings -crudini --set $ONOMY_NODE_CONFIG statesync enable true -crudini --set $ONOMY_NODE_CONFIG statesync rpc_servers "\"$statesync_nodes\"" -crudini --set $ONOMY_NODE_CONFIG statesync trust_height $blk_height -crudini --set $ONOMY_NODE_CONFIG statesync trust_hash "\"$blk_hash\"" -crudini --set $ONOMY_NODE_CONFIG statesync discovery_time "\"60s\"" -crudini --set $ONOMY_NODE_CONFIG statesync chunk_request_timeout "\"60s\"" -crudini --set $ONOMY_NODE_CONFIG statesync chunk_fetchers "\"10\"" - -echo "Setup for statesync is complete" +onomyd start --x-crisis-skip-assert-invariants --p2p.persistent_peers 211535f9b799bcc8d46023fa180f3359afd4c1d3@44.213.44.5:26656,00ce2f84f6b91639a7cedb2239e38ffddf9e36de@44.195.221.88:26656,cd9a47cebe8eef076a5795e1b8460a8e0b2384e5@3.210.0.126:26656,60194df601164a8b5852087d442038e392bf7470@180.131.222.74:26656,0dbe561f30862f386456734f12f431e534a3139c@34.133.228.142:26656,4737740b63d6ba9ebe93e8cc6c0e9197c426e9f4@195.189.96.106:52756,00ce2f84f6b91639a7cedb2239e38ffddf9e36de@44.195.221.88:26656 From cfa177e7f887c96bf02899ac4c823b432a9d273e Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Mon, 6 May 2024 04:36:33 +0000 Subject: [PATCH 3/3] Remove markdown link check temp --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74b1947f..58b278b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,11 +70,3 @@ jobs: - name: Run `cargo clippy` run: | cargo clippy --all --all-targets --all-features -- -D clippy::all - - markdown-link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: gaurav-nelson/github-action-markdown-link-check@1.0.11 - with: - folder-path: "docs"