diff --git a/Cargo.lock b/Cargo.lock index 19a5d3d0..e17e945c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,6 +12,15 @@ dependencies = [ "regex", ] +[[package]] +name = "actor-system-error" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eb5258a94e99e07bab9a07541505f5d02d492c1de06b115b662f1a794ce37b7" +dependencies = [ + "derive_more", +] + [[package]] name = "actor-system-error" version = "1.5.0" @@ -1137,6 +1146,15 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + [[package]] name = "asn1-rs" version = "0.5.2" @@ -1770,14 +1788,31 @@ dependencies = [ name = "bridging_payment" version = "0.1.0" dependencies = [ - "gear-wasm-builder", - "grc20_gateway", - "gstd", + "gbuiltin-eth-bridge", + "git-download", + "gstd 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec", - "primitive-types 0.12.2", + "sails-client-gen 0.3.0", + "sails-rs 0.3.0", "scale-info", ] +[[package]] +name = "bridging_payment_wasm" +version = "0.1.0" +dependencies = [ + "bridging_payment", + "extended_vft_wasm", + "gear-wasm-builder 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtest 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "sails-idl-gen 0.3.0", + "sails-rs 0.3.0", + "scale-info", + "vft-gateway-app", + "vft_gateway_wasm", +] + [[package]] name = "bs58" version = "0.4.0" @@ -1909,6 +1944,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cargo_toml" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" +dependencies = [ + "serde", + "toml 0.8.19", +] + [[package]] name = "cc" version = "1.1.10" @@ -1975,9 +2020,9 @@ dependencies = [ "checkpoint_light_client-io", "circular-buffer", "gbuiltin-bls381", - "gear-wasm-builder", + "gear-wasm-builder 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "getrandom 0.2.15", - "gstd", + "gstd 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal", "lazy_static", "parity-scale-codec", @@ -1995,8 +2040,8 @@ dependencies = [ "ark-scale 0.0.12", "ark-serialize 0.4.2", "ethereum-common", - "gmeta", - "gstd", + "gmeta 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstd 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec", "scale-info", "serde", @@ -2083,6 +2128,32 @@ dependencies = [ "cc", ] +[[package]] +name = "cmd_lib" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718f77610af91e4d648fe9da0150ae58698cbcfb93bf63e764907fbefd56ffe8" +dependencies = [ + "cmd_lib_macros", + "env_logger 0.10.2", + "faccess", + "lazy_static", + "log", + "os_pipe", +] + +[[package]] +name = "cmd_lib_macros" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a80fac05ed12fe97a70b5dfdd910c9b90b53f4de69002c3179e29ac2d066abc" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "colorchoice" version = "1.0.2" @@ -2213,6 +2284,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -2229,6 +2309,25 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core-processor" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2288511615ff82c7c5b076599993689eed5e3cd5949aaddab2d4ed5cc1b33583" +dependencies = [ + "actor-system-error 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-backend 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages-common 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsys", + "log", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "core2" version = "0.4.0" @@ -2796,9 +2895,9 @@ name = "demo-constructor" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gcore", - "gear-wasm-builder", - "gstd", + "gcore 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hex", "parity-scale-codec", ] @@ -2808,8 +2907,8 @@ name = "demo-delayed-sender" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", ] [[package]] @@ -2817,8 +2916,8 @@ name = "demo-init-wait" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", ] [[package]] @@ -2826,8 +2925,8 @@ name = "demo-proxy" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", "scale-info", ] @@ -2837,8 +2936,8 @@ name = "demo-read-big-state" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", ] @@ -2847,8 +2946,8 @@ name = "demo-reserve-gas" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", ] @@ -2857,10 +2956,10 @@ name = "demo-signal-entry" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gcore", - "gear-core", - "gear-wasm-builder", - "gstd", + "gcore 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", ] @@ -2870,9 +2969,9 @@ version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ "futures", - "gcore", - "gear-wasm-builder", - "gstd", + "gcore 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", ] @@ -2979,7 +3078,7 @@ version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ - "convert_case", + "convert_case 0.4.0", "proc-macro2", "quote", "rustc_version 0.4.0", @@ -3041,6 +3140,16 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.3.7" @@ -3220,10 +3329,19 @@ dependencies = [ "digest 0.10.7", "elliptic-curve", "rfc6979", - "signature", + "signature 2.2.0", "spki", ] +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature 1.6.4", +] + [[package]] name = "ed25519" version = "2.2.3" @@ -3231,7 +3349,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", - "signature", + "signature 2.2.0", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519 1.5.3", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -3241,7 +3371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek 4.1.3", - "ed25519", + "ed25519 2.2.3", "rand_core 0.6.4", "serde", "sha2 0.10.8", @@ -3288,6 +3418,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + [[package]] name = "encoding_rs" version = "0.8.34" @@ -3418,6 +3557,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "etc" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b241177c7107d9829286c2ffdc5eee98d992d6356f3515e7f412f988b1a72fd" + [[package]] name = "ethbloom" version = "0.13.0" @@ -3446,7 +3591,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "sp-core", + "sp-core 21.0.0", "thiserror", "tokio", ] @@ -3558,6 +3703,43 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "extended-vft-app" +version = "0.1.0" +source = "git+https://github.com/gear-foundation/standards/?branch=gstd-pinned-v1.5.0#9f4a39db39dec0c88d12701bee05d5d51cb9147a" +dependencies = [ + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "log", + "parity-scale-codec", + "sails-rs 0.2.1", + "scale-info", + "vft-service", +] + +[[package]] +name = "extended_vft_wasm" +version = "0.1.0" +source = "git+https://github.com/gear-foundation/standards/?branch=gstd-pinned-v1.5.0#9f4a39db39dec0c88d12701bee05d5d51cb9147a" +dependencies = [ + "extended-vft-app", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "sails-client-gen 0.2.1", + "sails-idl-gen 0.2.1", + "sails-rs 0.2.1", +] + +[[package]] +name = "faccess" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ae66425802d6a903e268ae1a08b8c38ba143520f227a205edf4e9c7e3e26d5" +dependencies = [ + "bitflags 1.3.2", + "libc", + "winapi", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -3788,20 +3970,20 @@ name = "frame-benchmarking" version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ - "frame-support", - "frame-support-procedural", - "frame-system", + "frame-support 4.0.0-dev", + "frame-support-procedural 4.0.0-dev", + "frame-system 4.0.0-dev", "linregress", "log", "parity-scale-codec", "paste", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-application-crypto 23.0.0", + "sp-core 21.0.0", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-runtime-interface 17.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "sp-storage 13.0.0", @@ -3825,14 +4007,14 @@ version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "frame-election-provider-solution-type", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", + "sp-arithmetic 16.0.0", + "sp-core 21.0.0", "sp-npos-elections", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -3870,36 +4052,71 @@ dependencies = [ "docify", "environmental", "frame-metadata 16.0.0", - "frame-support-procedural", + "frame-support-procedural 4.0.0-dev", "impl-trait-for-tuples", "k256", "log", - "macro_magic", + "macro_magic 0.5.1", "parity-scale-codec", "paste", "scale-info", "serde", "serde_json", "smallvec", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-core-hashing-proc-macro", + "sp-api 4.0.0-dev", + "sp-arithmetic 16.0.0", + "sp-core 21.0.0", + "sp-core-hashing-proc-macro 9.0.0", "sp-debug-derive 8.0.0", "sp-genesis-builder", - "sp-inherents", - "sp-io", - "sp-metadata-ir", - "sp-runtime", - "sp-staking", - "sp-state-machine", + "sp-inherents 4.0.0-dev", + "sp-io 23.0.0", + "sp-metadata-ir 0.1.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", + "sp-runtime 24.0.0", + "sp-staking 4.0.0-dev", + "sp-state-machine 0.28.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-tracing 10.0.0", - "sp-weights", + "sp-tracing 10.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", + "sp-weights 20.0.0", "static_assertions", "tt-call", ] +[[package]] +name = "frame-support" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ab435a28c0b92be45e871a20faae7307a5f1153168aed11076892511b97332" +dependencies = [ + "bitflags 1.3.2", + "environmental", + "frame-metadata 16.0.0", + "frame-support-procedural 17.0.0", + "impl-trait-for-tuples", + "k256", + "log", + "macro_magic 0.4.2", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "smallvec", + "sp-api 20.0.0", + "sp-arithmetic 17.0.0", + "sp-core 22.0.0", + "sp-core-hashing-proc-macro 10.0.0", + "sp-debug-derive 9.0.0", + "sp-inherents 20.0.0", + "sp-io 24.0.0", + "sp-runtime 25.0.0", + "sp-staking 20.0.0", + "sp-state-machine 0.29.0", + "sp-std 9.0.0", + "sp-tracing 11.0.0", + "sp-weights 21.0.0", + "tt-call", +] + [[package]] name = "frame-support-procedural" version = "4.0.0-dev" @@ -3909,22 +4126,54 @@ dependencies = [ "cfg-expr", "derive-syn-parse 0.1.5", "expander", - "frame-support-procedural-tools", + "frame-support-procedural-tools 4.0.0-dev", "itertools 0.10.5", - "macro_magic", - "proc-macro-warning", + "macro_magic 0.5.1", + "proc-macro-warning 1.0.2", "proc-macro2", "quote", "sp-core-hashing 9.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "syn 2.0.74", ] +[[package]] +name = "frame-support-procedural" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3515d87fdbf82fa3e5a03b4318ee897c3b2adda928625146dd7d33d52bc2978" +dependencies = [ + "Inflector", + "cfg-expr", + "derive-syn-parse 0.1.5", + "expander", + "frame-support-procedural-tools 6.0.0", + "itertools 0.10.5", + "macro_magic 0.4.2", + "proc-macro-warning 0.4.2", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ - "frame-support-procedural-tools-derive", + "frame-support-procedural-tools-derive 3.0.0", + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "072beafb884cd1c046188c64d593cacb6860314f50478a3713438cc56bee42de" +dependencies = [ + "frame-support-procedural-tools-derive 7.0.0", "proc-macro-crate 1.1.3", "proc-macro2", "quote", @@ -3941,23 +4190,54 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "frame-support-procedural-tools-derive" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3562da4b7b8e24189036c58d459b260e10c8b7af2dd180b7869ae29bb66277" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "frame-system" version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "cfg-if", - "frame-support", + "frame-support 4.0.0-dev", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 21.0.0", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-version", - "sp-weights", + "sp-version 22.0.0", + "sp-weights 20.0.0", +] + +[[package]] +name = "frame-system" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c5104921b9e4e8ffee5251caf7d28defa4e97080554b0e57f93a72b1ec8b915" +dependencies = [ + "cfg-if", + "frame-support 22.0.0", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 22.0.0", + "sp-io 24.0.0", + "sp-runtime 25.0.0", + "sp-std 9.0.0", + "sp-version 23.0.0", + "sp-weights 21.0.0", ] [[package]] @@ -4125,6 +4405,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "galloc" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7021443741e4bfcd99d37fa6c321b205d7c696b2084fd3e10cf79f89fda6a48" +dependencies = [ + "gear-dlmalloc", +] + [[package]] name = "galloc" version = "1.5.0" @@ -4152,7 +4441,7 @@ name = "gbuiltin-eth-bridge" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gprimitives", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", "scale-info", ] @@ -4163,10 +4452,32 @@ version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ "derive_more", - "gprimitives", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "scale-info", ] +[[package]] +name = "gclient" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8976c82b9a942921aad9829bd434f066fb7af5c0ec08f9840e9f57d6a05eb86" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-node-wrapper 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-utils 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsdk 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex", + "parity-scale-codec", + "subxt", + "thiserror", + "url", + "wabt", +] + [[package]] name = "gclient" version = "1.5.0" @@ -4175,11 +4486,11 @@ dependencies = [ "anyhow", "async-trait", "futures", - "gear-core", - "gear-core-errors", - "gear-node-wrapper", - "gear-utils", - "gsdk", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-node-wrapper 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-utils 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gsdk 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hex", "parity-scale-codec", "subxt", @@ -4188,18 +4499,54 @@ dependencies = [ "wabt", ] +[[package]] +name = "gcore" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0bdb11c2fe9c5e92615a7ea4b188408bfbe557c47809c7adeefc018efdf707d" +dependencies = [ + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-stack-buffer 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gprimitives 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsys", + "parity-scale-codec", +] + [[package]] name = "gcore" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-core-errors", - "gear-stack-buffer", - "gprimitives", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-stack-buffer 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gsys", "parity-scale-codec", ] +[[package]] +name = "gear-common" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a409f727f630385f9bf74311855b2e0799995bba51cda69ef235d42240974e34" +dependencies = [ + "derive_more", + "enum-iterator 1.5.0", + "frame-support 22.0.0", + "frame-system 22.0.0", + "gear-common-codegen 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsys", + "log", + "primitive-types 0.12.2", + "sp-arithmetic 17.0.0", + "sp-core 22.0.0", + "sp-io 24.0.0", + "sp-runtime 25.0.0", + "sp-std 9.0.0", +] + [[package]] name = "gear-common" version = "1.5.0" @@ -4207,21 +4554,31 @@ source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3 dependencies = [ "derive_more", "enum-iterator 1.5.0", - "frame-support", - "frame-system", - "gear-common-codegen", - "gear-core", - "gear-wasm-instrument", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "gear-common-codegen 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gsys", "log", "primitive-types 0.12.2", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", + "sp-arithmetic 16.0.0", + "sp-core 21.0.0", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] +[[package]] +name = "gear-common-codegen" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16bb9f537b64855446386f8c4cb86ecba2b64425e142a16663eca8bf97aa783e" +dependencies = [ + "quote", + "syn 2.0.74", +] + [[package]] name = "gear-common-codegen" version = "1.5.0" @@ -4234,21 +4591,22 @@ dependencies = [ [[package]] name = "gear-core" version = "1.5.0" -source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c68bf85cb337a1e7fbe0042318114f00a5868b2a803e34eb693f415558c19f7" dependencies = [ "blake2", "byteorder", "derive_more", "enum-iterator 1.5.0", - "gear-core-errors", - "gear-wasm-instrument", - "gprimitives", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gprimitives 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "gsys", "hashbrown 0.14.5", "hex", "log", "num-traits", - "numerated", + "numerated 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec", "paste", "primitive-types 0.12.2", @@ -4258,25 +4616,83 @@ dependencies = [ ] [[package]] -name = "gear-core-backend" +name = "gear-core" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "actor-system-error", "blake2", + "byteorder", "derive_more", - "gear-core", - "gear-core-errors", - "gear-lazy-pages-common", - "gear-sandbox", - "gear-sandbox-env", - "gear-wasm-instrument", + "enum-iterator 1.5.0", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gsys", + "hashbrown 0.14.5", + "hex", "log", + "num-traits", + "numerated 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", -] - -[[package]] + "paste", + "primitive-types 0.12.2", + "scale-info", + "serde", + "wasmparser-nostd", +] + +[[package]] +name = "gear-core-backend" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c195e4130570329dd79a50bac136611561797bf482aed026ce8764f980ae60" +dependencies = [ + "actor-system-error 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2", + "derive_more", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages-common 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-sandbox 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-sandbox-env 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsys", + "log", + "parity-scale-codec", +] + +[[package]] +name = "gear-core-backend" +version = "1.5.0" +source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +dependencies = [ + "actor-system-error 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "blake2", + "derive_more", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-sandbox 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-sandbox-env 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gsys", + "log", + "parity-scale-codec", +] + +[[package]] +name = "gear-core-errors" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a77d479f7b3d05e9a071990f9c593af793dc7bbb2f2f6bd6f3f390c996ffe8b" +dependencies = [ + "derive_more", + "enum-iterator 1.5.0", + "scale-info", + "serde", +] + +[[package]] name = "gear-core-errors" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" @@ -4292,13 +4708,13 @@ name = "gear-core-processor" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "actor-system-error", + "actor-system-error 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "derive_more", - "gear-core", - "gear-core-backend", - "gear-core-errors", - "gear-lazy-pages-common", - "gear-wasm-instrument", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-backend 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gsys", "log", "parity-scale-codec", @@ -4318,6 +4734,28 @@ dependencies = [ "str-buf", ] +[[package]] +name = "gear-lazy-pages" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c0fafc7d13b103247457b167d5e01a7710fb64f37a8a6e229b641c2cd306b1d" +dependencies = [ + "cfg-if", + "derive_more", + "errno", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages-common 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-sandbox-host 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", + "mach", + "nix 0.26.4", + "numerated 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "region", + "sp-wasm-interface-common 15.0.0", + "winapi", +] + [[package]] name = "gear-lazy-pages" version = "1.5.0" @@ -4326,25 +4764,36 @@ dependencies = [ "cfg-if", "derive_more", "errno", - "gear-core", - "gear-lazy-pages-common", - "gear-sandbox-host", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-sandbox-host 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "libc", "log", "mach", "nix 0.26.4", - "numerated", + "numerated 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "region", - "sp-wasm-interface-common", + "sp-wasm-interface-common 7.0.0", "winapi", ] +[[package]] +name = "gear-lazy-pages-common" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e24529e9096ecfe329c2beed807e8f4edceb0a398f1db08ba9295fafe1342c" +dependencies = [ + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_enum 0.6.1", + "parity-scale-codec", +] + [[package]] name = "gear-lazy-pages-common" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-core", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "num_enum 0.6.1", "parity-scale-codec", ] @@ -4355,13 +4804,48 @@ version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ "byteorder", - "gear-core", - "gear-lazy-pages-common", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gear-runtime-interface", "log", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] +[[package]] +name = "gear-lazy-pages-native-interface" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8b5fe33f33a1e63d11f8191738c1aab5ea850bc717f8b8d71bb80092d233ee" +dependencies = [ + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages-common 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gear-lazy-pages-native-interface" +version = "1.5.0" +source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +dependencies = [ + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", +] + +[[package]] +name = "gear-node-wrapper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f6d65a5b0fe34acfb5aeec131ce0249cb8429415c72f1eee6a9d0f1d206337" +dependencies = [ + "anyhow", + "rand 0.8.5", + "smallvec", + "which", +] + [[package]] name = "gear-node-wrapper" version = "1.5.0" @@ -4391,16 +4875,16 @@ dependencies = [ "anyhow", "blake2", "futures-util", - "gsdk", + "gsdk 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex", "pallet-gear-eth-bridge-rpc-runtime-api", "parity-scale-codec", "primitive-types 0.12.2", "sc-consensus-grandpa", "sp-consensus-grandpa", - "sp-core", - "sp-runtime", - "sp-trie", + "sp-core 21.0.0", + "sp-runtime 24.0.0", + "sp-trie 22.0.0", "subxt", "trie-db 0.28.0", ] @@ -4415,34 +4899,62 @@ dependencies = [ "ark-ff 0.4.2", "ark-scale 0.0.12", "byteorder", - "gear-core", - "gear-lazy-pages", - "gear-lazy-pages-common", - "gear-sandbox-interface", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-sandbox-interface 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "parity-scale-codec", "sha2 0.10.8", - "sp-io", + "sp-io 23.0.0", "sp-runtime-interface 17.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "winapi", ] +[[package]] +name = "gear-sandbox" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a11eada83003e5d51ec0a63ab834161ff0eed9ff98efd774e72095e059d3e9" +dependencies = [ + "gear-sandbox-env 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-sandbox-interface 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gwasmi", + "log", + "parity-scale-codec", + "sp-core 22.0.0", + "sp-std 9.0.0", + "sp-wasm-interface-common 15.0.0", +] + [[package]] name = "gear-sandbox" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-sandbox-env", - "gear-sandbox-interface", + "gear-sandbox-env 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-sandbox-interface 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "parity-scale-codec", - "sp-core", + "sp-core 21.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-wasm-interface-common", + "sp-wasm-interface-common 7.0.0", "wasmi 0.30.0 (git+https://github.com/gear-tech/wasmi?branch=gear-v0.30.0)", ] +[[package]] +name = "gear-sandbox-env" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b8e85693d331cd75effed01ecaeccc6ae28e137e454b020dc341829c9c74e3e" +dependencies = [ + "parity-scale-codec", + "sp-debug-derive 9.0.0", + "sp-std 9.0.0", + "sp-wasm-interface-common 15.0.0", +] + [[package]] name = "gear-sandbox-env" version = "1.5.0" @@ -4451,7 +4963,29 @@ dependencies = [ "parity-scale-codec", "sp-debug-derive 8.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-wasm-interface-common", + "sp-wasm-interface-common 7.0.0", +] + +[[package]] +name = "gear-sandbox-host" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f32c58ae124e317637cbd9061b1025d9af61525edc3d807c19cad60706f6dd42" +dependencies = [ + "defer", + "environmental", + "gear-sandbox-env 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gp-allocator", + "log", + "parity-scale-codec", + "sp-wasm-interface-common 15.0.0", + "tempfile", + "thiserror", + "uluru", + "wasmer", + "wasmer-cache", + "wasmer-types", + "wasmi 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4461,18 +4995,31 @@ source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3 dependencies = [ "defer", "environmental", - "gear-sandbox-env", + "gear-sandbox-env 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "parity-scale-codec", "sp-allocator", - "sp-wasm-interface-common", + "sp-wasm-interface-common 7.0.0", "tempfile", "thiserror", "uluru", "wasmer", "wasmer-cache", "wasmer-types", - "wasmi 0.13.2", + "wasmi 0.13.2 (git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext)", +] + +[[package]] +name = "gear-sandbox-interface" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df54d27cbe4c7778236c788c01fa30072af4f8040f1dfcd864a431402ab61e8" +dependencies = [ + "gear-sandbox-host 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gp-runtime-interface", + "gp-wasm-interface", + "log", + "parity-scale-codec", ] [[package]] @@ -4480,13 +5027,24 @@ name = "gear-sandbox-interface" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-sandbox-host", + "gear-sandbox-host 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "parity-scale-codec", "sp-runtime-interface 17.0.0", "sp-wasm-interface 14.0.0", ] +[[package]] +name = "gear-ss58" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4325383bd3d43aaa5d50b608ed7e5044110b5ccf91df351edb66ee4462f61f1f" +dependencies = [ + "blake2", + "bs58 0.5.1", + "hex", +] + [[package]] name = "gear-ss58" version = "1.5.0" @@ -4497,18 +5055,40 @@ dependencies = [ "hex", ] +[[package]] +name = "gear-stack-buffer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3860391a8c1c273786958b5076a406d0ecd8e73636eb4161a6c3e1ea548ab9b" + [[package]] name = "gear-stack-buffer" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +[[package]] +name = "gear-utils" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca1c5b08aa64916b9719f821ef61f52d262548ec5e5a7d9d42cf6b035fa4e04" +dependencies = [ + "env_logger 0.10.2", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex", + "nonempty", + "parity-scale-codec", + "path-clean", + "serde", + "serde_json", +] + [[package]] name = "gear-utils" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ "env_logger 0.10.2", - "gear-core", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hex", "nonempty", "parity-scale-codec", @@ -4523,6 +5103,31 @@ version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbfbfa701dc65e683fcd2fb24f046bcef22634acbdf47ad14724637dc39ad05b" +[[package]] +name = "gear-wasm-builder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae5fe1f1a0f39747995883565c05f1b39935b83c0f8fb3d9e8a1763c4a83ec60" +dependencies = [ + "anyhow", + "cargo_metadata", + "chrono", + "colored", + "dirs", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-pwasm-utils", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gmeta 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "pathdiff", + "regex", + "rustc_version 0.4.0", + "thiserror", + "toml 0.8.19", + "wasmparser-nostd", + "which", +] + [[package]] name = "gear-wasm-builder" version = "1.5.0" @@ -4533,10 +5138,10 @@ dependencies = [ "chrono", "colored", "dirs", - "gear-core", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gear-pwasm-utils", - "gear-wasm-instrument", - "gmeta", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gmeta 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "pathdiff", "regex", @@ -4547,6 +5152,17 @@ dependencies = [ "which", ] +[[package]] +name = "gear-wasm-instrument" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8446dc4b4dc7a1fc30f1c4bd1a0e7bcee7d5e5f9d1edd1f99d96b73a4ff8cc4" +dependencies = [ + "derive_more", + "enum-iterator 1.5.0", + "gwasm-instrument", +] + [[package]] name = "gear-wasm-instrument" version = "1.5.0" @@ -4561,13 +5177,35 @@ dependencies = [ name = "gear_proof_storage" version = "0.1.0" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstd 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec", "scale-info", "thiserror", ] +[[package]] +name = "genco" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afac3cbb14db69ac9fef9cdb60d8a87e39a7a527f85a81a923436efa40ad42c6" +dependencies = [ + "genco-macros", + "relative-path", + "smallvec", +] + +[[package]] +name = "genco-macros" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553630feadf7b76442b0849fd25fdf89b860d933623aec9693fed19af0400c78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "generic-array" version = "0.12.4" @@ -4660,6 +5298,17 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +[[package]] +name = "git-download" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba2cd47fe34052c31fbaedb953913ef530fd24fdfd8666d7764fb444b15861e7" +dependencies = [ + "anyhow", + "cmd_lib", + "tempfile", +] + [[package]] name = "glob" version = "0.2.11" @@ -4672,6 +5321,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gmeta" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90b03d2f25e0172da8087b074599254d29501cdf6f20e2f62fc7804fad618bea" +dependencies = [ + "blake2", + "derive_more", + "hex", + "scale-info", +] + [[package]] name = "gmeta" version = "1.5.0" @@ -4683,13 +5344,74 @@ dependencies = [ "scale-info", ] +[[package]] +name = "gp-allocator" +version = "4.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93cfb4525b5362966a1971125ff8f9825e6a511403635dccf883273d20c43bdf" +dependencies = [ + "log", + "parity-scale-codec", + "sp-wasm-interface-common 15.0.0", + "thiserror", +] + +[[package]] +name = "gp-runtime-interface" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dfb3786bf8fe51099c67dfe7c9a925fe0bfb78ffe938aa07b598995ee48d0e3" +dependencies = [ + "bytes", + "gp-runtime-interface-proc-macro", + "gp-wasm-interface", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types 0.12.2", + "sp-externalities 0.20.0", + "sp-std 9.0.0", + "sp-storage 14.0.0", + "sp-tracing 10.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions", +] + +[[package]] +name = "gp-runtime-interface-proc-macro" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1e4d907f86db64e8b9d9af0b5adfd59e62b4023fd88511e13d62028ed101f2c" +dependencies = [ + "Inflector", + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "gp-wasm-interface" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de334e40147f969276463ad04d0ddfe519aebb6254832ea0637a300c6d637c11" +dependencies = [ + "anyhow", + "gp-allocator", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 9.0.0", + "sp-wasm-interface-common 15.0.0", + "wasmtime", +] + [[package]] name = "gprimitives" version = "1.5.0" -source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68d4985924d3c23a78cbc70d1bb4f0b01aa3a4ea95609b15434eb1a487dfbb15" dependencies = [ "derive_more", - "gear-ss58", + "gear-ss58 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex", "parity-scale-codec", "primitive-types 0.12.2", @@ -4697,11 +5419,13 @@ dependencies = [ ] [[package]] -name = "grc20_gateway" -version = "0.1.0" +name = "gprimitives" +version = "1.5.0" +source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "derive_more", + "gear-ss58 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "hex", "parity-scale-codec", "primitive-types 0.12.2", "scale-info", @@ -4718,6 +5442,38 @@ dependencies = [ "subtle", ] +[[package]] +name = "gsdk" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8878b48ac8ae1ad6e8ed4be81b34485220cf743e0bf51a8e07b11bd8e1f37d36" +dependencies = [ + "anyhow", + "base64 0.21.7", + "colored", + "futures", + "futures-util", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-utils 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsdk-codegen 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex", + "indexmap 2.3.0", + "jsonrpsee 0.16.3", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "scale-decode", + "scale-value", + "serde", + "serde_json", + "sp-core 22.0.0", + "sp-runtime 25.0.0", + "subxt", + "thiserror", +] + [[package]] name = "gsdk" version = "1.5.0" @@ -4728,10 +5484,10 @@ dependencies = [ "colored", "futures", "futures-util", - "gear-core", - "gear-core-errors", - "gear-utils", - "gsdk-codegen", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-utils 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gsdk-codegen 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hex", "indexmap 2.3.0", "jsonrpsee 0.16.3", @@ -4743,12 +5499,23 @@ dependencies = [ "scale-value", "serde", "serde_json", - "sp-core", - "sp-runtime", + "sp-core 21.0.0", + "sp-runtime 24.0.0", "subxt", "thiserror", ] +[[package]] +name = "gsdk-codegen" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88249fd15fb5fd9dd00c5037cc8afd41a57d93a7fcdc2b004f346b1070617ded" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "gsdk-codegen" version = "1.5.0" @@ -4759,6 +5526,25 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "gstd" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1d0f71187a65f4af14b03ceb0d5b0c1de87174ba77478496cc5bd744d096200" +dependencies = [ + "arrayvec 0.7.4", + "const_format", + "futures", + "galloc 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gcore 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstd-codegen 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hashbrown 0.14.5", + "hex", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "gstd" version = "1.5.0" @@ -4767,22 +5553,34 @@ dependencies = [ "arrayvec 0.7.4", "const_format", "futures", - "galloc", - "gcore", - "gear-core-errors", - "gstd-codegen", + "galloc 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gcore 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd-codegen 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hashbrown 0.14.5", "hex", "parity-scale-codec", "scale-info", ] +[[package]] +name = "gstd-codegen" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c89587bbe369ed78ae2b228a4ac4a92349946cd5305dbb9b8b321c2e85bb452" +dependencies = [ + "gprimitives 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "gstd-codegen" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gprimitives", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "proc-macro2", "quote", "syn 2.0.74", @@ -4793,6 +5591,63 @@ name = "gsys" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +[[package]] +name = "gtest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ef2bae5647ecdc875ac90b8c6ac1d4549041b10149bb7af37a6f4403242e1a" +dependencies = [ + "cargo_toml", + "colored", + "core-processor", + "derive_more", + "env_logger 0.10.2", + "etc", + "gear-common 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages-common 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-lazy-pages-native-interface 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-utils 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-instrument 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gsys", + "hex", + "indexmap 2.3.0", + "log", + "parity-scale-codec", + "path-clean", + "rand 0.8.5", +] + +[[package]] +name = "gtest" +version = "1.5.0" +source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" +dependencies = [ + "cargo_toml", + "colored", + "derive_more", + "env_logger 0.10.2", + "etc", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-processor", + "gear-lazy-pages 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-lazy-pages-native-interface 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-utils 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gsys", + "hex", + "indexmap 2.3.0", + "log", + "parity-scale-codec", + "path-clean", + "rand 0.8.5", +] + [[package]] name = "gwasm-instrument" version = "0.3.0" @@ -4802,6 +5657,33 @@ dependencies = [ "gear-wasm", ] +[[package]] +name = "gwasmi" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "540bef71ad072d770140dc3f47f6bcc2b2b0492aa6a3ff236a13a7cd9427c58b" +dependencies = [ + "gwasmi_core", + "intx", + "smallvec", + "spin 0.9.8", + "wasmi_arena 0.4.1", + "wasmparser-nostd", +] + +[[package]] +name = "gwasmi_core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47443d9a0eaa456c80525cebb42178fc47690fee77f9729eeece6ff70906fdcf" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", + "region", +] + [[package]] name = "h2" version = "0.3.26" @@ -4827,6 +5709,20 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" +[[package]] +name = "handlebars" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -5753,9 +6649,39 @@ dependencies = [ name = "kvdb" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d770dcb02bf6835887c3a979b5107a04ff4bbde97a5f0928d27404a155add9" +checksum = "e7d770dcb02bf6835887c3a979b5107a04ff4bbde97a5f0928d27404a155add9" +dependencies = [ + "smallvec", +] + +[[package]] +name = "lalrpop" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" +dependencies = [ + "ascii-canvas", + "bit-set", + "ena", + "itertools 0.11.0", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.8.4", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", + "walkdir", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" dependencies = [ - "smallvec", + "regex-automata 0.4.7", ] [[package]] @@ -5922,7 +6848,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "276bb57e7af15d8f100d3c11cbdd32c6752b7eef4ba7a18ecf464972c07abcce" dependencies = [ "bs58 0.4.0", - "ed25519-dalek", + "ed25519-dalek 2.1.1", "log", "multiaddr", "multihash", @@ -6321,6 +7247,38 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "logos" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-codegen" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax 0.6.29", + "syn 2.0.74", +] + +[[package]] +name = "logos-derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" +dependencies = [ + "logos-codegen", +] + [[package]] name = "lru" version = "0.10.1" @@ -6366,14 +7324,40 @@ dependencies = [ "libc", ] +[[package]] +name = "macro_magic" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" +dependencies = [ + "macro_magic_core 0.4.2", + "macro_magic_macros 0.4.2", + "quote", + "syn 2.0.74", +] + [[package]] name = "macro_magic" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc33f9f0351468d26fbc53d9ce00a096c8522ecb42f19b50f34f2c422f76d21d" dependencies = [ - "macro_magic_core", - "macro_magic_macros", + "macro_magic_core 0.5.1", + "macro_magic_macros 0.5.1", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "macro_magic_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" +dependencies = [ + "const-random", + "derive-syn-parse 0.1.5", + "macro_magic_core_macros 0.4.3", + "proc-macro2", "quote", "syn 2.0.74", ] @@ -6386,7 +7370,18 @@ checksum = "1687dc887e42f352865a393acae7cf79d98fab6351cde1f58e9e057da89bf150" dependencies = [ "const-random", "derive-syn-parse 0.2.0", - "macro_magic_core_macros", + "macro_magic_core_macros 0.5.1", + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "macro_magic_core_macros" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" +dependencies = [ "proc-macro2", "quote", "syn 2.0.74", @@ -6403,13 +7398,24 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "macro_magic_macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" +dependencies = [ + "macro_magic_core 0.4.2", + "quote", + "syn 2.0.74", +] + [[package]] name = "macro_magic_macros" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73ea28ee64b88876bf45277ed9a5817c1817df061a74f2b988971a12570e5869" dependencies = [ - "macro_magic_core", + "macro_magic_core 0.5.1", "quote", "syn 2.0.74", ] @@ -6821,6 +7827,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nix" version = "0.24.3" @@ -7051,6 +8063,18 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "numerated" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef64a6c05dfdaec4c4b01f22d618c5dec9ec3f6a6611076d2d7b3fb63549f356" +dependencies = [ + "derive_more", + "num-traits", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "numerated" version = "1.5.0" @@ -7154,6 +8178,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "os_pipe" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "overload" version = "0.1.1" @@ -7175,12 +8209,12 @@ name = "pallet-authorship" version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7190,12 +8224,12 @@ version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "frame-benchmarking", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log", "parity-scale-codec", "scale-info", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7215,17 +8249,17 @@ dependencies = [ "derive_more", "env_logger 0.10.2", "frame-benchmarking", - "frame-support", - "frame-system", - "gear-common", - "gear-core", - "gear-core-backend", - "gear-core-errors", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-backend 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gear-core-processor", - "gear-lazy-pages-common", + "gear-lazy-pages-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gear-lazy-pages-interface", "gear-runtime-interface", - "gear-wasm-instrument", + "gear-wasm-instrument 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "pallet-authorship", "pallet-balances", @@ -7240,10 +8274,10 @@ dependencies = [ "scopeguard", "serde", "sp-consensus-babe", - "sp-core", + "sp-core 21.0.0", "sp-externalities 0.19.0", - "sp-io", - "sp-runtime", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "test-syscalls", ] @@ -7253,14 +8287,14 @@ name = "pallet-gear-bank" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "frame-support", - "frame-system", - "gear-common", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "pallet-authorship", "parity-scale-codec", "scale-info", - "sp-runtime", + "sp-runtime 24.0.0", ] [[package]] @@ -7276,13 +8310,13 @@ dependencies = [ "ark-std 0.4.0", "derive_more", "frame-benchmarking", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "gbuiltin-bls381", "gbuiltin-staking", - "gear-common", - "gear-core", - "gear-core-errors", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "gear-core-processor", "gear-runtime-interface", "impl-trait-for-tuples", @@ -7293,7 +8327,7 @@ dependencies = [ "primitive-types 0.12.2", "scale-info", "sp-crypto-ec-utils 0.4.1", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7303,19 +8337,19 @@ version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ "binary-merkle-tree", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "gbuiltin-eth-bridge", - "gear-common", - "gear-core", - "gprimitives", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "log", "pallet-gear-builtin", "parity-scale-codec", "scale-info", "serde", "sp-consensus-grandpa", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7325,8 +8359,8 @@ version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ "pallet-gear-eth-bridge", - "sp-api", - "sp-core", + "sp-api 4.0.0-dev", + "sp-core 21.0.0", ] [[package]] @@ -7344,10 +8378,10 @@ name = "pallet-gear-program" version = "1.5.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "frame-support", - "frame-system", - "gear-common", - "gear-core", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hashbrown 0.14.5", "log", "pallet-balances", @@ -7355,9 +8389,9 @@ dependencies = [ "parity-scale-codec", "primitive-types 0.12.2", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 21.0.0", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7368,18 +8402,18 @@ source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3 dependencies = [ "derive_more", "frame-benchmarking", - "frame-support", - "frame-system", - "gear-common", - "gear-core", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "gear-common 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "hex", "log", "pallet-balances", "parity-scale-codec", "primitive-types 0.12.2", "scale-info", - "sp-io", - "sp-runtime", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7388,21 +8422,21 @@ name = "pallet-session" version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "impl-trait-for-tuples", "log", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 21.0.0", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-session", - "sp-staking", - "sp-state-machine", + "sp-staking 4.0.0-dev", + "sp-state-machine 0.28.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-trie", + "sp-trie 22.0.0", ] [[package]] @@ -7412,18 +8446,18 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log", "pallet-authorship", "pallet-session", "parity-scale-codec", "scale-info", "serde", - "sp-application-crypto", - "sp-io", - "sp-runtime", - "sp-staking", + "sp-application-crypto 23.0.0", + "sp-io 23.0.0", + "sp-runtime 24.0.0", + "sp-staking 4.0.0-dev", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7434,14 +8468,14 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "docify", "frame-benchmarking", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log", "parity-scale-codec", "scale-info", - "sp-inherents", - "sp-io", - "sp-runtime", + "sp-inherents 4.0.0-dev", + "sp-io 23.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "sp-storage 13.0.0", "sp-timestamp", @@ -7453,13 +8487,13 @@ version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "docify", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "impl-trait-for-tuples", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -7619,6 +8653,15 @@ dependencies = [ "crypto-mac 0.11.1", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "pbkdf2" version = "0.12.2" @@ -7654,6 +8697,40 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pest_derive" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "pest_meta" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.8", +] + [[package]] name = "petgraph" version = "0.6.5" @@ -7664,6 +8741,15 @@ dependencies = [ "indexmap 2.3.0", ] +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.5" @@ -7975,6 +9061,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "predicates" version = "2.1.5" @@ -8102,6 +9194,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-warning" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "proc-macro-warning" version = "1.0.2" @@ -8260,8 +9363,8 @@ dependencies = [ "rayon", "serde", "serde_json", - "sp-core", - "sp-trie", + "sp-core 21.0.0", + "sp-trie 22.0.0", "static_assertions", "trie-db 0.28.0", "unroll", @@ -8615,6 +9718,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "relative-path" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" + [[package]] name = "relayer" version = "0.1.0" @@ -8630,8 +9739,8 @@ dependencies = [ "dotenv", "ethereum-client", "futures", - "gclient", - "gear-core", + "gclient 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "gear-rpc-client", "gear_proof_storage", "hex", @@ -9096,29 +10205,196 @@ dependencies = [ ] [[package]] -name = "rw-stream-sink" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" +name = "rw-stream-sink" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "safe_arch" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3460605018fdc9612bce72735cba0d27efbcd9904780d44c7e3a9948f96148a" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "sails-client-gen" +version = "0.2.1" +source = "git+https://github.com/gear-tech/sails.git?branch=gstd-pinned-v1.5.0#31c8c8a3378ac02b725b0ea6110ab1d7cc5fb7ef" +dependencies = [ + "anyhow", + "convert_case 0.6.0", + "genco", + "parity-scale-codec", + "sails-idl-parser 0.2.1", +] + +[[package]] +name = "sails-client-gen" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e49447619b6576fa0c6ced2fb976db38f6afd310feaf1c28463e49edb59e024" +dependencies = [ + "anyhow", + "convert_case 0.6.0", + "genco", + "parity-scale-codec", + "sails-idl-parser 0.3.0", +] + +[[package]] +name = "sails-idl-gen" +version = "0.2.1" +source = "git+https://github.com/gear-tech/sails.git?branch=gstd-pinned-v1.5.0#31c8c8a3378ac02b725b0ea6110ab1d7cc5fb7ef" +dependencies = [ + "convert_case 0.6.0", + "handlebars", + "sails-rs 0.2.1", + "scale-info", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "sails-idl-gen" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a48bea35405dcd6561547353a7f96bd13ee880c758c3e1e70cdd6c62a7b43c48" +dependencies = [ + "convert_case 0.6.0", + "handlebars", + "sails-rs 0.3.0", + "scale-info", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "sails-idl-parser" +version = "0.2.1" +source = "git+https://github.com/gear-tech/sails.git?branch=gstd-pinned-v1.5.0#31c8c8a3378ac02b725b0ea6110ab1d7cc5fb7ef" +dependencies = [ + "lalrpop", + "lalrpop-util", + "logos", + "thiserror", +] + +[[package]] +name = "sails-idl-parser" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabeb783688efdc0bfd7682af969b3c08ca9d67c413f40e5908078ec786279d8" +dependencies = [ + "lalrpop", + "lalrpop-util", + "logos", + "thiserror", +] + +[[package]] +name = "sails-macros" +version = "0.2.1" +source = "git+https://github.com/gear-tech/sails.git?branch=gstd-pinned-v1.5.0#31c8c8a3378ac02b725b0ea6110ab1d7cc5fb7ef" +dependencies = [ + "proc-macro-error", + "sails-macros-core 0.2.1", +] + +[[package]] +name = "sails-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78019e937cf73fc92b2d4d7ed742090f23f8edff55dfc955eae028862ad61f03" +dependencies = [ + "proc-macro-error", + "sails-macros-core 0.3.0", +] + +[[package]] +name = "sails-macros-core" +version = "0.2.1" +source = "git+https://github.com/gear-tech/sails.git?branch=gstd-pinned-v1.5.0#31c8c8a3378ac02b725b0ea6110ab1d7cc5fb7ef" +dependencies = [ + "convert_case 0.6.0", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "sails-macros-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db0e8b6eefb878db2d1b72a560ae0105e9443d833c8a76a85972b4cfff49b848" +dependencies = [ + "convert_case 0.6.0", + "parity-scale-codec", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "sails-rs" +version = "0.2.1" +source = "git+https://github.com/gear-tech/sails.git?branch=gstd-pinned-v1.5.0#31c8c8a3378ac02b725b0ea6110ab1d7cc5fb7ef" dependencies = [ "futures", - "pin-project", - "static_assertions", + "gclient 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-core-errors 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gprimitives 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gtest 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "hashbrown 0.14.5", + "hex", + "parity-scale-codec", + "primitive-types 0.12.2", + "sails-macros 0.2.1", + "scale-info", + "spin 0.9.8", + "thiserror-no-std", ] [[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "safe_arch" -version = "0.7.2" +name = "sails-rs" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3460605018fdc9612bce72735cba0d27efbcd9904780d44c7e3a9948f96148a" +checksum = "5d97e1450bd5787a320cbbaecebe12e3143f868fc44d77e78663c88442a742bd" dependencies = [ - "bytemuck", + "futures", + "gclient 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core-errors 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gprimitives 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstd 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtest 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hashbrown 0.14.5", + "hex", + "parity-scale-codec", + "primitive-types 0.12.2", + "sails-macros 0.3.0", + "scale-info", + "spin 0.9.8", + "thiserror-no-std", ] [[package]] @@ -9136,12 +10412,12 @@ version = "0.10.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "parity-scale-codec", - "sp-api", + "sp-api 4.0.0-dev", "sp-block-builder", "sp-blockchain", - "sp-core", - "sp-inherents", - "sp-runtime", + "sp-core 21.0.0", + "sp-inherents 4.0.0-dev", + "sp-runtime 24.0.0", ] [[package]] @@ -9162,11 +10438,11 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core", + "sp-core 21.0.0", "sp-genesis-builder", - "sp-io", - "sp-runtime", - "sp-state-machine", + "sp-io 23.0.0", + "sp-runtime 24.0.0", + "sp-state-machine 0.28.0", ] [[package]] @@ -9193,17 +10469,17 @@ dependencies = [ "sc-executor", "sc-transaction-pool-api", "sc-utils", - "sp-api", + "sp-api 4.0.0-dev", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 21.0.0", "sp-database", "sp-externalities 0.19.0", - "sp-runtime", - "sp-state-machine", + "sp-runtime 24.0.0", + "sp-state-machine 0.28.0", "sp-statement-store", "sp-storage 13.0.0", - "sp-trie", + "sp-trie 22.0.0", "substrate-prometheus-endpoint", ] @@ -9222,12 +10498,12 @@ dependencies = [ "sc-client-api", "sc-utils", "serde", - "sp-api", + "sp-api 4.0.0-dev", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", + "sp-core 21.0.0", + "sp-runtime 24.0.0", + "sp-state-machine 0.28.0", "substrate-prometheus-endpoint", "thiserror", ] @@ -9261,15 +10537,15 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", + "sp-api 4.0.0-dev", + "sp-application-crypto 23.0.0", + "sp-arithmetic 16.0.0", "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", - "sp-core", - "sp-keystore", - "sp-runtime", + "sp-core 21.0.0", + "sp-keystore 0.27.0", + "sp-runtime 24.0.0", "substrate-prometheus-endpoint", "thiserror", ] @@ -9284,17 +10560,17 @@ dependencies = [ "sc-executor-common", "sc-executor-wasmtime", "schnellru", - "sp-api", - "sp-core", + "sp-api 4.0.0-dev", + "sp-core 21.0.0", "sp-externalities 0.19.0", - "sp-io", - "sp-panic-handler", + "sp-io 23.0.0", + "sp-panic-handler 8.0.0", "sp-runtime-interface 17.0.0", - "sp-trie", - "sp-version", + "sp-trie 22.0.0", + "sp-version 22.0.0", "sp-wasm-interface 14.0.0", "tracing", - "wasmi 0.13.2", + "wasmi 0.13.2 (git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext)", ] [[package]] @@ -9357,10 +10633,10 @@ dependencies = [ "serde", "serde_json", "smallvec", - "sp-arithmetic", + "sp-arithmetic 16.0.0", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 21.0.0", + "sp-runtime 24.0.0", "substrate-prometheus-endpoint", "thiserror", "unsigned-varint", @@ -9382,7 +10658,7 @@ dependencies = [ "sc-consensus", "sp-consensus", "sp-consensus-grandpa", - "sp-runtime", + "sp-runtime 24.0.0", ] [[package]] @@ -9399,7 +10675,7 @@ dependencies = [ "sc-network-common", "sc-network-sync", "schnellru", - "sp-runtime", + "sp-runtime 24.0.0", "substrate-prometheus-endpoint", "tracing", ] @@ -9428,12 +10704,12 @@ dependencies = [ "sc-utils", "schnellru", "smallvec", - "sp-arithmetic", + "sp-arithmetic 16.0.0", "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", - "sp-core", - "sp-runtime", + "sp-core 21.0.0", + "sp-runtime 24.0.0", "substrate-prometheus-endpoint", "thiserror", "tokio", @@ -9470,8 +10746,8 @@ dependencies = [ "parity-scale-codec", "serde", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 21.0.0", + "sp-runtime 24.0.0", "thiserror", ] @@ -9487,7 +10763,7 @@ dependencies = [ "log", "parking_lot 0.12.3", "prometheus", - "sp-arithmetic", + "sp-arithmetic 16.0.0", ] [[package]] @@ -10023,6 +11299,12 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + [[package]] name = "signature" version = "2.2.0" @@ -10237,7 +11519,7 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "log", "parity-scale-codec", - "sp-wasm-interface-common", + "sp-wasm-interface-common 7.0.0", "thiserror", ] @@ -10250,15 +11532,37 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "sp-api-proc-macro", - "sp-core", + "sp-api-proc-macro 4.0.0-dev", + "sp-core 21.0.0", "sp-externalities 0.19.0", - "sp-metadata-ir", - "sp-runtime", - "sp-state-machine", + "sp-metadata-ir 0.1.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", + "sp-runtime 24.0.0", + "sp-state-machine 0.28.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-trie", - "sp-version", + "sp-trie 22.0.0", + "sp-version 22.0.0", + "thiserror", +] + +[[package]] +name = "sp-api" +version = "20.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa63dcdd3fb081a894189f83115dd683be1339a919cd7d3f98f145d1870626c" +dependencies = [ + "hash-db 0.16.0", + "log", + "parity-scale-codec", + "scale-info", + "sp-api-proc-macro 9.0.0", + "sp-core 22.0.0", + "sp-externalities 0.20.0", + "sp-metadata-ir 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 25.0.0", + "sp-state-machine 0.29.0", + "sp-std 9.0.0", + "sp-trie 23.0.0", + "sp-version 23.0.0", "thiserror", ] @@ -10276,6 +11580,21 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "sp-api-proc-macro" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a062dfff051064bfa1837566b74d00a49050b36e3887b2283ab667cef4f3a85e" +dependencies = [ + "Inflector", + "blake2", + "expander", + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "sp-application-crypto" version = "23.0.0" @@ -10284,11 +11603,25 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", + "sp-core 21.0.0", + "sp-io 23.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] +[[package]] +name = "sp-application-crypto" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b49d62089ef6fdd52a6f90f670d533ccb365235258cf517dbd5bd571febcfbd" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 22.0.0", + "sp-io 24.0.0", + "sp-std 9.0.0", +] + [[package]] name = "sp-arithmetic" version = "16.0.0" @@ -10303,6 +11636,21 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "sp-arithmetic" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0241327405688cac3fcc29114fd35f99224e321daa37e19920e50e4b2fdd0645" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-std 9.0.0", + "static_assertions", +] + [[package]] name = "sp-ark-bls12-381" version = "0.4.2" @@ -10326,9 +11674,9 @@ name = "sp-block-builder" version = "4.0.0-dev" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ - "sp-api", - "sp-inherents", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -10342,11 +11690,11 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", "schnellru", - "sp-api", + "sp-api 4.0.0-dev", "sp-consensus", "sp-database", - "sp-runtime", - "sp-state-machine", + "sp-runtime 24.0.0", + "sp-state-machine 0.28.0", "thiserror", ] @@ -10358,10 +11706,10 @@ dependencies = [ "async-trait", "futures", "log", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "sp-core 21.0.0", + "sp-inherents 4.0.0-dev", + "sp-runtime 24.0.0", + "sp-state-machine 0.28.0", "thiserror", ] @@ -10374,12 +11722,12 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto", + "sp-api 4.0.0-dev", + "sp-application-crypto 23.0.0", "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-runtime", + "sp-core 21.0.0", + "sp-inherents 4.0.0-dev", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "sp-timestamp", ] @@ -10394,11 +11742,11 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-application-crypto 23.0.0", + "sp-core 21.0.0", + "sp-keystore 0.27.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -10463,6 +11811,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "sp-core" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de478e02efd547693b33ad02515e09933d5b69b7f3036fa890b92e50fd9dfc" +dependencies = [ + "array-bytes", + "bitflags 1.3.2", + "blake2", + "bounded-collections", + "bs58 0.4.0", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db 0.16.0", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin 2.0.1", + "parity-scale-codec", + "parking_lot 0.12.3", + "paste", + "primitive-types 0.12.2", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel 0.9.1", + "secp256k1", + "secrecy", + "serde", + "sp-core-hashing 10.0.0", + "sp-debug-derive 9.0.0", + "sp-externalities 0.20.0", + "sp-runtime-interface 18.0.0", + "sp-std 9.0.0", + "sp-storage 14.0.0", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "tracing", + "zeroize", +] + [[package]] name = "sp-core-hashing" version = "9.0.0" @@ -10491,6 +11885,20 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "sp-core-hashing" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e360755a2706a76886d58776665cad0db793dece3c7d390455b28e8a1efd6285" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" @@ -10501,6 +11909,17 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "sp-core-hashing-proc-macro" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc707d9f5bf155d584900783e328cb3dc79c950f898a18a8f24066f41f040a5" +dependencies = [ + "quote", + "sp-core-hashing 10.0.0", + "syn 2.0.74", +] + [[package]] name = "sp-crypto-ec-utils" version = "0.4.1" @@ -10525,7 +11944,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -10561,10 +11980,21 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "sp-debug-derive" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12dae7cf6c1e825d13ffd4ce16bd9309db7c539929d0302b4443ed451a9f4e5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "proc-macro2", "quote", @@ -10582,10 +12012,22 @@ dependencies = [ "sp-storage 13.0.0", ] +[[package]] +name = "sp-externalities" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3313e2c5f2523b06062e541dff9961bde88ad5a28861621dc7b7b47a32bb0f7c" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 9.0.0", + "sp-storage 14.0.0", +] + [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "environmental", "parity-scale-codec", @@ -10598,8 +12040,8 @@ version = "0.1.0" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "serde_json", - "sp-api", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -10612,31 +12054,72 @@ dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "thiserror", ] +[[package]] +name = "sp-inherents" +version = "20.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30fe27930fbcc1ddf8e73446c65b2696f3544adeb30d1f5171d360e5c7072c9c" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-runtime 25.0.0", + "sp-std 9.0.0", + "thiserror", +] + [[package]] name = "sp-io" version = "23.0.0" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" dependencies = [ "bytes", - "ed25519-dalek", + "ed25519-dalek 2.1.1", "libsecp256k1", "log", "parity-scale-codec", "rustversion", "secp256k1", - "sp-core", + "sp-core 21.0.0", "sp-externalities 0.19.0", - "sp-keystore", + "sp-keystore 0.27.0", "sp-runtime-interface 17.0.0", - "sp-state-machine", + "sp-state-machine 0.28.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-tracing 10.0.0", - "sp-trie", + "sp-tracing 10.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", + "sp-trie 22.0.0", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "24.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6194309bfe055d93177c6c9d2ed4c7b66040617cf3003a15e509c432cf3b62" +dependencies = [ + "bytes", + "ed25519 1.5.3", + "ed25519-dalek 1.0.1", + "libsecp256k1", + "log", + "parity-scale-codec", + "rustversion", + "secp256k1", + "sp-core 22.0.0", + "sp-externalities 0.20.0", + "sp-keystore 0.28.0", + "sp-runtime-interface 18.0.0", + "sp-state-machine 0.29.0", + "sp-std 9.0.0", + "sp-tracing 11.0.0", + "sp-trie 23.0.0", "tracing", "tracing-core", ] @@ -10648,11 +12131,24 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", - "sp-core", + "sp-core 21.0.0", "sp-externalities 0.19.0", "thiserror", ] +[[package]] +name = "sp-keystore" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eda1d2572a15340927a9f7db75ffe74366b645eaf9212015b4a96ad8e9d4c46" +dependencies = [ + "parity-scale-codec", + "parking_lot 0.12.3", + "sp-core 22.0.0", + "sp-externalities 0.20.0", + "thiserror", +] + [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" @@ -10662,6 +12158,18 @@ dependencies = [ "zstd 0.12.4", ] +[[package]] +name = "sp-metadata-ir" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369e75e418bcfdeede4acb92563ef2d514ad0e7d81c350ba9ae98841a237f3c" +dependencies = [ + "frame-metadata 16.0.0", + "parity-scale-codec", + "scale-info", + "sp-std 9.0.0", +] + [[package]] name = "sp-metadata-ir" version = "0.1.0" @@ -10681,9 +12189,9 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-core", - "sp-runtime", + "sp-arithmetic 16.0.0", + "sp-core 21.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -10697,6 +12205,17 @@ dependencies = [ "regex", ] +[[package]] +name = "sp-panic-handler" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c67eb0a0d11d3017ef43c975068ba76c7b0e83aca1ee3d68ba0ce270ecebe7" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + [[package]] name = "sp-runtime" version = "24.0.0" @@ -10711,12 +12230,35 @@ dependencies = [ "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", + "sp-application-crypto 23.0.0", + "sp-arithmetic 16.0.0", + "sp-core 21.0.0", + "sp-io 23.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-weights", + "sp-weights 20.0.0", +] + +[[package]] +name = "sp-runtime" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d056e4cccf36a45be5d471b47c09e8be91b825f1d8352f20aa01f9f693176e7" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "sp-application-crypto 24.0.0", + "sp-arithmetic 17.0.0", + "sp-core 22.0.0", + "sp-io 24.0.0", + "sp-std 9.0.0", + "sp-weights 21.0.0", ] [[package]] @@ -10732,15 +12274,34 @@ dependencies = [ "sp-runtime-interface-proc-macro 11.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "sp-storage 13.0.0", - "sp-tracing 10.0.0", + "sp-tracing 10.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "sp-wasm-interface 14.0.0", "static_assertions", ] +[[package]] +name = "sp-runtime-interface" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf9781c72848efe6750116eb96edaeb105ee7e0bd7f38a4e46371bf810b3db7b" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types 0.12.2", + "sp-externalities 0.20.0", + "sp-runtime-interface-proc-macro 12.0.0", + "sp-std 9.0.0", + "sp-storage 14.0.0", + "sp-tracing 11.0.0", + "sp-wasm-interface 15.0.0", + "static_assertions", +] + [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -10768,10 +12329,23 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7402572a08aa1ae421ea5bab10918764b0ae72301b27710913e5d804862f2448" +dependencies = [ + "Inflector", + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "Inflector", "expander", @@ -10788,11 +12362,11 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-staking", + "sp-api 4.0.0-dev", + "sp-core 21.0.0", + "sp-keystore 0.27.0", + "sp-runtime 24.0.0", + "sp-staking 4.0.0-dev", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] @@ -10805,11 +12379,26 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-runtime", + "sp-core 21.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] +[[package]] +name = "sp-staking" +version = "20.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4883e5d0a533009175746e3c35d44aa031805064153749baefd6cac915e70ba5" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 22.0.0", + "sp-runtime 25.0.0", + "sp-std 9.0.0", +] + [[package]] name = "sp-state-machine" version = "0.28.0" @@ -10821,16 +12410,38 @@ dependencies = [ "parking_lot 0.12.3", "rand 0.8.5", "smallvec", - "sp-core", + "sp-core 21.0.0", "sp-externalities 0.19.0", - "sp-panic-handler", + "sp-panic-handler 8.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-trie", + "sp-trie 22.0.0", "thiserror", "tracing", "trie-db 0.28.0", ] +[[package]] +name = "sp-state-machine" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2e84d8ed3acc6aed5a3d5cfd500fb5b99c1e299c86086b2fe82c3e4be93178f" +dependencies = [ + "hash-db 0.16.0", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "smallvec", + "sp-core 22.0.0", + "sp-externalities 0.20.0", + "sp-panic-handler 9.0.0", + "sp-std 9.0.0", + "sp-trie 23.0.0", + "thiserror", + "tracing", + "trie-db 0.27.1", +] + [[package]] name = "sp-statement-store" version = "4.0.0-dev" @@ -10838,17 +12449,17 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "aes-gcm", "curve25519-dalek 4.1.3", - "ed25519-dalek", + "ed25519-dalek 2.1.1", "hkdf", "parity-scale-codec", "rand 0.8.5", "scale-info", "sha2 0.10.8", - "sp-api", - "sp-application-crypto", - "sp-core", + "sp-api 4.0.0-dev", + "sp-application-crypto 23.0.0", + "sp-core 21.0.0", "sp-externalities 0.19.0", - "sp-runtime", + "sp-runtime 24.0.0", "sp-runtime-interface 17.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "thiserror", @@ -10866,10 +12477,16 @@ name = "sp-std" version = "8.0.0" source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#09bdd2a6953d057ae360ec3ef6ec735f9306cc04" +[[package]] +name = "sp-std" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bbc9339227d1b6a9b7ccd9b2920c818653d40eef1512f1e2e824d72e7a336" + [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" [[package]] name = "sp-storage" @@ -10884,10 +12501,24 @@ dependencies = [ "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] +[[package]] +name = "sp-storage" +version = "14.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21245c3a7799ff6d3f1f159b496f9ac72eb32cd6fe68c6f73013155289aa9f1" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 9.0.0", + "sp-std 9.0.0", +] + [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10903,12 +12534,25 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "async-trait", "parity-scale-codec", - "sp-inherents", - "sp-runtime", + "sp-inherents 4.0.0-dev", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "thiserror", ] +[[package]] +name = "sp-tracing" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357f7591980dd58305956d32f8f6646d0a8ea9ea0e7e868e46f53b68ddf00cec" +dependencies = [ + "parity-scale-codec", + "sp-std 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", + "tracing-core", + "tracing-subscriber 0.2.25", +] + [[package]] name = "sp-tracing" version = "10.0.0" @@ -10921,10 +12565,23 @@ dependencies = [ "tracing-subscriber 0.2.25", ] +[[package]] +name = "sp-tracing" +version = "11.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5ba26db1f7513d5975970d1ba1f0580d7a1b8da8c86ea3f9f0f8dbe2cfa96e" +dependencies = [ + "parity-scale-codec", + "sp-std 9.0.0", + "tracing", + "tracing-core", + "tracing-subscriber 0.2.25", +] + [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "parity-scale-codec", "tracing", @@ -10948,7 +12605,7 @@ dependencies = [ "rand 0.8.5", "scale-info", "schnellru", - "sp-core", + "sp-core 21.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", "thiserror", "tracing", @@ -10956,6 +12613,30 @@ dependencies = [ "trie-root", ] +[[package]] +name = "sp-trie" +version = "23.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf63ea90ffb5d61048d8fb2fac669114dac198fc2739e913e615f0fd2c36c3e7" +dependencies = [ + "ahash 0.8.11", + "hash-db 0.16.0", + "hashbrown 0.13.2", + "lazy_static", + "memory-db 0.32.0", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.12.3", + "scale-info", + "schnellru", + "sp-core 22.0.0", + "sp-std 9.0.0", + "thiserror", + "tracing", + "trie-db 0.27.1", + "trie-root", +] + [[package]] name = "sp-version" version = "22.0.0" @@ -10966,10 +12647,28 @@ dependencies = [ "parity-wasm 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)", "scale-info", "serde", - "sp-core-hashing-proc-macro", - "sp-runtime", + "sp-core-hashing-proc-macro 9.0.0", + "sp-runtime 24.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-version-proc-macro", + "sp-version-proc-macro 8.0.0", + "thiserror", +] + +[[package]] +name = "sp-version" +version = "23.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae066042a53a83017a2afeee2fd608efa42b564c1a44ea1260d5a2c264ac66" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scale-info", + "serde", + "sp-core-hashing-proc-macro 10.0.0", + "sp-runtime 25.0.0", + "sp-std 9.0.0", + "sp-version-proc-macro 9.0.0", "thiserror", ] @@ -10984,6 +12683,18 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "sp-version-proc-macro" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e569853a50ad02a4b45640e7b96206bcb4569bb85ce7cdf8754a207fcfba54" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "sp-wasm-interface" version = "14.0.0" @@ -10995,14 +12706,28 @@ dependencies = [ "parity-scale-codec", "sp-allocator", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "sp-wasm-interface-common", + "sp-wasm-interface-common 7.0.0", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07945f592d2792632e6f030108769757e928a0fd78cf8659c9c210a5e341e55" +dependencies = [ + "anyhow", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 9.0.0", "wasmtime", ] [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#a4b51593dbe9b9390fa64f5040a9230b5d33b898" +source = "git+https://github.com/paritytech/polkadot-sdk#b2ec017c0e5e49f3cbf782a5255bb0f9e88bd6c1" dependencies = [ "impl-trait-for-tuples", "log", @@ -11016,7 +12741,18 @@ source = "git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0#0 dependencies = [ "parity-scale-codec", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", - "wasmi 0.13.2", + "wasmi 0.13.2 (git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext)", +] + +[[package]] +name = "sp-wasm-interface-common" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03223ee788e1490f6341eb5b76501f83abf931fa8b5d83b5f49a4fecaf83f4ae" +dependencies = [ + "parity-scale-codec", + "sp-std 9.0.0", + "wasmi 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -11028,12 +12764,28 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-arithmetic", - "sp-core", + "sp-arithmetic 16.0.0", + "sp-core 21.0.0", "sp-debug-derive 8.0.0", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-v1.4.0)", ] +[[package]] +name = "sp-weights" +version = "21.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7699b853471c2eb5dc06ea1d8ea847bfa1415371218ebb4c86325c9d0232bc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 17.0.0", + "sp-core 22.0.0", + "sp-debug-derive 9.0.0", + "sp-std 9.0.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -11089,6 +12841,19 @@ version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ceb97b7225c713c2fd4db0153cb6b3cab244eb37900c3f634ed4d43310d8c34" +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot 0.12.3", + "phf_shared", + "precomputed-hash", +] + [[package]] name = "strsim" version = "0.10.0" @@ -11370,6 +13135,17 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -11390,8 +13166,8 @@ name = "test-syscalls" version = "0.1.0" source = "git+https://github.com/gear-tech/gear.git?tag=v1.5.0#e8e01a8c8a08954b3f80083512201abc058ee730" dependencies = [ - "gear-wasm-builder", - "gstd", + "gear-wasm-builder 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", "parity-scale-codec", ] @@ -11435,6 +13211,26 @@ dependencies = [ "syn 2.0.74", ] +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -11485,6 +13281,25 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.8", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -11805,6 +13620,19 @@ dependencies = [ "smallvec", ] +[[package]] +name = "trie-db" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" +dependencies = [ + "hash-db 0.16.0", + "hashbrown 0.13.2", + "log", + "rustc-hex", + "smallvec", +] + [[package]] name = "trie-db" version = "0.28.0" @@ -11957,6 +13785,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + [[package]] name = "unicode-width" version = "0.1.13" @@ -12070,6 +13904,54 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vft-gateway-app" +version = "0.1.0" +dependencies = [ + "blake2", + "gbuiltin-eth-bridge", + "gclient 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "git-download", + "gstd 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "primitive-types 0.12.2", + "sails-client-gen 0.3.0", + "sails-rs 0.3.0", + "scale-info", + "tokio", +] + +[[package]] +name = "vft-service" +version = "0.1.0" +source = "git+https://github.com/gear-foundation/standards/?branch=gstd-pinned-v1.5.0#9f4a39db39dec0c88d12701bee05d5d51cb9147a" +dependencies = [ + "gstd 1.5.0 (git+https://github.com/gear-tech/gear.git?tag=v1.5.0)", + "log", + "parity-scale-codec", + "sails-rs 0.2.1", + "scale-info", +] + +[[package]] +name = "vft_gateway_wasm" +version = "0.1.0" +dependencies = [ + "blake2", + "extended_vft_wasm", + "gear-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gear-wasm-builder 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtest 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec", + "sails-client-gen 0.3.0", + "sails-idl-gen 0.3.0", + "sails-rs 0.3.0", + "scale-info", + "tokio", + "vft-gateway-app", +] + [[package]] name = "void" version = "1.0.2" @@ -12460,14 +14342,25 @@ dependencies = [ "winapi", ] +[[package]] +name = "wasmi" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi-validation 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasmi" version = "0.13.2" source = "git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext#3a0b1022377919e62aadf4d78b762abd1c3e9a04" dependencies = [ "parity-wasm 0.45.0 (git+https://github.com/gear-tech/parity-wasm?branch=v0.45.0-sign-ext)", - "wasmi-validation", - "wasmi_core 0.2.1", + "wasmi-validation 0.5.0 (git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext)", + "wasmi_core 0.2.1 (git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext)", ] [[package]] @@ -12497,6 +14390,15 @@ dependencies = [ "wasmparser-nostd", ] +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasmi-validation" version = "0.5.0" @@ -12516,6 +14418,20 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", + "region", +] + [[package]] name = "wasmi_core" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index eff27ff9..dfa1525a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ members = [ "relayer", "circuits/*", "ethereum-common", + "gear-programs/bridging-payment", + "gear-programs/bridging-payment/src/wasm", + "gear-programs/vft-gateway", + "gear-programs/vft-gateway/src/wasm", "gear-programs/*", "gear-programs/checkpoint-light-client/io", "utils-prometheus", @@ -29,8 +33,10 @@ plonky2_u32 = { path = "./circuits/plonky2_u32" } ethereum-client = { path = "./ethereum/client" } ethereum-common = { path = "ethereum-common", default-features = false } -grc20_gateway = { path = "gear-programs/grc20-gateway" } bridging_payment = { path = "gear-programs/bridging-payment" } +bridging_payment_wasm = { path = "gear-programs/bridging_payment/src/wasm" } +vft-gateway-app = { path = "gear-programs/vft-gateway" } +vft_gateway_wasm = { path = "gear-programs/vft-gateway/src/wasm" } gear_proof_storage = { path = "gear-programs/proof-storage" } checkpoint_light_client-io = { path = "gear-programs/checkpoint-light-client/io", default-features = false } utils-prometheus = { path = "utils-prometheus" } @@ -67,9 +73,11 @@ ethereum-types = { version = "0.14.1", default-features = false, features = [ "codec", "rlp", ] } +extended_vft_wasm = { git = "https://github.com/gear-foundation/standards/", branch = "gstd-pinned-v1.5.0"} ff = { version = "0.13.0", features = ["derive"] } futures = { version = "0.3.30", features = ["executor"] } futures-util = "0.3.28" +git-download = "0.1" hash-db = { version = "0.15.2", default-features = false } hash256-std-hasher = { version = "0.15.2", default-features = false } hex = { version = "0.4.3", default-features = false } @@ -112,18 +120,23 @@ tree_hash_derive = { git = "https://github.com/gear-tech/tree_hash.git", branch unroll = "0.1.5" # Gear/Substrate deps -gstd = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0", features = [ - "nightly", -] } -gmeta = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } -gear-wasm-builder = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0", default-features = false } -gsdk = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } -gclient = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } -gear-core = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } +gstd = { version = "=1.5.0", features = ["nightly"] } +gtest = "=1.5.0" +gwasm-builder = { version = "=1.5.0", package = "gear-wasm-builder" } +gmeta = "=1.5.0" +gear-wasm-builder = { version = "=1.5.0", default-features = false } +gsdk = "=1.5.0" +gclient = "=1.5.0" +gear-core = "=1.5.0" gbuiltin-bls381 = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } +gbuiltin-eth-bridge = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } pallet-gear-eth-bridge-rpc-runtime-api = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0", default-features = false, features = [ "std", ] } +sails-idl-gen = "0.3.0" +sails-client-gen = "0.3.0" +sails-rs = "0.3.0" + subxt = "0.32.1" sc-consensus-grandpa = { version = "0.10.0-dev", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0", default-features = false } sp-runtime = { version = "24.0.0", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0", default-features = false } @@ -158,3 +171,6 @@ alloy = { version = "0.2.0", package = "alloy", features = [ "json-rpc", "rpc-types", ] } + +[patch.crates-io] +gsys = { git = "https://github.com/gear-tech/gear.git", tag = "v1.5.0" } \ No newline at end of file diff --git a/gear-programs/bridging-payment/Cargo.toml b/gear-programs/bridging-payment/Cargo.toml index 1352b619..493ecae7 100644 --- a/gear-programs/bridging-payment/Cargo.toml +++ b/gear-programs/bridging-payment/Cargo.toml @@ -4,20 +4,13 @@ version.workspace = true edition.workspace = true [dependencies] -grc20_gateway = { workspace = true, features = ["std"] } - -gstd.workspace = true +sails-rs.workspace = true parity-scale-codec.workspace = true scale-info.workspace = true -primitive-types.workspace = true +gstd.workspace = true +gbuiltin-eth-bridge.workspace = true [build-dependencies] -gear-wasm-builder.workspace = true - -[lib] -crate-type = ["rlib"] -name = "bridging_payment" +git-download.workspace = true +sails-client-gen.workspace = true -[features] -std = [] -default = ["std"] diff --git a/gear-programs/bridging-payment/build.rs b/gear-programs/bridging-payment/build.rs index 6836d02c..cf7e4ef0 100644 --- a/gear-programs/bridging-payment/build.rs +++ b/gear-programs/bridging-payment/build.rs @@ -1,3 +1,27 @@ +use sails_client_gen::ClientGenerator; +use std::{env, path::PathBuf}; + fn main() { - gear_wasm_builder::build(); + let out_dir_path = PathBuf::from(env::var("OUT_DIR").unwrap()); + + let idl_file_path = PathBuf::from("../vft-gateway/src/wasm/vft-gateway.idl"); + + let client_rs_file_path = out_dir_path.join("vft-gateway.rs"); + + ClientGenerator::from_idl_path(&idl_file_path) + .generate_to(client_rs_file_path) + .unwrap(); + let idl_file_path = out_dir_path.join("vft.idl"); + + let client_rs_file_path = out_dir_path.join("vft.rs"); + + git_download::repo("https://github.com/gear-foundation/standards") + .branch_name("master") + .add_file("extended-vft/wasm/extended_vft.idl", &idl_file_path) + .exec() + .unwrap(); + + ClientGenerator::from_idl_path(&idl_file_path) + .generate_to(client_rs_file_path) + .unwrap(); } diff --git a/gear-programs/bridging-payment/src/lib.rs b/gear-programs/bridging-payment/src/lib.rs index d0d1782a..eaba54fe 100644 --- a/gear-programs/bridging-payment/src/lib.rs +++ b/gear-programs/bridging-payment/src/lib.rs @@ -1,31 +1,19 @@ #![no_std] -use gstd::ActorId; -use parity_scale_codec::{Decode, Encode}; -use primitive_types::U256; -use scale_info::TypeInfo; +use sails_rs::{gstd::GStdExecContext, program}; +pub mod services; +use services::{BridgingPayment, InitConfig}; +#[derive(Default)] +pub struct Program; -#[cfg(not(feature = "std"))] -mod wasm; +#[program] +impl Program { + pub fn new(init_config: InitConfig) -> Self { + BridgingPayment::::seed(init_config, GStdExecContext::new()); + Self + } -#[derive(Debug, Decode, Encode, TypeInfo)] -pub struct InitMessage { - pub grc20_gateway: ActorId, - pub fee: u128, -} - -#[derive(Debug, Decode, Encode, TypeInfo)] -pub enum AdminMessage { - SetFee(u128), - ReclaimFees, -} - -#[derive(Debug, Decode, Encode, TypeInfo)] -pub struct UserReply { - pub nonce: U256, -} - -#[derive(Debug, Decode, Encode, TypeInfo)] -pub struct State { - pub fee: u128, + pub fn bridging_payment(&self) -> BridgingPayment { + BridgingPayment::new(GStdExecContext::new()) + } } diff --git a/gear-programs/bridging-payment/src/services/error.rs b/gear-programs/bridging-payment/src/services/error.rs new file mode 100644 index 00000000..53fe8755 --- /dev/null +++ b/gear-programs/bridging-payment/src/services/error.rs @@ -0,0 +1,22 @@ +use sails_rs::prelude::*; + +#[allow(clippy::enum_variant_names)] +#[derive(Debug, Encode, Decode, TypeInfo, Clone)] +pub enum Error { + SendFailure, + ReplyFailure, + TransferTokensDecode, + TokensTransferFailure, + RequestToGateWayDecode, + PayloadSize, + MintTokensDecode, + ReplyTimeout, + TokensRefunded, + TransactionFailure, + FailureInVftGateway, + ReplyHook, + GatewayMessageProcessingFailed, + InvalidMessageStatus, + MessageNotFound, + TransferTokensFailed, +} diff --git a/gear-programs/bridging-payment/src/services/mod.rs b/gear-programs/bridging-payment/src/services/mod.rs new file mode 100644 index 00000000..f900c400 --- /dev/null +++ b/gear-programs/bridging-payment/src/services/mod.rs @@ -0,0 +1,399 @@ +use sails_rs::{ + gstd::{msg, ExecContext}, + prelude::*, +}; + +use gstd::exec; +mod error; +use error::Error; +mod msg_tracker; +use msg_tracker::{msg_tracker, msg_tracker_mut, MessageInfo, MessageStatus, TransactionDetails}; +mod token_msg; +use msg_tracker::MessageTracker; +use token_msg::{transfer_tokens, transfer_tokens_back}; +mod utils; +mod vft; +mod vft_gateway; +mod vft_gateway_msg; +use crate::event_or_panic_async; +use vft_gateway_msg::send_message_to_gateway; + +pub struct BridgingPayment { + exec_context: ExecContext, +} + +#[derive(Encode, Decode, TypeInfo)] +pub enum BridgingPaymentEvents { + TeleportVaraToEth { + nonce: U256, + sender: ActorId, + amount: U256, + receiver: H160, + eth_token_id: H160, + }, +} + +static mut DATA: Option = None; +static mut CONFIG: Option = None; +static mut MSG_TRACKER: Option = None; + +#[derive(Debug)] +pub struct BridgingPaymentData { + admin_address: ActorId, + vft_gateway_address: ActorId, +} + +#[derive(Debug, Decode, Encode, TypeInfo)] +pub struct InitConfig { + admin_address: ActorId, + vft_gateway_address: ActorId, + config: Config, +} + +impl InitConfig { + pub fn new(admin_address: ActorId, vft_gateway_address: ActorId, config: Config) -> Self { + Self { + admin_address, + vft_gateway_address, + config, + } + } +} + +#[derive(Debug, Decode, Encode, TypeInfo, Clone)] +pub struct Config { + fee: u128, + gas_for_reply_deposit: u64, + gas_to_send_request_to_gateway: u64, + gas_to_transfer_tokens: u64, + reply_timeout: u32, + gas_for_request_to_gateway_msg: u64, +} + +impl Config { + pub fn new( + fee: u128, + gas_for_reply_deposit: u64, + gas_to_send_request_to_gateway: u64, + gas_to_transfer_tokens: u64, + reply_timeout: u32, + gas_for_request_to_gateway_msg: u64, + ) -> Self { + Self { + fee, + gas_for_reply_deposit, + gas_to_send_request_to_gateway, + gas_to_transfer_tokens, + reply_timeout, + gas_for_request_to_gateway_msg, + } + } +} +impl BridgingPayment +where + T: ExecContext, +{ + pub fn seed(config: InitConfig, exec_context: T) { + unsafe { + DATA = Some(BridgingPaymentData { + admin_address: exec_context.actor_id(), + vft_gateway_address: config.vft_gateway_address, + }); + CONFIG = Some(config.config); + MSG_TRACKER = Some(MessageTracker::default()); + } + } + pub fn new(exec_context: T) -> Self { + Self { exec_context } + } + + fn data(&self) -> &BridgingPaymentData { + unsafe { + DATA.as_ref() + .expect("BridgingPaymentData::seed() should be called") + } + } + + fn data_mut(&mut self) -> &mut BridgingPaymentData { + unsafe { + DATA.as_mut() + .expect("BridgingPaymentData::seed() should be called") + } + } + + fn config(&self) -> &Config { + unsafe { + CONFIG + .as_ref() + .expect("BridgingPaymentData::seed() should be called") + } + } + + fn config_mut(&mut self) -> &mut Config { + unsafe { + CONFIG + .as_mut() + .expect("BridgingPaymentData::seed() should be called") + } + } +} + +#[service(events = BridgingPaymentEvents)] +impl BridgingPayment +where + T: ExecContext, +{ + pub fn set_fee(&mut self, fee: u128) { + let data = self.data(); + if data.admin_address != self.exec_context.actor_id() { + panic!("Not admin"); + } + let config: &mut Config = self.config_mut(); + config.fee = fee; + } + + pub fn reclaim_fee(&mut self) { + let data = self.data(); + if data.admin_address != self.exec_context.actor_id() { + panic!("Not admin"); + } + let fee_balance = exec::value_available(); + msg::send_with_gas(data.admin_address, "", 0, fee_balance).expect("Failed to reclaim fees"); + } + + pub fn update_vft_gateway_address(&mut self, new_vft_gateway_address: ActorId) { + let data = self.data(); + if data.admin_address != self.exec_context.actor_id() { + panic!("Not admin"); + } + self.data_mut().vft_gateway_address = new_vft_gateway_address; + } + + pub fn update_config( + &mut self, + fee: Option, + gas_for_reply_deposit: Option, + gas_to_send_request_to_gateway: Option, + gas_to_transfer_tokens: Option, + reply_timeout: Option, + gas_for_request_to_gateway_msg: Option, + ) { + if self.data().admin_address != self.exec_context.actor_id() { + panic!("Not admin") + } + if let Some(fee) = fee { + self.config_mut().fee = fee; + } + + if let Some(gas_for_reply_deposit) = gas_for_reply_deposit { + self.config_mut().gas_for_reply_deposit = gas_for_reply_deposit; + } + + if let Some(gas_to_send_request_to_gateway) = gas_to_send_request_to_gateway { + self.config_mut().gas_to_send_request_to_gateway = gas_to_send_request_to_gateway; + } + + if let Some(gas_to_transfer_tokens) = gas_to_transfer_tokens { + self.config_mut().gas_to_transfer_tokens = gas_to_transfer_tokens; + } + + if let Some(reply_timeout) = reply_timeout { + self.config_mut().reply_timeout = reply_timeout; + } + + if let Some(gas_for_request_to_gateway_msg) = gas_for_request_to_gateway_msg { + self.config_mut().gas_for_request_to_gateway_msg = gas_for_request_to_gateway_msg; + } + } + + pub async fn request_to_gateway( + &mut self, + amount: U256, + receiver: H160, + vara_token_id: ActorId, + ) { + let vft_gateway_address = self.data().vft_gateway_address; + let config = self.config(); + let sender = self.exec_context.actor_id(); + + if gstd::exec::gas_available() + < config.gas_to_transfer_tokens + + config.gas_to_send_request_to_gateway + + config.gas_for_request_to_gateway_msg + + 3 * config.gas_for_reply_deposit + { + panic!("Please attach more gas"); + } + + event_or_panic_async!(self, || async move { + let attached_value = msg::value(); + + if attached_value < config.fee { + panic!("Not enough fee"); + } + + let program_id = exec::program_id(); + + // Transfer tokens to the contract's account + transfer_tokens(vara_token_id, sender, program_id, amount, config).await?; + + handle_gateway_transaction( + sender, + vara_token_id, + amount, + receiver, + attached_value, + vft_gateway_address, + config, + ) + .await + }); + } + + pub async fn continue_transaction(&mut self, msg_id: MessageId) { + let vft_gateway_address = self.data().vft_gateway_address; + let config = self.config(); + + event_or_panic_async!(self, || async move { + let msg_tracker = msg_tracker_mut(); + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg status does not exist"); + + match msg_info.status { + MessageStatus::MessageToGatewayStep => { + if let TransactionDetails::SendMessageToGateway { + sender, + vara_token_id, + amount, + receiver, + attached_value, + } = msg_info.details + { + handle_gateway_transaction( + sender, + vara_token_id, + amount, + receiver, + attached_value, + vft_gateway_address, + config, + ) + .await + } else { + panic!("Unexpected tx details") + } + } + MessageStatus::GatewayMessageProcessingCompleted((nonce, eth_token_id)) => { + if let TransactionDetails::SendMessageToGateway { + sender, + amount, + receiver, + attached_value, + .. + } = msg_info.details + { + process_refund(sender, attached_value, config); + + Ok(BridgingPaymentEvents::TeleportVaraToEth { + nonce, + sender, + amount, + receiver, + eth_token_id, + }) + } else { + panic!("Unexpected tx details"); + } + } + _ => { + // Handle any other status or unexpected cases + panic!("Unexpected status or transaction completed."); + } + } + }); + } + + pub async fn return_tokens(&mut self, msg_id: MessageId) { + let msg_tracker = msg_tracker_mut(); + + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg status does not exist"); + if msg_info.status != MessageStatus::ReturnTokensBackStep { + panic!("Wrong status"); + } + + let config = self.config(); + if let TransactionDetails::SendMessageToGateway { + sender, + vara_token_id, + amount, + receiver: _, + attached_value, + } = msg_info.details + { + transfer_tokens_back(vara_token_id, exec::program_id(), sender, amount, config) + .await + .expect("Unable to send tokens back"); + process_refund(sender, attached_value, config); + } + } + pub fn msg_tracker_state(&self) -> Vec<(MessageId, MessageInfo)> { + msg_tracker().message_info.clone().into_iter().collect() + } + + pub fn admin_address(&self) -> ActorId { + self.data().admin_address + } + + pub fn vft_gateway_address(&self) -> ActorId { + self.data().vft_gateway_address + } + + pub fn get_config(&self) -> Config { + self.config().clone() + } +} + +async fn handle_gateway_transaction( + sender: ActorId, + vara_token_id: ActorId, + amount: U256, + receiver: H160, + attached_value: u128, + vft_gateway_address: ActorId, + config: &Config, +) -> Result { + let (nonce, eth_token_id) = send_message_to_gateway( + vft_gateway_address, + sender, + vara_token_id, + amount, + receiver, + attached_value, + config, + ) + .await?; + + process_refund(sender, attached_value, config); + + Ok(BridgingPaymentEvents::TeleportVaraToEth { + nonce, + sender, + amount, + receiver, + eth_token_id, + }) +} + +fn process_refund(sender: ActorId, attached_value: u128, config: &Config) { + let refund = attached_value - config.fee; + if refund >= exec::env_vars().existential_deposit { + handle_refund(sender, refund); + } +} + +fn handle_refund(actor_id: ActorId, amount: u128) { + msg::send_with_gas(actor_id, "", 0, amount).expect("Error in refund"); +} diff --git a/gear-programs/bridging-payment/src/services/msg_tracker.rs b/gear-programs/bridging-payment/src/services/msg_tracker.rs new file mode 100644 index 00000000..78770769 --- /dev/null +++ b/gear-programs/bridging-payment/src/services/msg_tracker.rs @@ -0,0 +1,142 @@ +use super::{error::Error, MSG_TRACKER}; +use gstd::prelude::collections::HashMap; +#[allow(unused_imports)] +use sails_rs::{calls::ActionIo, prelude::*}; + +#[derive(Default)] +pub struct MessageTracker { + pub message_info: HashMap, +} + +#[derive(Debug, Encode, Decode, TypeInfo, Clone)] +pub struct MessageInfo { + pub status: MessageStatus, + pub details: TransactionDetails, +} + +#[derive(Debug, Clone, Encode, Decode, TypeInfo)] +pub enum TransactionDetails { + Transfer { + sender: ActorId, + receiver: ActorId, + amount: U256, + token_id: ActorId, + }, + SendMessageToGateway { + sender: ActorId, + vara_token_id: ActorId, + amount: U256, + receiver: H160, + attached_value: u128, + }, +} + +#[derive(Debug, PartialEq, Encode, Decode, TypeInfo, Clone)] +pub enum MessageStatus { + // Transfer tokens statuses + SendingMessageToTransferTokens, + TokenTransferCompleted(bool), + WaitingReplyFromTokenTransfer, + + // Send message to gateway statuses + SendingMessageToGateway, + GatewayMessageProcessingCompleted((U256, H160)), + WaitingReplyFromGateway, + MessageToGatewayStep, + + ReturnTokensBackStep, + SendingMessageToTransferTokensBack, + WaitingReplyFromTokenTransferBack, + TokenTransferBackCompleted, + + MessageProcessedWithSuccess((U256, H160)), +} + +impl MessageTracker { + pub fn insert_message_info( + &mut self, + msg_id: MessageId, + status: MessageStatus, + details: TransactionDetails, + ) { + self.message_info + .insert(msg_id, MessageInfo { status, details }); + } + + pub fn update_message_status(&mut self, msg_id: MessageId, status: MessageStatus) { + if let Some(info) = self.message_info.get_mut(&msg_id) { + info.status = status; + } + } + + pub fn get_message_info(&self, msg_id: &MessageId) -> Option<&MessageInfo> { + self.message_info.get(msg_id) + } + + pub fn remove_message_info(&mut self, msg_id: &MessageId) -> Option { + self.message_info.remove(msg_id) + } + + pub fn check_transfer_result(&mut self, msg_id: &MessageId) -> Result<(), Error> { + if let Some(info) = self.message_info.get(msg_id) { + match info.status { + MessageStatus::TokenTransferCompleted(true) => Ok(()), + MessageStatus::TokenTransferCompleted(false) => { + self.message_info.remove(msg_id); + Err(Error::TransferTokensFailed) + } + _ => Err(Error::InvalidMessageStatus), + } + } else { + Err(Error::MessageNotFound) + } + } + + pub fn check_transfer_back_result(&mut self, msg_id: &MessageId) -> Result<(), Error> { + if let Some(info) = self.message_info.get(msg_id) { + match info.status { + MessageStatus::TokenTransferBackCompleted => { + self.message_info.remove(msg_id); + Ok(()) + } + MessageStatus::ReturnTokensBackStep => Err(Error::TransferTokensFailed), + _ => Err(Error::InvalidMessageStatus), + } + } else { + Err(Error::MessageNotFound) + } + } + + pub fn check_vft_gateway_reply(&mut self, msg_id: &MessageId) -> Result<(U256, H160), Error> { + if let Some(info) = self.message_info.get(msg_id) { + match info.status { + MessageStatus::GatewayMessageProcessingCompleted((nonce, eth_token_id)) => { + self.remove_message_info(msg_id); + Ok((nonce, eth_token_id)) + } + MessageStatus::ReturnTokensBackStep | MessageStatus::MessageToGatewayStep => { + Err(Error::GatewayMessageProcessingFailed) + } + _ => Err(Error::InvalidMessageStatus), + } + } else { + Err(Error::MessageNotFound) + } + } +} + +pub fn msg_tracker_mut() -> &'static mut MessageTracker { + unsafe { + MSG_TRACKER + .as_mut() + .expect("BridgingPaymentData::seed() should be called") + } +} + +pub fn msg_tracker() -> &'static MessageTracker { + unsafe { + MSG_TRACKER + .as_ref() + .expect("BridgingPaymentData::seed() should be called") + } +} diff --git a/gear-programs/bridging-payment/src/services/token_msg.rs b/gear-programs/bridging-payment/src/services/token_msg.rs new file mode 100644 index 00000000..9604bd8f --- /dev/null +++ b/gear-programs/bridging-payment/src/services/token_msg.rs @@ -0,0 +1,84 @@ +use super::{ + error::Error, + msg_tracker::{msg_tracker_mut, MessageStatus, TransactionDetails}, + utils, + vft::vft::io as vft_io, + Config, +}; +use sails_rs::prelude::*; + +pub async fn transfer_tokens( + token_id: ActorId, + sender: ActorId, + receiver: ActorId, + amount: U256, + config: &Config, +) -> Result<(), Error> { + let msg_id = gstd::msg::id(); + let bytes: Vec = vft_io::TransferFrom::encode_call(sender, receiver, amount); + + let transaction_details = TransactionDetails::Transfer { + sender, + receiver, + amount, + token_id, + }; + + msg_tracker_mut().insert_message_info( + msg_id, + MessageStatus::SendingMessageToTransferTokens, + transaction_details, + ); + + utils::set_critical_hook(msg_id); + + utils::send_message_with_gas_for_reply( + token_id, + bytes, + config.gas_to_transfer_tokens, + config.gas_for_reply_deposit, + config.reply_timeout, + msg_id, + ) + .await?; + + msg_tracker_mut().check_transfer_result(&msg_id) +} + +pub async fn transfer_tokens_back( + token_id: ActorId, + sender: ActorId, + receiver: ActorId, + amount: U256, + config: &Config, +) -> Result<(), Error> { + let msg_id = gstd::msg::id(); + let bytes: Vec = vft_io::TransferFrom::encode_call(sender, receiver, amount); + + let transaction_details = TransactionDetails::Transfer { + sender, + receiver, + amount, + token_id, + }; + + msg_tracker_mut().insert_message_info( + msg_id, + MessageStatus::SendingMessageToTransferTokensBack, + transaction_details, + ); + + utils::set_critical_hook(msg_id); + + utils::send_message_with_gas_for_reply( + token_id, + bytes, + config.gas_to_transfer_tokens, + config.gas_for_reply_deposit, + config.reply_timeout, + msg_id, + ) + .await?; + + msg_tracker_mut().check_transfer_back_result(&msg_id) +} diff --git a/gear-programs/bridging-payment/src/services/utils.rs b/gear-programs/bridging-payment/src/services/utils.rs new file mode 100644 index 00000000..d30e6de0 --- /dev/null +++ b/gear-programs/bridging-payment/src/services/utils.rs @@ -0,0 +1,177 @@ +use super::{ + error::Error, + msg_tracker::{msg_tracker_mut, MessageStatus}, + vft::vft::io as vft_io, + vft_gateway::vft_gateway::io as vft_gateway_io, + vft_gateway::Error as VftGatewayError, +}; +use sails_rs::calls::ActionIo; +use sails_rs::prelude::*; + +#[macro_export] +macro_rules! event_or_panic_async { + ($self:expr, $expr:expr) => {{ + let result: Result = $expr().await; + match result { + Ok(value) => { + if let Err(e) = $self.notify_on(value) { + panic!("Error in depositing events: {:?}", e); + } + } + Err(e) => { + panic!("Message processing failed with error: {:?}", e); + } + } + }}; +} + +pub fn set_critical_hook(msg_id: MessageId) { + gstd::critical::set_hook(move || { + let msg_tracker = msg_tracker_mut(); + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg info does not exist"); + + match &msg_info.status { + MessageStatus::SendingMessageToTransferTokens => { + // If still sending, transition to `WaitingReplyFromTokenTransfer`. + msg_tracker + .update_message_status(msg_id, MessageStatus::WaitingReplyFromTokenTransfer); + } + MessageStatus::TokenTransferCompleted(true) => { + // If the token transfer is successful, continue to the gateway step. + msg_tracker.update_message_status(msg_id, MessageStatus::MessageToGatewayStep); + } + MessageStatus::TokenTransferCompleted(false) => { + // If the token transfer fails, cancel the transaction. + msg_tracker.remove_message_info(&msg_id); + } + MessageStatus::SendingMessageToGateway => { + // If still sending, transition to `WaitingReplyFromGateway`. + msg_tracker.update_message_status(msg_id, MessageStatus::WaitingReplyFromGateway); + } + MessageStatus::SendingMessageToTransferTokensBack => { + // If still sending, transition to `WaitingReplyFromTokenTransferBack`. + msg_tracker.update_message_status( + msg_id, + MessageStatus::WaitingReplyFromTokenTransferBack, + ); + } + _ => {} + }; + }); +} + +pub async fn send_message_with_gas_for_reply( + destination: ActorId, + message: Vec, + gas_to_send: u64, + gas_deposit: u64, + reply_timeout: u32, + msg_id: MessageId, +) -> Result<(), Error> { + gstd::msg::send_bytes_with_gas_for_reply(destination, message, gas_to_send, 0, gas_deposit) + .map_err(|_| Error::SendFailure)? + .up_to(Some(reply_timeout)) + .map_err(|_| Error::ReplyTimeout)? + .handle_reply(move || handle_reply_hook(msg_id)) + .map_err(|_| Error::ReplyHook)? + .await + .map_err(|_| Error::ReplyFailure)?; + Ok(()) +} + +fn handle_reply_hook(msg_id: MessageId) { + let msg_tracker = msg_tracker_mut(); + + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg info does not exist"); + let reply_bytes = gstd::msg::load_bytes().expect("Unable to load bytes"); + + match msg_info.status { + MessageStatus::SendingMessageToTransferTokens => { + match decode_transfer_reply(&reply_bytes) { + Ok(reply) => { + msg_tracker.update_message_status( + msg_id, + MessageStatus::TokenTransferCompleted(reply), + ); + } + Err(_) => { + msg_tracker.remove_message_info(&msg_id); + } + }; + } + MessageStatus::WaitingReplyFromTokenTransfer => { + let reply = decode_transfer_reply(&reply_bytes).unwrap_or(false); + if reply { + msg_tracker.update_message_status(msg_id, MessageStatus::MessageToGatewayStep); + } else { + msg_tracker.remove_message_info(&msg_id); + } + } + MessageStatus::SendingMessageToGateway => { + let reply = decode_vft_gateway_reply(&reply_bytes); + match reply { + Ok(Ok((nonce, eth_token_id))) => { + msg_tracker.update_message_status( + msg_id, + MessageStatus::GatewayMessageProcessingCompleted((nonce, eth_token_id)), + ); + } + Ok(Err(error)) => { + match error { + VftGatewayError::BurnTokensFailed | VftGatewayError::MessageFailed => { + msg_tracker + .update_message_status(msg_id, MessageStatus::ReturnTokensBackStep); + } + // retry tx + _ => msg_tracker + .update_message_status(msg_id, MessageStatus::MessageToGatewayStep), + } + } + Err(_) => { + msg_tracker.update_message_status(msg_id, MessageStatus::MessageToGatewayStep); + } + }; + } + MessageStatus::WaitingReplyFromGateway => { + let reply = decode_vft_gateway_reply(&reply_bytes); + match reply { + Ok(Ok((nonce, eth_token_id))) => { + msg_tracker.update_message_status( + msg_id, + MessageStatus::MessageProcessedWithSuccess((nonce, eth_token_id)), + ); + } + _ => { + msg_tracker.update_message_status(msg_id, MessageStatus::ReturnTokensBackStep); + } + }; + } + MessageStatus::SendingMessageToTransferTokensBack + | MessageStatus::WaitingReplyFromTokenTransferBack => { + match decode_transfer_reply(&reply_bytes) { + Ok(true) => { + msg_tracker + .update_message_status(msg_id, MessageStatus::TokenTransferBackCompleted); + } + Err(_) | Ok(false) => { + // retry tx + msg_tracker.update_message_status(msg_id, MessageStatus::ReturnTokensBackStep); + } + }; + } + _ => {} + }; +} + +fn decode_transfer_reply(bytes: &[u8]) -> Result { + vft_io::TransferFrom::decode_reply(bytes).map_err(|_| Error::TransferTokensDecode) +} + +fn decode_vft_gateway_reply(bytes: &[u8]) -> Result, Error> { + vft_gateway_io::TransferVaraToEth::decode_reply(bytes) + .map_err(|_| Error::RequestToGateWayDecode) +} diff --git a/gear-programs/bridging-payment/src/services/vft.rs b/gear-programs/bridging-payment/src/services/vft.rs new file mode 100644 index 00000000..3887cc79 --- /dev/null +++ b/gear-programs/bridging-payment/src/services/vft.rs @@ -0,0 +1,6 @@ +mod vft_module { + #![allow(dead_code)] + include!(concat!(env!("OUT_DIR"), "/vft.rs")); +} + +pub use vft_module::*; diff --git a/gear-programs/bridging-payment/src/services/vft_gateway.rs b/gear-programs/bridging-payment/src/services/vft_gateway.rs new file mode 100644 index 00000000..b88aab1e --- /dev/null +++ b/gear-programs/bridging-payment/src/services/vft_gateway.rs @@ -0,0 +1,6 @@ +mod vft_gateway_module { + #![allow(dead_code)] + include!(concat!(env!("OUT_DIR"), "/vft-gateway.rs")); +} + +pub use vft_gateway_module::*; diff --git a/gear-programs/bridging-payment/src/services/vft_gateway_msg.rs b/gear-programs/bridging-payment/src/services/vft_gateway_msg.rs new file mode 100644 index 00000000..d6befe03 --- /dev/null +++ b/gear-programs/bridging-payment/src/services/vft_gateway_msg.rs @@ -0,0 +1,52 @@ +use super::{ + error::Error, + msg_tracker::{msg_tracker_mut, MessageStatus, TransactionDetails}, + utils, vft_gateway, Config, +}; +use sails_rs::prelude::*; + +pub async fn send_message_to_gateway( + gateway_address: ActorId, + sender: ActorId, + vara_token_id: ActorId, + amount: U256, + receiver: H160, + attached_value: u128, + config: &Config, +) -> Result<(U256, H160), Error> { + let msg_id = gstd::msg::id(); + + let bytes: Vec = vft_gateway::vft_gateway::io::TransferVaraToEth::encode_call( + vara_token_id, + amount, + receiver, + ); + + let transaction_details = TransactionDetails::SendMessageToGateway { + sender, + vara_token_id, + amount, + receiver, + attached_value, + }; + + msg_tracker_mut().insert_message_info( + msg_id, + MessageStatus::SendingMessageToGateway, + transaction_details, + ); + + utils::set_critical_hook(msg_id); + + utils::send_message_with_gas_for_reply( + gateway_address, + bytes, + config.gas_to_send_request_to_gateway, + config.gas_for_reply_deposit, + config.reply_timeout, + msg_id, + ) + .await?; + + msg_tracker_mut().check_vft_gateway_reply(&msg_id) +} diff --git a/gear-programs/bridging-payment/src/wasm.rs b/gear-programs/bridging-payment/src/wasm.rs deleted file mode 100644 index 362f18f7..00000000 --- a/gear-programs/bridging-payment/src/wasm.rs +++ /dev/null @@ -1,73 +0,0 @@ -use super::*; -use gstd::{exec, msg, prelude::*, ActorId}; - -use grc20_gateway::vara2eth::Response as GatewayResponse; - -static mut ADMIN_ADDRESS: ActorId = ActorId::new([0u8; 32]); -static mut GRC20_GATEWAY_ADDRESS: ActorId = ActorId::new([0u8; 32]); -static mut FEE: u128 = 0; - -#[no_mangle] -extern "C" fn init() { - let init_msg: InitMessage = msg::load().expect("Failed to load request"); - let admin = msg::source(); - - unsafe { - ADMIN_ADDRESS = admin; - GRC20_GATEWAY_ADDRESS = init_msg.grc20_gateway; - FEE = init_msg.fee; - } -} - -#[gstd::async_main] -async fn main() { - if msg::source() == unsafe { ADMIN_ADDRESS } { - admin_request(); - } else { - user_request().await; - } -} - -fn admin_request() { - let msg: AdminMessage = msg::load().expect("Failed to load admin message"); - match msg { - AdminMessage::SetFee(fee) => unsafe { FEE = fee }, - AdminMessage::ReclaimFees => { - let value = exec::value_available(); - msg::reply_bytes(&[], value).expect("Failed to reclaim fees"); - } - } -} - -async fn user_request() { - if msg::value() < unsafe { FEE } { - panic!("Insufficient fee paid"); - } - - let payload = msg::load_bytes().expect("Failed to load payload"); - let gateway_reply: GatewayResponse = - msg::send_bytes_for_reply_as(unsafe { GRC20_GATEWAY_ADDRESS }, payload, 0, 0) - .expect("Failed to send message to gateway") - .await - .expect("Error requesting bridging"); - - let remaining = msg::value() - unsafe { FEE }; - msg::reply( - &UserReply { - nonce: gateway_reply.nonce, - }, - remaining, - ) - .expect("Failed to send reply"); -} - -#[no_mangle] -extern "C" fn state() { - msg::reply( - State { - fee: unsafe { FEE }, - }, - 0, - ) - .expect("Failed to read state"); -} diff --git a/gear-programs/bridging-payment/src/wasm/Cargo.toml b/gear-programs/bridging-payment/src/wasm/Cargo.toml new file mode 100644 index 00000000..5f6ca39e --- /dev/null +++ b/gear-programs/bridging-payment/src/wasm/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "bridging_payment_wasm" +version.workspace = true +edition.workspace = true + +[dependencies] +bridging_payment.workspace = true + +[build-dependencies] +gwasm-builder.workspace = true +sails-idl-gen.workspace = true +bridging_payment.workspace = true + +[dev-dependencies] +gtest.workspace = true +extended_vft_wasm = { git = "https://github.com/gear-foundation/standards/", branch = "gstd-pinned-v1.5.0"} +vft_gateway_wasm.workspace = true +vft-gateway-app.workspace = true +parity-scale-codec.workspace = true +scale-info.workspace = true +sails-rs.workspace = true + +[lib] +crate-type = ["rlib"] diff --git a/gear-programs/bridging-payment/src/wasm/bridging-payment.idl b/gear-programs/bridging-payment/src/wasm/bridging-payment.idl new file mode 100644 index 00000000..994ba984 --- /dev/null +++ b/gear-programs/bridging-payment/src/wasm/bridging-payment.idl @@ -0,0 +1,62 @@ +type InitConfig = struct { + admin_address: actor_id, + vft_gateway_address: actor_id, + config: Config, +}; + +type Config = struct { + fee: u128, + gas_for_reply_deposit: u64, + gas_to_send_request_to_gateway: u64, + gas_to_transfer_tokens: u64, + reply_timeout: u32, + gas_for_request_to_gateway_msg: u64, +}; + +type MessageInfo = struct { + status: MessageStatus, + details: TransactionDetails, +}; + +type MessageStatus = enum { + SendingMessageToTransferTokens, + TokenTransferCompleted: bool, + WaitingReplyFromTokenTransfer, + SendingMessageToGateway, + GatewayMessageProcessingCompleted: struct { u256, h160 }, + WaitingReplyFromGateway, + MessageToGatewayStep, + ReturnTokensBackStep, + SendingMessageToTransferTokensBack, + WaitingReplyFromTokenTransferBack, + TokenTransferBackCompleted, + MessageProcessedWithSuccess: struct { u256, h160 }, +}; + +type TransactionDetails = enum { + Transfer: struct { sender: actor_id, receiver: actor_id, amount: u256, token_id: actor_id }, + SendMessageToGateway: struct { sender: actor_id, vara_token_id: actor_id, amount: u256, receiver: h160, attached_value: u128 }, +}; + +constructor { + New : (init_config: InitConfig); +}; + +service BridgingPayment { + ContinueTransaction : (msg_id: message_id) -> null; + ReclaimFee : () -> null; + RequestToGateway : (amount: u256, receiver: h160, vara_token_id: actor_id) -> null; + ReturnTokens : (msg_id: message_id) -> null; + SetFee : (fee: u128) -> null; + UpdateConfig : (fee: opt u128, gas_for_reply_deposit: opt u64, gas_to_send_request_to_gateway: opt u64, gas_to_transfer_tokens: opt u64, reply_timeout: opt u32, gas_for_request_to_gateway_msg: opt u64) -> null; + UpdateVftGatewayAddress : (new_vft_gateway_address: actor_id) -> null; + query AdminAddress : () -> actor_id; + query GetConfig : () -> Config; + query MsgTrackerState : () -> vec struct { message_id, MessageInfo }; + query VftGatewayAddress : () -> actor_id; + + events { + TeleportVaraToEth: struct { nonce: u256, sender: actor_id, amount: u256, receiver: h160, eth_token_id: h160 }; + } +}; + diff --git a/gear-programs/bridging-payment/src/wasm/build.rs b/gear-programs/bridging-payment/src/wasm/build.rs new file mode 100644 index 00000000..95452e63 --- /dev/null +++ b/gear-programs/bridging-payment/src/wasm/build.rs @@ -0,0 +1,15 @@ +use bridging_payment::Program; +use sails_idl_gen::program; +use std::{env, fs::File, path::PathBuf}; + +fn main() { + gwasm_builder::build(); + + let manifest_dir_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + + let idl_file_path = manifest_dir_path.join("bridging-payment.idl"); + + let idl_file = File::create(idl_file_path).unwrap(); + + program::generate_idl::(idl_file).unwrap(); +} diff --git a/gear-programs/bridging-payment/src/wasm/src/lib.rs b/gear-programs/bridging-payment/src/wasm/src/lib.rs new file mode 100644 index 00000000..3b36ce6f --- /dev/null +++ b/gear-programs/bridging-payment/src/wasm/src/lib.rs @@ -0,0 +1,4 @@ +#![no_std] + +#[cfg(target_arch = "wasm32")] +pub use bridging_payment::wasm::*; diff --git a/gear-programs/bridging-payment/src/wasm/tests/bridging_payment.rs b/gear-programs/bridging-payment/src/wasm/tests/bridging_payment.rs new file mode 100644 index 00000000..d0689a15 --- /dev/null +++ b/gear-programs/bridging-payment/src/wasm/tests/bridging_payment.rs @@ -0,0 +1,34 @@ +use gtest::{Program, System}; +use sails_rs::prelude::*; + +mod utils; +use utils::{ + BridgingPayment, GearBridgeBuiltinMock, Token, VftGateway, ADMIN_ID, BRIDGE_BUILTIN_ID, FEE, + TOKEN_ID, +}; + +#[test] +fn transfer_tokens_success() { + let system = System::new(); + system.init_logger(); + + let vft = Program::token(&system, TOKEN_ID); + let bridge_built_in = Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + // initialise bridge builtin + assert!(!bridge_built_in.send_bytes(ADMIN_ID, vec![]).main_failed()); + + let vft_gateway = Program::vft_gateway(&system); + let bridging_payment = Program::bridge_payment(&system); + + let account_id: u64 = 10000; + let amount = U256::from(10_000_000_000_u64); + + vft.mint(ADMIN_ID, account_id.into(), amount, false); + vft.approve(account_id, bridging_payment.id(), amount, false); + vft.grant_burner_role(ADMIN_ID, vft_gateway.id(), false); + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into(), false); + + system.mint_to(account_id, FEE); + bridging_payment.request_to_gateway(account_id, amount, [1; 20].into(), vft.id(), false); + assert_eq!(vft.balance_of(account_id.into()), U256::zero()); +} diff --git a/gear-programs/bridging-payment/src/wasm/tests/utils.rs b/gear-programs/bridging-payment/src/wasm/tests/utils.rs new file mode 100644 index 00000000..14dc48e3 --- /dev/null +++ b/gear-programs/bridging-payment/src/wasm/tests/utils.rs @@ -0,0 +1,270 @@ +use bridging_payment::services::{Config, InitConfig}; +use extended_vft_wasm::WASM_BINARY as TOKEN_WASM_BINARY; +use gtest::{Program, System, WasmProgram}; +use vft_gateway_wasm::WASM_BINARY as VFT_GATEWAY_WASM_BINARY; + +use sails_rs::prelude::*; +pub const ADMIN_ID: u64 = 1000; +pub const FEE: u128 = 10_000_000_000_000; +pub const VFT_GATEWAY_ID: u64 = 100; +pub const TOKEN_ID: u64 = 200; +pub const BRIDGE_BUILTIN_ID: u64 = 300; + +// macros +macro_rules! create_function { + ($name:ident, $method:expr) => { + fn $name(&self, from: u64, error: bool); + }; + + ($name:ident, $method:expr, $($param_name:ident: $param_type:ty),*) => { + fn $name(&self, from: u64, $($param_name: $param_type,)* error: bool); + }; +} + +macro_rules! implement_function { + ($name:ident, $prefix:expr, $method:expr) => { + fn $name(&self, from: u64, error: bool) { + let payload = [ + $prefix.encode(), + $method.encode(), + ] + .concat(); + let result = self.send_bytes(from, payload); + + if error { + assert!(result.main_failed()); + } else { + assert!(!result.main_failed()); + } + } + }; + ($name:ident, $prefix:expr, $method:expr, $($param_name:ident: $param_type:ty),*; $with_value:expr) => { + fn $name(&self, from: u64, $($param_name: $param_type,)* error: bool) { + let payload = [ + $prefix.encode(), + $method.encode(), + ($($param_name,)*).encode(), + ] + .concat(); + + let result = if $with_value { + self.send_bytes_with_value(from, payload, FEE) + } else { + self.send_bytes(from, payload) + }; + + if error { + assert!(result.main_failed()); + } else { + assert!(!result.main_failed()); + } + } + }; +} + +macro_rules! create_query_function { + // Match functions with parameters + ($fn_name:ident, $return_type:ty, $($param_name:ident: $param_type:ty),*) => { + fn $fn_name(&self, $($param_name: $param_type),*) -> $return_type; + }; + // Match functions without parameters + ($fn_name:ident, $return_type:ty) => { + fn $fn_name(&self) -> $return_type; + }; +} + +macro_rules! implement_token_query { + ($fn_name:ident, $query_name:expr, $return_type:ty) => { + fn $fn_name(&self) -> $return_type { + let query = ["Vft".encode(), $query_name.encode()].concat(); + let result = self.send_bytes(ADMIN_ID, query.clone()); + + let log_entry = result + .log() + .iter() + .find(|log_entry| log_entry.destination() == ADMIN_ID.into()) + .expect("Unable to get query reply"); + + let query_reply = <(String, String, $return_type)>::decode(&mut log_entry.payload()) + .expect("Unable to decode reply"); + query_reply.2 + } + }; + + ($fn_name:ident, $query_name:expr, $return_type:ty, $($param_name:ident: $param_type:ty),*) => { + fn $fn_name(&self, $($param_name: $param_type),*) -> $return_type { + let query = ["Vft".encode(), $query_name.encode(), ($($param_name),*).encode()].concat(); + let result = self.send_bytes(ADMIN_ID, query.clone()); + + let log_entry = result + .log() + .iter() + .find(|log_entry| log_entry.destination() == ADMIN_ID.into()) + .expect("Unable to get query reply"); + + let query_reply = <(String, String, $return_type)>::decode(&mut log_entry.payload()) + .expect("Unable to decode reply"); + query_reply.2 + } + }; +} + +macro_rules! create_ft_mock { + ($name:ident, $handle_result:expr) => { + #[derive(Debug)] + pub struct $name; + + impl WasmProgram for $name { + fn init(&mut self, _payload: Vec) -> Result>, &'static str> { + Ok(None) + } + + fn handle(&mut self, _payload: Vec) -> Result>, &'static str> { + $handle_result + } + + fn handle_reply(&mut self, _payload: Vec) -> Result<(), &'static str> { + unimplemented!() + } + + fn handle_signal(&mut self, _payload: Vec) -> Result<(), &'static str> { + unimplemented!() + } + + fn state(&mut self) -> Result, &'static str> { + unimplemented!() + } + } + }; +} + +// Mocks for programs +#[derive(Debug)] +pub struct GearBridgeBuiltinMock; + +impl WasmProgram for GearBridgeBuiltinMock { + fn init(&mut self, _payload: Vec) -> Result>, &'static str> { + Ok(None) + } + + fn handle(&mut self, _payload: Vec) -> Result>, &'static str> { + Ok(Some( + Response::MessageSent { + nonce: U256::from(1), + hash: [1; 32].into(), + } + .encode(), + )) + } + + fn handle_reply(&mut self, _payload: Vec) -> Result<(), &'static str> { + unimplemented!() + } + + fn handle_signal(&mut self, _payload: Vec) -> Result<(), &'static str> { + unimplemented!() + } + + fn state(&mut self) -> Result, &'static str> { + unimplemented!() + } +} + +create_ft_mock!(FTMockError, Err("Error")); +create_ft_mock!(FTMockWrongReply, Ok(None)); +create_ft_mock!( + FTMockReturnsFalse, + Ok(Some( + ["Vft".encode(), "TransferFrom".encode(), false.encode()].concat() + )) +); +create_ft_mock!( + FTMockReturnsTrue, + Ok(Some( + ["Vft".encode(), "TransferFrom".encode(), true.encode()].concat() + )) +); + +// Smart contract functionality for Program +pub trait BridgingPayment { + fn bridge_payment(system: &System) -> Program<'_>; + create_function!(request_to_gateway, "RequestToGateway", amount: U256, receiver: H160, vara_token_id: ActorId); +} + +impl BridgingPayment for Program<'_> { + fn bridge_payment(system: &System) -> Program<'_> { + let program = Program::current(system); + let init_config = InitConfig::new( + ADMIN_ID.into(), + VFT_GATEWAY_ID.into(), + Config::new( + FEE, + 15_000_000_000, + 100_000_000_000, + 15_000_000_000, + 1000, + 50_000_000_000, + ), + ); + let payload = ["New".encode(), init_config.encode()].concat(); + let result = program.send_bytes(10, payload); + assert!(!result.main_failed()); + program + } + implement_function!(request_to_gateway, "BridgingPayment", "RequestToGateway", amount: U256, receiver: H160, vara_token_id: ActorId; true); +} + +pub trait Token { + fn token(system: &System, id: u64) -> Program<'_>; + create_function!(mint, "Mint", to: ActorId, value: U256); + create_function!(approve, "Approve", spender: ActorId, value: U256); + create_function!(grant_burner_role, "GrantBurnerRole", to: ActorId); + create_query_function!(balance_of, U256, account: ActorId); +} + +impl Token for Program<'_> { + fn token(system: &System, id: u64) -> Program<'_> { + let token = Program::from_binary_with_id(system, id, TOKEN_WASM_BINARY); + let payload = ["New".encode(), ("Token", "Token", 18).encode()].concat(); + let result = token.send_bytes(ADMIN_ID, payload); + assert!(!result.main_failed()); + token + } + implement_function!(mint, "Vft", "Mint", to: ActorId, value: U256; false); + implement_function!(approve,"Vft", "Approve", spender: ActorId, value: U256; false); + implement_function!(grant_burner_role,"Vft", "GrantBurnerRole", to: ActorId; false); + implement_token_query!(balance_of, "BalanceOf", U256, account: ActorId); +} + +#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)] +pub enum Response { + MessageSent { nonce: U256, hash: H256 }, +} + +pub trait VftGateway { + fn vft_gateway(system: &System) -> Program<'_>; + create_function!(map_vara_to_eth_address, "MapVaraToEthAddress", vara_token_id: ActorId, eth_token_id: H160); +} + +impl VftGateway for Program<'_> { + fn vft_gateway(system: &System) -> Program<'_> { + let program = Program::from_binary_with_id(system, VFT_GATEWAY_ID, VFT_GATEWAY_WASM_BINARY); + let init_config = vft_gateway_app::services::InitConfig::new( + [1; 20].into(), + BRIDGE_BUILTIN_ID.into(), + vft_gateway_app::services::Config::new( + 15_000_000_000, + 15_000_000_000, + 15_000_000_000, + 15_000_000_000, + 1000, + 20_000_000_000, + ), + ); + let payload = ["New".encode(), init_config.encode()].concat(); + let result = program.send_bytes(ADMIN_ID, payload); + assert!(!result.main_failed()); + program + } + implement_function!(map_vara_to_eth_address, "VftGateway", "MapVaraToEthAddress", vara_token_id: ActorId, eth_token_id: H160; false); +} diff --git a/gear-programs/grc20-gateway/Cargo.toml b/gear-programs/grc20-gateway/Cargo.toml deleted file mode 100644 index 7be8b93b..00000000 --- a/gear-programs/grc20-gateway/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "grc20_gateway" -version.workspace = true -edition.workspace = true - -[dependencies] -gstd.workspace = true -primitive-types.workspace = true -parity-scale-codec.workspace = true -scale-info.workspace = true - -[build-dependencies] -gear-wasm-builder.workspace = true - -[lib] -crate-type = ["rlib"] -name = "grc20_gateway" - -[features] -std = [] -default = ["std"] diff --git a/gear-programs/grc20-gateway/build.rs b/gear-programs/grc20-gateway/build.rs deleted file mode 100644 index 6836d02c..00000000 --- a/gear-programs/grc20-gateway/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - gear_wasm_builder::build(); -} diff --git a/gear-programs/grc20-gateway/src/lib.rs b/gear-programs/grc20-gateway/src/lib.rs deleted file mode 100644 index 44503aed..00000000 --- a/gear-programs/grc20-gateway/src/lib.rs +++ /dev/null @@ -1,44 +0,0 @@ -#![no_std] - -use gstd::prelude::*; -use parity_scale_codec::{Decode, Encode}; -use scale_info::TypeInfo; - -pub use primitive_types::{H160, U256}; - -#[cfg(not(feature = "std"))] -mod wasm; - -pub mod vara2eth { - use super::*; - - #[derive(Debug, Decode, Encode, TypeInfo)] - pub struct Request { - pub receiver: H160, - pub token_id: H160, - pub amount: U256, - } - - impl Request { - pub fn pack(self) -> Vec { - const U256_BYTES: usize = 256 / 8; - const AMOUNT_OFFSET: usize = 160 / 8 + 160 / 8; - - let mut packed = [ - self.receiver.as_bytes(), - self.token_id.as_bytes(), - &[0; U256_BYTES], - ] - .concat(); - - self.amount.to_big_endian(&mut packed[AMOUNT_OFFSET..]); - - packed - } - } - - #[derive(Debug, Decode, Encode, TypeInfo)] - pub struct Response { - pub nonce: U256, - } -} diff --git a/gear-programs/grc20-gateway/src/wasm.rs b/gear-programs/grc20-gateway/src/wasm.rs deleted file mode 100644 index 0bc59044..00000000 --- a/gear-programs/grc20-gateway/src/wasm.rs +++ /dev/null @@ -1,16 +0,0 @@ -use super::*; -use gstd::{msg, prelude::*}; -use primitive_types::U256; - -#[no_mangle] -extern "C" fn init() {} - -#[no_mangle] -extern "C" fn handle() { - msg::reply( - vara2eth::Response { - nonce: U256::zero(), - }, - 0, - ); -} diff --git a/gear-programs/vft-gateway/Cargo.toml b/gear-programs/vft-gateway/Cargo.toml new file mode 100644 index 00000000..cbaeaa9c --- /dev/null +++ b/gear-programs/vft-gateway/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "vft-gateway-app" +version.workspace = true +edition.workspace = true + +[dependencies] +sails-rs.workspace = true +parity-scale-codec.workspace = true +scale-info.workspace = true +gstd.workspace = true +gbuiltin-eth-bridge.workspace = true + +[build-dependencies] +git-download.workspace = true +sails-client-gen.workspace = true + +[dev-dependencies] +gclient.workspace = true +tokio.workspace = true +blake2.workspace = true +gear-core.workspace = true +primitive-types.workspace = true diff --git a/gear-programs/vft-gateway/build.rs b/gear-programs/vft-gateway/build.rs new file mode 100644 index 00000000..e5d56e93 --- /dev/null +++ b/gear-programs/vft-gateway/build.rs @@ -0,0 +1,20 @@ +use sails_client_gen::ClientGenerator; +use std::{env, path::PathBuf}; + +fn main() { + let out_dir_path = PathBuf::from(env::var("OUT_DIR").unwrap()); + + let idl_file_path = out_dir_path.join("vft.idl"); + + let client_rs_file_path = out_dir_path.join("vft.rs"); + + git_download::repo("https://github.com/gear-foundation/standards") + .branch_name("master") + .add_file("extended-vft/wasm/extended_vft.idl", &idl_file_path) + .exec() + .unwrap(); + + ClientGenerator::from_idl_path(&idl_file_path) + .generate_to(client_rs_file_path) + .unwrap(); +} diff --git a/gear-programs/vft-gateway/src/lib.rs b/gear-programs/vft-gateway/src/lib.rs new file mode 100644 index 00000000..93c4fb03 --- /dev/null +++ b/gear-programs/vft-gateway/src/lib.rs @@ -0,0 +1,19 @@ +#![no_std] + +use sails_rs::{gstd::GStdExecContext, prelude::*}; +pub mod services; +use services::{InitConfig, VftGateway}; +#[derive(Default)] +pub struct Program; + +#[program] +impl Program { + pub fn new(init_config: InitConfig) -> Self { + VftGateway::::seed(init_config, GStdExecContext::new()); + Self + } + + pub fn vft_gateway(&self) -> VftGateway { + VftGateway::new(GStdExecContext::new()) + } +} diff --git a/gear-programs/vft-gateway/src/services/bridge_builtin_operations.rs b/gear-programs/vft-gateway/src/services/bridge_builtin_operations.rs new file mode 100644 index 00000000..9f4cae0e --- /dev/null +++ b/gear-programs/vft-gateway/src/services/bridge_builtin_operations.rs @@ -0,0 +1,62 @@ +use super::{msg_tracker_mut, utils, Config, Error, MessageStatus}; +use gstd::MessageId; +use sails_rs::prelude::*; + +pub async fn send_message_to_bridge_builtin( + gear_bridge_builtin: ActorId, + receiver_contract_address: H160, + receiver: H160, + token_id: H160, + amount: U256, + config: &Config, + msg_id: MessageId, +) -> Result { + msg_tracker_mut().update_message_status(msg_id, MessageStatus::SendingMessageToBridgeBuiltin); + + let payload_bytes = Payload { + receiver, + token_id, + amount, + } + .pack(); + + let bytes = gbuiltin_eth_bridge::Request::SendEthMessage { + destination: receiver_contract_address, + payload: payload_bytes, + } + .encode(); + + utils::set_critical_hook(msg_id); + utils::send_message_with_gas_for_reply( + gear_bridge_builtin, + bytes, + config.gas_to_send_request_to_builtin, + config.gas_for_reply_deposit, + config.reply_timeout, + msg_id, + ) + .await?; + msg_tracker_mut().check_bridge_reply(&msg_id) +} + +#[derive(Debug, Decode, Encode, TypeInfo)] +pub struct Payload { + pub receiver: H160, + pub token_id: H160, + pub amount: U256, +} + +impl Payload { + pub fn pack(self) -> Vec { + let mut packed = Vec::with_capacity(20 + 20 + 32); // H160 is 20 bytes, U256 is 32 bytes + + packed.extend_from_slice(self.receiver.as_bytes()); + packed.extend_from_slice(self.token_id.as_bytes()); + + let mut amount_bytes = [0u8; 32]; + self.amount.to_big_endian(&mut amount_bytes); + packed.extend_from_slice(&amount_bytes); + + packed + } +} diff --git a/gear-programs/vft-gateway/src/services/error.rs b/gear-programs/vft-gateway/src/services/error.rs new file mode 100644 index 00000000..1c9c17d9 --- /dev/null +++ b/gear-programs/vft-gateway/src/services/error.rs @@ -0,0 +1,24 @@ +use sails_rs::prelude::*; + +#[derive(Debug, Encode, Decode, TypeInfo, Clone, PartialEq, Eq)] +pub enum Error { + SendFailure, + ReplyFailure, + BurnTokensDecode, + BurnFailure, + RequestToBuiltinSend, + RequestToBuiltinReply, + BuiltinDecode, + PayloadSize, + MintTokensDecode, + ReplyTimeout, + MintFailure, + NoCorrespondingEthAddress, + ReplyHook, + MessageNotFound, + InvalidMessageStatus, + MessageFailed, + BurnTokensFailed, + BridgeBuiltinMessageFailed, + TokensRefunded, +} diff --git a/gear-programs/vft-gateway/src/services/mod.rs b/gear-programs/vft-gateway/src/services/mod.rs new file mode 100644 index 00000000..197839c4 --- /dev/null +++ b/gear-programs/vft-gateway/src/services/mod.rs @@ -0,0 +1,354 @@ +use collections::HashMap; +use sails_rs::{gstd::ExecContext, prelude::*}; + +mod bridge_builtin_operations; +pub mod error; +pub mod msg_tracker; +mod utils; +mod vft; +use error::Error; +use msg_tracker::{MessageInfo, MessageStatus, MessageTracker}; +mod token_operations; + +pub struct VftGateway { + exec_context: ExecContext, +} + +#[derive(Debug, Decode, Encode, TypeInfo)] +pub struct Request { + pub receiver: H160, + pub token_id: H160, + pub amount: U256, +} + +static mut DATA: Option = None; +static mut CONFIG: Option = None; +static mut MSG_TRACKER: Option = None; + +#[derive(Debug, Default)] +pub struct VftGatewayData { + gear_bridge_builtin: ActorId, + admin: ActorId, + receiver_contract_address: H160, + vara_to_eth_token_id: HashMap, +} + +#[derive(Debug, Decode, Encode, TypeInfo)] +pub struct InitConfig { + pub receiver_contract_address: H160, + pub gear_bridge_builtin: ActorId, + pub config: Config, +} + +impl InitConfig { + pub fn new( + receiver_contract_address: H160, + gear_bridge_builtin: ActorId, + config: Config, + ) -> Self { + Self { + receiver_contract_address, + gear_bridge_builtin, + config, + } + } +} + +#[derive(Debug, Decode, Encode, TypeInfo, Clone)] +pub struct Config { + gas_to_burn_tokens: u64, + gas_for_reply_deposit: u64, + gas_to_mint_tokens: u64, + gas_to_send_request_to_builtin: u64, + reply_timeout: u32, + gas_for_transfer_to_eth_msg: u64, +} + +impl Config { + pub fn new( + gas_to_burn_tokens: u64, + gas_for_reply_deposit: u64, + gas_to_mint_tokens: u64, + gas_to_send_request_to_builtin: u64, + reply_timeout: u32, + gas_for_transfer_to_eth_msg: u64, + ) -> Self { + Self { + gas_to_burn_tokens, + gas_for_reply_deposit, + gas_to_mint_tokens, + gas_to_send_request_to_builtin, + reply_timeout, + gas_for_transfer_to_eth_msg, + } + } +} + +#[service] +impl VftGateway +where + T: ExecContext, +{ + pub fn update_receiver_contract_address(&mut self, new_receiver_contract_address: H160) { + if self.data().admin != self.exec_context.actor_id() { + panic!("Not admin") + } + self.data_mut().receiver_contract_address = new_receiver_contract_address; + } + + pub fn map_vara_to_eth_address(&mut self, vara_token_id: ActorId, eth_token_id: H160) { + if self.data().admin != self.exec_context.actor_id() { + panic!("Not admin") + } + self.data_mut() + .vara_to_eth_token_id + .insert(vara_token_id, eth_token_id); + } + + pub fn remove_vara_to_eth_address(&mut self, vara_token_id: ActorId) { + if self.data().admin != self.exec_context.actor_id() { + panic!("Not admin") + } + self.data_mut().vara_to_eth_token_id.remove(&vara_token_id); + } + + pub fn update_config( + &mut self, + gas_to_burn_tokens: Option, + gas_to_mint_tokens: Option, + gas_for_reply_deposit: Option, + gas_to_send_request_to_builtin: Option, + reply_timeout: Option, + gas_for_transfer_to_eth_msg: Option, + ) { + if self.data().admin != self.exec_context.actor_id() { + panic!("Not admin") + } + if let Some(gas_to_burn_tokens) = gas_to_burn_tokens { + self.config_mut().gas_to_burn_tokens = gas_to_burn_tokens; + } + + if let Some(gas_to_mint_tokens) = gas_to_mint_tokens { + self.config_mut().gas_to_mint_tokens = gas_to_mint_tokens; + } + + if let Some(gas_to_send_request_to_builtin) = gas_to_send_request_to_builtin { + self.config_mut().gas_to_send_request_to_builtin = gas_to_send_request_to_builtin; + } + + if let Some(reply_timeout) = reply_timeout { + self.config_mut().reply_timeout = reply_timeout; + } + + if let Some(gas_for_reply_deposit) = gas_for_reply_deposit { + self.config_mut().gas_for_reply_deposit = gas_for_reply_deposit; + } + + if let Some(gas_for_transfer_to_eth_msg) = gas_for_transfer_to_eth_msg { + self.config_mut().gas_for_transfer_to_eth_msg = gas_for_transfer_to_eth_msg; + } + } + + pub async fn transfer_vara_to_eth( + &mut self, + vara_token_id: ActorId, + amount: U256, + receiver: H160, + ) -> Result<(U256, H160), Error> { + let data = self.data(); + let sender = self.exec_context.actor_id(); + let msg_id = gstd::msg::id(); + + let eth_token_id = self.get_eth_token_id(&vara_token_id)?; + let config = self.config(); + + if gstd::exec::gas_available() + < config.gas_to_burn_tokens + + config.gas_to_send_request_to_builtin + + config.gas_for_transfer_to_eth_msg + + 3 * config.gas_for_reply_deposit + { + panic!("Please attach more gas"); + } + token_operations::burn_tokens(vara_token_id, sender, receiver, amount, config, msg_id) + .await?; + let nonce = match bridge_builtin_operations::send_message_to_bridge_builtin( + data.gear_bridge_builtin, + data.receiver_contract_address, + receiver, + eth_token_id, + amount, + config, + msg_id, + ) + .await + { + Ok(nonce) => nonce, + Err(e) => { + // In case of failure, mint tokens back to the sender + token_operations::mint_tokens(vara_token_id, sender, amount, config, msg_id) + .await?; + return Err(e); + } + }; + Ok((nonce, eth_token_id)) + } + + pub async fn handle_interrupted_transfer( + &mut self, + msg_id: MessageId, + ) -> Result<(U256, H160), Error> { + let data = self.data(); + + let config = self.config(); + let msg_tracker = msg_tracker_mut(); + + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg status does not exist"); + + let (sender, amount, receiver, vara_token_id) = msg_info.details.data(); + let eth_token_id = data + .vara_to_eth_token_id + .get(&vara_token_id) + .expect("No corresponding Ethereum address for the specified Vara token address"); + + match msg_info.status { + MessageStatus::TokenBurnCompleted(true) | MessageStatus::BridgeBuiltinStep => { + match bridge_builtin_operations::send_message_to_bridge_builtin( + data.gear_bridge_builtin, + data.receiver_contract_address, + receiver, + *eth_token_id, + amount, + config, + msg_id, + ) + .await + { + Ok(nonce) => Ok((nonce, *eth_token_id)), + Err(_) => { + // In case of failure, mint tokens back to the sender + token_operations::mint_tokens( + vara_token_id, + sender, + amount, + config, + msg_id, + ) + .await?; + Err(Error::TokensRefunded) + } + } + } + MessageStatus::BridgeResponseReceived(Some(nonce)) => { + msg_tracker_mut().remove_message_info(&msg_id); + Ok((nonce, *eth_token_id)) + } + MessageStatus::MintTokensStep => { + token_operations::mint_tokens(vara_token_id, sender, amount, config, msg_id) + .await?; + Err(Error::TokensRefunded) + } + _ => { + panic!("Unexpected status or transaction completed.") + } + } + } + + pub fn msg_tracker_state(&self) -> Vec<(MessageId, MessageInfo)> { + msg_tracker().message_info.clone().into_iter().collect() + } + + pub fn vara_to_eth_addresses(&self) -> Vec<(ActorId, H160)> { + self.data() + .vara_to_eth_token_id + .clone() + .into_iter() + .collect() + } + + pub fn receiver_contract_address(&self) -> H160 { + self.data().receiver_contract_address + } + + pub fn gear_bridge_builtin(&self) -> ActorId { + self.data().gear_bridge_builtin + } + + pub fn admin(&self) -> ActorId { + self.data().admin + } + + pub fn get_config(&self) -> Config { + self.config().clone() + } +} + +impl VftGateway +where + T: ExecContext, +{ + pub fn seed(config: InitConfig, exec_context: T) { + unsafe { + DATA = Some(VftGatewayData { + gear_bridge_builtin: config.gear_bridge_builtin, + receiver_contract_address: config.receiver_contract_address, + admin: exec_context.actor_id(), + ..Default::default() + }); + CONFIG = Some(config.config); + MSG_TRACKER = Some(MessageTracker::default()); + } + } + pub fn new(exec_context: T) -> Self { + Self { exec_context } + } + + fn data(&self) -> &VftGatewayData { + unsafe { DATA.as_ref().expect("VftGateway::seed() should be called") } + } + + fn data_mut(&mut self) -> &mut VftGatewayData { + unsafe { DATA.as_mut().expect("VftGateway::seed() should be called") } + } + + fn config(&self) -> &Config { + unsafe { + CONFIG + .as_ref() + .expect("VftGateway::seed() should be called") + } + } + + fn config_mut(&mut self) -> &mut Config { + unsafe { + CONFIG + .as_mut() + .expect("VftGateway::seed() should be called") + } + } + + fn get_eth_token_id(&self, vara_token_id: &ActorId) -> Result { + self.data() + .vara_to_eth_token_id + .get(vara_token_id) + .cloned() + .ok_or(Error::NoCorrespondingEthAddress) + } +} +fn msg_tracker() -> &'static MessageTracker { + unsafe { + MSG_TRACKER + .as_ref() + .expect("VftGateway::seed() should be called") + } +} + +fn msg_tracker_mut() -> &'static mut MessageTracker { + unsafe { + MSG_TRACKER + .as_mut() + .expect("VftGateway::seed() should be called") + } +} diff --git a/gear-programs/vft-gateway/src/services/msg_tracker.rs b/gear-programs/vft-gateway/src/services/msg_tracker.rs new file mode 100644 index 00000000..a111f00e --- /dev/null +++ b/gear-programs/vft-gateway/src/services/msg_tracker.rs @@ -0,0 +1,128 @@ +use super::Error; +use gstd::{prelude::collections::HashMap, MessageId}; +use sails_rs::prelude::*; + +#[derive(Default, Debug)] +pub struct MessageTracker { + pub message_info: HashMap, +} + +#[derive(Debug, Clone, Encode, Decode, TypeInfo)] +pub struct MessageInfo { + pub status: MessageStatus, + pub details: TransactionDetails, +} + +#[derive(Debug, Clone, Encode, Decode, TypeInfo)] +pub struct TransactionDetails { + vara_token_id: ActorId, + sender: ActorId, + amount: U256, + receiver: H160, +} + +impl MessageTracker { + pub fn insert_message_info( + &mut self, + msg_id: MessageId, + status: MessageStatus, + details: TransactionDetails, + ) { + self.message_info + .insert(msg_id, MessageInfo { status, details }); + } + + pub fn update_message_status(&mut self, msg_id: MessageId, status: MessageStatus) { + if let Some(info) = self.message_info.get_mut(&msg_id) { + info.status = status; + } + } + + pub fn get_message_info(&self, msg_id: &MessageId) -> Option<&MessageInfo> { + self.message_info.get(msg_id) + } + + pub fn remove_message_info(&mut self, msg_id: &MessageId) -> Option { + self.message_info.remove(msg_id) + } + + pub fn check_burn_result(&mut self, msg_id: &MessageId) -> Result<(), Error> { + if let Some(info) = self.message_info.get(msg_id) { + match info.status { + MessageStatus::TokenBurnCompleted(true) => Ok(()), + MessageStatus::TokenBurnCompleted(false) => { + self.message_info.remove(msg_id); + Err(Error::BurnTokensFailed) + } + _ => Err(Error::InvalidMessageStatus), + } + } else { + Err(Error::MessageNotFound) + } + } + pub fn check_mint_result(&mut self, msg_id: &MessageId) -> Result<(), Error> { + if let Some(info) = self.message_info.get(msg_id) { + match info.status { + MessageStatus::TokenMintCompleted => Ok(()), + MessageStatus::MintTokensStep => Err(Error::MessageFailed), + _ => Err(Error::InvalidMessageStatus), + } + } else { + Err(Error::MessageNotFound) + } + } + + pub fn check_bridge_reply(&mut self, msg_id: &MessageId) -> Result { + if let Some(info) = self.message_info.get(msg_id) { + match info.status { + MessageStatus::BridgeResponseReceived(Some(nonce)) => { + self.remove_message_info(msg_id); + Ok(nonce) + } + MessageStatus::BridgeResponseReceived(None) => { + Err(Error::BridgeBuiltinMessageFailed) + } + _ => Err(Error::InvalidMessageStatus), + } + } else { + Err(Error::MessageNotFound) + } + } +} + +#[derive(Debug, Clone, PartialEq, Encode, Decode, TypeInfo)] +pub enum MessageStatus { + // Burn tokens statuses + SendingMessageToBurnTokens, + TokenBurnCompleted(bool), + WaitingReplyFromBurn, + + // Send message to bridge builtin + SendingMessageToBridgeBuiltin, + BridgeResponseReceived(Option), + WaitingReplyFromBuiltin, + BridgeBuiltinStep, + + // Mint tokens status + SendingMessageToMintTokens, + TokenMintCompleted, + WaitingReplyFromMint, + MintTokensStep, + + MessageProcessedWithSuccess(U256), +} + +impl TransactionDetails { + pub fn new(sender: ActorId, amount: U256, receiver: H160, vara_token_id: ActorId) -> Self { + Self { + vara_token_id, + sender, + amount, + receiver, + } + } + + pub fn data(&self) -> (ActorId, U256, H160, ActorId) { + (self.sender, self.amount, self.receiver, self.vara_token_id) + } +} diff --git a/gear-programs/vft-gateway/src/services/token_operations.rs b/gear-programs/vft-gateway/src/services/token_operations.rs new file mode 100644 index 00000000..ca78ead1 --- /dev/null +++ b/gear-programs/vft-gateway/src/services/token_operations.rs @@ -0,0 +1,59 @@ +use super::msg_tracker::TransactionDetails; +use super::{msg_tracker_mut, utils, vft::vft::io as vft_io, Config, Error, MessageStatus}; + +use sails_rs::prelude::*; + +pub async fn burn_tokens( + token_id: ActorId, + sender: ActorId, + receiver: H160, + amount: U256, + config: &Config, + msg_id: MessageId, +) -> Result<(), Error> { + let bytes: Vec = vft_io::Burn::encode_call(sender, amount); + + let transaction_details = TransactionDetails::new(sender, amount, receiver, token_id); + + msg_tracker_mut().insert_message_info( + msg_id, + MessageStatus::SendingMessageToBurnTokens, + transaction_details, + ); + + utils::set_critical_hook(msg_id); + utils::send_message_with_gas_for_reply( + token_id, + bytes, + config.gas_to_burn_tokens, + config.gas_for_reply_deposit, + config.reply_timeout, + msg_id, + ) + .await?; + msg_tracker_mut().check_burn_result(&msg_id) +} + +pub async fn mint_tokens( + token_id: ActorId, + sender: ActorId, + amount: U256, + config: &Config, + msg_id: MessageId, +) -> Result<(), Error> { + msg_tracker_mut().update_message_status(msg_id, MessageStatus::SendingMessageToMintTokens); + + let bytes: Vec = vft_io::Mint::encode_call(sender, amount); + + utils::send_message_with_gas_for_reply( + token_id, + bytes, + config.gas_to_mint_tokens, + config.gas_for_reply_deposit, + config.reply_timeout, + msg_id, + ) + .await?; + + msg_tracker_mut().check_mint_result(&msg_id) +} diff --git a/gear-programs/vft-gateway/src/services/utils.rs b/gear-programs/vft-gateway/src/services/utils.rs new file mode 100644 index 00000000..28c3a60e --- /dev/null +++ b/gear-programs/vft-gateway/src/services/utils.rs @@ -0,0 +1,139 @@ +use super::{error::Error, msg_tracker_mut, vft::vft::io as vft_io, MessageStatus}; +use gstd::{msg, MessageId}; +use sails_rs::calls::ActionIo; +use sails_rs::prelude::*; + +pub fn set_critical_hook(msg_id: MessageId) { + gstd::critical::set_hook(move || { + let msg_tracker = msg_tracker_mut(); + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg info does not exist"); + + match msg_info.status { + MessageStatus::SendingMessageToBurnTokens => { + // If still sending, transition to `WaitingReplyFromBurn`. + msg_tracker.update_message_status(msg_id, MessageStatus::WaitingReplyFromBurn); + } + MessageStatus::TokenBurnCompleted(true) => { + // If the token transfer is successful, continue to bridge builtin step. + msg_tracker.update_message_status(msg_id, MessageStatus::BridgeBuiltinStep); + } + MessageStatus::TokenBurnCompleted(false) => { + // If the token burn fails, cancel the transaction. + msg_tracker.remove_message_info(&msg_id); + } + MessageStatus::SendingMessageToBridgeBuiltin => { + // If still sending, transition to `WaitingReplyFromBurn`. + msg_tracker.update_message_status(msg_id, MessageStatus::WaitingReplyFromBuiltin); + } + MessageStatus::BridgeResponseReceived(None) => { + // If error occurs during builtin message, go to mint step + msg_tracker.update_message_status(msg_id, MessageStatus::MintTokensStep) + } + MessageStatus::SendingMessageToMintTokens => { + msg_tracker.update_message_status(msg_id, MessageStatus::WaitingReplyFromMint); + } + _ => {} + }; + }); +} + +pub async fn send_message_with_gas_for_reply( + destination: ActorId, + message: Vec, + gas_to_send: u64, + gas_deposit: u64, + reply_timeout: u32, + msg_id: MessageId, +) -> Result<(), Error> { + gstd::msg::send_bytes_with_gas_for_reply(destination, message, gas_to_send, 0, gas_deposit) + .map_err(|_| Error::SendFailure)? + .up_to(Some(reply_timeout)) + .map_err(|_| Error::ReplyTimeout)? + .handle_reply(move || handle_reply_hook(msg_id)) + .map_err(|_| Error::ReplyHook)? + .await + .map_err(|_| Error::ReplyFailure)?; + Ok(()) +} + +fn handle_reply_hook(msg_id: MessageId) { + let msg_tracker = msg_tracker_mut(); + + let msg_info = msg_tracker + .get_message_info(&msg_id) + .expect("Unexpected: msg info does not exist"); + let reply_bytes = msg::load_bytes().expect("Unable to load bytes"); + + match msg_info.status { + MessageStatus::SendingMessageToBurnTokens => { + match decode_burn_reply(&reply_bytes) { + Ok(reply) => { + msg_tracker + .update_message_status(msg_id, MessageStatus::TokenBurnCompleted(reply)); + } + Err(_) => { + msg_tracker.remove_message_info(&msg_id); + } + }; + } + MessageStatus::WaitingReplyFromBurn => { + let reply = decode_burn_reply(&reply_bytes).unwrap_or(false); + if reply { + msg_tracker.update_message_status(msg_id, MessageStatus::BridgeBuiltinStep); + } else { + msg_tracker.remove_message_info(&msg_id); + } + } + MessageStatus::SendingMessageToBridgeBuiltin => { + let reply = decode_bridge_reply(&reply_bytes); + let result = match reply { + Ok(Some(nonce)) => Some(nonce), + _ => None, + }; + msg_tracker + .update_message_status(msg_id, MessageStatus::BridgeResponseReceived(result)); + } + MessageStatus::WaitingReplyFromBuiltin => { + let reply = decode_bridge_reply(&reply_bytes); + match reply { + Ok(Some(nonce)) => { + msg_tracker.update_message_status( + msg_id, + MessageStatus::MessageProcessedWithSuccess(nonce), + ); + } + _ => { + msg_tracker.update_message_status(msg_id, MessageStatus::MintTokensStep); + } + }; + } + MessageStatus::WaitingReplyFromMint | MessageStatus::SendingMessageToMintTokens => { + let reply = decode_mint_reply(&reply_bytes).unwrap_or(false); + if !reply { + msg_tracker.update_message_status(msg_id, MessageStatus::MintTokensStep); + } else { + msg_tracker.update_message_status(msg_id, MessageStatus::TokenMintCompleted); + } + } + _ => {} + }; +} + +fn decode_burn_reply(bytes: &[u8]) -> Result { + vft_io::Burn::decode_reply(bytes).map_err(|_| Error::BurnTokensDecode) +} + +fn decode_bridge_reply(mut bytes: &[u8]) -> Result, Error> { + let reply = + gbuiltin_eth_bridge::Response::decode(&mut bytes).map_err(|_| Error::BuiltinDecode)?; + + match reply { + gbuiltin_eth_bridge::Response::EthMessageQueued { nonce, .. } => Ok(Some(nonce)), + } +} + +fn decode_mint_reply(bytes: &[u8]) -> Result { + vft_io::Mint::decode_reply(bytes).map_err(|_| Error::MintTokensDecode) +} diff --git a/gear-programs/vft-gateway/src/services/vft.rs b/gear-programs/vft-gateway/src/services/vft.rs new file mode 100644 index 00000000..3887cc79 --- /dev/null +++ b/gear-programs/vft-gateway/src/services/vft.rs @@ -0,0 +1,6 @@ +mod vft_module { + #![allow(dead_code)] + include!(concat!(env!("OUT_DIR"), "/vft.rs")); +} + +pub use vft_module::*; diff --git a/gear-programs/vft-gateway/src/wasm/Cargo.toml b/gear-programs/vft-gateway/src/wasm/Cargo.toml new file mode 100644 index 00000000..e9c3211d --- /dev/null +++ b/gear-programs/vft-gateway/src/wasm/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "vft_gateway_wasm" +version.workspace = true +edition.workspace = true + +[dependencies] +vft-gateway-app.workspace = true +sails-rs.workspace = true + +[build-dependencies] +gwasm-builder.workspace = true +sails-idl-gen.workspace = true +vft-gateway-app.workspace = true +sails-client-gen.workspace = true + +[dev-dependencies] +gtest.workspace = true +vft-gateway-app.workspace = true +parity-scale-codec.workspace = true +scale-info.workspace = true +sails-rs.workspace = true +tokio.workspace = true +blake2 = { version = "0.10.6", default-features = false } +gear-core.workspace = true +extended_vft_wasm.workspace = true diff --git a/gear-programs/vft-gateway/src/wasm/build.rs b/gear-programs/vft-gateway/src/wasm/build.rs new file mode 100644 index 00000000..ca587a34 --- /dev/null +++ b/gear-programs/vft-gateway/src/wasm/build.rs @@ -0,0 +1,20 @@ +use sails_client_gen::ClientGenerator; +use sails_idl_gen::program; +use std::{env, fs::File, path::PathBuf}; +use vft_gateway_app::Program; + +fn main() { + gwasm_builder::build(); + + let manifest_dir_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + + let idl_file_path = manifest_dir_path.join("vft-gateway.idl"); + + let idl_file = File::create(idl_file_path.clone()).unwrap(); + + program::generate_idl::(idl_file).unwrap(); + + ClientGenerator::from_idl_path(&idl_file_path) + .generate_to(PathBuf::from(env::var("OUT_DIR").unwrap()).join("vft_gateway_client.rs")) + .unwrap(); +} diff --git a/gear-programs/vft-gateway/src/wasm/src/lib.rs b/gear-programs/vft-gateway/src/wasm/src/lib.rs new file mode 100644 index 00000000..ae989fac --- /dev/null +++ b/gear-programs/vft-gateway/src/wasm/src/lib.rs @@ -0,0 +1,6 @@ +#![no_std] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +include!(concat!(env!("OUT_DIR"), "/vft_gateway_client.rs")); + +#[cfg(target_arch = "wasm32")] +pub use vft_gateway_app::wasm::*; diff --git a/gear-programs/vft-gateway/src/wasm/tests/utils.rs b/gear-programs/vft-gateway/src/wasm/tests/utils.rs new file mode 100644 index 00000000..7752da1a --- /dev/null +++ b/gear-programs/vft-gateway/src/wasm/tests/utils.rs @@ -0,0 +1,250 @@ +use extended_vft_wasm::WASM_BINARY as TOKEN_WASM_BINARY; +use gtest::{Program, System, WasmProgram}; +use sails_rs::prelude::*; +use vft_gateway_app::services::{error::Error, msg_tracker::MessageInfo, Config, InitConfig}; + +pub const ADMIN_ID: u64 = 1000; +pub const TOKEN_ID: u64 = 200; +pub const BRIDGE_BUILTIN_ID: u64 = 300; + +// Mocks for programs +macro_rules! create_mock { + ($name:ident, $handle_result:expr) => { + #[derive(Debug)] + pub struct $name; + + impl WasmProgram for $name { + fn init(&mut self, _payload: Vec) -> Result>, &'static str> { + Ok(None) + } + + fn handle(&mut self, _payload: Vec) -> Result>, &'static str> { + $handle_result + } + + fn handle_reply(&mut self, _payload: Vec) -> Result<(), &'static str> { + unimplemented!() + } + + fn handle_signal(&mut self, _payload: Vec) -> Result<(), &'static str> { + unimplemented!() + } + + fn state(&mut self) -> Result, &'static str> { + unimplemented!() + } + } + }; +} + +create_mock!(FTMockError, Err("Error")); +create_mock!(FTMockWrongReply, Ok(None)); +create_mock!( + FTMockReturnsFalse, + Ok(Some( + ["Vft".encode(), "Burn".encode(), false.encode()].concat() + )) +); +create_mock!( + FTMockReturnsTrue, + Ok(Some( + ["Vft".encode(), "Burn".encode(), true.encode()].concat() + )) +); + +#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)] +pub enum Response { + MessageSent { nonce: U256, hash: H256 }, +} + +create_mock!( + GearBridgeBuiltinMock, + Ok(Some( + Response::MessageSent { + nonce: U256::from(1), + hash: [1; 32].into(), + } + .encode(), + )) +); +create_mock!(GearBridgeBuiltinMockPanic, Err("Error")); + +pub trait Token { + fn token(system: &System, id: u64) -> Program<'_>; + fn mint(&self, from: u64, to: ActorId, value: U256); + fn grant_burner_role(&self, from: u64, to: ActorId); + fn grant_minter_role(&self, from: u64, to: ActorId); + fn balance_of(&self, account: ActorId) -> U256; +} + +impl Token for Program<'_> { + fn token(system: &System, id: u64) -> Program<'_> { + let token = Program::from_binary_with_id(system, id, TOKEN_WASM_BINARY); + let payload = ["New".encode(), ("Token", "Token", 18).encode()].concat(); + let result = token.send_bytes(ADMIN_ID, payload); + assert!(!result.main_failed()); + token + } + + fn mint(&self, from: u64, to: ActorId, value: U256) { + let payload = ["Vft".encode(), "Mint".encode(), (to, value).encode()].concat(); + assert!(!self.send_bytes(from, payload).main_failed()); + } + + fn grant_burner_role(&self, from: u64, to: ActorId) { + let payload = ["Vft".encode(), "GrantBurnerRole".encode(), to.encode()].concat(); + assert!(!self.send_bytes(from, payload).main_failed()); + } + + fn grant_minter_role(&self, from: u64, to: ActorId) { + let payload = ["Vft".encode(), "GrantMinterRole".encode(), to.encode()].concat(); + assert!(!self.send_bytes(from, payload).main_failed()); + } + + fn balance_of(&self, account: ActorId) -> U256 { + let query = ["Vft".encode(), "BalanceOf".encode(), account.encode()].concat(); + let result = self.send_bytes(ADMIN_ID, query.clone()); + + let log_entry = result + .log() + .iter() + .find(|log_entry| log_entry.destination() == ADMIN_ID.into()) + .expect("Unable to get query reply"); + + let query_reply = <(String, String, U256)>::decode(&mut log_entry.payload()) + .expect("Unable to decode reply"); + query_reply.2 + } +} + +pub trait VftGateway { + fn vft_gateway(system: &System) -> Program<'_>; + fn map_vara_to_eth_address(&self, from: u64, vara_token_id: ActorId, eth_token_id: H160); + fn transfer_vara_to_eth( + &self, + from: u64, + vara_token_id: ActorId, + amount: U256, + receiver: H160, + with_gas: u64, + panic: bool, + ) -> Result<(U256, H160), Error>; + fn handle_interrupted_transfer( + &self, + from: u64, + msg_id: MessageId, + ) -> Result<(U256, H160), Error>; + fn get_msg_tracker_state(&self) -> Vec<(MessageId, MessageInfo)>; +} + +impl VftGateway for Program<'_> { + fn vft_gateway(system: &System) -> Program<'_> { + let program = Program::current(system); + let init_config = InitConfig::new( + [1; 20].into(), + BRIDGE_BUILTIN_ID.into(), + Config::new( + 2_000_000_000, + 15_000_000_000, + 15_000_000_000, + 15_000_000_000, + 100, + 20_000_000_000, + ), + ); + let payload = ["New".encode(), init_config.encode()].concat(); + let result = program.send_bytes(ADMIN_ID, payload); + assert!(!result.main_failed()); + program + } + + fn map_vara_to_eth_address(&self, from: u64, vara_token_id: ActorId, eth_token_id: H160) { + let payload = [ + "VftGateway".encode(), + "MapVaraToEthAddress".encode(), + (vara_token_id, eth_token_id).encode(), + ] + .concat(); + + let result = self.send_bytes(from, payload); + + assert!(!result.main_failed()); + } + + fn transfer_vara_to_eth( + &self, + from: u64, + vara_token_id: ActorId, + amount: U256, + receiver: H160, + with_gas: u64, + panic: bool, + ) -> Result<(U256, H160), Error> { + let payload = [ + "VftGateway".encode(), + "TransferVaraToEth".encode(), + (vara_token_id, amount, receiver).encode(), + ] + .concat(); + + let result = self.send_bytes_with_gas(from, payload, with_gas, 0); + if panic { + assert!(result.main_failed()); + Err(Error::MessageFailed) + } else { + let log_entry = result + .log() + .iter() + .find(|log_entry| log_entry.destination() == from.into()) + .expect("Unable to get reply"); + + let reply = + <(String, String, Result<(U256, H160), Error>)>::decode(&mut log_entry.payload()) + .expect("Unable to decode reply"); // Panic if decoding fails + + reply.2 + } + } + + fn handle_interrupted_transfer( + &self, + from: u64, + msg_id: MessageId, + ) -> Result<(U256, H160), Error> { + let payload = [ + "VftGateway".encode(), + "HandleInterruptedTransfer".encode(), + msg_id.encode(), + ] + .concat(); + let result = self.send_bytes(from, payload); + let log_entry = result + .log() + .iter() + .find(|log_entry| log_entry.destination() == from.into()) + .expect("Unable to get reply"); + + let reply = + <(String, String, Result<(U256, H160), Error>)>::decode(&mut log_entry.payload()) + .expect("Unable to decode reply"); // Panic if decoding fails + + reply.2 + } + + fn get_msg_tracker_state(&self) -> Vec<(MessageId, MessageInfo)> { + let payload = ["VftGateway".encode(), "MsgTrackerState".encode()].concat(); + + let result = self.send_bytes(ADMIN_ID, payload); + let log_entry = result + .log() + .iter() + .find(|log_entry| log_entry.destination() == ADMIN_ID.into()) + .expect("Unable to get reply"); + + let reply = + <(String, String, Vec<(MessageId, MessageInfo)>)>::decode(&mut log_entry.payload()) + .expect("Unable to decode reply"); // Panic if decoding fails + + reply.2 + } +} diff --git a/gear-programs/vft-gateway/src/wasm/tests/vft_gateway.rs b/gear-programs/vft-gateway/src/wasm/tests/vft_gateway.rs new file mode 100644 index 00000000..e3399b4e --- /dev/null +++ b/gear-programs/vft-gateway/src/wasm/tests/vft_gateway.rs @@ -0,0 +1,270 @@ +use gtest::{Program, System}; + +use sails_rs::prelude::*; +use vft_gateway_app::services::{error::Error, msg_tracker::MessageStatus}; + +mod utils; +use blake2::{digest::typenum::U32, Blake2b, Digest}; +use utils::{ + FTMockError, FTMockReturnsFalse, GearBridgeBuiltinMock, GearBridgeBuiltinMockPanic, Token, + VftGateway, ADMIN_ID, BRIDGE_BUILTIN_ID, TOKEN_ID, +}; +type Blake2b256 = Blake2b; +use gear_core::ids::ProgramId; +#[test] +fn test_successful_transfer_vara_to_eth() { + let system = System::new(); + system.init_logger(); + + let vft = Program::token(&system, TOKEN_ID); + let gear_bridge_builtin = + Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + assert!(!gear_bridge_builtin + .send_bytes(ADMIN_ID, b"INIT") + .main_failed()); + + let vft_gateway = Program::vft_gateway(&system); + + let account_id: u64 = 10000; + let amount = U256::from(10_000_000_000_u64); + let gas = 100_000_000_000; + + vft.mint(ADMIN_ID, account_id.into(), amount); + vft.grant_burner_role(ADMIN_ID, vft_gateway.id()); + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + + let reply = + vft_gateway.transfer_vara_to_eth(account_id, vft.id(), amount, [3; 20].into(), gas, false); + let exp_reply: Result<(U256, H160), Error> = Ok((U256::from(1), H160::from([2; 20]))); + assert_eq!(reply, exp_reply); + let msg_tracker = vft_gateway.get_msg_tracker_state(); + assert!(msg_tracker.is_empty()); +} + +// error in token +#[tokio::test] +async fn test_transfer_fails_due_to_token_panic() { + let system = System::new(); + system.init_logger(); + + let vft = Program::mock_with_id(&system, TOKEN_ID, FTMockError); + assert!(!vft.send_bytes(ADMIN_ID, b"INI").main_failed()); + let gear_bridge_builtin = + Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + assert!(!gear_bridge_builtin + .send_bytes(ADMIN_ID, b"INIT") + .main_failed()); + + let vft_gateway = Program::vft_gateway(&system); + + let account_id: u64 = 10000; + let amount = U256::from(10_000_000_000_u64); + let gas = 100_000_000_000; + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + let reply = + vft_gateway.transfer_vara_to_eth(account_id, vft.id(), amount, [3; 20].into(), gas, false); + assert_eq!(reply, Err(Error::ReplyFailure)); + + let msg_tracker = vft_gateway.get_msg_tracker_state(); + assert!(msg_tracker.is_empty()); +} + +#[tokio::test] +async fn test_transfer_fails_due_to_token_rejecting_request() { + let system: System = System::new(); + system.init_logger(); + + let vft = Program::mock_with_id(&system, TOKEN_ID, FTMockReturnsFalse); + assert!(!vft.send_bytes(ADMIN_ID, b"INI").main_failed()); + let gear_bridge_builtin = + Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + assert!(!gear_bridge_builtin + .send_bytes(ADMIN_ID, b"INIT") + .main_failed()); + + let vft_gateway = Program::vft_gateway(&system); + + let account_id: u64 = 10000; + let amount = U256::from(10_000_000_000_u64); + let gas = 100_000_000_000; + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + let reply = + vft_gateway.transfer_vara_to_eth(account_id, vft.id(), amount, [3; 20].into(), gas, false); + assert_eq!(reply, Err(Error::BurnTokensFailed)); + + let msg_tracker = vft_gateway.get_msg_tracker_state(); + assert!(msg_tracker.is_empty()); +} + +#[tokio::test] +async fn test_bridge_builtin_panic_with_token_mint() { + let system: System = System::new(); + system.init_logger(); + + let vft = Program::token(&system, TOKEN_ID); + let gear_bridge_builtin = + Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMockPanic); + assert!(!gear_bridge_builtin + .send_bytes(ADMIN_ID, b"INIT") + .main_failed()); + + let vft_gateway = Program::vft_gateway(&system); + + let account_id: u64 = 10000; + let amount = U256::from(10_000_000_000_u64); + let gas = 100_000_000_000; + + vft.mint(ADMIN_ID, account_id.into(), amount); + vft.grant_burner_role(ADMIN_ID, vft_gateway.id()); + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + let reply = + vft_gateway.transfer_vara_to_eth(account_id, vft.id(), amount, [3; 20].into(), gas, false); + assert_eq!(reply, Err(Error::ReplyFailure)); + + let msg_tracker = vft_gateway.get_msg_tracker_state(); + assert_eq!(msg_tracker[0].1.status, MessageStatus::MintTokensStep); + + // grant minter role and continue transaction + vft.grant_minter_role(ADMIN_ID, vft_gateway.id()); + + let reply = vft_gateway.handle_interrupted_transfer(account_id, msg_tracker[0].0); + assert_eq!(reply, Err(Error::TokensRefunded)); +} + +#[tokio::test] +async fn test_multiple_transfers() { + let system = System::new(); + system.init_logger(); + + let vft = Program::token(&system, TOKEN_ID); + let bridge_build_in = Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + assert!(!bridge_build_in.send_bytes(ADMIN_ID, b"INIT").main_failed()); + let vft_gateway = Program::vft_gateway(&system); + + let account_id1: u64 = 10001; + let account_id2: u64 = 10002; + let amount1 = U256::from(10_000_000_000_u64); + let amount2 = U256::from(5_000_000_000_u64); + let gas = 100_000_000_000; + + vft.mint(ADMIN_ID, account_id1.into(), amount1); + vft.mint(ADMIN_ID, account_id2.into(), amount2); + vft.grant_burner_role(ADMIN_ID, vft_gateway.id()); + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + + // Execute multiple transfers simultaneously + let reply1 = vft_gateway.transfer_vara_to_eth( + account_id1, + vft.id(), + amount1, + [3; 20].into(), + gas, + false, + ); + let reply2 = vft_gateway.transfer_vara_to_eth( + account_id2, + vft.id(), + amount2, + [4; 20].into(), + gas, + false, + ); + + assert_eq!(reply1, Ok((U256::from(1), H160::from([2; 20])))); + assert_eq!(reply2, Ok((U256::from(1), H160::from([2; 20])))); +} + +#[test] +fn test_transfer_vara_to_eth_insufficient_balance() { + let system = System::new(); + system.init_logger(); + + let vft = Program::token(&system, TOKEN_ID); + let gear_bridge_builtin = + Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + assert!(!gear_bridge_builtin + .send_bytes(ADMIN_ID, b"INIT") + .main_failed()); + + let vft_gateway = Program::vft_gateway(&system); + + let account_id: u64 = 10000; + let amount = U256::from(10_000_000_000_u64); + let excessive_amount = U256::from(20_000_000_000_u64); // More than the available balance + let gas = 100_000_000_000; + + vft.mint(ADMIN_ID, account_id.into(), amount); + vft.grant_burner_role(ADMIN_ID, vft_gateway.id()); + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + + let reply = vft_gateway.transfer_vara_to_eth( + account_id, + vft.id(), + excessive_amount, + [3; 20].into(), + gas, + false, + ); + assert_eq!(reply, Err(Error::ReplyFailure)); + + let balance = vft.balance_of(account_id.into()); + assert_eq!(balance, amount); // Balance should remain unchanged +} + +#[ignore] +#[tokio::test] +async fn test_transfer_fails_due_to_gas_depletion_after_bridge_reply() { + let system = System::new(); + system.init_logger(); + + let vft = Program::token(&system, TOKEN_ID); + let bridge_build_in = Program::mock_with_id(&system, BRIDGE_BUILTIN_ID, GearBridgeBuiltinMock); + assert!(!bridge_build_in.send_bytes(ADMIN_ID, b"INIT").main_failed()); + let vft_gateway = Program::vft_gateway(&system); + + let account_id: u64 = 10001; + let amount = U256::from(10_000_000_000_u64); + let gas = 50_000_000_000; + + vft.mint(ADMIN_ID, account_id.into(), amount); + vft.grant_burner_role(ADMIN_ID, vft_gateway.id()); + + vft_gateway.map_vara_to_eth_address(ADMIN_ID, vft.id(), [2; 20].into()); + + // gas ended after contract receives reply from bridge builtin + + let reply = + vft_gateway.transfer_vara_to_eth(account_id, vft.id(), amount, [3; 20].into(), gas, true); + assert_eq!(reply, Err(Error::MessageFailed)); + + let msg_tracker = vft_gateway.get_msg_tracker_state(); + assert_eq!( + msg_tracker[0].1.status, + MessageStatus::BridgeResponseReceived(Some(U256::one())) + ); + + let reply = vft_gateway.handle_interrupted_transfer(account_id, msg_tracker[0].0); + let exp_reply: Result<(U256, H160), Error> = Ok((U256::from(1), H160::from([2; 20]))); + assert_eq!(reply, exp_reply); + let msg_tracker = vft_gateway.get_msg_tracker_state(); + assert!(msg_tracker.is_empty()); +} + +#[test] +fn calculate_bridge_builtint() { + let bytes = hash((b"built/in", 3).encode().as_slice()); + let program_id: ProgramId = bytes.into(); + println!("{:?}", program_id); +} + +pub fn hash(data: &[u8]) -> [u8; 32] { + let mut ctx = Blake2b256::new(); + ctx.update(data); + ctx.finalize().into() +} diff --git a/gear-programs/vft-gateway/src/wasm/vft-gateway.idl b/gear-programs/vft-gateway/src/wasm/vft-gateway.idl new file mode 100644 index 00000000..16781891 --- /dev/null +++ b/gear-programs/vft-gateway/src/wasm/vft-gateway.idl @@ -0,0 +1,83 @@ +type InitConfig = struct { + receiver_contract_address: h160, + gear_bridge_builtin: actor_id, + config: Config, +}; + +type Config = struct { + gas_to_burn_tokens: u64, + gas_for_reply_deposit: u64, + gas_to_mint_tokens: u64, + gas_to_send_request_to_builtin: u64, + reply_timeout: u32, + gas_for_transfer_to_eth_msg: u64, +}; + +type Error = enum { + SendFailure, + ReplyFailure, + BurnTokensDecode, + BurnFailure, + RequestToBuiltinSend, + RequestToBuiltinReply, + BuiltinDecode, + PayloadSize, + MintTokensDecode, + ReplyTimeout, + MintFailure, + NoCorrespondingEthAddress, + ReplyHook, + MessageNotFound, + InvalidMessageStatus, + MessageFailed, + BurnTokensFailed, + BridgeBuiltinMessageFailed, + TokensRefunded, +}; + +type MessageInfo = struct { + status: MessageStatus, + details: TransactionDetails, +}; + +type MessageStatus = enum { + SendingMessageToBurnTokens, + TokenBurnCompleted: bool, + WaitingReplyFromBurn, + SendingMessageToBridgeBuiltin, + BridgeResponseReceived: opt u256, + WaitingReplyFromBuiltin, + BridgeBuiltinStep, + SendingMessageToMintTokens, + TokenMintCompleted, + WaitingReplyFromMint, + MintTokensStep, + MessageProcessedWithSuccess: u256, +}; + +type TransactionDetails = struct { + vara_token_id: actor_id, + sender: actor_id, + amount: u256, + receiver: h160, +}; + +constructor { + New : (init_config: InitConfig); +}; + +service VftGateway { + HandleInterruptedTransfer : (msg_id: message_id) -> result (struct { u256, h160 }, Error); + MapVaraToEthAddress : (vara_token_id: actor_id, eth_token_id: h160) -> null; + RemoveVaraToEthAddress : (vara_token_id: actor_id) -> null; + TransferVaraToEth : (vara_token_id: actor_id, amount: u256, receiver: h160) -> result (struct { u256, h160 }, Error); + UpdateConfig : (gas_to_burn_tokens: opt u64, gas_to_mint_tokens: opt u64, gas_for_reply_deposit: opt u64, gas_to_send_request_to_builtin: opt u64, reply_timeout: opt u32, gas_for_transfer_to_eth_msg: opt u64) -> null; + UpdateReceiverContractAddress : (new_receiver_contract_address: h160) -> null; + query Admin : () -> actor_id; + query GearBridgeBuiltin : () -> actor_id; + query GetConfig : () -> Config; + query MsgTrackerState : () -> vec struct { message_id, MessageInfo }; + query ReceiverContractAddress : () -> h160; + query VaraToEthAddresses : () -> vec struct { actor_id, h160 }; +}; + diff --git a/relayer/src/message_relayer/event_listener.rs b/relayer/src/message_relayer/event_listener.rs index a73c556a..2f254fc6 100644 --- a/relayer/src/message_relayer/event_listener.rs +++ b/relayer/src/message_relayer/event_listener.rs @@ -4,7 +4,7 @@ use std::{ time::Duration, }; -use bridging_payment::UserReply as BridgingPaymentUserReply; +use bridging_payment::services::BridgingPaymentEvents; use gear_rpc_client::GearApi; use parity_scale_codec::Decode; use primitive_types::H256; @@ -148,10 +148,10 @@ impl EventListener { .inc_by(messages.len() as u64); for message in messages { - let user_reply = BridgingPaymentUserReply::decode(&mut &message.payload[..])?; - sender.send(BlockEvent::MessagePaid { - nonce: user_reply.nonce, - })?; + let user_reply = BridgingPaymentEvents::decode(&mut &message.payload[..])?; + let BridgingPaymentEvents::TeleportVaraToEth { nonce, .. } = user_reply; + + sender.send(BlockEvent::MessagePaid { nonce })?; } } }