From 1c3779f77eb5031b93f5e93475652f40aea83c6a Mon Sep 17 00:00:00 2001 From: Core Dev Date: Mon, 29 Jun 2026 15:42:06 +0800 Subject: [PATCH 1/2] bumped wasmd and wasvm versions --- app/config/const.go | 1 + app/upgrade_handler.go | 9 + app/upgrades/v2.20/upgrade.go | 20 ++ go.mod | 6 +- go.sum | 12 +- integration-tests/package.json | 1 + .../chain-upgrade/upgrade-simulation-20.sh | 218 ++++++++++++++++++ 7 files changed, 258 insertions(+), 9 deletions(-) create mode 100644 app/upgrades/v2.20/upgrade.go create mode 100755 integration-tests/src/setup/chain-upgrade/upgrade-simulation-20.sh diff --git a/app/config/const.go b/app/config/const.go index 07476380..0714094c 100644 --- a/app/config/const.go +++ b/app/config/const.go @@ -229,4 +229,5 @@ const ( Upgrade2_17 = "v2.17" Upgrade2_18 = "v2.18" Upgrade2_19 = "v2.19" + Upgrade2_20 = "v2.20" ) diff --git a/app/upgrade_handler.go b/app/upgrade_handler.go index 15a5981b..68dfc9d9 100644 --- a/app/upgrade_handler.go +++ b/app/upgrade_handler.go @@ -17,6 +17,7 @@ import ( v2_18 "github.com/terra-money/core/v2/app/upgrades/v2.18" v2_19 "github.com/terra-money/core/v2/app/upgrades/v2.19" v2_2_0 "github.com/terra-money/core/v2/app/upgrades/v2.2.0" + v2_20 "github.com/terra-money/core/v2/app/upgrades/v2.20" v2_3_0 "github.com/terra-money/core/v2/app/upgrades/v2.3.0" v2_4 "github.com/terra-money/core/v2/app/upgrades/v2.4" v2_5 "github.com/terra-money/core/v2/app/upgrades/v2.5" @@ -183,6 +184,14 @@ func (app *TerraApp) RegisterUpgradeHandlers() { app.Keepers, ), ) + app.Keepers.UpgradeKeeper.SetUpgradeHandler( + terraappconfig.Upgrade2_20, + v2_20.CreateUpgradeHandler( + app.GetModuleManager(), + app.GetConfigurator(), + app.Keepers, + ), + ) } func (app *TerraApp) RegisterUpgradeStores() { diff --git a/app/upgrades/v2.20/upgrade.go b/app/upgrades/v2.20/upgrade.go new file mode 100644 index 00000000..f8059541 --- /dev/null +++ b/app/upgrades/v2.20/upgrade.go @@ -0,0 +1,20 @@ +package v2_20 + +import ( + "context" + + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/terra-money/core/v2/app/keepers" +) + +func CreateUpgradeHandler( + mm *module.Manager, + cfg module.Configurator, + k keepers.TerraAppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, cfg, vm) + } +} diff --git a/go.mod b/go.mod index a43253be..daa0c64c 100644 --- a/go.mod +++ b/go.mod @@ -18,8 +18,8 @@ require ( cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.13.8 cosmossdk.io/x/upgrade v0.1.4 - github.com/CosmWasm/wasmd v0.54.3 - github.com/CosmWasm/wasmvm/v2 v2.2.4 + github.com/CosmWasm/wasmd v0.54.8 + github.com/CosmWasm/wasmvm/v2 v2.2.7 github.com/cometbft/cometbft v0.38.21 github.com/cometbft/cometbft-db v0.14.1 // indirect github.com/cosmos/btcutil v1.0.5 @@ -33,7 +33,7 @@ require ( github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241122170711-64c5cd5a9fb9 github.com/cosmos/ibc-go/modules/capability v1.0.1 - github.com/cosmos/ibc-go/v8 v8.5.2 + github.com/cosmos/ibc-go/v8 v8.8.0 github.com/cosmos/ledger-cosmos-go v0.14.0 // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 diff --git a/go.sum b/go.sum index b396da07..b3a65427 100644 --- a/go.sum +++ b/go.sum @@ -237,10 +237,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25 github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CosmWasm/wasmd v0.54.3 h1:Lnbshr2O4edRpdyBmubDOL13mgtKm+JaTxM7Nfvymxk= -github.com/CosmWasm/wasmd v0.54.3/go.mod h1:2FX9+3mf0FmlRHUoUwF8Vg/kkNdtey9TogE5N6nX4Ng= -github.com/CosmWasm/wasmvm/v2 v2.2.4 h1:V3UwXJMA8TNOuQETppDQkaXAevF7gOWLYpKvrThPv7o= -github.com/CosmWasm/wasmvm/v2 v2.2.4/go.mod h1:Aj/rB2KMRM8nAdbWxkO23rnQYb5KsoPuH9ZizSi0sVg= +github.com/CosmWasm/wasmd v0.54.8 h1:B9zKMnnM86f/7XFA6a26Gu976fn5lNt6BqAi+mQKwCU= +github.com/CosmWasm/wasmd v0.54.8/go.mod h1:jc6MmoaD7V26+gxVa3RuUafRQGH7kLFecaVMyxEqzNU= +github.com/CosmWasm/wasmvm/v2 v2.2.7 h1:JkDPvwYJl3hlmTdibxlu5ZN7tXFE/6QaKAFspPZa12A= +github.com/CosmWasm/wasmvm/v2 v2.2.7/go.mod h1:Aj/rB2KMRM8nAdbWxkO23rnQYb5KsoPuH9ZizSi0sVg= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= @@ -445,8 +445,8 @@ github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241122170711-64c5cd5a9f github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241122170711-64c5cd5a9fb9/go.mod h1:9+Z14xz3Y+5uEn5i1CvLcDN1aTthEhYUdI7pphySkY8= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= -github.com/cosmos/ibc-go/v8 v8.5.2 h1:27s9oeD2AxLQF3e9BQsYt9doONyZ7FwZi/qkBv6Sdks= -github.com/cosmos/ibc-go/v8 v8.5.2/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo= +github.com/cosmos/ibc-go/v8 v8.8.0 h1:Xn4/Xzt7JZihKRRSe8xJ65zG7PwrSnIWYRoQDK9hhME= +github.com/cosmos/ibc-go/v8 v8.8.0/go.mod h1:G2z+Q6ZQSMcyHI2+BVcJdvfOupb09M2h/tgpXOEdY6k= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= diff --git a/integration-tests/package.json b/integration-tests/package.json index f987254d..d36e4015 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -15,6 +15,7 @@ "test:chain:upgrade:v17": "bash src/setup/chain-upgrade/upgrade-simulation-17.sh", "test:chain:upgrade:v18": "bash src/setup/chain-upgrade/upgrade-simulation-18.sh", "test:chain:upgrade:v19": "bash src/setup/chain-upgrade/upgrade-simulation-19.sh", + "test:chain:upgrade:v20": "bash src/setup/chain-upgrade/upgrade-simulation-20.sh", "test:start": "jest --runInBand --detectOpenHandles", "start": "npm run test:init && npm run test:relayer && npm run test:start", "test:clean": "rm -rf src/test-data chain-upgrade-data && pkill terrad && pkill terrad && pkill relayer" diff --git a/integration-tests/src/setup/chain-upgrade/upgrade-simulation-20.sh b/integration-tests/src/setup/chain-upgrade/upgrade-simulation-20.sh new file mode 100755 index 00000000..0e3354df --- /dev/null +++ b/integration-tests/src/setup/chain-upgrade/upgrade-simulation-20.sh @@ -0,0 +1,218 @@ +#!/bin/bash + +OLD_VERSION=release/v2.19 +UPGRADE_HEIGHT=30 +CHAIN_ID=test-1 +CHAIN_HOME=$(pwd)/chain-upgrade-data +CONTRACT_PATH=$(pwd)/src/contracts/counter.wasm +DENOM=uluna +SOFTWARE_UPGRADE_NAME="v2.20" +GOV_PERIOD="3s" + +VAL_MNEMONIC_1="clock post desk civil pottery foster expand merit dash seminar song memory figure uniform spice circle try happy obvious trash crime hybrid hood cushion" +VAL_MNEMONIC_2="alley afraid soup fall idea toss can goose become valve initial strong forward bright dish figure check leopard decide warfare hub unusual join cart" +WALLET_MNEMONIC_1="banner spread envelope side kite person disagree path silver will brother under couch edit food venture squirrel civil budget number acquire point work mass" +WALLET_MNEMONIC_2="veteran try aware erosion drink dance decade comic dawn museum release episode original list ability owner size tuition surface ceiling depth seminar capable only" +WALLET_MNEMONIC_3="vacuum burst ordinary enact leaf rabbit gather lend left chase park action dish danger green jeans lucky dish mesh language collect acquire waste load" + +export OLD_BINARY=$CHAIN_HOME/terrad_old +export NEW_BINARY=$CHAIN_HOME/terrad_new + +rm -rf /tmp/terra +rm -r $CHAIN_HOME +mkdir $CHAIN_HOME +killall terrad_old +killall terrad_new + +# install old binary +if ! command -v $OLD_BINARY &> /dev/null +then + mkdir -p /tmp/terra + cd /tmp/terra + git clone https://github.com/terra-money/core + cd core + git checkout $OLD_VERSION + make build + cp /tmp/terra/core/build/terrad $CHAIN_HOME/terrad_old + cd $CHAIN_HOME +fi + +# install new binary +if ! command -v $NEW_BINARY &> /dev/null +then + cd ../.. + make build + cp build/terrad $NEW_BINARY +fi + +# init genesis +$OLD_BINARY init test --home $CHAIN_HOME --chain-id=$CHAIN_ID +echo $VAL_MNEMONIC_1 | $OLD_BINARY keys add val1 --home $CHAIN_HOME --recover --keyring-backend=test +VAL_ADDR_1=$($OLD_BINARY keys show val1 --home $CHAIN_HOME --keyring-backend=test --output=json | jq .address -r) + +echo $WALLET_MNEMONIC_1 | $OLD_BINARY keys add wallet1 --home $CHAIN_HOME --recover --keyring-backend=test +WALLET_ADDR_1=$($OLD_BINARY keys show wallet1 --home $CHAIN_HOME --keyring-backend=test --output=json | jq .address -r) + +echo $WALLET_MNEMONIC_2 | $OLD_BINARY keys add wallet2 --home $CHAIN_HOME --recover --keyring-backend=test +WALLET_ADDR_2=$($OLD_BINARY keys show wallet2 --home $CHAIN_HOME --keyring-backend=test --output=json | jq .address -r) + +echo $WALLET_MNEMONIC_3 | $OLD_BINARY keys add wallet3 --home $CHAIN_HOME --recover --keyring-backend=test +WALLET_ADDR_3=$($OLD_BINARY keys show wallet3 --home $CHAIN_HOME --keyring-backend=test --output=json | jq .address -r) + +$OLD_BINARY genesis add-genesis-account $($OLD_BINARY --home $CHAIN_HOME keys show val1 --keyring-backend test -a) 100000000000uluna --home $CHAIN_HOME + +CURRENT_TIME=$(date +%s) +echo "Current time: $CURRENT_TIME" +$OLD_BINARY genesis add-genesis-account $($OLD_BINARY --home $CHAIN_HOME keys show wallet1 --keyring-backend test -a) 100000000000uluna --vesting-amount 200000000uluna --vesting-start-time $CURRENT_TIME --vesting-end-time $(($CURRENT_TIME + 10000)) --home $CHAIN_HOME + +$OLD_BINARY genesis gentx val1 1000000000uluna --home $CHAIN_HOME --chain-id $CHAIN_ID --keyring-backend test --commission-max-rate 0.01 --commission-rate 0.01 --commission-max-change-rate 0.01 +$OLD_BINARY genesis collect-gentxs --home $CHAIN_HOME + +sed -i -e "s/\"max_deposit_period\": \"172800s\"/\"max_deposit_period\": \"$GOV_PERIOD\"/g" $CHAIN_HOME/config/genesis.json +sed -i -e "s/\"voting_period\": \"172800s\"/\"voting_period\": \"$GOV_PERIOD\"/g" $CHAIN_HOME/config/genesis.json + +sed -i -e 's/timeout_commit = "5s"/timeout_commit = "1s"/g' $CHAIN_HOME/config/config.toml +sed -i -e 's/timeout_propose = "3s"/timeout_propose = "1s"/g' $CHAIN_HOME/config/config.toml +sed -i -e 's/index_all_keys = false/index_all_keys = true/g' $CHAIN_HOME/config/config.toml +sed -i -e 's/enable = false/enable = true/g' $CHAIN_HOME/config/app.toml +sed -i -e 's/swagger = false/swagger = true/g' $CHAIN_HOME/config/app.toml + +# run old node +echo "Starting old binary on a separate process" +if [[ "$OSTYPE" == "darwin"* ]]; then + screen -L -dmS node1 $OLD_BINARY start --log_level trace --log_format json --home $CHAIN_HOME --pruning=nothing +else + screen -L -Logfile $CHAIN_HOME/log-screen.log -dmS node1 $OLD_BINARY start --log_level trace --log_format json --home $CHAIN_HOME --pruning=nothing +fi + +sleep 5 + +VALOPER_ADDR_1=$($OLD_BINARY q staking validators --output=json --home $CHAIN_HOME | jq .validators[0].operator_address -r) + +echo "Create new periodic vesting account $WALLET_ADDR_2" +echo '{ + "start_time": '$(date +%s)', + "periods":[ + { + "coins": "10000000uluna", + "length_seconds": 10000 + }, + { + "coins": "10000000uluna", + "length_seconds": 10000 + } + ] +}' > $CHAIN_HOME/create-periodic-vesting-account.json +NO_ECHO=$($OLD_BINARY tx vesting create-periodic-vesting-account $WALLET_ADDR_2 $CHAIN_HOME/create-periodic-vesting-account.json --from val1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME -y -o json) +sleep 1 +NO_ECHO=$($OLD_BINARY tx vesting create-periodic-vesting-account $WALLET_ADDR_3 $CHAIN_HOME/create-periodic-vesting-account.json --from val1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME -y -o json) +sleep 1 + +GOV_ADDRESS=$($OLD_BINARY query auth module-account gov --home $CHAIN_HOME --output json | jq .account.base_account.address -r) +echo '{ + "messages": [ + { + "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + "authority" : "'"$GOV_ADDRESS"'", + "plan" : { + "name": "'"$SOFTWARE_UPGRADE_NAME"'", + "time": "0001-01-01T00:00:00Z", + "height": "'"$UPGRADE_HEIGHT"'", + "upgraded_client_state": null + } + } + ], + "metadata": "", + "deposit": "550000000'$DENOM'", + "title": "Upgrade to '$SOFTWARE_UPGRADE_NAME'", + "summary": "Source Code Version https://github.com/terra-money/core" +}' > $CHAIN_HOME/software-upgrade.json + +echo "Submit proposal" +NO_ECHO=$($OLD_BINARY tx gov submit-proposal $CHAIN_HOME/software-upgrade.json --from val1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME -y) +sleep 2 +echo "Vote" +NO_ECHO=$($OLD_BINARY tx gov vote 1 yes --from val1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME -y) + +## determine block_height to halt +while true; do + BLOCK_HEIGHT=$($OLD_BINARY status --home $CHAIN_HOME | jq '.SyncInfo.latest_block_height' -r) + if [ $BLOCK_HEIGHT = "$UPGRADE_HEIGHT" ]; then + # assuming running only 1 terrad + echo "BLOCK HEIGHT = $UPGRADE_HEIGHT REACHED, STOPPING OLD BINARY" + pkill terrad_old + break + else + STATUS=$($OLD_BINARY query gov proposal 1 --output=json --home $CHAIN_HOME | jq ".status" -r) + echo "BLOCK_HEIGHT = $BLOCK_HEIGHT $STATUS" + sleep 1 + fi +done +sleep 1 + +# run new binary +echo "Starting new binary" +if [[ "$OSTYPE" == "darwin"* ]]; then + screen -L -dmS node1 $NEW_BINARY start --log_level trace --log_format json --home $CHAIN_HOME --pruning=nothing +else + screen -L -Logfile $CHAIN_HOME/log-screen.log -dmS node1 $NEW_BINARY start --log_level trace --log_format json --home $CHAIN_HOME --pruning=nothing +fi +sleep 15 + +echo "Upgrade successful" + +# get new block height +NEW_BLOCK_HEIGHT=$($NEW_BINARY status --home $CHAIN_HOME | jq '.sync_info.latest_block_height' -r) +echo "NEW_BLOCK_HEIGHT $NEW_BLOCK_HEIGHT" + +# assert that the new block height is greater than the upgrade height +if [ $NEW_BLOCK_HEIGHT -le $UPGRADE_HEIGHT ]; then + echo "New block height is less than or equal to the upgrade height" + exit 1 +fi + + +echo "Performing some sanity checks" + +# Create a new token +echo "Create a new token" +NO_ECHO=$($NEW_BINARY tx tokenfactory create-denom test --from wallet1 --keyring-backend test --gas auto --gas-adjustment 1.5 --home $CHAIN_HOME --chain-id $CHAIN_ID -y) +sleep 1 +TOKEN_DENOM=$($NEW_BINARY query tokenfactory denoms-from-creator $WALLET_ADDR_1 --home $CHAIN_HOME --output=json | jq .denoms[0] -r) +echo "TOKEN_DENOM $TOKEN_DENOM" +echo "Mint token" +NO_ECHO=$($NEW_BINARY tx tokenfactory mint 1000000000$TOKEN_DENOM --from wallet1 --keyring-backend test --gas auto --gas-adjustment 1.5 --home $CHAIN_HOME --chain-id $CHAIN_ID -y) +sleep 1 + +# Upload a contract +echo "Upload a contract" +# NO_ECHO=$($OLD_BINARY tx wasm store $CONTRACT_PATH --from wallet1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME -y) +NO_ECHO=$($NEW_BINARY tx wasm store $CONTRACT_PATH --from wallet1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME --gas auto --gas-adjustment 1.5 -y) +sleep 1 + +# Instantiate a contract +echo "Instantiate a contract" +NO_ECHO=$($NEW_BINARY tx wasm instantiate 1 '{"count":0}' --amount 100000000$TOKEN_DENOM --from wallet1 --keyring-backend test --chain-id $CHAIN_ID --home $CHAIN_HOME --label "counter" --no-admin -y) +sleep 1 +CONTRACT_ADDRESS=$($NEW_BINARY query wasm list-contract-by-code 1 --output=json --home $CHAIN_HOME | jq .contracts[0] -r) +echo "CONTRACT_ADDRESS $CONTRACT_ADDRESS" +CONTRACT_BALANCE=$($NEW_BINARY query bank balances $CONTRACT_ADDRESS --home $CHAIN_HOME --output=json | jq ".balances[0].amount") +if [[ "$CONTRACT_BALANCE" == "100000000" ]]; then + echo "Contract balance is less than 100000000" + exit 1 +fi + +# Check period vesting account +echo "Check period vesting account" +PERIOD_VESTING_BALANCE_1=$($NEW_BINARY query bank spendable-balances $WALLET_ADDR_2 --home $CHAIN_HOME --output=json | jq ".balances[0].amount") +echo "PERIOD_VESTING_BALANCE_1 $PERIOD_VESTING_BALANCE_1" +sleep 5 +PERIOD_VESTING_BALANCE_2=$($NEW_BINARY query bank spendable-balances $WALLET_ADDR_2 --home $CHAIN_HOME --output=json | jq ".balances[0].amount") +echo "PERIOD_VESTING_BALANCE_2 $PERIOD_VESTING_BALANCE_2" +if (( ${PERIOD_VESTING_BALANCE_2//\"} <= ${PERIOD_VESTING_BALANCE_1//\"} )); then + echo "Period vesting account balance must be updated every block" + exit 1 +fi + +# kill screen +screen -X -S node1 quit From 529a8e6f23ea874591449742e1931319f687c211 Mon Sep 17 00:00:00 2001 From: Core Dev Date: Wed, 1 Jul 2026 21:59:44 +0800 Subject: [PATCH 2/2] bump wasmd to 0.54.9 --- go.mod | 4 +- go.sum | 8 +- integration-tests/src/helpers/index.ts | 13 +- .../src/modules/ica/icav1.test.ts | 66 ++-- .../modules/tokenfactory/tokenfactory.test.ts | 362 ++---------------- 5 files changed, 83 insertions(+), 370 deletions(-) diff --git a/go.mod b/go.mod index daa0c64c..94c56aa6 100644 --- a/go.mod +++ b/go.mod @@ -18,8 +18,8 @@ require ( cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.13.8 cosmossdk.io/x/upgrade v0.1.4 - github.com/CosmWasm/wasmd v0.54.8 - github.com/CosmWasm/wasmvm/v2 v2.2.7 + github.com/CosmWasm/wasmd v0.54.9 + github.com/CosmWasm/wasmvm/v2 v2.2.8 github.com/cometbft/cometbft v0.38.21 github.com/cometbft/cometbft-db v0.14.1 // indirect github.com/cosmos/btcutil v1.0.5 diff --git a/go.sum b/go.sum index b3a65427..74536c47 100644 --- a/go.sum +++ b/go.sum @@ -237,10 +237,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25 github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CosmWasm/wasmd v0.54.8 h1:B9zKMnnM86f/7XFA6a26Gu976fn5lNt6BqAi+mQKwCU= -github.com/CosmWasm/wasmd v0.54.8/go.mod h1:jc6MmoaD7V26+gxVa3RuUafRQGH7kLFecaVMyxEqzNU= -github.com/CosmWasm/wasmvm/v2 v2.2.7 h1:JkDPvwYJl3hlmTdibxlu5ZN7tXFE/6QaKAFspPZa12A= -github.com/CosmWasm/wasmvm/v2 v2.2.7/go.mod h1:Aj/rB2KMRM8nAdbWxkO23rnQYb5KsoPuH9ZizSi0sVg= +github.com/CosmWasm/wasmd v0.54.9 h1:rca0ee3o6rLaoTt07Z4bKq6toYl/5nWHWEdO1tUmSqo= +github.com/CosmWasm/wasmd v0.54.9/go.mod h1:4uTpkoUHtKJtNyjqKCiASR1eslzjpNJqlgIzFuuPdmU= +github.com/CosmWasm/wasmvm/v2 v2.2.8 h1:7RqbEOTntOba8WjaWpQY5zU9xyyCVDKq0i4RSRa+M6M= +github.com/CosmWasm/wasmvm/v2 v2.2.8/go.mod h1:Aj/rB2KMRM8nAdbWxkO23rnQYb5KsoPuH9ZizSi0sVg= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= diff --git a/integration-tests/src/helpers/index.ts b/integration-tests/src/helpers/index.ts index 7a30d6e3..4cc30cf3 100644 --- a/integration-tests/src/helpers/index.ts +++ b/integration-tests/src/helpers/index.ts @@ -19,13 +19,20 @@ export { } export const getValueByIndexAndTypeAndKey = (events: any[], index: number, type: string, key: string) => { - const matchedEvents = events.filter((event: any) => event.type === type && event.attributes.find((attr: any) => attr.key === "msg_index").value === index.toString()); + const matchedEvents = events.filter((event: any) => + event.type === type && + event.attributes.find((attr: any) => attr.key === "msg_index")?.value === index.toString() + ); if (matchedEvents.length === 0) { throw new Error(`No event found with type ${type} and key ${key}`); } - return matchedEvents[0].attributes.find((attr: any) => attr.key === key).value; + const matchedAttribute = matchedEvents[0].attributes.find((attr: any) => attr.key === key); + if (matchedAttribute === undefined) { + throw new Error(`No attribute found with type ${type} and key ${key}`); + } + return matchedAttribute.value; } export const getEventsByIndex = (events: any[], index: number) => { return events.filter((event: any) => event.attributes.find((attr: any) => attr.key === "msg_index" && attr.value === index.toString())); -} \ No newline at end of file +} diff --git a/integration-tests/src/modules/ica/icav1.test.ts b/integration-tests/src/modules/ica/icav1.test.ts index 3583716d..b5187316 100644 --- a/integration-tests/src/modules/ica/icav1.test.ts +++ b/integration-tests/src/modules/ica/icav1.test.ts @@ -1,5 +1,5 @@ import { AccAddress, Coin, MsgTransfer, MsgSend, Coins } from "@terra-money/feather.js"; -import { blockInclusion, getEventsByIndex, getLCDClient, getMnemonics } from "../../helpers"; +import { blockInclusion, getEventsByIndex, getLCDClient, getMnemonics, getValueByIndexAndTypeAndKey } from "../../helpers"; import { MsgRegisterInterchainAccount, MsgSendTx } from "@terra-money/feather.js/dist/core/ica/controller/v1/msgs"; import { Height } from "@terra-money/feather.js/dist/core/ibc/core/client/Height"; import Long from "long"; @@ -15,6 +15,22 @@ describe("ICA Module (https://github.com/cosmos/ibc-go/tree/release/v7.3.x/modul let ibcCoinDenom: string | undefined; let intechainAccountAddr: AccAddress | undefined; + const waitForInterchainAccount = async () => { + for (let i = 0; i <= 10; i++) { + await blockInclusion(); + const res = await LCD.chain1.icaV1.controllerAccountAddress(externalAccAddr, "connection-0") + .catch((e) => { + const expectMsg = "failed to retrieve account address for icacontroller-"; + expect(e.response.data.message.startsWith(expectMsg)).toBeTruthy(); + }); + if (res) { + expect(res.address).toBeDefined(); + intechainAccountAddr = res.address; + return; + } + } + } + test('Must contain the expected module params', async () => { // Query ica host module params const hostResParams = await LCD.chain2.icaV1.hostParams("test-2"); @@ -104,44 +120,17 @@ describe("ICA Module (https://github.com/cosmos/ibc-go/tree/release/v7.3.x/modul let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - let events = txResult.logs[0].events; - - expect(events[0]) - .toStrictEqual({ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount" - }, { - "key": "sender", - "value": "terra1p4kcrttuxj9kyyvv5px5ccgwf0yrw74yp7jqm6" - }] - }); - expect(events[2]) - .toStrictEqual({ - "type": "message", - "attributes": [{ - "key": "module", - "value": "ibc_channel" - }] - }) - - // Check during 5 blocks for the receival - // of the IBC coin on chain-2 - for (let i = 0; i <= 5; i++) { - await blockInclusion(); - let res = await LCD.chain1.icaV1.controllerAccountAddress(externalAccAddr, "connection-0") - .catch((e) => { - const expectMsg = "failed to retrieve account address for icacontroller-"; - expect(e.response.data.message.startsWith(expectMsg)).toBeTruthy(); - }) - if (res) { - expect(res.address).toBeDefined(); - intechainAccountAddr = res.address; - break; - } - } + expect(txResult.code).toBe(0); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")) + .toBe("/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")) + .toBe(externalAccAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "module")) + .toBe("ibc_channel"); } + + await waitForInterchainAccount(); + expect(intechainAccountAddr).toBeDefined(); }); describe('After assuring the interchain account exists', () => { @@ -209,7 +198,6 @@ describe("ICA Module (https://github.com/cosmos/ibc-go/tree/release/v7.3.x/modul await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; const events = getEventsByIndex(txResult.events, 0); - console.log(JSON.stringify(events, null, 2)); expect(events[0]) .toStrictEqual({ "type": "message", diff --git a/integration-tests/src/modules/tokenfactory/tokenfactory.test.ts b/integration-tests/src/modules/tokenfactory/tokenfactory.test.ts index 62083789..b24438eb 100644 --- a/integration-tests/src/modules/tokenfactory/tokenfactory.test.ts +++ b/integration-tests/src/modules/tokenfactory/tokenfactory.test.ts @@ -1,5 +1,5 @@ import { Coin, Coins, Fee, MnemonicKey, MsgBurn, MsgChangeAdmin, MsgCreateDenom, MsgInstantiateContract, MsgMint, MsgStoreCode, MsgSetBeforeSendHook, MsgSend, MsgSubmitProposal, MsgUpdateParamsTokenFactory, MsgVote } from "@terra-money/feather.js"; -import { getMnemonics, getLCDClient, blockInclusion, votingPeriod } from "../../helpers"; +import { getMnemonics, getLCDClient, blockInclusion, votingPeriod, getValueByIndexAndTypeAndKey } from "../../helpers"; import fs from "fs"; import path from 'path'; import { VoteOption } from "../../../../../terra.proto/js/cosmos/gov/v1/gov"; @@ -35,7 +35,7 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - codeId = Number(txResult.logs[0].events[1].attributes[1].value); + codeId = Number(getValueByIndexAndTypeAndKey(txResult.events, 0, "store_code", "code_id")); expect(codeId).toBeDefined(); const msgInstantiateContract = new MsgInstantiateContract( @@ -54,7 +54,7 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - contractAddress = txResult.logs[0].events[4].attributes[0].value; + contractAddress = getValueByIndexAndTypeAndKey(txResult.events, 0, "instantiate", "_contract_address"); expect(contractAddress).toBeDefined(); }) @@ -92,65 +92,12 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - factoryDenom = txResult.logs[0].eventsByType.create_denom.new_token_denom[0] as string - expect(txResult.logs[0].events).toStrictEqual([{ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/osmosis.tokenfactory.v1beta1.MsgCreateDenom" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "module", - "value": "tokenfactory" - }] - }, { - "type": "coin_spent", - "attributes": [{ - "key": "spender", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "10000000uluna" - }] - }, { - "type": "coin_received", - "attributes": [{ - "key": "receiver", - "value": "terra1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8pm7utl" - }, { - "key": "amount", - "value": "10000000uluna" - }] - }, { - "type": "transfer", - "attributes": [{ - "key": "recipient", - "value": "terra1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8pm7utl" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "10000000uluna" - }] - }, { - "type": "message", - "attributes": [{ - "key": "sender", - "value": tokenFactoryWalletAddr - }] - }, { - "type": "create_denom", - "attributes": [{ - "key": "creator", - "value": tokenFactoryWalletAddr - }, { - "key": "new_token_denom", - "value": factoryDenom - }] - }]); + expect(txResult.code).toBe(0); + factoryDenom = getValueByIndexAndTypeAndKey(txResult.events, 0, "create_denom", "new_token_denom") as string; + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")).toBe("/osmosis.tokenfactory.v1beta1.MsgCreateDenom"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "create_denom", "creator")).toBe(tokenFactoryWalletAddr); + expect(factoryDenom).toBe(`factory/${tokenFactoryWalletAddr}/${subdenom}`); }) // Mint tokens to the minter address @@ -169,89 +116,11 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - expect(txResult.logs[0].events).toStrictEqual([{ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/osmosis.tokenfactory.v1beta1.MsgMint" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "module", - "value": "tokenfactory" - }] - }, - { - "type": "coin_received", - "attributes": [{ - "key": "receiver", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "1000000000" + factoryDenom - }] - }, - { - "type": "coinbase", - "attributes": [{ - "key": "minter", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "1000000000" + factoryDenom - }] - }, - { - "type": "coin_spent", - "attributes": [{ - "key": "spender", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "1000000000" + factoryDenom - }] - }, - { - "type": "coin_received", - "attributes": [{ - "key": "receiver", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "1000000000" + factoryDenom - }] - }, - { - "type": "transfer", - "attributes": [{ - "key": "recipient", - "value": tokenFactoryWalletAddr - }, { - "key": "sender", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "1000000000" + factoryDenom - }] - }, - { - "type": "message", - "attributes": [{ - "key": "sender", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }] - }, - { - "type": "tf_mint", - "attributes": [{ - "key": "mint_to_address", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "1000000000" + factoryDenom - }] - }]); + expect(txResult.code).toBe(0); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")).toBe("/osmosis.tokenfactory.v1beta1.MsgMint"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "tf_mint", "mint_to_address")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "tf_mint", "amount")).toBe("1000000000" + factoryDenom); }); }) @@ -267,88 +136,16 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ ), ], chainID: "test-1", - fee: new Fee(100_000, new Coins({ uluna: 100_000 })), + fee: new Fee(2000_000, new Coins({ uluna: 100_000 })), }); let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - expect(txResult.logs[0].events).toStrictEqual([{ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/osmosis.tokenfactory.v1beta1.MsgBurn" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "module", - "value": "tokenfactory" - }] - }, { - "type": "coin_spent", - "attributes": [{ - "key": "spender", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "500000000" + factoryDenom - }] - }, { - "type": "coin_received", - "attributes": [{ - "key": "receiver", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "500000000" + factoryDenom - }] - }, { - "type": "transfer", - "attributes": [{ - "key": "recipient", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "500000000" + factoryDenom - }] - }, { - "type": "message", - "attributes": [{ - "key": "sender", - "value": tokenFactoryWalletAddr - } - ] - }, { - "type": "coin_spent", - "attributes": [{ - "key": "spender", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "500000000" + factoryDenom - }] - }, { - "type": "burn", - "attributes": [{ - "key": "burner", - "value": "terra19ejy8n9qsectrf4semdp9cpknflld0j6my8d0p" - }, { - "key": "amount", - "value": "500000000" + factoryDenom - }] - }, { - "type": "tf_burn", - "attributes": [{ - "key": "burn_from_address", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "500000000" + factoryDenom - }] - }]) + expect(txResult.code).toBe(0); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")).toBe("/osmosis.tokenfactory.v1beta1.MsgBurn"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "tf_burn", "burn_from_address")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "tf_burn", "amount")).toBe("500000000" + factoryDenom); }); }) @@ -386,7 +183,7 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ expect(txResult.code).toBe(0); // Get the proposal id and validate exists - let proposalId = Number(txResult.logs[0].eventsByType.submit_proposal.proposal_id[0]); + let proposalId = Number(getValueByIndexAndTypeAndKey(txResult.events, 0, "submit_proposal", "proposal_id")); expect(proposalId) // Vote for the proposal @@ -435,28 +232,11 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - expect(txResult.logs[0].events).toStrictEqual([{ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "module", - "value": "tokenfactory" - }] - }, { - "type": "set_before_send_hook", - "attributes": [{ - "key": "denom", - "value": factoryDenom - }, { - "key": "before_send_hook_address", - "value": contractAddress - }] - }]); + expect(txResult.code).toBe(0); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")).toBe("/osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "set_before_send_hook", "denom")).toBe(factoryDenom); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "set_before_send_hook", "before_send_hook_address")).toBe(contractAddress); }); }); @@ -480,56 +260,12 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - expect(txResult.logs[0].events) - .toStrictEqual([{ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/cosmos.bank.v1beta1.MsgSend" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "module", - "value": "bank" - }] - }, { - "type": "coin_spent", - "attributes": [{ - "key": "spender", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "1" + factoryDenom - }] - }, { - "type": "coin_received", - "attributes": [{ - "key": "receiver", - "value": randomAccountAddr - }, { - "key": "amount", - "value": "1" + factoryDenom - }] - }, { - "type": "transfer", - "attributes": [{ - "key": "recipient", - "value": randomAccountAddr - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "amount", - "value": "1" + factoryDenom - }] - }, { - "type": "message", - "attributes": [{ - "key": "sender", - "value": tokenFactoryWalletAddr - }] - }]); + expect(txResult.code).toBe(0); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")).toBe("/cosmos.bank.v1beta1.MsgSend"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "transfer", "recipient")).toBe(randomAccountAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "transfer", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "transfer", "amount")).toBe("1" + factoryDenom); }); test("100 token blocked by the smart contract before send", async () => { @@ -609,29 +345,11 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ let result = await LCD.chain1.tx.broadcastSync(tx, "test-1"); await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - expect(txResult.logs[0].events).toStrictEqual([{ - "type": "message", - "attributes": [{ - "key": "action", - "value": "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin" - }, { - "key": "sender", - "value": tokenFactoryWalletAddr - }, { - "key": "module", - "value": "tokenfactory" - }] - }, - { - "type": "change_admin", - "attributes": [{ - "key": "denom", - "value": factoryDenom - }, { - "key": "new_admin", - "value": randomAccountAddr - }] - }]); + expect(txResult.code).toBe(0); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action")).toBe("/osmosis.tokenfactory.v1beta1.MsgChangeAdmin"); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender")).toBe(tokenFactoryWalletAddr); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "change_admin", "denom")).toBe(factoryDenom); + expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "change_admin", "new_admin")).toBe(randomAccountAddr); }); test("Must query the new admin of the denom", async () => { @@ -672,7 +390,7 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ await blockInclusion(); let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - let customQueryCodeId = Number(txResult.logs[0].events[1].attributes[1].value); + let customQueryCodeId = Number(getValueByIndexAndTypeAndKey(txResult.events, 0, "store_code", "code_id")); expect(customQueryCodeId).toBeDefined(); // Instantiate alliance query contract @@ -691,7 +409,7 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ await blockInclusion(); txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any; - customQueryContractAddress = txResult.logs[0].events[1].attributes[0].value; + customQueryContractAddress = getValueByIndexAndTypeAndKey(txResult.events, 0, "instantiate", "_contract_address"); expect(customQueryContractAddress).toBeDefined(); }) test("Must query token data using contract", async () => { @@ -707,4 +425,4 @@ describe("TokenFactory Module (https://github.com/terra-money/core/tree/release/ }); }) }) -}); \ No newline at end of file +});