Skip to content

Commit

Permalink
fix gentx validation (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
2dpetkov authored Oct 6, 2023
1 parent 9af6949 commit 2a1cd1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ validate-dydx-mainnet-1-gentx:
docker run --platform linux/amd64 \
-e VALIDATE_GENESIS_DIR_PATH=./dydx-mainnet-1 \
-e VALIDATE_GENESIS_TAR_URL='https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2Fv0.3.1/dydxprotocold-v0.3.1-linux-amd64.tar.gz' \
-e VALIDATE_GENESIS_STAKE_TOKEN=dv4tnt \
-e VALIDATE_GENESIS_STAKE_TOKEN=adydx \
-e GENESIS_FILE_NAME=pregenesis.json \
-e ADD_GENTXS=true \
-v $(CURDIR):/workspace \
Expand All @@ -14,7 +14,7 @@ validate-dydx-mainnet-1-final-genesis:
docker run --platform linux/amd64 \
-e VALIDATE_GENESIS_DIR_PATH=./dydx-mainnet-1 \
-e VALIDATE_GENESIS_TAR_URL='https://github.com/dydxprotocol/v4-chain/releases/download/protocol%2Fv0.3.1/dydxprotocold-v0.3.1-linux-amd64.tar.gz' \
-e VALIDATE_GENESIS_STAKE_TOKEN=dv4tnt \
-e VALIDATE_GENESIS_STAKE_TOKEN=adydx \
-e GENESIS_FILE_NAME=genesis.json \
-e ADD_GENTXS=false \
-v $(CURDIR):/workspace \
Expand Down
22 changes: 0 additions & 22 deletions validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,11 @@ dydxprotocold_path=$(tar -xvf $tar_path --directory /tmp/dydxprotocold)
mkdir -p ~/bin
cp /tmp/dydxprotocold/$dydxprotocold_path /usr/local/bin/dydxprotocold

add_genesis_account () {
find "$1" -type f -name "*.json" | while read json_file; do
delegator_address=$(jq -r '.body.messages[0].delegator_address' "$json_file")
moniker=$(jq -r '.body.messages[0].description.moniker' "$json_file")

if [ "$moniker" != "dydx-1" ] && [ "$moniker" != "dydx-2" ] && [ "$moniker" != "dydx-research" ]; then
denom=$(jq -r '.body.messages[0].value.denom' "$json_file")
amount=$(jq -r '.body.messages[0].value.amount' "$json_file")

if [ "$amount$denom" != "50000000000$stake_token" ]; then
echo "Expected 50000000000$stake_token delegated tokens, but got $amount$denom"
exit 1
fi

echo "Adding genesis for $delegator_address"
dydxprotocold add-genesis-account "$delegator_address" 100000000000$stake_token
fi
done
}

dydxprotocold init --chain-id=dydx-mainnet-1 dydx-1
cp $dir_path/$genesis_file ~/.dydxprotocol/config/genesis.json

if [ "$add_gentxs" = "true" ]; then
echo "Adding gentxs to pregenesis..."
add_genesis_account $dir_path/gentx

mkdir ~/.dydxprotocol/config/gentx
cp $dir_path/gentx/* ~/.dydxprotocol/config/gentx

Expand Down

0 comments on commit 2a1cd1d

Please sign in to comment.