emulate block broadcast mode in seed scripts (#1824)

This commit is contained in:
Levi Schoen 2024-02-08 15:32:44 -08:00 committed by GitHub
parent c0df29333b
commit ad03a75679
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 2 deletions

View File

@ -1,6 +1,14 @@
#!/bin/bash
set -ex
# by sleeping 1 block in between tx's
# we can emulate the behavior of the
# the deprecated and now removed (as of Kava 16)
# broadcast mode of `block` in order to
# minimize the chance tx's fail due to an
# account sequence number mismatch
AVG_SECONDS_BETWEEN_BLOCKS=6.5
# configure kava binary to talk to the desired chain endpoint
kava config node "${CHAIN_API_URL}"
kava config chain-id "${CHAIN_ID}"
@ -23,6 +31,8 @@ echo "sweet ocean blush coil mobile ten floor sample nuclear power legend where
# fund evm-contract-deployer account (using issuance)
kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# deploy and fund USDC ERC20 contract
MULTICHAIN_USDC_CONTRACT_DEPLOY=$(npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" deploy-erc20 "USD Coin" USDC 6)
MULTICHAIN_USDC_CONTRACT_ADDRESS=${MULTICHAIN_USDC_CONTRACT_DEPLOY: -42}
@ -96,6 +106,8 @@ npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" mint-erc20 "$TETHER_USDT_
kava tx issuance issue 6000000000ukava kava1vlpsrmdyuywvaqrv7rx6xga224sqfwz3fyfhwq \
--from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# parse space seperated list of validators
# into bash array
read -r -a GENESIS_VALIDATOR_ADDRESS_ARRAY <<<"$GENESIS_VALIDATOR_ADDRESSES"
@ -103,11 +115,14 @@ read -r -a GENESIS_VALIDATOR_ADDRESS_ARRAY <<<"$GENESIS_VALIDATOR_ADDRESSES"
# delegate 300KAVA to each validator
for validator in "${GENESIS_VALIDATOR_ADDRESS_ARRAY[@]}"; do
kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
done
# create a text proposal
kava tx gov submit-legacy-proposal --deposit 1000000000ukava --type "Text" --title "Example Proposal" --description "This is an example proposal" --gas auto --gas-adjustment 1.2 --from dev-wallet --gas-prices 0.01ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# setup god's wallet
echo "${KAVA_TESTNET_GOD_MNEMONIC}" | kava keys add --recover god
@ -159,9 +174,13 @@ printf "original evm util module params\n %s" , "$originalEvmUtilParams"
# committee 1 is the stability committee. on internal testnet, this has only one member.
kava tx committee submit-proposal 1 "$proposalFileName" --gas 2000000 --gas-prices 0.01ukava --from god -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# vote on the proposal. this assumes no other committee proposal has ever been submitted (id=1)
kava tx committee vote 1 yes --gas 2000000 --gas-prices 0.01ukava --from god -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# fetch current module params
updatedEvmUtilParams=$(curl https://api.app.internal.testnet.us-east.production.kava.io/kava/evmutil/v1beta1/params)
printf "updated evm util module params\n %s" , "$updatedEvmUtilParams"
@ -172,3 +191,5 @@ kava tx evmutil convert-cosmos-coin-to-erc20 \
"$DEV_TEST_WALLET_ADDRESS" \
1000000hard \
--from dev-wallet --gas 2000000 --gas-prices 0.001ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS

View File

@ -1,6 +1,14 @@
#!/bin/bash
set -ex
# by sleeping 1 block in between tx's
# we can emulate the behavior of the
# the deprecated and now removed (as of Kava 16)
# broadcast mode of `block` in order to
# minimize the chance tx's fail due to an
# account sequence number mismatch
AVG_SECONDS_BETWEEN_BLOCKS=6.5
# configure kava binary to talk to the desired chain endpoint
kava config node "${CHAIN_API_URL}"
kava config chain-id "${CHAIN_ID}"
@ -23,9 +31,13 @@ echo "sweet ocean blush coil mobile ten floor sample nuclear power legend where
# fund evm-contract-deployer account (using issuance)
kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# fund 5k kava to x/community account
kava tx community fund-community-pool 5000000000ukava --from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# deploy and fund USDC ERC20 contract
MULTICHAIN_USDC_CONTRACT_DEPLOY=$(npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" deploy-erc20 "USD Coin" USDC 6)
MULTICHAIN_USDC_CONTRACT_ADDRESS=${MULTICHAIN_USDC_CONTRACT_DEPLOY: -42}
@ -89,6 +101,8 @@ npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" mint-erc20 "$AXL_USDC_CON
kava tx issuance issue 6000000000ukava kava1vlpsrmdyuywvaqrv7rx6xga224sqfwz3fyfhwq \
--from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# parse space seperated list of validators
# into bash array
read -r -a GENESIS_VALIDATOR_ADDRESS_ARRAY <<< "$GENESIS_VALIDATOR_ADDRESSES"
@ -97,11 +111,14 @@ read -r -a GENESIS_VALIDATOR_ADDRESS_ARRAY <<< "$GENESIS_VALIDATOR_ADDRESSES"
for validator in "${GENESIS_VALIDATOR_ADDRESS_ARRAY[@]}"
do
kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
done
# create a text proposal
kava tx gov submit-legacy-proposal --deposit 1000000000ukava --type "Text" --title "Example Proposal" --description "This is an example proposal" --gas auto --gas-adjustment 1.2 --from dev-wallet --gas-prices 0.01ukava -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# setup god's wallet
echo "${KAVA_TESTNET_GOD_MNEMONIC}" | kava keys add --recover god
@ -150,9 +167,13 @@ printf "original evm util module params\n %s" , "$originalEvmUtilParams"
# https://github.com/Kava-Labs/kava/pull/1556/files#diff-0bd6043650c708661f37bbe6fa5b29b52149e0ec0069103c3954168fc9f12612R900-R903
kava tx committee submit-proposal 1 "$proposalFileName" --gas 2000000 --gas-prices 0.01ukava --from god -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# vote on the proposal. this assumes no other committee proposal has ever been submitted (id=1)
kava tx committee vote 1 yes --gas 2000000 --gas-prices 0.01ukava --from god -y
sleep $AVG_SECONDS_BETWEEN_BLOCKS
# fetch current module params
updatedEvmUtilParams=$(curl https://api.app.internal.testnet.us-east.production.kava.io/kava/evmutil/v1beta1/params)
printf "updated evm util module params\n %s" , "$updatedEvmUtilParams"

View File

@ -76,8 +76,8 @@ jobs:
- name: compile default erc20 contracts
run: make compile-contracts
working-directory: kava-bridge
- name: download seed script from master
run: wget https://raw.githubusercontent.com/Kava-Labs/kava/master/.github/scripts/${SEED_SCRIPT_FILENAME} && chmod +x ${SEED_SCRIPT_FILENAME}
- name: download seed script from current commit
run: wget https://raw.githubusercontent.com/Kava-Labs/kava/${GITHUB_SHA}/.github/scripts/${SEED_SCRIPT_FILENAME} && chmod +x ${SEED_SCRIPT_FILENAME}
working-directory: kava-bridge/contract
env:
SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}