sdk, terra: Fix tests and add them to CI
The terra tests had bit rotted quite terribly. It seems no one has run them in almost a year because the API changed with the 0.14 release of cosmwasm_vm in April, 2021. Completely remove cosmwasm_vm from dev-dependencies. The tests aren't doing anything that requires interacting with the wasm code and can just test the relevant functions directly. Once this goes in the tests should be running in the CI so hopefully no one will be able to push any more breaking changes. commit-id:537d95e6
This commit is contained in:
parent
3fdd9ccc3e
commit
e907a05b1e
|
@ -95,10 +95,16 @@ jobs:
|
|||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
default: true
|
||||
|
||||
- name: Run `cargo check`
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --workspace --manifest-path ${{ matrix.manifest }}
|
||||
|
||||
- name: Run `cargo test`
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --workspace --manifest-path ${{ matrix.manifest }}
|
||||
|
|
|
@ -20,5 +20,4 @@ wormhole-sdk = { path = "../../../sdk/rust/sdk", features = ["devne
|
|||
wormhole-messenger-common = { path = "../common" }
|
||||
|
||||
[dev-dependencies]
|
||||
cosmwasm-vm = { version = "0.16.0", default-features = false }
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -42,9 +42,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
|
@ -192,18 +192,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.8.0"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e851ca7c24871e7336801608a4797d7376545b6928a10d32d75685687141ead"
|
||||
checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck_derive"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54"
|
||||
checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -218,9 +218,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.72"
|
||||
version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -262,9 +262,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-crypto"
|
||||
version = "0.16.3"
|
||||
version = "0.16.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3703ca1b98c8d890b82c3978f3c5bd47116f8767340dfaa4fd9bdcaa15ebcc64"
|
||||
checksum = "79b110e31d47bd265e17ec88dd7328fcf40e1ee67a6131c1ab492f77fef8cd83"
|
||||
dependencies = [
|
||||
"digest 0.9.0",
|
||||
"ed25519-zebra",
|
||||
|
@ -275,22 +275,23 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-derive"
|
||||
version = "0.16.3"
|
||||
version = "0.16.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c04f4923c080df70b04ff3e0680c92e3b8357f3b125ed65ce4bd4aa1f522c06f"
|
||||
checksum = "0faf9bad5eb0a43a00406e64f8d33407a06bd1826fa976195a69db70e6c18d9d"
|
||||
dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmwasm-std"
|
||||
version = "0.16.3"
|
||||
version = "0.16.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c80dbbb380c23a4f10ae6178dd411ed90c9f9931ddf4932156cc5e5ab78d1c19"
|
||||
checksum = "4a0d4e46ab20939af6366a71783324ae4babdedb111f0dd797d063a2e68718bc"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"cosmwasm-crypto",
|
||||
"cosmwasm-derive",
|
||||
"forward_ref",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde-json-wasm",
|
||||
|
@ -300,9 +301,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-storage"
|
||||
version = "0.16.3"
|
||||
version = "0.16.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b4cc64cb7104bcf64e935e074aa291466d7c714374f5ec5e3fd8e9d3f0e5ce5"
|
||||
checksum = "c243d26ba6c49abb5ed69762648a9c664ba263debce425ad10603e7b8aa92ced"
|
||||
dependencies = [
|
||||
"cosmwasm-std",
|
||||
"serde",
|
||||
|
@ -310,9 +311,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
|
||||
checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -505,9 +506,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.4"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf"
|
||||
checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28"
|
||||
|
||||
[[package]]
|
||||
name = "ecdsa"
|
||||
|
@ -596,10 +597,16 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
name = "forward_ref"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||
checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e"
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"typenum",
|
||||
|
@ -621,9 +628,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.3"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
|
||||
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
@ -728,9 +735,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
|||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.56"
|
||||
version = "0.3.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
|
||||
checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -761,9 +768,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.112"
|
||||
version = "0.2.122"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
||||
checksum = "ec647867e2bf0772e28c8bcde4f0d19a9216916e890543b5a03ed8ef27b8f259"
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
|
@ -815,18 +822,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
|
||||
checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
version = "0.4.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -854,13 +862,12 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.0"
|
||||
version = "7.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
|
||||
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -926,9 +933,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
|
||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
|
||||
[[package]]
|
||||
name = "primitive-types"
|
||||
|
@ -951,18 +958,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.34"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1"
|
||||
checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.10"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
|
||||
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -1005,7 +1012,7 @@ version = "0.6.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom 0.2.3",
|
||||
"getrandom 0.2.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1019,18 +1026,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.11"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
version = "1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -1114,15 +1121,15 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d"
|
||||
checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.132"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1147,9 +1154,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.132"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276"
|
||||
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1169,9 +1176,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.73"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5"
|
||||
checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -1180,9 +1187,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.8"
|
||||
version = "0.9.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa"
|
||||
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0",
|
||||
"cfg-if",
|
||||
|
@ -1352,9 +1359,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.83"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959"
|
||||
checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1363,9 +1370,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
@ -1401,15 +1408,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.14.0"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
|
||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
||||
|
||||
[[package]]
|
||||
name = "uint"
|
||||
version = "0.9.1"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f"
|
||||
checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crunchy",
|
||||
|
@ -1425,9 +1432,9 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
|||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
|
@ -1443,9 +1450,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.79"
|
||||
version = "0.2.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
|
||||
checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
|
@ -1453,9 +1460,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.79"
|
||||
version = "0.2.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
|
||||
checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
|
@ -1468,9 +1475,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.79"
|
||||
version = "0.2.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
|
||||
checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -1478,9 +1485,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.79"
|
||||
version = "0.2.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
|
||||
checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1491,15 +1498,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.79"
|
||||
version = "0.2.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
|
||||
checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.56"
|
||||
version = "0.3.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
|
||||
checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -1559,7 +1566,7 @@ dependencies = [
|
|||
"cw20-base",
|
||||
"cw20-wrapped",
|
||||
"generic-array",
|
||||
"getrandom 0.2.3",
|
||||
"getrandom 0.2.6",
|
||||
"hex",
|
||||
"k256",
|
||||
"lazy_static",
|
||||
|
|
|
@ -31,7 +31,6 @@ use nom::{
|
|||
IResult,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
use std::str::FromStr; // Remove in 2021
|
||||
|
||||
use crate::WormholeError::{
|
||||
InvalidGovernanceAction,
|
||||
|
@ -279,11 +278,6 @@ mod testing {
|
|||
|
||||
#[test]
|
||||
fn test_valid_gov_header() {
|
||||
let signers = hex::decode("00b072505b5b999c1d08905c02e2b6b2832ef72c0ba6c8db4f77fe457ef2b3d053410b1e92a9194d9210df24d987ac83d7b6f0c21ce90f8bc1869de0898bda7e9801").unwrap();
|
||||
let payload = hex::decode("000000000000000000000000000000000000000000546f6b656e42726964676501000000013b26409f8aaded3f5ddca184695aa6a0fa829b0c85caf84856324896d214ca98").unwrap();
|
||||
let emitter =
|
||||
hex::decode("0000000000000000000000000000000000000000000000000000000000000004")
|
||||
.unwrap();
|
||||
let module =
|
||||
hex::decode("000000000000000000000000000000000000000000546f6b656e427269646765")
|
||||
.unwrap();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,3 @@ codegen-units = 1
|
|||
panic = 'abort'
|
||||
incremental = false
|
||||
overflow-checks = true
|
||||
|
||||
[patch.crates-io]
|
||||
memmap2 = { git = "https://github.com/certusone/wormhole", package = "memmap2" }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# 1. The first stage builds the contracts
|
||||
# 2. The second is an empty image with only the wasm files (useful for exporting)
|
||||
# 3. The third creates a node.js environment to deploy the contracts to devnet
|
||||
FROM cosmwasm/workspace-optimizer:0.12.1@sha256:1508cf7545f4b656ecafa34e29c1acf200cdab47fced85c2bc076c0c158b1338 AS builder
|
||||
FROM cosmwasm/workspace-optimizer:0.12.6@sha256:e6565a5e87c830ef3e8775a9035006b38ad0aaf0a96319158c802457b1dd1d08 AS builder
|
||||
COPY Cargo.lock /code/
|
||||
COPY Cargo.toml /code/
|
||||
COPY contracts /code/contracts
|
||||
|
|
|
@ -23,6 +23,3 @@ cw20 = { version = "0.8.0" }
|
|||
cw20-legacy = { version = "0.2.0", features = ["library"]}
|
||||
cw-storage-plus = { version = "0.8.0" }
|
||||
thiserror = { version = "1.0.20" }
|
||||
|
||||
[dev-dependencies]
|
||||
cosmwasm-vm = { version = "0.16.0", default-features = false }
|
||||
|
|
|
@ -244,8 +244,6 @@ mod tests {
|
|||
};
|
||||
use cw20::TokenInfoResponse;
|
||||
|
||||
const CANONICAL_LENGTH: usize = 20;
|
||||
|
||||
fn get_balance(deps: Deps, address: HumanAddr) -> Uint128 {
|
||||
query_balance(deps, address.into()).unwrap().balance
|
||||
}
|
||||
|
@ -262,14 +260,14 @@ mod tests {
|
|||
};
|
||||
let env = mock_env();
|
||||
let info = mock_info(creator, &[]);
|
||||
let res = instantiate(deps, env, info, init_msg).unwrap();
|
||||
let res = instantiate(deps.branch(), env, info, init_msg).unwrap();
|
||||
assert_eq!(0, res.messages.len());
|
||||
|
||||
assert_eq!(
|
||||
query_token_info(deps.as_ref()).unwrap(),
|
||||
TokenInfoResponse {
|
||||
name: "Wormhole Wrapped".to_string(),
|
||||
symbol: "WWT".to_string(),
|
||||
name: "Integers (Wormhole)".to_string(),
|
||||
symbol: "INT".to_string(),
|
||||
decimals: 10,
|
||||
total_supply: Uint128::from(0u128),
|
||||
}
|
||||
|
@ -291,7 +289,7 @@ mod tests {
|
|||
mint_to: &HumanAddr,
|
||||
amount: Uint128,
|
||||
) {
|
||||
do_init(deps, creator);
|
||||
do_init(deps.branch(), creator);
|
||||
|
||||
let msg = ExecuteMsg::Mint {
|
||||
recipient: mint_to.clone(),
|
||||
|
@ -300,15 +298,15 @@ mod tests {
|
|||
|
||||
let env = mock_env();
|
||||
let info = mock_info(creator, &[]);
|
||||
let res = execute(deps.as_mut(), env, info, msg.clone()).unwrap();
|
||||
let res = execute(deps.branch(), env, info, msg.clone()).unwrap();
|
||||
assert_eq!(0, res.messages.len());
|
||||
assert_eq!(get_balance(deps.as_ref(), mint_to.clone(),), amount);
|
||||
|
||||
assert_eq!(
|
||||
query_token_info(deps.as_ref()).unwrap(),
|
||||
TokenInfoResponse {
|
||||
name: "Wormhole Wrapped".to_string(),
|
||||
symbol: "WWT".to_string(),
|
||||
name: "Integers (Wormhole)".to_string(),
|
||||
symbol: "INT".to_string(),
|
||||
decimals: 10,
|
||||
total_supply: amount,
|
||||
}
|
||||
|
|
|
@ -1,37 +1,33 @@
|
|||
static WASM: &[u8] =
|
||||
include_bytes!("../../../target/wasm32-unknown-unknown/release/cw20_wrapped.wasm");
|
||||
|
||||
use cosmwasm_std::{
|
||||
from_slice,
|
||||
Binary,
|
||||
Env,
|
||||
HandleResponse,
|
||||
HandleResult,
|
||||
HumanAddr,
|
||||
InitResponse,
|
||||
Uint128,
|
||||
};
|
||||
use cosmwasm_storage::to_length_prefixed;
|
||||
use cosmwasm_vm::{
|
||||
testing::{
|
||||
handle,
|
||||
init,
|
||||
mock_dependencies,
|
||||
mock_env,
|
||||
mock_instance,
|
||||
query,
|
||||
mock_info,
|
||||
MockApi,
|
||||
MockQuerier,
|
||||
MockStorage,
|
||||
},
|
||||
Addr,
|
||||
Api,
|
||||
Instance,
|
||||
OwnedDeps,
|
||||
Response,
|
||||
Storage,
|
||||
Uint128,
|
||||
};
|
||||
use cosmwasm_storage::to_length_prefixed;
|
||||
use cw20::TokenInfoResponse;
|
||||
use cw20_wrapped::{
|
||||
contract::{
|
||||
execute,
|
||||
instantiate,
|
||||
query,
|
||||
},
|
||||
msg::{
|
||||
HandleMsg,
|
||||
InitMsg,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
QueryMsg,
|
||||
WrappedAssetInfoResponse,
|
||||
},
|
||||
state::{
|
||||
WrappedAssetInfo,
|
||||
|
@ -40,109 +36,88 @@ use cw20_wrapped::{
|
|||
ContractError,
|
||||
};
|
||||
|
||||
enum TestAddress {
|
||||
INITIALIZER,
|
||||
RECIPIENT,
|
||||
SENDER,
|
||||
}
|
||||
|
||||
impl TestAddress {
|
||||
fn value(&self) -> HumanAddr {
|
||||
match self {
|
||||
TestAddress::INITIALIZER => HumanAddr::from("addr0000"),
|
||||
TestAddress::RECIPIENT => HumanAddr::from("addr2222"),
|
||||
TestAddress::SENDER => HumanAddr::from("addr3333"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mock_env_height(signer: &HumanAddr, height: u64, time: u64) -> Env {
|
||||
let mut env = mock_env(signer, &[]);
|
||||
env.block.height = height;
|
||||
env.block.time = time;
|
||||
env
|
||||
}
|
||||
static INITIALIZER: &str = "addr0000";
|
||||
static RECIPIENT: &str = "addr2222";
|
||||
static SENDER: &str = "addr3333";
|
||||
|
||||
fn get_wrapped_asset_info<S: Storage>(storage: &S) -> WrappedAssetInfo {
|
||||
let key = to_length_prefixed(KEY_WRAPPED_ASSET);
|
||||
let data = storage
|
||||
.get(&key)
|
||||
.0
|
||||
.expect("error getting data")
|
||||
.expect("data should exist");
|
||||
from_slice(&data).expect("invalid data")
|
||||
}
|
||||
|
||||
fn do_init(height: u64) -> Instance<MockStorage, MockApi, MockQuerier> {
|
||||
let mut deps = mock_instance(WASM, &[]);
|
||||
let init_msg = InitMsg {
|
||||
fn do_init() -> OwnedDeps<MockStorage, MockApi, MockQuerier> {
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let init_msg = InstantiateMsg {
|
||||
name: "Integers".into(),
|
||||
symbol: "INT".into(),
|
||||
asset_chain: 1,
|
||||
asset_address: vec![1; 32].into(),
|
||||
decimals: 10,
|
||||
mint: None,
|
||||
init_hook: None,
|
||||
};
|
||||
let env = mock_env_height(&TestAddress::INITIALIZER.value(), height, 0);
|
||||
let res: InitResponse = init(&mut deps, env, init_msg).unwrap();
|
||||
let env = mock_env();
|
||||
let info = mock_info(INITIALIZER, &[]);
|
||||
let res: Response = instantiate(deps.as_mut(), env, info, init_msg).unwrap();
|
||||
assert_eq!(0, res.messages.len());
|
||||
|
||||
// query the store directly
|
||||
let api = deps.api;
|
||||
deps.with_storage(|storage| {
|
||||
assert_eq!(
|
||||
get_wrapped_asset_info(storage),
|
||||
WrappedAssetInfo {
|
||||
asset_chain: 1,
|
||||
asset_address: vec![1; 32].into(),
|
||||
bridge: api.canonical_address(&TestAddress::INITIALIZER.value()).0?,
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let bridge = deps.api.addr_canonicalize(INITIALIZER).unwrap();
|
||||
assert_eq!(
|
||||
get_wrapped_asset_info(&deps.storage),
|
||||
WrappedAssetInfo {
|
||||
asset_chain: 1,
|
||||
asset_address: vec![1; 32].into(),
|
||||
bridge,
|
||||
}
|
||||
);
|
||||
|
||||
deps
|
||||
}
|
||||
|
||||
fn do_mint(
|
||||
deps: &mut Instance<MockStorage, MockApi, MockQuerier>,
|
||||
height: u64,
|
||||
recipient: &HumanAddr,
|
||||
deps: &mut OwnedDeps<MockStorage, MockApi, MockQuerier>,
|
||||
recipient: &Addr,
|
||||
amount: &Uint128,
|
||||
) {
|
||||
let mint_msg = HandleMsg::Mint {
|
||||
recipient: recipient.clone(),
|
||||
let mint_msg = ExecuteMsg::Mint {
|
||||
recipient: recipient.to_string(),
|
||||
amount: amount.clone(),
|
||||
};
|
||||
let env = mock_env_height(&TestAddress::INITIALIZER.value(), height, 0);
|
||||
let handle_response: HandleResponse = handle(deps, env, mint_msg).unwrap();
|
||||
let info = mock_info(INITIALIZER, &[]);
|
||||
let handle_response: Response = execute(deps.as_mut(), mock_env(), info, mint_msg).unwrap();
|
||||
assert_eq!(0, handle_response.messages.len());
|
||||
}
|
||||
|
||||
fn do_transfer(
|
||||
deps: &mut Instance<MockStorage, MockApi, MockQuerier>,
|
||||
height: u64,
|
||||
sender: &HumanAddr,
|
||||
recipient: &HumanAddr,
|
||||
deps: &mut OwnedDeps<MockStorage, MockApi, MockQuerier>,
|
||||
sender: &Addr,
|
||||
recipient: &Addr,
|
||||
amount: &Uint128,
|
||||
) {
|
||||
let transfer_msg = HandleMsg::Transfer {
|
||||
recipient: recipient.clone(),
|
||||
let transfer_msg = ExecuteMsg::Transfer {
|
||||
recipient: recipient.to_string(),
|
||||
amount: amount.clone(),
|
||||
};
|
||||
let env = mock_env_height(sender, height, 0);
|
||||
let handle_response: HandleResponse = handle(deps, env, transfer_msg).unwrap();
|
||||
let env = mock_env();
|
||||
let info = mock_info(sender.as_str(), &[]);
|
||||
let handle_response: Response = execute(deps.as_mut(), env, info, transfer_msg).unwrap();
|
||||
assert_eq!(0, handle_response.messages.len());
|
||||
}
|
||||
|
||||
fn check_balance(
|
||||
deps: &mut Instance<MockStorage, MockApi, MockQuerier>,
|
||||
address: &HumanAddr,
|
||||
deps: &OwnedDeps<MockStorage, MockApi, MockQuerier>,
|
||||
address: &Addr,
|
||||
amount: &Uint128,
|
||||
) {
|
||||
let query_response = query(
|
||||
deps,
|
||||
deps.as_ref(),
|
||||
mock_env(),
|
||||
QueryMsg::Balance {
|
||||
address: address.clone(),
|
||||
address: address.to_string(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
@ -152,74 +127,62 @@ fn check_balance(
|
|||
);
|
||||
}
|
||||
|
||||
fn check_token_details(deps: &mut Instance<MockStorage, MockApi, MockQuerier>, supply: &Uint128) {
|
||||
let query_response = query(deps, QueryMsg::TokenInfo {}).unwrap();
|
||||
fn check_token_details(deps: &OwnedDeps<MockStorage, MockApi, MockQuerier>, supply: Uint128) {
|
||||
let query_response = query(deps.as_ref(), mock_env(), QueryMsg::TokenInfo {}).unwrap();
|
||||
assert_eq!(
|
||||
query_response.as_slice(),
|
||||
format!(
|
||||
"{{\"name\":\"Wormhole Wrapped\",\
|
||||
\"symbol\":\"WWT\",\
|
||||
\"decimals\":10,\
|
||||
\"total_supply\":\"{}\"}}",
|
||||
supply.u128()
|
||||
)
|
||||
.as_bytes()
|
||||
from_slice::<TokenInfoResponse>(query_response.as_slice()).unwrap(),
|
||||
TokenInfoResponse {
|
||||
name: "Integers (Wormhole)".into(),
|
||||
symbol: "INT".into(),
|
||||
decimals: 10,
|
||||
total_supply: supply,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn init_works() {
|
||||
let mut deps = do_init(111);
|
||||
check_token_details(&mut deps, &Uint128(0));
|
||||
let mut deps = do_init();
|
||||
check_token_details(&mut deps, Uint128::new(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn query_works() {
|
||||
let mut deps = do_init(111);
|
||||
let deps = do_init();
|
||||
|
||||
let query_response = query(&mut deps, QueryMsg::WrappedAssetInfo {}).unwrap();
|
||||
let query_response = query(deps.as_ref(), mock_env(), QueryMsg::WrappedAssetInfo {}).unwrap();
|
||||
assert_eq!(
|
||||
query_response.as_slice(),
|
||||
format!(
|
||||
"{{\"asset_chain\":1,\
|
||||
\"asset_address\":\"{}\",\
|
||||
\"bridge\":\"{}\"}}",
|
||||
Binary::from(vec![1; 32]).to_base64(),
|
||||
TestAddress::INITIALIZER.value().as_str()
|
||||
)
|
||||
.as_bytes()
|
||||
from_slice::<WrappedAssetInfoResponse>(&query_response.as_slice()).unwrap(),
|
||||
WrappedAssetInfoResponse {
|
||||
asset_chain: 1,
|
||||
asset_address: vec![1; 32].into(),
|
||||
bridge: Addr::unchecked(INITIALIZER),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mint_works() {
|
||||
let mut deps = do_init(111);
|
||||
let mut deps = do_init();
|
||||
|
||||
do_mint(
|
||||
&mut deps,
|
||||
112,
|
||||
&TestAddress::RECIPIENT.value(),
|
||||
&Uint128(123_123_123),
|
||||
);
|
||||
let recipient = Addr::unchecked(RECIPIENT);
|
||||
do_mint(&mut deps, &recipient, &Uint128::new(123_123_123));
|
||||
|
||||
check_balance(
|
||||
&mut deps,
|
||||
&TestAddress::RECIPIENT.value(),
|
||||
&Uint128(123_123_123),
|
||||
);
|
||||
check_token_details(&mut deps, &Uint128(123_123_123));
|
||||
check_balance(&deps, &recipient, &Uint128::new(123_123_123));
|
||||
check_token_details(&deps, Uint128::new(123_123_123));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn others_cannot_mint() {
|
||||
let mut deps = do_init(111);
|
||||
let mut deps = do_init();
|
||||
|
||||
let mint_msg = HandleMsg::Mint {
|
||||
recipient: TestAddress::RECIPIENT.value(),
|
||||
amount: Uint128(123_123_123),
|
||||
let mint_msg = ExecuteMsg::Mint {
|
||||
recipient: RECIPIENT.into(),
|
||||
amount: Uint128::new(123_123_123),
|
||||
};
|
||||
let env = mock_env_height(&TestAddress::RECIPIENT.value(), 112, 0);
|
||||
let handle_result: HandleResult<HandleResponse> = handle(&mut deps, env, mint_msg);
|
||||
let env = mock_env();
|
||||
let info = mock_info(RECIPIENT, &[]);
|
||||
let handle_result = execute(deps.as_mut(), env, info, mint_msg);
|
||||
assert_eq!(
|
||||
format!("{}", handle_result.unwrap_err()),
|
||||
format!("{}", ContractError::Unauthorized {})
|
||||
|
@ -228,26 +191,13 @@ fn others_cannot_mint() {
|
|||
|
||||
#[test]
|
||||
fn transfer_works() {
|
||||
let mut deps = do_init(111);
|
||||
let mut deps = do_init();
|
||||
|
||||
do_mint(
|
||||
&mut deps,
|
||||
112,
|
||||
&TestAddress::SENDER.value(),
|
||||
&Uint128(123_123_123),
|
||||
);
|
||||
do_transfer(
|
||||
&mut deps,
|
||||
113,
|
||||
&TestAddress::SENDER.value(),
|
||||
&TestAddress::RECIPIENT.value(),
|
||||
&Uint128(123_123_000),
|
||||
);
|
||||
let sender = Addr::unchecked(SENDER);
|
||||
let recipient = Addr::unchecked(RECIPIENT);
|
||||
do_mint(&mut deps, &sender, &Uint128::new(123_123_123));
|
||||
do_transfer(&mut deps, &sender, &recipient, &Uint128::new(123_123_000));
|
||||
|
||||
check_balance(&mut deps, &TestAddress::SENDER.value(), &Uint128(123));
|
||||
check_balance(
|
||||
&mut deps,
|
||||
&TestAddress::RECIPIENT.value(),
|
||||
&Uint128(123_123_000),
|
||||
);
|
||||
check_balance(&mut deps, &sender, &Uint128::new(123));
|
||||
check_balance(&mut deps, &recipient, &Uint128::new(123_123_000));
|
||||
}
|
||||
|
|
|
@ -1,14 +1,39 @@
|
|||
#![cfg(test)]
|
||||
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
|
||||
use cosmwasm_std::{from_binary, to_binary, CosmosMsg, DepsMut, Empty, Response, WasmMsg};
|
||||
use cosmwasm_std::{
|
||||
from_binary,
|
||||
testing::{
|
||||
mock_dependencies,
|
||||
mock_env,
|
||||
mock_info,
|
||||
},
|
||||
to_binary,
|
||||
CosmosMsg,
|
||||
DepsMut,
|
||||
Empty,
|
||||
Response,
|
||||
WasmMsg,
|
||||
};
|
||||
|
||||
use cw721::{
|
||||
Approval, ApprovalResponse, ContractInfoResponse, Cw721Query, Cw721ReceiveMsg, Expiration,
|
||||
NftInfoResponse, OperatorsResponse, OwnerOfResponse,
|
||||
Approval,
|
||||
ApprovalResponse,
|
||||
ContractInfoResponse,
|
||||
Cw721Query,
|
||||
Cw721ReceiveMsg,
|
||||
Expiration,
|
||||
NftInfoResponse,
|
||||
OperatorsResponse,
|
||||
OwnerOfResponse,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
ContractError, Cw721Contract, ExecuteMsg, Extension, InstantiateMsg, MintMsg, QueryMsg,
|
||||
ContractError,
|
||||
Cw721Contract,
|
||||
ExecuteMsg,
|
||||
Extension,
|
||||
InstantiateMsg,
|
||||
MintMsg,
|
||||
QueryMsg,
|
||||
};
|
||||
|
||||
const MINTER: &str = "merlin";
|
||||
|
@ -30,7 +55,7 @@ fn setup_contract(deps: DepsMut<'_>) -> Cw721Contract<'static, Extension, Empty>
|
|||
|
||||
#[test]
|
||||
fn proper_instantiation() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = Cw721Contract::<Extension, Empty>::default();
|
||||
|
||||
let msg = InstantiateMsg {
|
||||
|
@ -68,7 +93,7 @@ fn proper_instantiation() {
|
|||
|
||||
#[test]
|
||||
fn minting() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
|
||||
let token_id = "petrify".to_string();
|
||||
|
@ -147,7 +172,7 @@ fn minting() {
|
|||
|
||||
#[test]
|
||||
fn burning() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
|
||||
let token_id = "petrify".to_string();
|
||||
|
@ -196,7 +221,7 @@ fn burning() {
|
|||
|
||||
#[test]
|
||||
fn transferring_nft() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
|
||||
// Mint a token
|
||||
|
@ -250,7 +275,7 @@ fn transferring_nft() {
|
|||
|
||||
#[test]
|
||||
fn sending_nft() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
|
||||
// Mint a token
|
||||
|
@ -316,7 +341,7 @@ fn sending_nft() {
|
|||
|
||||
#[test]
|
||||
fn approving_revoking() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
|
||||
// Mint a token
|
||||
|
@ -440,7 +465,7 @@ fn approving_revoking() {
|
|||
|
||||
#[test]
|
||||
fn approving_all_revoking_all() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
|
||||
// Mint a couple tokens (from the same owner)
|
||||
|
@ -655,15 +680,15 @@ fn approving_all_revoking_all() {
|
|||
|
||||
#[test]
|
||||
fn query_tokens_by_owner() {
|
||||
let mut deps = mock_dependencies();
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let contract = setup_contract(deps.as_mut());
|
||||
let minter = mock_info(MINTER, &[]);
|
||||
|
||||
// Mint a couple tokens (from the same owner)
|
||||
let token_id1 = "grow1".to_string();
|
||||
let demeter = String::from("Demeter");
|
||||
let demeter = String::from("demeter");
|
||||
let token_id2 = "grow2".to_string();
|
||||
let ceres = String::from("Ceres");
|
||||
let ceres = String::from("ceres");
|
||||
let token_id3 = "sing".to_string();
|
||||
|
||||
let mint_msg = ExecuteMsg::Mint(MintMsg::<Extension> {
|
||||
|
|
|
@ -1,13 +1,33 @@
|
|||
use std::env::current_dir;
|
||||
use std::fs::create_dir_all;
|
||||
use std::{
|
||||
env::current_dir,
|
||||
fs::create_dir_all,
|
||||
};
|
||||
|
||||
use cosmwasm_schema::{export_schema, export_schema_with_title, remove_schemas, schema_for};
|
||||
use cosmwasm_schema::{
|
||||
export_schema,
|
||||
export_schema_with_title,
|
||||
remove_schemas,
|
||||
schema_for,
|
||||
};
|
||||
|
||||
use cw721::{
|
||||
AllNftInfoResponse, ApprovalResponse, ApprovalsResponse, ContractInfoResponse, NftInfoResponse,
|
||||
NumTokensResponse, OperatorsResponse, OwnerOfResponse, TokensResponse,
|
||||
AllNftInfoResponse,
|
||||
ApprovalResponse,
|
||||
ApprovalsResponse,
|
||||
ContractInfoResponse,
|
||||
NftInfoResponse,
|
||||
NumTokensResponse,
|
||||
OperatorsResponse,
|
||||
OwnerOfResponse,
|
||||
TokensResponse,
|
||||
};
|
||||
use cw721_base::{
|
||||
ExecuteMsg,
|
||||
Extension,
|
||||
InstantiateMsg,
|
||||
MinterResponse,
|
||||
QueryMsg,
|
||||
};
|
||||
use cw721_metadata_onchain::{ExecuteMsg, Extension, InstantiateMsg, MinterResponse, QueryMsg};
|
||||
|
||||
fn main() {
|
||||
let mut out_dir = current_dir().unwrap();
|
||||
|
@ -16,7 +36,7 @@ fn main() {
|
|||
remove_schemas(&out_dir).unwrap();
|
||||
|
||||
export_schema(&schema_for!(InstantiateMsg), &out_dir);
|
||||
export_schema_with_title(&schema_for!(ExecuteMsg), &out_dir, "ExecuteMsg");
|
||||
export_schema_with_title(&schema_for!(ExecuteMsg<()>), &out_dir, "ExecuteMsg");
|
||||
export_schema(&schema_for!(QueryMsg), &out_dir);
|
||||
export_schema_with_title(
|
||||
&schema_for!(AllNftInfoResponse<Extension>),
|
||||
|
|
|
@ -23,4 +23,8 @@ cw721 = { path = "../../packages/cw721" }
|
|||
wormhole-bridge-terra = { path = "../wormhole", features = ["library"] }
|
||||
sha3 = { version = "0.9.1", default-features = false }
|
||||
hex = "0.4.2"
|
||||
bigint = "4"
|
||||
bigint = "4"
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0"
|
||||
lazy_static = "1.4.0"
|
||||
|
|
|
@ -32,5 +32,4 @@ lazy_static = "1.4.0"
|
|||
bigint = "4"
|
||||
|
||||
[dev-dependencies]
|
||||
cosmwasm-vm = { version = "0.16.0", default-features = false }
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -13,7 +13,6 @@ use cosmwasm_std::{
|
|||
Empty,
|
||||
Env,
|
||||
MessageInfo,
|
||||
Order,
|
||||
QueryRequest,
|
||||
Reply,
|
||||
Response,
|
||||
|
@ -1173,7 +1172,6 @@ fn build_native_id(denom: &str) -> Vec<u8> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use cosmwasm_std::{
|
||||
to_binary,
|
||||
Binary,
|
||||
StdResult,
|
||||
};
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
static WASM: &[u8] = include_bytes!("../../../target/wasm32-unknown-unknown/release/wormhole.wasm");
|
||||
|
||||
use cosmwasm_std::{
|
||||
from_slice,
|
||||
Coin,
|
||||
Env,
|
||||
HumanAddr,
|
||||
InitResponse,
|
||||
};
|
||||
use cosmwasm_storage::to_length_prefixed;
|
||||
use cosmwasm_vm::{
|
||||
testing::{
|
||||
init,
|
||||
mock_env,
|
||||
mock_instance,
|
||||
MockApi,
|
||||
MockQuerier,
|
||||
MockStorage,
|
||||
},
|
||||
Api,
|
||||
Instance,
|
||||
Storage,
|
||||
};
|
||||
|
||||
use wormhole::{
|
||||
msg::InitMsg,
|
||||
state::{
|
||||
ConfigInfo,
|
||||
GuardianAddress,
|
||||
GuardianSetInfo,
|
||||
CONFIG_KEY,
|
||||
},
|
||||
};
|
||||
|
||||
use hex;
|
||||
|
||||
enum TestAddress {
|
||||
INITIALIZER,
|
||||
}
|
||||
|
||||
impl TestAddress {
|
||||
fn value(&self) -> HumanAddr {
|
||||
match self {
|
||||
TestAddress::INITIALIZER => HumanAddr::from("initializer"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mock_env_height(signer: &HumanAddr, height: u64, time: u64) -> Env {
|
||||
let mut env = mock_env(signer, &[]);
|
||||
env.block.height = height;
|
||||
env.block.time = time;
|
||||
env
|
||||
}
|
||||
|
||||
fn get_config_info<S: Storage>(storage: &S) -> ConfigInfo {
|
||||
let key = to_length_prefixed(CONFIG_KEY);
|
||||
let data = storage
|
||||
.get(&key)
|
||||
.0
|
||||
.expect("error getting data")
|
||||
.expect("data should exist");
|
||||
from_slice(&data).expect("invalid data")
|
||||
}
|
||||
|
||||
fn do_init(
|
||||
height: u64,
|
||||
guardians: &Vec<GuardianAddress>,
|
||||
) -> Instance<MockStorage, MockApi, MockQuerier> {
|
||||
let mut deps = mock_instance(WASM, &[]);
|
||||
let init_msg = InitMsg {
|
||||
initial_guardian_set: GuardianSetInfo {
|
||||
addresses: guardians.clone(),
|
||||
expiration_time: 100,
|
||||
},
|
||||
guardian_set_expirity: 50,
|
||||
wrapped_asset_code_id: 999,
|
||||
};
|
||||
let env = mock_env_height(&TestAddress::INITIALIZER.value(), height, 0);
|
||||
let owner = deps
|
||||
.api
|
||||
.canonical_address(&TestAddress::INITIALIZER.value())
|
||||
.0
|
||||
.unwrap();
|
||||
let res: InitResponse = init(&mut deps, env, init_msg).unwrap();
|
||||
assert_eq!(0, res.messages.len());
|
||||
|
||||
// query the store directly
|
||||
deps.with_storage(|storage| {
|
||||
assert_eq!(
|
||||
get_config_info(storage),
|
||||
ConfigInfo {
|
||||
guardian_set_index: 0,
|
||||
guardian_set_expirity: 50,
|
||||
wrapped_asset_code_id: 999,
|
||||
owner,
|
||||
fee: Coin::new(10000, "uluna"),
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
deps
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn init_works() {
|
||||
let guardians = vec![GuardianAddress::from(GuardianAddress {
|
||||
bytes: hex::decode("beFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe")
|
||||
.expect("Decoding failed")
|
||||
.into(),
|
||||
})];
|
||||
let _deps = do_init(111, &guardians);
|
||||
}
|
|
@ -31,5 +31,4 @@ hex = "0.4.2"
|
|||
lazy_static = "1.4.0"
|
||||
|
||||
[dev-dependencies]
|
||||
cosmwasm-vm = { version = "0.16.0", default-features = false }
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -426,6 +426,17 @@ mod tests {
|
|||
#[test]
|
||||
fn test_deserialize() {
|
||||
let x = hex::decode("080000000901007bfa71192f886ab6819fa4862e34b4d178962958d9b2e3d9437338c9e5fde1443b809d2886eaa69e0f0158ea517675d96243c9209c3fe1d94d5b19866654c6980000000b150000000500020001020304000000000000000000000000000000000000000000000000000000000000000000000a0261626364").unwrap();
|
||||
|
||||
let body = &x[ParsedVAA::HEADER_LEN + ParsedVAA::SIGNATURE_LEN..];
|
||||
let mut hasher = Keccak256::new();
|
||||
hasher.update(body);
|
||||
let hash = hasher.finalize();
|
||||
|
||||
// Rehash the hash
|
||||
let mut hasher = Keccak256::new();
|
||||
hasher.update(hash);
|
||||
let hash = hasher.finalize().to_vec();
|
||||
|
||||
let v = ParsedVAA::deserialize(x.as_slice()).unwrap();
|
||||
assert_eq!(
|
||||
v,
|
||||
|
@ -443,10 +454,7 @@ mod tests {
|
|||
sequence: 10,
|
||||
consistency_level: 2,
|
||||
payload: vec![97, 98, 99, 100],
|
||||
hash: vec![
|
||||
195, 10, 19, 96, 8, 61, 218, 69, 160, 238, 165, 142, 105, 119, 139, 121, 212,
|
||||
73, 238, 179, 13, 80, 245, 224, 75, 110, 163, 8, 185, 132, 55, 34
|
||||
]
|
||||
hash,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
use cosmwasm_std::{
|
||||
from_slice,
|
||||
testing::{
|
||||
mock_dependencies,
|
||||
mock_env,
|
||||
mock_info,
|
||||
MockApi,
|
||||
MockQuerier,
|
||||
MockStorage,
|
||||
},
|
||||
Coin,
|
||||
OwnedDeps,
|
||||
Response,
|
||||
Storage,
|
||||
};
|
||||
use cosmwasm_storage::to_length_prefixed;
|
||||
|
||||
use wormhole::{
|
||||
contract::instantiate,
|
||||
msg::InstantiateMsg,
|
||||
state::{
|
||||
ConfigInfo,
|
||||
GuardianAddress,
|
||||
GuardianSetInfo,
|
||||
CONFIG_KEY,
|
||||
},
|
||||
};
|
||||
|
||||
use hex;
|
||||
|
||||
static INITIALIZER: &str = "initializer";
|
||||
static GOV_ADDR: &[u8] = b"GOVERNANCE_ADDRESS";
|
||||
|
||||
fn get_config_info<S: Storage>(storage: &S) -> ConfigInfo {
|
||||
let key = to_length_prefixed(CONFIG_KEY);
|
||||
let data = storage
|
||||
.get(&key)
|
||||
.expect("data should exist");
|
||||
from_slice(&data).expect("invalid data")
|
||||
}
|
||||
|
||||
fn do_init(guardians: &[GuardianAddress]) -> OwnedDeps<MockStorage, MockApi, MockQuerier> {
|
||||
let mut deps = mock_dependencies(&[]);
|
||||
let init_msg = InstantiateMsg {
|
||||
gov_chain: 0,
|
||||
gov_address: GOV_ADDR.into(),
|
||||
initial_guardian_set: GuardianSetInfo {
|
||||
addresses: guardians.to_vec(),
|
||||
expiration_time: 100,
|
||||
},
|
||||
guardian_set_expirity: 50,
|
||||
};
|
||||
let env = mock_env();
|
||||
let info = mock_info(INITIALIZER, &[]);
|
||||
let res: Response = instantiate(deps.as_mut(), env, info, init_msg).unwrap();
|
||||
assert_eq!(0, res.messages.len());
|
||||
|
||||
// query the store directly
|
||||
assert_eq!(
|
||||
get_config_info(&deps.storage),
|
||||
ConfigInfo {
|
||||
guardian_set_index: 0,
|
||||
guardian_set_expirity: 50,
|
||||
gov_chain: 0,
|
||||
gov_address: GOV_ADDR.to_vec(),
|
||||
fee: Coin::new(0, "uluna"),
|
||||
}
|
||||
);
|
||||
deps
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn init_works() {
|
||||
let guardians = [GuardianAddress::from(GuardianAddress {
|
||||
bytes: hex::decode("beFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe")
|
||||
.expect("Decoding failed")
|
||||
.into(),
|
||||
})];
|
||||
let _deps = do_init(&guardians);
|
||||
}
|
Loading…
Reference in New Issue