diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index dc9287c3a..4b8a8b414 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: metadata: - - parachain-metadata-interlay +# - parachain-metadata-interlay - parachain-metadata-kintsugi steps: diff --git a/Cargo.lock b/Cargo.lock index 801e479dd..2b623c8ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,6 +36,41 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aes-gcm" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "ahash" version = "0.7.6" @@ -168,6 +203,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + [[package]] name = "arrayvec" version = "0.5.2" @@ -180,6 +224,63 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c1da3ae8dabd9c00f453a329dfe1fb28da3c0a72e2478cdcd93171740c20499" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand 2.0.0", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock", + "autocfg", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix 0.37.23", + "slab", + "socket2", + "waker-fn", +] + [[package]] name = "async-lock" version = "2.7.0" @@ -189,6 +290,41 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-net" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0434b1ed18ce1cf5769b8ac540e33f01fa9471058b5e89da9e06f3c882a8c12f" +dependencies = [ + "async-io", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-process" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +dependencies = [ + "async-io", + "async-lock", + "autocfg", + "blocking", + "cfg-if 1.0.0", + "event-listener", + "futures-lite", + "rustix 0.37.23", + "signal-hook", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-task" +version = "4.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" + [[package]] name = "async-trait" version = "0.1.72" @@ -200,6 +336,18 @@ dependencies = [ "syn 2.0.27", ] +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -320,6 +468,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bip39" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +dependencies = [ + "bitcoin_hashes 0.11.0", +] + [[package]] name = "bitcoin" version = "0.30.1" @@ -393,6 +550,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b375d62f341cef9cd9e77793ec8f1db3fc9ce2e4d57e982c8fe697a2c16af3b6" +[[package]] +name = "bitcoin_hashes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" + [[package]] name = "bitcoin_hashes" version = "0.12.0" @@ -460,6 +623,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq 0.1.5", +] + [[package]] name = "blake2b_simd" version = "1.0.1" @@ -468,7 +641,7 @@ checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq", + "constant_time_eq 0.2.6", ] [[package]] @@ -510,6 +683,22 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "blocking" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c4ef1f913d78636d78d538eec1f18de81e481f44b1be0a81060090530846e1" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "fastrand 2.0.0", + "futures-io", + "futures-lite", + "piper", + "tracing", +] + [[package]] name = "bounded-collections" version = "0.1.8" @@ -528,6 +717,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + [[package]] name = "bstr" version = "1.6.0" @@ -624,6 +822,31 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chacha20" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "zeroize", +] + +[[package]] +name = "chacha20poly1305" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.26" @@ -639,6 +862,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array 0.14.7", +] + [[package]] name = "clang-sys" version = "1.6.1" @@ -697,12 +929,27 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "concurrent-queue" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-oid" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "constant_time_eq" version = "0.2.6" @@ -801,6 +1048,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -858,6 +1115,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "2.1.3" @@ -884,6 +1150,46 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "platforms", + "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.27", +] + +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "darling" version = "0.14.4" @@ -1273,6 +1579,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.0.0" @@ -1317,6 +1632,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1405,6 +1726,18 @@ dependencies = [ "serde", ] +[[package]] +name = "frame-metadata" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" +dependencies = [ + "cfg-if 1.0.0", + "parity-scale-codec", + "scale-info", + "serde", +] + [[package]] name = "frame-support" version = "4.0.0-dev" @@ -1412,7 +1745,7 @@ source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#f dependencies = [ "bitflags 1.3.2", "environmental", - "frame-metadata", + "frame-metadata 15.1.0", "frame-support-procedural", "impl-trait-for-tuples", "k256", @@ -1559,6 +1892,21 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -1658,10 +2006,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", - "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", +] + +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug 0.3.0", + "polyval", ] [[package]] @@ -1852,6 +2208,9 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "serde", +] [[package]] name = "headers" @@ -2162,6 +2521,12 @@ dependencies = [ "hashbrown 0.14.0", ] +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + [[package]] name = "instant" version = "0.1.12" @@ -2196,6 +2561,12 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "intx" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" + [[package]] name = "io-lifetimes" version = "1.0.11" @@ -2671,6 +3042,12 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +[[package]] +name = "lru" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" + [[package]] name = "mach" version = "0.3.2" @@ -2765,6 +3142,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + [[package]] name = "mime" version = "0.3.17" @@ -2928,6 +3317,18 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" +[[package]] +name = "no-std-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -3254,6 +3655,12 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" +[[package]] +name = "parking" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" + [[package]] name = "parking_lot" version = "0.11.2" @@ -3326,6 +3733,15 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -3376,6 +3792,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.0", + "futures-io", +] + [[package]] name = "pkcs8" version = "0.10.2" @@ -3392,6 +3819,51 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "platforms" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" + +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "poly1305" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +dependencies = [ + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -4075,6 +4547,17 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +[[package]] +name = "ruzstd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" +dependencies = [ + "byteorder", + "thiserror-core", + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.15" @@ -4183,7 +4666,7 @@ dependencies = [ "base58", "blake2", "either", - "frame-metadata", + "frame-metadata 15.1.0", "parity-scale-codec", "scale-bits", "scale-decode", @@ -4224,7 +4707,7 @@ dependencies = [ "arrayvec 0.5.2", "curve25519-dalek 2.1.3", "getrandom 0.1.16", - "merlin", + "merlin 2.0.1", "rand 0.7.3", "rand_core 0.5.1", "sha2 0.8.2", @@ -4232,6 +4715,22 @@ dependencies = [ "zeroize", ] +[[package]] +name = "schnorrkel" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844b7645371e6ecdf61ff246ba1958c29e802881a749ae3fb1993675d210d28d" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "curve25519-dalek-ng", + "merlin 3.0.0", + "rand_core 0.6.4", + "sha2 0.9.9", + "subtle-ng", + "zeroize", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -4605,6 +5104,12 @@ dependencies = [ "paste", ] +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "slab" version = "0.4.8" @@ -4636,6 +5141,120 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +[[package]] +name = "smol" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13f2b548cd8447f8de0fdf1c592929f70f4fc7039a05e47404b0d096ec6987a1" +dependencies = [ + "async-channel", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-net", + "async-process", + "blocking", + "futures-lite", +] + +[[package]] +name = "smoldot" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cce5e2881b30bad7ef89f383a816ad0b22c45915911f28499026de4a76d20ee" +dependencies = [ + "arrayvec 0.7.4", + "async-lock", + "atomic", + "base64 0.21.2", + "bip39", + "blake2-rfc", + "bs58 0.5.0", + "crossbeam-queue", + "derive_more", + "ed25519-zebra", + "either", + "event-listener", + "fnv", + "futures-channel", + "futures-util", + "hashbrown 0.14.0", + "hex", + "hmac 0.12.1", + "itertools", + "libsecp256k1", + "merlin 3.0.0", + "no-std-net", + "nom", + "num-bigint 0.4.3", + "num-rational 0.4.1", + "num-traits", + "pbkdf2 0.12.2", + "pin-project", + "rand 0.8.5", + "rand_chacha 0.3.1", + "ruzstd", + "schnorrkel 0.10.2", + "serde", + "serde_json", + "sha2 0.10.7", + "siphasher", + "slab", + "smallvec", + "smol", + "snow", + "soketto", + "tiny-keccak", + "twox-hash", + "wasmi 0.30.0", +] + +[[package]] +name = "smoldot-light" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2f7b4687b83ff244ef6137735ed5716ad37dcdf3ee16c4eb1a32fb9808fa47" +dependencies = [ + "async-lock", + "blake2-rfc", + "derive_more", + "either", + "event-listener", + "fnv", + "futures-channel", + "futures-util", + "hashbrown 0.14.0", + "hex", + "itertools", + "log", + "lru", + "parking_lot 0.12.1", + "rand 0.8.5", + "serde", + "serde_json", + "siphasher", + "slab", + "smol", + "smoldot", +] + +[[package]] +name = "snow" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" +dependencies = [ + "aes-gcm", + "blake2", + "chacha20poly1305", + "curve25519-dalek 4.1.1", + "rand_core 0.6.4", + "rustc_version", + "sha2 0.10.7", + "subtle", +] + [[package]] name = "socket2" version = "0.4.9" @@ -4731,7 +5350,7 @@ dependencies = [ "bitflags 1.3.2", "blake2", "bounded-collections", - "bs58", + "bs58 0.4.0", "dyn-clonable", "ed25519-zebra", "futures 0.3.28", @@ -4741,7 +5360,7 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", - "merlin", + "merlin 2.0.1", "parity-scale-codec", "parking_lot 0.12.1", "paste", @@ -4749,7 +5368,7 @@ dependencies = [ "rand 0.8.5", "regex", "scale-info", - "schnorrkel", + "schnorrkel 0.9.1", "secp256k1 0.24.3", "secrecy", "serde", @@ -4897,7 +5516,7 @@ name = "sp-metadata-ir" version = "0.1.0" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "frame-metadata", + "frame-metadata 15.1.0", "parity-scale-codec", "scale-info", "sp-std 5.0.0", @@ -5095,7 +5714,7 @@ dependencies = [ "log", "parity-scale-codec", "sp-std 5.0.0", - "wasmi", + "wasmi 0.13.2", "wasmtime", ] @@ -5218,7 +5837,7 @@ checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" dependencies = [ "hmac 0.11.0", "pbkdf2 0.8.0", - "schnorrkel", + "schnorrkel 0.9.1", "sha2 0.9.9", "zeroize", ] @@ -5229,19 +5848,24 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "subxt" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31a734d66fa935fbda56ba6a71d7e969f424c8c5608d416ba8499d71d8cbfc1f" +checksum = "0ba02ada83ba2640c46e200a1758cc83ce876a16326d2c52ca5db41b7d6645ce" dependencies = [ "base58", "blake2", "derivative", "either", - "frame-metadata", + "frame-metadata 16.0.0", "futures 0.3.28", - "getrandom 0.2.10", "hex", "impl-serde 0.4.0", "jsonrpsee", @@ -5255,6 +5879,7 @@ dependencies = [ "serde", "serde_json", "sp-core-hashing 9.0.0", + "subxt-lightclient", "subxt-macro", "subxt-metadata", "thiserror", @@ -5263,11 +5888,11 @@ dependencies = [ [[package]] name = "subxt-codegen" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2f231d97c145c564bd544212c0cc0c29c09ff516af199f4ce00c8e055f8138" +checksum = "3213eb04567e710aa253b94de74337c7b663eea52114805b8723129763282779" dependencies = [ - "frame-metadata", + "frame-metadata 16.0.0", "heck", "hex", "jsonrpsee", @@ -5281,11 +5906,28 @@ dependencies = [ "tokio", ] +[[package]] +name = "subxt-lightclient" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439a235bedd0e460c110e5341d919ec3a27f9be3dd4c1c944daad8a9b54d396d" +dependencies = [ + "futures 0.3.28", + "futures-util", + "serde", + "serde_json", + "smoldot-light", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + [[package]] name = "subxt-macro" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e544e41e1c84b616632cd2f86862342868f62e11e4cd9062a9e3dbf5fc871f64" +checksum = "cfda460cc5f701785973382c589e9bb12c23bb8d825bfc3ac547b7c672aba1c0" dependencies = [ "darling 0.20.3", "proc-macro-error", @@ -5295,11 +5937,11 @@ dependencies = [ [[package]] name = "subxt-metadata" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01ce5044c81db3404d38c56f1e69d72eff72c54e5913c9bba4c0b58d376031f" +checksum = "0283bd02163913fbd0a5153d0b179533e48b239b953fa4e43baa27c73f18861c" dependencies = [ - "frame-metadata", + "frame-metadata 16.0.0", "parity-scale-codec", "scale-info", "sp-core-hashing 9.0.0", @@ -5387,7 +6029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ "cfg-if 1.0.0", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", "rustix 0.38.4", "windows-sys 0.48.0", @@ -5417,6 +6059,26 @@ dependencies = [ "thiserror-impl", ] +[[package]] +name = "thiserror-core" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" +dependencies = [ + "thiserror-core-impl", +] + +[[package]] +name = "thiserror-core-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "thiserror-impl" version = "1.0.44" @@ -5467,6 +6129,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -5835,6 +6506,16 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array 0.14.7", + "subtle", +] + [[package]] name = "untrusted" version = "0.7.1" @@ -5936,6 +6617,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "want" version = "0.3.1" @@ -6068,7 +6755,21 @@ checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ "parity-wasm", "wasmi-validation", - "wasmi_core", + "wasmi_core 0.2.1", +] + +[[package]] +name = "wasmi" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51fb5c61993e71158abf5bb863df2674ca3ec39ed6471c64f07aeaf751d67b4" +dependencies = [ + "intx", + "smallvec", + "spin 0.9.8", + "wasmi_arena", + "wasmi_core 0.12.0", + "wasmparser-nostd", ] [[package]] @@ -6080,6 +6781,12 @@ dependencies = [ "parity-wasm", ] +[[package]] +name = "wasmi_arena" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" + [[package]] name = "wasmi_core" version = "0.2.1" @@ -6093,6 +6800,18 @@ dependencies = [ "num-traits", ] +[[package]] +name = "wasmi_core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + [[package]] name = "wasmparser" version = "0.100.0" @@ -6103,6 +6822,15 @@ dependencies = [ "url 2.4.0", ] +[[package]] +name = "wasmparser-nostd" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" +dependencies = [ + "indexmap-nostd", +] + [[package]] name = "wasmtime" version = "6.0.2" diff --git a/bitcoin/src/electrs/mod.rs b/bitcoin/src/electrs/mod.rs index 536d3defe..5e34ebfd0 100644 --- a/bitcoin/src/electrs/mod.rs +++ b/bitcoin/src/electrs/mod.rs @@ -266,7 +266,7 @@ impl ElectrsClient { ) -> Result, Error> { let script = ScriptBuilder::new() .push_opcode(opcodes::OP_RETURN) - .push_slice(&data.as_fixed_bytes()) + .push_slice(data.as_fixed_bytes()) .into_script(); let script_hash = { diff --git a/bitcoin/src/light/mod.rs b/bitcoin/src/light/mod.rs index 1c6ba6cf7..09e069ad0 100644 --- a/bitcoin/src/light/mod.rs +++ b/bitcoin/src/light/mod.rs @@ -84,7 +84,7 @@ impl BitcoinLight { } async fn get_coinbase_txid(&self, block_hash: &BlockHash) -> Result { - Ok(self.electrs.get_coinbase_txid(&block_hash).await?) + Ok(self.electrs.get_coinbase_txid(block_hash).await?) } } diff --git a/oracle/src/feeds/dia_fair_price.rs b/oracle/src/feeds/dia_fair_price.rs index cc4a10e4c..6fd843075 100644 --- a/oracle/src/feeds/dia_fair_price.rs +++ b/oracle/src/feeds/dia_fair_price.rs @@ -28,7 +28,7 @@ impl Default for DiaFairPriceApi { fn extract_response(value: Value, alias: &str) -> Option { value .as_array()? - .into_iter() + .iter() .find(|entry| matches!(entry.get("Token").and_then(|value| value.as_str()), Some(token) if token.to_uppercase() == alias))? .get("FairPrice")? .as_f64() diff --git a/runner/Cargo.toml b/runner/Cargo.toml index 28400be4f..6d53cce74 100644 --- a/runner/Cargo.toml +++ b/runner/Cargo.toml @@ -24,7 +24,7 @@ signal-hook = "0.3.14" signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] } futures = "0.3.21" backoff = { version = "0.3.0", features = ["tokio"] } -subxt = { version = "0.29.0", default_features = false, features = ["jsonrpsee-ws"] } +subxt = { version = "0.30.0", default_features = false, features = ["jsonrpsee","native"] } sha2 = "0.8.2" [dev-dependencies] diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 65a859fef..491ba5b64 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -12,6 +12,8 @@ testing-utils = [ ] parachain-metadata-interlay = [] parachain-metadata-kintsugi = [] +run-test-with-sudo = [] +run-test-with-specific-node-target = [] [dependencies] serde = { version = "1.0.136", features = ["derive"] } @@ -41,7 +43,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" } # Subxt dependencies -subxt = { version = "0.29.0", default_features = false, features = ["jsonrpsee-ws"] } +subxt = { version = "0.30.0", default_features = false, features = ["jsonrpsee","native"] } jsonrpsee = { version = "0.16", features = ["async-client", "client-ws-transport", "macros", "jsonrpsee-types", "client", "jsonrpsee-ws-client", "jsonrpsee-client-transport"] } bitcoin = { path = "../bitcoin" } diff --git a/runtime/metadata-parachain-kintsugi.scale b/runtime/metadata-parachain-kintsugi.scale index 8c557970e..846543c3c 100644 Binary files a/runtime/metadata-parachain-kintsugi.scale and b/runtime/metadata-parachain-kintsugi.scale differ diff --git a/runtime/src/error.rs b/runtime/src/error.rs index aec11e1f2..31640d187 100644 --- a/runtime/src/error.rs +++ b/runtime/src/error.rs @@ -110,7 +110,7 @@ impl Error { Error::SubxtRuntimeError(SubxtError::Runtime(DispatchError::Module(module_error))) => { match module_error.as_root_error::() { Ok(root_error) => format!("{:?}", root_error), - Err(_) => format!("Unknown error: {:?}", module_error.raw()), + Err(_) => format!("Unknown error: {:?}", module_error.to_string()), } } err => err.to_string(), diff --git a/runtime/src/integration/mod.rs b/runtime/src/integration/mod.rs index 121ee9594..7f8709589 100644 --- a/runtime/src/integration/mod.rs +++ b/runtime/src/integration/mod.rs @@ -173,16 +173,42 @@ pub async fn with_timeout(future: T, duration: Duration) -> T::Output } pub async fn start_chain() -> std::io::Result { - let _stop_previous_instance = Command::new("docker") - .arg("compose") - .arg("rm") - .arg("-v") - .arg("-s") - .arg("-f") - .arg("interbtc") - .status() - .unwrap(); - let command = Command::new("sh").arg("../scripts/run_parachain_node.sh").spawn(); + let command = if cfg!(feature = "run-test-with-sudo") { + let _stop_previous_instance = Command::new("sudo") + .arg("docker") + .arg("compose") + .arg("rm") + .arg("-v") + .arg("-s") + .arg("-f") + .arg("interbtc") + .status() + .unwrap(); + Command::new("sh") + .arg("../scripts/run_parachain_node_with_sudo.sh") + .spawn() + } else if cfg!(feature = "run-test-with-specific-node-target") { + let _stop_previous_instance = Command::new("sh") + .arg("-c") + .arg("lsof -ti :9944 | xargs kill") + .status() + .unwrap(); + + Command::new("sh") + .arg("../scripts/run_parachain_node_with_specific_target.sh") + .spawn() + } else { + let _stop_previous_instance = Command::new("docker") + .arg("compose") + .arg("rm") + .arg("-v") + .arg("-s") + .arg("-f") + .arg("interbtc") + .status() + .unwrap(); + Command::new("sh").arg("../scripts/run_parachain_node.sh").spawn() + }; command } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 533c692a0..aa287a48f 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -176,7 +176,6 @@ pub struct WrapperKeepOpaque { pub struct InterBtcRuntime; impl Config for InterBtcRuntime { - type Index = ::Index; type Hash = ::Hash; type AccountId = AccountId; type Address = Self::AccountId; diff --git a/runtime/src/rpc.rs b/runtime/src/rpc.rs index 1594c3347..07a2697da 100644 --- a/runtime/src/rpc.rs +++ b/runtime/src/rpc.rs @@ -15,15 +15,17 @@ use module_bitcoin::{ parser::{parse_block_header, parse_transaction}, types::FullTransactionProof, }; -use primitives::{BalanceWrapper, UnsignedFixedPoint}; +use primitives::UnsignedFixedPoint; use serde_json::Value; use std::{convert::TryInto, future::Future, ops::Range, sync::Arc, time::Duration}; +#[cfg(feature = "testing-utils")] +use subxt::rpc::rpc_params; use subxt::{ blocks::ExtrinsicEvents, client::OnlineClient, events::StaticEvent, metadata::DecodeWithMetadata, - rpc::{rpc_params, RpcClientT}, + rpc::RpcClientT, storage::{address::Yes, StorageAddress}, tx::TxPayload, utils::Static, @@ -272,7 +274,7 @@ impl InterBtcParachain { let tx_progress = self .api .tx() - .create_signed_with_nonce(&call, &self.signer, nonce, Default::default())? + .create_signed_with_nonce(&call, &self.signer, nonce.into(), Default::default())? .submit_and_watch() .await?; @@ -479,7 +481,7 @@ impl InterBtcParachain { self.api .tx() - .create_signed_with_nonce(&call, &self.signer, nonce, Default::default()) + .create_signed_with_nonce(&call, &self.signer, nonce.into(), Default::default()) .unwrap() .submit_and_watch() .await @@ -506,7 +508,7 @@ impl InterBtcParachain { // submit tx but don't watch self.api .tx() - .create_signed_with_nonce(&call, &self.signer, nonce, Default::default()) + .create_signed_with_nonce(&call, &self.signer, nonce.into(), Default::default()) .unwrap() .submit() .await @@ -515,7 +517,7 @@ impl InterBtcParachain { // should call with the same nonce self.api .tx() - .create_signed_with_nonce(&call, &self.signer, nonce, Default::default()) + .create_signed_with_nonce(&call, &self.signer, nonce.into(), Default::default()) .unwrap() .submit_and_watch() .await @@ -988,16 +990,15 @@ impl ReplacePallet for InterBtcParachain { &self, account_id: AccountId, ) -> Result, Error> { - let head = Some(self.get_finalized_block_hash().await?); - let result: Vec = self - .api - .rpc() - .request("replace_getNewVaultReplaceRequests", rpc_params![account_id, head]) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .replace_api() + .get_new_vault_replace_requests(account_id); + let result: Vec> = self.api.runtime_api().at(head).call(runtime_api_call).await?; join_all( result .into_iter() - .map(|key| async move { self.get_replace_request(key).await.map(|value| (key, value)) }), + .map(|key| async move { self.get_replace_request(*key).await.map(|value| (*key, value)) }), ) .await .into_iter() @@ -1009,16 +1010,15 @@ impl ReplacePallet for InterBtcParachain { &self, account_id: AccountId, ) -> Result, Error> { - let head = Some(self.get_finalized_block_hash().await?); - let result: Vec = self - .api - .rpc() - .request("replace_getOldVaultReplaceRequests", rpc_params![account_id, head]) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .replace_api() + .get_old_vault_replace_requests(account_id); + let result: Vec> = self.api.runtime_api().at(head).call(runtime_api_call).await?; join_all( result .into_iter() - .map(|key| async move { self.get_replace_request(key).await.map(|value| (key, value)) }), + .map(|key| async move { self.get_replace_request(*key).await.map(|value| (*key, value)) }), ) .await .into_iter() @@ -1127,31 +1127,44 @@ impl OraclePallet for InterBtcParachain { /// Converts the amount in btc to dot, based on the current set exchange rate. async fn wrapped_to_collateral(&self, amount: u128, currency_id: CurrencyId) -> Result { - let head = Some(self.get_finalized_block_hash().await?); - let result: BalanceWrapper<_> = self - .api - .rpc() - .request( - "oracle_wrappedToCollateral", - rpc_params![BalanceWrapper { amount }, currency_id, head], - ) - .await?; - Ok(result.amount) + let head = self.get_finalized_block_hash().await?; + + // Create a runtime API payload that calls into + // `Core_version` function. + let runtime_api_call = metadata::apis() + .oracle_api() + .wrapped_to_collateral(BalanceWrapper { amount }, currency_id); + + let result: Result = + self.api.runtime_api().at(head).call(runtime_api_call).await?; + + let balance: BalanceWrapper = result.map_err(|err| { + let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) + .unwrap_or(subxt::error::DispatchError::Other); + Error::SubxtRuntimeError(SubxtError::Runtime(dispatch_error)) + })?; + Ok(balance.amount) } /// Converts the amount in dot to btc, based on the current set exchange rate. async fn collateral_to_wrapped(&self, amount: u128, currency_id: CurrencyId) -> Result { - let head = Some(self.get_finalized_block_hash().await?); - let result: BalanceWrapper<_> = self - .api - .rpc() - .request( - "oracle_collateralToWrapped", - rpc_params![BalanceWrapper { amount }, currency_id, head], - ) - .await?; + let head = self.get_finalized_block_hash().await?; + // Create a runtime API payload that calls into + // `Core_version` function. + let runtime_api_call = metadata::apis() + .oracle_api() + .collateral_to_wrapped(BalanceWrapper { amount }, currency_id); - Ok(result.amount) + let result: Result = + self.api.runtime_api().at(head).call(runtime_api_call).await?; + + let balance: BalanceWrapper = result.map_err(|err| { + let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) + .unwrap_or(subxt::error::DispatchError::Other); + Error::SubxtRuntimeError(SubxtError::Runtime(dispatch_error)) + })?; + + Ok(balance.amount) } async fn has_updated(&self, key: &OracleKey) -> Result { @@ -1240,16 +1253,13 @@ impl IssuePallet for InterBtcParachain { &self, account_id: AccountId, ) -> Result, Error> { - let head = Some(self.get_finalized_block_hash().await?); - let result: Vec = self - .api - .rpc() - .request("issue_getVaultIssueRequests", rpc_params![account_id, head]) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis().issue_api().get_vault_issue_requests(account_id); + let result: Vec> = self.api.runtime_api().at(head).call(runtime_api_call).await?; join_all( result .into_iter() - .map(|key| async move { self.get_issue_request(key).await.map(|value| (key, value)) }), + .map(|key| async move { self.get_issue_request(*key).await.map(|value| (*key, value)) }), ) .await .into_iter() @@ -1346,16 +1356,13 @@ impl RedeemPallet for InterBtcParachain { &self, account_id: AccountId, ) -> Result, Error> { - let head = Some(self.get_finalized_block_hash().await?); - let result: Vec = self - .api - .rpc() - .request("redeem_getVaultRedeemRequests", rpc_params![account_id, head]) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis().redeem_api().get_vault_redeem_requests(account_id); + let result: Vec> = self.api.runtime_api().at(head).call(runtime_api_call).await?; join_all( result .into_iter() - .map(|key| async move { self.get_redeem_request(key).await.map(|value| (key, value)) }), + .map(|key| async move { self.get_redeem_request(*key).await.map(|value| (*key, value)) }), ) .await .into_iter() @@ -1470,15 +1477,12 @@ impl BtcRelayPallet for InterBtcParachain { /// check that the block with the given block is included in the main chain of the relay, with sufficient /// confirmations async fn verify_block_header_inclusion(&self, block_hash: H256Le) -> Result<(), Error> { - let head = Some(self.get_finalized_block_hash().await?); - let result: Result<(), metadata::DispatchError> = self - .api - .rpc() - .request( - "btcRelay_verifyBlockHeaderInclusion", - rpc_params![Into::::into(block_hash), head], - ) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .btc_relay_api() + .verify_block_header_inclusion(Into::::into(block_hash).into()); // V15 + let result: Result<(), metadata::DispatchError> = + self.api.runtime_api().at(head).call(runtime_api_call).await?; result.map_err(|err| { let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) @@ -1604,12 +1608,14 @@ impl VaultRegistryPallet for InterBtcParachain { } async fn get_vaults_by_account_id(&self, account_id: &AccountId) -> Result, Error> { - let head = Some(self.get_finalized_block_hash().await?); - let result = self - .api - .rpc() - .request("vaultRegistry_getVaultsByAccountId", rpc_params![account_id, head]) - .await?; + let head = self.get_finalized_block_hash().await?; + + let runtime_api_call = metadata::apis() + .vault_registry_api() + .get_vaults_by_account_id(account_id.clone()); + + let result = self.api.runtime_api().at(head).call(runtime_api_call).await?.unwrap(); + Ok(result) } @@ -1707,56 +1713,70 @@ impl VaultRegistryPallet for InterBtcParachain { amount_btc: u128, collateral_currency: CurrencyId, ) -> Result { - let head = Some(self.get_finalized_block_hash().await?); - let result: BalanceWrapper<_> = self - .api - .rpc() - .request( - "vaultRegistry_getRequiredCollateralForWrapped", - rpc_params![BalanceWrapper { amount: amount_btc }, collateral_currency, head], - ) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .vault_registry_api() + .get_required_collateral_for_wrapped(BalanceWrapper { amount: amount_btc }, collateral_currency); // V15 + let result: Result = + self.api.runtime_api().at(head).call(runtime_api_call).await?; - Ok(result.amount) + let balance: BalanceWrapper = result.map_err(|err| { + let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) + .unwrap_or(subxt::error::DispatchError::Other); + Error::SubxtRuntimeError(SubxtError::Runtime(dispatch_error)) + })?; + Ok(balance.amount) } /// Get the amount of collateral required for the given vault to be at the /// current SecureCollateralThreshold with the current exchange rate async fn get_required_collateral_for_vault(&self, vault_id: VaultId) -> Result { - let head = Some(self.get_finalized_block_hash().await?); - let result: BalanceWrapper<_> = self - .api - .rpc() - .request( - "vaultRegistry_getRequiredCollateralForVault", - rpc_params![vault_id, head], - ) - .await?; - Ok(result.amount) + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .vault_registry_api() + .get_required_collateral_for_vault(vault_id); // V15 + let result: Result = + self.api.runtime_api().at(head).call(runtime_api_call).await?; + + let balance: BalanceWrapper = result.map_err(|err| { + let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) + .unwrap_or(subxt::error::DispatchError::Other); + Error::SubxtRuntimeError(SubxtError::Runtime(dispatch_error)) + })?; + Ok(balance.amount) } async fn get_vault_total_collateral(&self, vault_id: VaultId) -> Result { - let head = Some(self.get_finalized_block_hash().await?); - let result: BalanceWrapper<_> = self - .api - .rpc() - .request("vaultRegistry_getVaultTotalCollateral", rpc_params![vault_id, head]) - .await?; + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .vault_registry_api() + .get_vault_total_collateral(vault_id); // V15 + let result: Result = + self.api.runtime_api().at(head).call(runtime_api_call).await?; - Ok(result.amount) + let balance: BalanceWrapper = result.map_err(|err| { + let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) + .unwrap_or(subxt::error::DispatchError::Other); + Error::SubxtRuntimeError(SubxtError::Runtime(dispatch_error)) + })?; + Ok(balance.amount) } async fn get_collateralization_from_vault(&self, vault_id: VaultId, only_issued: bool) -> Result { - let head = Some(self.get_finalized_block_hash().await?); - let result: UnsignedFixedPoint = self - .api - .rpc() - .request( - "vaultRegistry_getCollateralizationFromVault", - rpc_params![vault_id, only_issued, head], - ) - .await?; - Ok(result.into_inner()) + let head = self.get_finalized_block_hash().await?; + let runtime_api_call = metadata::apis() + .vault_registry_api() + .get_collateralization_from_vault(vault_id, only_issued); // V15 + let result: Result, metadata::DispatchError> = + self.api.runtime_api().at(head).call(runtime_api_call).await?; + + let balance: UnsignedFixedPoint = *result.map_err(|err| { + let dispatch_error = subxt::error::DispatchError::decode_from(err.encode(), self.api.metadata()) + .unwrap_or(subxt::error::DispatchError::Other); + Error::SubxtRuntimeError(SubxtError::Runtime(dispatch_error)) + })?; + + Ok(balance.into_inner()) } /// For testing purposes only. Sets the current vault client release. diff --git a/runtime/src/types.rs b/runtime/src/types.rs index edf0f4506..3534843d9 100644 --- a/runtime/src/types.rs +++ b/runtime/src/types.rs @@ -160,6 +160,8 @@ mod metadata_aliases { pub type VaultId = metadata::runtime_types::interbtc_primitives::VaultId; pub type VaultCurrencyPair = metadata::runtime_types::interbtc_primitives::VaultCurrencyPair; + pub type BalanceWrapper = metadata::runtime_types::interbtc_primitives::BalanceWrapper; + #[cfg(feature = "parachain-metadata-interlay")] pub type EncodedCall = metadata::runtime_types::interlay_runtime_parachain::RuntimeCall; #[cfg(feature = "parachain-metadata-kintsugi")] diff --git a/runtime/src/utils/account_id.rs b/runtime/src/utils/account_id.rs index 6ae04ea82..cd8dd5db1 100644 --- a/runtime/src/utils/account_id.rs +++ b/runtime/src/utils/account_id.rs @@ -30,7 +30,7 @@ impl AccountId32 { pub fn to_sp_core_account_id(&self) -> Sp_AccountId32 { let account_id = self.0.clone(); - (*account_id).clone().into() + (*account_id).clone() } } @@ -73,7 +73,7 @@ impl<'de> Deserialize<'de> for AccountId32 { impl From for AccountId32 { fn from(value: sp_runtime::AccountId32) -> Self { - AccountId32(Static(value.into())) + AccountId32(Static(value)) } } impl From for AccountId32 { diff --git a/runtime/src/utils/signer.rs b/runtime/src/utils/signer.rs index e5ec06826..cf5865f3c 100644 --- a/runtime/src/utils/signer.rs +++ b/runtime/src/utils/signer.rs @@ -57,8 +57,8 @@ where Pair: PairT, Pair::Signature: Into, { - fn account_id(&self) -> &T::AccountId { - &self.account_id + fn account_id(&self) -> T::AccountId { + self.account_id.clone() } fn address(&self) -> T::Address { diff --git a/scripts/run_parachain_node_with_specific_target.sh b/scripts/run_parachain_node_with_specific_target.sh new file mode 100644 index 000000000..1a577d017 --- /dev/null +++ b/scripts/run_parachain_node_with_specific_target.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Paste your chain working here +cd /Users/nakul/Desktop/Interlay_Work/node/interbtc + +./target/release/interbtc-parachain --dev --instant-seal \ No newline at end of file diff --git a/scripts/run_parachain_node_with_sudo.sh b/scripts/run_parachain_node_with_sudo.sh new file mode 100644 index 000000000..2c9817bb5 --- /dev/null +++ b/scripts/run_parachain_node_with_sudo.sh @@ -0,0 +1,5 @@ +#!/bin/bash + + +# Start parachain instance +sudo docker compose up -d interbtc \ No newline at end of file diff --git a/test.sh b/test.sh new file mode 100755 index 000000000..fb7f9b9e9 --- /dev/null +++ b/test.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +export RUST_LOG="info,regalloc=warn" +export BITCOIN_RPC_URL="http://127.0.0.1:18443" +export BITCOIN_RPC_USER="rpcuser" +export BITCOIN_RPC_PASS="rpcpassword" +export ELECTRS_URL="http://localhost:3002" +sudo docker-compose up -d bitcoind bitcoin-cli electrs +cargo test --release --features parachain-metadata-kintsugi --features run-test-with-specific-node-target -- --nocapture +lsof -ti :9944 | xargs kill \ No newline at end of file diff --git a/vault/src/cli.rs b/vault/src/cli.rs index f4340e701..87409b6e4 100644 --- a/vault/src/cli.rs +++ b/vault/src/cli.rs @@ -19,18 +19,13 @@ impl FromStr for RestartPolicy { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub enum LoggingFormat { + #[default] Full, Json, } -impl Default for LoggingFormat { - fn default() -> Self { - LoggingFormat::Full - } -} - impl FromStr for LoggingFormat { type Err = String; fn from_str(code: &str) -> Result { diff --git a/vault/src/connection_manager.rs b/vault/src/connection_manager.rs index 63eeffb66..cad7f293f 100644 --- a/vault/src/connection_manager.rs +++ b/vault/src/connection_manager.rs @@ -128,7 +128,7 @@ impl ConnectionManager { match service.start().await { Err(backoff::Error::Permanent(err)) => { tracing::warn!("Disconnected: {}", err); - return Err(err.into()); + return Err(err); } Err(backoff::Error::Transient(err)) => { tracing::warn!("Disconnected: {}", err.to_human()); diff --git a/vault/src/system.rs b/vault/src/system.rs index 24f79745a..6b781e2a7 100644 --- a/vault/src/system.rs +++ b/vault/src/system.rs @@ -568,9 +568,7 @@ impl VaultService { } async fn run_service(&self) -> Result<(), BackoffError> { - self.validate_bitcoin_network() - .await - .map_err(|err| BackoffError::Permanent(err))?; + self.validate_bitcoin_network().await.map_err(BackoffError::Permanent)?; let account_id = self.btc_parachain.get_account_id().clone(); let parsed_auto_register = self @@ -594,7 +592,7 @@ impl VaultService { .btc_parachain .get_bitcoin_confirmations() .await - .map_err(|err| Error::RuntimeError(err))?, + .map_err(Error::RuntimeError)?, }; tracing::info!("Using {} bitcoin confirmations", num_confirmations); @@ -669,7 +667,7 @@ impl VaultService { Arc::new(Box::new( OrderedVaultsDelay::new(self.btc_parachain.clone()) .await - .map_err(|err| Error::RuntimeError(err))?, + .map_err(Error::RuntimeError)?, )) };