From 533489cc732c0e4f35d78da3922c9d53ac17b54e Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 5 Nov 2024 10:45:22 -0500 Subject: [PATCH 1/3] feat: constructors for tangle and EVM --- Cargo.lock | 583 ++++++++++++------ .../contracts/lib/forge-std | 2 +- .../src/main.rs | 7 +- .../incredible-squaring-symbiotic/src/main.rs | 6 +- .../contracts/lib/forge-std | 2 +- blueprints/incredible-squaring/src/main.rs | 17 +- .../tangle-raw-event-listener/src/main.rs | 7 +- blueprints/tangle-raw/Cargo.toml | 22 - blueprints/tangle-raw/build.rs | 5 - blueprints/tangle-raw/src/lib.rs | 24 - blueprints/tangle-raw/src/main.rs | 37 -- .../src/event_listener/tangle.rs | 51 -- macros/blueprint-proc-macro/src/job.rs | 33 +- macros/blueprint-proc-macro/src/lib.rs | 2 +- macros/blueprint-proc-macro/src/report.rs | 29 +- macros/blueprint-proc-macro/src/shared.rs | 26 +- .../{event_listener => special_impls}/evm.rs | 41 +- .../{event_listener => special_impls}/mod.rs | 0 .../src/special_impls/tangle.rs | 100 +++ macros/blueprint-proc-macro/src/tangle/mod.rs | 2 +- 20 files changed, 614 insertions(+), 382 deletions(-) delete mode 100644 blueprints/tangle-raw/Cargo.toml delete mode 100644 blueprints/tangle-raw/build.rs delete mode 100644 blueprints/tangle-raw/src/lib.rs delete mode 100644 blueprints/tangle-raw/src/main.rs delete mode 100644 macros/blueprint-proc-macro/src/event_listener/tangle.rs rename macros/blueprint-proc-macro/src/{event_listener => special_impls}/evm.rs (74%) rename macros/blueprint-proc-macro/src/{event_listener => special_impls}/mod.rs (100%) create mode 100644 macros/blueprint-proc-macro/src/special_impls/tangle.rs diff --git a/Cargo.lock b/Cargo.lock index 315899bc..3a39153b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,11 +128,11 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy-chains" -version = "0.1.44" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c660915971620592abe2c292c859957eb60e73a60c0eba34a6793eea60512cff" +checksum = "18c5c520273946ecf715c0010b4e3503d7eba9893cd9ce6b7fff5654c4a3c470" dependencies = [ - "alloy-primitives 0.8.10", + "alloy-primitives 0.8.11", "num_enum", "strum", ] @@ -233,8 +233,8 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8fa8a1a3c4cbd221f2b8e3693aeb328fca79a757fe556ed08e47bbbc2a70db7" dependencies = [ - "alloy-primitives 0.8.10", - "alloy-sol-types 0.8.10", + "alloy-primitives 0.8.11", + "alloy-sol-types 0.8.11", "serde", "serde_json", "thiserror", @@ -285,9 +285,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8edae627382349b56cd6a7a2106f4fd69b243a9233e560c55c2e03cabb7e1d3c" +checksum = "fd58d377699e6cfeab52c4a9d28bdc4ef37e2bd235ff2db525071fe37a2e9af5" dependencies = [ "alloy-rlp", "bytes", @@ -295,7 +295,7 @@ dependencies = [ "const-hex", "derive_more 1.0.0", "foldhash", - "hashbrown 0.15.0", + "hashbrown 0.15.1", "hex-literal", "indexmap 2.6.0", "itoa", @@ -383,7 +383,7 @@ checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -418,7 +418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "370143ed581aace6e663342d21d209c6b2e34ee6142f7d6675adb518deeaf0dc" dependencies = [ "alloy-json-rpc 0.4.2", - "alloy-primitives 0.8.10", + "alloy-primitives 0.8.11", "alloy-transport 0.4.2", "alloy-transport-http 0.4.2", "futures", @@ -531,21 +531,21 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] name = "alloy-sol-macro" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841eabaa4710f719fddbc24c95d386eae313f07e6da4babc25830ee37945be0c" +checksum = "8a1b42ac8f45e2f49f4bcdd72cbfde0bb148f5481d403774ffa546e48b83efc1" dependencies = [ - "alloy-sol-macro-expander 0.8.10", - "alloy-sol-macro-input 0.8.10", + "alloy-sol-macro-expander 0.8.11", + "alloy-sol-macro-input 0.8.11", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -562,26 +562,26 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "syn-solidity 0.7.7", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6672337f19d837b9f7073c45853aeb528ed9f7dd6a4154ce683e9e5cb7794014" +checksum = "06318f1778e57f36333e850aa71bd1bb5e560c10279e236622faae0470c50412" dependencies = [ - "alloy-sol-macro-input 0.8.10", + "alloy-sol-macro-input 0.8.11", "const-hex", "heck 0.5.0", "indexmap 2.6.0", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.85", - "syn-solidity 0.8.10", + "syn 2.0.87", + "syn-solidity 0.8.11", "tiny-keccak", ] @@ -598,23 +598,23 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.85", + "syn 2.0.87", "syn-solidity 0.7.7", ] [[package]] name = "alloy-sol-macro-input" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dff37dd20bfb118b777c96eda83b2067f4226d2644c5cfa00187b3bc01770ba" +checksum = "eaebb9b0ad61a41345a22c9279975c0cdd231b97947b10d7aad1cf0a7181e4a5" dependencies = [ "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", - "syn-solidity 0.8.10", + "syn 2.0.87", + "syn-solidity 0.8.11", ] [[package]] @@ -642,12 +642,12 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa828bb1b9a6dc52208fbb18084fb9ce2c30facc2bfda6a5d922349b4990354f" +checksum = "374d7fb042d68ddfe79ccb23359de3007f6d4d53c13f703b64fb0db422132111" dependencies = [ - "alloy-primitives 0.8.10", - "alloy-sol-macro 0.8.10", + "alloy-primitives 0.8.11", + "alloy-sol-macro 0.8.11", "const-hex", ] @@ -766,9 +766,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -781,9 +781,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" @@ -815,9 +815,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" [[package]] name = "anymap2" @@ -1094,7 +1094,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "synstructure 0.13.1", ] @@ -1106,7 +1106,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1170,7 +1170,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 0.38.38", + "rustix 0.38.39", "slab", "tracing", "windows-sys 0.59.0", @@ -1213,7 +1213,7 @@ dependencies = [ "cfg-if 1.0.0", "event-listener 5.3.1", "futures-lite", - "rustix 0.38.38", + "rustix 0.38.39", "tracing", ] @@ -1229,7 +1229,7 @@ dependencies = [ "cfg-if 1.0.0", "futures-core", "futures-io", - "rustix 0.38.38", + "rustix 0.38.39", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -1254,7 +1254,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1271,7 +1271,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1359,7 +1359,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1434,9 +1434,9 @@ dependencies = [ [[package]] name = "aws-sdk-kms" -version = "1.48.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2afbd208dabc6785946d4ef2444eb1f54fe0aaf0f62f2a4f9a9e9c303aeff0be" +checksum = "1f4c89f1d2e0df99ccd21f98598c1e587ad78bd87ae22a74aba392b5566bb038" dependencies = [ "aws-credential-types", "aws-runtime", @@ -1546,9 +1546,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.7.2" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e086682a53d3aa241192aa110fa8dfce98f2f5ac2ead0de84d41582c7e8fdb96" +checksum = "92165296a47a812b267b4f41032ff8069ab7ff783696d217f0994a0d7ab585cd" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -1563,9 +1563,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.2.8" +version = "1.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c9cdc179e6afbf5d391ab08c85eac817b51c87e1892a5edb5f7bbdc64314b4" +checksum = "4fbd94a32b3a7d55d3806fe27d98d3ad393050439dd05eb53ece36ec5e3d3510" dependencies = [ "base64-simd", "bytes", @@ -1734,7 +1734,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.85", + "syn 2.0.87", "which", ] @@ -2229,9 +2229,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.31" +version = "1.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "0f57c4b4da2a9d619dd035f27316d7a426305b75be93d09e92f2b9229c34feaf" dependencies = [ "jobserver", "libc", @@ -2394,7 +2394,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2755,7 +2755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2814,7 +2814,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2871,7 +2871,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2893,7 +2893,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2989,7 +2989,7 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3000,7 +3000,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3013,7 +3013,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3033,7 +3033,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "unicode-xid", ] @@ -3121,7 +3121,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3132,18 +3132,18 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "docify" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a2f138ad521dc4a2ced1a4576148a6a610b4c5923933b062a263130a6802ce" +checksum = "a772b62b1837c8f060432ddcc10b17aae1453ef17617a99bc07789252d2a5896" dependencies = [ "docify_macros", ] [[package]] name = "docify_macros" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a081e51fb188742f5a7a1164ad752121abcb22874b21e2c3b0dd040c515fdad" +checksum = "60e6be249b0a462a14784a99b19bf35a667bb5e09de611738bb7362fa4c95ff7" dependencies = [ "common-path", "derive-syn-parse", @@ -3151,7 +3151,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.85", + "syn 2.0.87", "termcolor", "toml", "walkdir", @@ -3740,7 +3740,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3753,7 +3753,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3960,7 +3960,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "syn 2.0.85", + "syn 2.0.87", "toml", "walkdir", ] @@ -3978,7 +3978,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -4004,7 +4004,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.85", + "syn 2.0.87", "tempfile", "thiserror", "tiny-keccak", @@ -4191,7 +4191,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -4506,9 +4506,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +checksum = "3f1fa2f9765705486b33fd2acf1577f8ec449c2ba1f318ae5447697b7c08d210" dependencies = [ "fastrand", "futures-core", @@ -4535,7 +4535,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -4627,7 +4627,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.85", + "syn 2.0.87", "tracing", "trybuild", ] @@ -4675,7 +4675,7 @@ dependencies = [ "gadget-sdk", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "trybuild", ] @@ -5264,9 +5264,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" dependencies = [ "allocator-api2", "equivalent", @@ -5726,6 +5726,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -5744,12 +5862,23 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -6001,7 +6130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", "serde", ] @@ -7007,7 +7136,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -7229,7 +7358,7 @@ checksum = "3b51f1d220e3fa869e24cfd75915efe3164bd09bb11b3165db3f37f57bf673e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -7247,6 +7376,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -7269,7 +7404,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] @@ -7336,7 +7471,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.38", + "rustix 0.38.39", ] [[package]] @@ -7738,9 +7873,9 @@ dependencies = [ [[package]] name = "ntex" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223834e688405dcc46b5c28bc9225648c603e64d7b61e8903da33064b6f1464e" +checksum = "d7b2a207ac0bec11a1cc6b44b2dcbcab3991b0482337f62a78c919bf13e1b4f2" dependencies = [ "base64 0.22.1", "bitflags 2.6.0", @@ -7797,9 +7932,9 @@ dependencies = [ [[package]] name = "ntex-h2" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c26686e5f3b21552a554e83b5a3312a00038d82e262d6e01f507e2f81bda8a" +checksum = "d6f96f9a837c794ccf047438a1bbbf3d93fdcf2bfce42eb2a777595d1393ec7e" dependencies = [ "bitflags 2.6.0", "fxhash", @@ -7832,9 +7967,9 @@ dependencies = [ [[package]] name = "ntex-io" -version = "2.7.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80c49628e35ff52f36137a8e732261f392de621406a163571888f6163e3f6b10" +checksum = "2ab41a7f7a96c6d1f9736d71efae9eb91c59274cb35757986eae9bd1fd76b052" dependencies = [ "bitflags 2.6.0", "log", @@ -7902,9 +8037,9 @@ dependencies = [ [[package]] name = "ntex-server" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9c3f4b038d1bcc3aff4e457a4b8258828b8e119c9ef4fd1e42c8df5e732cee" +checksum = "300921ed1f8626d7bfb06813ff839945eed08f763fbc1296590f878b8ee7f9e3" dependencies = [ "async-broadcast", "async-channel", @@ -7923,18 +8058,18 @@ dependencies = [ [[package]] name = "ntex-service" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02daa9c4fc8b5382b24dd69d504599a72774d6828e4fc21e9013cb62096db7aa" +checksum = "62351b99deeb128baafbd71fc22e8ef93bef643fc60fbb51db8a45006f03cda1" dependencies = [ "slab", ] [[package]] name = "ntex-tls" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e08948d9a1d27d11c474c374e6b8c0eee7e2dd4a288967d5dcce13d7adbd80e" +checksum = "5b6df536ec6f8f2499f5e3a2e2893cfc1b775408ee0c917d0570821025dc22e3" dependencies = [ "log", "ntex-bytes", @@ -7946,22 +8081,23 @@ dependencies = [ [[package]] name = "ntex-tokio" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623868ff022f737d7b94212dc85e471f895e58f6c59c72552cdc9a22c5f167ed" +checksum = "c41ff5282a2912445e9fcf0c751b8c71edefa803bf71478515c8600f4e3e8853" dependencies = [ "log", "ntex-bytes", "ntex-io", + "ntex-rt", "ntex-util", "tokio", ] [[package]] name = "ntex-util" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95f0cf57859407e61c61a7e131cd339b05537046580b65abbf0a817f46917be" +checksum = "10fc97836b6bf4044897370725b7fbcfecef9a8be29c352c35f8c0a587e2e721" dependencies = [ "bitflags 2.6.0", "futures-core", @@ -8109,7 +8245,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8223,7 +8359,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8262,9 +8398,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "4.4.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e7ccb95e240b7c9506a3d544f10d935e142cc90b0a1d56954fb44d89ad6b97" +checksum = "c65ee1f9701bf938026630b455d5315f490640234259037edb259798b3bcf85e" dependencies = [ "num-traits", ] @@ -8403,7 +8539,7 @@ dependencies = [ "regex", "regex-syntax 0.8.5", "structmeta", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8579,7 +8715,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8652,7 +8788,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8690,7 +8826,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8782,7 +8918,7 @@ dependencies = [ "polkavm-common 0.8.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8794,7 +8930,7 @@ dependencies = [ "polkavm-common 0.9.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8804,7 +8940,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" dependencies = [ "polkavm-derive-impl 0.8.0", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8814,7 +8950,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" dependencies = [ "polkavm-derive-impl 0.9.0", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8827,7 +8963,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.38", + "rustix 0.38.39", "tracing", "windows-sys 0.59.0", ] @@ -8889,7 +9025,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8958,7 +9094,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -9010,7 +9146,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -9123,9 +9259,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e346e016eacfff12233c243718197ca12f148c84e1e84268a896699b41c71780" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ "cfg_aliases 0.2.1", "libc", @@ -9310,7 +9446,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -9516,7 +9652,7 @@ checksum = "a5a11a05ee1ce44058fa3d5961d05194fdbe3ad6b40f904af764d81b86450e6b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -9774,9 +9910,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" dependencies = [ "bitflags 2.6.0", "errno", @@ -10091,7 +10227,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10117,7 +10253,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10139,7 +10275,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.85", + "syn 2.0.87", "thiserror", ] @@ -10385,7 +10521,7 @@ checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10396,7 +10532,7 @@ checksum = "e578a843d40b4189a4d66bba51d7684f57da5bd7c304c64e14bd63efbef49509" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10419,7 +10555,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10479,7 +10615,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10977,7 +11113,7 @@ checksum = "48d09fa0a5f7299fb81ee25ae3853d26200f7a348148aed6de76be905c007dbe" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11098,7 +11234,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11517,7 +11653,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11528,7 +11664,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11550,7 +11686,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11626,7 +11762,7 @@ dependencies = [ "scale-info", "scale-typegen", "subxt-metadata", - "syn 2.0.85", + "syn 2.0.87", "thiserror", "tokio", ] @@ -11699,7 +11835,7 @@ dependencies = [ "quote", "scale-typegen", "subxt-codegen", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11782,9 +11918,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -11800,19 +11936,19 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] name = "syn-solidity" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16320d4a2021ba1a32470b3759676114a918885e9800e68ad60f2c67969fba62" +checksum = "edf42e81491fb8871b74df3d222c64ae8cbc1269ea509fa768a3ed3e1b0ac8cb" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11850,7 +11986,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11959,7 +12095,7 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if 1.0.0", "fastrand", - "rustix 0.38.38", + "rustix 0.38.39", "windows-sys 0.52.0", ] @@ -11999,7 +12135,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" dependencies = [ - "rustix 0.38.38", + "rustix 0.38.39", "windows-sys 0.59.0", ] @@ -12040,22 +12176,22 @@ checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b" [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12119,6 +12255,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -12160,7 +12306,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12383,7 +12529,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12556,7 +12702,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12628,7 +12774,7 @@ checksum = "f9534daa9fd3ed0bd911d462a37f172228077e7abf18c18a5f67199d959205f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12760,12 +12906,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna 1.0.3", "percent-encoding", "serde", ] @@ -12782,6 +12928,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -12839,9 +12997,9 @@ checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" [[package]] name = "w3f-bls" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a48c48447120a85b0bdb897ba9426a7aa15b4229498a2e19103e8c9368dd4b2" +checksum = "70a3028804c8bbae2a97a15b71ffc0e308c4b01a520994aafa77d56e94e19024" dependencies = [ "ark-bls12-377", "ark-bls12-381", @@ -12923,7 +13081,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -12957,7 +13115,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -13208,7 +13366,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.38", + "rustix 0.38.39", ] [[package]] @@ -13316,7 +13474,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -13327,7 +13485,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -13602,6 +13760,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -13726,6 +13896,30 @@ dependencies = [ "time", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure 0.13.1", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -13744,7 +13938,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure 0.13.1", ] [[package]] @@ -13764,7 +13979,29 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std b/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std index 1de6eecf..1eea5bae 160000 --- a/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std +++ b/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std @@ -1 +1 @@ -Subproject commit 1de6eecf821de7fe2c908cc48d3ab3dced20717f +Subproject commit 1eea5bae12ae557d589f9f0f0edae2faa47cb262 diff --git a/blueprints/incredible-squaring-eigenlayer/src/main.rs b/blueprints/incredible-squaring-eigenlayer/src/main.rs index 3e07fa7d..71e4197f 100644 --- a/blueprints/incredible-squaring-eigenlayer/src/main.rs +++ b/blueprints/incredible-squaring-eigenlayer/src/main.rs @@ -65,11 +65,8 @@ async fn main() { client: aggregator_client, env: env.clone(), }; - let x_square_eigen = XsquareEigenEventHandler { - ctx, - contract: contract.clone(), - contract_instance: Default::default(), - }; + + let x_square_eigen = XsquareEigenEventHandler::new(contract.clone(), ctx); let aggregator_context = AggregatorContext::new( server_address, diff --git a/blueprints/incredible-squaring-symbiotic/src/main.rs b/blueprints/incredible-squaring-symbiotic/src/main.rs index cf633f16..28a45aed 100644 --- a/blueprints/incredible-squaring-symbiotic/src/main.rs +++ b/blueprints/incredible-squaring-symbiotic/src/main.rs @@ -30,11 +30,7 @@ async fn main() { provider, ); - let x_square = blueprint::XsquareEventHandler { - context: blueprint::MyContext {}, - contract: contract.clone(), - contract_instance: Default::default(), - }; + let x_square = blueprint::XsquareEventHandler::new(contract, blueprint::MyContext {}); info!("~~~ Executing the incredible squaring blueprint ~~~"); let symb_config = SymbioticConfig::default(); diff --git a/blueprints/incredible-squaring/contracts/lib/forge-std b/blueprints/incredible-squaring/contracts/lib/forge-std index 1de6eecf..1eea5bae 160000 --- a/blueprints/incredible-squaring/contracts/lib/forge-std +++ b/blueprints/incredible-squaring/contracts/lib/forge-std @@ -1 +1 @@ -Subproject commit 1de6eecf821de7fe2c908cc48d3ab3dced20717f +Subproject commit 1eea5bae12ae557d589f9f0f0edae2faa47cb262 diff --git a/blueprints/incredible-squaring/src/main.rs b/blueprints/incredible-squaring/src/main.rs index a252bd77..aefa4287 100644 --- a/blueprints/incredible-squaring/src/main.rs +++ b/blueprints/incredible-squaring/src/main.rs @@ -1,4 +1,4 @@ -use color_eyre::{eyre::eyre, Result}; +use color_eyre::Result; use gadget_sdk::info; use gadget_sdk::runners::tangle::TangleConfig; use gadget_sdk::runners::BlueprintRunner; @@ -7,17 +7,12 @@ use incredible_squaring_blueprint as blueprint; #[gadget_sdk::main(env)] async fn main() { - let client = env.client().await.map_err(|e| eyre!(e))?; - let signer = env.first_sr25519_signer().map_err(|e| eyre!(e))?; + let x_square = blueprint::XsquareEventHandler::new(&env, blueprint::MyContext).await?; - info!("Starting the event watcher for {} ...", signer.account_id()); - - let x_square = blueprint::XsquareEventHandler { - service_id: env.service_id().expect("No service ID found"), - context: blueprint::MyContext, - client, - signer, - }; + info!( + "Starting the event watcher for {} ...", + x_square.signer.account_id() + ); info!("~~~ Executing the incredible squaring blueprint ~~~"); let tangle_config = TangleConfig::default(); diff --git a/blueprints/tangle-raw-event-listener/src/main.rs b/blueprints/tangle-raw-event-listener/src/main.rs index 16b74e63..a9a6c31f 100644 --- a/blueprints/tangle-raw-event-listener/src/main.rs +++ b/blueprints/tangle-raw-event-listener/src/main.rs @@ -11,12 +11,7 @@ async fn main() { info!("Starting the event watcher for {} ...", signer.account_id()); - let x_square = blueprint::RawEventHandler { - service_id: env.service_id().expect("No service ID found"), - context: blueprint::MyContext, - client, - signer, - }; + let x_square = blueprint::RawEventHandler::new(&env, blueprint::MyContext).await?; let tangle_config = TangleConfig::default(); diff --git a/blueprints/tangle-raw/Cargo.toml b/blueprints/tangle-raw/Cargo.toml deleted file mode 100644 index 6cbb694e..00000000 --- a/blueprints/tangle-raw/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "tangle-raw-blueprint" -version = "0.1.1" -description = "A Simple Blueprint to demo how to listen to raw events from Tangle" -authors.workspace = true -edition.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -publish = false - -[dependencies] -gadget-sdk = { workspace = true, features = ["std"] } -color-eyre = { workspace = true } -tracing = { workspace = true } - -[build-dependencies] -blueprint-metadata = { workspace = true } - -[features] -default = ["std"] -std = [] \ No newline at end of file diff --git a/blueprints/tangle-raw/build.rs b/blueprints/tangle-raw/build.rs deleted file mode 100644 index acb638b3..00000000 --- a/blueprints/tangle-raw/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - println!("cargo:rerun-if-changed=src/lib.rs"); - println!("cargo:rerun-if-changed=src/main.rs"); - blueprint_metadata::generate_json(); -} diff --git a/blueprints/tangle-raw/src/lib.rs b/blueprints/tangle-raw/src/lib.rs deleted file mode 100644 index 1ee1ee64..00000000 --- a/blueprints/tangle-raw/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -use gadget_sdk::event_listener::tangle::{TangleEvent, TangleEventListener}; -use gadget_sdk::job; -use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api; - -#[derive(Clone)] -pub struct MyContext; - -#[job( - id = 0, - event_listener( - listener = TangleEventListener, - ), -)] -pub fn raw(event: TangleEvent, context: MyContext) -> Result { - if let Some(balance_transfer) = event - .evt - .as_event::() - .ok() - .flatten() - { - gadget_sdk::info!("Found a balance transfer: {balance_transfer:?}"); - } - Ok(0) -} diff --git a/blueprints/tangle-raw/src/main.rs b/blueprints/tangle-raw/src/main.rs deleted file mode 100644 index 85869285..00000000 --- a/blueprints/tangle-raw/src/main.rs +++ /dev/null @@ -1,37 +0,0 @@ -use color_eyre::{eyre::eyre, Result}; -use gadget_sdk::config::protocol::TangleInstanceSettings; -use gadget_sdk::info; -use gadget_sdk::runners::tangle::TangleConfig; -use gadget_sdk::runners::BlueprintRunner; -use gadget_sdk::tangle_subxt::subxt::tx::Signer; -use tangle_raw_blueprint as blueprint; - -#[gadget_sdk::main(env)] -async fn main() { - let client = env.client().await.map_err(|e| eyre!(e))?; - let signer = env.first_sr25519_signer().map_err(|e| eyre!(e))?; - let tangle_config = TangleConfig { - price_targets: Default::default(), - }; - - info!("Starting the event watcher for {} ...", signer.account_id()); - - let tangle_settings = env.protocol_specific.tangle()?; - let TangleInstanceSettings { service_id, .. } = tangle_settings; - - let x_square = blueprint::RawEventHandler { - service_id: *service_id, - context: blueprint::MyContext, - client, - signer, - }; - - info!("~~~ Executing the incredible squaring blueprint ~~~"); - BlueprintRunner::new(tangle_config, env) - .job(x_square) - .run() - .await?; - - info!("Exiting..."); - Ok(()) -} diff --git a/macros/blueprint-proc-macro/src/event_listener/tangle.rs b/macros/blueprint-proc-macro/src/event_listener/tangle.rs deleted file mode 100644 index 8196ef70..00000000 --- a/macros/blueprint-proc-macro/src/event_listener/tangle.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::job::{declared_params_to_field_types, EventListenerArgs}; -use indexmap::IndexMap; -use proc_macro2::TokenStream; -use quote::quote; -use syn::{Ident, Type}; - -#[allow(clippy::too_many_arguments)] -pub(crate) fn generate_additional_tangle_logic(struct_name: &Ident) -> TokenStream { - quote! { - #[automatically_derived] - impl gadget_sdk::event_listener::markers::IsTangle for #struct_name {} - } -} - -pub(crate) fn get_tangle_job_processor_wrapper( - params: &[Ident], - param_types: &IndexMap, - event_listeners: &EventListenerArgs, - ordered_inputs: &mut Vec, - fn_name_ident: &Ident, - call_id_static_name: &Ident, - asyncness: &TokenStream, -) -> TokenStream { - let params = - declared_params_to_field_types(params, param_types).expect("Failed to generate params"); - let params_tokens = event_listeners.get_param_name_tokenstream(¶ms, true); - - let job_processor_call = if params_tokens.is_empty() { - let second_param = ordered_inputs.pop().expect("Expected a context"); - quote! { - // If no args are specified, assume this job has no parameters and thus takes in the raw event - #fn_name_ident (param0, #second_param) #asyncness .map_err(|err| gadget_sdk::Error::Other(err.to_string())) - } - } else { - quote! { - let mut args_iter = param0.args.clone().into_iter(); - #(#params_tokens)* - #fn_name_ident (#(#ordered_inputs)*) #asyncness .map_err(|err| gadget_sdk::Error::Other(err.to_string())) - } - }; - - quote! { - move |param0: gadget_sdk::event_listener::tangle::TangleEvent<_, _>| async move { - if let Some(call_id) = param0.call_id { - #call_id_static_name.store(call_id, std::sync::atomic::Ordering::Relaxed); - } - - #job_processor_call - } - } -} diff --git a/macros/blueprint-proc-macro/src/job.rs b/macros/blueprint-proc-macro/src/job.rs index 3c8d59e4..0ee7db4d 100644 --- a/macros/blueprint-proc-macro/src/job.rs +++ b/macros/blueprint-proc-macro/src/job.rs @@ -1,10 +1,10 @@ -use crate::event_listener::evm::{ - generate_evm_event_handler, get_evm_instance_data, get_evm_job_processor_wrapper, +use crate::shared::{pascal_case, type_to_field_type}; +use crate::special_impls::evm::{ + generate_evm_specific_impl, get_evm_instance_data, get_evm_job_processor_wrapper, }; -use crate::event_listener::tangle::{ - generate_additional_tangle_logic, get_tangle_job_processor_wrapper, +use crate::special_impls::tangle::{ + generate_tangle_specific_impl, get_tangle_job_processor_wrapper, }; -use crate::shared::{pascal_case, type_to_field_type}; use gadget_blueprint_proc_macro_core::{FieldType, JobDefinition, JobMetadata}; use indexmap::{IndexMap, IndexSet}; use proc_macro::TokenStream; @@ -77,7 +77,13 @@ pub(crate) fn job_impl(args: &JobArgs, input: &ItemFn) -> syn::Result proc_macro2::TokenStream { #[allow(clippy::too_many_lines)] pub fn generate_additional_logic( input: &ItemFn, - job_args: &JobArgs, + event_listener_args: &EventListenerArgs, suffix: &str, + param_map: &IndexMap, + job_params: &[Ident], ) -> proc_macro2::TokenStream { let (_fn_name, _fn_name_string, struct_name) = generate_fn_name_and_struct(input, suffix); - let event_listener_args = &job_args.event_listener; - match job_args.event_listener.get_event_listener().listener_type { - ListenerType::Evm => generate_evm_event_handler(&struct_name, event_listener_args), + match event_listener_args.get_event_listener().listener_type { + ListenerType::Evm => { + generate_evm_specific_impl(&struct_name, event_listener_args, param_map, job_params) + } - ListenerType::Tangle => generate_additional_tangle_logic(&struct_name), + ListenerType::Tangle => { + generate_tangle_specific_impl(&struct_name, param_map, job_params, event_listener_args) + } ListenerType::Custom => proc_macro2::TokenStream::default(), } diff --git a/macros/blueprint-proc-macro/src/lib.rs b/macros/blueprint-proc-macro/src/lib.rs index 64a56a96..cbcfab8e 100644 --- a/macros/blueprint-proc-macro/src/lib.rs +++ b/macros/blueprint-proc-macro/src/lib.rs @@ -26,7 +26,7 @@ mod report; /// Shared utilities for the Blueprint Macros mod shared; -mod event_listener; +mod special_impls; /// Utilities for Tangle Blueprint macro generation mod tangle; diff --git a/macros/blueprint-proc-macro/src/report.rs b/macros/blueprint-proc-macro/src/report.rs index 0f9ed4ed..e88c630b 100644 --- a/macros/blueprint-proc-macro/src/report.rs +++ b/macros/blueprint-proc-macro/src/report.rs @@ -1,6 +1,7 @@ use crate::job::{ - declared_params_to_field_types, generate_autogen_struct, get_current_call_id_field_name, - get_job_id_field_name, get_result_type, EventListenerArgs, ResultsKind, + declared_params_to_field_types, generate_additional_logic, generate_autogen_struct, + get_current_call_id_field_name, get_job_id_field_name, get_result_type, EventListenerArgs, + ResultsKind, }; use crate::shared::{pascal_case, type_to_field_type}; use gadget_blueprint_proc_macro_core::{ @@ -131,15 +132,20 @@ pub(crate) fn report_impl(args: &ReportArgs, input: &ItemFn) -> syn::Result syn::Result syn::Result { } } -#[allow(dead_code)] -pub fn parse_struct_fields(fields: &syn::Fields) -> syn::Result> { - fields - .iter() - .map(|field| { - let name = field - .ident - .as_ref() - .ok_or_else(|| syn::Error::new_spanned(field, "Unnamed fields are not supported"))? - .to_string(); - let field_type = type_to_field_type(&field.ty)?; - Ok((name, field_type)) - }) - .collect() +/// Returns the set of arguments which are not job-related arguments. These typically go into the +/// autogenerated job struct +pub fn get_non_job_arguments( + param_map: &IndexMap, + job_params: &[Ident], +) -> IndexMap { + param_map + .clone() + .into_iter() + .filter(|r| !job_params.contains(&r.0)) + .collect::>() } #[cfg(test)] diff --git a/macros/blueprint-proc-macro/src/event_listener/evm.rs b/macros/blueprint-proc-macro/src/special_impls/evm.rs similarity index 74% rename from macros/blueprint-proc-macro/src/event_listener/evm.rs rename to macros/blueprint-proc-macro/src/special_impls/evm.rs index 59ce68f0..814c4a1e 100644 --- a/macros/blueprint-proc-macro/src/event_listener/evm.rs +++ b/macros/blueprint-proc-macro/src/special_impls/evm.rs @@ -4,6 +4,7 @@ use quote::{format_ident, quote}; use syn::{Ident, Type}; use crate::job::{declared_params_to_field_types, EventListenerArgs}; +use crate::shared::get_non_job_arguments; pub(crate) fn get_evm_instance_data( event_handler: &EventListenerArgs, @@ -21,18 +22,52 @@ pub(crate) fn get_evm_instance_data( ) } -pub(crate) fn generate_evm_event_handler( +pub(crate) fn generate_evm_specific_impl( struct_name: &Ident, - event_handler: &EventListenerArgs, + event_listener_args: &EventListenerArgs, + param_map: &IndexMap, + job_params: &[Ident], ) -> TokenStream { - let abi_string = event_handler + let abi_string = event_listener_args .get_event_listener() .evm_args .as_ref() .and_then(|r| r.abi.clone()) .expect("ABI String must exist"); + let non_job_param_map = get_non_job_arguments(param_map, job_params); + let mut new_function_signature = vec![]; + let mut constructor_args = vec![]; + + let (_, _, _, instance_name) = get_evm_instance_data(event_listener_args); + + // Push in the contract + new_function_signature.push(quote! { + contract: #instance_name, + }); + constructor_args.push(quote! { + contract, + contract_instance: Default::default(), + }); + + for (field_name, ty) in non_job_param_map { + new_function_signature.push(quote! { + #field_name: #ty, + }); + constructor_args.push(quote! { + #field_name, + }) + } + quote! { + impl #struct_name { + pub fn new(#(#new_function_signature)*) -> Self { + Self { + #(#constructor_args)* + } + } + } + impl Deref for #struct_name { type Target = gadget_sdk::event_listener::evm::contracts::AlloyContractInstance; diff --git a/macros/blueprint-proc-macro/src/event_listener/mod.rs b/macros/blueprint-proc-macro/src/special_impls/mod.rs similarity index 100% rename from macros/blueprint-proc-macro/src/event_listener/mod.rs rename to macros/blueprint-proc-macro/src/special_impls/mod.rs diff --git a/macros/blueprint-proc-macro/src/special_impls/tangle.rs b/macros/blueprint-proc-macro/src/special_impls/tangle.rs new file mode 100644 index 00000000..fb985b10 --- /dev/null +++ b/macros/blueprint-proc-macro/src/special_impls/tangle.rs @@ -0,0 +1,100 @@ +use crate::job::{declared_params_to_field_types, EventListenerArgs}; +use crate::shared::get_non_job_arguments; +use indexmap::IndexMap; +use proc_macro2::TokenStream; +use quote::quote; +use syn::{Ident, Type}; + +#[allow(clippy::too_many_arguments)] +pub(crate) fn generate_tangle_specific_impl( + struct_name: &Ident, + param_map: &IndexMap, + job_params: &[Ident], + event_listener_args: &EventListenerArgs, +) -> TokenStream { + let mut non_job_param_map = get_non_job_arguments(param_map, job_params); + let mut new_function_signature = vec![]; + let mut constructor_args = vec![]; + + if event_listener_args.get_event_listener().is_raw() { + // TODO: task 001: find better way to identify which ident is the raw event + // remove the 0th element + let _ = non_job_param_map.shift_remove_index(0); + } + + // Push the expected types + new_function_signature.push(quote! { + env: &gadget_sdk::config::gadget_config::GadgetConfiguration, + }); + + constructor_args.push(quote! { + client, + signer, + service_id, + }); + + for (param_name, param_type) in non_job_param_map { + new_function_signature.push(quote! { + #param_name: #param_type, + }); + + constructor_args.push(quote! { + #param_name, + }); + } + + quote! { + impl #struct_name { + pub async fn new(#(#new_function_signature)*) -> Result { + let client = env.client().await?; + let signer = env.first_sr25519_signer()?; + let service_id = env.service_id().ok_or_else(|| gadget_sdk::Error::Other("No service ID found in ENV".to_string()))?; + + Ok(Self { + #(#constructor_args)* + }) + } + } + + #[automatically_derived] + impl gadget_sdk::event_listener::markers::IsTangle for #struct_name {} + } +} + +pub(crate) fn get_tangle_job_processor_wrapper( + job_params: &[Ident], + param_map: &IndexMap, + event_listeners: &EventListenerArgs, + ordered_inputs: &mut Vec, + fn_name_ident: &Ident, + call_id_static_name: &Ident, + asyncness: &TokenStream, +) -> TokenStream { + let params = + declared_params_to_field_types(job_params, param_map).expect("Failed to generate params"); + let params_tokens = event_listeners.get_param_name_tokenstream(¶ms, true); + + let job_processor_call = if params_tokens.is_empty() { + let second_param = ordered_inputs.pop().expect("Expected a context"); + quote! { + // If no args are specified, assume this job has no parameters and thus takes in the raw event + #fn_name_ident (param0, #second_param) #asyncness .map_err(|err| gadget_sdk::Error::Other(err.to_string())) + } + } else { + quote! { + let mut args_iter = param0.args.clone().into_iter(); + #(#params_tokens)* + #fn_name_ident (#(#ordered_inputs)*) #asyncness .map_err(|err| gadget_sdk::Error::Other(err.to_string())) + } + }; + + quote! { + move |param0: gadget_sdk::event_listener::tangle::TangleEvent<_, _>| async move { + if let Some(call_id) = param0.call_id { + #call_id_static_name.store(call_id, std::sync::atomic::Ordering::Relaxed); + } + + #job_processor_call + } + } +} diff --git a/macros/blueprint-proc-macro/src/tangle/mod.rs b/macros/blueprint-proc-macro/src/tangle/mod.rs index 77e96337..2bd212a6 100644 --- a/macros/blueprint-proc-macro/src/tangle/mod.rs +++ b/macros/blueprint-proc-macro/src/tangle/mod.rs @@ -131,7 +131,7 @@ pub fn field_type_to_param_token( .collect(); quote! { - let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Struct(#ident)) = args_iter.next() else { #else_block }; + let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Struct(#ident, ..)) = args_iter.next() else { #else_block }; let mut #ident = #ident.into_iter(); #(#field_tokens)* let #ident = #struct_ident { From 407c026334ccabc980274b3f8cf63597a997a7d6 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 5 Nov 2024 12:32:48 -0500 Subject: [PATCH 2/3] feat: Add docstrings chore: lints --- .../tangle-raw-event-listener/src/main.rs | 13 +- macros/blueprint-proc-macro/src/job.rs | 6 +- macros/blueprint-proc-macro/src/lib.rs | 3 - .../src/special_impls/evm.rs | 7 + .../src/special_impls/tangle.rs | 158 +++++++++++++++++- macros/blueprint-proc-macro/src/tangle/mod.rs | 147 ---------------- 6 files changed, 174 insertions(+), 160 deletions(-) delete mode 100644 macros/blueprint-proc-macro/src/tangle/mod.rs diff --git a/blueprints/tangle-raw-event-listener/src/main.rs b/blueprints/tangle-raw-event-listener/src/main.rs index a9a6c31f..ebf72897 100644 --- a/blueprints/tangle-raw-event-listener/src/main.rs +++ b/blueprints/tangle-raw-event-listener/src/main.rs @@ -1,4 +1,4 @@ -use color_eyre::{eyre::eyre, Result}; +use color_eyre::Result; use gadget_sdk::info; use gadget_sdk::runners::{tangle::TangleConfig, BlueprintRunner}; use gadget_sdk::tangle_subxt::subxt::tx::Signer; @@ -6,16 +6,13 @@ use tangle_raw_event_listener_blueprint as blueprint; #[gadget_sdk::main(env)] async fn main() { - let client = env.client().await.map_err(|e| eyre!(e))?; - let signer = env.first_sr25519_signer().map_err(|e| eyre!(e))?; - - info!("Starting the event watcher for {} ...", signer.account_id()); - let x_square = blueprint::RawEventHandler::new(&env, blueprint::MyContext).await?; - let tangle_config = TangleConfig::default(); - info!("~~~ Executing the incredible squaring blueprint ~~~"); + info!( + "~~~ Executing the incredible squaring blueprint for {:?} ~~~", + x_square.signer.address() + ); BlueprintRunner::new(tangle_config, env) .job(x_square) .run() diff --git a/macros/blueprint-proc-macro/src/job.rs b/macros/blueprint-proc-macro/src/job.rs index 0ee7db4d..429dbe85 100644 --- a/macros/blueprint-proc-macro/src/job.rs +++ b/macros/blueprint-proc-macro/src/job.rs @@ -1025,7 +1025,11 @@ impl EventListenerArgs { let index = Index::from(i); match self.get_event_listener().listener_type { ListenerType::Tangle => { - crate::tangle::field_type_to_param_token(&ident, t, panic_on_decode_fail) + crate::special_impls::tangle::field_type_to_param_token( + &ident, + t, + panic_on_decode_fail, + ) } ListenerType::Evm => { quote! { diff --git a/macros/blueprint-proc-macro/src/lib.rs b/macros/blueprint-proc-macro/src/lib.rs index cbcfab8e..6cf373a7 100644 --- a/macros/blueprint-proc-macro/src/lib.rs +++ b/macros/blueprint-proc-macro/src/lib.rs @@ -28,9 +28,6 @@ mod shared; mod special_impls; -/// Utilities for Tangle Blueprint macro generation -mod tangle; - mod sdk_main; /// A procedural macro that annotates a function as a job. diff --git a/macros/blueprint-proc-macro/src/special_impls/evm.rs b/macros/blueprint-proc-macro/src/special_impls/evm.rs index 814c4a1e..6ff80f0a 100644 --- a/macros/blueprint-proc-macro/src/special_impls/evm.rs +++ b/macros/blueprint-proc-macro/src/special_impls/evm.rs @@ -59,8 +59,15 @@ pub(crate) fn generate_evm_specific_impl( }) } + let struct_name_as_literal = struct_name.to_string(); + quote! { impl #struct_name { + /// Create a new + #[doc = "["] + #[doc = #struct_name_as_literal] + #[doc = "`]"] + /// instance pub fn new(#(#new_function_signature)*) -> Self { Self { #(#constructor_args)* diff --git a/macros/blueprint-proc-macro/src/special_impls/tangle.rs b/macros/blueprint-proc-macro/src/special_impls/tangle.rs index fb985b10..fbc2748b 100644 --- a/macros/blueprint-proc-macro/src/special_impls/tangle.rs +++ b/macros/blueprint-proc-macro/src/special_impls/tangle.rs @@ -1,8 +1,9 @@ use crate::job::{declared_params_to_field_types, EventListenerArgs}; use crate::shared::get_non_job_arguments; +use gadget_blueprint_proc_macro_core::FieldType; use indexmap::IndexMap; use proc_macro2::TokenStream; -use quote::quote; +use quote::{format_ident, quote}; use syn::{Ident, Type}; #[allow(clippy::too_many_arguments)] @@ -43,8 +44,19 @@ pub(crate) fn generate_tangle_specific_impl( }); } + let struct_name_as_literal = struct_name.to_string(); + quote! { impl #struct_name { + /// Create a new + #[doc = "["] + #[doc = #struct_name_as_literal] + #[doc = "`]"] + /// instance + /// # Errors + /// + /// - `gadget_sdk::Error`: if the client fails to connect, the signer is not found, or + /// the service ID is not found. pub async fn new(#(#new_function_signature)*) -> Result { let client = env.client().await?; let signer = env.first_sr25519_signer()?; @@ -98,3 +110,147 @@ pub(crate) fn get_tangle_job_processor_wrapper( } } } + +#[allow(clippy::too_many_lines)] +pub fn field_type_to_param_token( + ident: &Ident, + t: &FieldType, + panic_on_decode_fail: bool, +) -> TokenStream { + let else_block = if panic_on_decode_fail { + quote! { + panic!("Failed to decode the field"); + } + } else { + quote! { + return Ok(vec![]); + } + }; + match t { + FieldType::Void => unreachable!("void type should not be in params"), + FieldType::Bool => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Bool(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Uint8 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint8(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Int8 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int8(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Uint16 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint16(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Int16 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int16(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Uint32 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint32(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Int32 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int32(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Uint64 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint64(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Int64 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int64(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Uint128 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint128(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::U256 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::U256(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Int128 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int128(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::Float64 => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Float64(#ident)) = args_iter.next() else { #else_block }; } + } + FieldType::String => { + let inner_ident = format_ident!("{}_inner", ident); + quote! { + let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::String(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::BoundedString(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec(#inner_ident)))) = args_iter.next() else { #else_block }; + // Convert the BoundedVec to a String + let #ident = match String::from_utf8(#inner_ident) { + Ok(s) => s, + Err(e) => { + ::gadget_sdk::warn!("failed to convert bytes to a valid utf8 string: {e}"); + return Err(gadget_sdk::Error::Other(e.to_string())); + } + }; + } + } + FieldType::Bytes => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Bytes(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec(#ident))) = args_iter.next() else { #else_block }; } + } + FieldType::Optional(t_x) => { + let inner_ident = format_ident!("{}_inner", ident); + let x_ident = format_ident!("{}_option", ident); + let x_inner = field_type_to_param_token(&x_ident, t_x, panic_on_decode_fail); + let inner = quote! { + let Some(#inner_ident) = args_iter.next() else { #else_block; }; + }; + quote! { + #inner + let #ident = match #inner_ident { + _ => { + #x_inner + Some(#x_ident) + }, + gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::None => None, + }; + } + } + FieldType::Array(_, _) => todo!("Handle array"), + FieldType::List(ty) => { + let inner_ident = format_ident!("{}_inner", ident); + let inner = quote! { + let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::List(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec(#inner_ident))) = args_iter.next() else { #else_block; }; + }; + + let ty_variant_ident = format_ident!("{ty:?}"); + + quote! { + #inner + let #ident = #inner_ident + .into_iter() + .map(|item| if let gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::<>:: #ty_variant_ident(val) = item { + val.0 + } else { + panic!("Failed to decode the list"); + }) + .collect::>(); + } + } + FieldType::Struct(name, fields) => { + let struct_ident = format_ident!("{}", name); + let field_tokens: Vec<_> = fields + .iter() + .map(|(field_name, field_type)| { + let field_ident = format_ident!("{}", field_name); + let inner_ident = format_ident!("{}_{}", ident, field_name); + let inner_token = + field_type_to_param_token(&inner_ident, field_type, panic_on_decode_fail); + quote! { + #inner_token + #field_ident: #inner_ident, + } + }) + .collect(); + + quote! { + let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Struct(#ident, ..)) = args_iter.next() else { #else_block }; + let mut #ident = #ident.into_iter(); + #(#field_tokens)* + let #ident = #struct_ident { + #(#field_tokens)* + }; + } + } + + FieldType::AccountId => { + quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::AccountId(#ident)) = args_iter.next() else { #else_block }; } + } + } +} diff --git a/macros/blueprint-proc-macro/src/tangle/mod.rs b/macros/blueprint-proc-macro/src/tangle/mod.rs deleted file mode 100644 index 2bd212a6..00000000 --- a/macros/blueprint-proc-macro/src/tangle/mod.rs +++ /dev/null @@ -1,147 +0,0 @@ -use gadget_blueprint_proc_macro_core::FieldType; -use quote::{format_ident, quote}; -use syn::Ident; - -#[allow(clippy::too_many_lines)] -pub fn field_type_to_param_token( - ident: &Ident, - t: &FieldType, - panic_on_decode_fail: bool, -) -> proc_macro2::TokenStream { - let else_block = if panic_on_decode_fail { - quote! { - panic!("Failed to decode the field"); - } - } else { - quote! { - return Ok(vec![]); - } - }; - match t { - FieldType::Void => unreachable!("void type should not be in params"), - FieldType::Bool => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Bool(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Uint8 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint8(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Int8 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int8(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Uint16 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint16(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Int16 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int16(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Uint32 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint32(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Int32 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int32(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Uint64 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint64(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Int64 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int64(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Uint128 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Uint128(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::U256 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::U256(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Int128 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Int128(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::Float64 => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Float64(#ident)) = args_iter.next() else { #else_block }; } - } - FieldType::String => { - let inner_ident = format_ident!("{}_inner", ident); - quote! { - let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::String(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::BoundedString(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec(#inner_ident)))) = args_iter.next() else { #else_block }; - // Convert the BoundedVec to a String - let #ident = match String::from_utf8(#inner_ident) { - Ok(s) => s, - Err(e) => { - ::gadget_sdk::warn!("failed to convert bytes to a valid utf8 string: {e}"); - return Err(gadget_sdk::Error::Other(e.to_string())); - } - }; - } - } - FieldType::Bytes => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Bytes(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec(#ident))) = args_iter.next() else { #else_block }; } - } - FieldType::Optional(t_x) => { - let inner_ident = format_ident!("{}_inner", ident); - let x_ident = format_ident!("{}_option", ident); - let x_inner = field_type_to_param_token(&x_ident, t_x, panic_on_decode_fail); - let inner = quote! { - let Some(#inner_ident) = args_iter.next() else { #else_block; }; - }; - quote! { - #inner - let #ident = match #inner_ident { - _ => { - #x_inner - Some(#x_ident) - }, - gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::None => None, - }; - } - } - FieldType::Array(_, _) => todo!("Handle array"), - FieldType::List(ty) => { - let inner_ident = format_ident!("{}_inner", ident); - let inner = quote! { - let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::List(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec(#inner_ident))) = args_iter.next() else { #else_block; }; - }; - - let ty_variant_ident = format_ident!("{ty:?}"); - - quote! { - #inner - let #ident = #inner_ident - .into_iter() - .map(|item| if let gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::<>:: #ty_variant_ident(val) = item { - val.0 - } else { - panic!("Failed to decode the list"); - }) - .collect::>(); - } - } - FieldType::Struct(name, fields) => { - let struct_ident = format_ident!("{}", name); - let field_tokens: Vec<_> = fields - .iter() - .map(|(field_name, field_type)| { - let field_ident = format_ident!("{}", field_name); - let inner_ident = format_ident!("{}_{}", ident, field_name); - let inner_token = - field_type_to_param_token(&inner_ident, field_type, panic_on_decode_fail); - quote! { - #inner_token - #field_ident: #inner_ident, - } - }) - .collect(); - - quote! { - let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::Struct(#ident, ..)) = args_iter.next() else { #else_block }; - let mut #ident = #ident.into_iter(); - #(#field_tokens)* - let #ident = #struct_ident { - #(#field_tokens)* - }; - } - } - - FieldType::AccountId => { - quote! { let Some(gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field::AccountId(#ident)) = args_iter.next() else { #else_block }; } - } - } -} From 95e03929ea8c638b8deb542125459e69e2d3312a Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 5 Nov 2024 13:29:41 -0500 Subject: [PATCH 3/3] fix: docstrings --- macros/blueprint-proc-macro/src/special_impls/evm.rs | 2 +- macros/blueprint-proc-macro/src/special_impls/tangle.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/blueprint-proc-macro/src/special_impls/evm.rs b/macros/blueprint-proc-macro/src/special_impls/evm.rs index 6ff80f0a..0e3eb153 100644 --- a/macros/blueprint-proc-macro/src/special_impls/evm.rs +++ b/macros/blueprint-proc-macro/src/special_impls/evm.rs @@ -64,7 +64,7 @@ pub(crate) fn generate_evm_specific_impl( quote! { impl #struct_name { /// Create a new - #[doc = "["] + #[doc = "[`"] #[doc = #struct_name_as_literal] #[doc = "`]"] /// instance diff --git a/macros/blueprint-proc-macro/src/special_impls/tangle.rs b/macros/blueprint-proc-macro/src/special_impls/tangle.rs index fbc2748b..88f37704 100644 --- a/macros/blueprint-proc-macro/src/special_impls/tangle.rs +++ b/macros/blueprint-proc-macro/src/special_impls/tangle.rs @@ -49,7 +49,7 @@ pub(crate) fn generate_tangle_specific_impl( quote! { impl #struct_name { /// Create a new - #[doc = "["] + #[doc = "[`"] #[doc = #struct_name_as_literal] #[doc = "`]"] /// instance