diff --git a/Cargo.lock b/Cargo.lock index f73a2e95..8f267ec1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -413,13 +413,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -540,9 +540,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -588,9 +588,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bitvec" @@ -670,9 +670,9 @@ dependencies = [ [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -715,9 +715,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" dependencies = [ "serde", ] @@ -730,7 +730,7 @@ checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" dependencies = [ "camino", "cargo-platform", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", "thiserror", @@ -790,9 +790,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", "clap_derive", @@ -800,9 +800,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", @@ -812,21 +812,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "coins-bip32" @@ -866,7 +866,7 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bech32", "bs58", "digest 0.10.7", @@ -956,19 +956,28 @@ version = "0.1.0" dependencies = [ "ethers", "eyre", + "http", + "metrics", + "opentelemetry", + "opentelemetry-datadog", + "opentelemetry-http", "serde", + "tokio", "tracing", + "tracing-opentelemetry", + "tracing-subscriber 0.3.17", ] [[package]] name = "const-hex" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa72a10d0e914cad6bcad4e7409e68d230c1c2db67896e19a37f758b1fcbdab5" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" dependencies = [ "cfg-if", "cpufeatures", "hex", + "proptest", "serde", ] @@ -1015,9 +1024,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -1126,6 +1135,16 @@ dependencies = [ "itertools 0.10.5", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.3" @@ -1199,9 +1218,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", "itoa", @@ -1211,9 +1230,9 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] @@ -1247,7 +1266,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1258,7 +1277,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1279,9 +1298,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] [[package]] name = "derivative" @@ -1402,9 +1424,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" -version = "0.13.5" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" dependencies = [ "base16ct", "crypto-bigint", @@ -1443,7 +1465,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "hex", "k256", @@ -1457,14 +1479,14 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -1489,9 +1511,9 @@ dependencies = [ [[package]] name = "enumset" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e875f1719c16de097dee81ed675e2d9bb63096823ed3f0ca827b7dea3028bbbb" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" dependencies = [ "enumset_derive", ] @@ -1505,7 +1527,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1516,25 +1538,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys 0.48.0", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eth-keystore" version = "0.5.0" @@ -1671,7 +1682,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.37", + "syn 2.0.38", "toml 0.7.8", "walkdir", ] @@ -1689,7 +1700,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1715,7 +1726,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.37", + "syn 2.0.38", "tempfile", "thiserror", "tiny-keccak", @@ -1725,7 +1736,7 @@ dependencies = [ [[package]] name = "ethers-core" version = "2.0.10" -source = "git+https://github.com/gakonst/ethers-rs#70e5f022b1bd94c26dbc85d57b5342e5e23ba8c2" +source = "git+https://github.com/gakonst/ethers-rs#841ff8c47980798fbb47991e047f8481b1d5eb39" dependencies = [ "arrayvec", "bytes", @@ -1756,7 +1767,7 @@ checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" dependencies = [ "ethers-core 2.0.10 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", "thiserror", @@ -1798,7 +1809,7 @@ checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.4", + "base64 0.21.5", "bytes", "const-hex", "enr", @@ -1867,7 +1878,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", "solang-parser", @@ -1943,9 +1954,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -1999,9 +2010,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -2014,9 +2025,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -2024,15 +2035,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -2041,9 +2052,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-locks" @@ -2057,26 +2068,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -2090,9 +2101,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -2214,7 +2225,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] @@ -2223,14 +2234,14 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "hashers" @@ -2343,7 +2354,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -2352,9 +2363,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -2387,12 +2398,11 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" name = "identity-sequencer" version = "0.1.0" dependencies = [ - "clap 4.4.6", + "clap 4.4.7", + "common", "ethers", "eyre", "futures", - "metrics", - "reqwest", "serde", "state_bridge", "tokio", @@ -2468,12 +2478,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", ] [[package]] @@ -2496,9 +2506,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -2537,18 +2547,18 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -2559,9 +2569,9 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "pem", - "ring", + "ring 0.16.20", "serde", "serde_json", "simple_asn1", @@ -2605,7 +2615,7 @@ dependencies = [ "lalrpop-util", "petgraph", "regex", - "regex-syntax", + "regex-syntax 0.7.5", "string_cache", "term", "tiny-keccak", @@ -2632,9 +2642,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libloading" @@ -2648,21 +2658,21 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -2713,6 +2723,15 @@ dependencies = [ "libc", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matchit" version = "0.7.3" @@ -2790,7 +2809,7 @@ checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2810,9 +2829,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -2879,6 +2898,16 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num" version = "0.4.1" @@ -2949,9 +2978,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -2969,23 +2998,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3054,11 +3083,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "a9dfc0783362704e97ef3bd24261995a699468440099ef95d869b4d9732f829a" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -3075,7 +3104,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3086,9 +3115,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830" dependencies = [ "cc", "libc", @@ -3096,12 +3125,117 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54" +dependencies = [ + "opentelemetry_api", + "opentelemetry_sdk", +] + +[[package]] +name = "opentelemetry-datadog" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5f4ecf595095d3b641dd2761a0c3d1f175d3d6c28f38e65418d8004ea3255dd" +dependencies = [ + "futures-core", + "http", + "indexmap 1.9.3", + "itertools 0.10.5", + "once_cell", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-semantic-conventions", + "reqwest", + "rmp", + "thiserror", + "url", +] + +[[package]] +name = "opentelemetry-http" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7594ec0e11d8e33faf03530a4c49af7064ebba81c1480e01be67d90b356508b" +dependencies = [ + "async-trait", + "bytes", + "http", + "opentelemetry_api", + "reqwest", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269" +dependencies = [ + "opentelemetry", +] + +[[package]] +name = "opentelemetry_api" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a81f725323db1b1206ca3da8bb19874bbd3f57c3bcd59471bfb04525b265b9b" +dependencies = [ + "futures-channel", + "futures-util", + "indexmap 1.9.3", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", +] + +[[package]] +name = "opentelemetry_sdk" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa8e705a0612d48139799fcbaba0d4a90f06277153e43dd2bdc16c6f0edd8026" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "once_cell", + "opentelemetry_api", + "ordered-float", + "percent-encoding", + "rand", + "regex", + "thiserror", + "tokio", + "tokio-stream", +] + [[package]] name = "option-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "ordered-float" +version = "3.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +dependencies = [ + "num-traits", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "owo-colors" version = "1.3.0" @@ -3134,7 +3268,7 @@ version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", @@ -3152,13 +3286,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -3225,9 +3359,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" dependencies = [ "memchr", "thiserror", @@ -3241,7 +3375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.2", + "indexmap 2.1.0", ] [[package]] @@ -3284,7 +3418,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3322,7 +3456,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3383,9 +3517,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b559898e0b4931ed2d3b959ab0c2da4d99cc644c4b0b1a35b4d344027f474023" +checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -3406,14 +3546,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "primitive-types" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", @@ -3433,6 +3573,15 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3459,9 +3608,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -3472,13 +3621,13 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.7.5", "unarray", ] @@ -3587,9 +3736,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] @@ -3618,33 +3767,54 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.6" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] name = "regex-automata" -version = "0.3.9" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.2", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + [[package]] name = "region" version = "3.0.0" @@ -3672,7 +3842,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -3728,12 +3898,26 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", - "untrusted", + "spin 0.5.2", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] + [[package]] name = "ripemd" version = "0.1.3" @@ -3757,7 +3941,7 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid 1.4.1", + "uuid 1.5.0", ] [[package]] @@ -3793,11 +3977,22 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rmp" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + [[package]] name = "ruint" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95294d6e3a6192f3aabf91c38f56505a625aa495533442744185a36d75a790c4" +checksum = "724fd11728a3804e9944b14cab63825024c40bf42f8af87c8b5d97c4bbacf426" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -3805,6 +4000,7 @@ dependencies = [ "bytes", "fastrlp", "num-bigint", + "num-traits", "parity-scale-codec", "primitive-types", "proptest", @@ -3855,16 +4051,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.19", + "semver 1.0.20", ] [[package]] name = "rustix" -version = "0.38.15" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -3873,12 +4069,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", - "ring", + "ring 0.17.5", "rustls-webpki", "sct", ] @@ -3889,17 +4085,17 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", ] [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] @@ -3934,9 +4130,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ "cfg-if", "derive_more", @@ -3946,11 +4142,11 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", @@ -3985,12 +4181,12 @@ dependencies = [ [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] @@ -4039,7 +4235,7 @@ dependencies = [ [[package]] name = "semaphore" version = "0.1.0" -source = "git+https://github.com/worldcoin/semaphore-rs?branch=main#404c2a59b41e60b83a83e7546bd9b3cda7e9a2a7" +source = "git+https://github.com/worldcoin/semaphore-rs?branch=main#a484bf0dd7d41d665ffabc56f31a852d0c4f27fd" dependencies = [ "ark-bn254", "ark-circom", @@ -4074,18 +4270,18 @@ dependencies = [ [[package]] name = "semaphore-depth-config" version = "0.1.0" -source = "git+https://github.com/worldcoin/semaphore-rs?branch=main#404c2a59b41e60b83a83e7546bd9b3cda7e9a2a7" +source = "git+https://github.com/worldcoin/semaphore-rs?branch=main#a484bf0dd7d41d665ffabc56f31a852d0c4f27fd" [[package]] name = "semaphore-depth-macros" version = "0.1.0" -source = "git+https://github.com/worldcoin/semaphore-rs?branch=main#404c2a59b41e60b83a83e7546bd9b3cda7e9a2a7" +source = "git+https://github.com/worldcoin/semaphore-rs?branch=main#a484bf0dd7d41d665ffabc56f31a852d0c4f27fd" dependencies = [ "itertools 0.10.5", "proc-macro2", "quote", "semaphore-depth-config", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4099,9 +4295,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ "serde", ] @@ -4133,9 +4329,9 @@ version = "0.1.0" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] @@ -4161,20 +4357,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -4246,9 +4442,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b21f559e07218024e7e9f90f96f601825397de0e25420135f7f952453fed0b" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -4322,9 +4518,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -4332,9 +4528,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -4360,6 +4556,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" version = "0.7.2" @@ -4431,15 +4633,15 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4450,16 +4652,16 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "svm-rs" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597e3a746727984cb7ea2487b6a40726cad0dbe86628e7d429aa6b8c4c153db4" +checksum = "d0cc95be7cc2c384a2f57cac56548d2178650905ebe5725bc8970ccc25529060" dependencies = [ "dirs", "fs2", "hex", "once_cell", "reqwest", - "semver 1.0.19", + "semver 1.0.20", "serde", "serde_json", "sha2", @@ -4481,9 +4683,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -4498,11 +4700,11 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sysctl" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed66d6a2ccbd656659289bc90767895b7abbdec897a0fc6031aca3ed1cb51d3e" +checksum = "ec7dddc5f0fee506baf8b9fdb989e242f17e4b11c61dfbb0635b705217199eea" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "byteorder", "enum-as-inner", "libc", @@ -4545,19 +4747,19 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "windows-sys 0.48.0", ] @@ -4584,22 +4786,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4614,12 +4816,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -4688,7 +4891,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -4701,7 +4904,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4724,6 +4927,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-tungstenite" version = "0.20.1" @@ -4743,9 +4957,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -4794,7 +5008,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -4807,7 +5021,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -4862,7 +5076,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4905,6 +5119,33 @@ dependencies = [ "tracing", ] +[[package]] +name = "tracing-log" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75327c6b667828ddc28f5e3f169036cb793c3f588d83bf0f262a7f062ffed3c8" +dependencies = [ + "once_cell", + "opentelemetry", + "opentelemetry_sdk", + "smallvec", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber 0.3.17", +] + [[package]] name = "tracing-subscriber" version = "0.2.25" @@ -4922,9 +5163,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", "sharded-slab", + "smallvec", "thread_local", + "tracing", "tracing-core", + "tracing-log", ] [[package]] @@ -4932,12 +5180,15 @@ name = "tree_availability" version = "0.1.0" dependencies = [ "axum", + "bytes", "common", "ethers", "eyre", "futures", + "futures-util", "hyper", "metrics", + "opentelemetry", "reqwest", "semaphore", "serde", @@ -5044,6 +5295,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.4.1" @@ -5055,6 +5312,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" @@ -5079,9 +5342,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" [[package]] name = "valuable" @@ -5128,9 +5391,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5138,24 +5401,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -5165,9 +5428,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5175,28 +5438,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasm-encoder" -version = "0.33.2" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34180c89672b3e4825c3a8db4b61a674f1447afd5fe2445b2d22c3d8b6ea086c" +checksum = "53ae0be20bf87918df4fa831bfbbd0b491d24aee407ed86360eae4c2c5608d38" dependencies = [ "leb128", ] @@ -5440,9 +5703,9 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wast" -version = "65.0.2" +version = "67.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55a88724cf8c2c0ebbf32c8e8f4ac0d6aa7ba6d73a1cfd94b254aa8f894317e" +checksum = "36c2933efd77ff2398b83817a98984ffe4b67aefd9aa1d2c8e68e19b553f1c38" dependencies = [ "leb128", "memchr", @@ -5452,18 +5715,18 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.74" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83e1a8d86d008adc7bafa5cf4332d448699a08fcf2a715a71fbb75e2c5ca188" +checksum = "c02905d13751dcb18f4e19f489d37a1bf139f519feaeef28d072a41a78e69a74" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -5701,9 +5964,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" dependencies = [ "memchr", ] @@ -5754,22 +6017,22 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.15" +version = "0.7.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ba595b9f2772fbee2312de30eeb80ec773b4cb2f1e8098db024afadda6c06f" +checksum = "e50cbb27c30666a6108abd6bc7577556265b44f243e2be89a8bc4e07a528c107" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.15" +version = "0.7.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772666c41fb6dceaf520b564b962d738a8e1a83b41bd48945f50837aed78bb1d" +checksum = "a25f293fe55f0a48e7010d65552bb63704f6ceb55a1a385da10d41d8f78e4a3d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5789,7 +6052,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -5833,11 +6096,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" +version = "2.0.9+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" dependencies = [ "cc", - "libc", "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index eb883cae..65f1bea4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,19 +6,17 @@ edition = "2021" [workspace] members = [ - "crates/common" -, + "crates/common", "crates/sequencer", "crates/state_bridge", "crates/tree_availability"] [dependencies] clap = { version = "4.4.6", features = ["derive"] } +common = { path = "./crates/common" } ethers = "2.0.10" eyre = "0.6.8" futures = "0.3.28" -metrics = "0.21.1" -reqwest = "0.11.22" serde = "1.0.188" state_bridge = { path = "crates/state_bridge" } tokio = { version = "1.33.0", features = ["full"] } diff --git a/bin/state_bridge_service.rs b/bin/state_bridge_service.rs index 60b108cc..974566c6 100644 --- a/bin/state_bridge_service.rs +++ b/bin/state_bridge_service.rs @@ -10,46 +10,30 @@ use ethers::prelude::{ SignerMiddleware, H160, }; use ethers::providers::Middleware; +use futures::stream::FuturesUnordered; +use futures::StreamExt; use serde::{Deserialize, Serialize}; -use state_bridge::bridge::{IBridgedWorldID, IStateBridge, StateBridge}; -use state_bridge::root::IWorldIDIdentityManager; +use state_bridge::abi::{ + IBridgedWorldID, IStateBridge, IWorldIDIdentityManager, +}; +use state_bridge::bridge::StateBridge; use state_bridge::StateBridgeService; use tracing::info; -// The state bridge service propagates roots from the world tree. Frequency of root propagation is specified -// by the relaying_period. This service will not propagate roots that have already been propagated before. #[derive(Parser, Debug)] #[clap( name = "State Bridge Service", - about = "The state bridge service propagates roots according to the specified relaying_period by calling the propagateRoot() method on each specified World ID StateBridge. The state bridge service will also make sure that it doesn't propagate roots that have already been propagated and have finalized on the BridgedWorldID side." + about = "The state bridge service listens to root changes from the WorldIdIdentityManager and propagates them to each of the corresponding Layer 2s specified in the configuration file." )] -struct Options { - #[clap(long, help = "Path to the TOML state bridge service config file")] +struct Opts { + #[clap( + short, + long, + help = "Path to the TOML state bridge service config file" + )] config: PathBuf, } -// Converts a u64 into a Duration using Duration::from_secs -mod duration_seconds { - use std::time::Duration; - - use serde::{Deserialize, Deserializer, Serializer}; - - pub fn serialize(duration: &Duration, s: S) -> Result - where - S: Serializer, - { - s.serialize_u64(duration.as_secs()) - } - - pub fn deserialize<'de, D>(d: D) -> Result - where - D: Deserializer<'de>, - { - let secs = u64::deserialize(d)?; - Ok(Duration::from_secs(secs)) - } -} - #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)] struct BridgeConfig { name: String, @@ -58,14 +42,24 @@ struct BridgeConfig { bridged_rpc_url: String, } -// The config TOML file defines all the necessary parameters to spawn a state bridge service. -// rpc_url - HTTP rpc url for an Ethereum node (string) -// private_key - pk to an address that will call the propagateRoot() method on the StateBridge contract (string) -// world_id_address - WorldIDIdentityManager contract address (string) -// bridge_pair_addresses - List of StateBridge and BridgedWorldID contract address pairs (strings) -// bridged_world_id_addresses - List of BridgedWorldID contract addresses (strings) -// relaying_period: propagateRoot() call period time in seconds (u64) -// block_confirmations - Number of block confirmations required for the propagateRoot call on the StateBridge contract (optional number) +//TODO: lets update this to be a yaml file and then we can do something like the following: +// rpc_url: "" +// private_key: "" +// world_id_address: "" +// block_confirmations: "" +// state_bridges: +// optimism: +// state_bridge_address: "" +// bridged_world_id_address: "" +// bridged_rpc_url: "" +// relaying_period_seconds: 5 +// +// arbitrum: +// state_bridge_address: "" +// bridged_world_id_address: "" +// bridged_rpc_url: "" +// relaying_period_seconds: 5 + #[derive(Deserialize, Serialize, Debug, Clone)] struct Config { // RPC URL for the HTTP provider (World ID IdentityManager) @@ -77,37 +71,25 @@ struct Config { // List of `StateBridge` and `BridgedWorldID` pair addresses bridge_configs: Vec, // `propagateRoot()` call period time in seconds - #[serde(with = "duration_seconds")] relaying_period_seconds: Duration, // Number of block confirmations required for the `propagateRoot` call on the `StateBridge` // contract - #[serde(default = "default_block_confirmations")] - block_confirmations: usize, -} - -fn default_block_confirmations() -> usize { - 1usize + block_confirmations: Option, } #[tokio::main] async fn main() -> eyre::Result<()> { - let options = Options::parse(); - - let contents = fs::read_to_string(&options.config)?; - + let opts = Opts::parse(); + let contents = fs::read_to_string(&opts.config)?; let config: Config = toml::from_str(&contents)?; - let rpc_url = config.rpc_url; - - let block_confirmations = config.block_confirmations; - spawn_state_bridge_service( - rpc_url, + config.rpc_url, config.private_key, config.world_id_address, config.bridge_configs, config.relaying_period_seconds, - block_confirmations, + config.block_confirmations.unwrap_or(0), ) .await?; @@ -127,15 +109,13 @@ async fn spawn_state_bridge_service( let chain_id = provider.get_chainid().await?.as_u64(); - let wallet = private_key - .parse::() - .expect("couldn't instantiate wallet from private key") - .with_chain_id(chain_id); + let wallet = private_key.parse::()?.with_chain_id(chain_id); let wallet_address = wallet.address(); - let middleware = SignerMiddleware::new(provider, wallet); - let middleware = NonceManagerMiddleware::new(middleware, wallet_address); - let middleware = Arc::new(middleware); + let signer_middleware = SignerMiddleware::new(provider, wallet); + let nonce_manager_middleware = + NonceManagerMiddleware::new(signer_middleware, wallet_address); + let middleware = Arc::new(nonce_manager_middleware); let world_id_interface = IWorldIDIdentityManager::new(world_id_address, middleware.clone()); @@ -187,75 +167,12 @@ async fn spawn_state_bridge_service( info!("Added a bridge to {} to the state-bridge-service", name); } - state_bridge_service.spawn().await?; - - Ok(()) -} - -#[cfg(test)] -mod tests { - use std::str::FromStr; - use std::time::Duration; - - use super::{Config, H160}; - use crate::BridgeConfig; + let handles = state_bridge_service.spawn().await?; - #[tokio::test] - async fn test_deserialize_toml() -> eyre::Result<()> { - let config: Config = toml::from_str( - r#" - rpc_url = "127.0.0.1:8545" - private_key = "4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318" - world_id_address = "0x3f0BF744bb79A0b919f7DED73724ec20c43572B9" - bridge_configs = [ - [ - "Optimism", - "0x3f0BF744bb79A0b919f7DED73724ec20c43572B9", - "0x4f0BF744bb79A0b919f7DED73724ec20c43572B9", - "127.0.0.1:8545", - ] - ] - relaying_period_seconds = 5 - "#) - .expect("couldn't deserialize toml-encoded string"); - - assert_eq!( - config.rpc_url, - String::from("127.0.0.1:8545"), - "RPC didn't match" - ); - assert_eq!(config.private_key, String::from("4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318"), "private key didn't match"); - assert_eq!( - config.world_id_address, - H160::from_str("0x3f0BF744bb79A0b919f7DED73724ec20c43572B9") - .unwrap(), - "World ID address didn't match" - ); - let bridged_configs: Vec = vec![BridgeConfig { - name: "Optimism".to_string(), - state_bridge_address: H160::from_str( - "0x3f0BF744bb79A0b919f7DED73724ec20c43572B9", - ) - .unwrap(), - bridged_world_id_address: H160::from_str( - "0x4f0BF744bb79A0b919f7DED73724ec20c43572B9", - ) - .unwrap(), - bridged_rpc_url: "127.0.0.1:8545".to_string(), - }]; - - assert_eq!(config.bridge_configs, bridged_configs); - // assert it uses serde default 1 block confirmation - assert_eq!( - config.block_confirmations, 1usize, - "block confirmations didn't match" - ); - assert_eq!( - config.relaying_period_seconds, - Duration::from_secs(5u64), - "relaying period didn't match" - ); - - Ok(()) + let mut handles = handles.into_iter().collect::>(); + while let Some(result) = handles.next().await { + result??; } + + Ok(()) } diff --git a/bin/tree_availability_service.rs b/bin/tree_availability_service.rs index 7b89a83d..8dcaae8f 100644 --- a/bin/tree_availability_service.rs +++ b/bin/tree_availability_service.rs @@ -1,10 +1,12 @@ use std::sync::Arc; use clap::Parser; +use common::tracing::init_subscriber; use ethers::providers::{Http, Provider}; use ethers::types::H160; use futures::stream::FuturesUnordered; use futures::StreamExt; +use tracing::Level; use tree_availability::TreeAvailabilityService; #[derive(Parser, Debug)] @@ -30,6 +32,13 @@ struct Opts { address: H160, #[clap(short, long, help = "Creation block of the World Tree")] creation_block: u64, + #[clap( + short, + long, + help = "Maximum window size when scanning blocks for TreeChanged events", + default_value = "1000" + )] + window_size: u64, #[clap(short, long, help = "Ethereum RPC endpoint")] rpc_endpoint: String, #[clap( @@ -39,12 +48,21 @@ struct Opts { default_value = "8080" )] port: u16, + #[clap(long, help = "Enable datadog backend for instrumentation")] + datadog: bool, } #[tokio::main] pub async fn main() -> eyre::Result<()> { let opts = Opts::parse(); + if opts.datadog { + todo!("Initialize datadog tracing backend"); + // init_datadog_subscriber("tree-availability-service", Level::INFO); + } else { + init_subscriber(Level::INFO); + } + let middleware = Arc::new(Provider::::try_from(opts.rpc_endpoint)?); let handles = TreeAvailabilityService::new( opts.tree_depth, @@ -52,6 +70,7 @@ pub async fn main() -> eyre::Result<()> { opts.tree_history_size, opts.address, opts.creation_block, + opts.window_size, middleware, ) .serve(opts.port) @@ -59,6 +78,7 @@ pub async fn main() -> eyre::Result<()> { let mut handles = handles.into_iter().collect::>(); while let Some(result) = handles.next().await { + tracing::error!("TreeAvailabilityError: {:?}", result); result??; } diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index b26531df..b6e55c04 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -13,4 +13,12 @@ ethers = { version = "2.0.10", features = [ ] } eyre = "0.6.8" serde = "1.0.189" -tracing = "0.1.39" +metrics = "0.21.1" +opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } +opentelemetry-datadog = {verison = "0.8.0", features = ["reqwest-client"]} +tracing = "0.1.40" +tracing-opentelemetry = "0.21.0" +tracing-subscriber = {version = "0.3.17", features = ["env-filter"]} +tokio = "1.33.0" +http = "0.2.9" +opentelemetry-http = "0.9.0" diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index 4815f05a..349bc246 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -1 +1,2 @@ pub mod test_utilities; +pub mod tracing; diff --git a/crates/common/src/tracing.rs b/crates/common/src/tracing.rs new file mode 100644 index 00000000..9c1723f0 --- /dev/null +++ b/crates/common/src/tracing.rs @@ -0,0 +1,55 @@ +use tracing::Level; +use tracing_opentelemetry::OpenTelemetrySpanExt; +use tracing_subscriber::filter::EnvFilter; +use tracing_subscriber::fmt; +use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt; +use tracing_subscriber::util::SubscriberInitExt; + +pub fn init_subscriber(level: Level) { + let fmt_layer = fmt::layer().with_target(false).with_level(true); + + let filter = EnvFilter::from_default_env().add_directive(level.into()); + + tracing_subscriber::registry() + .with(filter) + .with(fmt_layer) + .init(); +} + +pub fn init_datadog_subscriber(service_name: &str, level: Level) { + let tracer = opentelemetry_datadog::new_pipeline() + .with_service_name(service_name) + .with_api_version(opentelemetry_datadog::ApiVersion::Version05) + .install_batch(opentelemetry::runtime::Tokio) + .expect("Could not initialize tracer"); + + let otel_layer = tracing_opentelemetry::OpenTelemetryLayer::new(tracer); + + let filter = tracing_subscriber::filter::EnvFilter::from_default_env() + .add_directive(level.into()); + + let fmt_layer = fmt::layer().with_target(false).with_level(true); + + tracing_subscriber::registry() + .with(filter) + .with(fmt_layer) + .with(otel_layer) + .init(); +} + +pub fn trace_from_headers(headers: &http::HeaderMap) { + tracing::Span::current().set_parent( + opentelemetry::global::get_text_map_propagator(|propagator| { + propagator.extract(&opentelemetry_http::HeaderExtractor(headers)) + }), + ); +} + +pub fn trace_to_headers(headers: &mut http::HeaderMap) { + opentelemetry::global::get_text_map_propagator(|propagator| { + propagator.inject_context( + &tracing::Span::current().context(), + &mut opentelemetry_http::HeaderInjector(headers), + ); + }); +} diff --git a/crates/state_bridge/src/abi.rs b/crates/state_bridge/src/abi.rs new file mode 100644 index 00000000..a2a9d84a --- /dev/null +++ b/crates/state_bridge/src/abi.rs @@ -0,0 +1,23 @@ +use ethers::middleware::contract::abigen; + +abigen!( + IWorldIDIdentityManager, + r#"[ + function latestRoot() external returns (uint256) + event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) + ]"#; + + IStateBridge, + r#"[ + function propagateRoot() external + ]"#; + + IBridgedWorldID, + r#"[ + event RootAdded(uint256 root, uint128 timestamp) + function latestRoot() public view virtual returns (uint256) + function receiveRoot(uint256 newRoot) external + ]"#, + event_derives(serde::Deserialize, serde::Serialize) + +); diff --git a/crates/state_bridge/src/bridge.rs b/crates/state_bridge/src/bridge.rs index 91432ca3..1893b145 100644 --- a/crates/state_bridge/src/bridge.rs +++ b/crates/state_bridge/src/bridge.rs @@ -1,6 +1,5 @@ use std::sync::Arc; -use ethers::middleware::contract::abigen; use ethers::providers::Middleware; use ethers::types::H160; use ruint::Uint; @@ -8,29 +7,11 @@ use tokio::select; use tokio::task::JoinHandle; use tokio::time::{Duration, Instant}; +use crate::abi::{IBridgedWorldID, IStateBridge}; use crate::error::StateBridgeError; use crate::root::Hash; -abigen!( - IStateBridge, - r#"[ - function propagateRoot() external - ]"#; -); - -abigen!( - IBridgedWorldID, - r#"[ - event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) - event RootAdded(uint256 root, uint128 timestamp) - function latestRoot() public view virtual returns (uint256) - function receiveRoot(uint256 newRoot) external - ]"#, - event_derives(serde::Deserialize, serde::Serialize) -); - -/// The `StateBridge` takes care of listening to roots propagated from the `WorldRoot` and -/// propagates them periodically every time `relaying_period` elapses and the root was updated. +/// The `StateBridge` is responsible for monitoring root changes from the `WorldRoot`, propagating the root to the corresponding Layer 2. pub struct StateBridge { /// Interface for the `StateBridge` contract pub state_bridge: IStateBridge, @@ -43,15 +24,12 @@ pub struct StateBridge { } impl StateBridge { - /// Initializes a StateBridge + /// # Arguments /// - /// `state_bridge`: `StateBridge` contract interface - /// - /// `bridged_world_id`: `BridgedWorldID` contract interface - /// - /// `relaying_period`: Time in between `propagateRoot()` calls - /// - /// `block_confirmations: The number of blocks before a `propagateRoot()` call is considered finalized + /// * state_bridge - Interface to the StateBridge smart contract. + /// * bridged_world_id - Interface to the BridgedWorldID smart contract. + /// * relaying_period - Duration between successive propagateRoot() invocations. + /// * block_confirmations - Number of block confirmations required to consider a propagateRoot() transaction as finalized. pub fn new( state_bridge: IStateBridge, bridged_world_id: IBridgedWorldID, @@ -66,19 +44,14 @@ impl StateBridge { }) } - /// Initializes a StateBridge with address and middleware - /// - /// `bridge_address`: `StateBridge` contract address - /// - /// `canonical_middleware`: middleware for the chain where the `StateBridge` is deployed + /// # Arguments /// - /// `bridged_world_id_address`: `BridgedWorldID` contract address - /// - /// `derived_middleware`: middleware for the chain where the `BridgedWorldID` is deployed - /// - /// `relaying_period`: Time in between `propagateRoot()` calls - /// - /// `block_confirmations: The number of block confirmations before a `propagateRoot()` transaction is considered finalized + /// * `bridge_address` - Address of the StateBridge contract. + /// * `canonical_middleware` - Middleware for interacting with the chain where StateBridge is deployed. + /// * `bridged_world_id_address` - Address of the BridgedWorldID contract. + /// * `derived_middleware` - Middleware for interacting with the chain where BridgedWorldID is deployed. + /// * `relaying_period` - Duration between `propagateRoot()` transactions. + /// * `block_confirmations` - Number of block confirmations before a`propagateRoot()` transaction is considered finalized. pub fn new_from_parts( bridge_address: H160, canonical_middleware: Arc, @@ -103,9 +76,11 @@ impl StateBridge { }) } - /// Spawns the `StateBridge` which listens to the `WorldRoot` `TreeChanged` events for new roots to propagate. + /// Spawns a `StateBridge` task to listen for `TreeChanged` events from `WorldRoot` and propagate new roots. + /// + /// # Arguments /// - /// `root_rx`: The root receiver that listens to the `WorldRoot` root sender + /// * `root_rx` - Receiver channel for roots from `WorldRoot`. pub async fn spawn( &self, mut root_rx: tokio::sync::broadcast::Receiver, diff --git a/crates/state_bridge/src/lib.rs b/crates/state_bridge/src/lib.rs index a724d937..680f4aff 100644 --- a/crates/state_bridge/src/lib.rs +++ b/crates/state_bridge/src/lib.rs @@ -4,55 +4,42 @@ //! //! The state bridge service for the World ID protocol takes care of periodically relaying the latest roots from the World ID Identity Manager onto L2 networks or sidechains that implement native bridge on Ethereum or have an integration with third party messaging protocol. The state bridge service requires a deployment of the [`world-id-state-bridge`](github.com/worldcoin/world-id-state-bridge/) contracts which in turn also have to be connected to a valid [`world-id-contracts`](https://github.com/worldcoin/world-id-contracts/) deployment. +pub mod abi; pub mod bridge; pub mod error; pub mod root; use std::sync::Arc; +use abi::IWorldIDIdentityManager; use bridge::StateBridge; use error::StateBridgeError; use ethers::providers::Middleware; use ethers::types::H160; -use root::{IWorldIDIdentityManager, WorldTreeRoot}; +use root::WorldTreeRoot; use tokio::task::JoinHandle; -/// `StateBridgeService` has handles to `StateBridge` contracts, periodically -/// calls the `propagateRoot` method on them and ensures that the transaction -/// finalizes on Ethereum mainnet. It also monitors `_latestRoot` changes -/// on the `WorldIDIdentityManager` contract and calls `propagateRoot` only if -/// the root has changed and a specific relay period amount of time has elapsed. +/// Monitors the world tree root for changes and propagates new roots to target Layer 2s pub struct StateBridgeService { - /// `WorldIDIdentityManager` contract interface + /// Local state of the world tree root, responsible for listening to TreeChanged events from the`WorldIDIdentityManager`. pub canonical_root: WorldTreeRoot, - /// List of `StateBridge` contract interfaces + /// Vec of `StateBridge`, responsible for root propagation to target Layer 2s. pub state_bridges: Vec>, - /// `StateBridge` Tokio task handles - pub handles: Vec>>>, } impl StateBridgeService where M: Middleware, { - /// Initializes the `StateBridgeService` - /// - /// `world_tree`:`IWorldID ` - interface to the `WorldIDIdentityManager` pub async fn new( world_tree: IWorldIDIdentityManager, ) -> Result> { Ok(Self { canonical_root: WorldTreeRoot::new(world_tree).await?, state_bridges: vec![], - handles: vec![], }) } - /// Initializes the `StateBridgeService` - /// - /// `world_tree_address`:`H160` - interface to the `WorldIDIdentityManager` - /// - /// `middleware`:`Arc` - Middleware provider pub async fn new_from_parts( world_tree_address: H160, middleware: Arc, @@ -63,44 +50,36 @@ where Ok(Self { canonical_root: WorldTreeRoot::new(world_tree).await?, state_bridges: vec![], - handles: vec![], }) } - /// Adds a state bridge to the list of state bridges the service will use - /// to propagate roots on chain to their destination chains. - /// - /// `state_bridge`: `StateBridge` - state bridge contract interface with provider - /// - /// ### Notes - /// - /// Needs to be called before the spawn function so that the `StateBridgeService` - /// knows where to propagate roots to. + /// Adds a `StateBridge` to orchestrate root propagation to a target Layer 2. pub fn add_state_bridge(&mut self, state_bridge: StateBridge) { self.state_bridges.push(state_bridge); } /// Spawns the `StateBridgeService`. - pub async fn spawn(&mut self) -> Result<(), StateBridgeError> { - // if no state bridge initialized then there is no point in spawning - // the state bridge service as there'd be no receivers for new roots. + pub async fn spawn( + &mut self, + ) -> Result< + Vec>>>, + StateBridgeError, + > { if self.state_bridges.is_empty() { return Err(StateBridgeError::BridgesNotInitialized); } - // We first instantiate the receivers on the state bridges - // so that the root sender doesn't yield an error when pushing roots - // through the channel. + let mut handles = vec![]; + + // Bridges are spawned before the root so that the broadcast channel has active subscribers before the sender is spawned to avoid a SendError for bridge in self.state_bridges.iter() { - self.handles.push( + handles.push( bridge.spawn(self.canonical_root.root_tx.subscribe()).await, ); } - // creates a sender to the channel which will fetch new roots - // and pass it to the `StateBridge` through the channel - self.handles.push(self.canonical_root.spawn().await); + handles.push(self.canonical_root.spawn().await); - Ok(()) + Ok(handles) } } diff --git a/crates/state_bridge/src/root.rs b/crates/state_bridge/src/root.rs index 5c16e8d2..2a6fdaad 100644 --- a/crates/state_bridge/src/root.rs +++ b/crates/state_bridge/src/root.rs @@ -8,28 +8,14 @@ use semaphore::merkle_tree::Hasher; use semaphore::poseidon_tree::PoseidonHash; pub type Hash = ::Hash; -use ethers::prelude::abigen; use tokio::task::JoinHandle; +use crate::abi::{IWorldIDIdentityManager, TreeChangedFilter}; use crate::error::StateBridgeError; -// Creates the ABI for the WorldIDIdentityManager interface -abigen!( - IWorldIDIdentityManager, - r#"[ - function latestRoot() external returns (uint256) - event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) - ]"#; -); - -/// `WorldTreeRoot` is the struct that has a `WorldIDIdentityManager` interface -/// and sends the latest roots to a channel so that the `StateBridgeService` can -/// consume them. It listens to `TreeChanged` events on `WorldIDIdentityManager` in -/// order to update its internal state. +/// Monitors `TreeChanged` events from `WorldIDIdentityManager` and broadcasts new roots to through the `root_tx`. pub struct WorldTreeRoot { - /// `WorldIDIdentityManager` contract interface pub world_id_identity_manager: IWorldIDIdentityManager, - /// channel to send the latest roots to the `StateBridge` pub root_tx: tokio::sync::broadcast::Sender, } @@ -37,9 +23,6 @@ impl WorldTreeRoot where M: Middleware, { - /// Initializes `WorldTreeRoot` - /// - /// `world_id_identity_manager`:`IWorldIDIdentityManager` - `WorldIDIdentityManager` interface pub async fn new( world_id_identity_manager: IWorldIDIdentityManager, ) -> Result> { @@ -51,13 +34,6 @@ where }) } - /// Initializes `WorldTreeRoot` from address and middleware - /// - /// `world_id_identity_manager`:`IWorldIDIdentityManager` - `WorldIDIdentityManager` interface - /// - /// `world_tree_address`: `H160` - `WorldIDIdentityManager` contract address - /// - /// `middleware`: `Arc` - Middleware provider (ethers) pub async fn new_from_parts( world_tree_address: H160, middleware: Arc, @@ -75,22 +51,20 @@ where }) } - /// Spawns the `WorldTreeRoot` task which will fetch the latest root in the `WorldIDIdentityManager` - /// [merkle tree root](https://github.com/worldcoin/world-id-contracts/blob/852790da8f348d6a2dbb58d1e29123a644f4aece/src/WorldIDIdentityManagerImplV1.sol#L63) every single time the - /// tree is updated by a batch insertion or batch deletion operation. + /// Spawns the `WorldTreeRoot` task which will listen to changes to the `WorldIDIdentityManager` + /// [merkle tree root](https://github.com/worldcoin/world-id-contracts/blob/852790da8f348d6a2dbb58d1e29123a644f4aece/src/WorldIDIdentityManagerImplV1.sol#L63). pub async fn spawn(&self) -> JoinHandle>> { let root_tx = self.root_tx.clone(); let world_id_identity_manager = self.world_id_identity_manager.clone(); tokio::spawn(async move { - // event emitted when insertions or deletions on the merkle tree have taken place + // Event emitted when insertions or deletions are made to the tree let filter = world_id_identity_manager.event::(); let mut event_stream = filter.stream().await?.with_meta(); // Listen to a stream of events, when a new event is received, update the root and block number while let Some(Ok((event, _))) = event_stream.next().await { - // Send it through the tx, you can convert ethers U256 to ruint with Uint::from_limbs() root_tx.send(Uint::from_limbs(event.post_root.0))?; } diff --git a/crates/state_bridge/tests/bridge_service.rs b/crates/state_bridge/tests/bridge_service.rs index bc0f96ca..66adc803 100644 --- a/crates/state_bridge/tests/bridge_service.rs +++ b/crates/state_bridge/tests/bridge_service.rs @@ -16,10 +16,12 @@ pub use ethers::types::{Bytes, H256, U256}; pub use ethers::utils::{Anvil, AnvilInstance}; pub use serde::{Deserialize, Serialize}; pub use serde_json::json; -use state_bridge::bridge::{IBridgedWorldID, IStateBridge, StateBridge}; +use state_bridge::abi::{ + IBridgedWorldID, IStateBridge, IWorldIDIdentityManager, +}; +use state_bridge::bridge::StateBridge; use state_bridge::error::StateBridgeError; -use state_bridge::root::IWorldIDIdentityManager; -use state_bridge::StateBridgeService; +use state_bridge::{root, StateBridgeService}; pub use tokio::spawn; pub use tokio::task::JoinHandle; pub use tracing::{error, info, instrument}; diff --git a/crates/tree_availability/Cargo.toml b/crates/tree_availability/Cargo.toml index 0f1493f5..0beadb3a 100644 --- a/crates/tree_availability/Cargo.toml +++ b/crates/tree_availability/Cargo.toml @@ -25,8 +25,11 @@ serde_json = "1.0.107" take_mut = "0.2.2" thiserror = "1.0.49" tokio = { version = "1.32.0", features = ["sync", "macros"] } -tracing = "0.1.37" +tracing = {version = "0.1.37", features = ["attributes"]} +opentelemetry = "0.20.0" +common = { path = "../common" } +bytes = "1.5.0" +futures-util = "0.3.29" [dev-dependencies] -common = { path = "../common" } reqwest = { version = "0.11.22", features = ["json"] } diff --git a/crates/tree_availability/src/lib.rs b/crates/tree_availability/src/lib.rs index 0a7282e9..2c808f7d 100644 --- a/crates/tree_availability/src/lib.rs +++ b/crates/tree_availability/src/lib.rs @@ -14,6 +14,7 @@ pub mod world_tree; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; +use axum::middleware; use error::TreeAvailabilityError; use ethers::providers::Middleware; use ethers::types::H160; @@ -50,6 +51,7 @@ impl TreeAvailabilityService { tree_history_size: usize, world_tree_address: H160, world_tree_creation_block: u64, + window_size: u64, middleware: Arc, ) -> Self { let tree = PoseidonTree::::new_with_dense_prefix( @@ -63,6 +65,7 @@ impl TreeAvailabilityService { tree_history_size, world_tree_address, world_tree_creation_block, + window_size, middleware, )); @@ -85,19 +88,24 @@ impl TreeAvailabilityService { let mut handles = vec![]; // Initialize a new router and spawn the server + tracing::info!(?port, "Initializing axum server"); + let router = axum::Router::new() .route("/inclusionProof", axum::routing::post(inclusion_proof)) .route("/synced", axum::routing::post(synced)) + .layer(middleware::from_fn(server::middleware::logging::middleware)) .with_state(self.world_tree.clone()); let address = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port); let server_handle = tokio::spawn(async move { + tracing::info!("Spawning server"); axum::Server::bind(&address) .serve(router.into_make_service()) .await .map_err(TreeAvailabilityError::HyperError)?; + tracing::info!("Server spawned"); Ok(()) }); diff --git a/crates/tree_availability/src/server/middleware/logging.rs b/crates/tree_availability/src/server/middleware/logging.rs new file mode 100644 index 00000000..ec23ea6e --- /dev/null +++ b/crates/tree_availability/src/server/middleware/logging.rs @@ -0,0 +1,222 @@ +#![allow(clippy::cast_possible_truncation)] + +use axum::http::{Request, StatusCode}; +use axum::middleware::Next; +use axum::response::Response; +use bytes::Bytes; +use hyper::body::HttpBody; +use hyper::{Body, Method}; +use tracing::{error, info, info_span, warn, Instrument}; + +// 1 MiB +const MAX_REQUEST_BODY_SIZE: u64 = 1024 * 1024; + +pub async fn middleware( + request: Request, + next: Next, +) -> Result +where + B: HttpBody, + ::Error: std::error::Error, +{ + let (parts, body) = request.into_parts(); + + let uri_path = parts.uri.path().to_string(); + let request_method = parts.method.clone(); + let request_query = parts.uri.query().map(ToString::to_string); + + if let Method::GET = request_method { + let span = + info_span!("request", ?uri_path, ?request_method, ?request_query); + + async { + common::tracing::trace_from_headers(&parts.headers); + + info!( + uri_path, + ?request_method, + ?request_query, + "Processing request" + ); + + let body = Body::empty(); + let request = Request::from_parts(parts, body); + + let response = next.run(request).await; + + let mut response = handle_response( + &uri_path, + &request_method, + request_query.as_deref(), + response, + ) + .await?; + common::tracing::trace_to_headers(response.headers_mut()); + + Ok(response) + } + .instrument(span) + .await + } else { + let body = body_to_string(body).await?; + + let span = info_span!( + "request", + ?uri_path, + ?request_method, + ?request_query, + ?body + ); + + async { + common::tracing::trace_from_headers(&parts.headers); + + info!( + ?uri_path, + ?request_method, + ?request_query, + ?body, + "Processing request" + ); + + let body = Body::from(body); + let request = Request::from_parts(parts, body); + + let response = next.run(request).await; + + let mut response = handle_response( + &uri_path, + &request_method, + request_query.as_deref(), + response, + ) + .await?; + + common::tracing::trace_to_headers(response.headers_mut()); + + Ok(response) + } + .instrument(span) + .await + } +} + +async fn handle_response( + uri_path: &str, + request_method: &Method, + request_query: Option<&str>, + response: Response, +) -> Result { + let (parts, body) = response.into_parts(); + + let response_status = parts.status; + + let response = if response_status.is_client_error() + || response_status.is_server_error() + { + let response_body = body_to_string(body).await?; + + if response_status.is_client_error() { + warn!( + uri_path, + ?request_method, + ?request_query, + ?response_status, + ?response_body, + "Error processing request" + ); + } else { + error!( + uri_path, + ?request_method, + ?request_query, + ?response_status, + ?response_body, + "Error processing request" + ); + } + + let body = axum::body::boxed(Body::from(response_body)); + + Response::from_parts(parts, body) + } else { + Response::from_parts(parts, body) + }; + + info!( + uri_path, + ?request_method, + ?request_query, + ?response_status, + "Finished processing request" + ); + + Ok(response) +} + +/// Reads the body of a request into a `Bytes` object chunk by chunk +/// and returns an error if the body is larger than `MAX_REQUEST_BODY_SIZE`. +async fn body_to_bytes_safe(body: B) -> Result +where + B: HttpBody, + ::Error: std::error::Error, +{ + use bytes::BufMut; + + let size_hint = body + .size_hint() + .upper() + .unwrap_or_else(|| body.size_hint().lower()); + + if size_hint > MAX_REQUEST_BODY_SIZE { + error!( + "Request body too large: {} bytes (max: {} bytes)", + size_hint, MAX_REQUEST_BODY_SIZE + ); + + return Err(StatusCode::PAYLOAD_TOO_LARGE); + } + + let mut body_bytes = Vec::with_capacity(size_hint as usize); + + futures_util::pin_mut!(body); + + while let Some(chunk) = body.data().await { + let chunk = chunk.map_err(|error| { + error!("Error reading body: {}", error); + StatusCode::INTERNAL_SERVER_ERROR + })?; + + body_bytes.put(chunk); + + if body_bytes.len() > MAX_REQUEST_BODY_SIZE as usize { + error!( + "Request body too large: {} bytes (max: {} bytes)", + body_bytes.len(), + MAX_REQUEST_BODY_SIZE + ); + + return Err(StatusCode::PAYLOAD_TOO_LARGE); + } + } + + Ok(body_bytes.into()) +} + +async fn body_to_string(body: B) -> Result +where + B: HttpBody, + ::Error: std::error::Error, +{ + let body_bytes = body_to_bytes_safe(body).await?; + + let s = match String::from_utf8(body_bytes.to_vec()) { + Ok(s) => s, + Err(error) => { + error!("Error converting body to string: {}", error); + return Err(StatusCode::BAD_REQUEST); + } + }; + + Ok(s) +} diff --git a/crates/tree_availability/src/server/middleware/mod.rs b/crates/tree_availability/src/server/middleware/mod.rs new file mode 100644 index 00000000..31348d2f --- /dev/null +++ b/crates/tree_availability/src/server/middleware/mod.rs @@ -0,0 +1 @@ +pub mod logging; diff --git a/crates/tree_availability/src/server.rs b/crates/tree_availability/src/server/mod.rs similarity index 95% rename from crates/tree_availability/src/server.rs rename to crates/tree_availability/src/server/mod.rs index aca2ddc2..df09f22c 100644 --- a/crates/tree_availability/src/server.rs +++ b/crates/tree_availability/src/server/mod.rs @@ -1,6 +1,8 @@ use std::sync::atomic::Ordering; use std::sync::Arc; +pub mod middleware; + use axum::extract::State; use axum::http::StatusCode; use axum::response::IntoResponse; @@ -15,7 +17,7 @@ use serde_json::Value; use crate::error::TreeError; use crate::world_tree::{Hash, WorldTree}; -#[derive(Serialize, Deserialize)] +#[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct InclusionProofRequest { pub identity_commitment: Hash, @@ -38,7 +40,6 @@ impl InclusionProofRequest { #[serde(rename_all = "camelCase")] pub struct InclusionProof { pub root: Field, - //TODO: Implement `Deserialize` for Proof within semaphore-rs instead of using `deserialize_with` #[serde(deserialize_with = "deserialize_proof")] pub proof: Proof, pub message: Option, @@ -77,6 +78,7 @@ where } } +#[tracing::instrument(level = "debug", skip(world_tree))] pub async fn inclusion_proof( State(world_tree): State>>, Json(req): Json, @@ -109,6 +111,7 @@ impl SyncResponse { } } +#[tracing::instrument(level = "debug", skip(world_tree))] pub async fn synced( State(world_tree): State>>, ) -> (StatusCode, Json) { diff --git a/crates/tree_availability/src/world_tree/abi.rs b/crates/tree_availability/src/world_tree/abi.rs index 90a0be72..d30890d2 100644 --- a/crates/tree_availability/src/world_tree/abi.rs +++ b/crates/tree_availability/src/world_tree/abi.rs @@ -1,10 +1,13 @@ use ethers::middleware::contract::abigen; +//TODO: Update staging deployment and remove `deleteIdentities` containing a batch size from the abi below abigen!( IWorldIDIdentityManager, r#"[ event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) function registerIdentities(uint256[8] calldata insertionProof, uint256 preRoot, uint32 startIndex, uint256[] calldata identityCommitments, uint256 postRoot) external function deleteIdentities(uint256[8] calldata deletionProof, bytes calldata packedDeletionIndices, uint256 preRoot, uint256 postRoot) external + function deleteIdentities(uint256[8] calldata deletionProof, uint32 batchSize, bytes calldata packedDeletionIndices, uint256 preRoot, uint256 postRoot) external + ]"#; ); diff --git a/crates/tree_availability/src/world_tree/block_scanner.rs b/crates/tree_availability/src/world_tree/block_scanner.rs index 48a6b388..f3034be5 100644 --- a/crates/tree_availability/src/world_tree/block_scanner.rs +++ b/crates/tree_availability/src/world_tree/block_scanner.rs @@ -10,7 +10,7 @@ pub struct BlockScanner { /// The onchain data provider middleware: M, /// The block from which to start parsing a given event - current_block: AtomicU64, + pub last_synced_block: AtomicU64, /// The maximum block range to parse window_size: u64, } @@ -27,7 +27,7 @@ where ) -> Self { Self { middleware, - current_block: AtomicU64::new(current_block), + last_synced_block: AtomicU64::new(current_block), window_size, } } @@ -45,34 +45,32 @@ where ) -> Result, M::Error> { let latest_block = self.middleware.get_block_number().await?.as_u64(); - let current_block = self.current_block.load(Ordering::SeqCst); + let last_synced_block = self.last_synced_block.load(Ordering::SeqCst); - if current_block >= latest_block { + if last_synced_block >= latest_block { return Ok(Vec::new()); } - let from_block = current_block; + let from_block = last_synced_block + 1; let to_block = latest_block.min(from_block + self.window_size); - let next_current_block = to_block + 1; - - let from_block = Some(BlockNumber::Number(from_block.into())); - let to_block = Some(BlockNumber::Number(to_block.into())); + tracing::info!(?from_block, ?to_block, "Scanning blocks"); let logs = self .middleware .get_logs(&Filter { block_option: FilterBlockOption::Range { - from_block, - to_block, + from_block: Some(BlockNumber::Number(from_block.into())), + to_block: Some(BlockNumber::Number(to_block.into())), }, address, topics, }) .await?; - self.current_block - .store(next_current_block, Ordering::SeqCst); + self.last_synced_block.store(to_block, Ordering::SeqCst); + + tracing::info!(?to_block, "Current block updated"); Ok(logs) } diff --git a/crates/tree_availability/src/world_tree/mod.rs b/crates/tree_availability/src/world_tree/mod.rs index 1d3d9ef6..b776aa2e 100644 --- a/crates/tree_availability/src/world_tree/mod.rs +++ b/crates/tree_availability/src/world_tree/mod.rs @@ -39,20 +39,17 @@ impl WorldTree { /// /// # Arguments /// - /// * `tree` - The PoseidonTree used for the merkle tree representation. + /// * `tree` - The `PoseidonTree` used for the merkle tree representation. /// * `tree_history_size` - The number of historical tree roots to keep in memory. /// * `address` - The smart contract address of the `WorldIDIdentityManager`. /// * `creation_block` - The block number at which the contract was deployed. /// * `middleware` - Provider to interact with Ethereum. - /// - /// # Returns - /// - /// New instance of `WorldTree`. pub fn new( tree: PoseidonTree, tree_history_size: usize, address: H160, creation_block: u64, + window_size: u64, middleware: Arc, ) -> Self { Self { @@ -60,6 +57,7 @@ impl WorldTree { tree_updater: Arc::new(TreeUpdater::new( address, creation_block, + window_size, middleware, )), synced: Arc::new(AtomicBool::new(false)), @@ -67,15 +65,13 @@ impl WorldTree { } /// Spawns a task that continually syncs the `TreeData` to the state at the chain head. - /// - /// # Returns - /// - /// A `JoinHandle` that resolves to a `Result<(), TreeAvailabilityError>` when the spawned task completes. pub async fn spawn( &self, ) -> JoinHandle>> { let tree_data = self.tree_data.clone(); let tree_updater = self.tree_updater.clone(); + + tracing::info!("Spawning thread to sync tree"); let synced = self.synced.clone(); tokio::spawn(async move { @@ -85,7 +81,6 @@ impl WorldTree { loop { tree_updater.sync_to_head(&tree_data).await?; - // Sleep a little to unblock the executor tokio::time::sleep(Duration::from_secs(5)).await; } }) diff --git a/crates/tree_availability/src/world_tree/tree_data.rs b/crates/tree_availability/src/world_tree/tree_data.rs index 1e28987c..a36250d7 100644 --- a/crates/tree_availability/src/world_tree/tree_data.rs +++ b/crates/tree_availability/src/world_tree/tree_data.rs @@ -11,6 +11,8 @@ use crate::server::InclusionProof; pub struct TreeData { /// A canonical in-memory representation of the World Tree. pub tree: RwLock>, + /// Depth of the merkle tree. + pub depth: usize, /// The number of historical tree roots to cache for serving older proofs. pub tree_history_size: usize, /// Cache of historical tree state, used to serve proofs against older roots. If the cache becomes larger than `tree_history_size`, the oldest roots are removed on a FIFO basis. @@ -18,20 +20,15 @@ pub struct TreeData { } impl TreeData { - /// Initializes a new instance of `TreeData`. - /// /// * `tree` - PoseidonTree representing the World Tree onchain, which will be used to generate inclusion proofs. /// * `tree_history_size` - Number of previous tree states to retain for serving proofs with historical roots. - /// - /// # Returns - /// - /// A new `TreeData` instance. pub fn new( tree: PoseidonTree, tree_history_size: usize, ) -> Self { Self { tree_history_size, + depth: tree.depth(), tree: RwLock::new(tree.derived()), tree_history: RwLock::new(VecDeque::new()), } @@ -52,7 +49,9 @@ impl TreeData { let mut tree = self.tree.write().await; for (i, identity) in identities.iter().enumerate() { - *tree = tree.update(start_index + i, identity); + let idx = start_index + i; + *tree = tree.update(idx, identity); + tracing::info!(?identity, ?idx, "Inserted identity"); } } @@ -68,6 +67,7 @@ impl TreeData { for idx in delete_indices.iter() { *tree = tree.update(*idx, &Hash::ZERO); + tracing::info!(?idx, "Deleted identity"); } } @@ -77,10 +77,20 @@ impl TreeData { let mut tree_history = self.tree_history.write().await; if tree_history.len() == self.tree_history_size { - tree_history.pop_back(); + let historical_tree = tree_history + .pop_back() + .expect("Tree history length should be > 0"); + + let historical_root = historical_tree.root(); + tracing::info!(?historical_root, "Popping tree from history",); } - tree_history.push_front(self.tree.read().await.clone()); + let updated_tree = self.tree.read().await.clone(); + + let new_root = updated_tree.root(); + tracing::info!(?new_root, "Pushing tree to history",); + + tree_history.push_front(updated_tree); } } @@ -97,18 +107,11 @@ impl TreeData { ) -> Option { let tree = self.tree.read().await; - // If the root is not specified, use the latest root - if root.is_none() { - Some(InclusionProof::new( - tree.root(), - Self::proof(&tree, identity)?, - None, - )) - } else { - let root = root.unwrap(); - + if let Some(root) = root { // If the root is the latest root, use the current version of the tree if root == tree.root() { + tracing::info!(?identity, ?root, "Getting inclusion proof"); + return Some(InclusionProof::new( root, Self::proof(&tree, identity)?, @@ -116,9 +119,15 @@ impl TreeData { )); } else { let tree_history = self.tree_history.read().await; - // // Otherwise, search the tree history for the root and use the corresponding tree + // Otherwise, search the tree history for the root and use the corresponding tree for prev_tree in tree_history.iter() { if prev_tree.root() == root { + tracing::info!( + ?identity, + ?root, + "Getting inclusion proof" + ); + return Some(InclusionProof::new( root, Self::proof(prev_tree, identity)?, @@ -128,7 +137,22 @@ impl TreeData { } } + //TODO: should return an error if the tree root is specified but not in history + tracing::warn!( + ?identity, + ?root, + "Could not get inclusion proof. Root not in tree history." + ); None + } else { + let latest_root = tree.root(); + tracing::info!(?identity, ?latest_root, "Getting inclusion proof"); + // If the root is not specified, return a proof at the latest root + Some(InclusionProof::new( + latest_root, + Self::proof(&tree, identity)?, + None, + )) } } diff --git a/crates/tree_availability/src/world_tree/tree_updater.rs b/crates/tree_availability/src/world_tree/tree_updater.rs index b7d9d984..8a205d98 100644 --- a/crates/tree_availability/src/world_tree/tree_updater.rs +++ b/crates/tree_availability/src/world_tree/tree_updater.rs @@ -1,4 +1,4 @@ -use std::sync::atomic::{AtomicBool, AtomicU64}; +use std::sync::atomic::AtomicU64; use std::sync::Arc; use std::time::Duration; @@ -14,11 +14,9 @@ use super::abi::{ use super::block_scanner::BlockScanner; use super::tree_data::TreeData; use crate::error::TreeAvailabilityError; +use crate::world_tree::abi::DeleteIdentitiesWithDeletionProofAndBatchSizeAndPackedDeletionIndicesAndPreRootCall; use crate::world_tree::Hash; -// TODO: Change to a configurable parameter -const SCANNING_WINDOW_SIZE: u64 = 100; - /// Manages the synchronization of the World Tree with it's onchain representation. pub struct TreeUpdater { /// Contract address of the `WorldIDIdentityManager`. @@ -32,20 +30,18 @@ pub struct TreeUpdater { } impl TreeUpdater { - /// Initializes TreeUpdater - /// - /// `address`: `WorldIDIdentityManager` contract address - /// - /// `creation_block`: The block height of the `WorldIDIdentityManager` contract deployment - /// - /// `middleware`: provider - pub fn new(address: H160, creation_block: u64, middleware: Arc) -> Self { + pub fn new( + address: H160, + creation_block: u64, + window_size: u64, + middleware: Arc, + ) -> Self { Self { address, latest_synced_block: AtomicU64::new(creation_block), block_scanner: BlockScanner::new( middleware.clone(), - SCANNING_WINDOW_SIZE, + window_size, creation_block, ), middleware, @@ -61,6 +57,8 @@ impl TreeUpdater { &self, tree_data: &TreeData, ) -> Result<(), TreeAvailabilityError> { + tracing::info!("Syncing tree to chain head"); + let logs = self .block_scanner .next( @@ -76,19 +74,22 @@ impl TreeUpdater { .map_err(TreeAvailabilityError::MiddlewareError)?; if logs.is_empty() { + tracing::info!("No `TreeChanged` events found within block range"); return Ok(()); } let mut futures = FuturesOrdered::new(); - //TODO: update this to use a throttle that can be set by the user + //TODO: update this to use a throttle that can be set by the user, however this is likely only going to result in one log per query for logs in logs.chunks(20) { for log in logs { - futures.push_back(self.middleware.get_transaction( - log.transaction_hash.ok_or( - TreeAvailabilityError::TransactionHashNotFound, - )?, - )); + let tx_hash = log + .transaction_hash + .ok_or(TreeAvailabilityError::TransactionHashNotFound)?; + + tracing::info!(?tx_hash, "Getting transaction"); + + futures.push_back(self.middleware.get_transaction(tx_hash)); } while let Some(transaction) = futures.next().await { @@ -117,19 +118,25 @@ impl TreeUpdater { tree_data: &TreeData, transaction: &Transaction, ) -> Result<(), TreeAvailabilityError> { + let tx_hash = transaction.hash; + tracing::info!(?tx_hash, "Syncing from transaction"); + let calldata = &transaction.input; let function_selector = Selector::try_from(&calldata[0..4]) .expect("Transaction data does not contain a function selector"); if function_selector == RegisterIdentitiesCall::selector() { + tracing::info!("Decoding registerIdentities calldata"); + let register_identities_call = RegisterIdentitiesCall::decode(calldata.as_ref())?; let start_index = register_identities_call.start_index; let identities = register_identities_call.identity_commitments; - let identities: Vec<_> = identities - .into_iter() + + let identities: Vec = identities + .into_iter().take_while(|x| *x != U256::zero()) .map(|u256: U256| Hash::from_limbs(u256.0)) .collect(); @@ -137,16 +144,40 @@ impl TreeUpdater { .insert_many_at(start_index as usize, &identities) .await; } else if function_selector == DeleteIdentitiesCall::selector() { + tracing::info!("Decoding deleteIdentities calldata"); + let delete_identities_call = DeleteIdentitiesCall::decode(calldata.as_ref())?; - let indices = unpack_indices( + let indices= unpack_indices( + delete_identities_call.packed_deletion_indices.as_ref(), + ); + + let indices: Vec = indices + .into_iter().take_while(|x| *x != 2_u32.pow(tree_data.depth as u32)) + .map(|x| x as usize) + .collect(); + tree_data.delete_many(&indices).await; + + } else if function_selector == DeleteIdentitiesWithDeletionProofAndBatchSizeAndPackedDeletionIndicesAndPreRootCall::selector() { + + tracing::info!("Decoding deleteIdentities calldata"); + + // @dev This is a type that is generated by abigen!() since there is a function defined with a conflicting function name but different params + let delete_identities_call = + DeleteIdentitiesWithDeletionProofAndBatchSizeAndPackedDeletionIndicesAndPreRootCall::decode(calldata.as_ref())?; + + let indices= unpack_indices( delete_identities_call.packed_deletion_indices.as_ref(), ); - let indices: Vec<_> = - indices.into_iter().map(|x| x as usize).collect(); + let indices: Vec = indices + .into_iter().take_while(|x| *x != 2_u32.pow(tree_data.depth as u32)) + .map(|x| x as usize) + .collect(); tree_data.delete_many(&indices).await; + + } else { return Err(TreeAvailabilityError::UnrecognizedFunctionSelector); } diff --git a/crates/tree_availability/tests/inclusion_proof.rs b/crates/tree_availability/tests/inclusion_proof.rs index 4b67a7b9..1d2ab1fa 100644 --- a/crates/tree_availability/tests/inclusion_proof.rs +++ b/crates/tree_availability/tests/inclusion_proof.rs @@ -60,6 +60,7 @@ async fn test_inclusion_proof() -> eyre::Result<()> { 5, world_tree_address, world_tree_creation_block, + 1000, middleware, );