-
Notifications
You must be signed in to change notification settings - Fork 172
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
fix!: v19 not loading in contracts from state #960
Conversation
current test is to start the original v19, upload a contract, execute. Then stop, and start with the new fixed binary to ensure it works issue: new contract seem to work. So flow has to be v18 -> v19 -> this v19 patch to ensure post migration works with the new |
Using the following to reproduce #!/bin/bash
# Run this script to quickly install, setup, and run the current version, upgrade, and run the new version after migration
# sh ~/Desktop/blockchain_scripts/test_v47_upgrade.sh
# run this in the root of your dir
export KEY="juno1"
export CHAINID="local-1"
export MONIKER="localjuno"
export KEYALGO="secp256k1"
export KEYRING="test"
export NODE="tcp://localhost:26657"
export OLDBINARY="junodv18" # git checkout v18.0.0 && make install && cp ~/go/bin/junod ~/go/bin/junodv16
export NEWBINARY="junod" # v19.0.0
export UPGRADE_NAME="v19"
export UPGRADE_HEIGHT="80"
junod config keyring-backend $KEYRING
junod config chain-id $CHAINID
command -v $OLDBINARY > /dev/null 2>&1 || { echo >&2 "junod command not found. Ensure this is setup / properly installed in your GOPATH."; exit 1; }
command -v $NEWBINARY > /dev/null 2>&1 || { echo >&2 "junod command not found. Ensure this is setup / properly installed in your GOPATH."; exit 1; }
command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; }
# Call this in its own terminal window beside the running binary. make sure to capture all the above exported variables as well
doUpgradeSDKv47() {
# upload a contract to test pre and post execution
export JUNOD_NODE="tcp://localhost:26657"
FLAGS="--from $KEY --gas 10000000 --gas-prices 0.0025ujuno --chain-id $CHAINID --keyring-backend $KEYRING --yes"
$OLDBINARY tx wasm store ./contracts/cw_template.wasm $FLAGS
junod tx wasm instantiate 1 '{"count":0}' --label "template" --no-admin $FLAGS
junod tx wasm execute juno14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9skjuwg8 '{"increment":{}}' $FLAGS
$NEWBINARY tx gov submit-legacy-proposal software-upgrade $UPGRADE_NAME --title "upgrading" --description "test upgrade" --deposit 1000000ujuno --upgrade-height $UPGRADE_HEIGHT --from $KEY --keyring-backend $KEYRING --chain-id $CHAINID --yes --broadcast-mode sync --node $NODE --no-validate --upgrade-info='{"binaries":{"linux/amd64":"https://linkhere.com/binary?checksum=sha256:aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f"}}'
$NEWBINARY tx gov vote "1" yes --from $KEY --keyring-backend=$KEYRING --node=$NODE --chain-id=$CHAINID --yes
# Waitm then we will run these after it halts at height
$NEWBINARY start --pruning=default --minimum-gas-prices=0ujuno
}
from_scratch () {
# installs latest in current branch
# make install # we call binaries directly
# remove existing daemon.
rm -rf ~/.juno/*
# juno1efd63aw40lxf3n4mhf7dzhjkr453axurv2zdzk
echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | $OLDBINARY keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover
# juno1hj5fveer5cjtn4wd6wstzugjfdxzl0xps73ftl
echo "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise" | $OLDBINARY keys add feeacc --keyring-backend $KEYRING --algo $KEYALGO --recover
$OLDBINARY init $MONIKER --chain-id $CHAINID
# Function updates the config based on a jq argument as a string
update_test_genesis () {
# update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"'
cat $HOME/.juno/config/genesis.json | jq "$1" > $HOME/.juno/config/tmp_genesis.json && mv $HOME/.juno/config/tmp_genesis.json $HOME/.juno/config/genesis.json
}
# Set gas limit in genesis
update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"'
update_test_genesis '.app_state["gov"]["params"]["voting_period"]="15s"'
update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="ujuno"'
update_test_genesis '.app_state["staking"]["params"]["min_commission_rate"]="0.010000000000000000"'
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="ujuno"'
update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom": "ujuno","amount": "100"}]'
update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom": "ujuno","amount": "1000"}'
# NOTE: since we test v11 -> 12, no TF setting here
# update_test_genesis '.app_state["tokenfactory"]["params"]["denom_creation_fee"]=[{"denom":"ujuno","amount":"100"}]'
# update_test_genesis '.app_state["feeshare"]["params"]["allowed_denoms"]=["ujuno"]'
# Allocate genesis accounts
$OLDBINARY genesis add-genesis-account $KEY 10000000ujuno,1000utest --keyring-backend $KEYRING
$OLDBINARY genesis add-genesis-account feeacc 1000000ujuno,1000utest --keyring-backend $KEYRING
$OLDBINARY genesis gentx $KEY 1000000ujuno --keyring-backend $KEYRING --chain-id $CHAINID
# Collect genesis tx
$OLDBINARY genesis collect-gentxs
# Run this to ensure junorything worked and that the genesis file is setup correctly
$OLDBINARY genesis validate-genesis
}
from_scratch
echo "Starting node..."
# Opens the RPC endpoint to outside connections
sed -i '/laddr = "tcp:\/\/127.0.0.1:26657"/c\laddr = "tcp:\/\/0.0.0.0:26657"' ~/.juno/config/config.toml
sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' ~/.juno/config/config.toml
sed -i 's/enable = false/enable = true/g' ~/.juno/config/app.toml
$OLDBINARY start --pruning=nothing --minimum-gas-prices=0ujuno |
issue: the |
found it, easier patch incoming. Weird wasmd quirk |
Timeline:
InitializePinnedCodes
on both, which resulted in issues since it was double pinning codesmainWasmer, err := wasmvm.NewVM(wasmDir, wasmCapabilities, 32, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize)
&lcWasmer, err := wasmvm.NewVM(lcWasmDir, wasmCapabilities, 32, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize)
in keepers/keepers.gowasmd func request homeDir, but really wants dataDir when using a custom vm!
Also needs a backport to main