From 827e2a8f71c2675b16070a241c6a2423dfbe2444 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Sat, 24 Feb 2024 16:51:04 -0700 Subject: [PATCH] types: first pass --- Cargo.lock | 1358 +++++++++++++++++++++-- Cargo.toml | 1 - crates/derive/Cargo.toml | 5 + crates/derive/src/lib.rs | 4 + crates/derive/src/types/mod.rs | 118 ++ crates/derive/src/types/single_batch.rs | 46 + crates/derive/src/types/span_batch.rs | 509 +++++++++ 7 files changed, 1932 insertions(+), 109 deletions(-) create mode 100644 crates/derive/src/types/mod.rs create mode 100644 crates/derive/src/types/single_batch.rs create mode 100644 crates/derive/src/types/span_batch.rs diff --git a/Cargo.lock b/Cargo.lock index 36c1cf7c7..ecc9c4005 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,191 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "alloy-consensus" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a55f37a018440d752b2a9575f8c1150f21906949ff2446fd054661a553a47e1" + +[[package]] +name = "alloy-primitives" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef197eb250c64962003cb08b90b17f0882c192f4a6f2f544809d424fd7cb0e7d" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +dependencies = [ + "arrayvec", + "bytes", +] + [[package]] name = "anyhow" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.0", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "auto_impl" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -44,6 +223,33 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" @@ -56,6 +262,39 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.5.0" @@ -74,6 +313,168 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "const-hex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbd12d49ab0eaf8193ba9175e45f56bbc2e4b27d57b8cfe62aa47942a46b9a9" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.8" @@ -81,207 +482,758 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "hermit-abi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak-asm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "kona-common" +version = "0.0.1" +dependencies = [ + "anyhow", + "cfg-if", + "linked_list_allocator", +] + +[[package]] +name = "kona-derive" +version = "0.0.1" +dependencies = [ + "alloy-consensus", + "alloy-primitives", + "alloy-rlp", + "anyhow", + "unsigned-varint", +] + +[[package]] +name = "kona-preimage" +version = "0.0.1" +dependencies = [ + "anyhow", + "cfg-if", + "kona-common", + "tempfile", + "tokio", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" +dependencies = [ + "spinning_top", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parity-scale-codec" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pest" +version = "2.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.4.2", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", ] [[package]] -name = "fastrand" -version = "2.0.1" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] [[package]] -name = "gimli" -version = "0.28.1" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] -name = "hermit-abi" -version = "0.3.5" +name = "rand_xorshift" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] [[package]] -name = "kona-common" -version = "0.0.1" +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "anyhow", - "cfg-if", - "linked_list_allocator", + "bitflags 1.3.2", ] [[package]] -name = "kona-derive" -version = "0.0.1" +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] -name = "kona-preimage" -version = "0.0.1" +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "anyhow", - "cfg-if", - "kona-common", - "tempfile", - "tokio", + "hmac", + "subtle", ] [[package]] -name = "libc" -version = "0.2.153" +name = "rlp" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] [[package]] -name = "linked_list_allocator" -version = "0.10.5" +name = "ruint" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" +checksum = "608a5726529f2f0ef81b8fde9873c4bb829d6b5b5ca6be4d97345ddf0749c825" dependencies = [ - "spinning_top", + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", ] [[package]] -name = "linux-raw-sys" -version = "0.4.13" +name = "ruint-macro" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "e666a5496a0b2186dbcd0ff6106e29e093c15591bde62c20d3842007c6978a09" [[package]] -name = "lock_api" -version = "0.4.11" +name = "rustc-demangle" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "memchr" -version = "2.7.1" +name = "rustc-hex" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "miniz_oxide" -version = "0.7.2" +name = "rustc_version" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "adler", + "semver 0.11.0", ] [[package]] -name = "mio" -version = "0.8.10" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "libc", - "wasi", - "windows-sys 0.48.0", + "semver 1.0.22", ] [[package]] -name = "num_cpus" -version = "1.16.0" +name = "rustix" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "hermit-abi", + "bitflags 2.4.2", + "errno", "libc", + "linux-raw-sys", + "windows-sys 0.52.0", ] [[package]] -name = "object" -version = "0.32.2" +name = "rusty-fork" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" dependencies = [ - "memchr", + "fnv", + "quick-error", + "tempfile", + "wait-timeout", ] [[package]] -name = "parking_lot" -version = "0.12.1" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "lock_api", - "parking_lot_core", + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", ] [[package]] -name = "parking_lot_core" -version = "0.9.9" +name = "semver" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", + "semver-parser", ] [[package]] -name = "pin-project-lite" -version = "0.2.13" +name = "semver" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] -name = "proc-macro2" -version = "1.0.78" +name = "semver-parser" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" dependencies = [ - "unicode-ident", + "pest", ] [[package]] -name = "quote" -version = "1.0.35" +name = "serde" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ - "proc-macro2", + "serde_derive", ] [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "serde_derive" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ - "bitflags 1.3.2", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.38.31" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "bitflags 2.4.2", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", + "cfg-if", + "cpufeatures", + "digest 0.10.7", ] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "sha3-asm" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +dependencies = [ + "cc", + "cfg-if", +] [[package]] name = "signal-hook-registry" @@ -292,6 +1244,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + [[package]] name = "smallvec" version = "1.13.1" @@ -317,6 +1279,39 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.48" @@ -328,6 +1323,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.10.0" @@ -340,6 +1341,35 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "thiserror" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tokio" version = "1.36.0" @@ -367,15 +1397,89 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -513,3 +1617,41 @@ name = "windows_x86_64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] diff --git a/Cargo.toml b/Cargo.toml index 97a256d83..e78f9755e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,6 @@ exclude = ["**/target", "benches/", "tests"] [workspace.dependencies] anyhow = { version = "1.0.79", default-features = false } -tracing = "0.1.40" cfg-if = "1.0.0" [profile.dev] diff --git a/crates/derive/Cargo.toml b/crates/derive/Cargo.toml index 99a56a8fd..be8b71b0a 100644 --- a/crates/derive/Cargo.toml +++ b/crates/derive/Cargo.toml @@ -9,3 +9,8 @@ repository.workspace = true homepage.workspace = true [dependencies] +alloy-consensus = "0.1.0" +alloy-primitives = { version = "0.6.3", features = ["rlp"] } +alloy-rlp = "0.3.4" +anyhow.workspace = true +unsigned-varint = "0.8.0" diff --git a/crates/derive/src/lib.rs b/crates/derive/src/lib.rs index f8b585e96..368855a72 100644 --- a/crates/derive/src/lib.rs +++ b/crates/derive/src/lib.rs @@ -13,3 +13,7 @@ pub mod stages; pub mod traits; +pub mod types; + +extern crate alloc; +extern crate std; diff --git a/crates/derive/src/types/mod.rs b/crates/derive/src/types/mod.rs new file mode 100644 index 000000000..e2ee60739 --- /dev/null +++ b/crates/derive/src/types/mod.rs @@ -0,0 +1,118 @@ +use alloc::string::String; +use alloc::vec::Vec; +use alloy_primitives::{hex, Address, BlockHash}; +use alloy_rlp::Decodable; +use std::fmt::Debug; + +mod single_batch; +pub use single_batch::SingleBatch; + +mod span_batch; +pub use span_batch::SpanBatch; + +/// Selected block header info +#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)] +pub struct BlockInfo { + /// The block hash + pub hash: BlockHash, + /// The block number + pub number: u64, + /// The parent block hash + pub parent_hash: BlockHash, + /// The block timestamp + pub timestamp: u64, +} + +/// A raw transaction +#[derive(Clone, PartialEq, Eq)] +pub struct RawTransaction(pub Vec); + +impl Debug for RawTransaction { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "0x{}", hex::encode(&self.0)) + } +} + +impl Decodable for RawTransaction { + /// Decodes RLP encoded bytes into [RawTransaction] bytes + fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { + let tx_bytes: Vec = Decodable::decode(buf)?; + Ok(Self(tx_bytes)) + } +} + +/// A single L2 block derived from a batch. +#[derive(Debug)] +pub struct BlockInput { + /// Timestamp of the L2 block + pub timestamp: u64, + /// Transactions included in this block + pub transactions: Vec, + /// The L1 block this batch was fully derived from + pub l1_inclusion_block: u64, +} + +/// The global `Magi` configuration. +#[derive(Debug, Clone)] +pub struct Config { + /// The L1 chain RPC URL + pub l1_rpc_url: String, + /// The L2 chain RPC URL + pub l2_rpc_url: String, + /// The L2 engine API URL + pub l2_engine_url: String, + /// The L2 chain config + pub chain: ChainConfig, + /// Engine API JWT Secret. + /// This is used to authenticate with the engine API + pub jwt_secret: String, + /// A trusted L2 RPC URL to use for fast/checkpoint syncing + pub checkpoint_sync_url: Option, + /// The port of the `Magi` RPC server + pub rpc_port: u16, + /// If devnet is enabled. + pub devnet: bool, +} + +/// Configurations for a blockchain. +#[derive(Debug, Clone)] +pub struct ChainConfig { + /// The network name + pub network: String, + /// The L1 chain id + pub l1_chain_id: u64, + /// The L2 chain id + pub l2_chain_id: u64, + /* + /// The L1 genesis block referenced by the L2 chain + pub l1_start_epoch: Epoch, + */ + /// The L2 genesis block info + pub l2_genesis: BlockInfo, + /* + /// The initial system config value + pub system_config: SystemConfig, + */ + /// The batch inbox address + pub batch_inbox: Address, + /// The deposit contract address + pub deposit_contract: Address, + /// The L1 system config contract address + pub system_config_contract: Address, + /// The maximum byte size of all pending channels + pub max_channel_size: u64, + /// The max timeout for a channel (as measured by the frame L1 block number) + pub channel_timeout: u64, + /// Number of L1 blocks in a sequence window + pub seq_window_size: u64, + /// Maximum timestamp drift + pub max_seq_drift: u64, + /// Timestamp of the regolith hardfork + pub regolith_time: u64, + /// Timestamp of the canyon hardfork + pub canyon_time: u64, + /// Timestamp of the delta hardfork + pub delta_time: u64, + /// Network blocktime + pub blocktime: u64, +} diff --git a/crates/derive/src/types/single_batch.rs b/crates/derive/src/types/single_batch.rs new file mode 100644 index 000000000..b8ae05a3e --- /dev/null +++ b/crates/derive/src/types/single_batch.rs @@ -0,0 +1,46 @@ +use super::RawTransaction; +use alloc::vec::Vec; +use alloy_primitives::BlockHash; +use alloy_rlp::Decodable; +use std::fmt::Debug; + +/// Represents a single batch: a single encoded L2 block +#[derive(Debug, Clone)] +pub struct SingleBatch { + /// Block hash of the previous L2 block + pub parent_hash: BlockHash, + /// The batch epoch number. Same as the first L1 block number in the epoch. + pub epoch_num: u64, + /// The block hash of the first L1 block in the epoch + pub epoch_hash: BlockHash, + /// The L2 block timestamp of this batch + pub timestamp: u64, + /// The L2 block transactions in this batch + pub transactions: Vec, +} + +impl SingleBatch { + /// Decodes RLP bytes into a [SingleBatch] + pub fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { + let parent_hash = Decodable::decode(buf)?; + let epoch_num = Decodable::decode(buf)?; + let epoch_hash = Decodable::decode(buf)?; + let timestamp = Decodable::decode(buf)?; + let transactions = Decodable::decode(buf)?; + + Ok(SingleBatch { + parent_hash, + epoch_num, + epoch_hash, + timestamp, + transactions, + }) + } + + /// If any transactions are empty or deposited transaction types. + pub fn has_invalid_transactions(&self) -> bool { + self.transactions + .iter() + .any(|tx| tx.0.is_empty() || tx.0[0] == 0x7E) + } +} diff --git a/crates/derive/src/types/span_batch.rs b/crates/derive/src/types/span_batch.rs new file mode 100644 index 000000000..d5840bc82 --- /dev/null +++ b/crates/derive/src/types/span_batch.rs @@ -0,0 +1,509 @@ +use alloc::vec::Vec; +use alloy_primitives::{Address, Bytes, StorageKey, U256}; +use alloy_rlp::{BufMut, BytesMut, Decodable, Encodable}; + +use super::{BlockInput, Config, RawTransaction}; +use anyhow::Result; + +#[derive(Debug, Clone)] +pub struct AccessList(pub Vec); + +impl Encodable for AccessList { + fn length(&self) -> usize { + let mut len = 0; + for item in &self.0 { + len += item.address.length(); + len += item.storage_keys.len() * 32; + } + len + } + + fn encode(&self, out: &mut dyn BufMut) { + for item in &self.0 { + item.address.encode(out); + for key in &item.storage_keys { + key.encode(out); + } + } + } +} + +impl Decodable for AccessList { + fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { + let mut items = Vec::new(); + while !buf.is_empty() { + let address = Address::decode(buf)?; + let mut storage_keys = Vec::new(); + for _ in 0..buf.len() / 32 { + let key = StorageKey::decode(buf)?; + storage_keys.push(key); + } + items.push(AccessListItem { + address, + storage_keys, + }); + } + + Ok(Self(items)) + } +} + +#[derive(Debug, Clone)] +pub struct AccessListItem { + /// Account addresses that would be loaded at the start of execution + pub address: Address, + /// Keys of storage that would be loaded at the start of execution + pub storage_keys: Vec, +} + +/// Represents a span batch: a range of encoded L2 blocks +#[derive(Debug, Clone)] +pub struct SpanBatch { + /// Uvarint encoded relative timestamp since L2 genesis + pub rel_timestamp: u64, + /// Uvarint encoded L1 origin number of the last L2 block in the batch + pub l1_origin_num: u64, + /// First 20 bytes of the parent hash of the first L2 block in the batch. + pub parent_check: [u8; 20], + /// Last 20 bytes of the L1 origin hash of the last L2 block in the batch. + pub l1_origin_check: [u8; 20], + /// Uvarint encoded number of L2 blocks in the batch. + pub block_count: u64, + /// Bitlist of [SpanBatch.block_count] bits: 1 bit per block. + pub origin_bits: Vec, + /// Uvarint encoded number of L2 transactions in this batch + pub block_tx_counts: Vec, + /// The L2 transactions in this batch + pub transactions: Vec, + /// The L1 block number this batch was derived from. + pub l1_inclusion_block: u64, +} + +impl SpanBatch { + /// Decodes a sequence of bytes into a [SpanBatch] + pub fn decode(data: &[u8], l1_inclusion_block: u64, chain_id: u64) -> alloy_rlp::Result { + let (rel_timestamp, data) = unsigned_varint::decode::u64(data) + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode timestamp"))?; + let (l1_origin_num, data) = unsigned_varint::decode::u64(data) + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode l1 origin"))?; + + let (parent_check, data) = take_data(data, 20); + let (l1_origin_check, data) = take_data(data, 20); + let (block_count, data) = unsigned_varint::decode::u64(data) + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode block count"))?; + + let (origin_bits, data) = decode_bitlist(data, block_count); + let (block_tx_counts, data) = decode_block_tx_counts(data, block_count) + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode tx counts"))?; + + let total_txs = block_tx_counts.iter().sum(); + let (transactions, _) = decode_transactions(chain_id, data, total_txs) + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode transactions"))?; + + Ok(SpanBatch { + rel_timestamp, + l1_origin_num, + parent_check: parent_check + .try_into() + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode parent check"))?, + l1_origin_check: l1_origin_check + .try_into() + .map_err(|_| alloy_rlp::Error::Custom("Failed to decode l1 origin check"))?, + block_count, + block_tx_counts, + origin_bits, + transactions, + l1_inclusion_block, + }) + } + + /// Returns a [BlockInput] vector for this batch. Contains all L2 block in the batch. + pub fn block_inputs(&self, config: &Config) -> Vec { + let init_epoch_num = self.l1_origin_num + - self + .origin_bits + .iter() + .map(|b| if *b { 1 } else { 0 }) + .sum::(); + + let mut inputs = Vec::new(); + let mut epoch_num = init_epoch_num; + let mut tx_index = 0usize; + for i in 0..self.block_count as usize { + if self.origin_bits[i] { + epoch_num += 1; + } + + let tx_end = self.block_tx_counts[i] as usize; + let transactions = self.transactions[tx_index..tx_index + tx_end].to_vec(); + tx_index += self.block_tx_counts[i] as usize; + + let timestamp = self.rel_timestamp + + config.chain.l2_genesis.timestamp + + i as u64 * config.chain.blocktime; + + let block_input = BlockInput { + timestamp, + transactions, + l1_inclusion_block: self.l1_inclusion_block, + }; + + inputs.push(block_input); + } + + inputs + } + + /// Returns the L1 origin number of the last L2 block in the batch + pub fn start_epoch_num(&self) -> u64 { + self.l1_origin_num + - self + .origin_bits + .iter() + .map(|b| if *b { 1 } else { 0 }) + .sum::() + + if self.origin_bits[0] { 1 } else { 0 } + } +} + +/// Splits a byte slice at the specified index (length) into a tuple of 2 byte slices +fn take_data(data: &[u8], length: usize) -> (&[u8], &[u8]) { + (&data[0..length], &data[length..]) +} + +/// Decodes a bitlist into boolean values and returns a tuple of booleans + the original bitlist. +fn decode_bitlist(data: &[u8], len: u64) -> (Vec, &[u8]) { + let mut bitlist = Vec::new(); + + let len_up = (len + 7) / 8; + let (bytes, data) = take_data(data, len_up as usize); + + for byte in bytes.iter().rev() { + for i in 0..8 { + let bit = (byte >> i) & 1 == 1; + bitlist.push(bit); + } + } + + let bitlist = bitlist[..len as usize].to_vec(); + + (bitlist, data) +} + +/// Decodes the number of transactions in the batch into a U64 vector +fn decode_block_tx_counts(data: &[u8], block_count: u64) -> Result<(Vec, &[u8])> { + let mut tx_counts = Vec::new(); + let mut data_ref = data; + for _ in 0..block_count { + let (count, d) = unsigned_varint::decode::u64(data_ref).unwrap(); + data_ref = d; + tx_counts.push(count); + } + + Ok((tx_counts, data_ref)) +} + +/// Decodes transactions in a batch and returns a [RawTransaction] vector +fn decode_transactions( + chain_id: u64, + data: &[u8], + tx_count: u64, +) -> Result<(Vec, &[u8])> { + let (contract_creation_bits, data) = decode_bitlist(data, tx_count); + let (y_parity_bits, data) = decode_bitlist(data, tx_count); + let (signatures, data) = decode_signatures(data, tx_count); + + let tos_count = contract_creation_bits.iter().filter(|b| !**b).count() as u64; + let (tos, data) = decode_tos(data, tos_count); + + let (tx_datas, data) = decode_tx_data(data, tx_count); + let (tx_nonces, data) = decode_uvarint_list(data, tx_count); + let (tx_gas_limits, data) = decode_uvarint_list(data, tx_count); + + let legacy_tx_count = tx_datas + .iter() + .filter(|tx| matches!(tx, TxData::Legacy { .. })) + .count() as u64; + + let (protected_bits, data) = decode_bitlist(data, legacy_tx_count); + + let mut txs = Vec::new(); + let mut legacy_i = 0; + let mut tos_i = 0; + + for i in 0..tx_count as usize { + let mut encoder = BytesMut::new(); + + match &tx_datas[i] { + TxData::Legacy { + value, + gas_price, + data, + } => { + chain_id.encode(&mut encoder); + tx_nonces[i].encode(&mut encoder); + gas_price.encode(&mut encoder); + tx_gas_limits[i].encode(&mut encoder); + + if contract_creation_bits[i] { + "".encode(&mut encoder); + } else { + tos[tos_i].encode(&mut encoder); + tos_i += 1; + } + + value.encode(&mut encoder); + data.encode(&mut encoder); + + let parity = if y_parity_bits[i] { 1 } else { 0 }; + let v = if protected_bits[legacy_i] { + chain_id * 2 + 35 + parity + } else { + 27 + parity + }; + + v.encode(&mut encoder); + signatures[i].0.encode(&mut encoder); + signatures[i].1.encode(&mut encoder); + + let raw_tx = RawTransaction(encoder.to_vec()); + txs.push(raw_tx); + legacy_i += 1; + } + TxData::Type1 { + value, + gas_price, + data, + access_list, + } => { + chain_id.encode(&mut encoder); + tx_nonces[i].encode(&mut encoder); + gas_price.encode(&mut encoder); + tx_gas_limits[i].encode(&mut encoder); + + if contract_creation_bits[i] { + "".encode(&mut encoder); + } else { + tos[tos_i].encode(&mut encoder); + tos_i += 1; + } + + value.encode(&mut encoder); + data.encode(&mut encoder); + access_list.encode(&mut encoder); + + let parity = if y_parity_bits[i] { 1u64 } else { 0u64 }; + parity.encode(&mut encoder); + signatures[i].0.encode(&mut encoder); + signatures[i].1.encode(&mut encoder); + + let mut raw = encoder.to_vec(); + raw.insert(0, 1); + let raw_tx = RawTransaction(raw); + txs.push(raw_tx); + } + TxData::Type2 { + value, + max_fee, + max_priority_fee, + data, + access_list, + } => { + chain_id.encode(&mut encoder); + tx_nonces[i].encode(&mut encoder); + max_priority_fee.encode(&mut encoder); + max_fee.encode(&mut encoder); + tx_gas_limits[i].encode(&mut encoder); + + if contract_creation_bits[i] { + "".encode(&mut encoder); + } else { + tos[tos_i].encode(&mut encoder); + tos_i += 1; + } + + value.encode(&mut encoder); + data.encode(&mut encoder); + access_list.encode(&mut encoder); + + let parity = if y_parity_bits[i] { 1u64 } else { 0u64 }; + + parity.encode(&mut encoder); + signatures[i].0.encode(&mut encoder); + signatures[i].1.encode(&mut encoder); + + let mut raw = encoder.to_vec(); + raw.insert(0, 2); + + let raw_tx = RawTransaction(raw); + txs.push(raw_tx); + } + } + } + + Ok((txs, data)) +} + +/// Decodes transaction nonces in the batch into a U64 vector +fn decode_uvarint_list(data: &[u8], count: u64) -> (Vec, &[u8]) { + let mut list = Vec::new(); + let mut data_ref = data; + + for _ in 0..count { + let (nonce, d) = unsigned_varint::decode::u64(data_ref).unwrap(); + data_ref = d; + list.push(nonce); + } + + (list, data_ref) +} + +/// Decodes EIP-2718 `TransactionType` formatted transactions in the batch into a [TxData] vector +fn decode_tx_data(data: &[u8], tx_count: u64) -> (Vec, &[u8]) { + let mut data_ref = data; + let mut tx_datas = Vec::new(); + + for _ in 0..tx_count { + let (next, data) = match data_ref[0] { + 1 => { + let mut rlp = &data_ref[1..]; + + let value = U256::decode(&mut rlp).unwrap(); + let gas_price = U256::decode(&mut rlp).unwrap(); + let data = Vec::::decode(&mut rlp).unwrap(); + let access_list = AccessList::decode(&mut rlp).unwrap(); + + let next = rlp.len() + 1; + let data = TxData::Type1 { + value, + gas_price, + data: data.into(), + access_list, + }; + + (next, data) + } + 2 => { + let mut rlp = &data_ref[1..]; + let value = U256::decode(&mut rlp).unwrap(); + let max_priority_fee = U256::decode(&mut rlp).unwrap(); + let max_fee = U256::decode(&mut rlp).unwrap(); + let data = Vec::::decode(&mut rlp).unwrap(); + let access_list = AccessList::decode(&mut rlp).unwrap(); + + let next = rlp.len() + 1; + let data = TxData::Type2 { + value, + max_fee, + max_priority_fee, + data: data.into(), + access_list, + }; + + (next, data) + } + _ => { + let mut rlp = &data_ref[1..]; + let value = U256::decode(&mut rlp).unwrap(); + let gas_price = U256::decode(&mut rlp).unwrap(); + let data = Vec::::decode(&mut rlp).unwrap(); + + let next = rlp.len(); + let data = TxData::Legacy { + value, + gas_price, + data: data.into(), + }; + + (next, data) + } + }; + + tx_datas.push(data); + data_ref = &data_ref[next..]; + } + + (tx_datas, data_ref) +} + +/// The transaction type - Legacy, EIP-2930, or EIP-1559 +#[derive(Debug)] +enum TxData { + /// A legacy transaction type + Legacy { + /// Transaction value + value: U256, + /// Transaction gas price + gas_price: U256, + /// Transaction calldata + data: Bytes, + }, + /// An EIP-2930 transaction type + Type1 { + /// Transaction value + value: U256, + /// Transaction gas price + gas_price: U256, + /// Transaction calldata + data: Bytes, + /// Access list as specified in EIP-2930 + access_list: AccessList, + }, + /// An EIP-1559 transaction type + Type2 { + /// Transaction value + value: U256, + /// Max fee per gas as specified in EIP-1559 + max_fee: U256, + /// Max priority fee as specified in EIP-1559 + max_priority_fee: U256, + /// Transaction calldata + data: Bytes, + /// Access list as specified in EIP-2930 + access_list: AccessList, + }, +} + +/// Decodes transaction `To` fields in the batch into an [Address] vector +fn decode_tos(data: &[u8], count: u64) -> (Vec
, &[u8]) { + let mut data_ref = data; + let mut tos = Vec::new(); + for _ in 0..count { + let (addr, d) = decode_address(data_ref); + tos.push(addr); + data_ref = d; + } + + (tos, data_ref) +} + +/// Decodes arbitrary slice of bytes into an [Address] +fn decode_address(data: &[u8]) -> (Address, &[u8]) { + let (address_bytes, data) = take_data(data, 20); + let address = Address::from_slice(address_bytes); + (address, data) +} + +/// Decodes transaction `R` & `S` signature fields in the batch into a (U256, U256) vector +fn decode_signatures(data: &[u8], tx_count: u64) -> (Vec<(U256, U256)>, &[u8]) { + let mut sigs = Vec::new(); + let mut data_ref = data; + for _ in 0..tx_count { + let (r, d) = decode_u256(data_ref); + data_ref = d; + + let (s, d) = decode_u256(data_ref); + data_ref = d; + + sigs.push((r, s)); + } + + (sigs, data_ref) +} + +/// Decodes a U256 from an arbitrary slice of bytes +fn decode_u256(data: &[u8]) -> (U256, &[u8]) { + let (bytes, data) = take_data(data, 32); + let value = U256::from_be_slice(bytes); + (value, data) +}