From 2c3791389c64d0fb49777d7d34ee7867ac401f53 Mon Sep 17 00:00:00 2001 From: nakul1010 Date: Thu, 31 Aug 2023 12:07:45 +0530 Subject: [PATCH] fix: added fee calculation , benchmarking, test cases, migration --- .github/ISSUE_TEMPLATE/roadmap.md | 49 + .github/workflows/benchmark.yml | 103 -- .github/workflows/projects.yml | 8 + Cargo.lock | 1052 +++++++++-------- crates/bitcoin/Cargo.toml | 3 + crates/bitcoin/src/compat.rs | 119 ++ crates/bitcoin/src/lib.rs | 3 + crates/bitcoin/src/parser.rs | 116 +- crates/bitcoin/src/script.rs | 19 + crates/currency/src/lib.rs | 1 + crates/issue/src/benchmarking.rs | 56 +- crates/issue/src/default_weights.rs | 469 ++++---- crates/issue/src/lib.rs | 149 ++- crates/issue/src/migration.rs | 126 +- crates/issue/src/tests.rs | 25 +- crates/issue/src/types.rs | 4 +- crates/redeem/src/benchmarking.rs | 83 +- crates/redeem/src/default_weights.rs | 540 ++++++--- crates/redeem/src/ext.rs | 30 +- crates/redeem/src/lib.rs | 305 ++--- crates/redeem/src/tests.rs | 16 +- crates/redeem/src/types.rs | 130 +- crates/vault-registry/src/lib.rs | 50 +- crates/vault-registry/src/tests.rs | 7 +- crates/vault-registry/src/types.rs | 130 +- parachain/runtime/interlay/src/lib.rs | 3 +- .../runtime/interlay/src/weights/issue.rs | 227 ++-- .../runtime/interlay/src/weights/redeem.rs | 229 ++-- parachain/runtime/kintsugi/src/lib.rs | 3 +- .../runtime/kintsugi/src/weights/issue.rs | 231 ++-- .../runtime/kintsugi/src/weights/redeem.rs | 230 ++-- .../runtime-tests/src/parachain/redeem.rs | 2 +- .../runtime-tests/src/parachain/replace.rs | 201 ++-- .../runtime-tests/src/utils/redeem_utils.rs | 21 + primitives/src/lib.rs | 10 +- 35 files changed, 2948 insertions(+), 1802 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/roadmap.md delete mode 100644 .github/workflows/benchmark.yml create mode 100644 crates/bitcoin/src/compat.rs diff --git a/.github/ISSUE_TEMPLATE/roadmap.md b/.github/ISSUE_TEMPLATE/roadmap.md new file mode 100644 index 0000000000..b55df6d288 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/roadmap.md @@ -0,0 +1,49 @@ +--- +name: Roadmap +about: Add a new item to the roadmap +title: '' +labels: 'roadmap' +assignees: '' + +--- + +# Abstract + +[ADD HERE] + +A 2-3 sentence description of the proposal. + +# Motivation + +[ADD HERE] + +Provide a motivation for including this proposal. + +# Specification + +[ADD HERE] + +Provide a high-level, functional specification. The specification should be focussed on what the proposal is trying to achieve. + +## [OPTIONAL]Extensions + +[OPTIONAL][ADD HERE] + +### [OPTIONAL][TITLE] + +[OPTIONAL][ADD HERE] + +# Reference Implementation + +[OPTIONAL][ADD HERE] + +Provide a reference implementation, proof of concept, or basic pseudo-code for a better grounds to discuss the suggested implementation. The reference implementation focusses on the how. + +# Security Considerations + +[ADD HERE] + +Provide reasoning around security implications: + +- The proposal itself +- The propsals implications to the existing system diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 02ef88c48e..0000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,103 +0,0 @@ -# Original source: https://github.com/AcalaNetwork/Acala/blob/master/.github/workflows/benchmark.yml - -name: Benchmark -on: - issue_comment: - types: [created] -permissions: - pull-requests: write - contents: write -jobs: - benchmark: - name: Benchmark - if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/benchmark') }} - runs-on: [self-hosted, linux] - steps: - - uses: actions/github-script@v6 - name: Get PR branch - id: issue - with: - script: | - const pr = context.payload.issue.number - const data = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: pr - }) - return { - ref: data.data.head.ref, - sha: data.data.head.sha, - } - - uses: actions/checkout@v3 - with: - submodules: recursive - ref: ${{ fromJson(steps.issue.outputs.result).sha }} - - uses: actions/github-script@v6 - name: Prepare command - id: command - with: - result-encoding: string - # /benchmark CHAIN_NAME [PALLET_NAME] - script: | - const [cmd, ...args] = context.payload.comment.body.split(" ") - const [runtime, pallet] = args - return `bash ./scripts/benchmark.sh -r ${runtime ?? ""} -p ${pallet ?? ""}` - - uses: actions/github-script@v6 - name: Post comment - id: comment - with: - script: | - const data = await github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: ` - **Request**: \`${context.payload.comment.body}\` - **Command**: \`${{steps.command.outputs.result}}\` - - Running... - ` - }) - return data.data.id - - name: Set variables - run: | - echo "TOOLCHAIN=$(rustup show active-toolchain | cut -d " " -f1)" >> $GITHUB_ENV - - name: Install toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.TOOLCHAIN }} - components: rustfmt - target: wasm32-unknown-unknown - - name: Run benchmarks - run: ${{steps.command.outputs.result}} > ${{runner.temp}}/out.txt - - name: Commit new weights - run: | - git config user.email "contact@interlay.io" - git config user.name "Interlay Bot" - git add . - git commit -m '${{github.event.comment.body}}' --allow-empty - git push origin HEAD:${{ fromJson(steps.issue.outputs.result).ref }} - - uses: actions/github-script@v6 - name: Update comment - with: - script: | - const fs = require('fs') - const id = `${{steps.comment.outputs.result}}` - const body = fs.readFileSync('${{runner.temp}}/out.txt').toString() - github.rest.issues.updateComment({ - comment_id: id, - owner: context.repo.owner, - repo: context.repo.repo, - body: ` - **Request**: \`${context.payload.comment.body}\` - **Command**: \`${{steps.command.outputs.result}}\` - -
- Results - - \`\`\` - ${body.trim()} - \`\`\` -
- ` - }) diff --git a/.github/workflows/projects.yml b/.github/workflows/projects.yml index 79ef63c9b4..af4deb91e2 100644 --- a/.github/workflows/projects.yml +++ b/.github/workflows/projects.yml @@ -14,3 +14,11 @@ jobs: with: project-url: https://github.com/orgs/interlay/projects/3 github-token: ${{ secrets.PROJECTS }} + label: roadmap + label-operator: NOT + - uses: actions/add-to-project@v0.5.0 + with: + project-url: https://github.com/orgs/interlay/projects/4 + github-token: ${{ secrets.PROJECTS }} + label: roadmap + label-operator: OR diff --git a/Cargo.lock b/Cargo.lock index 60c064526d..0a232f29b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,11 +23,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.19.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli 0.27.3", + "gimli 0.28.0", ] [[package]] @@ -172,18 +172,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "aho-corasick" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" dependencies = [ "memchr", ] @@ -287,9 +278,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -297,9 +288,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "approx" @@ -359,7 +350,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.22", + "time 0.3.27", ] [[package]] @@ -375,7 +366,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.22", + "time 0.3.27", ] [[package]] @@ -427,9 +418,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -450,7 +441,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.20", + "rustix 0.37.23", "slab", "socket2 0.4.9", "waker-fn", @@ -458,9 +449,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] @@ -473,31 +464,31 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "asynchronous-codec" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" dependencies = [ "bytes", "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", ] [[package]] @@ -555,16 +546,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line 0.19.0", + "addr2line 0.21.0", "cc", "cfg-if", "libc", - "miniz_oxide 0.6.2", - "object 0.30.4", + "miniz_oxide", + "object 0.32.0", "rustc-demangle", ] @@ -610,6 +601,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "beef" version = "0.5.2" @@ -643,7 +640,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -672,11 +669,26 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitcoin" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e99ff7289b20a7385f66a0feda78af2fc119d28fb56aea8886a9cd0a4abdd75" +dependencies = [ + "bech32", + "bitcoin-private", + "bitcoin_hashes 0.12.0", + "core2 0.3.3", + "hex_lit", + "secp256k1 0.27.0", +] + [[package]] name = "bitcoin" version = "1.2.0" dependencies = [ - "bitcoin_hashes", + "bitcoin 0.30.1", + "bitcoin_hashes 0.7.6", "frame-support", "hex", "impl-serde 0.3.2", @@ -690,18 +702,40 @@ dependencies = [ "spin 0.7.1", ] +[[package]] +name = "bitcoin-private" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" + [[package]] name = "bitcoin_hashes" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b375d62f341cef9cd9e77793ec8f1db3fc9ce2e4d57e982c8fe697a2c16af3b6" +[[package]] +name = "bitcoin_hashes" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501" +dependencies = [ + "bitcoin-private", + "core2 0.3.3", +] + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "bitvec" version = "1.0.1" @@ -731,7 +765,7 @@ checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq", + "constant_time_eq 0.2.6", ] [[package]] @@ -742,20 +776,20 @@ checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq", + "constant_time_eq 0.2.6", ] [[package]] name = "blake3" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" dependencies = [ "arrayref", "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq", + "constant_time_eq 0.3.0", "digest 0.10.7", ] @@ -843,9 +877,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", "serde", @@ -861,7 +895,7 @@ checksum = "bd769563b4ea2953e2825c9e6b7470a5f55f67e0be00030bf3e390a2a6071f64" name = "btc-relay" version = "1.2.0" dependencies = [ - "bitcoin", + "bitcoin 1.2.0", "frame-benchmarking", "frame-support", "frame-system", @@ -959,18 +993,18 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" dependencies = [ "serde", ] @@ -983,7 +1017,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "thiserror", @@ -991,11 +1025,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -1085,7 +1120,7 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ - "core2", + "core2 0.4.0", "multibase", "multihash 0.16.3", "serde", @@ -1142,9 +1177,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.9" +version = "4.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" +checksum = "03aef18ddf7d879c15ce20f04826ef8418101c7e528014c3eeea13321047dca3" dependencies = [ "clap_builder", "clap_derive", @@ -1153,27 +1188,26 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.9" +version = "4.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" +checksum = "f8ce6fffb678c9b80a70b6b6de0aad31df727623a70fd9a842c30cd573e2fa98" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -1208,7 +1242,7 @@ version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1300,9 +1334,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "constant_time_eq" @@ -1310,6 +1344,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "convert_case" version = "0.4.0" @@ -1332,6 +1372,15 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "core2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239fa3ae9b63c2dc74bd3fa852d4792b8b305ae64eeede946265b6af62f1fff3" +dependencies = [ + "memchr", +] + [[package]] name = "core2" version = "0.4.0" @@ -1362,9 +1411,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1900,7 +1949,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -2185,23 +2234,36 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" +checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" dependencies = [ "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", "fiat-crypto", - "packed_simd_2", "platforms 3.0.2", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "cxx" -version = "1.0.97" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88abab2f5abbe4c56e8f1fb431b784d710b709888f35755a160e62e33fe38e8" +checksum = "28403c86fc49e3401fdf45499ba37fad6493d9329449d6449d7f0e10f4654d28" dependencies = [ "cc", "cxxbridge-flags", @@ -2211,9 +2273,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.97" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0c11acd0e63bae27dcd2afced407063312771212b7a823b4fd72d633be30fb" +checksum = "78da94fef01786dc3e0c76eafcd187abcaa9972c78e05ff4041e24fdf059c285" dependencies = [ "cc", "codespan-reporting", @@ -2221,24 +2283,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "cxxbridge-flags" -version = "1.0.97" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3816ed957c008ccd4728485511e3d9aaf7db419aa321e3d2c5a2f3411e36c8" +checksum = "e2a6f5e1dfb4b34292ad4ea1facbfdaa1824705b231610087b00b17008641809" [[package]] name = "cxxbridge-macro" -version = "1.0.97" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26acccf6f445af85ea056362561a24ef56cdc15fcc685f03aec50b9c702cb6d" +checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -2337,9 +2399,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", "zeroize", @@ -2373,6 +2435,12 @@ dependencies = [ "rusticata-macros", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + [[package]] name = "derivative" version = "2.2.0" @@ -2646,7 +2714,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -2669,9 +2737,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dyn-clonable" @@ -2696,9 +2764,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" [[package]] name = "ecdsa" @@ -2714,11 +2782,11 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ - "der 0.7.6", + "der 0.7.8", "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", @@ -2765,9 +2833,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" dependencies = [ "serde", ] @@ -2808,7 +2876,7 @@ dependencies = [ "group 0.13.0", "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1 0.7.2", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -2848,18 +2916,18 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "enumn" -version = "0.1.8" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" +checksum = "b893c4eb2dc092c811165f84dc7447fae16fb66521717968c34c509b39b1a5c5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -2896,15 +2964,15 @@ checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" [[package]] name = "equivalent" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" dependencies = [ "errno-dragonfly", "libc", @@ -3130,7 +3198,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -3178,6 +3246,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "fatality" version = "0.0.6" @@ -3206,7 +3280,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "async-trait", "fp-consensus", @@ -3222,7 +3296,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "async-trait", "ethereum", @@ -3252,7 +3326,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "fc-db", "fc-storage", @@ -3275,7 +3349,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "ethereum-types", @@ -3325,7 +3399,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "ethereum-types", @@ -3338,7 +3412,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "ethereum-types", @@ -3428,13 +3502,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] @@ -3484,13 +3558,13 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -3555,7 +3629,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "hex", "impl-serde 0.4.0", @@ -3574,7 +3648,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "parity-scale-codec", @@ -3586,7 +3660,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "ethereum-types", @@ -3600,7 +3674,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "evm", "frame-support", @@ -3615,7 +3689,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "ethereum-types", @@ -3632,7 +3706,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "frame-support", "parity-scale-codec", @@ -3644,7 +3718,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "parity-scale-codec", "serde", @@ -3736,7 +3810,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -3810,7 +3884,7 @@ name = "frame-support" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "bitflags", + "bitflags 1.3.2", "environmental", "frame-metadata", "frame-support-procedural", @@ -3851,7 +3925,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -3863,7 +3937,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -3873,7 +3947,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -3948,11 +4022,11 @@ dependencies = [ [[package]] name = "fs4" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7672706608ecb74ab2e055c68327ffc25ae4cac1e12349204fd5fb0f3487cce2" +checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "rustix 0.37.20", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -4034,12 +4108,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "waker-fn", ] @@ -4051,7 +4125,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -4096,7 +4170,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "pin-utils", "slab", ] @@ -4195,9 +4269,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "glob" @@ -4207,11 +4281,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "bstr", "fnv", "log", @@ -4242,9 +4316,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -4351,18 +4425,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -4401,6 +4466,12 @@ dependencies = [ "proc-macro-hack", ] +[[package]] +name = "hex_lit" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" + [[package]] name = "hkdf" version = "0.12.3" @@ -4480,14 +4551,14 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", ] [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -4497,9 +4568,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -4523,7 +4594,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "socket2 0.4.9", "tokio", "tower-service", @@ -4702,9 +4773,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "indicatif" -version = "0.17.5" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff8cc23a7393a397ed1d7f56e6365cba772aba9f9912ab968b03043c395d057" +checksum = "0b297dc40733f23a0e52728a58fa9489a5b7638a324932de16b41adc3ef80730" dependencies = [ "console", "instant", @@ -4751,7 +4822,7 @@ name = "interbtc-parachain" version = "1.2.0" dependencies = [ "async-trait", - "bitcoin", + "bitcoin 1.2.0", "btc-relay-rpc-runtime-api", "clap", "cumulus-client-cli", @@ -4851,7 +4922,7 @@ dependencies = [ name = "interbtc-primitives" version = "1.2.0" dependencies = [ - "bitcoin", + "bitcoin 1.2.0", "bstringify", "parity-scale-codec", "primitive-types", @@ -4928,7 +4999,7 @@ name = "interlay-runtime-parachain" version = "1.2.0" dependencies = [ "annuity", - "bitcoin", + "bitcoin 1.2.0", "btc-relay", "btc-relay-rpc-runtime-api", "clients-info", @@ -5048,7 +5119,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] @@ -5079,13 +5150,12 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.37.20", + "hermit-abi 0.3.2", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -5093,7 +5163,7 @@ dependencies = [ name = "issue" version = "1.2.0" dependencies = [ - "bitcoin", + "bitcoin 1.2.0", "btc-relay", "currency", "fee", @@ -5156,9 +5226,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -5329,7 +5399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "once_cell", "sha2 0.10.7", @@ -5349,7 +5419,7 @@ name = "kintsugi-runtime-parachain" version = "1.2.0" dependencies = [ "annuity", - "bitcoin", + "bitcoin 1.2.0", "btc-relay", "btc-relay-rpc-runtime-api", "clients-info", @@ -5639,12 +5709,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - [[package]] name = "libm" version = "0.2.7" @@ -6228,9 +6292,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "pkg-config", @@ -6239,9 +6303,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" dependencies = [ "cc", ] @@ -6263,9 +6327,9 @@ dependencies = [ [[package]] name = "linregress" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475015a7f8f017edb28d2e69813be23500ad4b32cfe3421c4148efc97324ee52" +checksum = "4de0b5f52a9f84544d268f5fabb71b38962d6aa3c6600b8bcd27d44ccf9c9c45" dependencies = [ "nalgebra", ] @@ -6282,6 +6346,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "loans" version = "1.9.3" @@ -6351,9 +6421,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lru" @@ -6429,7 +6499,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -6469,7 +6539,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.20", + "rustix 0.37.23", ] [[package]] @@ -6543,15 +6613,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -6735,7 +6796,7 @@ dependencies = [ "blake2b_simd", "blake2s_simd", "blake3", - "core2", + "core2 0.4.0", "digest 0.10.7", "multihash-derive", "sha2 0.10.7", @@ -6749,7 +6810,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" dependencies = [ - "core2", + "core2 0.4.0", "multihash-derive", "unsigned-varint", ] @@ -6790,9 +6851,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.32.2" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d47bba83f9e2006d117a9a33af1524e655516b8919caac694427a6fb1e511" +checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" dependencies = [ "approx", "matrixmultiply", @@ -6806,9 +6867,9 @@ dependencies = [ [[package]] name = "nalgebra-macros" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d232c68884c0c99810a5a4d333ef7e47689cfd0edc85efc9e54e1e6bf5212766" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" dependencies = [ "proc-macro2", "quote", @@ -6867,7 +6928,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags", + "bitflags 1.3.2", "byteorder", "libc", "netlink-packet-core", @@ -6920,7 +6981,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -6995,9 +7056,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg 1.1.0", "num-integer", @@ -7006,9 +7067,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -7058,21 +7119,21 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg 1.1.0", - "libm 0.2.7", + "libm", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] @@ -7094,7 +7155,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -7117,9 +7178,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.4" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" dependencies = [ "memchr", ] @@ -7162,11 +7223,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -7183,7 +7244,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -7194,9 +7255,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" dependencies = [ "cc", "libc", @@ -7489,16 +7550,6 @@ dependencies = [ "sha2 0.10.7", ] -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if", - "libm 0.1.4", -] - [[package]] name = "pallet-aura" version = "4.0.0-dev" @@ -7607,7 +7658,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "fp-evm", "frame-support", @@ -7720,7 +7771,7 @@ name = "pallet-contracts" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "bitflags", + "bitflags 1.3.2", "environmental", "frame-benchmarking", "frame-support", @@ -7749,7 +7800,7 @@ name = "pallet-contracts-primitives" version = "7.0.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "bitflags", + "bitflags 1.3.2", "parity-scale-codec", "scale-info", "sp-runtime", @@ -7764,7 +7815,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -7859,7 +7910,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "ethereum", "ethereum-types", @@ -7882,7 +7933,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "environmental", "evm", @@ -7907,7 +7958,7 @@ dependencies = [ [[package]] name = "pallet-evm-chain-id" version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "frame-support", "frame-system", @@ -7918,7 +7969,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "fp-evm", "frame-support", @@ -7928,7 +7979,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "fp-evm", "num", @@ -7937,7 +7988,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "fp-evm", "tiny-keccak", @@ -7946,7 +7997,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#1a718546085be20ce381b70e1f9e4c8b4d4b1f03" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42#2499d18c936edbcb7fcb711827db7abb9b4f4da4" dependencies = [ "fp-evm", "ripemd", @@ -8385,7 +8436,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -8638,7 +8689,7 @@ name = "parachain-tests" version = "1.2.0" dependencies = [ "annuity", - "bitcoin", + "bitcoin 1.2.0", "btc-relay", "btc-relay-rpc-runtime-api", "clients-info", @@ -8764,9 +8815,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4890dcb9556136a4ec2b0c51fa4a08c8b733b829506af8fff2e853f3a065985b" +checksum = "78f19d20a0d2cc52327a88d131fa1c4ea81ea4a04714aedcfeca2dd410049cf8" dependencies = [ "blake2", "crc32fast", @@ -8784,9 +8835,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.1" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" +checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -8799,9 +8850,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.1" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" +checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8872,14 +8923,14 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -8931,9 +8982,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" +checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" dependencies = [ "thiserror", "ucd-trie", @@ -8941,9 +8992,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" +checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" dependencies = [ "pest", "pest_generator", @@ -8951,22 +9002,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" +checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "pest_meta" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" +checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" dependencies = [ "once_cell", "pest", @@ -8975,32 +9026,32 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 1.9.3", + "indexmap 2.0.0", ] [[package]] name = "pin-project" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -9011,9 +9062,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" [[package]] name = "pin-utils" @@ -9037,7 +9088,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.6", + "der 0.7.8", "spki 0.7.2", ] @@ -10050,7 +10101,7 @@ name = "polkadot-runtime-parachains" version = "0.9.42" source = "git+https://github.com/paritytech//polkadot?branch=release-v0.9.42#6f991987c0b4cbbd7d4badc9ef08d83da5fefbfd" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bitvec", "derive_more", "frame-benchmarking", @@ -10237,12 +10288,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg 1.1.0", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "windows-sys 0.48.0", ] @@ -10283,9 +10334,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" +checksum = "f32154ba0af3a075eefa1eda8bb414ee928f62303a54ea85b8d6638ff1a6ee9e" [[package]] name = "ppv-lite86" @@ -10423,14 +10474,14 @@ checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -10479,7 +10530,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", @@ -10596,9 +10647,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" +checksum = "f31999cfc7927c4e212e60fd50934ab40e8e8bfd2d493d6095d2d306bc0764d9" dependencies = [ "bytes", "rand 0.8.5", @@ -10614,9 +10665,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -10858,7 +10909,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.22", + "time 0.3.27", "x509-parser 0.13.2", "yasna", ] @@ -10871,7 +10922,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.22", + "time 0.3.27", "yasna", ] @@ -10888,7 +10939,7 @@ dependencies = [ name = "redeem" version = "1.2.0" dependencies = [ - "bitcoin", + "bitcoin 1.2.0", "btc-relay", "currency", "fee", @@ -10946,7 +10997,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -10955,7 +11006,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -10984,22 +11035,22 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.16" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.16" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -11016,13 +11067,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.4" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", - "regex-syntax 0.7.2", + "regex-automata 0.3.6", + "regex-syntax 0.7.4", ] [[package]] @@ -11034,6 +11086,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -11042,9 +11105,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "region" @@ -11052,7 +11115,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "mach", "winapi", @@ -11425,7 +11488,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver 1.0.18", ] [[package]] @@ -11439,11 +11502,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.14" +version = "0.36.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" +checksum = "c37f1bd5ef1b5422177b7646cba67430579cfe2ace80f284fee876bca52ad941" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -11453,11 +11516,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.20" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -11465,6 +11528,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustix" +version = "0.38.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys 0.4.5", + "windows-sys 0.48.0", +] + [[package]] name = "rustls" version = "0.19.1" @@ -11513,9 +11589,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rusty-fork" @@ -11542,15 +11618,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safe_arch" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a7484307bd40f8f7ccbacccac730108f2cae119a3b11c74485b48aa9ea650f" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" dependencies = [ "bytemuck", ] @@ -11668,7 +11744,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -12119,7 +12195,7 @@ dependencies = [ "libc", "log", "once_cell", - "rustix 0.36.14", + "rustix 0.36.15", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -12230,7 +12306,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "array-bytes 4.2.0", "async-trait", - "bitflags", + "bitflags 1.3.2", "bytes", "futures", "futures-timer", @@ -12678,7 +12754,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -12802,9 +12878,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" dependencies = [ "bitvec", "cfg-if", @@ -12816,9 +12892,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12828,11 +12904,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -12866,15 +12942,15 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "sct" @@ -12924,12 +13000,12 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", - "der 0.7.6", + "der 0.7.8", "generic-array 0.14.7", "pkcs8 0.10.2", "subtle", @@ -12954,6 +13030,16 @@ dependencies = [ "secp256k1-sys 0.6.1", ] +[[package]] +name = "secp256k1" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +dependencies = [ + "bitcoin_hashes 0.12.0", + "secp256k1-sys 0.8.1", +] + [[package]] name = "secp256k1-sys" version = "0.4.0" @@ -12971,6 +13057,15 @@ dependencies = [ "cc", ] +[[package]] +name = "secp256k1-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +dependencies = [ + "cc", +] + [[package]] name = "secrecy" version = "0.8.0" @@ -13000,11 +13095,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -13013,9 +13108,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -13032,9 +13127,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] @@ -13047,29 +13142,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "dc59dfdcbad1437773485e0367fea4b090a2e0a16d9ffc46af47764536a298ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] name = "serde_json" -version = "1.0.99" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -13214,15 +13309,15 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg 1.1.0", ] @@ -13256,9 +13351,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "snap" @@ -13268,14 +13363,14 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" +checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.1", + "curve25519-dalek 4.0.0", "rand_core 0.6.4", "ring", "rustc_version", @@ -13351,7 +13446,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -13533,7 +13628,7 @@ version = "7.0.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ "array-bytes 4.2.0", - "bitflags", + "bitflags 1.3.2", "blake2", "bounded-collections", "bs58", @@ -13593,7 +13688,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -13621,7 +13716,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -13707,7 +13802,7 @@ version = "4.1.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ "thiserror", - "zstd 0.12.3+zstd.1.5.2", + "zstd 0.12.4", ] [[package]] @@ -13832,7 +13927,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -14000,7 +14095,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -14081,7 +14176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.6", + "der 0.7.8", ] [[package]] @@ -14207,9 +14302,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.40.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" +checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" dependencies = [ "Inflector", "num-format", @@ -14274,7 +14369,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg_aliases", "libc", "parking_lot 0.11.2", @@ -14452,7 +14547,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum", "tempfile", - "toml 0.7.5", + "toml 0.7.6", "walkdir", "wasm-opt", ] @@ -14506,9 +14601,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.22" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -14533,7 +14628,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] @@ -14556,21 +14651,20 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ - "autocfg 1.1.0", "cfg-if", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix 0.37.20", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -14591,22 +14685,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -14649,9 +14743,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-ctl" -version = "0.5.0" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37706572f4b151dff7a0146e040804e9c26fe3a3118591112f05cf12a4216c1" +checksum = "619bfed27d807b54f7f776b9430d4f8060e66ee138a28632ca898584d462c31c" dependencies = [ "libc", "paste", @@ -14660,9 +14754,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.5.3+5.3.0-patched" +version = "0.5.4+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" dependencies = [ "cc", "libc", @@ -14681,10 +14775,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.22" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" dependencies = [ + "deranged", "itoa", "serde", "time-core", @@ -14699,9 +14794,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" dependencies = [ "time-core", ] @@ -14761,20 +14856,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374442f06ee49c3a28a8fc9f01a2596fed7559c6b99b31279c3261778e77d84f" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg 1.1.0", "backtrace", "bytes", "libc", "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "signal-hook-registry", - "socket2 0.4.9", + "socket2 0.5.3", "tokio-macros", "windows-sys 0.48.0", ] @@ -14787,7 +14881,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -14808,7 +14902,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "tokio", "tokio-util", ] @@ -14823,7 +14917,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "tokio", "tracing", ] @@ -14839,9 +14933,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebafdf5ad1220cb59e7d17cf4d2c72015297b75b19a10472f99b89225089240" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -14860,9 +14954,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.11" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "serde", @@ -14888,14 +14982,14 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-util", "http", "http-body", "http-range-header", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "tower-layer", "tower-service", ] @@ -14920,7 +15014,7 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.12", "tracing-attributes", "tracing-core", ] @@ -14933,7 +15027,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -14976,7 +15070,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -15161,7 +15255,7 @@ dependencies = [ "sp-version", "sp-weights", "substrate-rpc-client", - "zstd 0.12.3+zstd.1.5.2", + "zstd 0.12.4", ] [[package]] @@ -15227,9 +15321,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uint" @@ -15257,9 +15351,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -15351,9 +15445,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom 0.2.10", ] @@ -15368,7 +15462,7 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" name = "vault-registry" version = "1.2.0" dependencies = [ - "bitcoin", + "bitcoin 1.2.0", "currency", "fee", "fixed-hash 0.7.0", @@ -15534,7 +15628,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", "wasm-bindgen-shared", ] @@ -15568,7 +15662,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -15698,7 +15792,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ "downcast-rs", - "libm 0.2.7", + "libm", "memory_units", "num-rational", "num-traits", @@ -15712,7 +15806,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" dependencies = [ "downcast-rs", - "libm 0.2.7", + "libm", "num-traits", "paste", ] @@ -15785,7 +15879,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.36.14", + "rustix 0.36.15", "serde", "sha2 0.10.7", "toml 0.5.11", @@ -15865,7 +15959,7 @@ checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" dependencies = [ "object 0.29.0", "once_cell", - "rustix 0.36.14", + "rustix 0.36.15", ] [[package]] @@ -15896,7 +15990,7 @@ dependencies = [ "memoffset 0.6.5", "paste", "rand 0.8.5", - "rustix 0.36.14", + "rustix 0.36.15", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -15980,7 +16074,7 @@ dependencies = [ "sha2 0.10.7", "stun", "thiserror", - "time 0.3.22", + "time 0.3.27", "tokio", "turn", "url", @@ -16012,9 +16106,9 @@ dependencies = [ [[package]] name = "webrtc-dtls" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05" +checksum = "c4a00f4242f2db33307347bd5be53263c52a0331c96c14292118c9a6bb48d267" dependencies = [ "aes 0.6.0", "aes-gcm 0.10.2", @@ -16029,12 +16123,11 @@ dependencies = [ "hkdf", "hmac 0.12.1", "log", - "oid-registry 0.6.1", "p256", "p384", "rand 0.8.5", "rand_core 0.6.4", - "rcgen 0.9.3", + "rcgen 0.10.0", "ring", "rustls 0.19.1", "sec1 0.3.0", @@ -16047,7 +16140,7 @@ dependencies = [ "tokio", "webpki 0.21.4", "webrtc-util", - "x25519-dalek 2.0.0-pre.1", + "x25519-dalek 2.0.0", "x509-parser 0.13.2", ] @@ -16149,7 +16242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" dependencies = [ "async-trait", - "bitflags", + "bitflags 1.3.2", "bytes", "cc", "ipnet", @@ -16282,9 +16375,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40018623e2dba2602a9790faba8d33f2ebdebf4b86561b83928db735f8784728" +checksum = "aa469ffa65ef7e0ba0f164183697b89b854253fd31aeb92358b7b6155177d62f" dependencies = [ "bytemuck", "safe_arch", @@ -16346,7 +16439,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -16379,7 +16472,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -16399,17 +16492,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -16420,9 +16513,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -16438,9 +16531,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -16456,9 +16549,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -16474,9 +16567,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -16492,9 +16585,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -16504,9 +16597,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -16522,15 +16615,15 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" dependencies = [ "memchr", ] @@ -16567,12 +16660,13 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.0.0", "rand_core 0.6.4", + "serde", "zeroize", ] @@ -16592,7 +16686,7 @@ dependencies = [ "ring", "rusticata-macros", "thiserror", - "time 0.3.22", + "time 0.3.27", ] [[package]] @@ -16610,7 +16704,7 @@ dependencies = [ "oid-registry 0.6.1", "rusticata-macros", "thiserror", - "time 0.3.22", + "time 0.3.27", ] [[package]] @@ -16704,7 +16798,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -16744,7 +16838,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.22", + "time 0.3.27", ] [[package]] @@ -16764,7 +16858,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.29", ] [[package]] @@ -16778,11 +16872,11 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.3+zstd.1.5.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" dependencies = [ - "zstd-safe 6.0.5+zstd.1.5.4", + "zstd-safe 6.0.6", ] [[package]] @@ -16797,9 +16891,9 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.5+zstd.1.5.4" +version = "6.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" dependencies = [ "libc", "zstd-sys", diff --git a/crates/bitcoin/Cargo.toml b/crates/bitcoin/Cargo.toml index da310e6bc8..24ead977cc 100644 --- a/crates/bitcoin/Cargo.toml +++ b/crates/bitcoin/Cargo.toml @@ -15,6 +15,7 @@ spin = { version = "0.7.1", default-features = false } primitive-types = { version = "0.12.1", default-features = false, features = ["codec", "scale-info"] } bitcoin_hashes = { version = "0.7.3", default-features = false } secp256k1 = { package = "secp256k1", git = "https://github.com/rust-bitcoin/rust-secp256k1", rev = "8e61874", default-features = false } +rust-bitcoin = { package = "bitcoin", version = "0.30.1", default-features = false, features = ["no-std"], optional = true } [dev-dependencies] mocktopus = "0.8.0" @@ -33,9 +34,11 @@ std = [ "primitive-types/std", "primitive-types/serde", "secp256k1/std", + "rust-bitcoin?/std" ] parser = [] runtime-benchmarks = [] +bitcoin-types-compat = ["rust-bitcoin", "parser"] [[example]] name = "parse-transaction" diff --git a/crates/bitcoin/src/compat.rs b/crates/bitcoin/src/compat.rs new file mode 100644 index 0000000000..940229e3f5 --- /dev/null +++ b/crates/bitcoin/src/compat.rs @@ -0,0 +1,119 @@ +//! Provides conversions between rust-bitcoin and interbtc types. +//! Please note that these operations involve (unbounded) re-encoding +//! and decoding so may be expensive to use. + +use crate::{formatter::TryFormat, parser::Parsable}; +use rust_bitcoin::consensus::{Decodable, Encodable}; + +pub use rust_bitcoin; + +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; + +#[derive(Debug)] +pub enum ConversionError { + ParsingError, + FormattingError, +} + +/// Macro to implement type conversion from interbtc types to rust-bitcoin, using consensus encoding +macro_rules! impl_bitcoin_conversion { + ($a:path, $b:path) => { + impl TryFrom<$a> for $b { + type Error = ConversionError; + fn try_from(value: $a) -> Result { + let mut bytes = Vec::::new(); + value + .try_format(&mut bytes) + .map_err(|_| ConversionError::FormattingError)?; + let result = Self::consensus_decode_from_finite_reader(&mut &bytes[..]) + .map_err(|_| ConversionError::ParsingError)?; + Ok(result) + } + } + }; +} + +/// Macro to implement type conversion to interbtc types from rust-bitcoin, using consensus encoding +macro_rules! impl_interbtc_conversion { + ($a:path, $b:path) => { + impl TryFrom<$b> for $a { + type Error = ConversionError; + fn try_from(value: $b) -> Result { + let mut data: Vec = Vec::new(); + value + .consensus_encode(&mut data) + .map_err(|_| ConversionError::FormattingError)?; + let result = Self::parse(&data, 0).map_err(|_| ConversionError::ParsingError)?; + Ok(result.0) + } + } + }; +} + +macro_rules! impl_bidirectional_conversions { + ($a:path, $b:path) => { + impl_bitcoin_conversion!($a, $b); + impl_interbtc_conversion!($a, $b); + }; +} + +// NOTE: rust_bitcoin::Script exists but we can't convert to that because it's unsized +impl_bitcoin_conversion!(crate::Script, rust_bitcoin::ScriptBuf); + +// Transaction conversions +impl_bidirectional_conversions!(crate::types::Transaction, rust_bitcoin::Transaction); + +// Payload -> Address +impl TryFrom for crate::Address { + type Error = ConversionError; + fn try_from(value: rust_bitcoin::address::Payload) -> Result { + let bitcoin_script = value.script_pubkey(); + let bitcoin_script_bytes = bitcoin_script.to_bytes(); + let interlay_script = crate::Script::from(bitcoin_script_bytes); + crate::Address::from_script_pub_key(&interlay_script).map_err(|_| ConversionError::ParsingError) + } +} + +// Address -> Payload +impl TryFrom for rust_bitcoin::address::Payload { + type Error = ConversionError; + fn try_from(value: crate::Address) -> Result { + let interlay_script = value.to_script_pub_key(); + let bitcoin_script = rust_bitcoin::blockdata::script::Script::from_bytes(interlay_script.as_bytes()); + rust_bitcoin::address::Payload::from_script(&bitcoin_script).map_err(|_| ConversionError::ParsingError) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::parser::parse_transaction; + + #[test] + fn test_transaction_compat() { + // txid eb3db053cd139147f2fd676cf59a491fd5aebc54bddfde829704585b659126fc + let raw_tx = "0100000000010120e6fb8f0e2cfb8667a140a92d045d5db7c1b56635790bc907c3e71d43720a150e00000017160014641e441c2ba32dd7cf05afde7922144dd106b09bffffffff019dbd54000000000017a914bd847a4912984cf6152547feca51c1b9c2bcbe2787024830450221008f00033064c26cfca4dc98e5dba800b18729c3441dca37b49358ae0df9be7fad02202a81085318466ea66ef390d5dab6737e44a05f7f2e747932ebba917e0098f37d012102c109fc47335c3a2e206d462ad52590b1842aa9d6e0eb9c683c896fa8723590b400000000"; + let tx_bytes = hex::decode(&raw_tx).unwrap(); + let interlay_transaction = parse_transaction(&tx_bytes).unwrap(); + + let rust_bitcoin_transaction: rust_bitcoin::Transaction = interlay_transaction.clone().try_into().unwrap(); + + // check that the rust-bitcoin type encodes to the same bytes + let mut re_encoded_bytes: Vec = Vec::new(); + rust_bitcoin_transaction + .consensus_encode(&mut re_encoded_bytes) + .unwrap(); + assert_eq!(tx_bytes, re_encoded_bytes); + + // check that the conversion back works + assert_eq!(interlay_transaction, rust_bitcoin_transaction.try_into().unwrap()); + } + + #[test] + fn test_address_compat() { + let interbtc_address = crate::Address::P2WPKHv0(primitive_types::H160([1; 20])); + let rust_bitcoin_address: rust_bitcoin::address::Payload = interbtc_address.clone().try_into().unwrap(); + assert_eq!(interbtc_address, rust_bitcoin_address.try_into().unwrap()); + } +} diff --git a/crates/bitcoin/src/lib.rs b/crates/bitcoin/src/lib.rs index 90115bcd7d..e0b8a3b79a 100644 --- a/crates/bitcoin/src/lib.rs +++ b/crates/bitcoin/src/lib.rs @@ -45,6 +45,9 @@ pub mod formatter; #[cfg(any(feature = "parser", test))] pub mod parser; +#[cfg(feature = "bitcoin-types-compat")] +pub mod compat; + pub mod utils; pub mod pow; diff --git a/crates/bitcoin/src/parser.rs b/crates/bitcoin/src/parser.rs index f57345eda2..4fd031e8c0 100644 --- a/crates/bitcoin/src/parser.rs +++ b/crates/bitcoin/src/parser.rs @@ -110,6 +110,68 @@ impl Parsable for Vec { } } +impl Parsable for Transaction { + fn parse(raw_bytes: &[u8], position: usize) -> Result<(Transaction, usize), Error> { + let slice = raw_bytes.get(position..).ok_or(Error::EndOfFile)?; + let mut parser = BytesParser::new(slice); + let version: i32 = parser.parse()?; + + // fail if incorrect version: we only support version 1 and 2 + if version != 1 && version != 2 { + return Err(Error::MalformedTransaction); + } + + let allow_witness = (version & SERIALIZE_TRANSACTION_NO_WITNESS) == 0; + + // TODO: bound maximum? + let mut inputs: Vec = parser.parse_with(version)?; + + let mut flags: u8 = 0; + if inputs.is_empty() && allow_witness { + flags = parser.parse()?; + inputs = parser.parse_with(version)?; + } + + // TODO: bound maximum? + let outputs: Vec = parser.parse()?; + + if (flags & 1) != 0 && allow_witness { + flags ^= 1; + for input in &mut inputs { + input.with_witness(parser.parse()?); + } + + if inputs.iter().all(|input| input.witness.is_empty()) { + // A transaction with a set witness-flag must actually include witnesses in the transaction. + // see https://github.com/bitcoin/bitcoin/blob/be4171679b8eab8205e04ff86140329bd67878a0/src/primitives/transaction.h#L214-L217 + return Err(Error::MalformedTransaction); + } + } + + // https://en.bitcoin.it/wiki/NLockTime + let locktime_or_blockheight: u32 = parser.parse()?; + let lock_at = if locktime_or_blockheight < LOCKTIME_THRESHOLD { + LockTime::BlockHeight(locktime_or_blockheight) + } else { + LockTime::Time(locktime_or_blockheight) + }; + + if flags != 0 { + return Err(Error::MalformedTransaction); + } + + Ok(( + Transaction { + version, + inputs, + outputs, + lock_at, + }, + parser.position, + )) + } +} + impl ParsableMeta for TransactionInput { fn parse_with(raw_bytes: &[u8], position: usize, version: i32) -> Result<(TransactionInput, usize), Error> { let slice = raw_bytes.get(position..).ok_or(Error::EndOfFile)?; @@ -270,59 +332,7 @@ pub fn parse_compact_uint(varint: &[u8]) -> Result<(u64, usize), Error> { /// /// * `raw_transaction` - the raw bytes of the transaction pub fn parse_transaction(raw_transaction: &[u8]) -> Result { - let mut parser = BytesParser::new(raw_transaction); - let version: i32 = parser.parse()?; - - // fail if incorrect version: we only support version 1 and 2 - if version != 1 && version != 2 { - return Err(Error::MalformedTransaction); - } - - let allow_witness = (version & SERIALIZE_TRANSACTION_NO_WITNESS) == 0; - - // TODO: bound maximum? - let mut inputs: Vec = parser.parse_with(version)?; - - let mut flags: u8 = 0; - if inputs.is_empty() && allow_witness { - flags = parser.parse()?; - inputs = parser.parse_with(version)?; - } - - // TODO: bound maximum? - let outputs: Vec = parser.parse()?; - - if (flags & 1) != 0 && allow_witness { - flags ^= 1; - for input in &mut inputs { - input.with_witness(parser.parse()?); - } - - if inputs.iter().all(|input| input.witness.is_empty()) { - // A transaction with a set witness-flag must actually include witnesses in the transaction. - // see https://github.com/bitcoin/bitcoin/blob/be4171679b8eab8205e04ff86140329bd67878a0/src/primitives/transaction.h#L214-L217 - return Err(Error::MalformedTransaction); - } - } - - // https://en.bitcoin.it/wiki/NLockTime - let locktime_or_blockheight: u32 = parser.parse()?; - let lock_at = if locktime_or_blockheight < LOCKTIME_THRESHOLD { - LockTime::BlockHeight(locktime_or_blockheight) - } else { - LockTime::Time(locktime_or_blockheight) - }; - - if flags != 0 { - return Err(Error::MalformedTransaction); - } - - Ok(Transaction { - version, - inputs, - outputs, - lock_at, - }) + Transaction::parse(raw_transaction, 0).map(|(tx, _len)| tx) } /// Parses a transaction input diff --git a/crates/bitcoin/src/script.rs b/crates/bitcoin/src/script.rs index 6fc9510323..6e1d3adb08 100644 --- a/crates/bitcoin/src/script.rs +++ b/crates/bitcoin/src/script.rs @@ -42,6 +42,15 @@ impl Script { } } + // If the most significant byte is >= 0x80 and the value is positive, push a + // new zero-byte to make the significant byte < 0x80 again. + // See https://github.com/bitcoin/bitcoin/blob/b565485c24c0feacae559a7f6f7b83d7516ca58d/src/script/script.h#L360-L373 + if let Some(x) = height_bytes.last() { + if (x & 0x80) != 0 { + height_bytes.push(0); + } + } + // note: formatting the height_bytes vec automatically prepends the length of the vec, so no need // to append it manually script.append(height_bytes); @@ -147,6 +156,16 @@ impl std::convert::TryFrom<&str> for Script { #[test] fn test_script_height() { assert_eq!(Script::height(7).bytes, vec![1, 7]); + // 2^7 boundary + assert_eq!(Script::height(127).bytes, vec![1, 127]); + assert_eq!(Script::height(128).bytes, vec![2, 128, 0]); + // 2^8 boundary + assert_eq!(Script::height(255).bytes, vec![2, 0xff, 0x00]); assert_eq!(Script::height(256).bytes, vec![2, 0x00, 0x01]); + // 2^15 boundary + assert_eq!(Script::height(32767).bytes, vec![2, 0xff, 0x7f]); + assert_eq!(Script::height(32768).bytes, vec![3, 0x00, 0x80, 0x00]); + // 2^16 boundary + assert_eq!(Script::height(65535).bytes, vec![3, 0xff, 0xff, 0x00]); assert_eq!(Script::height(65536).bytes, vec![3, 0x00, 0x00, 0x01]); } diff --git a/crates/currency/src/lib.rs b/crates/currency/src/lib.rs index c43615ca63..c1c0464c2e 100644 --- a/crates/currency/src/lib.rs +++ b/crates/currency/src/lib.rs @@ -116,6 +116,7 @@ pub mod pallet { + TryFrom + TryFrom // from bitcoin types + TryInto // into bitcoin types + + From + MaybeSerializeDeserialize + FullCodec + Copy diff --git a/crates/issue/src/benchmarking.rs b/crates/issue/src/benchmarking.rs index db7c0cdd4f..21101b317a 100644 --- a/crates/issue/src/benchmarking.rs +++ b/crates/issue/src/benchmarking.rs @@ -27,16 +27,16 @@ fn mint_collateral(account_id: &T::AccountId, amount: BalanceO deposit_tokens::(get_native_currency_id::(), account_id, amount); } -fn get_vault_id() -> DefaultVaultId { +fn get_vault_id(name: &'static str) -> DefaultVaultId { VaultId::new( - account("Vault", 0, 0), + account(name, 0, 0), get_collateral_currency_id::(), get_wrapped_currency_id::(), ) } fn setup_chain() { - let dummy_vault = get_vault_id::(); + let dummy_vault = get_vault_id::("Vault"); Oracle::::_set_exchange_rate( get_native_currency_id::(), // for griefing collateral @@ -114,9 +114,11 @@ fn setup_issue( vin: u32, vout: u32, tx_size: u32, + setup_as_replace: bool, ) -> ChainState { let origin: T::AccountId = account("Origin", 0, 0); - let vault_id = get_vault_id::(); + let new_vault_id = get_vault_id::("Vault"); + let old_vault_id = get_vault_id::("OldVault"); let relayer_id: T::AccountId = account("Relayer", 0, 0); mint_collateral::(&origin, (1u32 << 31).into()); @@ -128,8 +130,12 @@ fn setup_issue( let issue_id = H256::zero(); let issue_request = IssueRequest { - requester: AccountOrVault::Account(origin.clone()), - vault: vault_id.clone(), + requester: if setup_as_replace { + AccountOrVault::Vault(old_vault_id.clone()) + } else { + AccountOrVault::Account(origin.clone()) + }, + vault: new_vault_id.clone(), btc_address: vault_btc_address, amount: value.amount(), btc_height: Default::default(), @@ -159,11 +165,14 @@ fn setup_issue( let transaction = BtcRelay::::initialize_and_store_max(relayer_id.clone(), hashes, vin, outputs, tx_size as usize); - register_vault::(vault_id.clone()); + register_vault::(new_vault_id.clone()); + register_vault::(old_vault_id.clone()); + + VaultRegistry::::try_increase_to_be_issued_tokens(&new_vault_id, &value).unwrap(); + VaultRegistry::::try_increase_to_be_issued_tokens(&old_vault_id, &value).unwrap(); - VaultRegistry::::try_increase_to_be_issued_tokens(&vault_id, &value).unwrap(); - let secure_id = Security::::get_secure_id(&vault_id.account_id); - VaultRegistry::::register_deposit_address(&vault_id, secure_id).unwrap(); + let secure_id = Security::::get_secure_id(&new_vault_id.account_id); + VaultRegistry::::register_deposit_address(&new_vault_id, secure_id).unwrap(); ChainState { issue_id, @@ -180,7 +189,7 @@ pub mod benchmarks { fn request_issue() { let origin: T::AccountId = account("Origin", 0, 0); let amount = Issue::::issue_btc_dust_value(get_wrapped_currency_id::()).amount() + 1000u32.into(); - let vault_id = get_vault_id::(); + let vault_id = get_vault_id::("Vault"); let relayer_id: T::AccountId = account("Relayer", 0, 0); mint_collateral::(&origin, (1u32 << 31).into()); @@ -216,7 +225,7 @@ pub mod benchmarks { #[benchmark] fn execute_issue_exact(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<1, 10>, b: Linear<770, 2_048>) { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Exact, h, i, o, b); + let issue_data = setup_issue::(PaymentType::Exact, h, i, o, b, false); #[extrinsic_call] execute_issue(RawOrigin::Signed(origin), issue_data.issue_id, issue_data.transaction); @@ -225,7 +234,7 @@ pub mod benchmarks { #[benchmark] fn execute_issue_overpayment(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<1, 10>, b: Linear<770, 2_048>) { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Overpayment, h, i, o, b); + let issue_data = setup_issue::(PaymentType::Overpayment, h, i, o, b, false); #[extrinsic_call] execute_issue(RawOrigin::Signed(origin), issue_data.issue_id, issue_data.transaction); @@ -234,7 +243,7 @@ pub mod benchmarks { #[benchmark] fn execute_issue_underpayment(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<1, 10>, b: Linear<770, 2_048>) { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Underpayment, h, i, o, b); + let issue_data = setup_issue::(PaymentType::Underpayment, h, i, o, b, false); #[extrinsic_call] execute_issue(RawOrigin::Signed(origin), issue_data.issue_id, issue_data.transaction); @@ -243,7 +252,7 @@ pub mod benchmarks { #[benchmark] fn execute_expired_issue_exact(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<1, 10>, b: Linear<770, 2_048>) { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Exact, h, i, o, b); + let issue_data = setup_issue::(PaymentType::Exact, h, i, o, b, false); expire_issue::(&issue_data); #[extrinsic_call] @@ -253,7 +262,7 @@ pub mod benchmarks { #[benchmark] fn execute_expired_issue_overpayment(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<1, 10>, b: Linear<770, 2_048>) { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Overpayment, h, i, o, b); + let issue_data = setup_issue::(PaymentType::Overpayment, h, i, o, b, false); expire_issue::(&issue_data); #[extrinsic_call] @@ -263,7 +272,7 @@ pub mod benchmarks { #[benchmark] fn execute_expired_issue_underpayment(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<1, 10>, b: Linear<770, 2_048>) { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Underpayment, h, i, o, b); + let issue_data = setup_issue::(PaymentType::Underpayment, h, i, o, b, false); expire_issue::(&issue_data); #[extrinsic_call] @@ -274,7 +283,18 @@ pub mod benchmarks { fn cancel_issue() { let origin: T::AccountId = account("Origin", 0, 0); - let issue_data = setup_issue::(PaymentType::Exact, 2, 2, 2, 770); + let issue_data = setup_issue::(PaymentType::Exact, 2, 2, 2, 770, false); + expire_issue::(&issue_data); + + #[extrinsic_call] + cancel_issue(RawOrigin::Signed(origin), issue_data.issue_id); + } + + #[benchmark] + fn cancel_issue_for_replace() { + let origin: T::AccountId = account("Origin", 0, 0); + + let issue_data = setup_issue::(PaymentType::Exact, 2, 2, 2, 770, true); expire_issue::(&issue_data); #[extrinsic_call] diff --git a/crates/issue/src/default_weights.rs b/crates/issue/src/default_weights.rs index 54ef62854f..fb590f3517 100644 --- a/crates/issue/src/default_weights.rs +++ b/crates/issue/src/default_weights.rs @@ -2,31 +2,32 @@ //! Autogenerated weights for issue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-29, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `enterprise`, CPU: `Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz` +//! HOSTNAME: `Nakuls-MacBook-Pro.local`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kintsugi-dev"), DB CACHE: 1024 // Executed Command: -// target/release/interbtc-parachain +// ./target/release/interbtc-parachain // benchmark // pallet // --pallet // issue // --extrinsic // * -// --chain -// kintsugi-dev // --execution=wasm // --wasm-execution=compiled // --steps -// 50 +// 2 // --repeat -// 20 -// --output -// crates/issue/src/default_weights.rs +// 1 // --template -// .deploy/default-weight-template.hbs +// .deploy/runtime-weight-template.hbs +// --chain +// kintsugi-dev +// --output +// generated_weight_kintsugi.rs + #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -46,11 +47,13 @@ pub trait WeightInfo { fn execute_expired_issue_underpayment(h: u32, i: u32, o: u32, b: u32, ) -> Weight; fn cancel_issue() -> Weight; fn set_issue_period() -> Weight; + fn cancel_issue_for_replace() -> Weight; } /// Weights for issue using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { + /// Storage: BTCRelay StartBlockHeight (r:1 w:0) /// Proof: BTCRelay StartBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) @@ -58,15 +61,15 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: Fee IssueGriefingCollateral (r:1 w:0) /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: Fee IssueFee (r:1 w:0) + /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) @@ -75,8 +78,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -88,18 +89,18 @@ impl WeightInfo for SubstrateWeight { /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Issue IssueRequests (r:0 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) - fn request_issue() -> Weight { + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + fn request_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `3572` - // Estimated: `26156` - // Minimum execution time: 450_294_000 picoseconds. - Weight::from_parts(452_439_000, 26156) - .saturating_add(T::DbWeight::get().reads(19_u64)) + // Measured: `2690` + // Estimated: `6028` + // Minimum execution time: 38_621_000_000 picoseconds. + Weight::from_parts(38_621_000_000, 6028) + .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -115,7 +116,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -126,25 +127,21 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_exact(h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_issue_exact (_h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3435` - // Estimated: `20840` - // Minimum execution time: 142_775_000 picoseconds. - Weight::from_parts(117_261_202, 20840) - // Standard Error: 45_583 - .saturating_add(Weight::from_parts(1_682_032, 0).saturating_mul(h.into())) - // Standard Error: 41_054 - .saturating_add(Weight::from_parts(684_847, 0).saturating_mul(i.into())) - // Standard Error: 41_054 - .saturating_add(Weight::from_parts(287_609, 0).saturating_mul(o.into())) - // Standard Error: 308 - .saturating_add(Weight::from_parts(7_184, 0).saturating_mul(b.into())) + // Measured: `2448` + // Estimated: `3760` + // Minimum execution time: 206_000_000 picoseconds. + Weight::from_parts(261_839_397, 3760) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(277_777, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(166_666, 0).saturating_mul(o.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -160,11 +157,9 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:1 w:0) @@ -183,21 +178,23 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_overpayment(h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_issue_overpayment (_h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4257` - // Estimated: `32025` - // Minimum execution time: 212_556_000 picoseconds. - Weight::from_parts(219_428_668, 32025) - // Standard Error: 58_266 - .saturating_add(Weight::from_parts(901_425, 0).saturating_mul(h.into())) - // Standard Error: 394 - .saturating_add(Weight::from_parts(5_933, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(18_u64)) + // Measured: `3335` + // Estimated: `3760` + // Minimum execution time: 307_000_000 picoseconds. + Weight::from_parts(277_172_143, 3760) + // Standard Error: 1_347_150 + .saturating_add(Weight::from_parts(777_777, 0).saturating_mul(i.into())) + // Standard Error: 1_347_150 + .saturating_add(Weight::from_parts(1_000_000, 0).saturating_mul(o.into())) + // Standard Error: 9_486 + .saturating_add(Weight::from_parts(15_649, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -213,7 +210,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -226,23 +223,23 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_underpayment(h: u32, i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3688` - // Estimated: `21351` - // Minimum execution time: 161_721_000 picoseconds. - Weight::from_parts(157_484_537, 21351) - // Standard Error: 51_664 - .saturating_add(Weight::from_parts(1_573_495, 0).saturating_mul(h.into())) - // Standard Error: 46_531 - .saturating_add(Weight::from_parts(703_443, 0).saturating_mul(i.into())) - // Standard Error: 349 - .saturating_add(Weight::from_parts(3_376, 0).saturating_mul(b.into())) + // Measured: `2747` + // Estimated: `3760` + // Minimum execution time: 214_000_000 picoseconds. + Weight::from_parts(184_539_123, 3760) + // Standard Error: 1_732_050 + .saturating_add(Weight::from_parts(4_250_000, 0).saturating_mul(h.into())) + // Standard Error: 1_539_600 + .saturating_add(Weight::from_parts(1_555_555, 0).saturating_mul(i.into())) + // Standard Error: 10_842 + .saturating_add(Weight::from_parts(8_607, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -258,7 +255,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -269,21 +266,25 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_exact(h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_exact (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4358 + o * (8 ±0)` - // Estimated: `20840` - // Minimum execution time: 146_945_000 picoseconds. - Weight::from_parts(131_685_627, 20840) - // Standard Error: 120_641 - .saturating_add(Weight::from_parts(3_687_159, 0).saturating_mul(h.into())) - // Standard Error: 816 - .saturating_add(Weight::from_parts(15_185, 0).saturating_mul(b.into())) + // Measured: `3536` + // Estimated: `3760` + // Minimum execution time: 194_000_000 picoseconds. + Weight::from_parts(163_253_716, 3760) + // Standard Error: 974_278 + .saturating_add(Weight::from_parts(3_562_500, 0).saturating_mul(h.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(611_111, 0).saturating_mul(i.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(388_888, 0).saturating_mul(o.into())) + // Standard Error: 6_098 + .saturating_add(Weight::from_parts(6_651, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -299,11 +300,9 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:1 w:0) @@ -322,25 +321,23 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_overpayment(h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_overpayment (h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `5026 + i * (9 ±0)` - // Estimated: `32025` - // Minimum execution time: 219_548_000 picoseconds. - Weight::from_parts(188_635_084, 32025) - // Standard Error: 145_768 - .saturating_add(Weight::from_parts(2_393_121, 0).saturating_mul(h.into())) - // Standard Error: 131_286 - .saturating_add(Weight::from_parts(2_072_816, 0).saturating_mul(i.into())) - // Standard Error: 131_286 - .saturating_add(Weight::from_parts(81_139, 0).saturating_mul(o.into())) - // Standard Error: 986 - .saturating_add(Weight::from_parts(10_300, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(18_u64)) + // Measured: `4141 + h * (21 ±0) + i * (3 ±0) + o * (3 ±0)` + // Estimated: `3760` + // Minimum execution time: 322_000_000 picoseconds. + Weight::from_parts(316_622_652, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(937_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_055_555, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(55_555, 0).saturating_mul(o.into())) + .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -356,7 +353,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -369,19 +366,23 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_underpayment(_h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4495 + h * (9 ±0) + i * (13 ±0)` - // Estimated: `21351` - // Minimum execution time: 173_639_000 picoseconds. - Weight::from_parts(195_976_912, 21351) - // Standard Error: 849 - .saturating_add(Weight::from_parts(13_647, 0).saturating_mul(b.into())) + // Measured: `3990` + // Estimated: `3760` + // Minimum execution time: 231_000_000 picoseconds. + Weight::from_parts(177_273_669, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(5_437_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_277_777, 0).saturating_mul(i.into())) + // Standard Error: 677 + .saturating_add(Weight::from_parts(16_040, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -389,30 +390,48 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) - fn cancel_issue() -> Weight { + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + fn cancel_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `2583` - // Estimated: `6968` - // Minimum execution time: 78_715_000 picoseconds. - Weight::from_parts(83_016_000, 6968) + // Measured: `1505` + // Estimated: `3760` + // Minimum execution time: 89_000_000 picoseconds. + Weight::from_parts(89_000_000, 3760) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } - /// Storage: Issue IssuePeriod (r:0 w:1) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn set_issue_period() -> Weight { + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cancel_issue_for_replace () -> Weight { // Proof Size summary in bytes: // Measured: `1027` + // Estimated: `3760` + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(66_000_000, 3760) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Issue IssuePeriod (r:0 w:1) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn set_issue_period () -> Weight { + // Proof Size summary in bytes: + // Measured: `0` // Estimated: `0` - // Minimum execution time: 21_853_000 picoseconds. - Weight::from_parts(22_510_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } // For backwards compatibility and tests impl WeightInfo for () { + /// Storage: BTCRelay StartBlockHeight (r:1 w:0) /// Proof: BTCRelay StartBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) @@ -420,15 +439,15 @@ impl WeightInfo for () { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: Fee IssueGriefingCollateral (r:1 w:0) /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: Fee IssueFee (r:1 w:0) + /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) @@ -437,8 +456,6 @@ impl WeightInfo for () { /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -450,18 +467,19 @@ impl WeightInfo for () { /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Issue IssueRequests (r:0 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) - fn request_issue() -> Weight { + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + fn request_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `3572` - // Estimated: `26156` - // Minimum execution time: 450_294_000 picoseconds. - Weight::from_parts(452_439_000, 26156) - .saturating_add(RocksDbWeight::get().reads(19_u64)) + // Measured: `2690` + // Estimated: `6028` + // Minimum execution time: 38_621_000_000 picoseconds. + Weight::from_parts(38_621_000_000, 6028) + .saturating_add(RocksDbWeight::get().reads(18_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } + /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -477,7 +495,7 @@ impl WeightInfo for () { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -488,25 +506,21 @@ impl WeightInfo for () { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_exact(h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_issue_exact (_h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3435` - // Estimated: `20840` - // Minimum execution time: 142_775_000 picoseconds. - Weight::from_parts(117_261_202, 20840) - // Standard Error: 45_583 - .saturating_add(Weight::from_parts(1_682_032, 0).saturating_mul(h.into())) - // Standard Error: 41_054 - .saturating_add(Weight::from_parts(684_847, 0).saturating_mul(i.into())) - // Standard Error: 41_054 - .saturating_add(Weight::from_parts(287_609, 0).saturating_mul(o.into())) - // Standard Error: 308 - .saturating_add(Weight::from_parts(7_184, 0).saturating_mul(b.into())) + // Measured: `2448` + // Estimated: `3760` + // Minimum execution time: 206_000_000 picoseconds. + Weight::from_parts(261_839_397, 3760) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(277_777, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(166_666, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -522,11 +536,9 @@ impl WeightInfo for () { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:1 w:0) @@ -545,21 +557,23 @@ impl WeightInfo for () { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_overpayment(h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_issue_overpayment (_h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4257` - // Estimated: `32025` - // Minimum execution time: 212_556_000 picoseconds. - Weight::from_parts(219_428_668, 32025) - // Standard Error: 58_266 - .saturating_add(Weight::from_parts(901_425, 0).saturating_mul(h.into())) - // Standard Error: 394 - .saturating_add(Weight::from_parts(5_933, 0).saturating_mul(b.into())) - .saturating_add(RocksDbWeight::get().reads(18_u64)) + // Measured: `3335` + // Estimated: `3760` + // Minimum execution time: 307_000_000 picoseconds. + Weight::from_parts(277_172_143, 3760) + // Standard Error: 1_347_150 + .saturating_add(Weight::from_parts(777_777, 0).saturating_mul(i.into())) + // Standard Error: 1_347_150 + .saturating_add(Weight::from_parts(1_000_000, 0).saturating_mul(o.into())) + // Standard Error: 9_486 + .saturating_add(Weight::from_parts(15_649, 0).saturating_mul(b.into())) + .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -575,7 +589,7 @@ impl WeightInfo for () { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -588,23 +602,23 @@ impl WeightInfo for () { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_underpayment(h: u32, i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3688` - // Estimated: `21351` - // Minimum execution time: 161_721_000 picoseconds. - Weight::from_parts(157_484_537, 21351) - // Standard Error: 51_664 - .saturating_add(Weight::from_parts(1_573_495, 0).saturating_mul(h.into())) - // Standard Error: 46_531 - .saturating_add(Weight::from_parts(703_443, 0).saturating_mul(i.into())) - // Standard Error: 349 - .saturating_add(Weight::from_parts(3_376, 0).saturating_mul(b.into())) + // Measured: `2747` + // Estimated: `3760` + // Minimum execution time: 214_000_000 picoseconds. + Weight::from_parts(184_539_123, 3760) + // Standard Error: 1_732_050 + .saturating_add(Weight::from_parts(4_250_000, 0).saturating_mul(h.into())) + // Standard Error: 1_539_600 + .saturating_add(Weight::from_parts(1_555_555, 0).saturating_mul(i.into())) + // Standard Error: 10_842 + .saturating_add(Weight::from_parts(8_607, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -620,7 +634,7 @@ impl WeightInfo for () { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -631,21 +645,25 @@ impl WeightInfo for () { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_exact(h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_exact (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4358 + o * (8 ±0)` - // Estimated: `20840` - // Minimum execution time: 146_945_000 picoseconds. - Weight::from_parts(131_685_627, 20840) - // Standard Error: 120_641 - .saturating_add(Weight::from_parts(3_687_159, 0).saturating_mul(h.into())) - // Standard Error: 816 - .saturating_add(Weight::from_parts(15_185, 0).saturating_mul(b.into())) + // Measured: `3536` + // Estimated: `3760` + // Minimum execution time: 194_000_000 picoseconds. + Weight::from_parts(163_253_716, 3760) + // Standard Error: 974_278 + .saturating_add(Weight::from_parts(3_562_500, 0).saturating_mul(h.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(611_111, 0).saturating_mul(i.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(388_888, 0).saturating_mul(o.into())) + // Standard Error: 6_098 + .saturating_add(Weight::from_parts(6_651, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -661,11 +679,9 @@ impl WeightInfo for () { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:1 w:0) @@ -684,25 +700,23 @@ impl WeightInfo for () { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_overpayment(h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_overpayment (h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `5026 + i * (9 ±0)` - // Estimated: `32025` - // Minimum execution time: 219_548_000 picoseconds. - Weight::from_parts(188_635_084, 32025) - // Standard Error: 145_768 - .saturating_add(Weight::from_parts(2_393_121, 0).saturating_mul(h.into())) - // Standard Error: 131_286 - .saturating_add(Weight::from_parts(2_072_816, 0).saturating_mul(i.into())) - // Standard Error: 131_286 - .saturating_add(Weight::from_parts(81_139, 0).saturating_mul(o.into())) - // Standard Error: 986 - .saturating_add(Weight::from_parts(10_300, 0).saturating_mul(b.into())) - .saturating_add(RocksDbWeight::get().reads(18_u64)) + // Measured: `4141 + h * (21 ±0) + i * (3 ±0) + o * (3 ±0)` + // Estimated: `3760` + // Minimum execution time: 322_000_000 picoseconds. + Weight::from_parts(316_622_652, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(937_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_055_555, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(55_555, 0).saturating_mul(o.into())) + .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -718,7 +732,7 @@ impl WeightInfo for () { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -731,19 +745,23 @@ impl WeightInfo for () { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_underpayment(_h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4495 + h * (9 ±0) + i * (13 ±0)` - // Estimated: `21351` - // Minimum execution time: 173_639_000 picoseconds. - Weight::from_parts(195_976_912, 21351) - // Standard Error: 849 - .saturating_add(Weight::from_parts(13_647, 0).saturating_mul(b.into())) + // Measured: `3990` + // Estimated: `3760` + // Minimum execution time: 231_000_000 picoseconds. + Weight::from_parts(177_273_669, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(5_437_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_277_777, 0).saturating_mul(i.into())) + // Standard Error: 677 + .saturating_add(Weight::from_parts(16_040, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(261), added: 2736, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -751,24 +769,41 @@ impl WeightInfo for () { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) - fn cancel_issue() -> Weight { + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + fn cancel_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `2583` - // Estimated: `6968` - // Minimum execution time: 78_715_000 picoseconds. - Weight::from_parts(83_016_000, 6968) + // Measured: `1505` + // Estimated: `3760` + // Minimum execution time: 89_000_000 picoseconds. + Weight::from_parts(89_000_000, 3760) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } - /// Storage: Issue IssuePeriod (r:0 w:1) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn set_issue_period() -> Weight { + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cancel_issue_for_replace () -> Weight { // Proof Size summary in bytes: // Measured: `1027` + // Estimated: `3760` + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(66_000_000, 3760) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: Issue IssuePeriod (r:0 w:1) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn set_issue_period () -> Weight { + // Proof Size summary in bytes: + // Measured: `0` // Estimated: `0` - // Minimum execution time: 21_853_000 picoseconds. - Weight::from_parts(22_510_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } -} +} \ No newline at end of file diff --git a/crates/issue/src/lib.rs b/crates/issue/src/lib.rs index 6f597baf59..dcd4deb506 100644 --- a/crates/issue/src/lib.rs +++ b/crates/issue/src/lib.rs @@ -32,15 +32,15 @@ pub mod types; pub use crate::types::{DefaultIssueRequest, IssueRequest, IssueRequestStatus}; use crate::types::{BalanceOf, DefaultVaultId, Version}; -use bitcoin::{merkle::PartialTransactionProof, types::FullTransactionProof, Address}; +use bitcoin::{merkle::PartialTransactionProof, types::FullTransactionProof}; use btc_relay::{BtcAddress, BtcPublicKey}; use currency::Amount; use frame_support::{dispatch::DispatchError, ensure, pallet_prelude::Weight, traits::Get, transactional, PalletId}; use frame_system::{ensure_root, ensure_signed}; pub use pallet::*; -use primitives::AccountOrVault; +use primitives::{AccountOrVault, Balance}; use sp_core::H256; -use sp_runtime::traits::{AccountIdConversion, Convert, Saturating}; +use sp_runtime::traits::{AccountIdConversion, Convert, Saturating, Zero}; use sp_std::vec::Vec; use types::IssueRequestExt; use vault_registry::{types::CurrencyId, CurrencySource, VaultStatus}; @@ -76,7 +76,6 @@ pub mod pallet { use super::*; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; - use primitives::AccountOrVault; /// ## Configuration /// The pallet's configuration trait. @@ -183,7 +182,7 @@ pub mod pallet { Version::V4 } - /// Build storage at V1 (requires default 0). + /// Build storage at V5 (requires default 4). #[pallet::storage] #[pallet::getter(fn storage_version)] pub(super) type StorageVersion = StorageValue<_, Version, ValueQuery, DefaultForStorageVersion>; @@ -194,6 +193,13 @@ pub mod pallet { pub issue_btc_dust_value: BalanceOf, } + #[pallet::hooks] + impl Hooks> for Pallet { + fn on_runtime_upgrade() -> Weight { + migration::v5::migrate_v4_to_v5::() + } + } + #[cfg(feature = "std")] impl Default for GenesisConfig { fn default() -> Self { @@ -270,7 +276,10 @@ pub mod pallet { /// * `origin` - sender of the transaction /// * `issue_id` - identifier of issue request as output from request_issue #[pallet::call_index(2)] - #[pallet::weight(::WeightInfo::cancel_issue())] + #[pallet::weight( + ::WeightInfo::cancel_issue() + .max(::WeightInfo::cancel_issue_for_replace()) + )] #[transactional] pub fn cancel_issue(origin: OriginFor, issue_id: H256) -> DispatchResultWithPostInfo { let requester = ensure_signed(origin)?; @@ -305,37 +314,8 @@ impl Pallet { T::TreasuryPalletId::get().into_account_truncating() } - // Function to cancel an issue request and slash collateral - pub fn cancel_issue_request_and_slash_collateral(issue_id: &H256) -> Result, DispatchError> { - // Get the issue request using the provided issue_id - let issue = Self::get_issue_request_from_id(issue_id)?; - - // Retrieve the amount of griefing collateral from the issue - let griefing_collateral = issue.griefing_collateral(); - - // Transfer griefing collateral from the requester's account to the vault's account - ext::vault_registry::transfer_funds::( - CurrencySource::UserGriefing(issue.requester.get_account().clone()), - CurrencySource::FreeBalance(issue.vault.account_id), - &griefing_collateral, - )?; - - // Set the status of the issue request to 'Cancelled' - Self::set_issue_status(issue_id.clone(), IssueRequestStatus::Cancelled); - - // Emit an event to indicate the cancellation of the issue request - Self::deposit_event(Event::CancelIssue { - issue_id: issue_id.clone(), - requester: issue.requester.get_account().clone(), - griefing_collateral: griefing_collateral.amount(), - }); - - // Return the amount of griefing collateral that was slashed - Ok(griefing_collateral.amount()) - } - // Function to retrieve the vault ID associated with a given issue ID - pub fn get_vault_from_id_from_issue_id(issue_id: &H256) -> Result, DispatchError> { + pub fn get_vault_from_issue_id(issue_id: &H256) -> Result, DispatchError> { // Retrieve the issue request using the provided issue_id let issue_request = Self::get_issue_request_from_id(issue_id)?; @@ -348,18 +328,8 @@ impl Pallet { // Retrieve the issue request using the provided issue_id let issue = Self::get_issue_request_from_id(&issue_id)?; - // Calculate the total amount including both issue amount and fee - let total = issue.amount().checked_add(&issue.fee())?; - // Decrease the to-be-issued tokens and increase the issued tokens for the new vault - ext::vault_registry::issue_tokens::(&issue.vault, &total)?; - - // Distribute rewards based on the issue fee - ext::fee::distribute_rewards::(&issue.fee())?; - - // Release the locked griefing collateral to the requester's account - let griefing_collateral: Amount = issue.griefing_collateral(); - griefing_collateral.unlock_on(&issue.requester.get_account())?; + ext::vault_registry::issue_tokens::(&issue.vault, &issue.amount())?; // Set the issue status to 'Completed' Self::set_issue_status(issue_id, IssueRequestStatus::Completed); @@ -373,7 +343,7 @@ impl Pallet { amount_requested: BalanceOf, vault_id: DefaultVaultId, griefing_currency: CurrencyId, - ) -> Result<(H256, Address), DispatchError> { + ) -> Result<(H256, BtcAddress), DispatchError> { let amount_requested = Amount::new(amount_requested, vault_id.wrapped_currency()); ensure!( @@ -392,10 +362,28 @@ impl Pallet { // Check that the vault is currently not banned ext::vault_registry::ensure_not_banned::(&vault_id)?; - // calculate griefing collateral based on the total amount of tokens to be issued - let amount_collateral = amount_requested.convert_to(griefing_currency)?; - let griefing_collateral = ext::fee::get_issue_griefing_collateral::(&amount_collateral)?; - griefing_collateral.lock_on(requester.get_account())?; + // check if it's a replace request + let (griefing_collateral, fee, amount_user) = if requester.is_vault_account() { + ( + // for replace request griefing collateral remains as zero + Amount::new(Balance::zero().into(), griefing_currency), + // for replace request fee remains as zero + Amount::new(Balance::zero().into(), vault_id.wrapped_currency()), + // for replace amount given to old_vault should be equal to specified amount + amount_requested.clone(), + ) + } else { + // calculate griefing collateral based on the total amount of tokens to be issued + let amount_collateral = amount_requested.convert_to(griefing_currency)?; + let griefing_collateral = ext::fee::get_issue_griefing_collateral::(&amount_collateral)?; + griefing_collateral.lock_on(requester.get_account())?; + + let fee = ext::fee::get_issue_fee::(&amount_requested)?; + // calculate the amount of tokens that will be transferred to the user upon execution + let amount_user = amount_requested.checked_sub(&fee)?; + + (griefing_collateral, fee, amount_user) + }; // only continue if the payment is above the dust value ensure!( @@ -405,10 +393,6 @@ impl Pallet { ext::vault_registry::try_increase_to_be_issued_tokens::(&vault_id, &amount_requested)?; - let fee = ext::fee::get_issue_fee::(&amount_requested)?; - // calculate the amount of tokens that will be transferred to the user upon execution - let amount_user = amount_requested.checked_sub(&fee)?; - let issue_id = ext::security::get_secure_id::(&requester.get_account()); let btc_address = ext::vault_registry::register_deposit_address::(&vault_id, issue_id)?; let btc_public_key = ext::vault_registry::get_bitcoin_public_key::(&vault_id.account_id)?; @@ -537,12 +521,22 @@ impl Pallet { } /// Cancels CBA issuance if time has expired and slashes collateral. - fn _cancel_issue(requester: T::AccountId, issue_id: H256) -> Result<(), DispatchError> { + pub fn _cancel_issue(requester: T::AccountId, issue_id: H256) -> Result<(), DispatchError> { let issue = Self::get_pending_issue(&issue_id)?; let issue_period = Self::issue_period().max(issue.period); - let to_be_slashed_collateral = - if ext::btc_relay::has_request_expired::(issue.opentime, issue.btc_height, issue_period)? { + let is_replace_request = issue.requester.is_vault_account(); + + let issue_expired = ext::btc_relay::has_request_expired::(issue.opentime, issue.btc_height, issue_period)?; + + // its a replace issue call if requester is vault + let slashed_collateral = if is_replace_request { + // only cancel replace request if issue is expired + ensure!(issue_expired, Error::::TimeNotExpired); + // for replace request griefing collateral is set as zero + issue.griefing_collateral() + } else { + let to_be_slashed_collateral = if issue_expired { // anyone can cancel the issue request once expired issue.griefing_collateral() } else if issue.requester.get_account() == &requester { @@ -576,30 +570,35 @@ impl Pallet { return Err(Error::::TimeNotExpired.into()); }; - if ext::vault_registry::is_vault_liquidated::(&issue.vault)? { - // return slashed griefing collateral if the vault is liquidated - to_be_slashed_collateral.unlock_on(issue.requester.get_account())?; - } else { - // otherwise give slashed griefing collateral to the treasury - // since the vault may have purposely blocked minting - ext::vault_registry::transfer_funds::( - CurrencySource::UserGriefing(issue.requester.get_account().clone()), - CurrencySource::FreeBalance(Self::treasury_account_id()), - &to_be_slashed_collateral, - )?; - } + if ext::vault_registry::is_vault_liquidated::(&issue.vault)? { + // return slashed griefing collateral if the vault is liquidated + to_be_slashed_collateral.unlock_on(issue.requester.get_account())?; + } else { + // otherwise give slashed griefing collateral to the treasury + // since the vault may have purposely blocked minting + ext::vault_registry::transfer_funds::( + CurrencySource::UserGriefing(issue.requester.get_account().clone()), + CurrencySource::FreeBalance(Self::treasury_account_id()), + &to_be_slashed_collateral, + )?; + } - // decrease to-be-issued tokens - let full_amount = issue.amount().checked_add(&issue.fee())?; - ext::vault_registry::decrease_to_be_issued_tokens::(&issue.vault, &full_amount)?; + // decrease to-be-issued tokens + let full_amount = issue.amount().checked_add(&issue.fee())?; + ext::vault_registry::decrease_to_be_issued_tokens::(&issue.vault, &full_amount)?; + to_be_slashed_collateral + }; + + // Set the status of the issue request to 'Cancelled' Self::set_issue_status(issue_id, IssueRequestStatus::Cancelled); Self::deposit_event(Event::CancelIssue { issue_id, requester, - griefing_collateral: to_be_slashed_collateral.amount(), + griefing_collateral: slashed_collateral.amount(), }); + Ok(()) } diff --git a/crates/issue/src/migration.rs b/crates/issue/src/migration.rs index e95f8ffc7b..07906b2e4e 100644 --- a/crates/issue/src/migration.rs +++ b/crates/issue/src/migration.rs @@ -1,9 +1,10 @@ use super::*; use frame_support::{pallet_prelude::*, traits::OnRuntimeUpgrade}; +#[cfg(feature = "std")] use sp_core::H256; /// The log target. -const TARGET: &'static str = "runtime::issue::migration::v1"; +const TARGET: &'static str = "runtime::issue::migration::v5"; /// The original data layout of the democracy pallet without a specific version number. mod v0 { @@ -115,6 +116,86 @@ pub mod v1 { } } +mod v4 { + use super::*; + + #[frame_support::storage_alias] + pub(super) type IssueRequests = + StorageMap, Blake2_128Concat, H256, DefaultIssueRequest, OptionQuery>; + + #[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)] + pub struct IssueRequest { + /// the vault associated with this issue request + pub vault: primitives::VaultId, + /// the *active* block height when this request was opened + pub opentime: BlockNumber, + /// the issue period when this request was opened + pub period: BlockNumber, + /// the collateral held for spam prevention + pub griefing_collateral: Balance, + /// The currency used for the griefing collateral + pub griefing_currency: CurrencyId, + /// the number of tokens that will be transferred to the user (as such, this does not include the fee) + pub amount: Balance, + /// the number of tokens that will be transferred to the fee pool + pub fee: Balance, + /// the account issuing tokens + pub requester: AccountId, + /// the vault's Bitcoin deposit address + pub btc_address: BtcAddress, + /// the vault's Bitcoin public key (when this request was made) + pub btc_public_key: BtcPublicKey, + /// the highest recorded height in the BTC-Relay (at time of opening) + pub btc_height: u32, + /// the status of this issue request + pub status: IssueRequestStatus, + } + + pub type DefaultIssueRequest = IssueRequest< + ::AccountId, + ::BlockNumber, + BalanceOf, + CurrencyId, + >; +} + +pub mod v5 { + use super::*; + + pub fn migrate_v4_to_v5() -> Weight { + let mut weight = T::DbWeight::get().reads(1); + + if !matches!(crate::StorageVersion::::get(), Version::V4) { + return T::DbWeight::get().reads(1); // already upgraded; don't run migration + } + + IssueRequests::::translate(|key, old: v4::DefaultIssueRequest| { + weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1)); + log::info!(target: TARGET, "migrating issue #{:?}", &key); + + Some(DefaultIssueRequest:: { + vault: old.vault, + opentime: old.opentime, + period: old.period, + griefing_collateral: old.griefing_collateral, + amount: old.amount, + fee: old.fee, + requester: AccountOrVault::Account(old.requester), + btc_address: old.btc_address, + btc_public_key: old.btc_public_key, + btc_height: old.btc_height, + status: old.status, + griefing_currency: T::GetGriefingCollateralCurrencyId::get(), + }) + }); + + // update version + StorageVersion::new(5).put::>(); + + weight.saturating_add(T::DbWeight::get().reads_writes(0, 1)) + } +} + #[cfg(test)] mod test { use super::*; @@ -123,6 +204,49 @@ mod test { types::*, }; + #[test] + fn migrating_from_v4_to_v5() { + run_test(|| { + assert_eq!(crate::StorageVersion::::get(), Version::V4); + + let old = v4::DefaultIssueRequest:: { + requester: 123, + vault: DefaultVaultId::::new(123, Token(DOT), Token(IBTC)), + btc_address: BtcAddress::random(), + amount: 123, + btc_height: 234, + btc_public_key: Default::default(), + fee: 456, + griefing_collateral: 567, + opentime: 12334, + period: 12313, + status: Default::default(), + griefing_currency: ::GetGriefingCollateralCurrencyId::get(), + }; + let key = H256::zero(); + v4::IssueRequests::::insert(key, old.clone()); + + v5::migrate_v4_to_v5::(); + + assert_eq!(StorageVersion::get::>(), 5); + + let new = crate::IssueRequests::::get(key).unwrap(); + + assert!(old.requester == new.requester.get_account().clone()); + assert!(old.vault == new.vault); + assert!(old.btc_address == new.btc_address); + assert!(old.amount == new.amount); + assert!(old.btc_height == new.btc_height); + assert!(old.btc_public_key == new.btc_public_key); + assert!(old.fee == new.fee); + assert!(old.griefing_collateral == new.griefing_collateral); + assert!(old.opentime == new.opentime); + assert!(old.period == new.period); + assert!(old.status == new.status); + assert!(new.griefing_currency == ::GetGriefingCollateralCurrencyId::get()); + }); + } + #[allow(deprecated)] #[test] fn migration_works() { diff --git a/crates/issue/src/tests.rs b/crates/issue/src/tests.rs index 276a7e9a6a..7db077e0c0 100644 --- a/crates/issue/src/tests.rs +++ b/crates/issue/src/tests.rs @@ -425,7 +425,7 @@ fn execute_issue_fails_for_replace_request() { } #[test] -fn complete_issue_request_for_replace() { +fn fail_to_cancel_completed_replace_issue_request() { run_test(|| { let issue_id = setup_execute(3, 1, 1, 3, AccountOrVault::Vault(OLD_VAULT)); assert_ok!(Issue::_complete_vault_issue(issue_id)); @@ -438,15 +438,15 @@ fn complete_issue_request_for_replace() { } #[test] -fn cancel_issue_for_replace() { +fn cancel_replace_issue_request() { run_test(|| { let griefing_collateral = 10; let issue_id = setup_execute(3, 1, griefing_collateral, 3, AccountOrVault::Vault(OLD_VAULT)); - assert_eq!( - Issue::cancel_issue_request_and_slash_collateral(&issue_id), - Ok(griefing_collateral) - ); + ext::btc_relay::has_request_expired::.mock_safe(move |_, _, _| MockResult::Return(Ok(true))); + ext::vault_registry::decrease_to_be_issued_tokens::.mock_safe(move |_, _| MockResult::Return(Ok(()))); + + assert_ok!(Issue::_cancel_issue(USER, issue_id)); assert_eq!( Issue::issue_requests(&issue_id).unwrap().status, @@ -455,9 +455,18 @@ fn cancel_issue_for_replace() { let request_issue_event = TestEvent::Issue(Event::CancelIssue { issue_id, - requester: OLD_VAULT.account_id, - griefing_collateral, + requester: USER, + griefing_collateral: 0, }); assert!(System::events().iter().any(|a| a.event == request_issue_event)); }); } + +#[test] +fn cancel_replace_issue_when_request_not_expired() { + run_test(|| { + let griefing_collateral = 10; + let issue_id = setup_execute(3, 1, griefing_collateral, 3, AccountOrVault::Vault(OLD_VAULT)); + assert_noop!(cancel_issue(USER, &issue_id), TestError::TimeNotExpired); + }); +} diff --git a/crates/issue/src/types.rs b/crates/issue/src/types.rs index d1d1cadb2c..34f7b152bf 100644 --- a/crates/issue/src/types.rs +++ b/crates/issue/src/types.rs @@ -8,7 +8,7 @@ use vault_registry::types::CurrencyId; use crate::Config; /// Storage version. -#[derive(Encode, Decode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] +#[derive(Debug, Encode, Decode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] pub enum Version { /// Initial version. V0, @@ -20,6 +20,8 @@ pub enum Version { V3, /// Removed refund V4, + /// Updated `IssueRequest`, `requester` field to accept vault account + V5, } pub(crate) type BalanceOf = ::Balance; diff --git a/crates/redeem/src/benchmarking.rs b/crates/redeem/src/benchmarking.rs index 19fa82eb81..8cefb5f284 100644 --- a/crates/redeem/src/benchmarking.rs +++ b/crates/redeem/src/benchmarking.rs @@ -221,12 +221,19 @@ fn setup_replace( old_vault_id: &DefaultVaultId, new_vault_id: &DefaultVaultId, to_be_replaced: Amount, + expire_redeem_request: bool, ) -> (H256, BalanceOf) where <::Balance as TryInto>::Error: Debug, { let value: Amount = Amount::new(2u32.into(), get_wrapped_currency_id::()); + let btc_address = if expire_redeem_request { + Default::default() + } else { + BtcAddress::dummy() + }; + //set up redeem let redeem_id = H256::zero(); let mut redeem_request = test_request::(&old_vault_id); @@ -234,6 +241,8 @@ where redeem_request.opentime = Security::::active_block_number(); redeem_request.issue_id = Some(H256::zero()); redeem_request.amount_btc = value.amount(); + redeem_request.btc_address = btc_address; + Redeem::::insert_redeem_request(&redeem_id, &redeem_request); VaultRegistry::::try_increase_to_be_redeemed_tokens(&old_vault_id, &to_be_replaced).unwrap(); @@ -242,17 +251,19 @@ where mint_and_reserve_wrapped::(&redeem_request.redeemer, redeem_request.amount_btc); // expire redeem request - initialize_and_mine_blocks_until_expiry::(&redeem_request); - Security::::set_active_block_number( - Security::::active_block_number() + Redeem::::redeem_period() + 100u32.into(), - ); + if expire_redeem_request { + initialize_and_mine_blocks_until_expiry::(&redeem_request); + Security::::set_active_block_number( + Security::::active_block_number() + Redeem::::redeem_period() + 100u32.into(), + ); + } // set up issue let issue_id = H256::zero(); let issue_request = IssueRequest { - requester: AccountOrVault::Account(old_vault_id.account_id.clone()), + requester: AccountOrVault::Vault(old_vault_id.clone()), vault: new_vault_id.clone(), - btc_address: Default::default(), + btc_address, amount: value.amount(), btc_height: Default::default(), btc_public_key: Default::default(), @@ -268,8 +279,6 @@ where VaultRegistry::::try_increase_to_be_issued_tokens(&new_vault_id, &value).unwrap(); - Redeem::::insert_request(&redeem_id, &issue_id); - (redeem_id, redeem_request.amount_btc) } @@ -492,7 +501,7 @@ pub mod benchmarks { .. } = setup_chain::(); - let (redeem_id, amount_btc) = setup_replace::(&old_vault_id, &new_vault_id, to_be_replaced); + let (redeem_id, amount_btc) = setup_replace::(&old_vault_id, &new_vault_id, to_be_replaced, true); let vault_id = activate_lending_and_get_vault_id::(); @@ -601,6 +610,62 @@ pub mod benchmarks { ); } + #[benchmark] + pub fn execute_replace(h: Linear<2, 10>, i: Linear<1, 10>, o: Linear<2, 3>, b: Linear<541, 2_048>) { + let ChainState { + old_vault_id, + to_be_replaced, + new_vault_id, + .. + } = setup_chain::(); + + let (redeem_id, amount_btc) = setup_replace::(&old_vault_id, &new_vault_id, to_be_replaced, false); + + let vault_id = activate_lending_and_get_vault_id::(); + + initialize_oracle::(); + + register_public_key::(vault_id.clone()); + VaultRegistry::::insert_vault( + &vault_id, + Vault { + id: vault_id.clone(), + issued_tokens: amount_btc, + to_be_redeemed_tokens: amount_btc, + ..Vault::new(vault_id.clone()) + }, + ); + + mint_collateral::(&vault_id.account_id, 1000u32.into()); + assert_ok!(VaultRegistry::::try_deposit_collateral(&vault_id, &collateral(1000))); + + assert_ok!(Oracle::::_set_exchange_rate( + get_collateral_currency_id::(), + UnsignedFixedPoint::::one() + )); + + let relayer_id: T::AccountId = account("Relayer", 0, 0); + + // we always need these outputs for redeem + let mut outputs = vec![ + TransactionOutput::payment(amount_btc.try_into().unwrap(), &BtcAddress::dummy()), + TransactionOutput::op_return(0, H256::zero().as_bytes()), + ]; + + // add return-to-self output + if o == 3 { + outputs.push(TransactionOutput::payment( + 2u32.into(), + &BtcAddress::P2PKH(sp_core::H160::zero()), + )); + } + + let transaction = BtcRelay::::initialize_and_store_max(relayer_id.clone(), h, i, outputs, b as usize); + + #[extrinsic_call] + execute_redeem(RawOrigin::Signed(vault_id.account_id.clone()), redeem_id, transaction); + } + impl_benchmark_test_suite!( Redeem, crate::mock::ExtBuilder::build_with(Default::default()), diff --git a/crates/redeem/src/default_weights.rs b/crates/redeem/src/default_weights.rs index 8079f3e54b..d150040f37 100644 --- a/crates/redeem/src/default_weights.rs +++ b/crates/redeem/src/default_weights.rs @@ -2,31 +2,31 @@ //! Autogenerated weights for redeem //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-12, STEPS: `100`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-29, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `interlay-hetzner-01`, CPU: `AMD EPYC 7502P 32-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kintsugi-testnet-latest"), DB CACHE: 1024 +//! HOSTNAME: `Nakuls-MacBook-Pro.local`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kintsugi-dev"), DB CACHE: 1024 // Executed Command: -// target/release/interbtc-parachain +// ./target/release/interbtc-parachain // benchmark // pallet -// --chain -// kintsugi-testnet-latest -// --execution=wasm -// --wasm-execution=compiled // --pallet // redeem // --extrinsic // * +// --execution=wasm +// --wasm-execution=compiled // --steps -// 100 +// 2 // --repeat -// 10 -// --output -// ./crates/redeem/src/default_weights.rs +// 1 // --template -// .deploy/default-weight-template.hbs +// .deploy/runtime-weight-template.hbs +// --chain +// kintsugi-dev +// --output +// generated_weight_kintsugi.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -40,8 +40,10 @@ pub trait WeightInfo { fn request_redeem() -> Weight; fn liquidation_redeem() -> Weight; fn execute_redeem(h: u32, i: u32, o: u32, b: u32, ) -> Weight; + fn execute_replace(h: u32, i: u32, o: u32, b: u32, ) -> Weight; fn cancel_redeem_reimburse() -> Weight; fn cancel_redeem_retry() -> Weight; + fn cancel_replace() -> Weight; fn set_redeem_period() -> Weight; fn self_redeem() -> Weight; fn request_replace() -> Weight; @@ -50,8 +52,9 @@ pub trait WeightInfo { /// Weights for redeem using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + + /// Storage: VaultRegistry Vaults (r:1 w:1) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:2 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) @@ -60,8 +63,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) @@ -103,14 +104,14 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) - fn request_redeem() -> Weight { + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + fn request_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `4672` - // Estimated: `47658` - // Minimum execution time: 311_664_000 picoseconds. - Weight::from_parts(315_792_000, 47658) - .saturating_add(T::DbWeight::get().reads(29_u64)) + // Measured: `3161` + // Estimated: `6260` + // Minimum execution time: 270_000_000 picoseconds. + Weight::from_parts(270_000_000, 6260) + .saturating_add(T::DbWeight::get().reads(28_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Tokens Accounts (r:3 w:3) @@ -137,17 +138,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Loans AccountDeposits (r:1 w:0) /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) - fn liquidation_redeem() -> Weight { + fn liquidation_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `3861` - // Estimated: `40975` - // Minimum execution time: 279_078_000 picoseconds. - Weight::from_parts(282_886_000, 40975) + // Measured: `2193` + // Estimated: `8760` + // Minimum execution time: 257_000_000 picoseconds. + Weight::from_parts(257_000_000, 8760) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -167,32 +168,28 @@ impl WeightInfo for SubstrateWeight { /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// The range of component `h` is `[2, 10]`. /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[2, 3]`. /// The range of component `b` is `[541, 2048]`. - fn execute_redeem(h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_redeem (h: u32, _i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3463` - // Estimated: `18221` - // Minimum execution time: 180_491_000 picoseconds. - Weight::from_parts(156_971_337, 18221) - // Standard Error: 18_912 - .saturating_add(Weight::from_parts(1_667_781, 0).saturating_mul(h.into())) - // Standard Error: 17_010 - .saturating_add(Weight::from_parts(730_184, 0).saturating_mul(i.into())) - // Standard Error: 102_447 - .saturating_add(Weight::from_parts(810_488, 0).saturating_mul(o.into())) - // Standard Error: 103 - .saturating_add(Weight::from_parts(5_905, 0).saturating_mul(b.into())) + // Measured: `2268 + o * (1 ±0)` + // Estimated: `3743` + // Minimum execution time: 176_000_000 picoseconds. + Weight::from_parts(151_584_172, 3743) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(2_562_500, 0).saturating_mul(h.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(500_000, 0).saturating_mul(o.into())) + // Standard Error: 574 + .saturating_add(Weight::from_parts(8_958, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -200,7 +197,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -262,11 +259,11 @@ impl WeightInfo for SubstrateWeight { /// Storage: VaultRewards TotalStake (r:1 w:1) /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) /// Storage: VaultRewards RewardCurrencies (r:1 w:0) - /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(138), added: 2613, mode: MaxEncodedLen) + /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(50), added: 2525, mode: MaxEncodedLen) /// Storage: VaultCapacity TotalStake (r:1 w:1) /// Proof: VaultCapacity TotalStake (max_values: None, max_size: Some(32), added: 2507, mode: MaxEncodedLen) /// Storage: VaultCapacity RewardCurrencies (r:1 w:0) - /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(127), added: 2602, mode: MaxEncodedLen) + /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(39), added: 2514, mode: MaxEncodedLen) /// Storage: Loans RewardSupplyState (r:1 w:1) /// Proof: Loans RewardSupplyState (max_values: None, max_size: Some(47), added: 2522, mode: MaxEncodedLen) /// Storage: Loans RewardSupplySpeed (r:1 w:0) @@ -279,19 +276,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) /// Storage: VaultRegistry PunishmentDelay (r:1 w:0) /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn cancel_redeem_reimburse() -> Weight { + fn cancel_redeem_reimburse () -> Weight { // Proof Size summary in bytes: - // Measured: `7166` - // Estimated: `135176` - // Minimum execution time: 798_478_000 picoseconds. - Weight::from_parts(808_188_000, 135176) - .saturating_add(T::DbWeight::get().reads(60_u64)) + // Measured: `5403` + // Estimated: `11350` + // Minimum execution time: 782_000_000 picoseconds. + Weight::from_parts(782_000_000, 11350) + .saturating_add(T::DbWeight::get().reads(59_u64)) .saturating_add(T::DbWeight::get().writes(29_u64)) } - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -299,7 +294,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -361,11 +356,11 @@ impl WeightInfo for SubstrateWeight { /// Storage: VaultRewards TotalStake (r:1 w:1) /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) /// Storage: VaultRewards RewardCurrencies (r:1 w:0) - /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(138), added: 2613, mode: MaxEncodedLen) + /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(50), added: 2525, mode: MaxEncodedLen) /// Storage: VaultCapacity TotalStake (r:1 w:1) /// Proof: VaultCapacity TotalStake (max_values: None, max_size: Some(32), added: 2507, mode: MaxEncodedLen) /// Storage: VaultCapacity RewardCurrencies (r:1 w:0) - /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(127), added: 2602, mode: MaxEncodedLen) + /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(39), added: 2514, mode: MaxEncodedLen) /// Storage: Loans RewardSupplyState (r:1 w:1) /// Proof: Loans RewardSupplyState (max_values: None, max_size: Some(47), added: 2522, mode: MaxEncodedLen) /// Storage: Loans RewardSupplySpeed (r:1 w:0) @@ -378,64 +373,117 @@ impl WeightInfo for SubstrateWeight { /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) /// Storage: VaultRegistry PunishmentDelay (r:1 w:0) /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn cancel_redeem_retry() -> Weight { + fn cancel_redeem_retry () -> Weight { // Proof Size summary in bytes: - // Measured: `7166` - // Estimated: `132666` - // Minimum execution time: 729_751_000 picoseconds. - Weight::from_parts(738_648_000, 132666) - .saturating_add(T::DbWeight::get().reads(59_u64)) + // Measured: `5403` + // Estimated: `11350` + // Minimum execution time: 706_000_000 picoseconds. + Weight::from_parts(706_000_000, 11350) + .saturating_add(T::DbWeight::get().reads(58_u64)) .saturating_add(T::DbWeight::get().writes(28_u64)) } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: Redeem RedeemPeriod (r:1 w:0) + /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) + /// Storage: Fee PunishmentFee (r:1 w:0) + /// Proof: Fee PunishmentFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: VaultStaking Nonce (r:1 w:0) + /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) + /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry TotalUserVaultCollateral (r:1 w:1) + /// Proof: VaultRegistry TotalUserVaultCollateral (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultCapacity Stake (r:1 w:0) + /// Proof: VaultCapacity Stake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardPerToken (r:2 w:0) + /// Proof: VaultCapacity RewardPerToken (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardTally (r:2 w:2) + /// Proof: VaultCapacity RewardTally (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultCapacity TotalRewards (r:2 w:2) + /// Proof: VaultCapacity TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultRewards Stake (r:1 w:0) + /// Proof: VaultRewards Stake (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardPerToken (r:2 w:0) + /// Proof: VaultRewards RewardPerToken (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardTally (r:2 w:2) + /// Proof: VaultRewards RewardTally (max_values: None, max_size: Some(124), added: 2599, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalRewards (r:2 w:2) + /// Proof: VaultRewards TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Fee Commission (r:1 w:0) + /// Proof: Fee Commission (max_values: None, max_size: Some(86), added: 2561, mode: MaxEncodedLen) + /// Storage: VaultStaking RewardPerToken (r:2 w:2) + /// Proof: VaultStaking RewardPerToken (max_values: None, max_size: Some(117), added: 2592, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalStake (r:1 w:0) + /// Proof: VaultStaking TotalStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) + /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalStake (r:1 w:0) + /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + fn cancel_replace () -> Weight { + // Proof Size summary in bytes: + // Measured: `4404` + // Estimated: `6364` + // Minimum execution time: 394_000_000 picoseconds. + Weight::from_parts(394_000_000, 6364) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(15_u64)) + } /// Storage: Redeem RedeemPeriod (r:0 w:1) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn set_redeem_period() -> Weight { + fn set_redeem_period () -> Weight { // Proof Size summary in bytes: - // Measured: `1025` + // Measured: `0` // Estimated: `0` - // Minimum execution time: 28_527_000 picoseconds. - Weight::from_parts(29_970_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) - fn self_redeem() -> Weight { + fn self_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `2449` - // Estimated: `7835` - // Minimum execution time: 147_756_000 picoseconds. - Weight::from_parts(149_109_000, 7835) + // Measured: `1399` + // Estimated: `3677` + // Minimum execution time: 116_000_000 picoseconds. + Weight::from_parts(116_000_000, 3677) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } - /// Storage: VaultRegistry Vaults (r:2 w:2) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: BTCRelay StartBlockHeight (r:1 w:0) /// Proof: BTCRelay StartBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: Oracle Aggregate (r:3 w:0) - /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: Fee IssueGriefingCollateral (r:1 w:0) - /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Tokens Accounts (r:1 w:1) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:2 w:0) /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:2 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -448,8 +496,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) /// Proof: Fee RedeemFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Redeem RedeemTransactionSize (r:1 w:0) - /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry PremiumRedeemThreshold (r:1 w:0) @@ -460,23 +506,63 @@ impl WeightInfo for SubstrateWeight { /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) - /// Storage: Redeem Requests (r:0 w:1) - /// Proof: Redeem Requests (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - fn request_replace() -> Weight { + fn request_replace () -> Weight { // Proof Size summary in bytes: - // Measured: `3277` - // Estimated: `8547` - // Minimum execution time: 39_015_000_000 picoseconds. - Weight::from_parts(39_015_000_000, 8547) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(7_u64)) + // Measured: `2735` + // Estimated: `6364` + // Minimum execution time: 38_446_000_000 picoseconds. + Weight::from_parts(38_446_000_000, 6364) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) + /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay Chains (r:1 w:0) + /// Proof: BTCRelay Chains (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) + /// Storage: BTCRelay BlockHeaders (r:1 w:0) + /// Proof: BTCRelay BlockHeaders (max_values: None, max_size: Some(200), added: 2675, mode: MaxEncodedLen) + /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) + /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) + /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// The range of component `h` is `[2, 10]`. + /// The range of component `i` is `[1, 10]`. + /// The range of component `o` is `[2, 3]`. + /// The range of component `b` is `[541, 2048]`. + fn execute_replace (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2310` + // Estimated: `6364` + // Minimum execution time: 178_000_000 picoseconds. + Weight::from_parts(108_702_702, 6364) + // Standard Error: 433_012 + .saturating_add(Weight::from_parts(3_875_000, 0).saturating_mul(h.into())) + // Standard Error: 384_900 + .saturating_add(Weight::from_parts(1_444_444, 0).saturating_mul(i.into())) + // Standard Error: 3_464_101 + .saturating_add(Weight::from_parts(8_000_000, 0).saturating_mul(o.into())) + // Standard Error: 2_298 + .saturating_add(Weight::from_parts(11_280, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } } // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + + /// Storage: VaultRegistry Vaults (r:1 w:1) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:2 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) @@ -485,8 +571,6 @@ impl WeightInfo for () { /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) @@ -528,14 +612,14 @@ impl WeightInfo for () { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) - fn request_redeem() -> Weight { + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + fn request_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `4672` - // Estimated: `47658` - // Minimum execution time: 311_664_000 picoseconds. - Weight::from_parts(315_792_000, 47658) - .saturating_add(RocksDbWeight::get().reads(29_u64)) + // Measured: `3161` + // Estimated: `6260` + // Minimum execution time: 270_000_000 picoseconds. + Weight::from_parts(270_000_000, 6260) + .saturating_add(RocksDbWeight::get().reads(28_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: Tokens Accounts (r:3 w:3) @@ -562,17 +646,17 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Loans AccountDeposits (r:1 w:0) /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) - fn liquidation_redeem() -> Weight { + fn liquidation_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `3861` - // Estimated: `40975` - // Minimum execution time: 279_078_000 picoseconds. - Weight::from_parts(282_886_000, 40975) + // Measured: `2193` + // Estimated: `8760` + // Minimum execution time: 257_000_000 picoseconds. + Weight::from_parts(257_000_000, 8760) .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -592,32 +676,28 @@ impl WeightInfo for () { /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// The range of component `h` is `[2, 10]`. /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[2, 3]`. /// The range of component `b` is `[541, 2048]`. - fn execute_redeem(h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_redeem (h: u32, _i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3463` - // Estimated: `18221` - // Minimum execution time: 180_491_000 picoseconds. - Weight::from_parts(156_971_337, 18221) - // Standard Error: 18_912 - .saturating_add(Weight::from_parts(1_667_781, 0).saturating_mul(h.into())) - // Standard Error: 17_010 - .saturating_add(Weight::from_parts(730_184, 0).saturating_mul(i.into())) - // Standard Error: 102_447 - .saturating_add(Weight::from_parts(810_488, 0).saturating_mul(o.into())) - // Standard Error: 103 - .saturating_add(Weight::from_parts(5_905, 0).saturating_mul(b.into())) + // Measured: `2268 + o * (1 ±0)` + // Estimated: `3743` + // Minimum execution time: 176_000_000 picoseconds. + Weight::from_parts(151_584_172, 3743) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(2_562_500, 0).saturating_mul(h.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(500_000, 0).saturating_mul(o.into())) + // Standard Error: 574 + .saturating_add(Weight::from_parts(8_958, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -625,7 +705,7 @@ impl WeightInfo for () { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -687,11 +767,11 @@ impl WeightInfo for () { /// Storage: VaultRewards TotalStake (r:1 w:1) /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) /// Storage: VaultRewards RewardCurrencies (r:1 w:0) - /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(138), added: 2613, mode: MaxEncodedLen) + /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(50), added: 2525, mode: MaxEncodedLen) /// Storage: VaultCapacity TotalStake (r:1 w:1) /// Proof: VaultCapacity TotalStake (max_values: None, max_size: Some(32), added: 2507, mode: MaxEncodedLen) /// Storage: VaultCapacity RewardCurrencies (r:1 w:0) - /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(127), added: 2602, mode: MaxEncodedLen) + /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(39), added: 2514, mode: MaxEncodedLen) /// Storage: Loans RewardSupplyState (r:1 w:1) /// Proof: Loans RewardSupplyState (max_values: None, max_size: Some(47), added: 2522, mode: MaxEncodedLen) /// Storage: Loans RewardSupplySpeed (r:1 w:0) @@ -704,19 +784,17 @@ impl WeightInfo for () { /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) /// Storage: VaultRegistry PunishmentDelay (r:1 w:0) /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn cancel_redeem_reimburse() -> Weight { + fn cancel_redeem_reimburse () -> Weight { // Proof Size summary in bytes: - // Measured: `7166` - // Estimated: `135176` - // Minimum execution time: 798_478_000 picoseconds. - Weight::from_parts(808_188_000, 135176) - .saturating_add(RocksDbWeight::get().reads(60_u64)) + // Measured: `5403` + // Estimated: `11350` + // Minimum execution time: 782_000_000 picoseconds. + Weight::from_parts(782_000_000, 11350) + .saturating_add(RocksDbWeight::get().reads(59_u64)) .saturating_add(RocksDbWeight::get().writes(29_u64)) } - /// Storage: Security ParachainStatus (r:1 w:0) - /// Proof: Security ParachainStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -724,7 +802,7 @@ impl WeightInfo for () { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -786,11 +864,11 @@ impl WeightInfo for () { /// Storage: VaultRewards TotalStake (r:1 w:1) /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) /// Storage: VaultRewards RewardCurrencies (r:1 w:0) - /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(138), added: 2613, mode: MaxEncodedLen) + /// Proof: VaultRewards RewardCurrencies (max_values: None, max_size: Some(50), added: 2525, mode: MaxEncodedLen) /// Storage: VaultCapacity TotalStake (r:1 w:1) /// Proof: VaultCapacity TotalStake (max_values: None, max_size: Some(32), added: 2507, mode: MaxEncodedLen) /// Storage: VaultCapacity RewardCurrencies (r:1 w:0) - /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(127), added: 2602, mode: MaxEncodedLen) + /// Proof: VaultCapacity RewardCurrencies (max_values: None, max_size: Some(39), added: 2514, mode: MaxEncodedLen) /// Storage: Loans RewardSupplyState (r:1 w:1) /// Proof: Loans RewardSupplyState (max_values: None, max_size: Some(47), added: 2522, mode: MaxEncodedLen) /// Storage: Loans RewardSupplySpeed (r:1 w:0) @@ -803,64 +881,117 @@ impl WeightInfo for () { /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) /// Storage: VaultRegistry PunishmentDelay (r:1 w:0) /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn cancel_redeem_retry() -> Weight { + fn cancel_redeem_retry () -> Weight { // Proof Size summary in bytes: - // Measured: `7166` - // Estimated: `132666` - // Minimum execution time: 729_751_000 picoseconds. - Weight::from_parts(738_648_000, 132666) - .saturating_add(RocksDbWeight::get().reads(59_u64)) + // Measured: `5403` + // Estimated: `11350` + // Minimum execution time: 706_000_000 picoseconds. + Weight::from_parts(706_000_000, 11350) + .saturating_add(RocksDbWeight::get().reads(58_u64)) .saturating_add(RocksDbWeight::get().writes(28_u64)) } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: Redeem RedeemPeriod (r:1 w:0) + /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) + /// Storage: Fee PunishmentFee (r:1 w:0) + /// Proof: Fee PunishmentFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: VaultStaking Nonce (r:1 w:0) + /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) + /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry TotalUserVaultCollateral (r:1 w:1) + /// Proof: VaultRegistry TotalUserVaultCollateral (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultCapacity Stake (r:1 w:0) + /// Proof: VaultCapacity Stake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardPerToken (r:2 w:0) + /// Proof: VaultCapacity RewardPerToken (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardTally (r:2 w:2) + /// Proof: VaultCapacity RewardTally (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultCapacity TotalRewards (r:2 w:2) + /// Proof: VaultCapacity TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultRewards Stake (r:1 w:0) + /// Proof: VaultRewards Stake (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardPerToken (r:2 w:0) + /// Proof: VaultRewards RewardPerToken (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardTally (r:2 w:2) + /// Proof: VaultRewards RewardTally (max_values: None, max_size: Some(124), added: 2599, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalRewards (r:2 w:2) + /// Proof: VaultRewards TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Fee Commission (r:1 w:0) + /// Proof: Fee Commission (max_values: None, max_size: Some(86), added: 2561, mode: MaxEncodedLen) + /// Storage: VaultStaking RewardPerToken (r:2 w:2) + /// Proof: VaultStaking RewardPerToken (max_values: None, max_size: Some(117), added: 2592, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalStake (r:1 w:0) + /// Proof: VaultStaking TotalStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) + /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalStake (r:1 w:0) + /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + fn cancel_replace () -> Weight { + // Proof Size summary in bytes: + // Measured: `4404` + // Estimated: `6364` + // Minimum execution time: 394_000_000 picoseconds. + Weight::from_parts(394_000_000, 6364) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(15_u64)) + } /// Storage: Redeem RedeemPeriod (r:0 w:1) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - fn set_redeem_period() -> Weight { + fn set_redeem_period () -> Weight { // Proof Size summary in bytes: - // Measured: `1025` + // Measured: `0` // Estimated: `0` - // Minimum execution time: 28_527_000 picoseconds. - Weight::from_parts(29_970_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) - fn self_redeem() -> Weight { + fn self_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `2449` - // Estimated: `7835` - // Minimum execution time: 147_756_000 picoseconds. - Weight::from_parts(149_109_000, 7835) + // Measured: `1399` + // Estimated: `3677` + // Minimum execution time: 116_000_000 picoseconds. + Weight::from_parts(116_000_000, 3677) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: VaultRegistry Vaults (r:2 w:2) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: BTCRelay StartBlockHeight (r:1 w:0) /// Proof: BTCRelay StartBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: Oracle Aggregate (r:3 w:0) - /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: Fee IssueGriefingCollateral (r:1 w:0) - /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Tokens Accounts (r:1 w:1) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:2 w:0) /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:2 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -873,8 +1004,6 @@ impl WeightInfo for () { /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) /// Proof: Fee RedeemFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Redeem RedeemTransactionSize (r:1 w:0) - /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry PremiumRedeemThreshold (r:1 w:0) @@ -885,15 +1014,54 @@ impl WeightInfo for () { /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) - /// Storage: Redeem Requests (r:0 w:1) - /// Proof: Redeem Requests (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - fn request_replace() -> Weight { + fn request_replace () -> Weight { // Proof Size summary in bytes: - // Measured: `3277` - // Estimated: `8547` - // Minimum execution time: 39_015_000_000 picoseconds. - Weight::from_parts(39_015_000_000, 8547) - .saturating_add(RocksDbWeight::get().reads(27_u64)) - .saturating_add(RocksDbWeight::get().writes(7_u64)) + // Measured: `2735` + // Estimated: `6364` + // Minimum execution time: 38_446_000_000 picoseconds. + Weight::from_parts(38_446_000_000, 6364) + .saturating_add(RocksDbWeight::get().reads(21_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) } -} + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) + /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay Chains (r:1 w:0) + /// Proof: BTCRelay Chains (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) + /// Storage: BTCRelay BlockHeaders (r:1 w:0) + /// Proof: BTCRelay BlockHeaders (max_values: None, max_size: Some(200), added: 2675, mode: MaxEncodedLen) + /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) + /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) + /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// The range of component `h` is `[2, 10]`. + /// The range of component `i` is `[1, 10]`. + /// The range of component `o` is `[2, 3]`. + /// The range of component `b` is `[541, 2048]`. + fn execute_replace (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2310` + // Estimated: `6364` + // Minimum execution time: 178_000_000 picoseconds. + Weight::from_parts(108_702_702, 6364) + // Standard Error: 433_012 + .saturating_add(Weight::from_parts(3_875_000, 0).saturating_mul(h.into())) + // Standard Error: 384_900 + .saturating_add(Weight::from_parts(1_444_444, 0).saturating_mul(i.into())) + // Standard Error: 3_464_101 + .saturating_add(Weight::from_parts(8_000_000, 0).saturating_mul(o.into())) + // Standard Error: 2_298 + .saturating_add(Weight::from_parts(11_280, 0).saturating_mul(b.into())) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } +} \ No newline at end of file diff --git a/crates/redeem/src/ext.rs b/crates/redeem/src/ext.rs index e7ad363ca0..ba51790e80 100644 --- a/crates/redeem/src/ext.rs +++ b/crates/redeem/src/ext.rs @@ -43,18 +43,20 @@ pub(crate) mod vault_registry { use frame_support::dispatch::{DispatchError, DispatchResult}; use vault_registry::types::{CurrencyId, CurrencySource, DefaultVault}; + pub fn is_vault_fully_replacing( + vault_id: &DefaultVaultId, + to_redeem_tokens: &Amount, + ) -> Result { + >::is_vault_fully_replacing(vault_id, to_redeem_tokens) + } + pub fn cancel_replace_tokens( old_vault_id: &DefaultVaultId, new_vault_id: &DefaultVaultId, - tokens: &Amount, + redeem_tokens: &Amount, + issue_tokens: &Amount, ) -> DispatchResult { - >::cancel_replace_tokens(old_vault_id, new_vault_id, tokens) - } - - pub fn requestable_to_be_replaced_tokens( - vault_id: &DefaultVaultId, - ) -> Result, DispatchError> { - >::requestable_to_be_replaced_tokens(vault_id) + >::cancel_replace_tokens(old_vault_id, new_vault_id, redeem_tokens, issue_tokens) } pub fn get_liquidated_collateral( @@ -256,15 +258,11 @@ pub(crate) mod issue { >::_complete_vault_issue(issue_id) } - pub fn get_vault_from_id_from_issue_id( - issue_id: &H256, - ) -> Result, DispatchError> { - >::get_vault_from_id_from_issue_id(issue_id) + pub fn get_vault_from_issue_id(issue_id: &H256) -> Result, DispatchError> { + >::get_vault_from_issue_id(issue_id) } - pub fn cancel_issue_request_and_slash_collateral( - issue_id: &H256, - ) -> Result, DispatchError> { - >::cancel_issue_request_and_slash_collateral(issue_id) + pub fn cancel_issue(issue_id: H256, redeemer: T::AccountId) -> Result<(), DispatchError> { + >::_cancel_issue(redeemer, issue_id) } } diff --git a/crates/redeem/src/lib.rs b/crates/redeem/src/lib.rs index 887212c2e5..7f24d54d11 100644 --- a/crates/redeem/src/lib.rs +++ b/crates/redeem/src/lib.rs @@ -53,6 +53,21 @@ use vault_registry::{ pub use pallet::*; use primitives::{AccountOrVault, VaultId}; +fn calculate_weight( + merkle_proof_hashes: u32, + inputs_len: u32, + outputs_len: u32, + tx_encoded_len: u32, +) -> Weight { + ::WeightInfo::execute_redeem(merkle_proof_hashes, inputs_len, outputs_len, tx_encoded_len) + .saturating_add(::WeightInfo::execute_redeem( + merkle_proof_hashes, + inputs_len, + outputs_len, + tx_encoded_len, + )) +} + /// Complexity: /// - `O(H + I + O + B)` where: /// - `H` is the number of hashes in the merkle tree @@ -60,18 +75,21 @@ use primitives::{AccountOrVault, VaultId}; /// - `O` is the number of transaction outputs /// - `B` is `transaction` size in bytes (length-fee-bounded) fn weight_for_execute_redeem(proof: &FullTransactionProof) -> Weight { - ::WeightInfo::execute_redeem( + let execute_redeem_weight = calculate_weight::( + proof.user_tx_proof.merkle_proof.hashes.len() as u32, // H + proof.user_tx_proof.transaction.inputs.len() as u32, // I + proof.user_tx_proof.transaction.outputs.len() as u32, // O + proof.user_tx_proof.tx_encoded_len, + ); + + let execute_replace_weight = calculate_weight::( proof.user_tx_proof.merkle_proof.hashes.len() as u32, // H proof.user_tx_proof.transaction.inputs.len() as u32, // I proof.user_tx_proof.transaction.outputs.len() as u32, // O proof.user_tx_proof.tx_encoded_len, - ) - .saturating_add(::WeightInfo::execute_redeem( - proof.coinbase_proof.merkle_proof.hashes.len() as u32, // H - proof.coinbase_proof.transaction.inputs.len() as u32, // I - proof.coinbase_proof.transaction.outputs.len() as u32, // O - proof.coinbase_proof.tx_encoded_len, - )) + ); + + execute_redeem_weight.max(execute_replace_weight) } #[frame_support::pallet] @@ -79,7 +97,6 @@ pub mod pallet { use super::*; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; - use primitives::{AccountOrVault, VaultId}; use vault_registry::types::DefaultVaultCurrencyPair; /// ## Configuration @@ -132,8 +149,8 @@ pub mod pallet { issue_id: H256, old_vault: DefaultVaultId, new_vault: DefaultVaultId, - slashed_amount: BalanceOf, status: RedeemRequestStatus, + punishment_fee: BalanceOf, }, MintTokensForReimbursedRedeem { redeem_id: H256, @@ -176,6 +193,8 @@ pub mod pallet { ReplaceSelfNotAllowed, /// Vault cannot replace different currency. InvalidWrappedCurrency, + /// The issue id is not found for replace request + IsseeIdNotFoundForReplaceRequest, } /// The time difference in number of blocks between a redeem request is created and required completion time by a @@ -198,11 +217,6 @@ pub mod pallet { #[pallet::getter(fn redeem_btc_dust_value)] pub(super) type RedeemBtcDustValue = StorageValue<_, BalanceOf, ValueQuery>; - /// This mapping provides an access from a unique hash redeemId to a issueId hash - #[pallet::storage] - #[pallet::getter(fn redeem_issue_requests)] - pub(super) type Requests = StorageMap<_, Blake2_128Concat, H256, H256, OptionQuery>; - /// the expected size in bytes of the redeem bitcoin transfer #[pallet::storage] #[pallet::getter(fn redeem_transaction_size)] @@ -246,7 +260,11 @@ pub mod pallet { } #[pallet::hooks] - impl Hooks for Pallet {} + impl Hooks for Pallet { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + crate::types::v1::migrate_v0_to_v1::() + } + } #[pallet::pallet] pub struct Pallet(_); @@ -341,7 +359,14 @@ pub mod pallet { /// and slash the Vault, or wishes to keep the tokens (and retry /// Redeem with another Vault) #[pallet::call_index(3)] - #[pallet::weight(if *reimburse { ::WeightInfo::cancel_redeem_reimburse() } else { ::WeightInfo::cancel_redeem_retry() })] + #[pallet::weight( + ::WeightInfo::cancel_replace() + .max(if *reimburse { + ::WeightInfo::cancel_redeem_reimburse() + } else { + ::WeightInfo::cancel_redeem_retry() + }) + )] #[transactional] pub fn cancel_redeem(origin: OriginFor, redeem_id: H256, reimburse: bool) -> DispatchResultWithPostInfo { let redeemer = ensure_signed(origin)?; @@ -555,25 +580,12 @@ impl Pallet { // don't allow vaults to replace themselves ensure!(old_vault != new_vault, Error::::ReplaceSelfNotAllowed); - // Calculate requestable tokens for old vault - let max_requestable_tokens: Amount = - ext::vault_registry::requestable_to_be_replaced_tokens::(&old_vault_id)?; - let requestable_tokens = amount.min(max_requestable_tokens.amount()); - // Initiate issue call - let (issue_id, btc_address) = ext::issue::request_vault_issue::( - old_vault.clone(), - requestable_tokens, - new_vault_id.clone(), - griefing_currency, - )?; + let (issue_id, btc_address) = + ext::issue::request_vault_issue::(old_vault.clone(), amount, new_vault_id.clone(), griefing_currency)?; // Initiate redeem call - let redeem_id = - Self::_request_redeem(new_vault, requestable_tokens, btc_address, old_vault_id, Some(issue_id))?; - - // Store the request IDs - Self::insert_request(&redeem_id, &issue_id); + Self::_request_redeem(new_vault, amount, btc_address, old_vault_id, Some(issue_id))?; Ok(()) } @@ -586,54 +598,78 @@ impl Pallet { issue_id: Option, ) -> Result { let amount_wrapped = Amount::new(amount_wrapped, vault_id.wrapped_currency()); + let is_replace_request = redeemer.is_vault_account(); + + // We saw a user lose bitcoin when they forgot to enter the address in the polkadot-js ui. + // Make sure this can't happen again. + ensure!(!btc_address.is_zero(), btc_relay::Error::::InvalidBtcHash); + + ext::vault_registry::ensure_not_banned::(&vault_id)?; + + let (fee_wrapped, inclusion_fee, user_to_be_received_btc) = if is_replace_request { + // If vault if completely replacing the collateral then don't charge fees + let fee_wrapped = if ext::vault_registry::is_vault_fully_replacing::(&vault_id, &amount_wrapped)? { + Amount::zero(vault_id.wrapped_currency()) + } else { + ext::fee::get_redeem_fee::(&amount_wrapped)? + }; + + // only allow requests of amount above above the minimum + ensure!( + // this is the amount the vault will send (minus fee) + amount_wrapped.ge(&Self::get_dust_value(vault_id.wrapped_currency()))?, + Error::::AmountBelowDustAmount + ); + + // increased the to_be_redeem tokens by amount_wrapped - fee_wrapped + ext::vault_registry::try_increase_to_be_redeemed_tokens::( + &vault_id, + &amount_wrapped.checked_sub(&fee_wrapped)?, + )?; - // if redeemer is vault then it's a replace request, skip wrapped tokens balance check for - // it - if !redeemer.is_vault_account() { + ( + fee_wrapped, + // the inclusion fee is paid by new vault itself hence we can set it as zero + Amount::zero(vault_id.wrapped_currency()), + // the new vault (redeemer) should receive the whole amount without deduction of fees + // as fee handling is done by new vault itself + amount_wrapped, + ) + } else { let redeemer_balance = ext::treasury::get_balance::(&redeemer.get_account(), vault_id.wrapped_currency()); ensure!( amount_wrapped.le(&redeemer_balance)?, - Error::::AmountExceedsUserBalance + Error::::AmountExceedsUserBalance, ); - } - // We saw a user lose bitcoin when they forgot to enter the address in the polkadot-js ui. - // Make sure this can't happen again. - ensure!(!btc_address.is_zero(), btc_relay::Error::::InvalidBtcHash); - - // todo: currently allowed to redeem from one currency to the other for free - decide if this is desirable - let mut fee_wrapped = if redeemer.get_account().clone() == vault_id.account_id { - Amount::zero(vault_id.wrapped_currency()) - } else { - ext::fee::get_redeem_fee::(&amount_wrapped)? - }; - let mut inclusion_fee = Self::get_current_inclusion_fee(vault_id.wrapped_currency())?; + let fee_wrapped = if redeemer.get_account().clone() == vault_id.account_id { + Amount::zero(vault_id.wrapped_currency()) + } else { + ext::fee::get_redeem_fee::(&amount_wrapped)? + }; - let vault_to_be_burned_tokens = amount_wrapped.checked_sub(&fee_wrapped)?; + let inclusion_fee = Self::get_current_inclusion_fee(vault_id.wrapped_currency())?; - // this can overflow for small requested values. As such return AmountBelowDustAmount when this happens - let user_to_be_received_btc = vault_to_be_burned_tokens - .checked_sub(&inclusion_fee) - .map_err(|_| Error::::AmountBelowDustAmount)?; + let vault_to_be_burned_tokens = amount_wrapped.checked_sub(&fee_wrapped)?; - ext::vault_registry::ensure_not_banned::(&vault_id)?; + let user_to_be_received_btc = vault_to_be_burned_tokens + .checked_sub(&inclusion_fee) + .map_err(|_| Error::::AmountBelowDustAmount)?; - // only allow requests of amount above above the minimum - ensure!( - // this is the amount the vault will send (minus fee) - user_to_be_received_btc.ge(&Self::get_dust_value(vault_id.wrapped_currency()))?, - Error::::AmountBelowDustAmount - ); + // only allow requests of amount above above the minimum + ensure!( + // this is the amount the vault will send (minus fee) + user_to_be_received_btc.ge(&Self::get_dust_value(vault_id.wrapped_currency()))?, + Error::::AmountBelowDustAmount + ); - if redeemer.is_vault_account() { - // increased the to_be_redeem tokens by amount_wrapped since a request replace - ext::vault_registry::try_increase_to_be_redeemed_tokens::(&vault_id, &amount_wrapped)?; - } else { // vault will get rid of the btc + btc_inclusion_fee ext::vault_registry::try_increase_to_be_redeemed_tokens::(&vault_id, &vault_to_be_burned_tokens)?; amount_wrapped.lock_on(redeemer.get_account())?; - } + + (fee_wrapped, inclusion_fee, user_to_be_received_btc) + }; let redeem_id = ext::security::get_secure_id::(redeemer.get_account()); @@ -647,14 +683,6 @@ impl Pallet { Amount::zero(currency_id) }; - let to_be_received_btc = if redeemer.is_vault_account() { - fee_wrapped = Amount::zero(vault_id.wrapped_currency()); - inclusion_fee = Amount::zero(vault_id.wrapped_currency()); - amount_wrapped.amount() - } else { - user_to_be_received_btc.amount() - }; - Self::insert_redeem_request( &redeem_id, &RedeemRequest { @@ -662,7 +690,7 @@ impl Pallet { opentime: ext::security::active_block_number::(), fee: fee_wrapped.amount(), transfer_fee_btc: inclusion_fee.amount(), - amount_btc: to_be_received_btc, + amount_btc: user_to_be_received_btc.amount(), premium: premium_collateral.amount(), period: Self::redeem_period(), redeemer: redeemer.get_account().clone(), @@ -676,7 +704,7 @@ impl Pallet { Self::deposit_event(Event::::RequestRedeem { redeem_id, redeemer: redeemer.get_account().clone(), - amount: to_be_received_btc, + amount: user_to_be_received_btc.amount(), fee: fee_wrapped.amount(), premium: premium_collateral.amount(), vault_id, @@ -724,20 +752,29 @@ impl Pallet { redeem_id, )?; - if redeem.is_redeem_a_replace_request() { + // if redeem has issue_id its a replace request + if let Some(issue_id) = redeem.issue_id { + let replace_fee = redeem.fee(); + //redeem tokens for old vault + let redeem_tokens = redeem.amount_btc().checked_sub(&replace_fee)?; + + //Decreases to_be_redeem and issued tokens for old vault ext::vault_registry::redeem_tokens::( &redeem.vault, - &redeem.amount_btc(), + &redeem_tokens, &redeem.premium()?, &redeem.redeemer, )?; - // get issue_id from redeem_id - let issue_id = >::get(redeem_id).ok_or(Error::::RedeemIdNotFound)?; - // complete_vault_issue increases issued_tokens & decreases to_be_issued for new vault ext::issue::complete_vault_issue::(issue_id)?; + + // mint wrapped fees + replace_fee.mint_to(&ext::fee::fee_pool_account_id::())?; + + // distribute rewards + ext::fee::distribute_rewards::(&replace_fee)?; } else { // burn amount (without parachain fee, but including transfer fee) let burn_amount = redeem.amount_btc().checked_add(&redeem.transfer_fee_btc())?; @@ -765,20 +802,14 @@ impl Pallet { Ok(()) } - fn _cancel_redeem_request(redeemer: T::AccountId, redeem_id: H256, reimburse: bool) -> DispatchResult { - let redeem = Self::get_open_redeem_request_from_id(&redeem_id)?; + fn _cancel_redeem_request( + redeem: DefaultRedeemRequest, + redeemer: T::AccountId, + redeem_id: H256, + reimburse: bool, + ) -> DispatchResult { ensure!(redeemer == redeem.redeemer, Error::::UnauthorizedRedeemer); - // only cancellable after the request has expired - ensure!( - ext::btc_relay::has_request_expired::( - redeem.opentime, - redeem.btc_height, - Self::redeem_period().max(redeem.period) - )?, - Error::::TimeNotExpired - ); - let vault = ext::vault_registry::get_vault_from_id::(&redeem.vault)?; let vault_to_be_redeemed_tokens = Amount::new(vault.to_be_redeemed_tokens, redeem.vault.wrapped_currency()); let vault_id = redeem.vault.clone(); @@ -875,30 +906,40 @@ impl Pallet { Ok(()) } - // Cancels a redeem request, replaces it with a new issue request, adjusts vault balances, and - // updates the system state. - fn _cancel_replace_request(redeem_id: H256, issue_id: H256) -> DispatchResult { - let redeem = Self::get_open_redeem_request_from_id(&redeem_id)?; + // Cancels a replace request + fn _cancel_replace_request( + redeem: DefaultRedeemRequest, + redeem_id: H256, + issue_id: H256, + redeemer: T::AccountId, + ) -> DispatchResult { + let old_vault_id = redeem.vault.clone(); + let new_vault_id = ext::issue::get_vault_from_issue_id::(&issue_id)?; - // only cancellable after the request has expired - ensure!( - ext::btc_relay::has_request_expired::( - redeem.opentime, - redeem.btc_height, - Self::redeem_period().max(redeem.period) - )?, - Error::::TimeNotExpired - ); + // cancel issue request + ext::issue::cancel_issue::(issue_id, redeemer)?; - let old_vault_id = &redeem.vault; - let new_vault_id = ext::issue::get_vault_from_id_from_issue_id::(&issue_id)?; + let redeem_tokens = redeem.amount_btc().checked_sub(&redeem.fee())?; // decrease old-vault's to-be-redeemed tokens, and // decrease new-vault's to-be-issued tokens - ext::vault_registry::cancel_replace_tokens::(&old_vault_id, &new_vault_id, &redeem.amount_btc())?; + ext::vault_registry::cancel_replace_tokens::( + &old_vault_id, + &new_vault_id, + &redeem_tokens, + &redeem.amount_btc(), + )?; + + let amount_wrapped_in_collateral = redeem.amount_btc().convert_to(old_vault_id.collateral_currency())?; - // cancel issue request and slash collateral - let slashed_amount = ext::issue::cancel_issue_request_and_slash_collateral::(&issue_id)?; + // calculate the punishment fee (e.g. 10%) + let punishment_fee = ext::fee::get_punishment_fee::(&amount_wrapped_in_collateral)?; + + ext::vault_registry::transfer_funds_saturated::( + CurrencySource::Collateral(old_vault_id.clone()), + CurrencySource::FreeBalance(new_vault_id.account_id.clone()), + &punishment_fee, + )?; // Set the status of the redeem request to "Cancelled" Self::set_redeem_status(redeem_id, RedeemRequestStatus::Cancelled); @@ -907,27 +948,35 @@ impl Pallet { Self::deposit_event(Event::::CancelReplace { redeem_id, issue_id, - old_vault: old_vault_id.clone(), - new_vault: new_vault_id.clone(), - slashed_amount, + old_vault: old_vault_id, + new_vault: new_vault_id, status: RedeemRequestStatus::Cancelled, + punishment_fee: punishment_fee.amount(), }); Ok(()) } fn _cancel_redeem(redeemer: T::AccountId, redeem_id: H256, reimburse: bool) -> DispatchResult { - // Retrieve the request associated with the redeem_id - let request = >::get(redeem_id); + // Retrieve the redeem request associated with the redeem_id + let redeem = Self::get_open_redeem_request_from_id(&redeem_id)?; + + // only cancellable after the request has expired + ensure!( + ext::btc_relay::has_request_expired::( + redeem.opentime, + redeem.btc_height, + Self::redeem_period().max(redeem.period) + )?, + Error::::TimeNotExpired + ); - if request.is_none() { - // If there's no associated request, cancel the redeem request - Self::_cancel_redeem_request(redeemer, redeem_id, reimburse) + if let Some(issue_id) = redeem.issue_id { + // Cancel the replace request using the redeem request, redeem_id and issue_id + Self::_cancel_replace_request(redeem, redeem_id, issue_id, redeemer) } else { - // If there's an associated request, retrieve its issue_id - let issue_id = request.ok_or(Error::::InvalidCancelRequest)?; - // Cancel the replace request using the redeem_id and issue_id - Self::_cancel_replace_request(redeem_id, issue_id) + // If there's no associated issue_id, cancel the redeem request + Self::_cancel_redeem_request(redeem, redeemer, redeem_id, reimburse) } } @@ -957,16 +1006,6 @@ impl Pallet { Ok(()) } - /// Insert a new request replace. - /// - /// # Arguments - /// - /// * `key` - 256-bit identifier of the redeem request - /// * `value` - 256-bit identifier of the issue request - fn insert_request(key: &H256, value: &H256) { - >::insert(key, value); - } - /// Insert a new redeem request into state. /// /// # Arguments diff --git a/crates/redeem/src/tests.rs b/crates/redeem/src/tests.rs index 5971da5588..5692be2f35 100644 --- a/crates/redeem/src/tests.rs +++ b/crates/redeem/src/tests.rs @@ -53,6 +53,8 @@ fn default_vault() -> DefaultVault { #[test] fn test_request_redeem_fails_with_amount_exceeds_user_balance() { run_test(|| { + ext::vault_registry::ensure_not_banned::.mock_safe(move |_vault_id| MockResult::Return(Ok(()))); + let amount = Amount::::new(2, ::GetWrappedCurrencyId::get()); amount.mint_to(&USER).unwrap(); let amount = 10_000_000; @@ -567,6 +569,7 @@ fn test_cancel_redeem_fails_with_time_not_expired() { #[test] fn test_cancel_redeem_fails_with_unauthorized_caller() { run_test(|| { + ext::btc_relay::has_request_expired::.mock_safe(|_, _, _| MockResult::Return(Ok(true))); Security::::set_active_block_number(20); Redeem::get_open_redeem_request_from_id.mock_safe(|_| { @@ -734,14 +737,13 @@ mod redeem_replace_tests { fn setup_mocks() { ext::vault_registry::ensure_not_banned::.mock_safe(|_| MockResult::Return(Ok(()))); - ext::vault_registry::requestable_to_be_replaced_tokens:: - .mock_safe(move |_| MockResult::Return(Ok(wrapped(1000000)))); ext::vault_registry::transfer_funds::.mock_safe(|_, _, _| MockResult::Return(Ok(()))); ext::vault_registry::try_increase_to_be_redeemed_tokens:: .mock_safe(move |_vault_id, _amount| MockResult::Return(Ok(()))); ext::security::get_secure_id::.mock_safe(move |_| MockResult::Return(H256([0; 32]))); ext::vault_registry::is_vault_below_premium_threshold:: .mock_safe(move |_vault_id| MockResult::Return(Ok(false))); + ext::vault_registry::is_vault_fully_replacing::.mock_safe(move |_, _| MockResult::Return(Ok(false))); } fn setup_execute_redeem() { @@ -754,9 +756,11 @@ mod redeem_replace_tests { ext::btc_relay::verify_and_validate_op_return_transaction:: .mock_safe(|_, _, _, _| MockResult::Return(Ok(()))); ext::btc_relay::has_request_expired::.mock_safe(|_, _, _| MockResult::Return(Ok(true))); - ext::issue::get_vault_from_id_from_issue_id::.mock_safe(|_| MockResult::Return(Ok(NEW_VAULT))); - ext::vault_registry::cancel_replace_tokens::.mock_safe(|_, _, _| MockResult::Return(Ok(()))); - ext::issue::cancel_issue_request_and_slash_collateral::.mock_safe(|_| MockResult::Return(Ok(1))); + ext::issue::get_vault_from_issue_id::.mock_safe(|_| MockResult::Return(Ok(NEW_VAULT))); + ext::vault_registry::cancel_replace_tokens::.mock_safe(|_, _, _, _| MockResult::Return(Ok(()))); + ext::vault_registry::transfer_funds_saturated:: + .mock_safe(move |_, _, amount| MockResult::Return(Ok(amount.clone()))); + ext::issue::cancel_issue::.mock_safe(|_, _| MockResult::Return(Ok(()))); let amount = 10; assert_ok!(Redeem::request_replace( @@ -850,8 +854,8 @@ mod redeem_replace_tests { issue_id: H256([1; 32]), old_vault: OLD_VAULT, new_vault: NEW_VAULT, - slashed_amount: 1, status: RedeemRequestStatus::Cancelled, + punishment_fee: 1, }); assert_err!( diff --git a/crates/redeem/src/types.rs b/crates/redeem/src/types.rs index c14ddc4c6a..f3d473d52c 100644 --- a/crates/redeem/src/types.rs +++ b/crates/redeem/src/types.rs @@ -4,15 +4,93 @@ use scale_info::TypeInfo; use sp_runtime::DispatchError; use vault_registry::types::CurrencyId; -use crate::Config; +use crate::{Config, Pallet}; +use btc_relay::BtcAddress; use codec::{Decode, Encode, MaxEncodedLen}; use currency::Amount; +use frame_support::{pallet_prelude::OptionQuery, traits::Get, Blake2_128Concat}; +use sp_core::H256; /// Storage version. -#[derive(Encode, Decode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] +#[derive(Debug, Encode, Decode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] pub enum Version { /// Initial version. V0, + /// Added `issue_id` to `RedeemRequest` + V1, +} + +mod v0 { + use super::*; + + pub type DefaultRedeemRequest = RedeemRequest< + ::AccountId, + ::BlockNumber, + BalanceOf, + CurrencyId, + >; + + #[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)] + pub struct RedeemRequest { + /// the vault associated with this redeem request + pub vault: VaultId, + /// the *active* block height when this request was opened + pub opentime: BlockNumber, + /// the redeem period when this request was opened + pub period: BlockNumber, + /// total redeem fees - taken from request amount + pub fee: Balance, + /// amount the vault should spend on the bitcoin inclusion fee - taken from request amount + pub transfer_fee_btc: Balance, + /// total amount of BTC for the vault to send + pub amount_btc: Balance, + /// premium redeem amount in collateral + pub premium: Balance, + /// the account redeeming tokens (for BTC) + pub redeemer: AccountId, + /// the user's Bitcoin address for payment verification + pub btc_address: BtcAddress, + /// the highest recorded height in the BTC-Relay (at time of opening) + pub btc_height: u32, + /// the status of this redeem request + pub status: RedeemRequestStatus, + } + + #[frame_support::storage_alias] + pub(super) type RedeemRequests = + StorageMap, Blake2_128Concat, H256, DefaultRedeemRequest, OptionQuery>; +} + +pub mod v1 { + use super::*; + + pub fn migrate_v0_to_v1() -> frame_support::weights::Weight { + if !matches!(crate::StorageVersion::::get(), Version::V0) { + return T::DbWeight::get().reads(1); // already upgraded; don't run migration + } + // update vault struct to remove replace pallet fields + crate::RedeemRequests::::translate(|_key, old: v0::DefaultRedeemRequest| { + Some(crate::DefaultRedeemRequest:: { + vault: old.vault, + opentime: old.opentime, + period: old.period, + fee: old.fee, + transfer_fee_btc: old.transfer_fee_btc, + amount_btc: old.amount_btc, + premium: old.premium, + redeemer: old.redeemer, + btc_address: old.btc_address, + btc_height: old.btc_height, + status: old.status, + issue_id: None, + }) + }); + + // update version + crate::StorageVersion::::put(Version::V1); + + T::DbWeight::get().reads_writes(0, 1) + } } pub(crate) type BalanceOf = ::Balance; @@ -47,3 +125,51 @@ impl RedeemRequestExt for RedeemRequest::get(), Version::V0); + + let old = v0::DefaultRedeemRequest:: { + vault: DefaultVaultId::::new(123, Token(DOT), Token(IBTC)), + opentime: 1, + period: 12313, + fee: 456, + transfer_fee_btc: 1, + amount_btc: 100, + premium: 0, + redeemer: USER, + btc_address: BtcAddress::random(), + btc_height: 0, + status: RedeemRequestStatus::Reimbursed(false), + }; + let key = H256::zero(); + v0::RedeemRequests::::insert(key, old.clone()); + + v1::migrate_v0_to_v1::(); + + assert_eq!(crate::StorageVersion::::get(), Version::V1); + + let new = crate::RedeemRequests::::get(key).unwrap(); + + assert!(old.vault == new.vault); + assert!(old.opentime == new.opentime); + assert!(old.period == new.period); + assert!(old.fee == new.fee); + assert!(old.transfer_fee_btc == new.transfer_fee_btc); + assert!(old.amount_btc == new.amount_btc); + assert!(old.premium == new.premium); + assert!(old.redeemer == new.redeemer); + assert!(old.btc_address == new.btc_address); + assert!(old.btc_height == new.btc_height); + assert!(old.status == new.status); + assert_eq!(new.issue_id.is_none(), true); + }); + } +} diff --git a/crates/vault-registry/src/lib.rs b/crates/vault-registry/src/lib.rs index b8ee2e79b0..0dfd43a2ae 100644 --- a/crates/vault-registry/src/lib.rs +++ b/crates/vault-registry/src/lib.rs @@ -111,7 +111,7 @@ pub mod pallet { } fn on_runtime_upgrade() -> frame_support::weights::Weight { - crate::types::v1::migrate_v1_to_v6::() + types::v7::migrate_v6_to_v7::() } } @@ -976,14 +976,6 @@ impl Pallet { Ok(btc_address) } - /// returns the amount of tokens that a vault can request to be replaced on top of the - /// current to-be-replaced tokens - pub fn requestable_to_be_replaced_tokens(vault_id: &DefaultVaultId) -> Result, DispatchError> { - let vault = Self::get_active_rich_vault_from_id(&vault_id)?; - - vault.issued_tokens().checked_sub(&vault.to_be_redeemed_tokens()) - } - /// Decreases the amount of tokens to be issued in the next issue request from the /// vault, or from the liquidation vault if the vault is liquidated /// @@ -1050,6 +1042,37 @@ impl Pallet { Ok(()) } + /// Checks if redeeming a certain amount of tokens from a vault would fully replace the vault's locked tokens. + /// + /// # Arguments + /// * `vault_id` - the id of the vault to check + /// * `to_redeem_tokens` - the amount of tokens to be redeemed + /// + /// # Errors + /// * `VaultNotFound` - if no vault exists for the given `vault_id` + /// * `InsufficientTokensCommitted` - if the amount of to-be-redeemed tokens is too low + /// + /// # Returns + /// `Ok(true)` if redeeming the specified `to_redeem_tokens` would fully replace the vault's locked tokens. + /// `Ok(false)` otherwise. + pub fn is_vault_fully_replacing( + vault_id: &DefaultVaultId, + to_redeem_tokens: &Amount, + ) -> Result { + let vault = Self::get_active_rich_vault_from_id(&vault_id)?; + let max_redeemable = vault.issued_tokens().checked_sub(&vault.to_be_redeemed_tokens())?; + ensure!( + max_redeemable.ge(&to_redeem_tokens)?, + Error::::InsufficientTokensCommitted + ); + + if to_redeem_tokens == &max_redeemable { + Ok(true) + } else { + Ok(false) + } + } + /// Subtracts an amount tokens from the to-be-redeemed tokens balance of a vault. /// /// # Arguments @@ -1279,7 +1302,8 @@ impl Pallet { pub fn cancel_replace_tokens( old_vault_id: &DefaultVaultId, new_vault_id: &DefaultVaultId, - tokens: &Amount, + redeem_tokens: &Amount, + issue_tokens: &Amount, ) -> DispatchResult { let mut old_vault = Self::get_rich_vault_from_id(&old_vault_id)?; let mut new_vault = Self::get_rich_vault_from_id(&new_vault_id)?; @@ -1287,7 +1311,7 @@ impl Pallet { if old_vault.data.is_liquidated() { let to_be_transferred = Self::calculate_collateral( &old_vault.liquidated_collateral(), - tokens, + redeem_tokens, &old_vault.to_be_redeemed_tokens(), )?; old_vault.decrease_liquidated_collateral(&to_be_transferred)?; @@ -1300,8 +1324,8 @@ impl Pallet { )?; } - old_vault.cancel_redeem_tokens(tokens)?; - new_vault.cancel_issue_tokens(tokens)?; + old_vault.cancel_redeem_tokens(redeem_tokens)?; + new_vault.cancel_issue_tokens(issue_tokens)?; Ok(()) } diff --git a/crates/vault-registry/src/tests.rs b/crates/vault-registry/src/tests.rs index 7e1ed457f1..0b0ef06c64 100644 --- a/crates/vault-registry/src/tests.rs +++ b/crates/vault-registry/src/tests.rs @@ -608,7 +608,12 @@ fn cancel_replace_tokens_succeeds() { assert_ok!(VaultRegistry::try_increase_to_be_redeemed_tokens(&old_id, &wrapped(50))); assert_ok!(VaultRegistry::try_increase_to_be_issued_tokens(&new_id, &wrapped(50))); - assert_ok!(VaultRegistry::cancel_replace_tokens(&old_id, &new_id, &wrapped(50))); + assert_ok!(VaultRegistry::cancel_replace_tokens( + &old_id, + &new_id, + &wrapped(50), + &wrapped(50) + )); let old_vault = VaultRegistry::get_active_rich_vault_from_id(&old_id).unwrap(); let new_vault = VaultRegistry::get_active_rich_vault_from_id(&new_id).unwrap(); diff --git a/crates/vault-registry/src/types.rs b/crates/vault-registry/src/types.rs index 9a32a828be..22a66aa7eb 100644 --- a/crates/vault-registry/src/types.rs +++ b/crates/vault-registry/src/types.rs @@ -5,6 +5,7 @@ use frame_support::{ dispatch::{DispatchError, DispatchResult}, ensure, traits::Get, + Blake2_128Concat, }; pub use primitives::{VaultCurrencyPair, VaultId}; use scale_info::TypeInfo; @@ -20,7 +21,7 @@ use mocktopus::macros::mockable; pub use bitcoin::{Address as BtcAddress, PublicKey as BtcPublicKey}; /// Storage version. -#[derive(Encode, Decode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] +#[derive(Debug, Encode, Decode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] pub enum Version { /// Initial version. V0, @@ -36,6 +37,10 @@ pub enum Version { V5, /// Removed wallet V6, + /// Removed replace pallet fields + /// Following fields have been removed from vault + /// `to_be_replaced_tokens`, `replace_collateral` and `active_replace_collateral` + V7, } #[derive(Debug, PartialEq)] @@ -92,18 +97,80 @@ pub type DefaultVaultId = VaultId<::AccountId, Cur pub type DefaultVaultCurrencyPair = VaultCurrencyPair>; -pub mod v1 { +mod v6 { + use super::*; + pub type DefaultVault = Vault< + ::AccountId, + ::BlockNumber, + BalanceOf, + CurrencyId, + UnsignedFixedPoint, + >; + + #[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] + #[cfg_attr(feature = "std", derive(Debug))] + pub struct Vault { + /// Account identifier of the Vault + pub id: VaultId, + /// Current status of the vault + pub status: VaultStatus, + /// Block height until which this Vault is banned from being used for + /// Issue, Redeem (except during automatic liquidation) and Replace. + pub banned_until: Option, + /// Custom secure collateral threshold + pub secure_collateral_threshold: Option, + /// Number of tokens pending issue + pub to_be_issued_tokens: Balance, + /// Number of issued tokens + pub issued_tokens: Balance, + /// Number of tokens pending redeem + pub to_be_redeemed_tokens: Balance, + /// Number of tokens that have been requested for a replace through + /// `request_replace`, but that have not been accepted yet by a new_vault. + pub to_be_replaced_tokens: Balance, + /// Amount of collateral that is available as griefing collateral to vaults accepting + /// a replace request. It is to be payed out if the old_vault fails to call execute_replace. + pub replace_collateral: Balance, + /// Amount of collateral locked for accepted replace requests. + pub active_replace_collateral: Balance, + /// Amount of collateral that is locked for remaining to_be_redeemed + /// tokens upon liquidation. + pub liquidated_collateral: Balance, + } + + #[frame_support::storage_alias] + pub(super) type Vaults = StorageMap, Blake2_128Concat, DefaultVaultId, DefaultVault>; +} +pub mod v7 { use super::*; - pub fn migrate_v1_to_v6() -> frame_support::weights::Weight { - // kintsugi is on V6 but interlay is still on V1 - if !matches!(crate::StorageVersion::::get(), Version::V1) { + pub fn migrate_v6_to_v7() -> frame_support::weights::Weight { + let mut weight = T::DbWeight::get().reads(1); + + // kintsugi is on V6 but interlay is also on V6 + if !matches!(crate::StorageVersion::::get(), Version::V6) { log::info!("Not running vault storage migration"); - return T::DbWeight::get().reads(1); // already upgraded; don't run migration + return weight; // already upgraded; don't run migration } - // nothing to do other than update version - crate::StorageVersion::::put(Version::V6); - T::DbWeight::get().reads_writes(0, 1) + + // update vault struct to remove replace pallet fields + crate::Vaults::::translate(|_key, old: v6::DefaultVault| { + weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1)); + Some(crate::DefaultVault:: { + id: old.id, + status: old.status, + banned_until: old.banned_until, + secure_collateral_threshold: old.secure_collateral_threshold, + to_be_issued_tokens: old.to_be_issued_tokens, + issued_tokens: old.issued_tokens, + to_be_redeemed_tokens: old.to_be_redeemed_tokens, + liquidated_collateral: old.liquidated_collateral, + }) + }); + + // update version + crate::StorageVersion::::put(Version::V7); + weight.saturating_add(T::DbWeight::get().reads_writes(0, 1)) } } @@ -735,3 +802,48 @@ impl From> for RichSystemVault { RichSystemVault { data: vault } } } + +#[cfg(test)] +mod test { + use super::*; + use crate::mock::{Test as T, *}; + + #[test] + fn migrating_from_v6_to_v7() { + run_test(|| { + crate::StorageVersion::::put(Version::V6); + + let old = v6::DefaultVault:: { + id: DefaultVaultId::::new(123, Token(DOT), Token(IBTC)), + status: VaultStatus::Active(true), + banned_until: None, + secure_collateral_threshold: Default::default(), + to_be_issued_tokens: 0u32.into(), + issued_tokens: 0u32.into(), + to_be_redeemed_tokens: 0u32.into(), + to_be_replaced_tokens: 0u32.into(), + replace_collateral: 0u32.into(), + active_replace_collateral: 0u32.into(), + liquidated_collateral: 0u32.into(), + }; + let key = DefaultVaultId::::new(123, Token(DOT), Token(IBTC)); + + v6::Vaults::::insert(key.clone(), old.clone()); + + v7::migrate_v6_to_v7::(); + + assert_eq!(crate::StorageVersion::::get(), Version::V7); + + let new = crate::Vaults::::get(key).unwrap(); + + assert!(old.id == new.id); + assert!(old.status == new.status); + assert!(old.banned_until == new.banned_until); + assert!(old.secure_collateral_threshold == new.secure_collateral_threshold); + assert!(old.to_be_issued_tokens == new.to_be_issued_tokens); + assert!(old.issued_tokens == new.issued_tokens); + assert!(old.to_be_redeemed_tokens == new.to_be_redeemed_tokens); + assert!(old.liquidated_collateral == new.liquidated_collateral); + }); + } +} diff --git a/parachain/runtime/interlay/src/lib.rs b/parachain/runtime/interlay/src/lib.rs index a4fb9ba639..4d275ad8ca 100644 --- a/parachain/runtime/interlay/src/lib.rs +++ b/parachain/runtime/interlay/src/lib.rs @@ -1245,7 +1245,8 @@ construct_runtime! { Oracle: oracle::{Pallet, Call, Config, Storage, Event} = 62, Issue: issue::{Pallet, Call, Config, Storage, Event} = 63, Redeem: redeem::{Pallet, Call, Config, Storage, Event} = 64, - Fee: fee::{Pallet, Call, Config, Storage} = 65, + // Replace: 65 + Fee: fee::{Pallet, Call, Config, Storage} = 66, // Refund: 67 Nomination: nomination::{Pallet, Call, Config, Storage, Event} = 68, ClientsInfo: clients_info::{Pallet, Call, Storage, Event} = 69, diff --git a/parachain/runtime/interlay/src/weights/issue.rs b/parachain/runtime/interlay/src/weights/issue.rs index fa72cf8d1c..cf0c067d1d 100644 --- a/parachain/runtime/interlay/src/weights/issue.rs +++ b/parachain/runtime/interlay/src/weights/issue.rs @@ -2,31 +2,31 @@ //! Autogenerated weights for issue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-29, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `interlay-rust-runner-2mz2v-jrrg4`, CPU: `AMD EPYC 7502P 32-Core Processor` +//! HOSTNAME: `Nakuls-MacBook-Pro.local`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("interlay-dev"), DB CACHE: 1024 // Executed Command: -// target/release/interbtc-parachain +// ./target/release/interbtc-parachain // benchmark // pallet // --pallet -// * +// issue // --extrinsic // * -// --chain -// interlay-dev // --execution=wasm // --wasm-execution=compiled // --steps -// 50 +// 2 // --repeat -// 10 -// --output -// parachain/runtime/interlay/src/weights/ +// 1 // --template // .deploy/runtime-weight-template.hbs +// --chain +// interlay-dev +// --output +// generated_weight_interlay.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -47,13 +47,15 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: Fee IssueGriefingCollateral (r:1 w:0) /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: Fee IssueFee (r:1 w:0) + /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) @@ -62,8 +64,6 @@ impl issue::WeightInfo for WeightInfo { /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -75,18 +75,18 @@ impl issue::WeightInfo for WeightInfo { /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Issue IssueRequests (r:0 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) fn request_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `2681` + // Measured: `2633` // Estimated: `6028` - // Minimum execution time: 556_004_000 picoseconds. - Weight::from_parts(558_989_000, 6028) + // Minimum execution time: 39_089_000_000 picoseconds. + Weight::from_parts(39_089_000_000, 6028) .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -102,7 +102,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -113,23 +113,25 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_exact (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_issue_exact (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2434` - // Estimated: `3737` - // Minimum execution time: 195_191_000 picoseconds. - Weight::from_parts(33_956_966, 3737) - // Standard Error: 810_295 - .saturating_add(Weight::from_parts(10_187_551, 0).saturating_mul(h.into())) - // Standard Error: 730_159 - .saturating_add(Weight::from_parts(7_188_076, 0).saturating_mul(i.into())) - // Standard Error: 5_239 - .saturating_add(Weight::from_parts(34_842, 0).saturating_mul(b.into())) + // Measured: `2428` + // Estimated: `3760` + // Minimum execution time: 193_000_000 picoseconds. + Weight::from_parts(160_513_301, 3760) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_500_000, 0).saturating_mul(h.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_333_333, 0).saturating_mul(i.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(333_333, 0).saturating_mul(o.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(6_259, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -145,7 +147,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -166,19 +168,25 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_overpayment (h: u32, _i: u32, _o: u32, _b: u32, ) -> Weight { + fn execute_issue_overpayment (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3248` - // Estimated: `3737` - // Minimum execution time: 313_197_000 picoseconds. - Weight::from_parts(676_783_389, 3737) - // Standard Error: 967_719 - .saturating_add(Weight::from_parts(1_294_288, 0).saturating_mul(h.into())) + // Measured: `3278` + // Estimated: `3760` + // Minimum execution time: 305_000_000 picoseconds. + Weight::from_parts(260_494_913, 3760) + // Standard Error: 216_506 + .saturating_add(Weight::from_parts(2_125_000, 0).saturating_mul(h.into())) + // Standard Error: 192_450 + .saturating_add(Weight::from_parts(555_555, 0).saturating_mul(i.into())) + // Standard Error: 192_450 + .saturating_add(Weight::from_parts(444_444, 0).saturating_mul(o.into())) + // Standard Error: 1_355 + .saturating_add(Weight::from_parts(17_214, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -194,7 +202,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -207,23 +215,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_underpayment (h: u32, _i: u32, o: u32, b: u32, ) -> Weight { + fn execute_issue_underpayment (h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2739` - // Estimated: `3737` - // Minimum execution time: 231_854_000 picoseconds. - Weight::from_parts(253_010_791, 3737) - // Standard Error: 189_488 - .saturating_add(Weight::from_parts(3_800_800, 0).saturating_mul(h.into())) - // Standard Error: 170_748 - .saturating_add(Weight::from_parts(167_716, 0).saturating_mul(o.into())) - // Standard Error: 1_225 - .saturating_add(Weight::from_parts(6_220, 0).saturating_mul(b.into())) + // Measured: `2727` + // Estimated: `3760` + // Minimum execution time: 220_000_000 picoseconds. + Weight::from_parts(220_934_076, 3760) + // Standard Error: 1_840_303 + .saturating_add(Weight::from_parts(3_437_500, 0).saturating_mul(h.into())) + // Standard Error: 1_635_825 + .saturating_add(Weight::from_parts(611_111, 0).saturating_mul(i.into())) + // Standard Error: 1_635_825 + .saturating_add(Weight::from_parts(611_111, 0).saturating_mul(o.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -239,7 +247,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -250,25 +258,21 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_exact (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_exact (h: u32, _i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3363` - // Estimated: `3737` - // Minimum execution time: 201_924_000 picoseconds. - Weight::from_parts(139_929_561, 3737) - // Standard Error: 194_156 - .saturating_add(Weight::from_parts(3_652_125, 0).saturating_mul(h.into())) - // Standard Error: 174_955 - .saturating_add(Weight::from_parts(1_547_829, 0).saturating_mul(i.into())) - // Standard Error: 174_955 - .saturating_add(Weight::from_parts(1_815_584, 0).saturating_mul(o.into())) - // Standard Error: 1_255 - .saturating_add(Weight::from_parts(16_572, 0).saturating_mul(b.into())) + // Measured: `3287` + // Estimated: `3760` + // Minimum execution time: 193_000_000 picoseconds. + Weight::from_parts(223_547_730, 3760) + // Standard Error: 649_519 + .saturating_add(Weight::from_parts(4_000_000, 0).saturating_mul(h.into())) + // Standard Error: 4_065 + .saturating_add(Weight::from_parts(9_389, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -284,7 +288,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -305,25 +309,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_overpayment (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_overpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3947 + h * (1 ±0) + i * (1 ±0)` - // Estimated: `3737` - // Minimum execution time: 319_510_000 picoseconds. - Weight::from_parts(297_484_836, 3737) - // Standard Error: 93_915 - .saturating_add(Weight::from_parts(3_775_028, 0).saturating_mul(h.into())) - // Standard Error: 84_627 - .saturating_add(Weight::from_parts(1_330_041, 0).saturating_mul(i.into())) - // Standard Error: 84_627 - .saturating_add(Weight::from_parts(179_165, 0).saturating_mul(o.into())) - // Standard Error: 607 - .saturating_add(Weight::from_parts(2_628, 0).saturating_mul(b.into())) + // Measured: `4018 + h * (9 ±0) + i * (4 ±0)` + // Estimated: `3760` + // Minimum execution time: 314_000_000 picoseconds. + Weight::from_parts(269_041_862, 3760) + // Standard Error: 3_031_088 + .saturating_add(Weight::from_parts(2_875_000, 0).saturating_mul(h.into())) + // Standard Error: 2_694_301 + .saturating_add(Weight::from_parts(1_555_555, 0).saturating_mul(i.into())) + // Standard Error: 18_973 + .saturating_add(Weight::from_parts(16_431, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -339,7 +341,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -352,23 +354,25 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_underpayment (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3653` - // Estimated: `3737` - // Minimum execution time: 241_423_000 picoseconds. - Weight::from_parts(228_353_888, 3737) - // Standard Error: 69_658 - .saturating_add(Weight::from_parts(3_202_457, 0).saturating_mul(h.into())) - // Standard Error: 62_769 - .saturating_add(Weight::from_parts(689_283, 0).saturating_mul(i.into())) - // Standard Error: 450 - .saturating_add(Weight::from_parts(3_239, 0).saturating_mul(b.into())) + // Measured: `4257` + // Estimated: `3760` + // Minimum execution time: 225_000_000 picoseconds. + Weight::from_parts(169_911_776, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(4_312_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(2_166_666, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_277_777, 0).saturating_mul(o.into())) + // Standard Error: 677 + .saturating_add(Weight::from_parts(5_868, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -376,24 +380,41 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) fn cancel_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `1495` - // Estimated: `3737` - // Minimum execution time: 89_729_000 picoseconds. - Weight::from_parts(90_551_000, 3737) + // Measured: `1485` + // Estimated: `3760` + // Minimum execution time: 90_000_000 picoseconds. + Weight::from_parts(90_000_000, 3760) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cancel_issue_for_replace () -> Weight { + // Proof Size summary in bytes: + // Measured: `1007` + // Estimated: `3760` + // Minimum execution time: 63_000_000 picoseconds. + Weight::from_parts(63_000_000, 3760) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } /// Storage: Issue IssuePeriod (r:0 w:1) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn set_issue_period () -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 17_425_000 picoseconds. - Weight::from_parts(17_906_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } \ No newline at end of file diff --git a/parachain/runtime/interlay/src/weights/redeem.rs b/parachain/runtime/interlay/src/weights/redeem.rs index 296c5bdfa6..967effd348 100644 --- a/parachain/runtime/interlay/src/weights/redeem.rs +++ b/parachain/runtime/interlay/src/weights/redeem.rs @@ -2,31 +2,31 @@ //! Autogenerated weights for redeem //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-29, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `interlay-rust-runner-2mz2v-jrrg4`, CPU: `AMD EPYC 7502P 32-Core Processor` +//! HOSTNAME: `Nakuls-MacBook-Pro.local`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("interlay-dev"), DB CACHE: 1024 // Executed Command: -// target/release/interbtc-parachain +// ./target/release/interbtc-parachain // benchmark // pallet // --pallet -// * +// redeem // --extrinsic // * -// --chain -// interlay-dev // --execution=wasm // --wasm-execution=compiled // --steps -// 50 +// 2 // --repeat -// 10 -// --output -// parachain/runtime/interlay/src/weights/ +// 1 // --template // .deploy/runtime-weight-template.hbs +// --chain +// interlay-dev +// --output +// generated_weight_interlay.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -40,6 +40,8 @@ pub struct WeightInfo(PhantomData); impl redeem::WeightInfo for WeightInfo { + /// Storage: VaultRegistry Vaults (r:1 w:1) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:2 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) @@ -48,8 +50,6 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) @@ -91,13 +91,13 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) fn request_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `3155` + // Measured: `3107` // Estimated: `6260` - // Minimum execution time: 310_652_000 picoseconds. - Weight::from_parts(313_168_000, 6260) + // Minimum execution time: 307_000_000 picoseconds. + Weight::from_parts(307_000_000, 6260) .saturating_add(T::DbWeight::get().reads(28_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -129,13 +129,13 @@ impl redeem::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `2173` // Estimated: `8760` - // Minimum execution time: 283_197_000 picoseconds. - Weight::from_parts(284_509_000, 8760) + // Minimum execution time: 292_000_000 picoseconds. + Weight::from_parts(292_000_000, 8760) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -155,30 +155,30 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// The range of component `h` is `[2, 10]`. /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[2, 3]`. /// The range of component `b` is `[541, 2048]`. fn execute_redeem (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2295 + o * (1 ±0)` - // Estimated: `3725` - // Minimum execution time: 183_618_000 picoseconds. - Weight::from_parts(155_534_743, 3725) - // Standard Error: 117_935 - .saturating_add(Weight::from_parts(3_687_939, 0).saturating_mul(h.into())) - // Standard Error: 106_320 - .saturating_add(Weight::from_parts(952_959, 0).saturating_mul(i.into())) - // Standard Error: 644_527 - .saturating_add(Weight::from_parts(862_990, 0).saturating_mul(o.into())) - // Standard Error: 649 - .saturating_add(Weight::from_parts(4_928, 0).saturating_mul(b.into())) + // Measured: `2248 + o * (1 ±0)` + // Estimated: `3743` + // Minimum execution time: 182_000_000 picoseconds. + Weight::from_parts(136_635_488, 3743) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(562_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_611_111, 0).saturating_mul(i.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(7_500_000, 0).saturating_mul(o.into())) + // Standard Error: 574 + .saturating_add(Weight::from_parts(7_631, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -186,7 +186,7 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -267,15 +267,15 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn cancel_redeem_reimburse () -> Weight { // Proof Size summary in bytes: - // Measured: `5396` + // Measured: `5349` // Estimated: `11350` - // Minimum execution time: 847_787_000 picoseconds. - Weight::from_parts(851_295_000, 11350) + // Minimum execution time: 753_000_000 picoseconds. + Weight::from_parts(753_000_000, 11350) .saturating_add(T::DbWeight::get().reads(59_u64)) .saturating_add(T::DbWeight::get().writes(29_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -283,7 +283,7 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -364,63 +364,115 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn cancel_redeem_retry () -> Weight { // Proof Size summary in bytes: - // Measured: `5396` + // Measured: `5349` // Estimated: `11350` - // Minimum execution time: 775_122_000 picoseconds. - Weight::from_parts(783_890_000, 11350) + // Minimum execution time: 724_000_000 picoseconds. + Weight::from_parts(724_000_000, 11350) .saturating_add(T::DbWeight::get().reads(58_u64)) .saturating_add(T::DbWeight::get().writes(28_u64)) } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: Redeem RedeemPeriod (r:1 w:0) + /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) + /// Storage: Fee PunishmentFee (r:1 w:0) + /// Proof: Fee PunishmentFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: VaultStaking Nonce (r:1 w:0) + /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) + /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry TotalUserVaultCollateral (r:1 w:1) + /// Proof: VaultRegistry TotalUserVaultCollateral (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultCapacity Stake (r:1 w:0) + /// Proof: VaultCapacity Stake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardPerToken (r:2 w:0) + /// Proof: VaultCapacity RewardPerToken (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardTally (r:2 w:2) + /// Proof: VaultCapacity RewardTally (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultCapacity TotalRewards (r:2 w:2) + /// Proof: VaultCapacity TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultRewards Stake (r:1 w:0) + /// Proof: VaultRewards Stake (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardPerToken (r:2 w:0) + /// Proof: VaultRewards RewardPerToken (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardTally (r:2 w:2) + /// Proof: VaultRewards RewardTally (max_values: None, max_size: Some(124), added: 2599, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalRewards (r:2 w:2) + /// Proof: VaultRewards TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Fee Commission (r:1 w:0) + /// Proof: Fee Commission (max_values: None, max_size: Some(86), added: 2561, mode: MaxEncodedLen) + /// Storage: VaultStaking RewardPerToken (r:2 w:2) + /// Proof: VaultStaking RewardPerToken (max_values: None, max_size: Some(117), added: 2592, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalStake (r:1 w:0) + /// Proof: VaultStaking TotalStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) + /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalStake (r:1 w:0) + /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + fn cancel_replace () -> Weight { + // Proof Size summary in bytes: + // Measured: `4412` + // Estimated: `6364` + // Minimum execution time: 397_000_000 picoseconds. + Weight::from_parts(397_000_000, 6364) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(15_u64)) + } /// Storage: Redeem RedeemPeriod (r:0 w:1) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn set_redeem_period () -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 18_136_000 picoseconds. - Weight::from_parts(18_727_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) fn self_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `1427` - // Estimated: `3725` - // Minimum execution time: 149_329_000 picoseconds. - Weight::from_parts(152_415_000, 3725) + // Measured: `1379` + // Estimated: `3677` + // Minimum execution time: 111_000_000 picoseconds. + Weight::from_parts(111_000_000, 3677) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } - - /// Storage: VaultRegistry Vaults (r:2 w:2) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: BTCRelay StartBlockHeight (r:1 w:0) /// Proof: BTCRelay StartBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: Oracle Aggregate (r:3 w:0) - /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: Fee IssueGriefingCollateral (r:1 w:0) - /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Tokens Accounts (r:1 w:1) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:2 w:0) /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:2 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -433,8 +485,6 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) /// Proof: Fee RedeemFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Redeem RedeemTransactionSize (r:1 w:0) - /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry PremiumRedeemThreshold (r:1 w:0) @@ -445,15 +495,52 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) - /// Storage: Redeem Requests (r:0 w:1) - /// Proof: Redeem Requests (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) - fn request_replace() -> Weight { + fn request_replace () -> Weight { // Proof Size summary in bytes: - // Measured: `3277` - // Estimated: `8547` - // Minimum execution time: 39_015_000_000 picoseconds. - Weight::from_parts(39_015_000_000, 8547) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(7_u64)) + // Measured: `2641` + // Estimated: `6364` + // Minimum execution time: 39_118_000_000 picoseconds. + Weight::from_parts(39_118_000_000, 6364) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) + /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay Chains (r:1 w:0) + /// Proof: BTCRelay Chains (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) + /// Storage: BTCRelay BlockHeaders (r:1 w:0) + /// Proof: BTCRelay BlockHeaders (max_values: None, max_size: Some(200), added: 2675, mode: MaxEncodedLen) + /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) + /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) + /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// The range of component `h` is `[2, 10]`. + /// The range of component `i` is `[1, 10]`. + /// The range of component `o` is `[2, 3]`. + /// The range of component `b` is `[541, 2048]`. + fn execute_replace (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2286` + // Estimated: `6364` + // Minimum execution time: 172_000_000 picoseconds. + Weight::from_parts(166_279_897, 6364) + // Standard Error: 216_506 + .saturating_add(Weight::from_parts(3_125_000, 0).saturating_mul(h.into())) + // Standard Error: 192_450 + .saturating_add(Weight::from_parts(111_111, 0).saturating_mul(i.into())) + // Standard Error: 1_149 + .saturating_add(Weight::from_parts(663, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } } \ No newline at end of file diff --git a/parachain/runtime/kintsugi/src/lib.rs b/parachain/runtime/kintsugi/src/lib.rs index 2f835f2dee..f2df4a8d7d 100644 --- a/parachain/runtime/kintsugi/src/lib.rs +++ b/parachain/runtime/kintsugi/src/lib.rs @@ -1247,7 +1247,8 @@ construct_runtime! { Oracle: oracle::{Pallet, Call, Config, Storage, Event} = 62, Issue: issue::{Pallet, Call, Config, Storage, Event} = 63, Redeem: redeem::{Pallet, Call, Config, Storage, Event} = 64, - Fee: fee::{Pallet, Call, Config, Storage} = 65, + // Replace: 65 + Fee: fee::{Pallet, Call, Config, Storage} = 66, // Refund: 67 Nomination: nomination::{Pallet, Call, Config, Storage, Event} = 68, ClientsInfo: clients_info::{Pallet, Call, Storage, Event} = 69, diff --git a/parachain/runtime/kintsugi/src/weights/issue.rs b/parachain/runtime/kintsugi/src/weights/issue.rs index 10f28c57a2..eeeded9f67 100644 --- a/parachain/runtime/kintsugi/src/weights/issue.rs +++ b/parachain/runtime/kintsugi/src/weights/issue.rs @@ -2,31 +2,31 @@ //! Autogenerated weights for issue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-29, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `interlay-rust-runner-2mz2v-kcxvd`, CPU: `AMD EPYC 7502P 32-Core Processor` +//! HOSTNAME: `Nakuls-MacBook-Pro.local`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kintsugi-dev"), DB CACHE: 1024 // Executed Command: -// target/release/interbtc-parachain +// ./target/release/interbtc-parachain // benchmark // pallet // --pallet -// * +// issue // --extrinsic // * -// --chain -// kintsugi-dev // --execution=wasm // --wasm-execution=compiled // --steps -// 50 +// 2 // --repeat -// 10 -// --output -// parachain/runtime/kintsugi/src/weights/ +// 1 // --template // .deploy/runtime-weight-template.hbs +// --chain +// kintsugi-dev +// --output +// generated_weight_kintsugi.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -47,13 +47,15 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: Fee IssueGriefingCollateral (r:1 w:0) /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: Fee IssueFee (r:1 w:0) + /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) @@ -62,8 +64,6 @@ impl issue::WeightInfo for WeightInfo { /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -75,18 +75,18 @@ impl issue::WeightInfo for WeightInfo { /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Issue IssueRequests (r:0 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) fn request_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `2718` + // Measured: `2690` // Estimated: `6028` - // Minimum execution time: 558_298_000 picoseconds. - Weight::from_parts(565_393_000, 6028) + // Minimum execution time: 38_621_000_000 picoseconds. + Weight::from_parts(38_621_000_000, 6028) .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -102,7 +102,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -113,25 +113,21 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_exact (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_issue_exact (_h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2434` - // Estimated: `3737` - // Minimum execution time: 198_538_000 picoseconds. - Weight::from_parts(171_478_384, 3737) - // Standard Error: 67_279 - .saturating_add(Weight::from_parts(3_496_696, 0).saturating_mul(h.into())) - // Standard Error: 60_626 - .saturating_add(Weight::from_parts(794_967, 0).saturating_mul(i.into())) - // Standard Error: 60_626 - .saturating_add(Weight::from_parts(420_219, 0).saturating_mul(o.into())) - // Standard Error: 435 - .saturating_add(Weight::from_parts(5_157, 0).saturating_mul(b.into())) + // Measured: `2448` + // Estimated: `3760` + // Minimum execution time: 206_000_000 picoseconds. + Weight::from_parts(261_839_397, 3760) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(277_777, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(166_666, 0).saturating_mul(o.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -147,7 +143,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -168,25 +164,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_overpayment (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_issue_overpayment (_h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3285` - // Estimated: `3737` - // Minimum execution time: 316_013_000 picoseconds. - Weight::from_parts(296_206_373, 3737) - // Standard Error: 170_956 - .saturating_add(Weight::from_parts(3_648_998, 0).saturating_mul(h.into())) - // Standard Error: 154_049 - .saturating_add(Weight::from_parts(965_687, 0).saturating_mul(i.into())) - // Standard Error: 154_049 - .saturating_add(Weight::from_parts(440_368, 0).saturating_mul(o.into())) - // Standard Error: 1_105 - .saturating_add(Weight::from_parts(1_242, 0).saturating_mul(b.into())) + // Measured: `3335` + // Estimated: `3760` + // Minimum execution time: 307_000_000 picoseconds. + Weight::from_parts(277_172_143, 3760) + // Standard Error: 1_347_150 + .saturating_add(Weight::from_parts(777_777, 0).saturating_mul(i.into())) + // Standard Error: 1_347_150 + .saturating_add(Weight::from_parts(1_000_000, 0).saturating_mul(o.into())) + // Standard Error: 9_486 + .saturating_add(Weight::from_parts(15_649, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -202,7 +196,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -215,23 +209,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_issue_underpayment (h: u32, i: u32, o: u32, _b: u32, ) -> Weight { + fn execute_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2739` - // Estimated: `3737` - // Minimum execution time: 236_814_000 picoseconds. - Weight::from_parts(218_087_002, 3737) - // Standard Error: 143_849 - .saturating_add(Weight::from_parts(3_739_468, 0).saturating_mul(h.into())) - // Standard Error: 129_622 - .saturating_add(Weight::from_parts(1_289_008, 0).saturating_mul(i.into())) - // Standard Error: 129_622 - .saturating_add(Weight::from_parts(452_541, 0).saturating_mul(o.into())) + // Measured: `2747` + // Estimated: `3760` + // Minimum execution time: 214_000_000 picoseconds. + Weight::from_parts(184_539_123, 3760) + // Standard Error: 1_732_050 + .saturating_add(Weight::from_parts(4_250_000, 0).saturating_mul(h.into())) + // Standard Error: 1_539_600 + .saturating_add(Weight::from_parts(1_555_555, 0).saturating_mul(i.into())) + // Standard Error: 10_842 + .saturating_add(Weight::from_parts(8_607, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -247,7 +241,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) @@ -260,23 +254,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `b` is `[770, 2048]`. fn execute_expired_issue_exact (h: u32, i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3567` - // Estimated: `3737` - // Minimum execution time: 206_463_000 picoseconds. - Weight::from_parts(179_023_981, 3737) - // Standard Error: 118_695 - .saturating_add(Weight::from_parts(3_632_454, 0).saturating_mul(h.into())) - // Standard Error: 106_956 - .saturating_add(Weight::from_parts(825_036, 0).saturating_mul(i.into())) - // Standard Error: 106_956 - .saturating_add(Weight::from_parts(185_589, 0).saturating_mul(o.into())) - // Standard Error: 767 - .saturating_add(Weight::from_parts(6_936, 0).saturating_mul(b.into())) + // Measured: `3536` + // Estimated: `3760` + // Minimum execution time: 194_000_000 picoseconds. + Weight::from_parts(163_253_716, 3760) + // Standard Error: 974_278 + .saturating_add(Weight::from_parts(3_562_500, 0).saturating_mul(h.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(611_111, 0).saturating_mul(i.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(388_888, 0).saturating_mul(o.into())) + // Standard Error: 6_098 + .saturating_add(Weight::from_parts(6_651, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -292,7 +286,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -313,25 +307,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_overpayment (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_overpayment (h: u32, i: u32, o: u32, _b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4039 + h * (17 ±0) + i * (2 ±0)` - // Estimated: `3737` - // Minimum execution time: 326_534_000 picoseconds. - Weight::from_parts(312_629_634, 3737) - // Standard Error: 118_522 - .saturating_add(Weight::from_parts(3_380_960, 0).saturating_mul(h.into())) - // Standard Error: 106_800 - .saturating_add(Weight::from_parts(561_891, 0).saturating_mul(i.into())) - // Standard Error: 106_800 - .saturating_add(Weight::from_parts(164_257, 0).saturating_mul(o.into())) - // Standard Error: 766 - .saturating_add(Weight::from_parts(3_419, 0).saturating_mul(b.into())) + // Measured: `4141 + h * (21 ±0) + i * (3 ±0) + o * (3 ±0)` + // Estimated: `3760` + // Minimum execution time: 322_000_000 picoseconds. + Weight::from_parts(316_622_652, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(937_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_055_555, 0).saturating_mul(i.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(55_555, 0).saturating_mul(o.into())) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -347,7 +339,7 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Fee IssueFee (r:1 w:0) /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) @@ -360,25 +352,23 @@ impl issue::WeightInfo for WeightInfo { /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[1, 10]`. /// The range of component `b` is `[770, 2048]`. - fn execute_expired_issue_underpayment (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_expired_issue_underpayment (h: u32, i: u32, _o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `3633 + o * (11 ±0)` - // Estimated: `3737` - // Minimum execution time: 245_292_000 picoseconds. - Weight::from_parts(218_248_263, 3737) - // Standard Error: 75_656 - .saturating_add(Weight::from_parts(3_638_323, 0).saturating_mul(h.into())) - // Standard Error: 68_174 - .saturating_add(Weight::from_parts(1_189_484, 0).saturating_mul(i.into())) - // Standard Error: 68_174 - .saturating_add(Weight::from_parts(378_537, 0).saturating_mul(o.into())) - // Standard Error: 489 - .saturating_add(Weight::from_parts(4_279, 0).saturating_mul(b.into())) + // Measured: `3990` + // Estimated: `3760` + // Minimum execution time: 231_000_000 picoseconds. + Weight::from_parts(177_273_669, 3760) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(5_437_500, 0).saturating_mul(h.into())) + // Standard Error: 96_225 + .saturating_add(Weight::from_parts(1_277_777, 0).saturating_mul(i.into())) + // Standard Error: 677 + .saturating_add(Weight::from_parts(16_040, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Issue IssueRequests (r:1 w:1) - /// Proof: Issue IssueRequests (max_values: None, max_size: Some(272), added: 2747, mode: MaxEncodedLen) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Issue IssuePeriod (r:1 w:0) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -386,24 +376,41 @@ impl issue::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) fn cancel_issue () -> Weight { // Proof Size summary in bytes: - // Measured: `1495` - // Estimated: `3737` - // Minimum execution time: 91_653_000 picoseconds. - Weight::from_parts(93_397_000, 3737) + // Measured: `1505` + // Estimated: `3760` + // Minimum execution time: 89_000_000 picoseconds. + Weight::from_parts(89_000_000, 3760) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cancel_issue_for_replace () -> Weight { + // Proof Size summary in bytes: + // Measured: `1027` + // Estimated: `3760` + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(66_000_000, 3760) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } /// Storage: Issue IssuePeriod (r:0 w:1) /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn set_issue_period () -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 18_417_000 picoseconds. - Weight::from_parts(18_597_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } } \ No newline at end of file diff --git a/parachain/runtime/kintsugi/src/weights/redeem.rs b/parachain/runtime/kintsugi/src/weights/redeem.rs index 44a280e029..dfe0a5d757 100644 --- a/parachain/runtime/kintsugi/src/weights/redeem.rs +++ b/parachain/runtime/kintsugi/src/weights/redeem.rs @@ -2,31 +2,31 @@ //! Autogenerated weights for redeem //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-29, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `interlay-rust-runner-2mz2v-kcxvd`, CPU: `AMD EPYC 7502P 32-Core Processor` +//! HOSTNAME: `Nakuls-MacBook-Pro.local`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kintsugi-dev"), DB CACHE: 1024 // Executed Command: -// target/release/interbtc-parachain +// ./target/release/interbtc-parachain // benchmark // pallet // --pallet -// * +// redeem // --extrinsic // * -// --chain -// kintsugi-dev // --execution=wasm // --wasm-execution=compiled // --steps -// 50 +// 2 // --repeat -// 10 -// --output -// parachain/runtime/kintsugi/src/weights/ +// 1 // --template // .deploy/runtime-weight-template.hbs +// --chain +// kintsugi-dev +// --output +// generated_weight_kintsugi.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -40,6 +40,8 @@ pub struct WeightInfo(PhantomData); impl redeem::WeightInfo for WeightInfo { + /// Storage: VaultRegistry Vaults (r:1 w:1) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:2 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) @@ -48,8 +50,6 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:2 w:0) /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) @@ -91,13 +91,13 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) fn request_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `3189` + // Measured: `3161` // Estimated: `6260` - // Minimum execution time: 311_614_000 picoseconds. - Weight::from_parts(319_349_000, 6260) + // Minimum execution time: 270_000_000 picoseconds. + Weight::from_parts(270_000_000, 6260) .saturating_add(T::DbWeight::get().reads(28_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -127,15 +127,15 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Loans AccountDeposits (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn liquidation_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `2173` + // Measured: `2193` // Estimated: `8760` - // Minimum execution time: 287_687_000 picoseconds. - Weight::from_parts(292_145_000, 8760) + // Minimum execution time: 257_000_000 picoseconds. + Weight::from_parts(257_000_000, 8760) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) @@ -155,30 +155,28 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// The range of component `h` is `[2, 10]`. /// The range of component `i` is `[1, 10]`. /// The range of component `o` is `[2, 3]`. /// The range of component `b` is `[541, 2048]`. - fn execute_redeem (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + fn execute_redeem (h: u32, _i: u32, o: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2295 + o * (1 ±0)` - // Estimated: `3725` - // Minimum execution time: 184_800_000 picoseconds. - Weight::from_parts(149_034_719, 3725) - // Standard Error: 137_585 - .saturating_add(Weight::from_parts(3_833_551, 0).saturating_mul(h.into())) - // Standard Error: 124_035 - .saturating_add(Weight::from_parts(1_176_171, 0).saturating_mul(i.into())) - // Standard Error: 751_913 - .saturating_add(Weight::from_parts(1_964_806, 0).saturating_mul(o.into())) - // Standard Error: 757 - .saturating_add(Weight::from_parts(5_490, 0).saturating_mul(b.into())) + // Measured: `2268 + o * (1 ±0)` + // Estimated: `3743` + // Minimum execution time: 176_000_000 picoseconds. + Weight::from_parts(151_584_172, 3743) + // Standard Error: 108_253 + .saturating_add(Weight::from_parts(2_562_500, 0).saturating_mul(h.into())) + // Standard Error: 866_025 + .saturating_add(Weight::from_parts(500_000, 0).saturating_mul(o.into())) + // Standard Error: 574 + .saturating_add(Weight::from_parts(8_958, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -186,7 +184,7 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -267,15 +265,15 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn cancel_redeem_reimburse () -> Weight { // Proof Size summary in bytes: - // Measured: `5430` + // Measured: `5403` // Estimated: `11350` - // Minimum execution time: 850_042_000 picoseconds. - Weight::from_parts(865_223_000, 11350) + // Minimum execution time: 782_000_000 picoseconds. + Weight::from_parts(782_000_000, 11350) .saturating_add(T::DbWeight::get().reads(59_u64)) .saturating_add(T::DbWeight::get().writes(29_u64)) } /// Storage: Redeem RedeemRequests (r:1 w:1) - /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(245), added: 2720, mode: MaxEncodedLen) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) /// Storage: Redeem RedeemPeriod (r:1 w:0) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Security ActiveBlockCount (r:1 w:0) @@ -283,7 +281,7 @@ impl redeem::WeightInfo for WeightInfo { /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Loans UnderlyingAssetId (r:1 w:0) /// Proof: Loans UnderlyingAssetId (max_values: None, max_size: Some(38), added: 2513, mode: MaxEncodedLen) /// Storage: Oracle Aggregate (r:1 w:0) @@ -364,62 +362,115 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: VaultRegistry PunishmentDelay (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn cancel_redeem_retry () -> Weight { // Proof Size summary in bytes: - // Measured: `5430` + // Measured: `5403` // Estimated: `11350` - // Minimum execution time: 773_779_000 picoseconds. - Weight::from_parts(789_120_000, 11350) + // Minimum execution time: 706_000_000 picoseconds. + Weight::from_parts(706_000_000, 11350) .saturating_add(T::DbWeight::get().reads(58_u64)) .saturating_add(T::DbWeight::get().writes(28_u64)) } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: Redeem RedeemPeriod (r:1 w:0) + /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// Storage: Issue IssuePeriod (r:1 w:0) + /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) + /// Storage: Fee PunishmentFee (r:1 w:0) + /// Proof: Fee PunishmentFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: VaultStaking Nonce (r:1 w:0) + /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalCurrentStake (r:1 w:0) + /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry TotalUserVaultCollateral (r:1 w:1) + /// Proof: VaultRegistry TotalUserVaultCollateral (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultCapacity Stake (r:1 w:0) + /// Proof: VaultCapacity Stake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardPerToken (r:2 w:0) + /// Proof: VaultCapacity RewardPerToken (max_values: None, max_size: Some(59), added: 2534, mode: MaxEncodedLen) + /// Storage: VaultCapacity RewardTally (r:2 w:2) + /// Proof: VaultCapacity RewardTally (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultCapacity TotalRewards (r:2 w:2) + /// Proof: VaultCapacity TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: VaultRewards Stake (r:1 w:0) + /// Proof: VaultRewards Stake (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardPerToken (r:2 w:0) + /// Proof: VaultRewards RewardPerToken (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen) + /// Storage: VaultRewards RewardTally (r:2 w:2) + /// Proof: VaultRewards RewardTally (max_values: None, max_size: Some(124), added: 2599, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalRewards (r:2 w:2) + /// Proof: VaultRewards TotalRewards (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Fee Commission (r:1 w:0) + /// Proof: Fee Commission (max_values: None, max_size: Some(86), added: 2561, mode: MaxEncodedLen) + /// Storage: VaultStaking RewardPerToken (r:2 w:2) + /// Proof: VaultStaking RewardPerToken (max_values: None, max_size: Some(117), added: 2592, mode: MaxEncodedLen) + /// Storage: VaultStaking TotalStake (r:1 w:0) + /// Proof: VaultStaking TotalStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) + /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) + /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: VaultRewards TotalStake (r:1 w:0) + /// Proof: VaultRewards TotalStake (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + fn cancel_replace () -> Weight { + // Proof Size summary in bytes: + // Measured: `4404` + // Estimated: `6364` + // Minimum execution time: 394_000_000 picoseconds. + Weight::from_parts(394_000_000, 6364) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(15_u64)) + } /// Storage: Redeem RedeemPeriod (r:0 w:1) /// Proof: Redeem RedeemPeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn set_redeem_period () -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 18_106_000 picoseconds. - Weight::from_parts(18_667_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: VaultRegistry Vaults (r:1 w:1) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(260), added: 2735, mode: MaxEncodedLen) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) /// Storage: Tokens TotalIssuance (r:1 w:1) /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(35), added: 2510, mode: MaxEncodedLen) fn self_redeem () -> Weight { // Proof Size summary in bytes: - // Measured: `1427` - // Estimated: `3725` - // Minimum execution time: 150_121_000 picoseconds. - Weight::from_parts(151_013_000, 3725) + // Measured: `1399` + // Estimated: `3677` + // Minimum execution time: 116_000_000 picoseconds. + Weight::from_parts(116_000_000, 3677) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } - /// Storage: VaultRegistry Vaults (r:2 w:2) - /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: BTCRelay StartBlockHeight (r:1 w:0) /// Proof: BTCRelay StartBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay BestBlockHeight (r:1 w:0) /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: Oracle Aggregate (r:3 w:0) - /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) - /// Storage: Fee IssueGriefingCollateral (r:1 w:0) - /// Proof: Fee IssueGriefingCollateral (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Tokens Accounts (r:1 w:1) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) /// Storage: Issue IssueBtcDustValue (r:1 w:0) /// Proof: Issue IssueBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry SecureCollateralThreshold (r:1 w:0) /// Proof: VaultRegistry SecureCollateralThreshold (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: Oracle Aggregate (r:1 w:0) + /// Proof: Oracle Aggregate (max_values: None, max_size: Some(44), added: 2519, mode: MaxEncodedLen) /// Storage: VaultStaking Nonce (r:2 w:0) /// Proof: VaultStaking Nonce (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen) /// Storage: VaultStaking TotalCurrentStake (r:2 w:0) /// Proof: VaultStaking TotalCurrentStake (max_values: None, max_size: Some(106), added: 2581, mode: MaxEncodedLen) - /// Storage: Fee IssueFee (r:1 w:0) - /// Proof: Fee IssueFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Security Nonce (r:1 w:1) /// Proof: Security Nonce (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) /// Storage: System ParentHash (r:1 w:0) @@ -432,8 +483,6 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Issue IssuePeriod (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Fee RedeemFee (r:1 w:0) /// Proof: Fee RedeemFee (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: Redeem RedeemTransactionSize (r:1 w:0) - /// Proof: Redeem RedeemTransactionSize (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Redeem RedeemBtcDustValue (r:1 w:0) /// Proof: Redeem RedeemBtcDustValue (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: VaultRegistry PremiumRedeemThreshold (r:1 w:0) @@ -444,15 +493,54 @@ impl redeem::WeightInfo for WeightInfo { /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) /// Storage: Redeem RedeemRequests (r:0 w:1) /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) - /// Storage: Redeem Requests (r:0 w:1) - /// Proof: Redeem Requests (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn request_replace () -> Weight { // Proof Size summary in bytes: - // Measured: `3371` - // Estimated: `8547` - // Minimum execution time: 38_952_000_000 picoseconds. - Weight::from_parts(38_952_000_000, 8547) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(7_u64)) + // Measured: `2735` + // Estimated: `6364` + // Minimum execution time: 38_446_000_000 picoseconds. + Weight::from_parts(38_446_000_000, 6364) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: Redeem RedeemRequests (r:1 w:1) + /// Proof: Redeem RedeemRequests (max_values: None, max_size: Some(278), added: 2753, mode: MaxEncodedLen) + /// Storage: BTCRelay DisableInclusionCheck (r:1 w:0) + /// Proof: BTCRelay DisableInclusionCheck (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BTCRelay BestBlockHeight (r:1 w:0) + /// Proof: BTCRelay BestBlockHeight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay Chains (r:1 w:0) + /// Proof: BTCRelay Chains (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) + /// Storage: BTCRelay BlockHeaders (r:1 w:0) + /// Proof: BTCRelay BlockHeaders (max_values: None, max_size: Some(200), added: 2675, mode: MaxEncodedLen) + /// Storage: BTCRelay StableBitcoinConfirmations (r:1 w:0) + /// Proof: BTCRelay StableBitcoinConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Security ActiveBlockCount (r:1 w:0) + /// Proof: Security ActiveBlockCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BTCRelay StableParachainConfirmations (r:1 w:0) + /// Proof: BTCRelay StableParachainConfirmations (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: VaultRegistry Vaults (r:2 w:2) + /// Proof: VaultRegistry Vaults (max_values: None, max_size: Some(212), added: 2687, mode: MaxEncodedLen) + /// Storage: Issue IssueRequests (r:1 w:1) + /// Proof: Issue IssueRequests (max_values: None, max_size: Some(295), added: 2770, mode: MaxEncodedLen) + /// The range of component `h` is `[2, 10]`. + /// The range of component `i` is `[1, 10]`. + /// The range of component `o` is `[2, 3]`. + /// The range of component `b` is `[541, 2048]`. + fn execute_replace (h: u32, i: u32, o: u32, b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2310` + // Estimated: `6364` + // Minimum execution time: 178_000_000 picoseconds. + Weight::from_parts(108_702_702, 6364) + // Standard Error: 433_012 + .saturating_add(Weight::from_parts(3_875_000, 0).saturating_mul(h.into())) + // Standard Error: 384_900 + .saturating_add(Weight::from_parts(1_444_444, 0).saturating_mul(i.into())) + // Standard Error: 3_464_101 + .saturating_add(Weight::from_parts(8_000_000, 0).saturating_mul(o.into())) + // Standard Error: 2_298 + .saturating_add(Weight::from_parts(11_280, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } } \ No newline at end of file diff --git a/parachain/runtime/runtime-tests/src/parachain/redeem.rs b/parachain/runtime/runtime-tests/src/parachain/redeem.rs index 76f227de2e..7fe7a1af7f 100644 --- a/parachain/runtime/runtime-tests/src/parachain/redeem.rs +++ b/parachain/runtime/runtime-tests/src/parachain/redeem.rs @@ -628,7 +628,7 @@ mod spec_based_tests { test_with(|vault_id| { set_redeem_period(1000); let redeem_id = request_redeem(&vault_id); - mine_blocks(12); + mine_blocks(100); SecurityPallet::set_active_block_number(1100); assert_noop!( RuntimeCall::Redeem(RedeemCall::cancel_redeem { diff --git a/parachain/runtime/runtime-tests/src/parachain/replace.rs b/parachain/runtime/runtime-tests/src/parachain/replace.rs index 7a87eb5336..b9254cd00d 100644 --- a/parachain/runtime/runtime-tests/src/parachain/replace.rs +++ b/parachain/runtime/runtime-tests/src/parachain/replace.rs @@ -1,6 +1,6 @@ use crate::{ setup::{assert_eq, issue_utils::assert_issue_request_event, redeem_utils::assert_redeem_request_event, *}, - utils::loans_utils::activate_lending_and_mint, + utils::{loans_utils::activate_lending_and_mint, redeem_utils::get_punishment_fee}, }; use currency::Amount; use issue::DefaultIssueRequest; @@ -70,25 +70,6 @@ fn test_without_initialization(execute: impl Fn(CurrencyId) -> R) { ExtBuilder::build().execute_with(|| execute(Token(KSM))); } -// pub fn withdraw_replace(old_vault_id: &VaultId, amount: Amount) -> DispatchResultWithPostInfo { -// VaultRegistryPallet::collateral_integrity_check(); -// -// RuntimeCall::Replace(ReplaceCall::withdraw_replace { -// currency_pair: old_vault_id.currencies.clone(), -// amount: amount.amount(), -// }) -// .dispatch(origin_of(old_vault_id.account_id.clone())) -// } - -// pub fn assert_replace_request_event() { -// let events = SystemPallet::events(); -// let ids = events.iter().filter_map(|r| match r.event { -// RuntimeEvent::Replace(ReplaceEvent::RequestReplace { .. }) => Some(()), -// _ => None, -// }); -// assert_eq!(ids.count(), 1); -// } - #[cfg(test)] mod request_replace_tests { use super::{assert_eq, *}; @@ -99,6 +80,7 @@ mod request_replace_tests { new_vault_id: &VaultId, issue: &IssueRequest, amount: Amount, + fee: Amount, ) { assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), @@ -107,7 +89,7 @@ mod request_replace_tests { *old_vault.free_balance.get_mut(&issue.griefing_currency).unwrap() -= Amount::new(issue.griefing_collateral, issue.griefing_currency); - old_vault.to_be_redeemed += amount; + old_vault.to_be_redeemed += amount - fee; new_vault.to_be_issued += amount; } ) @@ -135,8 +117,14 @@ mod request_replace_tests { let issue_id = assert_issue_request_event(); let issue = IssuePallet::get_issue_request_from_id(&issue_id).unwrap(); - assert_eq!(issue.griefing_collateral(), griefing(2)); - assert_state_after_accept_replace_correct(&old_vault_id, &new_vault_id, &issue, accept_amount); + assert_eq!(issue.griefing_collateral(), griefing(0)); + assert_state_after_accept_replace_correct( + &old_vault_id, + &new_vault_id, + &issue, + accept_amount, + redeem.fee(), + ); }); } @@ -165,42 +153,34 @@ mod request_replace_tests { let issue_id = assert_issue_request_event(); let issue = IssuePallet::get_issue_request_from_id(&issue_id).unwrap(); - assert_eq!(issue.griefing_collateral(), griefing(1)); - assert_state_after_accept_replace_correct(&old_vault_id, &new_vault_id, &issue, accept_amount); + assert_eq!(issue.griefing_collateral(), griefing(0)); + assert_state_after_accept_replace_correct( + &old_vault_id, + &new_vault_id, + &issue, + accept_amount, + redeem.fee(), + ); }); } #[test] - fn integration_test_replace_accept_replace_above_capacity_succeeds() { + fn integration_test_request_replace_above_capacity_fails() { test_with(|old_vault_id, new_vault_id| { // try to accept 400% let accept_amount = DEFAULT_VAULT_TO_BE_REPLACED * 4; let accept_amount = old_vault_id.wrapped(accept_amount.amount()); - assert_ok!(RuntimeCall::Redeem(RedeemCall::request_replace { - currency_pair: old_vault_id.currencies.clone(), - amount: accept_amount.amount(), - new_vault_id: new_vault_id.clone(), - griefing_currency: DEFAULT_GRIEFING_CURRENCY - }) - .dispatch(origin_of(old_vault_id.account_id.clone()))); - - let redeem_id = assert_redeem_request_event(); - let redeem = RedeemPallet::get_open_redeem_request_from_id(&redeem_id).unwrap(); - - assert_eq!(redeem.amount_btc, accept_amount.amount() / 2); - assert_eq!(redeem.issue_id.is_some(), true); - - let issue_id = assert_issue_request_event(); - let issue = IssuePallet::get_issue_request_from_id(&issue_id).unwrap(); - - assert_eq!(issue.griefing_collateral(), griefing(4)); - assert_state_after_accept_replace_correct( - &old_vault_id, - &new_vault_id, - &issue, - Amount::new(accept_amount.amount() / 2, old_vault_id.currencies.wrapped), + assert_err!( + RuntimeCall::Redeem(RedeemCall::request_replace { + currency_pair: old_vault_id.currencies.clone(), + amount: accept_amount.amount(), + new_vault_id: new_vault_id.clone(), + griefing_currency: DEFAULT_GRIEFING_CURRENCY + }) + .dispatch(origin_of(old_vault_id.account_id.clone())), + VaultRegistryError::InsufficientTokensCommitted ); }); } @@ -278,7 +258,6 @@ mod request_replace_tests { ); CoreVaultData::force_to(&new_vault_id, default_vault_state(&new_vault_id)); - //Fixme: The code works without this check, ideally shouldn't have worked? assert_noop!( RuntimeCall::Redeem(RedeemCall::request_replace { currency_pair: old_vault_id.currencies.clone(), @@ -414,7 +393,7 @@ mod execute_replace_payment_limits { #[test] fn integration_test_execute_replace_with_exact_amount_succeeds() { test_with(|old_vault_id, new_vault_id| { - let accept_amount = old_vault_id.wrapped(1000000); + let accept_amount = old_vault_id.wrapped(10000); assert_ok!(RuntimeCall::Redeem(RedeemCall::request_replace { currency_pair: old_vault_id.currencies.clone(), @@ -437,7 +416,7 @@ mod execute_replace_payment_limits { #[test] fn integration_test_execute_replace_with_overpayment_fails() { test_with(|old_vault_id, new_vault_id| { - let accept_amount = old_vault_id.wrapped(1000000); + let accept_amount = old_vault_id.wrapped(10000); assert_ok!(RuntimeCall::Redeem(RedeemCall::request_replace { currency_pair: old_vault_id.currencies.clone(), @@ -463,7 +442,7 @@ mod execute_replace_payment_limits { #[test] fn integration_test_execute_replace_with_underpayment_fails() { test_with(|old_vault_id, new_vault_id| { - let accept_amount = old_vault_id.wrapped(1000000); + let accept_amount = old_vault_id.wrapped(10000); assert_ok!(RuntimeCall::Redeem(RedeemCall::request_replace { currency_pair: old_vault_id.currencies.clone(), @@ -572,7 +551,7 @@ fn integration_test_replace_execute_replace_success() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, _redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); let pre_execute_state = ParachainTwoVaultState::get(&old_vault_id, &new_vault_id); @@ -580,9 +559,8 @@ fn integration_test_replace_execute_replace_success() { assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_execute_state.with_changes(|old_vault, new_vault, _| { - old_vault.issued -= accept_amount; - old_vault.to_be_redeemed -= accept_amount; - *old_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); + old_vault.issued -= accept_amount - redeem.fee; + old_vault.to_be_redeemed -= accept_amount - redeem.fee; new_vault.issued += accept_amount; new_vault.to_be_issued -= accept_amount; @@ -608,7 +586,7 @@ fn integration_test_replace_execute_replace_old_vault_liquidated() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); let old = CoreVaultData::vault(old_vault_id.clone()); @@ -618,23 +596,25 @@ fn integration_test_replace_execute_replace_old_vault_liquidated() { assert_ok!(execute_replace(redeem_id)); - let collateral_for_replace = - calculate_replace_collateral(&old, redeem.amount_btc(), old_vault_id.collateral_currency()); + let collateral_for_replace = calculate_replace_collateral( + &old, + redeem.amount_btc().checked_sub(&redeem.fee()).unwrap(), + old_vault_id.collateral_currency(), + ); assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_execution_state.with_changes(|old_vault, new_vault, liquidation_vault| { let liquidation_vault = liquidation_vault.with_currency(&old_vault_id.currencies); - liquidation_vault.issued -= accept_amount; - liquidation_vault.to_be_redeemed -= accept_amount; + liquidation_vault.issued -= accept_amount - redeem.fee; + liquidation_vault.to_be_redeemed -= accept_amount - redeem.fee; new_vault.to_be_issued -= accept_amount; new_vault.issued += accept_amount; - old_vault.to_be_redeemed -= accept_amount; + old_vault.to_be_redeemed -= accept_amount - redeem.fee; old_vault.liquidated_collateral -= collateral_for_replace; - *old_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); *old_vault .free_balance .get_mut(&old_vault_id.collateral_currency()) @@ -649,7 +629,7 @@ fn integration_test_replace_execute_replace_new_vault_liquidated() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, _redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); liquidate_vault(&new_vault_id); @@ -665,9 +645,8 @@ fn integration_test_replace_execute_replace_new_vault_liquidated() { liquidation_vault.issued += accept_amount; liquidation_vault.to_be_issued -= accept_amount; - old_vault.to_be_redeemed -= accept_amount; - old_vault.issued -= accept_amount; - *old_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); + old_vault.to_be_redeemed -= accept_amount - redeem.fee; + old_vault.issued -= accept_amount - redeem.fee; }) ); }); @@ -678,7 +657,7 @@ fn integration_test_replace_execute_replace_both_vaults_liquidated() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); let old = CoreVaultData::vault(old_vault_id.clone()); @@ -689,23 +668,25 @@ fn integration_test_replace_execute_replace_both_vaults_liquidated() { assert_ok!(execute_replace(redeem_id)); - let collateral_for_replace = - calculate_replace_collateral(&old, redeem.amount_btc(), old_vault_id.collateral_currency()); + let collateral_for_replace = calculate_replace_collateral( + &old, + redeem.amount_btc().checked_sub(&redeem.fee()).unwrap(), + old_vault_id.collateral_currency(), + ); assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_execution_state.with_changes(|old_vault, _new_vault, liquidation_vault| { let old_liquidation_vault = liquidation_vault.with_currency(&old_vault_id.currencies); - old_liquidation_vault.to_be_redeemed -= accept_amount; - old_liquidation_vault.issued -= accept_amount; + old_liquidation_vault.to_be_redeemed -= accept_amount - redeem.fee; + old_liquidation_vault.issued -= accept_amount - redeem.fee; let new_liquidation_vault = liquidation_vault.with_currency(&new_vault_id.currencies); new_liquidation_vault.to_be_issued -= accept_amount; new_liquidation_vault.issued += accept_amount; - old_vault.to_be_redeemed -= accept_amount; + old_vault.to_be_redeemed -= accept_amount - redeem.fee; old_vault.liquidated_collateral -= collateral_for_replace; - *old_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); *old_vault .free_balance .get_mut(&old_vault_id.collateral_currency()) @@ -729,17 +710,19 @@ fn integration_test_replace_execute_replace_with_cancelled() { fn integration_test_replace_cancel_replace_success() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, _redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); let pre_cancellation_state = ParachainTwoVaultState::get(&old_vault_id, &new_vault_id); cancel_replace(redeem_id); + let punishment_fee = get_punishment_fee(); assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_cancellation_state.with_changes(|old_vault, new_vault, _| { new_vault.to_be_issued -= accept_amount; - *new_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); + old_vault.backing_collateral -= punishment_fee; + *new_vault.free_balance.get_mut(&punishment_fee.currency()).unwrap() += punishment_fee; - old_vault.to_be_redeemed -= accept_amount; + old_vault.to_be_redeemed -= accept_amount - redeem.fee; }) ); }); @@ -749,7 +732,7 @@ fn integration_test_replace_cancel_replace_success() { fn integration_test_replace_cancel_replace_old_vault_liquidated() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); let old = CoreVaultData::vault(old_vault_id.clone()); @@ -759,21 +742,23 @@ fn integration_test_replace_cancel_replace_old_vault_liquidated() { cancel_replace(redeem_id); - let collateral_for_replace = - calculate_replace_collateral(&old, redeem.amount_btc(), old_vault_id.collateral_currency()); + let collateral_for_replace = calculate_replace_collateral( + &old, + redeem.amount_btc().checked_sub(&redeem.fee()).unwrap(), + old_vault_id.collateral_currency(), + ); assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_cancellation_state.with_changes(|old_vault, new_vault, liquidation_vault| { - let liquidation_vault = liquidation_vault.with_currency(&old_vault_id.currencies); - - old_vault.to_be_redeemed -= accept_amount; + old_vault.to_be_redeemed -= accept_amount - redeem.fee; old_vault.liquidated_collateral -= collateral_for_replace; new_vault.to_be_issued -= accept_amount; - *new_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); - liquidation_vault.to_be_redeemed -= accept_amount; + let liquidation_vault = liquidation_vault.with_currency(&old_vault_id.currencies); + + liquidation_vault.to_be_redeemed -= accept_amount - redeem.fee; liquidation_vault.collateral += collateral_for_replace; }) ); @@ -784,20 +769,20 @@ fn integration_test_replace_cancel_replace_old_vault_liquidated() { fn integration_test_replace_cancel_replace_new_vault_liquidated() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, _redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); liquidate_vault(&new_vault_id); let pre_cancellation_state = ParachainTwoVaultState::get(&old_vault_id, &new_vault_id); cancel_replace(redeem_id); - + let punishment_fee = get_punishment_fee(); assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_cancellation_state.with_changes(|old_vault, new_vault, liquidation_vault| { - old_vault.to_be_redeemed -= accept_amount; - - *new_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); + old_vault.to_be_redeemed -= accept_amount - redeem.fee; + old_vault.backing_collateral -= punishment_fee; + *new_vault.free_balance.get_mut(&punishment_fee.currency()).unwrap() += punishment_fee; let new_liquidation_vault = liquidation_vault.with_currency(&new_vault_id.currencies); new_liquidation_vault.to_be_issued -= accept_amount; @@ -821,13 +806,16 @@ fn integration_test_replace_cancel_replace_both_vaults_liquidated() { cancel_replace(redeem_id); - let collateral_for_replace = - calculate_replace_collateral(&old, redeem.amount_btc(), old_vault_id.collateral_currency()); + let collateral_for_replace = calculate_replace_collateral( + &old, + redeem.amount_btc().checked_sub(&redeem.fee()).unwrap(), + old_vault_id.collateral_currency(), + ); assert_eq!( ParachainTwoVaultState::get(&old_vault_id, &new_vault_id), pre_cancellation_state.with_changes(|old_vault, new_vault, liquidation_vault| { - old_vault.to_be_redeemed -= accept_amount; + old_vault.to_be_redeemed -= accept_amount - redeem.fee; old_vault.liquidated_collateral -= collateral_for_replace; *new_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); @@ -838,6 +826,8 @@ fn integration_test_replace_cancel_replace_both_vaults_liquidated() { let new_liquidation_vault = liquidation_vault.with_currency(&new_vault_id.currencies); new_liquidation_vault.to_be_issued -= accept_amount; + let new_liquidation_vault = liquidation_vault.with_currency(&old_vault_id.currencies); + new_liquidation_vault.to_be_redeemed += redeem.fee(); //KBTC }) ); }); @@ -867,7 +857,7 @@ fn integration_test_replace_vault_with_different_currency_succeeds() { CoreVaultData::force_to(&new_vault_id, default_vault_state(&new_vault_id)); let accept_amount = new_vault_id.wrapped(10000); - let (redeem_id, _redeem, _issue_id, issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); + let (redeem_id, redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); let pre_execute_state = ParachainTwoVaultState::get(&old_vault_id, &new_vault_id); @@ -878,10 +868,8 @@ fn integration_test_replace_vault_with_different_currency_succeeds() { pre_execute_state.with_changes(|old_vault, new_vault, _| { new_vault.to_be_issued -= accept_amount; new_vault.issued += accept_amount; - old_vault.to_be_redeemed -= accept_amount; - old_vault.issued -= accept_amount; - - *old_vault.free_balance.get_mut(&DEFAULT_GRIEFING_CURRENCY).unwrap() += issue.griefing_collateral(); + old_vault.to_be_redeemed -= accept_amount - redeem.fee; + old_vault.issued -= accept_amount - redeem.fee; }) ); }); @@ -922,7 +910,7 @@ mod oracle_down { } #[test] - fn no_oracle_cancel_replace_succeeds() { + fn no_oracle_cancel_replace_fails() { test_with(|old_vault_id, new_vault_id| { let accept_amount = new_vault_id.wrapped(10000); let (redeem_id, _redeem, _issue_id, _issue) = setup_replace(accept_amount, &old_vault_id, &new_vault_id); @@ -932,11 +920,14 @@ mod oracle_down { mine_blocks(2); SecurityPallet::set_active_block_number(30); - assert_ok!(RuntimeCall::Redeem(RedeemCall::cancel_redeem { - redeem_id: redeem_id, - reimburse: true, - }) - .dispatch(origin_of(account_of(NEW_VAULT)))); + assert_noop!( + RuntimeCall::Redeem(RedeemCall::cancel_redeem { + redeem_id: redeem_id, + reimburse: true, + }) + .dispatch(origin_of(account_of(NEW_VAULT))), + OracleError::MissingExchangeRate + ); }) } diff --git a/parachain/runtime/runtime-tests/src/utils/redeem_utils.rs b/parachain/runtime/runtime-tests/src/utils/redeem_utils.rs index fbb266c8fb..297e9dbe06 100644 --- a/parachain/runtime/runtime-tests/src/utils/redeem_utils.rs +++ b/parachain/runtime/runtime-tests/src/utils/redeem_utils.rs @@ -154,6 +154,27 @@ pub fn assert_redeem_request_event() -> H256 { ids.last().unwrap().clone() } +// returns punishment_fee that vault has paid for cancel replace +pub fn get_punishment_fee() -> Amount { + let events = SystemPallet::events(); + let ids = events + .iter() + .filter_map(|r| match r.event { + RuntimeEvent::Redeem(RedeemEvent::CancelReplace { + ref old_vault, + punishment_fee, + .. + }) => { + let fee = Amount::new(punishment_fee, old_vault.collateral_currency()); + Some(fee) + } + _ => None, + }) + .collect::>(); + assert!(ids.len() >= 1); + ids.last().unwrap().clone() +} + /// returns (fee, amount) pub fn assert_self_redeem_event() -> (Amount, Amount) { let events = SystemPallet::events(); diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 0616c92f4f..82b303abf9 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -91,6 +91,7 @@ pub enum AccountOrVault { Vault(VaultId), } impl AccountOrVault { + // Method to retrieve the account associated with an `AccountOrVault` instance pub fn get_account(&self) -> &AccountId { match self { AccountOrVault::Account(account_id) => account_id, @@ -98,6 +99,7 @@ impl AccountOrVault { } } + // Method to check if the enum variant is `Vault` pub fn is_vault_account(&self) -> bool { matches!(self, AccountOrVault::Vault(_)) } @@ -298,15 +300,9 @@ pub mod redeem { pub btc_height: u32, /// the status of this redeem request pub status: RedeemRequestStatus, - /// the issue id + /// the issue id associated with replace request pub issue_id: Option, } - - impl RedeemRequest { - pub fn is_redeem_a_replace_request(&self) -> bool { - self.issue_id.is_some() - } - } } pub mod replace {