diff --git a/.cargo/config b/.cargo/config index 7d1a066..00d3551 100644 --- a/.cargo/config +++ b/.cargo/config @@ -3,3 +3,4 @@ wasm = "build --release --target wasm32-unknown-unknown" wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" schema = "run --example schema" +integration-test = "test --package e2e -- --ignored --test-threads 1 -Z unstable-options --report-time" \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..627b17f --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,94 @@ +name: E2E Integration Tests + +on: + pull_request: + push: + branches: + - main + +jobs: + test: + name: E2E tests + runs-on: ubuntu-latest + env: + GAS_OUT_DIR: gas_reports + ENABLE_MAX_COLLECTION: true + GAS_LIMIT: 75000000 + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install latest nightly toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + targets: wasm32-unknown-unknown + + - name: Rust Dependencies Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + artifacts/ + key: ${{ runner.os }}-cargo-with-artifacts-${{ hashFiles('**/Cargo.lock') }} + + - name: Get mainnet GAS_LIMIT + run: echo "MAINNET_GAS_LIMIT=$(curl -s https://rpc.stargaze-apis.com/consensus_params | jq -r '.result.consensus_params.block.max_gas')" >> $GITHUB_ENV + + - name: Mainnet block GAS_LIMIT changed + if: ${{ env.MAINNET_GAS_LIMIT != env.GAS_LIMIT }} + uses: actions/github-script@v6 + with: + script: core.setFailed(`Integration tests must update GAS_LIMIT from ${process.env.GAS_LIMIT} to ${process.env.MAINNET_GAS_LIMIT}`) + + - name: Deploy local Stargaze node + run: make deploy-local + + - name: Optimize Contracts + run: make optimize + + - name: Run Integration Tests + run: make e2etest + + - name: Combine Test Gas Reports + run: cd e2e/ && jq -rs 'reduce .[] as $item ({}; . * $item)' gas_reports/*.json > gas_report.json + + - name: Raw Gas Report + run: cat e2e/gas_report.json + + - name: Set GIT_BRANCH + run: echo "GIT_BRANCH=$(echo ${{ github.ref }} | sed 's|/|-|g')" >> $GITHUB_ENV + + - name: Upload Gas Report + if: ${{ github.ref == 'refs/heads/main' }} + uses: actions/upload-artifact@v3 + with: + name: infinity-pool-gas-report-${{ env.GIT_BRANCH }} + path: e2e/gas_report.json + retention-days: 90 + + - name: Download main gas report + id: download_gas + # Because the max retention period of github artifacts is 90 days + # there's a possibility the main's report no longer exists + continue-on-error: true + if: ${{ github.ref != 'refs/heads/main' }} + # NOTE: We can't use github's `actions/download-artifact` because it doesnt support + # downloading an artifact cross workflows yet + # https://github.com/actions/download-artifact/issues/3 + uses: dawidd6/action-download-artifact@v2 + with: + branch: main + workflow: e2e.yml + name: infinity-pool-gas-report-refs-heads-main + + - name: Post gas diff to PR + if: ${{ github.ref != 'refs/heads/main' && steps.download_gas.outputs.found_artifact == 'true' }} + uses: de-husk/cosm-orc-gas-diff-action@v0.6.3 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + current_json: e2e/gas_report.json + old_json: gas_report.json diff --git a/Cargo.lock b/Cargo.lock index d60996b..f0620de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,6 +13,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "anyhow" version = "1.0.68" @@ -25,12 +34,108 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "async-stream" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "axum" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fb79c228270dcf2426e74864cabc94babb5dbab01a4314e702d2f16540e1591" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-http", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cae3e661676ffbacb30f1a824089a8c9150e71017f7e1e38f2aa32009188d34" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + [[package]] name = "base-factory" version = "0.21.8" @@ -94,6 +199,30 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" +[[package]] +name = "bip32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30ed1d6f8437a487a266c8293aeb95b61a23261273e3e02912cdb8b68bf798b" +dependencies = [ + "bs58", + "hmac", + "k256", + "once_cell", + "pbkdf2", + "rand_core 0.6.4", + "ripemd", + "sha2 0.10.6", + "subtle", + "zeroize", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "0.17.4" @@ -167,6 +296,21 @@ dependencies = [ "syn", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +dependencies = [ + "sha2 0.9.9", +] + +[[package]] +name = "bumpalo" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" + [[package]] name = "bytecheck" version = "0.6.9" @@ -199,6 +343,15 @@ name = "bytes" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +dependencies = [ + "serde", +] + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -206,12 +359,111 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "config" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" +dependencies = [ + "async-trait", + "json5", + "lazy_static", + "nom", + "pathdiff", + "ron", + "rust-ini", + "serde", + "serde_json", + "toml", + "yaml-rust", +] + [[package]] name = "const-oid" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "cosm-orc" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d7b3a13272e1fac3bea1f95bafff21f737052cbb8e47fff66550a2dc71ce63" +dependencies = [ + "config", + "cosm-tome", + "erased-serde", + "log", + "serde", + "serde_json", + "thiserror", + "tokio", +] + +[[package]] +name = "cosm-tome" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3daaf99d2364465e81ac948e6c27ecdc63aab74ab948d9f526793009dacd9d28" +dependencies = [ + "async-trait", + "cosmrs", + "regex", + "serde", + "serde_json", + "thiserror", + "tonic", +] + +[[package]] +name = "cosmos-sdk-proto" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673d31bd830c0772d78545de20d975129b6ab2f7db4e4e9313c3b8777d319194" +dependencies = [ + "prost 0.11.6", + "prost-types", + "tendermint-proto", + "tonic", +] + +[[package]] +name = "cosmrs" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fa07096219b1817432b8f1e47c22e928c64bbfd231fc08f0a98f0e7ddd602b7" +dependencies = [ + "bip32", + "cosmos-sdk-proto", + "ecdsa", + "eyre", + "getrandom", + "k256", + "rand_core 0.6.4", + "serde", + "serde_json", + "subtle-encoding", + "tendermint", + "tendermint-rpc", + "thiserror", +] + [[package]] name = "cosmwasm-crypto" version = "1.1.9" @@ -324,6 +576,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ct-logs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" +dependencies = [ + "sct", +] + [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -365,7 +626,7 @@ dependencies = [ "derivative", "itertools", "k256", - "prost", + "prost 0.9.0", "schemars", "serde", "thiserror", @@ -564,12 +825,39 @@ dependencies = [ "subtle", ] +[[package]] +name = "dlv-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + [[package]] name = "dyn-clone" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" +[[package]] +name = "e2e" +version = "0.1.0" +dependencies = [ + "assert_matches", + "cosm-orc", + "cosm-tome", + "cosmwasm-std", + "env_logger", + "once_cell", + "rand", + "serde", + "serde_json", + "sg2", + "sg721", + "sg721-base", + "test-context", + "vending-factory", + "vending-minter", +] + [[package]] name = "ecdsa" version = "0.14.8" @@ -582,6 +870,27 @@ dependencies = [ "signature", ] +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "ed25519-zebra" version = "3.1.0" @@ -623,6 +932,28 @@ dependencies = [ "zeroize", ] +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "erased-serde" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ca605381c017ec7a5fef5e548f1cfaa419ed0f6df6367339300db74c92aa7d" +dependencies = [ + "serde", +] + [[package]] name = "ethereum-verify" version = "0.21.8" @@ -636,6 +967,16 @@ dependencies = [ "sha3", ] +[[package]] +name = "eyre" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "ff" version = "0.12.1" @@ -646,6 +987,22 @@ dependencies = [ "subtle", ] +[[package]] +name = "flex-error" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" +dependencies = [ + "eyre", + "paste", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -661,6 +1018,95 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" +[[package]] +name = "futures" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" + +[[package]] +name = "futures-executor" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-macro" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" + +[[package]] +name = "futures-task" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" + +[[package]] +name = "futures-util" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.14.6" @@ -678,8 +1124,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -693,6 +1141,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -712,22 +1179,184 @@ dependencies = [ ] [[package]] -name = "hex" -version = "0.4.3" +name = "headers" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" +dependencies = [ + "base64", + "bitflags", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] [[package]] -name = "hmac" -version = "0.12.1" +name = "headers-core" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "digest 0.10.6", + "http", ] [[package]] -name = "idna" +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-proxy" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca815a891b24fdfb243fa3239c86154392b0953ee584aa1a2a1f66d20cbe75cc" +dependencies = [ + "bytes", + "futures", + "headers", + "http", + "hyper", + "hyper-rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "tower-service", + "webpki", +] + +[[package]] +name = "hyper-rustls" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +dependencies = [ + "ct-logs", + "futures-util", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki", + "webpki-roots", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + +[[package]] +name = "idna" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" @@ -736,6 +1365,22 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + [[package]] name = "infinity-pool" version = "0.1.0" @@ -778,6 +1423,26 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +[[package]] +name = "js-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "k256" version = "0.11.6" @@ -788,6 +1453,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "sha2 0.10.6", + "sha3", ] [[package]] @@ -799,12 +1465,90 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matchit" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.45.0", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -814,6 +1558,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + [[package]] name = "once_cell" version = "1.17.0" @@ -826,12 +1580,152 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] + +[[package]] +name = "paste" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "peg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c0b841ea54f523f7aa556956fbd293bcbe06f2e67d2eb732b7278aaf1d166a" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5aa52829b8decbef693af90202711348ab001456803ba2a98eb4ec8fb70844c" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c719dcf55f09a3a7e764c6649ab594c18a177e3599c467983cdf644bfc0a4088" + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pest" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028accff104c4e513bad663bbcd2ad7cfd5304144404c31ed0a77ac103d00660" +dependencies = [ + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac3922aac69a40733080f53c1ce7f91dcf57e1a5f6c52f421fadec7fbdc4b69" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d06646e185566b5961b4058dd107e0a7f56e77c3f484549fb119867773c0f202" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6f60b2ba541577e2a0c307c8f39d1439108120eb7903adeb6497fa880c59616" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.6", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.9.0" @@ -873,7 +1767,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.9.0", +] + +[[package]] +name = "prost" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698" +dependencies = [ + "bytes", + "prost-derive 0.11.6", ] [[package]] @@ -889,6 +1793,29 @@ dependencies = [ "syn", ] +[[package]] +name = "prost-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e0526209433e96d83d750dd81a99118edbc55739e7e61a46764fd2ad537788" +dependencies = [ + "bytes", + "prost 0.11.6", +] + [[package]] name = "ptr_meta" version = "0.1.4" @@ -969,6 +1896,23 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + [[package]] name = "rend" version = "0.3.6" @@ -989,6 +1933,41 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "rkyv" version = "0.7.39" @@ -1014,6 +1993,27 @@ dependencies = [ "syn", ] +[[package]] +name = "ron" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +dependencies = [ + "base64", + "bitflags", + "serde", +] + +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] + [[package]] name = "rust_decimal" version = "1.28.0" @@ -1032,12 +2032,61 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" +dependencies = [ + "openssl-probe", + "rustls", + "schannel", + "security-framework", +] + +[[package]] +name = "rustversion" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" + [[package]] name = "ryu" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + [[package]] name = "schemars" version = "0.8.11" @@ -1062,6 +2111,16 @@ dependencies = [ "syn", ] +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "seahash" version = "4.1.0" @@ -1082,6 +2141,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.16" @@ -1106,6 +2188,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_bytes" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.152" @@ -1139,6 +2230,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sg-controllers" version = "0.21.8" @@ -1378,6 +2480,17 @@ dependencies = [ "sg721-base", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1432,6 +2545,31 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spki" version = "0.6.0" @@ -1449,20 +2587,174 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "subtle" -version = "2.4.1" +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "subtle-encoding" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" +dependencies = [ + "zeroize", +] + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "tendermint" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa1d2d0ec1b531ba7d196f0dbee5e78ed2a82bfba928e88dff64aeec0b26073" +dependencies = [ + "async-trait", + "bytes", + "ed25519", + "ed25519-dalek", + "flex-error", + "futures", + "k256", + "num-traits", + "once_cell", + "prost 0.11.6", + "prost-types", + "ripemd160", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto", + "time", + "zeroize", +] + +[[package]] +name = "tendermint-config" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202a2f19502c03b353d8157694ed24fbc58c3dd64a92a5b0cb80b79c82af5be4" +dependencies = [ + "flex-error", + "serde", + "serde_json", + "tendermint", + "toml", + "url", +] + +[[package]] +name = "tendermint-proto" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "974d6330a19dfa6720e9f663fc59101d207a817db3f9c730d3f31caaa565b574" +dependencies = [ + "bytes", + "flex-error", + "num-derive", + "num-traits", + "prost 0.11.6", + "prost-types", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + +[[package]] +name = "tendermint-rpc" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5d87fa5429bd2ee39c4809dd546096daf432de9b71157bc12c182ab5bae7ea7" +dependencies = [ + "async-trait", + "bytes", + "flex-error", + "futures", + "getrandom", + "http", + "hyper", + "hyper-proxy", + "hyper-rustls", + "peg", + "pin-project", + "serde", + "serde_bytes", + "serde_json", + "subtle", + "subtle-encoding", + "tendermint", + "tendermint-config", + "tendermint-proto", + "thiserror", + "time", + "tokio", + "tracing", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "test-context" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "055831a02a4f5aa28fede67f2902014273eb8c21b958ac5ebbd59b71ef30dbc3" +dependencies = [ + "async-trait", + "futures", + "test-context-macros", +] [[package]] -name = "syn" -version = "1.0.107" +name = "test-context-macros" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "8901a55b0a7a06ebc4a674dcca925170da8e613fa3b163a1df804ed10afb154d" dependencies = [ - "proc-macro2", "quote", - "unicode-ident", + "syn", ] [[package]] @@ -1515,6 +2807,32 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2" +dependencies = [ + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a460aeb8de6dcb0f381e1ee05f1cd56fcf5a5f6eb8187ff3d8f0b11078d38b7c" +dependencies = [ + "time-core", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1530,6 +2848,81 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.11" @@ -1539,12 +2932,150 @@ dependencies = [ "serde", ] +[[package]] +name = "tonic" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost 0.11.6", + "prost-derive 0.11.6", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "typenum" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "ucd-trie" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" + [[package]] name = "uint" version = "0.9.5" @@ -1578,6 +3109,18 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -1589,6 +3132,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" + [[package]] name = "vending-factory" version = "0.21.8" @@ -1646,12 +3195,116 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + [[package]] name = "whitelist-immutable" version = "0.21.8" @@ -1671,8 +3324,144 @@ dependencies = [ "thiserror", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "zeroize" version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/Cargo.toml b/Cargo.toml index 84319f4..516968f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,12 @@ [workspace] -members = ["contracts/*"] +members = ["contracts/*", "e2e"] + +[workspace.package] +version = "0.1.0" +edition = "2021" +repository = "https://github.com/tasiov/infinity-pool" +description = "An NFT AMM protocol written for CosmWasm" +license = "BUSL-1.1" [profile.release.package.infinity-pool] codegen-units = 1 diff --git a/Makefile b/Makefile index 6acd426..84b9cd5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ -.PHONY: optimize lint +.PHONY: optimize lint schema deploy-local e2etest e2etest-full -optimize: +optimize: + mkdir -p artifacts target sh scripts/optimize.sh lint: @@ -8,3 +9,22 @@ lint: schema: sh scripts/schema.sh + +deploy-local: + docker kill stargaze || true + docker volume rm -f stargaze_data + docker run --rm -d --name stargaze \ + -e DENOM=ustars \ + -e CHAINID=testing \ + -e GAS_LIMIT=$(GAS_LIMIT) \ + -p 1317:1317 \ + -p 26656:26656 \ + -p 26657:26657 \ + -p 9090:9090 \ + --mount type=volume,source=stargaze_data,target=/root \ + publicawesome/stargaze:8.0.0 /data/entry-point.sh $(TEST_ADDRS) + +e2etest: + RUST_LOG=info CONFIG=configs/cosm-orc.yaml cargo integration-test $(TEST_NAME) + +e2etest-full: deploy-local optimize e2etest diff --git a/README.md b/README.md index 9de12d3..7786f0f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ INFINITY POOL IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES Infinity Pool is an automated market maker (AMM) protocol that allows for the buying and selling of NFT assets with a specified fungible token. The buy and sell price of the NFT assets are determined by the parameters of the pool, the bonding curve, and the assets custodied by the pool. -This protocol is a derivative of the [sudoswap](https://github.com/sudoswap/lssvm) protocol written in Solidity. Infinity Pool makes use of the sudoswap design, but is written for [CosmWasm](https://github.com/CosmWasm/cosmwasm) so that it may be used on Cosmos SDK based chains. +Infinity Pool makes use of an NFT AMM design, but is written for [CosmWasm](https://github.com/CosmWasm/cosmwasm) so that it may be used on Cosmos SDK based chains. ## Features diff --git a/contracts/infinity-pool/Cargo.toml b/contracts/infinity-pool/Cargo.toml index 16911a6..53aa1c2 100644 --- a/contracts/infinity-pool/Cargo.toml +++ b/contracts/infinity-pool/Cargo.toml @@ -1,10 +1,9 @@ [package] name = "infinity-pool" -version = "0.1.0" -edition = "2021" -repository = "https://github.com/tasiov/infinity-pool" -description = "An implementation of the Sudo Swap protocol written for CosmWasm" -license = "AGPL-3.0-only" +version = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } +license = { workspace = true } exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/e2e/Cargo.toml b/e2e/Cargo.toml new file mode 100644 index 0000000..de7f949 --- /dev/null +++ b/e2e/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "e2e" +version = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } +license = { workspace = true } + + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +cosm-orc = { version = "3.0.1" } +cosm-tome = { version = "0.1.1" } +assert_matches = "1.5" +serde_json = "1.0" +env_logger = "0.9.0" +test-context = "0.1.4" +once_cell = "1.13.0" +serde = { version = "1.0", default-features = false, features = ["derive"] } +rand = "0.8" + +cosmwasm-std = "1.1.9" +sg2 = "0.21.8" +sg721 = { version = "0.21.8", features = ["library"] } +sg721-base = { version = "0.21.8", features = ["library"] } +vending-minter = { version = "0.21.8"} +vending-factory = { version = "0.21.8"} diff --git a/e2e/configs/cosm-orc.yaml b/e2e/configs/cosm-orc.yaml new file mode 100644 index 0000000..4b18ec1 --- /dev/null +++ b/e2e/configs/cosm-orc.yaml @@ -0,0 +1,7 @@ +chain_cfg: + denom: "ustars" + prefix: "stars" + chain_id: "testing" + grpc_endpoint: "http://localhost:9090/" + gas_prices: 0.1 + gas_adjustment: 1.5 diff --git a/e2e/configs/test_accounts.json b/e2e/configs/test_accounts.json new file mode 100644 index 0000000..b9a1b6c --- /dev/null +++ b/e2e/configs/test_accounts.json @@ -0,0 +1,27 @@ +[ + { + "name": "user1", + "address": "stars16z43tjws3vw06ej9v7nrszu0ldsmn0eyjnjpu8", + "mnemonic": "game cook seven draw girl special once poem rhythm seven winner praise demise trick access style bracket later tunnel slush lab false game park" + }, + { + "name": "user2", + "address": "stars1t08es9sxvjt3rmmkf426ks4ce528m0u84lyv92", + "mnemonic": "priority ozone forget detect main sheriff delay armor noble ability job front lawsuit never tooth soup wire nominee leopard country cherry ostrich language actress" + }, + { + "name": "user3", + "address": "stars1x0nystpdqr9dtcy02wh4tcmhjxjlnk009ngcs8", + "mnemonic": "wife seminar album post drive garbage ceiling robot skirt sustain notice kite just discover noble nominee one escape clean heavy general segment narrow whisper" + }, + { + "name": "user4", + "address": "stars1v3fwgyw9kgtm08dpmfrlergxzxazwqa3qqxvd7", + "mnemonic": "deposit piece interest because warm gadget pen point settle own all benefit point august garden task broom velvet noble true next impose hood traffic" + }, + { + "name": "user5", + "address": "stars1r98zsyt50k7yk86pf28xhdtf5yedkf7wm7nu0n", + "mnemonic": "follow motion improve audit hazard business decide long convince frame quality rug boil merry luxury robust whip soldier save ritual print screen border board" + } +] \ No newline at end of file diff --git a/e2e/src/helpers/chain.rs b/e2e/src/helpers/chain.rs new file mode 100644 index 0000000..3c80c67 --- /dev/null +++ b/e2e/src/helpers/chain.rs @@ -0,0 +1,125 @@ +use cosm_orc::orchestrator::{CosmosgRPC, Key, SigningKey}; +use cosm_orc::{config::cfg::Config, orchestrator::cosm_orc::CosmOrc}; +use once_cell::sync::OnceCell; +use rand::Rng; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::env; +use std::fs; +use std::path::Path; +use std::time::Duration; +use test_context::TestContext; + +static CONFIG: OnceCell = OnceCell::new(); + +#[derive(Clone, Debug)] +pub struct Cfg { + pub orc_cfg: Config, + pub users: Vec, + pub gas_report_dir: String, +} + +#[derive(Clone, Debug)] +pub struct SigningAccount { + pub account: Account, + pub key: SigningKey, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Account { + pub name: String, + pub address: String, + pub mnemonic: String, +} + +// NOTE: we have to run the integration tests in one thread right now. +// We get `account sequence mismatch` CosmosSDK errors when we run in parallel. +// If we want to parallelize them we could either serialize the `account.sequence` per key, +// or use a different key per test. + +#[derive(Clone, Debug)] +pub struct Chain { + pub cfg: Cfg, + pub orc: CosmOrc, +} + +impl TestContext for Chain { + fn setup() -> Self { + let cfg = CONFIG.get_or_init(global_setup).clone(); + let orc = CosmOrc::new(cfg.orc_cfg.clone(), true).unwrap(); + Self { cfg, orc } + } + + fn teardown(self) { + let cfg = CONFIG.get().unwrap(); + save_gas_report(&self.orc, &cfg.gas_report_dir); + } +} + +// global_setup() runs once before all of the tests: +// - loads cosm orc / test account config files +// - stores contracts on chain for all tests to reuse +fn global_setup() -> Cfg { + env_logger::init(); + + let config = env::var("CONFIG").expect("missing yaml CONFIG env var"); + let gas_report_dir = env::var("GAS_OUT_DIR").unwrap_or_else(|_| "gas_reports".to_string()); + + let mut cfg = Config::from_yaml(&config).unwrap(); + let mut orc = CosmOrc::new(cfg.clone(), true).unwrap(); + let accounts = test_accounts(); + + // Poll for first block to make sure the node is up: + orc.poll_for_n_blocks(1, Duration::from_millis(20_000), true) + .unwrap(); + + let skip_storage = env::var("SKIP_CONTRACT_STORE").unwrap_or_else(|_| "false".to_string()); + if !skip_storage.parse::().unwrap() { + orc.store_contracts("../artifacts", &accounts[0].key, None) + .unwrap(); + + save_gas_report(&orc, &gas_report_dir); + + // persist stored code_ids in CONFIG, so we can reuse for all tests + cfg.contract_deploy_info = orc.contract_map.deploy_info().clone(); + } + + Cfg { + orc_cfg: cfg, + users: accounts, + gas_report_dir, + } +} + +fn test_accounts() -> Vec { + let bytes = fs::read("configs/test_accounts.json").unwrap(); + let accounts: Vec = serde_json::from_slice(&bytes).unwrap(); + + accounts + .into_iter() + .map(|a| SigningAccount { + account: a.clone(), + key: SigningKey { + name: a.name, + key: Key::Mnemonic(a.mnemonic), + }, + }) + .collect() +} + +fn save_gas_report(orc: &CosmOrc, gas_report_dir: &str) { + let report = orc + .gas_profiler_report() + .expect("error fetching profile reports"); + + let j: Value = serde_json::to_value(report).unwrap(); + + let p = Path::new(gas_report_dir); + if !p.exists() { + fs::create_dir(p).unwrap(); + } + + let mut rng = rand::thread_rng(); + let file_name = format!("test-{}.json", rng.gen::()); + fs::write(p.join(file_name), j.to_string()).unwrap(); +} diff --git a/e2e/src/helpers/helper.rs b/e2e/src/helpers/helper.rs new file mode 100644 index 0000000..3dc68ce --- /dev/null +++ b/e2e/src/helpers/helper.rs @@ -0,0 +1,157 @@ +use super::chain::Chain; +use cosm_orc::orchestrator::cosm_orc::tokio_block; +use cosm_orc::orchestrator::error::ProcessError; +use cosm_orc::orchestrator::Coin as OrcCoin; +use cosm_orc::orchestrator::{InstantiateResponse, SigningKey}; +use cosm_tome::chain::request::TxOptions; +use cosm_tome::modules::bank::model::SendRequest; +use cosmwasm_std::{Coin, Timestamp, Uint128}; +use sg2::{ + msg::{CollectionParams, CreateMinterMsg}, + MinterParams, +}; +use sg721::CollectionInfo; +use vending_factory::{ + msg::{InstantiateMsg, VendingMinterInitMsgExtension}, + state::ParamsExtension, +}; + +// contract names used by cosm-orc to register stored code ids / instantiated addresses: +pub const SG721_NAME: &str = "sg721_base"; +pub const FACTORY_NAME: &str = "vending_factory"; +pub const MINTER_NAME: &str = "vending_minter"; + +pub const MAX_TOKENS: u32 = 10_000; +pub const CREATION_FEE: u128 = 1_000_000_000; +pub const MINT_PRICE: u128 = 100_000_000; + +pub fn instantiate_factory( + chain: &mut Chain, + creator_addr: String, + key: &SigningKey, +) -> Result { + let denom = &chain.cfg.orc_cfg.chain_cfg.denom; + + chain.orc.instantiate( + FACTORY_NAME, + "factory_inst", + &InstantiateMsg { + params: MinterParams { + code_id: chain.orc.contract_map.code_id(MINTER_NAME).unwrap(), + creation_fee: Coin { + amount: Uint128::new(CREATION_FEE), + denom: denom.to_string(), + }, + min_mint_price: Coin { + amount: Uint128::new(50), + denom: denom.to_string(), + }, + mint_fee_bps: 1000, // 10% + max_trading_offset_secs: (60 * 60) * 24, + extension: ParamsExtension { + max_token_limit: MAX_TOKENS, + max_per_address_limit: 50, + airdrop_mint_fee_bps: 0, + airdrop_mint_price: Coin { + amount: Uint128::new(0), + denom: denom.to_string(), + }, + shuffle_fee: Coin { + amount: Uint128::new(500_000_000), + denom: denom.to_string(), + }, + }, + }, + }, + key, + Some(creator_addr.parse().unwrap()), + vec![], + ) +} + +pub fn create_minter_msg( + chain: &mut Chain, + creator_addr: String, + num_tokens: u32, + limit: u32, + start_time: Timestamp, + start_trading_time: Option, +) -> CreateMinterMsg { + let denom = &chain.cfg.orc_cfg.chain_cfg.denom; + + CreateMinterMsg { + init_msg: VendingMinterInitMsgExtension { + base_token_uri: "ipfs://...".to_string(), + payment_address: Some(creator_addr.clone()), + start_time, + num_tokens, + mint_price: Coin { + amount: Uint128::new(MINT_PRICE), + denom: denom.to_string(), + }, + per_address_limit: limit, + whitelist: None, + }, + collection_params: CollectionParams { + code_id: chain.orc.contract_map.code_id(SG721_NAME).unwrap(), + name: "Collection".to_string(), + symbol: "SYM".to_string(), + info: CollectionInfo { + creator: creator_addr, + description: "Description".to_string(), + image: "https://example.com/image.png".to_string(), + start_trading_time, + external_link: None, + explicit_content: None, + royalty_info: None, + }, + }, + } +} + +// gen_users will create `num_users` random SigningKeys +// and then transfer `init_balance` of funds to each of them. +pub fn gen_users(chain: &mut Chain, num_users: u32, init_balance: u128) -> Vec { + let prefix = &chain.cfg.orc_cfg.chain_cfg.prefix; + let denom = &chain.cfg.orc_cfg.chain_cfg.denom; + let from_user = &chain.cfg.users[1]; + + let mut users = vec![]; + for n in 0..num_users { + users.push(SigningKey::random_mnemonic(n.to_string())); + } + + let mut reqs = vec![]; + for user in &users { + reqs.push(SendRequest { + from: from_user.account.address.parse().unwrap(), + to: user.to_addr(prefix).unwrap(), + amounts: vec![OrcCoin { + amount: init_balance, + denom: denom.parse().unwrap(), + }], + }); + } + + tokio_block( + chain + .orc + .client + .bank_send_batch(reqs, &from_user.key, &TxOptions::default()), + ) + .unwrap(); + + users +} + +pub fn latest_block_time(chain: &Chain) -> Timestamp { + let now = tokio_block(chain.orc.client.tendermint_query_latest_block()) + .unwrap() + .block + .header + .unwrap() + .time + .unwrap(); + + Timestamp::from_seconds(now.seconds.try_into().unwrap()) +} diff --git a/e2e/src/helpers/mod.rs b/e2e/src/helpers/mod.rs new file mode 100644 index 0000000..eb0523f --- /dev/null +++ b/e2e/src/helpers/mod.rs @@ -0,0 +1,4 @@ +pub mod chain; + +#[allow(dead_code)] +pub mod helper; diff --git a/e2e/src/lib.rs b/e2e/src/lib.rs new file mode 100644 index 0000000..af50200 --- /dev/null +++ b/e2e/src/lib.rs @@ -0,0 +1,5 @@ +// #[cfg(not(target_arch = "wasm32"))] +// mod tests; + +// #[cfg(not(target_arch = "wasm32"))] +// mod helpers; diff --git a/e2e/src/tests/factory_test.rs b/e2e/src/tests/factory_test.rs new file mode 100644 index 0000000..b553be5 --- /dev/null +++ b/e2e/src/tests/factory_test.rs @@ -0,0 +1,392 @@ +use assert_matches::assert_matches; +use cosm_orc::orchestrator::cosm_orc::tokio_block; +use cosm_orc::orchestrator::error::CosmwasmError::TxError; +use cosm_orc::orchestrator::error::ProcessError; +use cosm_orc::orchestrator::Coin as OrcCoin; +use cosm_orc::orchestrator::ExecReq; +use sg2::msg::Sg2ExecuteMsg; +use std::collections::HashMap; +use std::env; +use std::time::Duration; +use test_context::test_context; + +use crate::helpers::{ + chain::Chain, + helper::{ + create_minter_msg, gen_users, instantiate_factory, latest_block_time, CREATION_FEE, + FACTORY_NAME, MAX_TOKENS, MINT_PRICE, + }, +}; + +#[test_context(Chain)] +#[test] +#[ignore] +fn test_instantiate_factory(chain: &mut Chain) { + let user = chain.cfg.users[0].clone(); + instantiate_factory(chain, user.account.address, &user.key).unwrap(); +} + +#[test_context(Chain)] +#[test] +#[ignore] +fn test_create_minter(chain: &mut Chain) { + if env::var("ENABLE_MAX_COLLECTION").is_err() { + return; + } + + let denom = chain.cfg.orc_cfg.chain_cfg.denom.clone(); + let user = chain.cfg.users[0].clone(); + let user_addr = &user.account.address; + + instantiate_factory(chain, user_addr.to_string(), &user.key).unwrap(); + + let start_time = latest_block_time(chain).plus_seconds(60); + + let minter_msg = Sg2ExecuteMsg::CreateMinter(create_minter_msg( + chain, + user_addr.to_string(), + MAX_TOKENS, + 50, + start_time, + None, + )); + + // requires fee + let err = chain + .orc + .execute( + FACTORY_NAME, + "factory_exec_minter_inst_no_fee_err", + &minter_msg, + &user.key, + vec![], + ) + .unwrap_err(); + assert_matches!(err, ProcessError::CosmwasmError(TxError(..))); + assert!(err.to_string().contains("No funds sent")); + + // requires exact fee + let err = chain + .orc + .execute( + FACTORY_NAME, + "factory_exec_minter_inst_exact_fee_err", + &minter_msg, + &user.key, + vec![OrcCoin { + amount: 50_000_000, + denom: denom.parse().unwrap(), + }], + ) + .unwrap_err(); + assert_matches!(err, ProcessError::CosmwasmError(TxError(..))); + assert!(err.to_string().contains("Insufficient fee")); + + let start_time = latest_block_time(chain).plus_seconds(5); + + let minter_msg = Sg2ExecuteMsg::CreateMinter(create_minter_msg( + chain, + user_addr.to_string(), + MAX_TOKENS, + 50, + start_time, + None, + )); + + let res = chain + .orc + .execute( + FACTORY_NAME, + "factory_exec_minter_inst", + &minter_msg, + &user.key, + vec![OrcCoin { + amount: CREATION_FEE, + denom: denom.parse().unwrap(), + }], + ) + .unwrap(); + + let tags = res + .res + .find_event_tags("instantiate".to_string(), "_contract_address".to_string()); + + let (minter_addr, sg721_addr) = (tags[0].value.to_string(), tags[1].value.to_string()); + assert!(!minter_addr.trim().is_empty()); + assert!(!sg721_addr.trim().is_empty()); + + // generate 200 user keys and send them all enough money to each mint 50 tokens + gas + let users = gen_users(chain, 200, MINT_PRICE * 52); + + let init_balance = tokio_block( + chain + .orc + .client + .bank_query_balance(user_addr.parse().unwrap(), denom.parse().unwrap()), + ) + .unwrap() + .balance; + + // Sleep to ensure we can start minting + chain + .orc + .poll_for_n_secs(6, Duration::from_millis(20_000)) + .unwrap(); + + let mut total_mints = 0; + let mut mints: HashMap = HashMap::new(); + + let num_users = users.len() as u32; + + // Batch mint all tokens: + chain + .orc + .contract_map + .add_address("minter", minter_addr) + .unwrap(); + + for user in &users { + let mut reqs = vec![]; + for _ in 0..MAX_TOKENS / num_users { + total_mints += 1; + reqs.push(ExecReq { + contract_name: "minter".to_string(), + msg: Box::new(vending_minter::msg::ExecuteMsg::Mint {}), + funds: vec![OrcCoin { + amount: MINT_PRICE, + denom: denom.parse().unwrap(), + }], + }); + } + + let res = chain + .orc + .execute_batch("minter_batch_exec_mint_token", reqs, user) + .unwrap(); + + let token_ids = res + .res + .find_event_tags("wasm".to_string(), "token_id".to_string()); + + let mut map = HashMap::new(); + for id in token_ids { + map.insert(&id.value, true); + } + + for (token_id, _) in map { + assert_eq!(mints.get(token_id), None); + mints.insert(token_id.to_string(), true); + } + } + + for n in 1..=MAX_TOKENS { + assert_eq!(mints.get(&n.to_string()), Some(&true)); + } + assert_eq!(total_mints, MAX_TOKENS); + + let balance = tokio_block( + chain + .orc + .client + .bank_query_balance(user_addr.parse().unwrap(), denom.parse().unwrap()), + ) + .unwrap() + .balance; + + // 10k x MINT_PRICE = 1M STARS x 0.9 (10% fee) + assert_eq!(balance.amount, init_balance.amount + 900_000_000_000); + + // Cannot mint more: + let res = chain.orc.execute( + "minter", + "minter_exec_mint_token_err", + &vending_minter::msg::ExecuteMsg::Mint {}, + &chain.cfg.users[1].key, + vec![OrcCoin { + amount: MINT_PRICE, + denom: denom.parse().unwrap(), + }], + ); + + let err = res.unwrap_err(); + assert_matches!(err, ProcessError::CosmwasmError(TxError(..))); + assert!(err.to_string().contains("Sold out")); +} + +#[test_context(Chain)] +#[test] +#[ignore] +fn test_start_trading_time(chain: &mut Chain) { + let denom = chain.cfg.orc_cfg.chain_cfg.denom.clone(); + let user = chain.cfg.users[0].clone(); + let user_addr = &user.account.address; + + let initial_total_supply = + tokio_block(chain.orc.client.bank_query_supply(denom.parse().unwrap())) + .unwrap() + .balance; + + instantiate_factory(chain, user_addr.to_string(), &user.key).unwrap(); + + let start_time = latest_block_time(chain).plus_seconds(5); + + let minter_msg = Sg2ExecuteMsg::CreateMinter(create_minter_msg( + chain, + user_addr.to_string(), + 1000, + 10, + start_time, + Some(start_time.plus_seconds(60 * 60)), + )); + + let res = chain + .orc + .execute( + FACTORY_NAME, + "factory_exec_minter_inst_w_trading_time", + &minter_msg, + &user.key, + vec![OrcCoin { + amount: CREATION_FEE, + denom: denom.parse().unwrap(), + }], + ) + .unwrap(); + + let tags = res + .res + .find_event_tags("instantiate".to_string(), "_contract_address".to_string()); + + let (minter_addr, sg721_addr) = (tags[0].value.clone(), tags[1].value.clone()); + assert!(!minter_addr.trim().is_empty()); + assert!(!sg721_addr.trim().is_empty()); + + let mut total_mints = 0; + let mut total_fairburn_fees = 0; + + let fair_burn_fees = res + .res + .find_event_tags("fund_fairburn_pool".to_string(), "amount".to_string()); + + let amount = fair_burn_fees[0].value.split(&denom).collect::>()[0]; + total_fairburn_fees += amount.parse::().unwrap(); + + let users = gen_users(chain, 20, MINT_PRICE * 12); + let num_users = users.len() as u32; + + chain + .orc + .contract_map + .add_address("minter", minter_addr) + .unwrap(); + + // Sleep to ensure we can start minting + chain + .orc + .poll_for_n_secs(6, Duration::from_millis(20_000)) + .unwrap(); + + let init_balance = tokio_block( + chain + .orc + .client + .bank_query_balance(user_addr.parse().unwrap(), denom.parse().unwrap()), + ) + .unwrap() + .balance; + + for user in &users { + let mut reqs = vec![]; + for _ in 0..100 / num_users { + total_mints += 1; + reqs.push(ExecReq { + contract_name: "minter".to_string(), + msg: Box::new(vending_minter::msg::ExecuteMsg::Mint {}), + funds: vec![OrcCoin { + amount: MINT_PRICE, + denom: denom.parse().unwrap(), + }], + }); + } + + let res = chain + .orc + .execute_batch("minter_batch_exec_mint_token_w_trading_time", reqs, user) + .unwrap(); + + let fair_burn_fees = res + .res + .find_event_tags("fund_fairburn_pool".to_string(), "amount".to_string()); + + for fee in fair_burn_fees { + let amount = fee.value.split(&denom).collect::>()[0]; + total_fairburn_fees += amount.parse::().unwrap(); + } + } + + assert_eq!(total_mints, 100); + + let balance = tokio_block( + chain + .orc + .client + .bank_query_balance(user_addr.parse().unwrap(), denom.parse().unwrap()), + ) + .unwrap() + .balance; + + // 100 x MINT_PRICE = 10k STARS x 0.9 (10% fee) + assert_eq!(balance.amount, init_balance.amount + 9_000_000_000); + + // fairburn fees + // half of the 10% fees should be sent to fairburn pool + // 500STARS + 500STARS initially sent for collection creation fee + assert_eq!(total_fairburn_fees, 1_000_000_000); + + let total_supply = tokio_block(chain.orc.client.bank_query_supply(denom.parse().unwrap())) + .unwrap() + .balance; + + // the other half burned + assert_eq!( + initial_total_supply.amount - 1_000_000_000, + total_supply.amount + ); +} + +#[test_context(Chain)] +#[test] +#[ignore] +fn test_invalid_start_trading_time(chain: &mut Chain) { + let denom = chain.cfg.orc_cfg.chain_cfg.denom.clone(); + let user = chain.cfg.users[0].clone(); + let user_addr = &user.account.address; + + instantiate_factory(chain, user_addr.to_string(), &user.key).unwrap(); + + let start_time = latest_block_time(chain).plus_seconds(100_000); + + let minter_msg = Sg2ExecuteMsg::CreateMinter(create_minter_msg( + chain, + user_addr.to_string(), + 1000, + 10, + start_time, + Some(start_time.plus_seconds(60 * 60 * 24 * 365)), + )); + + let res = chain.orc.execute( + FACTORY_NAME, + "factory_exec_minter_inst_w_trading_time_err", + &minter_msg, + &user.key, + vec![OrcCoin { + amount: CREATION_FEE, + denom: denom.parse().unwrap(), + }], + ); + + let err = res.unwrap_err(); + assert_matches!(err, ProcessError::CosmwasmError(TxError(..))); + assert!(err.to_string().contains("InvalidStartTradingTime")); +} diff --git a/e2e/src/tests/mod.rs b/e2e/src/tests/mod.rs new file mode 100644 index 0000000..c6c7acc --- /dev/null +++ b/e2e/src/tests/mod.rs @@ -0,0 +1,3 @@ +pub mod sg721_test; + +pub mod factory_test; diff --git a/e2e/src/tests/sg721_test.rs b/e2e/src/tests/sg721_test.rs new file mode 100644 index 0000000..51befd0 --- /dev/null +++ b/e2e/src/tests/sg721_test.rs @@ -0,0 +1,43 @@ +use assert_matches::assert_matches; +use cosm_orc::orchestrator::error::CosmwasmError::TxError; +use cosm_orc::orchestrator::error::ProcessError; +use sg721::{CollectionInfo, InstantiateMsg}; +use test_context::test_context; + +use crate::helpers::{chain::Chain, helper::SG721_NAME}; + +#[test_context(Chain)] +#[test] +#[ignore] +fn test_unauthorized_sg721_instantiation(chain: &mut Chain) { + let user = chain.cfg.users[0].clone(); + let user_addr = &user.account.address; + + let res = chain.orc.instantiate( + SG721_NAME, + "sg721_inst_err", + &InstantiateMsg { + name: "Collection Name".to_string(), + symbol: "COL".to_string(), + minter: user_addr.to_string(), + collection_info: CollectionInfo { + creator: user_addr.to_string(), + description: "Description".to_string(), + image: "https://example.com/image.png".to_string(), + external_link: Some("https://github.com/public-awesome".to_string()), + royalty_info: None, + explicit_content: None, + start_trading_time: None, + }, + }, + &user.key, + Some(user_addr.parse().unwrap()), + vec![], + ); + + let err = res.unwrap_err(); + assert_matches!(err, ProcessError::CosmwasmError(TxError(..))); + assert!(err + .to_string() + .contains("Unauthorized: instantiate wasm contract failed")); +}