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

Conversation

teddyding
Copy link
Contributor

@teddyding teddyding commented Oct 16, 2023

Changelist

Update pregenesis.sh script for testnet 4
Generate pregenesis file here

Test Plan

N/A

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2023

Walkthrough

The changes primarily focus on updating the testnet setup scripts, including modifications to chain ID, token balances, validator initialization, and genesis time. The consensus parameters are removed, and denomination metadata is introduced. The changes aim to enhance the configuration of the testnet environment and do not affect the core logic of the protocol.

Changes

File Summary
.../testnet-external/pregenesis.sh Updated chain ID, removed FAUCET_STAKE_BALANCE and VALIDATOR_INITIAL_STAKE_BALANCE, introduced FAUCET_NATIVE_TOKEN_BALANCE and TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT, and modified slashing and consensus parameters.
.../genesis.sh Introduced FAUCET_NATIVE_TOKEN_BALANCE, GENESIS_TIME, NATIVE_TOKEN_WHOLE_COIN, COIN_NAME, and updated TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE and TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT. Modified edit_genesis function to update genesis time and set denomination metadata.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between fc6d248 and 9c1c64c.
Files selected for processing (1)
  • protocol/testing/testnet-external/pregenesis.sh (3 hunks)
Additional comments (Suppressed): 3
protocol/testing/testnet-external/pregenesis.sh (3)
  • 52-52: The chain ID has been updated from "dydx-testnet-3" to "dydx-testnet-4". Ensure that this change is reflected across all services and components that interact with this chain.

  • 163-165: The consensus parameters have been removed from the script. This could potentially alter the network's consensus mechanism and its behavior. Please verify if this was intentional and if it has been tested thoroughly.

  • 221-224: The initial stake balance and self-delegation amounts for validators have been replaced with constants TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE and TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT. This standardizes these values across all validators, potentially affecting the distribution of power within the network. Ensure that these changes are in line with the intended design of the testnet.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 9c1c64c and f5b6aa8.
Files selected for processing (2)
  • protocol/testing/genesis.sh (1 hunks)
  • protocol/testing/testnet-external/pregenesis.sh (5 hunks)
Files skipped from review due to trivial changes (1)
  • protocol/testing/genesis.sh
Additional comments (Suppressed): 6
protocol/testing/testnet-external/pregenesis.sh (6)
  • 52-52: The CHAIN_ID has been updated from "dydx-testnet-3" to "dydx-testnet-4". Ensure that all references to the chain ID in the codebase have been updated to match this new value.

  • 64-64: The FAUCET_STAKE_BALANCE variable has been removed. Ensure that this does not affect any other parts of the code that might be using this variable.

  • 161-163: The consensus parameters have been removed. If these parameters are not set elsewhere, this could affect the consensus mechanism of the blockchain. Please verify.

  • 185-188: The FAUCET_BALANCE variable has been updated to use FAUCET_NATIVE_TOKEN_BALANCE instead of FAUCET_STAKE_BALANCE. Ensure that this change is reflected wherever FAUCET_BALANCE is used.

  • 219-222: The VALIDATOR_INITIAL_STAKE_BALANCE variable has been replaced with TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE. Ensure that this change is reflected wherever VALIDATOR_INITIAL_STAKE_BALANCE is used.

  • 224-224: The VALIDATOR_INITIAL_SELF_DELEGATION variable has been replaced with TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT. Ensure that this change is reflected wherever VALIDATOR_INITIAL_SELF_DELEGATION is used.

# 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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between f5b6aa8 and 6f9a4e1.
Files selected for processing (1)
  • protocol/testing/genesis.sh (2 hunks)
Additional comments (Suppressed): 4
protocol/testing/genesis.sh (4)
  • 22-28: The introduction of FAUCET_NATIVE_TOKEN_BALANCE and the update of TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE and TESTNET_VALIDATOR_SELF_DELEGATE_AMOUNT are significant changes. Ensure that these new values are compatible with the rest of the system and that they meet the requirements of the new testnet.

  • 36-37: The introduction of a fixed GENESIS_TIME is a significant change. Make sure that this time is appropriate for the new testnet and that it doesn't conflict with any other operations or assumptions in the system.

  • 39-41: The edit_genesis function now takes a parameter, which is a change from the previous version. Ensure that all calls to this function have been updated to pass the appropriate argument.

  • 68-69: The addition of the genesis_time field to the genesis.json file is a significant change. Ensure that this field is correctly used elsewhere in the system and that its value is correctly set.

@@ -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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 6f9a4e1 and b037f55.
Files selected for processing (2)
  • protocol/testing/genesis.sh (3 hunks)
  • protocol/testing/testnet-external/pregenesis.sh (6 hunks)
Additional comments (Suppressed): 11
protocol/testing/genesis.sh (5)
  • 24-25: New variables NATIVE_TOKEN_WHOLE_COIN and COIN_NAME are introduced. Ensure that these are used correctly throughout the codebase.

  • 30-30: The FAUCET_NATIVE_TOKEN_BALANCE is set to 50 million native tokens. Make sure this balance is appropriate for the testnet environment.

  • 39-39: The GENESIS_TIME is set to a fixed date. Ensure that this date is appropriate and does not cause any issues with the testnet.

  • 70-75: The edit_genesis function is updated to modify the genesis_time field in the genesis.json file. Ensure that this change does not affect the functionality of the testnet.

  • 1030-1031: The set_denom_metadata function is called to set denomination metadata for the native token. Ensure that this function is implemented correctly and that it does not introduce any issues.

protocol/testing/testnet-external/pregenesis.sh (6)
  • 52-52: The CHAIN_ID has been updated from "dydx-testnet-3" to "dydx-testnet-4". Ensure that all references to the chain ID in the codebase have been updated to match this new value.

  • 64-64: The FAUCET_STAKE_BALANCE variable has been removed. Ensure that this does not affect any other parts of the code that may be using this variable.

  • 138-138: The signed_blocks_window parameter in the slashing params has been updated from '12000' to '12288'. This change should be verified to ensure it aligns with the intended slashing policy.

  • 161-163: The consensus parameters have been removed. Ensure that this does not affect the consensus mechanism or any other parts of the code that may be using these parameters.

  • 185-188: The FAUCET_BALANCE is now initialized with FAUCET_NATIVE_TOKEN_BALANCE instead of FAUCET_STAKE_BALANCE. If SEED_FAUCET_USDC is true, the faucet is initialized with USDC balance in addition to the native token balance. Ensure that this change aligns with the intended token distribution policy.

  • 219-222: The VALIDATOR_INITIAL_STAKE_BALANCE variable has been replaced with TESTNET_VALIDATOR_NATIVE_TOKEN_BALANCE when initializing the validator account in genesis.json. Ensure that this change aligns with the intended validator token balance policy.

@teddyding teddyding merged commit 9338c8c into main Oct 16, 2023
15 checks passed
@teddyding teddyding deleted the td/pregenesis-testnet4 branch October 16, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants