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.json with latest prod_pregenesis.sh run #15

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

2dpetkov
Copy link

@2dpetkov 2dpetkov commented Oct 6, 2023

Makefile for the validation now uses version v0.4.0 - latest stable from Public Testnet

The suggested pregenesis.json has been generated using v4-chain/protocol's prod_pregenesis.sh script, applying the bridging transactions as well as calculating the bridging address balance.
Steps to generate

  1. clone https://github.com/dydxprotocol/v4-chain
  2. cd protocol
  3. git checkout protocol/v0.4.0
  4. make build
  5. check if the version is correct ./build/dydxprotocold version
  6. update the # TODO(GENESIS) section in protocol/scripts/genesis/prod_pregenesis.sh with mainnet details
CHAIN_ID="dydx-mainnet-1"
# Base denomination of the native token. Usually comes with a prefix "u-", "a-" to indicate unit.
NATIVE_TOKEN="adydx"
# Denomination of the native token in whole coins.
NATIVE_TOKEN_WHOLE_COIN="dydx"
# Human readable name of token.
COIN_NAME="DYDX"
# Market ID in the oracle price list for the rewards token.
REWARDS_TOKEN_MARKET_ID=1000000
# The numerical chain ID of the Ethereum chain for bridge daemon to query.
ETH_CHAIN_ID=1
# The address of the Ethereum contract for bridge daemon to monitor for logs.
ETH_BRIDGE_ADDRESS="0x46b2DeAe6eFf3011008EA27EA36b7c27255ddFA9"
# The next event id (the last processed id plus one) of the logs from the Ethereum contract.
BRIDGE_GENESIS_ACKNOWLEDGED_NEXT_ID=35
# The Ethereum block height of the most recently processed bridge event.
BRIDGE_GENESIS_ACKNOWLEDGED_ETH_BLOCK_HEIGHT=18332102
# Genesis time of the chain.
GENESIS_TIME="2023-10-26T17:00:00Z"
# Start time of the community vesting schedule.
COMMUNITY_VEST_START_TIME="2021-08-03T15:00:00Z"
# End time of the community vesting schedule.
COMMUNITY_VEST_END_TIME="2026-08-03T15:00:00Z"
# Start time of the rewards vesting schedule.
REWARDS_VEST_START_TIME="2021-08-03T15:00:00Z"
# End time of the rewards vesting schedule.
REWARDS_VEST_END_TIME="2026-08-03T15:00:00Z"
  1. run the script with ./scripts/genesis/prod_pregenesis.sh ./build/dydxprotocold, the resulting pregenesis.json file is at /tmp/prod-chain/.dydxprotocol/config/genesis.json
  2. generate the bridging account details with
ETH_RPC=<enter your Ethereum RPC endpoint here>

TOBLOCK=18341359 && go run scripts/bridge_events/bridge_events.go \
  -verbose \
  -denom adydx \
  -address 0x46b2DeAe6eFf3011008EA27EA36b7c27255ddFA9 \
  -rpc $ETH_RPC \
  -toblock $((TOBLOCK))
  1. Add bank.balances and auth.accounts from the output to .app_state.bank.balances and .app_state.auth.accounts in pregenesis.json
  2. Update the bridging account address in pregenesis.json (dydx1zlefkpe3g0vvm9a4h0jf9000lmqutlh9jwjnsv), to contain total supply, or 1 billion DYDX (that is 10^(18+9) adydx), minus the sum of the bridged amounts - part of the output of scripts/bridge_events/bridge_events.go

@2dpetkov 2dpetkov marked this pull request as draft October 13, 2023 17:16
@2dpetkov 2dpetkov changed the title update pregenesis.json with latest prod_pregenesis.json run update pregenesis.json with latest prod_pregenesis.sh run Oct 13, 2023
@2dpetkov 2dpetkov marked this pull request as ready for review October 17, 2023 10:05
Copy link

@pswies pswies left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for the great PR description 🙏

@2dpetkov 2dpetkov merged commit 5024916 into main Oct 17, 2023
1 check failed
@2dpetkov 2dpetkov deleted the ddp/update-pregenesis branch October 17, 2023 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants