diff --git a/Cargo.lock b/Cargo.lock index fa07f48..c7b44f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,7 +215,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -361,9 +361,9 @@ checksum = "5d5dde061bd34119e902bbb2d9b90c5692635cf59fb91d582c2b68043f1b8293" [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" @@ -450,9 +450,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" +checksum = "d7ebdfa2ebdab6b1760375fa7d6f382b9f486eac35fc994625a00e89280bdbb7" dependencies = [ "async-task", "concurrent-queue", @@ -562,9 +562,9 @@ dependencies = [ [[package]] name = "async-signal" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794f185324c2f00e771cd9f1ae8b5ac68be2ca7abb129a87afd6e86d228bc54d" +checksum = "dfb3634b73397aa844481f814fad23bbf07fdb0eabec10f2eb95e58944b1ec32" dependencies = [ "async-io 2.3.3", "async-lock 3.4.0", @@ -592,7 +592,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -626,6 +626,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + [[package]] name = "backtrace" version = "0.3.73" @@ -717,7 +723,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -757,7 +763,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ - "funty", + "funty 2.0.0", "radium", "serde", "tap", @@ -819,9 +825,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "e9ec96fe9a81b5e365f9db71fe00edc4fe4ca2cc7dcb7861f0603012a7caa210" dependencies = [ "arrayref", "arrayvec 0.7.4", @@ -861,6 +867,18 @@ dependencies = [ "piper", ] +[[package]] +name = "bounded-collections" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + [[package]] name = "bounded-collections" version = "0.2.0" @@ -911,13 +929,13 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.17" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ - "lazy_static", "memchr", - "regex-automata 0.1.10", + "regex-automata 0.4.7", + "serde", ] [[package]] @@ -967,9 +985,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" [[package]] name = "bzip2-sys" @@ -1026,13 +1044,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.0" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" dependencies = [ "jobserver", "libc", - "once_cell", ] [[package]] @@ -1198,7 +1215,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1910,7 +1927,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1936,7 +1953,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa22d6e479a4d3a2790bab291269ba0917a1ac384255a54a2ebc3f7c37e505e" dependencies = [ - "bounded-collections", + "bounded-collections 0.2.0", "bp-xcm-bridge-hub-router", "cumulus-primitives-core", "frame-benchmarking", @@ -2229,7 +2246,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2269,7 +2286,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2286,7 +2303,7 @@ checksum = "4b2c1c1776b986979be68bb2285da855f8d8a35851a769fca8740df7c3d07877" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2378,7 +2395,7 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2391,7 +2408,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2480,7 +2497,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2504,9 +2521,9 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.70", + "syn 2.0.72", "termcolor", - "toml 0.8.14", + "toml 0.8.15", "walkdir", ] @@ -2683,7 +2700,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2694,7 +2711,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2732,6 +2749,43 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "serde", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "primitive-types", + "uint", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -2803,7 +2857,7 @@ dependencies = [ "prettyplease 0.2.20", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2926,6 +2980,18 @@ dependencies = [ "scale-info", ] +[[package]] +name = "fixed" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -3078,7 +3144,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3228,7 +3294,7 @@ dependencies = [ "proc-macro2", "quote", "sp-crypto-hashing", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3241,7 +3307,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3252,7 +3318,7 @@ checksum = "68672b9ec6fe72d259d3879dc212c5e42e977588cdac830c76f54d9f492aeb58" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3350,6 +3416,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "funty" +version = "3.0.0-rc2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa590387383a574eb0a02370ad4b29c72e6ddd6b0afc2f6e2890bdb4be6d3a92" + [[package]] name = "futures" version = "0.1.31" @@ -3441,7 +3513,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3626,6 +3698,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "handlebars" version = "4.5.0" @@ -4432,9 +4514,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libloading" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -5028,9 +5110,9 @@ dependencies = [ [[package]] name = "lz4" -version = "1.25.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6eab492fe7f8651add23237ea56dbf11b3c4ff762ab83d40a47f11433421f91" +checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68" dependencies = [ "libc", "lz4-sys", @@ -5038,9 +5120,9 @@ dependencies = [ [[package]] name = "lz4-sys" -version = "1.9.5" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9764018d143cc854c9f17f0b907de70f14393b1f502da6375dce70f00514eb3" +checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" dependencies = [ "cc", "libc", @@ -5064,7 +5146,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5078,7 +5160,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5089,7 +5171,7 @@ checksum = "b02abfe41815b5bd98dbd4260173db2c116dda171dc0fe7838cb206333b83308" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5100,7 +5182,7 @@ checksum = "73ea28ee64b88876bf45277ed9a5817c1817df061a74f2b988971a12570e5869" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5472,7 +5554,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "synstructure 0.13.1", ] @@ -5520,7 +5602,7 @@ checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -6910,7 +6992,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -7148,7 +7230,7 @@ version = "8.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba9138b04168b07b1aff4a2079f5514753c31dddba40e5fb471b9cda7da27ad6" dependencies = [ - "bounded-collections", + "bounded-collections 0.2.0", "frame-benchmarking", "frame-support", "frame-system", @@ -7327,7 +7409,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.2", + "redox_syscall 0.5.3", "smallvec", "windows-targets 0.52.6", ] @@ -7414,7 +7496,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -7455,7 +7537,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -8272,7 +8354,7 @@ version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248ab090959a92e61493277e33b7e85104280a4beb4cb0815137d3c8c50a07f4" dependencies = [ - "bounded-collections", + "bounded-collections 0.2.0", "derive_more", "parity-scale-codec", "polkadot-core-primitives", @@ -8672,9 +8754,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] name = "powerfmt" @@ -8735,7 +8817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -8827,7 +8909,7 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -8873,7 +8955,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -8941,7 +9023,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -9160,9 +9242,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags 2.6.0", ] @@ -9207,7 +9289,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -9793,7 +9875,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -10843,7 +10925,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -11062,9 +11144,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", "core-foundation", @@ -11075,9 +11157,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -11133,7 +11215,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -11263,9 +11345,9 @@ dependencies = [ [[package]] name = "similar" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" +checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" dependencies = [ "bstr", "unicode-segmentation", @@ -11537,7 +11619,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -11731,7 +11813,7 @@ dependencies = [ "bip39", "bitflags 1.3.2", "blake2 0.10.6", - "bounded-collections", + "bounded-collections 0.2.0", "bs58 0.5.1", "dyn-clonable", "ed25519-zebra 3.1.0", @@ -11789,7 +11871,7 @@ checksum = "b85d0f1f1e44bd8617eb2a48203ee854981229e3e79e6f468c7175d5fd37489b" dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -11810,7 +11892,7 @@ checksum = "48d09fa0a5f7299fb81ee25ae3853d26200f7a348148aed6de76be905c007dbe" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -12059,7 +12141,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -12266,7 +12348,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -12289,7 +12371,7 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3be30aec904994451dcacf841a9168cfbbaf817de6b24b6a1c1418cbf1af2fe" dependencies = [ - "bounded-collections", + "bounded-collections 0.2.0", "parity-scale-codec", "scale-info", "serde", @@ -12394,7 +12476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fa328b87de3466bc38cc9a07244c42c647b7755b81115e1dfeb47cc13fc6e6" dependencies = [ "array-bytes 6.2.3", - "bounded-collections", + "bounded-collections 0.2.0", "derivative", "environmental", "impl-trait-for-tuples", @@ -12545,7 +12627,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -12667,7 +12749,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum 0.24.1", "tempfile", - "toml 0.8.14", + "toml 0.8.15", "walkdir", "wasm-opt", ] @@ -12690,6 +12772,205 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" +[[package]] +name = "sygma-access-segregator" +version = "0.2.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-std", +] + +[[package]] +name = "sygma-basic-feehandler" +version = "0.3.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-std", + "staging-xcm", + "staging-xcm-builder", + "sygma-access-segregator", + "sygma-traits", +] + +[[package]] +name = "sygma-bridge" +version = "0.3.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "arrayref", + "bounded-collections 0.1.9", + "cumulus-pallet-xcm", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "ethabi", + "fixed", + "frame-benchmarking", + "frame-support", + "frame-system", + "funty 3.0.0-rc2", + "hex", + "hex-literal 0.3.4", + "log", + "pallet-assets", + "pallet-balances", + "parity-scale-codec", + "primitive-types", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "sygma-access-segregator", + "sygma-basic-feehandler", + "sygma-bridge-forwarder", + "sygma-fee-handler-router", + "sygma-percentage-feehandler", + "sygma-traits", + "sygma-xcm-bridge", +] + +[[package]] +name = "sygma-bridge-forwarder" +version = "0.3.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "cumulus-pallet-xcm", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-support", + "frame-system", + "hex-literal 0.3.4", + "pallet-assets", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-std", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "sygma-traits", +] + +[[package]] +name = "sygma-fee-handler-router" +version = "0.3.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-std", + "staging-xcm", + "staging-xcm-builder", + "sygma-access-segregator", + "sygma-basic-feehandler", + "sygma-percentage-feehandler", + "sygma-traits", +] + +[[package]] +name = "sygma-percentage-feehandler" +version = "0.3.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-std", + "staging-xcm", + "staging-xcm-builder", + "sygma-access-segregator", + "sygma-traits", +] + +[[package]] +name = "sygma-rpc" +version = "0.2.1" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sc-client-api", + "sc-rpc", + "scale-info", + "sp-api", + "sp-blockchain", + "sp-runtime", + "sygma-runtime-api", + "sygma-traits", +] + +[[package]] +name = "sygma-runtime-api" +version = "0.2.1" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "sp-api", + "sygma-bridge", + "sygma-traits", +] + +[[package]] +name = "sygma-traits" +version = "0.2.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "ethabi", + "frame-support", + "parity-scale-codec", + "primitive-types", + "scale-info", + "sp-std", + "staging-xcm", + "staging-xcm-builder", +] + +[[package]] +name = "sygma-xcm-bridge" +version = "0.3.0" +source = "git+https://github.com/sygmaprotocol/sygma-substrate-pallets?branch=release-polkadot-v1.7.0-rpc-upgrade#5e988a5f02298fa48da0d086145ccfc7e48b5b2a" +dependencies = [ + "cumulus-pallet-xcm", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-support", + "frame-system", + "half", + "log", + "pallet-assets", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "sygma-bridge-forwarder", + "sygma-traits", +] + [[package]] name = "syn" version = "1.0.109" @@ -12703,9 +12984,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.70" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -12732,7 +13013,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -12947,6 +13228,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "fixed", "frame-benchmarking", "frame-executive", "frame-support", @@ -12954,6 +13236,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", + "hex", "hex-literal 0.4.1", "log", "merkle-distributor", @@ -13028,6 +13311,13 @@ dependencies = [ "strum 0.26.3", "strum_macros 0.26.4", "substrate-wasm-builder", + "sygma-access-segregator", + "sygma-basic-feehandler", + "sygma-bridge", + "sygma-fee-handler-router", + "sygma-percentage-feehandler", + "sygma-runtime-api", + "sygma-traits", "tangle-asset-registry", "tangle-currencies", "tangle-lst-minting", @@ -13076,6 +13366,8 @@ dependencies = [ "sp-blockchain", "sp-runtime", "substrate-frame-rpc-system", + "sygma-rpc", + "sygma-runtime-api", "tangle-primitives", ] @@ -13327,9 +13619,9 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] @@ -13351,18 +13643,18 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -13481,9 +13773,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" dependencies = [ "backtrace", "bytes", @@ -13506,7 +13798,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -13567,14 +13859,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.15", + "toml_edit 0.22.16", ] [[package]] @@ -13610,15 +13902,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.15" +version = "0.22.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" dependencies = [ "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.13", + "winnow 0.6.15", ] [[package]] @@ -13686,7 +13978,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -13731,7 +14023,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -14136,7 +14428,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "wasm-bindgen-shared", ] @@ -14170,7 +14462,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -14658,9 +14950,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2caba658a80831539b30698ae9862a72db6697dfdd7151e46920f5f2755c3ce2" +checksum = "901e8597c777fa042e9e245bd56c0dc4418c5db3f845b6ff94fbac732c6a0692" dependencies = [ "bytemuck", "safe_arch", @@ -14947,9 +15239,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" dependencies = [ "memchr", ] @@ -15058,7 +15350,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -15200,7 +15492,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -15220,7 +15512,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 342e5c0..b6dc9ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -243,6 +243,17 @@ static_assertions = { version = "1.1.0" } strum = { version = "0.26.3", default-features = false, features = ["derive"] } strum_macros = { version = "0.26.2" } tiny-keccak = { version = "2.0", features = ["fips202"] } +fixed = {version = "1.23.0", default-features = false } + +# Sygma +sygma-access-segregator = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-basic-feehandler = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-traits = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-fee-handler-router = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-percentage-feehandler = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-bridge = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-runtime-api = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } +sygma-rpc = { git = "https://github.com/sygmaprotocol/sygma-substrate-pallets", branch = "release-polkadot-v1.7.0-rpc-upgrade", default-features = false } [profile.dev] split-debuginfo = "unpacked" diff --git a/node/rpc/Cargo.toml b/node/rpc/Cargo.toml index de8f7d9..10250cd 100644 --- a/node/rpc/Cargo.toml +++ b/node/rpc/Cargo.toml @@ -20,4 +20,6 @@ sp-blockchain = { workspace = true } sp-runtime = { workspace = true } pallet-transaction-payment-rpc = { workspace = true } substrate-frame-rpc-system = { workspace = true } +sygma-rpc = { workspace = true } +sygma-runtime-api = { workspace = true } diff --git a/node/rpc/src/lib.rs b/node/rpc/src/lib.rs index a25450a..8e59129 100644 --- a/node/rpc/src/lib.rs +++ b/node/rpc/src/lib.rs @@ -69,13 +69,17 @@ where C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, + C::Api: sygma_runtime_api::SygmaBridgeApi, P: TransactionPool + Sync + Send + 'static, { + use sygma_rpc::{SygmaBridgeRpcServer, SygmaBridgeStorage}; + let mut module = RpcExtension::new(()); let FullDeps { client, pool, deny_unsafe } = deps; module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + module.merge(SygmaBridgeStorage::new(client.clone()).into_rpc())?; Ok(module) } @@ -95,13 +99,17 @@ where C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, + C::Api: sygma_runtime_api::SygmaBridgeApi, P: TransactionPool + Sync + Send + 'static, { + use sygma_rpc::{SygmaBridgeRpcServer, SygmaBridgeStorage}; + let mut module = RpcExtension::new(()); let FullDeps { client, pool, deny_unsafe } = deps; module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + module.merge(SygmaBridgeStorage::new(client.clone()).into_rpc())?; Ok(module) } diff --git a/runtime/tangle-polkadot/Cargo.toml b/runtime/tangle-polkadot/Cargo.toml index 349f0c2..5b7c541 100644 --- a/runtime/tangle-polkadot/Cargo.toml +++ b/runtime/tangle-polkadot/Cargo.toml @@ -17,6 +17,8 @@ strum = { workspace = true, features = ["derive"] } strum_macros = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } +fixed = { workspace = true } +hex = { workspace = true } # frame dependencies frame-benchmarking = { workspace = true, optional = true } @@ -123,12 +125,23 @@ tangle-lst-minting = { workspace = true } tangle-xcm-interface = { workspace = true } tangle-parachain-staking = { workspace = true } +# Sygma +sygma-access-segregator = { workspace = true } +sygma-basic-feehandler = { workspace = true } +sygma-traits = { workspace = true } +sygma-fee-handler-router ={ workspace = true } +sygma-percentage-feehandler = { workspace = true } +sygma-bridge = { workspace = true } +sygma-runtime-api = { workspace = true } + [build-dependencies] substrate-wasm-builder = { workspace = true } [features] default = ["std"] std = [ + "fixed/std", + "hex/std", "strum/std", "parity-scale-codec/std", "scale-info/std", @@ -226,6 +239,15 @@ std = [ "pallet-asset-rate/std", "pallet-message-queue/std", "polkadot-runtime-common/std", + + # Sygma + "sygma-basic-feehandler/std", + "sygma-traits/std", + "sygma-bridge/std", + "sygma-access-segregator/std", + "sygma-fee-handler-router/std", + "sygma-percentage-feehandler/std", + "sygma-runtime-api/std", ] with-tracing = ["frame-executive/with-tracing"] diff --git a/runtime/tangle-polkadot/src/lib.rs b/runtime/tangle-polkadot/src/lib.rs index 0fc7f2e..1d8fb79 100644 --- a/runtime/tangle-polkadot/src/lib.rs +++ b/runtime/tangle-polkadot/src/lib.rs @@ -23,6 +23,7 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +use fixed::{types::extra::U16, FixedU128 as DecimalFixedU128}; use core::convert::TryInto; use frame_support::traits::AsEnsureOriginWithArg; use tangle_primitives::staking::QueryResponseManager; @@ -33,7 +34,7 @@ pub use frame_support::{ construct_runtime, match_types, parameter_types, traits::{ ConstU128, ConstU32, ConstU64, ConstU8, Contains, EqualPrivilegeOnly, Everything, - InstanceFilter, IsInVec, Nothing, Randomness, WithdrawReasons, + InstanceFilter, IsInVec, Nothing, Randomness, WithdrawReasons, SortedMembers, ContainsPair }, weights::{ constants::{ @@ -50,19 +51,24 @@ pub use pallet_timestamp::Call as TimestampCall; use frame_support::genesis_builder_helper::{build_config, create_default_config}; use sp_api::impl_runtime_apis; use sp_arithmetic::Percent; -use sp_core::{ConstBool, OpaqueMetadata}; +use sp_core::{ConstBool, OpaqueMetadata, H160, H256, U256}; use sp_runtime::traits::Verify; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdConversion, BlakeTwo256, Block as BlockT, Zero}, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, DispatchError, DispatchResult, Perbill, Permill, RuntimeDebug, + ApplyExtrinsicResult, DispatchError, DispatchResult, Perbill, Permill, RuntimeDebug, AccountId32 }; -use sp_std::{marker::PhantomData, prelude::*}; +use sp_std::collections::btree_map::BTreeMap; +use sp_std::sync::Arc; +use sp_std::{marker::PhantomData, prelude::*, result, vec::Vec}; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; - +use sygma_traits::{ + ChainID, DecimalConverter, DepositNonce, DomainID, ExtractDestinationData, ResourceId, + VerifyingContractAddress, +}; pub use tangle_parachain_staking::{InflationInfo, Range}; /// Constant values used within the runtime. pub mod constants; @@ -81,7 +87,7 @@ use frame_support::{ Currency, Get, Imbalance, LinearStoragePrice, OnUnbalanced, }, }; -use frame_system::{EnsureRoot, EnsureSigned}; +use frame_system::{EnsureRoot, EnsureSigned, EnsureSignedBy}; use hex_literal::hex; use orml_oracle::DataProvider; use pallet_identity::legacy::IdentityInfo; @@ -114,12 +120,13 @@ pub mod xcm_config; use pallet_xcm::QueryStatus; use sp_runtime::traits::IdentityLookup; use xcm::v3::prelude::*; +use xcm::v4::Junctions::{X1, X3, X4}; pub use xcm_config::{ parachains, AccountId32Aliases, ExistentialDeposits, MultiCurrency, SelfParaChainId, Sibling, SiblingParachainConvertsVia, TangleCurrencyIdConvert, TangleTreasuryAccount, XcmConfig, XcmRouter, }; -use xcm_executor::XcmExecutor; +use xcm_executor::{XcmExecutor, traits::{Error as ExecutionError, MatchesFungibles}}; impl_opaque_keys! { pub struct SessionKeys { @@ -1186,6 +1193,9 @@ parameter_types! { pub const RemoveItemsLimit: u32 = 50; } +// This is used for linking asset ID on PJA with asset Location +pub type AssetIdNum = u32; + impl pallet_assets::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Balance = Balance; @@ -1238,6 +1248,447 @@ impl pallet_uniques::Config for Runtime { type Locker = (); } +parameter_types! { + pub const SygmaAccessSegregatorPalletIndex: u8 = 140; + pub const SygmaBasicFeeHandlerPalletIndex: u8 = 141; + pub const SygmaFeeHandlerRouterPalletIndex: u8 = 142; + pub const SygmaPercentageFeeHandlerRouterPalletIndex: u8 = 143; + pub const SygmaBridgePalletIndex: u8 = 144; +} + +pub struct SygmaAdminMembers; +impl SortedMembers for SygmaAdminMembers { + fn sorted_members() -> Vec { + [SygmaBridgeAdminAccount::get()].to_vec() + } +} + +impl sygma_bridge::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type TransferReserveAccounts = BridgeAccounts; + type FeeReserveAccount = SygmaBridgeFeeAccount; + type EIP712ChainID = EIP712ChainID; + type DestVerifyingContractAddress = DestVerifyingContractAddress; + type FeeHandler = SygmaFeeHandlerRouter; + type AssetTransactor = (CurrencyTransactor, FungiblesTransactor); + type ResourcePairs = ResourcePairs; + type IsReserve = ReserveChecker; + type ExtractDestData = DestinationDataParser; + type PalletId = SygmaBridgePalletId; + type PalletIndex = SygmaBridgePalletIndex; + type DecimalConverter = SygmaDecimalConverter; + type WeightInfo = sygma_bridge::weights::SygmaWeightInfo; +} + +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the parent `AccountId`. + xcm_config::ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId32` origins just alias directly to `AccountId`. + AccountId32Aliases, +); + +#[allow(deprecated)] +pub type CurrencyTransactor = xcm_config::XcmCurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + xcm_config::IsConcrete, + // Convert an XCM Location into a local account id: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId32, + // We don't track any teleports of `Balances`. + (), +>; + +/// Means for transacting assets besides the native currency on this chain. +pub type FungiblesTransactor = xcm_config::FungiblesAdapter< + // Use this fungibles implementation: + Assets, + // Use this currency when it is a fungible asset matching the given location or name: + SimpleForeignAssetConverter, + // Convert an XCM Location into a local account id: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId32, + // Disable teleport. + xcm_config::NoChecking, + // The account to use for tracking teleports. + CheckingAccount, +>; + +pub struct SimpleForeignAssetConverter(PhantomData<()>); +impl MatchesFungibles for SimpleForeignAssetConverter { + fn matches_fungibles(a: &xcm::v4::Asset) -> result::Result<(AssetIdNum, Balance), ExecutionError> { + match (&a.fun, &a.id) { + (xcm::v4::Fungibility::Fungible(ref amount), xcm::v4::AssetId(ref id)) => { + if id == &SygUSDLocation::get() { + Ok((SygUSDAssetId::get(), *amount)) + } else if id == &PHALocation::get() { + Ok((PHAAssetId::get(), *amount)) + } else { + Err(ExecutionError::AssetNotHandled) + } + }, + _ => Err(ExecutionError::AssetNotHandled), + } + } +} + +impl sygma_access_segregator::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BridgeCommitteeOrigin = EnsureSignedBy; + type PalletIndex = SygmaAccessSegregatorPalletIndex; + type Extrinsics = RegisteredExtrinsics; + type WeightInfo = sygma_access_segregator::weights::SygmaWeightInfo; +} + +impl sygma_basic_feehandler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type PalletIndex = SygmaBasicFeeHandlerPalletIndex; + type WeightInfo = sygma_basic_feehandler::weights::SygmaWeightInfo; +} + +impl sygma_fee_handler_router::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BasicFeeHandler = SygmaBasicFeeHandler; + type DynamicFeeHandler = (); + + type PercentageFeeHandler = SygmaPercentageFeeHandler; + type PalletIndex = SygmaFeeHandlerRouterPalletIndex; + type WeightInfo = sygma_fee_handler_router::weights::SygmaWeightInfo; +} + +impl sygma_percentage_feehandler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type PalletIndex = SygmaPercentageFeeHandlerRouterPalletIndex; + type WeightInfo = sygma_percentage_feehandler::weights::SygmaWeightInfo; +} + +parameter_types! { + // tTNT: native asset is always a reserved asset + pub NativeLocation: xcm::v4::Location = xcm::v4::Location::here(); + pub NativeSygmaResourceId: [u8; 32] = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000002000"); + + // SygUSD: a non-reserved asset + pub SygUSDLocation: xcm::v4::Location = xcm::v4::Location::new( + 1, + [ + xcm::v4::Junction::Parachain(1000), + slice_to_generalkey(b"sygma"), + slice_to_generalkey(b"sygusd"), + ], + ); + // SygUSDAssetId is the substrate assetID of SygUSD + pub SygUSDAssetId: AssetIdNum = 2000; + // SygUSDResourceId is the resourceID that mapping with the foreign asset SygUSD + pub SygUSDResourceId: ResourceId = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000001100"); + + // PHA: a reserved asset + pub PHALocation: xcm::v4::Location = xcm::v4::Location::new( + 1, + [ + xcm::v4::Junction::Parachain(2004), + slice_to_generalkey(b"sygma"), + slice_to_generalkey(b"pha"), + ], + ); + // PHAAssetId is the substrate assetID of PHA + pub PHAAssetId: AssetIdNum = 2001; + // PHAResourceId is the resourceID that mapping with the foreign asset PHA + pub PHAResourceId: ResourceId = hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000001000"); +} + +fn bridge_accounts_generator() -> BTreeMap { + let mut account_map: BTreeMap = BTreeMap::new(); + account_map.insert(NativeLocation::get().into(), BridgeAccountNative::get()); + account_map.insert(SygUSDLocation::get().into(), BridgeAccountOtherToken::get()); + account_map.insert(PHALocation::get().into(), BridgeAccountOtherToken::get()); + account_map +} + +const DEST_VERIFYING_CONTRACT_ADDRESS: &str = "6CdE2Cd82a4F8B74693Ff5e194c19CA08c2d1c68"; +parameter_types! { + // RegisteredExtrinsics here registers all valid (pallet index, extrinsic_name) paris + // make sure to update this when adding new access control extrinsic + pub RegisteredExtrinsics: Vec<(u8, Vec)> = [ + (SygmaAccessSegregatorPalletIndex::get(), b"grant_access".to_vec()), + (SygmaBasicFeeHandlerPalletIndex::get(), b"set_fee".to_vec()), + (SygmaBridgePalletIndex::get(), b"set_mpc_address".to_vec()), + (SygmaBridgePalletIndex::get(), b"pause_bridge".to_vec()), + (SygmaBridgePalletIndex::get(), b"unpause_bridge".to_vec()), + (SygmaBridgePalletIndex::get(), b"register_domain".to_vec()), + (SygmaBridgePalletIndex::get(), b"unregister_domain".to_vec()), + (SygmaBridgePalletIndex::get(), b"retry".to_vec()), + (SygmaFeeHandlerRouterPalletIndex::get(), b"set_fee_handler".to_vec()), + (SygmaPercentageFeeHandlerRouterPalletIndex::get(), b"set_fee_rate".to_vec()), + ].to_vec(); + + pub const SygmaBridgePalletId: PalletId = PalletId(*b"sygma/01"); + + // Tangle testnet super admin: 5D2hZnw8Z7kg5LpQiEBb6HPG4V51wYXuKhE7sVhXiUPWj8D1 + // pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("2ab4c35efb6ab82377c2325467103cf46742d288ae1f8917f1d5960f4a1e9065"); + pub SygmaBridgeAdminAccountKey: [u8; 32] = hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"); // alice + pub SygmaBridgeAdminAccount: AccountId = SygmaBridgeAdminAccountKey::get().into(); + + // SygmaBridgeFeeAccount is a substrate account and used for bridging fee collection + // SygmaBridgeFeeAccount address: 5ELLU7ibt5ZrNEYRwohtaRBDBa3TzcWwwPELBPSWWd2mbgv3 + pub SygmaBridgeFeeAccount: AccountId32 = AccountId32::new([100u8; 32]); + + // BridgeAccountNative: 5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e + pub BridgeAccountNative: AccountId32 = SygmaBridgePalletId::get().into_account_truncating(); + // BridgeAccountOtherToken 5EYCAe5jLbHcAAMKvLFiGhk3htXY8jQncbLTDGJQnpnPMAVp + pub BridgeAccountOtherToken: AccountId32 = SygmaBridgePalletId::get().into_sub_account_truncating(1u32); + // BridgeAccounts is a list of accounts for holding transferred asset collection + pub BridgeAccounts: BTreeMap = bridge_accounts_generator(); + + // EIP712ChainID is the chainID that pallet is assigned with, used in EIP712 typed data domain + // For local testing with ./scripts/sygma-setup/execute_proposal_test.js, please change it to 5 + pub EIP712ChainID: ChainID = U256::from(3799); + + // DestVerifyingContractAddress is a H160 address that is used in proposal signature verification, specifically EIP712 typed data + // When relayers signing, this address will be included in the EIP712Domain + // As long as the relayer and pallet configured with the same address, EIP712Domain should be recognized properly. + pub DestVerifyingContractAddress: VerifyingContractAddress = H160::from_slice(hex::decode(DEST_VERIFYING_CONTRACT_ADDRESS).ok().unwrap().as_slice()); + + pub RelayNetwork: NetworkId = NetworkId::Polkadot; + // ResourcePairs is where all supported assets and their associated resourceID are binding + pub ResourcePairs: Vec<(xcm::v4::AssetId, ResourceId)> = vec![ + (NativeLocation::get().into(), NativeSygmaResourceId::get()), + (SygUSDLocation::get().into(), SygUSDResourceId::get()), + (PHALocation::get().into(), PHAResourceId::get()), + ]; + + pub AssetDecimalPairs: Vec<(xcm::v4::AssetId, u8)> = vec![(NativeLocation::get().into(), 18u8), (SygUSDLocation::get().into(), 6u8), (PHALocation::get().into(), 12u8)]; +} + +pub struct ReserveChecker; +impl ContainsPair for ReserveChecker { + fn contains(asset: &xcm::v4::Asset, origin: &xcm::v4::Location) -> bool { + if let Some(ref id) = ConcrateSygmaAsset::origin(asset) { + if id == origin { + return true; + } + } + false + } +} + +pub struct ConcrateSygmaAsset; +impl ConcrateSygmaAsset { + pub fn id(asset: &xcm::v4::Asset) -> Option { + match (&asset.id, &asset.fun) { + (xcm::v4::AssetId(ref id), xcm::v4::Fungibility::Fungible(_)) => Some(id.clone()), + _ => None, + } + } + + pub fn origin(asset: &xcm::v4::Asset) -> Option { + Self::id(asset).and_then(|id| { + match (id.parents, id.first_interior()) { + // Sibling parachain + (1, Some(xcm::v4::Junction::Parachain(id))) => { + // Assume current parachain id is 1000, for production, always get proper parachain info + if *id == 1000 { + Some(xcm::v4::Location::new(0, X1(Arc::new([slice_to_generalkey(b"sygma")])))) + } else { + Some(xcm::v4::Location::here()) + } + }, + (1, _) => Some(xcm::v4::Location::here()), + // Children parachain + (0, Some(xcm::v4::Junction::Parachain(id))) => Some(xcm::v4::Location::new(0, X1(Arc::new([xcm::v4::Junction::Parachain(*id)])))), + // Local: (0, Here) + (0, None) => Some(id), + _ => None, + } + }) + } +} + +pub struct DestinationDataParser; +/// Extract dest to be recipient and Dest DomainID +/// if dest chain is substrate chain, recipient must be a encoded MultiLocation +/// if dest chain is non-substrate chain, recipient is [u8; 32] +impl ExtractDestinationData for crate::DestinationDataParser { + fn extract_dest(dest: &xcm::v4::Location) -> Option<(Vec, DomainID)> { + match (dest.parents, dest.interior.clone()) { + // final dest is on the remote substrate chain + (1, X4(xs)) => { + let [a, b, c, d] = *xs; + match (a, b, c, d) { + ( + xcm::v4::Junction::GeneralKey { length: path_len, data: sygma_path }, + xcm::v4::Junction::GeneralIndex(dest_domain_id), + xcm::v4::Junction::Parachain(parachain_id), + xcm::v4::Junction::AccountId32 { network: None, id: recipient }, + ) => { + if sygma_path[..path_len as usize] == [0x73, 0x79, 0x67, 0x6d, 0x61] { + return TryInto::::try_into(dest_domain_id).ok().map( + |domain_id| { + let l: xcm::v4::Location = xcm::v4::Location::new( + 1, + xcm::v4::Junctions::X2(Arc::new([ + xcm::v4::Junction::Parachain(parachain_id), + xcm::v4::Junction::AccountId32 { network: None, id: recipient }, + ])), + ); + (l.encode(), domain_id) + }, + ); + } + None + }, + _ => None, + } + }, + (0, X3(xs)) => { + let [a, b, c] = *xs; + match (a, b, c) { + // final dest is on the local substrate chain + ( + xcm::v4::Junction::GeneralKey { length: path_len, data: sygma_path }, + xcm::v4::Junction::GeneralIndex(dest_domain_id), + xcm::v4::Junction::AccountId32 { network: None, id: recipient }, + ) => { + if sygma_path[..path_len as usize] == [0x73, 0x79, 0x67, 0x6d, 0x61] { + return TryInto::::try_into(dest_domain_id).ok().map( + |domain_id| { + let l: xcm::v4::Location = xcm::v4::Location::new( + 0, + X1(Arc::new([xcm::v4::Junction::AccountId32 { + network: None, + id: recipient, + }])), + ); + (l.encode(), domain_id) + }, + ); + } + None + }, + // final dest is on the non-substrate chain such as EVM + ( + xcm::v4::Junction::GeneralKey { length: path_len, data: sygma_path }, + xcm::v4::Junction::GeneralIndex(dest_domain_id), + xcm::v4::Junction::GeneralKey { length: recipient_len, data: recipient }, + ) => { + if sygma_path[..path_len as usize] == [0x73, 0x79, 0x67, 0x6d, 0x61] { + return TryInto::::try_into(dest_domain_id).ok().map( + |domain_id| { + (recipient[..recipient_len as usize].to_vec(), domain_id) + }, + ); + } + None + }, + _ => None, + } + }, + _ => None, + } + } +} + +pub struct SygmaDecimalConverter(PhantomData); +impl>> DecimalConverter +for SygmaDecimalConverter +{ + fn convert_to(asset: &xcm::v4::Asset) -> Option { + match (&asset.fun, &asset.id) { + (xcm::v4::Fungibility::Fungible(amount), _) => { + for (asset_id, decimal) in DecimalPairs::get().iter() { + if *asset_id == asset.id { + return if *decimal == 18 { + Some(*amount) + } else { + type U112F16 = DecimalFixedU128; + if *decimal > 18 { + let a = + U112F16::from_num(10u128.saturating_pow(*decimal as u32 - 18)); + let b = U112F16::from_num(*amount).checked_div(a); + let r: u128 = b.unwrap_or_else(|| U112F16::from_num(0)).to_num(); + if r == 0 { + return None; + } + Some(r) + } else { + // Max is 5192296858534827628530496329220095 + // if source asset decimal is 12, the max amount sending to sygma + // relayer is 5192296858534827.628530496329 + if *amount > U112F16::MAX { + return None; + } + let a = + U112F16::from_num(10u128.saturating_pow(18 - *decimal as u32)); + let b = U112F16::from_num(*amount).saturating_mul(a); + Some(b.to_num()) + } + }; + } + } + None + }, + _ => None, + } + } + + fn convert_from(asset: &xcm::v4::Asset) -> Option { + match (&asset.fun, &asset.id) { + (xcm::v4::Fungibility::Fungible(amount), _) => { + for (asset_id, decimal) in DecimalPairs::get().iter() { + if *asset_id == asset.id { + return if *decimal == 18 { + Some((asset.id.clone(), *amount).into()) + } else { + type U112F16 = DecimalFixedU128; + if *decimal > 18 { + // Max is 5192296858534827628530496329220095 + // if dest asset decimal is 24, the max amount coming from sygma + // relayer is 5192296858.534827628530496329 + if *amount > U112F16::MAX { + return None; + } + let a = + U112F16::from_num(10u128.saturating_pow(*decimal as u32 - 18)); + let b = U112F16::from_num(*amount).saturating_mul(a); + let r: u128 = b.to_num(); + Some((asset.id.clone(), r).into()) + } else { + let a = + U112F16::from_num(10u128.saturating_pow(18 - *decimal as u32)); + let b = U112F16::from_num(*amount).checked_div(a); + let r: u128 = b.unwrap_or_else(|| U112F16::from_num(0)).to_num(); + if r == 0 { + return None; + } + Some((asset.id.clone(), r).into()) + } + }; + } + } + None + }, + _ => None, + } + } +} + +pub fn slice_to_generalkey(key: &[u8]) -> xcm::v4::Junction { + let len = key.len(); + assert!(len <= 32); + xcm::v4::Junction::GeneralKey { + length: len as u8, + data: { + let mut data = [0u8; 32]; + data[..len].copy_from_slice(key); + data + }, + } +} + construct_runtime! { pub enum Runtime { // Basic stuff @@ -1292,7 +1743,14 @@ construct_runtime! { Slp: tangle_slp = 116, XcmInterface: tangle_xcm_interface = 117, Assets: pallet_assets = 118, - Nfts: pallet_uniques = 119 + Nfts: pallet_uniques = 119, + + // Sygma + SygmaAccessSegregator: sygma_access_segregator = 140, + SygmaBasicFeeHandler: sygma_basic_feehandler = 141, + SygmaFeeHandlerRouter: sygma_fee_handler_router = 142, + SygmaPercentageFeeHandler: sygma_percentage_feehandler = 143, + SygmaBridge: sygma_bridge = 144, } } @@ -1427,6 +1885,12 @@ impl_runtime_apis! { } } + impl sygma_runtime_api::SygmaBridgeApi for Runtime { + fn is_proposal_executed(nonce: DepositNonce, domain_id: DomainID) -> bool { + SygmaBridge::is_proposal_executed(nonce, domain_id) + } + } + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) diff --git a/runtime/tangle-polkadot/src/xcm_config.rs b/runtime/tangle-polkadot/src/xcm_config.rs index 1d8bcb4..add8698 100644 --- a/runtime/tangle-polkadot/src/xcm_config.rs +++ b/runtime/tangle-polkadot/src/xcm_config.rs @@ -45,12 +45,14 @@ use xcm_builder::{ Account32Hash, DescribeAllTerminal, DescribeFamily, FrameTransactionalProcessor, HashedDescription, TrailingSetTopicAsId, }; +#[allow(deprecated)] pub use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeRevenue, TakeWeightCredit, + SovereignSignedViaLocation, TakeRevenue, TakeWeightCredit, NoChecking, + CurrencyAdapter as XcmCurrencyAdapter, FungiblesAdapter, }; use xcm_executor::traits::{MatchesFungible, Properties, ShouldExecute}; // orml imports @@ -114,7 +116,7 @@ impl> Convert> for TangleCurrencyIdConv pub struct TangleAccountIdToLocation; impl Convert for TangleAccountIdToLocation { fn convert(account: AccountId) -> Location { - [AccountId32 { network: None, id: account.into() }].into() + [xcm::v4::Junction::AccountId32 { network: None, id: account.into() }].into() } }