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

Feat/migrate wasm 08 #29

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ replace (
github.com/cosmos/cosmos-sdk => github.com/notional-labs/cosmos-sdk v0.50.5-patch-validators-trim-tag

github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 => github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.0-20240508031447-347412725653
github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240515182009-f733fca17f8a
github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240520132306-15e6ed1d5f00
//github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 => github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.0-20240504082418-e4d8c9cb7044
github.com/cosmos/ibc-go/v8 => github.com/notional-labs/ibc-go/v8 v8.0.0-alpha.1.0.20240515181700-c058e14324e8

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1385,8 +1385,8 @@ github.com/notional-labs/cosmos-sdk v0.50.5-patch-validators-trim-tag h1:lnMn2O2
github.com/notional-labs/cosmos-sdk v0.50.5-patch-validators-trim-tag/go.mod h1:oV/k6GJgXV9QPoM2fsYDPPsyPBgQbdotv532O6Mz1OQ=
github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.0-20240508031447-347412725653 h1:P7Chh5O10Jtv+vvfaVpG72fv5LKVWQLEtCKQrMtbBdw=
github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.0-20240508031447-347412725653/go.mod h1:NS+Ooc0vOyr1mAgAbt/HS8Dpes2dV7/YgOc+WxD63O4=
github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240515182009-f733fca17f8a h1:gKpmopVqbasJ7bjCbIh2ZKNJQgnXOYajj6aSclU5eQs=
github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240515182009-f733fca17f8a/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0=
github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240520132306-15e6ed1d5f00 h1:3H//l+PgIoPqLMNq+nbZx9Sebu1LxbSuIBKxwfKcCyU=
github.com/notional-labs/ibc-go/modules/light-clients/08-wasm v0.0.0-20240520132306-15e6ed1d5f00/go.mod h1:u2FXNcSxzzn5IwjWBA51HKMwiYMRK6/G35VmSJULhP0=
github.com/notional-labs/ibc-go/v8 v8.0.0-alpha.1.0.20240515181700-c058e14324e8 h1:RkivXDi3NoRZEjdbO0ueSykCnb7FPaBR0F8sWn5DlFM=
github.com/notional-labs/ibc-go/v8 v8.0.0-alpha.1.0.20240515181700-c058e14324e8/go.mod h1:x024D7fnWnTL6wNeoHbe0+JSjDaoQ3CNvJY8o9F4imE=
github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA=
Expand Down
26 changes: 11 additions & 15 deletions scripts/50/migrate-wasm-code.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ KEY=mykey
DENOM="ppica"
HOME_DIR="mytestnet"
CHAINID="centauri-dev"
BINARY=picad
WASM_CONTRACT_PATH="/Users/kien6034/notional/projects/composable-ibc/target/wasm32-unknown-unknown/release/ics10_grandpa_cw.wasm"
BINARY=_build/new/picad
WASM_CONTRACT_PATH="bin/ics10_grandpa_cw.wasm"

# Create a proposale to store wasm code
$BINARY tx ibc-wasm store-code $WASM_CONTRACT_PATH --title "migrate new contract" --summary "none" --from $KEY --keyring-backend test --home $HOME_DIR --deposit 10000000000${DENOM} --gas 20002152622 --fees 20020166${DENOM} -y

# Fetch proposal id
WASM_CLIENT_ID="08-wasm-0"

HEX_CHECKSUM="3e743bf804a60e5fd1dfab6c61bba0f2e76cda260edc66d6b7b10691fb5096c1"
$BINARY tx ibc-wasm migrate-contract $WASM_CLIENT_ID $HEX_CHECKSUM {} --title "store new wasm code" --summary "none" --from $KEY --keyring-backend test --chain-id $CHAINID --deposit 10000000000${DENOM} --home $HOME_DIR --gas 20002152622 --fees 20020166${DENOM} -y

sleep 6
$BINARY query gov proposals -o json > tmp-proposals.json
PROPOSAL_ID=$(jq -r '.proposals[-1].id' tmp-proposals.json)
# $BINARY query gov proposals -o json > /tmp/proposals.json
PROPOSAL_ID=6
echo "Proposal ID is: $PROPOSAL_ID"
rm -rf tmp-proposals.json

# Validator vote yes
$BINARY tx gov vote $PROPOSAL_ID yes --from $KEY --fees 100000${DENOM} --keyring-backend test --home $HOME_DIR --chain-id $CHAINID -y
Expand All @@ -23,13 +24,8 @@ $BINARY tx gov vote $PROPOSAL_ID yes --from $KEY --fees 100000${DENOM} --keyring
sleep 20

# Check the status
$BINARY query gov proposal $PROPOSAL_ID -o json > tmp-proposal.json
STATUS=$(jq -r '.proposal.status' tmp-proposal.json)
$BINARY query gov proposal $PROPOSAL_ID -o json > /tmp/proposal.json
STATUS=$(jq -r '.proposal.status' /tmp/proposal.json)
echo "Proposal status is: $STATUS"

# Query newly wasm checksums
CHECKSUM=$($BINARY query ibc-wasm checksums -o json | jq -r '.checksums[-1]')



##### Migrate the contract
9 changes: 5 additions & 4 deletions scripts/50/store-wasm-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ WASM_CONTRACT_PATH="$PWD/bin/ics10_grandpa_cw.wasm"
# Wait for chain to start
echo "Waiting for chain to start..."
sleep 10
# Create a proposale to store wasm code
$BINARY tx ibc-wasm store-code $WASM_CONTRACT_PATH --title "store new wasm code" --summary "none" --from $KEY --keyring-backend test --chain-id $CHAINID --home $HOME_DIR --deposit 10000000000${DENOM} --gas 20002152622 --fees 20020166${DENOM} -y

$BINARY tx ibc-wasm store-code $WASM_CONTRACT_PATH --title "store new wasm code" --summary "none" --from $KEY --keyring-backend test --chain-id $CHAINID --home $HOME_DIR --deposit 10000000000${DENOM} --gas 20002152622 --fees 20020166${DENOM} -y

# Fetch proposal id
sleep 6
$BINARY query gov proposals -o json > /tmp/proposals.json
PROPOSAL_ID=$(jq -r '.proposals[-1].id' /tmp/proposals.json)
# $BINARY query gov proposals -o json > /tmp/proposals.json
# PROPOSAL_ID=$(jq -r '.proposals[-1].id' /tmp/proposals.json)
PROPOSAL_ID=3 ## fix this
echo "Proposal ID is: $PROPOSAL_ID"

# Validator vote yes
Expand Down
4 changes: 2 additions & 2 deletions scripts/upgrade/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ sleep 1

# run new node
echo -e "\n\n=> =>continue running nodes after upgrade"
#CONTINUE="true" screen -L -dmS picad bash scripts/localnode.sh _build/new/picad $DENOM
CONTINUE="true" bash scripts/localnode.sh _build/new/picad $DENOM
CONTINUE="true" screen -L -dmS picad bash scripts/localnode.sh _build/new/picad $DENOM
#CONTINUE="true" bash scripts/localnode.sh _build/new/picad $DENOM

Loading