From d75fcdf66e3103eed692f27558a6389156a1e719 Mon Sep 17 00:00:00 2001 From: scnale Date: Mon, 29 Jan 2024 18:38:47 -0300 Subject: [PATCH] terra: upgrade scripts (#3753) * terra: updates RPC URL * terra: fixes fee estimation on bytecode upload * terra: fixes `verify` script * terra: updates README commands and instructions * terra: updates governance upgrade generation * terra: adds instructions to submit governance VAA through `worm` --- scripts/contract-upgrade-governance.sh | 4 +- terra/README.md | 26 ++- terra/tools/deploy_single.js | 13 +- terra/tools/package-lock.json | 212 ++++++++++++++++++------- terra/tools/package.json | 2 +- terra/verify | 7 +- 6 files changed, 190 insertions(+), 74 deletions(-) diff --git a/scripts/contract-upgrade-governance.sh b/scripts/contract-upgrade-governance.sh index b19171c23..037a19cc5 100755 --- a/scripts/contract-upgrade-governance.sh +++ b/scripts/contract-upgrade-governance.sh @@ -157,7 +157,7 @@ case "$chain_name" in chain=3 # This is not technically the explorer, but terra finder does not show # information about code ids, so this is the best we can do. - explorer="https://lcd.terra.dev/terra/wasm/v1beta1/codes/" + explorer="https://terra-classic-lcd.publicnode.com/cosmwasm/wasm/v1/code/" ;; bsc) chain=4 @@ -521,7 +521,7 @@ elif [ "$chain_name" = "terra" ]; then \`\`\`shell # $module - wormhole/terra$ ./verify -n mainnet -c $chain_name -w $(terra_artifact) -i $terra_code_id + wormhole/terra$ ./verify -n mainnet $(terra_artifact) $terra_code_id \`\`\` EOF elif [ "$chain_name" = "aptos" ]; then diff --git a/terra/README.md b/terra/README.md index f0ca3db44..5dba658b6 100644 --- a/terra/README.md +++ b/terra/README.md @@ -69,8 +69,16 @@ wormhole/terra $ make deploy/token_bridge ``` For each deployed contract, you will get a code id for that relevant -contract for the deployment, make note of these so you can use them in -the next step for on-chain verification. +contract for the deployment. The code id will be written to a network specific file +that you can read to execute further steps like contract verification. +The deployment prints the name of this file. + +### Instantiation + +The deployment script currently does not instantiate a new live contract but rather only uploads the bytecode. +This is all that is needed to upgrade existing contracts. + +To bootstrap a new instance of the contract you may need to modify the deployment slightly. ## Verify On-Chain @@ -106,20 +114,24 @@ on-chain bytecode with the locally compiled bytecode. ### Mainnet Upgrades on mainnet have to go through governance. Once the code is deployed in -the previous step, an unsigned governance VAA can be generated +the previous step, an unsigned governance VAA can be generated from the root of the repository: ```sh -./generate_governance -m token_bridge -c 59614 > token-bridge-upgrade-59614.prototxt +token_bridge_id=$(cat token_bridge-code-id-mainnet.txt) +./scripts/contract-upgrade-governance.sh --module token_bridge --chain terra --address $token_bridge_id > "token-bridge-upgrade-${token_bridge_id}.prototxt" ``` -This will write to the `token-bridge-upgrade-59614.prototxt` file, which can +Supposing that the token bridge code id is 59614, +this will write to the `token-bridge-upgrade-59614.prototxt` file, which can now be shared with the guardians to vote on. Once the guardians have reached quorum, the VAA may be submitted from any -funded wallet: TODO - make this easier and more unified +funded wallet with `worm` CLI: ``` sh -node main.js terra execute_governance_vaa --rpc "https://lcd.terra.dev" --chain_id "columbus-5" --mnemonic "..." --token_bridge "terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf" +export TERRA_MNEMONIC="..." +# Note that the chain should be inferred from the governance VAA +worm submit --network mainnet --rpc "https://terra-classic-lcd.publicnode.com" ``` ### Testnet diff --git a/terra/tools/deploy_single.js b/terra/tools/deploy_single.js index c461c0f3d..b47bb865a 100644 --- a/terra/tools/deploy_single.js +++ b/terra/tools/deploy_single.js @@ -10,7 +10,7 @@ import axios from "axios"; import yargs from "yargs"; import {hideBin} from "yargs/helpers"; -export const TERRA_GAS_PRICES_URL = "https://fcd.terra.dev/v1/txs/gas_prices"; +export const TERRA_GAS_PRICES_URL = "https://terra-classic-fcd.publicnode.com/v1/txs/gas_prices"; const argv = yargs(hideBin(process.argv)) .option('network', { @@ -38,7 +38,7 @@ const artifact = argv.artifact; const terra_host = argv.network === "mainnet" ? { - URL: "https://lcd.terra.dev", + URL: "https://terra-classic-lcd.publicnode.com", chainID: "columbus-5", name: "mainnet", } @@ -73,7 +73,7 @@ try { mnemonic: argv['private-key'] })) } -await wallet.sequence(); +const sequence = await wallet.sequence(); /* Deploy artifacts */ @@ -87,9 +87,12 @@ const store_code = new MsgStoreCode( ); const feeEstimate = await lcd.tx.estimateFee( - wallet.key.accAddress, - [store_code], + [{ + sequenceNumber: sequence, + publicKey: wallet.key.publicKey + }], { + msgs: [store_code], memo: "", feeDenoms, gasPrices, diff --git a/terra/tools/package-lock.json b/terra/tools/package-lock.json index dad4bb31a..793f57962 100644 --- a/terra/tools/package-lock.json +++ b/terra/tools/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@cosmjs/encoding": "^0.26.2", - "@terra-money/terra.js": "^3.1.3", + "@terra-money/terra.js": "^3.1.10", "dotenv": "^16.0.0", "ethers": "^5.4.4", "yargs": "^17.0.1" @@ -19,6 +19,17 @@ "@types/node": "^20.10.4" } }, + "node_modules/@classic-terra/terra.proto": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@classic-terra/terra.proto/-/terra.proto-1.1.0.tgz", + "integrity": "sha512-bYhQG5LUaGF0KPRY9hYT/HEcd1QExZPQd6zLV/rQkCe/eDxfwFRLzZHpaaAdfWoAAZjsRWqJbUCqCg7gXBbJpw==", + "dependencies": { + "@improbable-eng/grpc-web": "^0.14.1", + "google-protobuf": "^3.17.3", + "long": "^4.0.0", + "protobufjs": "~6.11.2" + } + }, "node_modules/@cosmjs/encoding": { "version": "0.26.6", "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.26.6.tgz", @@ -793,25 +804,14 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, - "node_modules/@terra-money/legacy.proto": { - "name": "@terra-money/terra.proto", - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-0.1.7.tgz", - "integrity": "sha512-NXD7f6pQCulvo6+mv6MAPzhOkUzRjgYVuHZE/apih+lVnPG5hDBU0rRYnOGGofwvKT5/jQoOENnFn/gioWWnyQ==", - "dependencies": { - "google-protobuf": "^3.17.3", - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, "node_modules/@terra-money/terra.js": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.3.tgz", - "integrity": "sha512-80HU5WXrqf3hZTo2GRhIycH17A+SkLD6afbu8MynMDGGD/A861F3zVv6NQ/Z7PWQGHxgddZEK/A0UQ2uK/xfHg==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.10.tgz", + "integrity": "sha512-MqR16LjTUyVD4HnEavP1iBW0c1roCoRHH/E1x9P44pXzgtv2wsMeP+2un4Bnck4Nkv/46Xvy/BSKiY90ll3BKA==", "dependencies": { - "@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7", - "@terra-money/terra.proto": "~2.0.0", - "axios": "^0.26.1", + "@classic-terra/terra.proto": "^1.1.0", + "@terra-money/terra.proto": "^2.1.0", + "axios": "^0.27.2", "bech32": "^2.0.0", "bip32": "^2.0.6", "bip39": "^3.0.3", @@ -822,16 +822,16 @@ "secp256k1": "^4.0.2", "tmp": "^0.2.1", "utf-8-validate": "^5.0.5", - "ws": "^7.5.5" + "ws": "^7.5.9" }, "engines": { "node": ">=14" } }, "node_modules/@terra-money/terra.proto": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-2.0.0.tgz", - "integrity": "sha512-ZjyFOFUzrGn8IwzGIgr1OJFcPSsQoz/XAfoSKThJx+OjJA7CLhdcz51+5h7ehNfb+qB9wr7aNME0h24wu9D4SQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-2.1.0.tgz", + "integrity": "sha512-rhaMslv3Rkr+QsTQEZs64FKA4QlfO0DfQHaR6yct/EovenMkibDEQ63dEL6yJA6LCaEQGYhyVB9JO9pTUA8ybw==", "dependencies": { "@improbable-eng/grpc-web": "^0.14.1", "google-protobuf": "^3.17.3", @@ -879,12 +879,18 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", "dependencies": { - "follow-redirects": "^1.14.8" + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" } }, "node_modules/balanced-match": { @@ -1059,6 +1065,17 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1094,6 +1111,14 @@ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==" }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dotenv": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", @@ -1182,9 +1207,9 @@ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "funding": [ { "type": "individual", @@ -1200,6 +1225,19 @@ } } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1319,6 +1357,25 @@ "safe-buffer": "^5.1.2" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -1693,6 +1750,17 @@ } }, "dependencies": { + "@classic-terra/terra.proto": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@classic-terra/terra.proto/-/terra.proto-1.1.0.tgz", + "integrity": "sha512-bYhQG5LUaGF0KPRY9hYT/HEcd1QExZPQd6zLV/rQkCe/eDxfwFRLzZHpaaAdfWoAAZjsRWqJbUCqCg7gXBbJpw==", + "requires": { + "@improbable-eng/grpc-web": "^0.14.1", + "google-protobuf": "^3.17.3", + "long": "^4.0.0", + "protobufjs": "~6.11.2" + } + }, "@cosmjs/encoding": { "version": "0.26.6", "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.26.6.tgz", @@ -2154,24 +2222,14 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, - "@terra-money/legacy.proto": { - "version": "npm:@terra-money/terra.proto@0.1.7", - "resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-0.1.7.tgz", - "integrity": "sha512-NXD7f6pQCulvo6+mv6MAPzhOkUzRjgYVuHZE/apih+lVnPG5hDBU0rRYnOGGofwvKT5/jQoOENnFn/gioWWnyQ==", - "requires": { - "google-protobuf": "^3.17.3", - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, "@terra-money/terra.js": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.3.tgz", - "integrity": "sha512-80HU5WXrqf3hZTo2GRhIycH17A+SkLD6afbu8MynMDGGD/A861F3zVv6NQ/Z7PWQGHxgddZEK/A0UQ2uK/xfHg==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/@terra-money/terra.js/-/terra.js-3.1.10.tgz", + "integrity": "sha512-MqR16LjTUyVD4HnEavP1iBW0c1roCoRHH/E1x9P44pXzgtv2wsMeP+2un4Bnck4Nkv/46Xvy/BSKiY90ll3BKA==", "requires": { - "@terra-money/legacy.proto": "npm:@terra-money/terra.proto@^0.1.7", - "@terra-money/terra.proto": "~2.0.0", - "axios": "^0.26.1", + "@classic-terra/terra.proto": "^1.1.0", + "@terra-money/terra.proto": "^2.1.0", + "axios": "^0.27.2", "bech32": "^2.0.0", "bip32": "^2.0.6", "bip39": "^3.0.3", @@ -2182,13 +2240,13 @@ "secp256k1": "^4.0.2", "tmp": "^0.2.1", "utf-8-validate": "^5.0.5", - "ws": "^7.5.5" + "ws": "^7.5.9" } }, "@terra-money/terra.proto": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-2.0.0.tgz", - "integrity": "sha512-ZjyFOFUzrGn8IwzGIgr1OJFcPSsQoz/XAfoSKThJx+OjJA7CLhdcz51+5h7ehNfb+qB9wr7aNME0h24wu9D4SQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@terra-money/terra.proto/-/terra.proto-2.1.0.tgz", + "integrity": "sha512-rhaMslv3Rkr+QsTQEZs64FKA4QlfO0DfQHaR6yct/EovenMkibDEQ63dEL6yJA6LCaEQGYhyVB9JO9pTUA8ybw==", "requires": { "@improbable-eng/grpc-web": "^0.14.1", "google-protobuf": "^3.17.3", @@ -2227,12 +2285,18 @@ "color-convert": "^2.0.1" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", "requires": { - "follow-redirects": "^1.14.8" + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" } }, "balanced-match": { @@ -2387,6 +2451,14 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2422,6 +2494,11 @@ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==" }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "dotenv": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", @@ -2494,9 +2571,19 @@ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" }, "follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } }, "fs.realpath": { "version": "1.0.0", @@ -2599,6 +2686,19 @@ "safe-buffer": "^5.1.2" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", diff --git a/terra/tools/package.json b/terra/tools/package.json index bc194c951..0e6ce828a 100644 --- a/terra/tools/package.json +++ b/terra/tools/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@cosmjs/encoding": "^0.26.2", - "@terra-money/terra.js": "^3.1.3", + "@terra-money/terra.js": "^3.1.10", "dotenv": "^16.0.0", "ethers": "^5.4.4", "yargs": "^17.0.1" diff --git a/terra/verify b/terra/verify index 54e0a2a1a..37b84b1c5 100755 --- a/terra/verify +++ b/terra/verify @@ -9,7 +9,7 @@ usage="Usage: -h show this help text -n set the network (mainnet, testnet, devnet. defaults to \$NETWORK if set)" -network=$NETWORK +network=${NETWORK:-""} while getopts ':hn:' option; do case "$option" in h) echo "$usage" @@ -31,7 +31,7 @@ shift $((OPTIND - 1)) case "$network" in - mainnet) url="https://lcd.terra.dev";; + mainnet) url="https://terra-classic-lcd.publicnode.com";; testnet) url="https://bombay-lcd.terra.dev";; devnet) url="http://localhost:1317";; *) printf "Network not set. Specify with -n\n" >&2 @@ -45,7 +45,8 @@ obj_file=$1 code_id=$2 -hash1=`curl "$url"/terra/wasm/v1beta1/codes/"$code_id" --silent | jq '.code_info.code_hash' -r | base64 -d | hexdump -v -e '/1 "%02x" '` +hash1uppercased=`curl "$url"/cosmwasm/wasm/v1/code/"$code_id" --silent | jq '.code_info.data_hash' -r` +hash1=${hash1uppercased,,} hash2=`sha256sum $obj_file | cut -f1 -d' '` echo "Deployed bytecode hash (on $network):"