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

Update pregenesis.sh script for testnet4 #628

Merged
merged 5 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions protocol/testing/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ NATIVE_TOKEN="adv4tnt" # public testnet token
DEFAULT_SUBACCOUNT_QUOTE_BALANCE=100000000000000000
DEFAULT_SUBACCOUNT_QUOTE_BALANCE_FAUCET=900000000000000000
# Each testnet validator has 1 million whole coins of native token.
TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE=1000000$EIGHTEEN_ZEROS # 1e24
TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE=1000000$EIGHTEEN_ZEROS # 1e24 or 1 million native tokens.
# Each testnet validator self-delegates 500k whole coins of native token.
TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT=500000$EIGHTEEN_ZEROS # 5e23
TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT=500000$EIGHTEEN_ZEROS # 5e23 or 500k native tokens.
FAUCET_NATIVE_TOKEN_BALANCE=50000000$EIGHTEEN_ZEROS # 5e25 or 50 million native tokens.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~60 validators + 3 faucet + 1 rewards vester = 60 million + 150 million + 10 million = 220 million = 22% of total supply.

Note we will need to manually update the bridge module balance after gentx process is complete to make it add up to 1 billion total supply

ETH_CHAIN_ID=11155111 # sepolia
# https://sepolia.etherscan.io/address/0xf75012c350e4ad55be2048bd67ce6e03b20de82d
ETH_BRIDGE_ADDRESS="0xf75012c350e4ad55be2048bd67ce6e03b20de82d"
Expand Down
21 changes: 6 additions & 15 deletions protocol/testing/testnet-external/pregenesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ done
echo "Running with SEED_FAUCET_USDC=$SEED_FAUCET_USDC..."

source "./testing/genesis.sh"
CHAIN_ID="dydx-testnet-3"
CHAIN_ID="dydx-testnet-4"
FAUCET_ACCOUNTS=(
"dydx1g2ygh8ufgwwpg5clp2qh3tmcmlewuyt2z6px8k" # main faucet
"dydx1fzhzmcvcy7nycvu46j9j4f7f8cnqxn3770q260" # backup #1
Expand All @@ -60,9 +60,7 @@ TMP_CHAIN_DIR="/tmp/chain"
TMP_EXCHANGE_CONFIG_JSON_DIR="/tmp/exchange_config"
AWS_REGION="us-east-2"

# initialize faucet address with 1e27 native tokens.
FAUCET_STAKE_BALANCE=1000000000000000000000000000
# initialize faucet with 1e13 micro USDC (10 million USDC).
# initialize faucet with 1e13 micro USDC (10 million USDC). Only used when `SEED_FAUCET_USDC` is true.
FAUCET_USDC_BALANCE=10000000000000

# Define monikers for each validator. These are made up strings and can be anything.
Expand Down Expand Up @@ -163,19 +161,12 @@ function overwrite_genesis_public_testnet() {
dasel put -t string -f "$GENESIS" '.app_state.gov.params.quorum' -v '0.33400' # 33.4%
dasel put -t string -f "$GENESIS" '.app_state.gov.params.threshold' -v '0.50000' # 50%
dasel put -t string -f "$GENESIS" '.app_state.gov.params.veto_threshold' -v '0.33400' # 33.4%

# Consensus params
dasel put -t string -f "$GENESIS" '.consensus_params.block.max_bytes' -v '22020096'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my own understanding, why are we removing this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, I think this is removed so we can keep the 4mib value that we settled one

dasel put -t string -f "$GENESIS" '.consensus_params.block.max_gas' -v '-1'
}

create_pregenesis_file() {
VAL_HOME_DIR="$TMP_CHAIN_DIR/.dydxprotocol"
VAL_CONFIG_DIR="$VAL_HOME_DIR/config"

VALIDATOR_INITIAL_STAKE_BALANCE=100000000000
VALIDATOR_INITIAL_SELF_DELEGATION=$((VALIDATOR_INITIAL_STAKE_BALANCE/2))

# This initializes the $VAL_HOME_DIR folder.
$DYDX_BINARY init "test-moniker" -o --chain-id=$CHAIN_ID --home "$VAL_HOME_DIR"

Expand All @@ -191,7 +182,7 @@ create_pregenesis_file() {
edit_genesis "$VAL_CONFIG_DIR" "" "" "$TMP_EXCHANGE_CONFIG_JSON_DIR" "./testing/delaymsg_config" ""
overwrite_genesis_public_testnet

FAUCET_BALANCE="${FAUCET_STAKE_BALANCE}$NATIVE_TOKEN"
FAUCET_BALANCE="${FAUCET_NATIVE_TOKEN_BALANCE}$NATIVE_TOKEN"
# If SEED_FAUCET_USDC is true, faucet is initalized with USDC balance in addition to native token balance.
if [ "$SEED_FAUCET_USDC" = true ]; then
FAUCET_BALANCE="${FAUCET_BALANCE},${FAUCET_USDC_BALANCE}$USDC_DENOM"
Expand Down Expand Up @@ -225,12 +216,12 @@ create_pregenesis_file() {
echo "${MNEMONICS[$i]}" | $DYDX_BINARY keys add "${MONIKERS[$i]}" --recover --keyring-backend=test --home "$INDIVIDUAL_VAL_HOME_DIR"

# Initialize the validator account in `genesis.json` under their individual home directory, which is used to create their gentx.
$DYDX_BINARY add-genesis-account "${VALIDATOR_ACCOUNTS[$i]}" "${VALIDATOR_INITIAL_STAKE_BALANCE}$NATIVE_TOKEN" --home "$INDIVIDUAL_VAL_HOME_DIR"
$DYDX_BINARY add-genesis-account "${VALIDATOR_ACCOUNTS[$i]}" "${TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE}$NATIVE_TOKEN" --home "$INDIVIDUAL_VAL_HOME_DIR"

# Initialize the validator account in `genesis.json` under the common home directory, which is used as the output geneis file.
$DYDX_BINARY add-genesis-account "${VALIDATOR_ACCOUNTS[$i]}" "${VALIDATOR_INITIAL_STAKE_BALANCE}$NATIVE_TOKEN" --home "$VAL_HOME_DIR"
$DYDX_BINARY add-genesis-account "${VALIDATOR_ACCOUNTS[$i]}" "${TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE}$NATIVE_TOKEN" --home "$VAL_HOME_DIR"

$DYDX_BINARY gentx "${MONIKERS[$i]}" "${VALIDATOR_INITIAL_SELF_DELEGATION}$NATIVE_TOKEN" --moniker="${MONIKERS[$i]}" --keyring-backend=test --chain-id=$CHAIN_ID --home "$INDIVIDUAL_VAL_HOME_DIR" --ip="${IPS[$i]}"
$DYDX_BINARY gentx "${MONIKERS[$i]}" "${TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT}$NATIVE_TOKEN" --moniker="${MONIKERS[$i]}" --keyring-backend=test --chain-id=$CHAIN_ID --home "$INDIVIDUAL_VAL_HOME_DIR" --ip="${IPS[$i]}"

# Copy the gentx to a shared directory.
cp -a "$INDIVIDUAL_VAL_CONFIG_DIR/gentx/." "$TMP_GENTX_DIR"
Expand Down
Loading