mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
emulate block broadcast mode in seed scripts (#1824)
This commit is contained in:
parent
c0df29333b
commit
ad03a75679
21
.github/scripts/seed-internal-testnet.sh
vendored
21
.github/scripts/seed-internal-testnet.sh
vendored
@ -1,6 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -ex
|
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
|
# configure kava binary to talk to the desired chain endpoint
|
||||||
kava config node "${CHAIN_API_URL}"
|
kava config node "${CHAIN_API_URL}"
|
||||||
kava config chain-id "${CHAIN_ID}"
|
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)
|
# fund evm-contract-deployer account (using issuance)
|
||||||
kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava -y
|
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
|
# 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_DEPLOY=$(npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" deploy-erc20 "USD Coin" USDC 6)
|
||||||
MULTICHAIN_USDC_CONTRACT_ADDRESS=${MULTICHAIN_USDC_CONTRACT_DEPLOY: -42}
|
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 \
|
kava tx issuance issue 6000000000ukava kava1vlpsrmdyuywvaqrv7rx6xga224sqfwz3fyfhwq \
|
||||||
--from dev-wallet --gas-prices 0.5ukava -y
|
--from dev-wallet --gas-prices 0.5ukava -y
|
||||||
|
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
|
|
||||||
# parse space seperated list of validators
|
# parse space seperated list of validators
|
||||||
# into bash array
|
# into bash array
|
||||||
read -r -a GENESIS_VALIDATOR_ADDRESS_ARRAY <<<"$GENESIS_VALIDATOR_ADDRESSES"
|
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
|
# delegate 300KAVA to each validator
|
||||||
for validator in "${GENESIS_VALIDATOR_ADDRESS_ARRAY[@]}"; do
|
for validator in "${GENESIS_VALIDATOR_ADDRESS_ARRAY[@]}"; do
|
||||||
kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y
|
kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
done
|
done
|
||||||
|
|
||||||
# create a text proposal
|
# 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
|
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
|
# setup god's wallet
|
||||||
echo "${KAVA_TESTNET_GOD_MNEMONIC}" | kava keys add --recover god
|
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.
|
# 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
|
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)
|
# 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
|
kava tx committee vote 1 yes --gas 2000000 --gas-prices 0.01ukava --from god -y
|
||||||
|
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
|
|
||||||
# fetch current module params
|
# fetch current module params
|
||||||
updatedEvmUtilParams=$(curl https://api.app.internal.testnet.us-east.production.kava.io/kava/evmutil/v1beta1/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"
|
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" \
|
"$DEV_TEST_WALLET_ADDRESS" \
|
||||||
1000000hard \
|
1000000hard \
|
||||||
--from dev-wallet --gas 2000000 --gas-prices 0.001ukava -y
|
--from dev-wallet --gas 2000000 --gas-prices 0.001ukava -y
|
||||||
|
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
|
21
.github/scripts/seed-protonet.sh
vendored
21
.github/scripts/seed-protonet.sh
vendored
@ -1,6 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -ex
|
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
|
# configure kava binary to talk to the desired chain endpoint
|
||||||
kava config node "${CHAIN_API_URL}"
|
kava config node "${CHAIN_API_URL}"
|
||||||
kava config chain-id "${CHAIN_ID}"
|
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)
|
# fund evm-contract-deployer account (using issuance)
|
||||||
kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava -y
|
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
|
# fund 5k kava to x/community account
|
||||||
kava tx community fund-community-pool 5000000000ukava --from dev-wallet --gas-prices 0.5ukava -y
|
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
|
# 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_DEPLOY=$(npx hardhat --network "${ERC20_DEPLOYER_NETWORK_NAME}" deploy-erc20 "USD Coin" USDC 6)
|
||||||
MULTICHAIN_USDC_CONTRACT_ADDRESS=${MULTICHAIN_USDC_CONTRACT_DEPLOY: -42}
|
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 \
|
kava tx issuance issue 6000000000ukava kava1vlpsrmdyuywvaqrv7rx6xga224sqfwz3fyfhwq \
|
||||||
--from dev-wallet --gas-prices 0.5ukava -y
|
--from dev-wallet --gas-prices 0.5ukava -y
|
||||||
|
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
|
|
||||||
# parse space seperated list of validators
|
# parse space seperated list of validators
|
||||||
# into bash array
|
# into bash array
|
||||||
read -r -a GENESIS_VALIDATOR_ADDRESS_ARRAY <<< "$GENESIS_VALIDATOR_ADDRESSES"
|
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[@]}"
|
for validator in "${GENESIS_VALIDATOR_ADDRESS_ARRAY[@]}"
|
||||||
do
|
do
|
||||||
kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y
|
kava tx staking delegate "${validator}" 300000000ukava --from dev-wallet --gas-prices 0.5ukava -y
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
done
|
done
|
||||||
|
|
||||||
# create a text proposal
|
# 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
|
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
|
# setup god's wallet
|
||||||
echo "${KAVA_TESTNET_GOD_MNEMONIC}" | kava keys add --recover god
|
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
|
# 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
|
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)
|
# 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
|
kava tx committee vote 1 yes --gas 2000000 --gas-prices 0.01ukava --from god -y
|
||||||
|
|
||||||
|
sleep $AVG_SECONDS_BETWEEN_BLOCKS
|
||||||
|
|
||||||
# fetch current module params
|
# fetch current module params
|
||||||
updatedEvmUtilParams=$(curl https://api.app.internal.testnet.us-east.production.kava.io/kava/evmutil/v1beta1/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"
|
printf "updated evm util module params\n %s" , "$updatedEvmUtilParams"
|
||||||
|
4
.github/workflows/cd-seed-chain.yml
vendored
4
.github/workflows/cd-seed-chain.yml
vendored
@ -76,8 +76,8 @@ jobs:
|
|||||||
- name: compile default erc20 contracts
|
- name: compile default erc20 contracts
|
||||||
run: make compile-contracts
|
run: make compile-contracts
|
||||||
working-directory: kava-bridge
|
working-directory: kava-bridge
|
||||||
- name: download seed script from master
|
- name: download seed script from current commit
|
||||||
run: wget https://raw.githubusercontent.com/Kava-Labs/kava/master/.github/scripts/${SEED_SCRIPT_FILENAME} && chmod +x ${SEED_SCRIPT_FILENAME}
|
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
|
working-directory: kava-bridge/contract
|
||||||
env:
|
env:
|
||||||
SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
|
SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
|
||||||
|
Loading…
Reference in New Issue
Block a user