diff --git a/batcher/Cargo.lock b/batcher/Cargo.lock index 7f7a1e5..28a6be4 100644 --- a/batcher/Cargo.lock +++ b/batcher/Cargo.lock @@ -47,6 +47,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "aligned-vec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "anstream" version = "0.6.15" @@ -96,6 +108,29 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "anyhow" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + [[package]] name = "arrayvec" version = "0.7.6" @@ -150,6 +185,29 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "av1-grain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom", + "num-rational", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e335041290c43101ca215eed6f43ec437eb5a42125573f600fc3fa42b9bddd62" +dependencies = [ + "arrayvec", +] + [[package]] name = "backtrace" version = "0.3.74" @@ -227,6 +285,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + [[package]] name = "bitflags" version = "1.3.2" @@ -239,6 +303,12 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "bitstream-io" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b81e1519b0d82120d2fd469d5bfb2919a9361c48b02d82d04befc1cdd2002452" + [[package]] name = "bitvec" version = "1.0.1" @@ -270,6 +340,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "built" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b" + [[package]] name = "bumpalo" version = "3.16.0" @@ -282,12 +358,24 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +[[package]] +name = "bytemuck" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" + [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + [[package]] name = "bytes" version = "1.8.0" @@ -361,6 +449,16 @@ dependencies = [ "shlex", ] +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -478,6 +576,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "colorchoice" version = "1.0.2" @@ -808,8 +912,11 @@ dependencies = [ "bincode", "clap", "ethers", + "image", "lambdaworks-crypto", "lambdaworks-math", + "qrcode", + "rqrr", "serde", "serde_json", "sha3", @@ -1134,6 +1241,21 @@ dependencies = [ "yansi", ] +[[package]] +name = "exr" +version = "1.73.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide", + "rayon-core", + "smallvec", + "zune-inflate", +] + [[package]] name = "eyre" version = "0.6.12" @@ -1150,6 +1272,15 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +[[package]] +name = "fdeflate" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" +dependencies = [ + "simd-adler32", +] + [[package]] name = "ff" version = "0.13.0" @@ -1194,6 +1325,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1337,6 +1474,34 @@ dependencies = [ "byteorder", ] +[[package]] +name = "g2gen" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc3e32f911a41e073b8492473c3595a043e1369ab319a2dbf8c89b1fea06457c" +dependencies = [ + "g2poly", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "g2p" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9afa6efed9af3a5a68ba066429c1497c299d4eafbd948fe630df47a8f2d29f" +dependencies = [ + "g2gen", + "g2poly", +] + +[[package]] +name = "g2poly" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fd8b261ccf00df8c5cc60c082bb7d7aa64c33a433cfcc091ca244326c924b2c" + [[package]] name = "generic-array" version = "0.14.7" @@ -1359,6 +1524,16 @@ dependencies = [ "wasi", ] +[[package]] +name = "gif" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" +dependencies = [ + "color_quant", + "weezl", +] + [[package]] name = "gimli" version = "0.31.1" @@ -1413,11 +1588,26 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "hashbrown" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "hashers" @@ -1546,6 +1736,45 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "image" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc144d44a31d753b02ce64093d532f55ff8dc4ebf2ffb8a63c0dda691385acae" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", + "num-traits", + "png", + "qoi", + "ravif", + "rayon", + "rgb", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e031e8e3d94711a9ccb5d6ea357439ef3dcbed361798bd4071dc4d9793fbe22f" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imgref" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" + [[package]] name = "impl-codec" version = "0.6.0" @@ -1618,6 +1847,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + [[package]] name = "ipnet" version = "2.10.1" @@ -1639,6 +1879,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1654,6 +1903,12 @@ dependencies = [ "libc", ] +[[package]] +name = "jpeg-decoder" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" + [[package]] name = "js-sys" version = "0.3.72" @@ -1709,7 +1964,7 @@ dependencies = [ "ascii-canvas", "bit-set", "ena", - "itertools", + "itertools 0.11.0", "lalrpop-util", "petgraph", "regex", @@ -1759,12 +2014,29 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + [[package]] name = "libc" version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +[[package]] +name = "libfuzzer-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +dependencies = [ + "arbitrary", + "cc", + "once_cell", +] + [[package]] name = "libm" version = "0.2.11" @@ -1803,6 +2075,33 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", +] + [[package]] name = "md-5" version = "0.10.6" @@ -1825,6 +2124,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.0" @@ -1832,6 +2137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ "adler2", + "simd-adler32", ] [[package]] @@ -1852,6 +2158,22 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + [[package]] name = "num-bigint" version = "0.4.6" @@ -1868,6 +2190,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -1877,6 +2210,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2024,6 +2368,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "path-slash" version = "0.2.1" @@ -2186,6 +2536,19 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +[[package]] +name = "png" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -2249,6 +2612,25 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "profiling" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" +dependencies = [ + "quote", + "syn 2.0.85", +] + [[package]] name = "proptest" version = "1.5.0" @@ -2265,6 +2647,30 @@ dependencies = [ "unarray", ] +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "qrcode" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d68782463e408eb1e668cf6152704bd856c78c5b6417adaee3203d8f4c1fc9ec" +dependencies = [ + "image", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quote" version = "1.0.37" @@ -2319,6 +2725,55 @@ dependencies = [ "rand_core", ] +[[package]] +name = "rav1e" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" +dependencies = [ + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools 0.12.1", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "once_cell", + "paste", + "profiling", + "rand", + "rand_chacha", + "simd_helpers", + "system-deps", + "thiserror", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error", + "rav1e", + "rgb", +] + [[package]] name = "rayon" version = "1.10.0" @@ -2439,6 +2894,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rgb" +version = "0.8.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" + [[package]] name = "ring" version = "0.16.20" @@ -2500,6 +2961,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rqrr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48eaf9c75f2a8f231b09036c115a45a9845313f7faa6a39fa45a2a2bd06a27c7" +dependencies = [ + "g2p", + "image", + "lru", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2792,6 +3264,21 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote", +] + [[package]] name = "simple_asn1" version = "0.6.2" @@ -2841,7 +3328,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" dependencies = [ - "itertools", + "itertools 0.11.0", "lalrpop", "lalrpop-util", "phf", @@ -2993,12 +3480,31 @@ dependencies = [ "libc", ] +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + [[package]] name = "tap" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + [[package]] name = "tempfile" version = "3.13.0" @@ -3043,6 +3549,17 @@ dependencies = [ "syn 2.0.85", ] +[[package]] +name = "tiff" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + [[package]] name = "time" version = "0.3.36" @@ -3368,6 +3885,23 @@ dependencies = [ "serde", ] +[[package]] +name = "v_frame" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + [[package]] name = "version_check" version = "0.9.5" @@ -3488,6 +4022,12 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "weezl" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" + [[package]] name = "winapi" version = "0.3.9" @@ -3510,7 +4050,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3795,3 +4335,27 @@ dependencies = [ "cc", "pkg-config", ] + +[[package]] +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16099418600b4d8f028622f73ff6e3deaabdff330fb9a2a131dea781ee8b0768" +dependencies = [ + "zune-core", +] diff --git a/batcher/Cargo.toml b/batcher/Cargo.toml index 1028068..dbdab86 100644 --- a/batcher/Cargo.toml +++ b/batcher/Cargo.toml @@ -17,3 +17,6 @@ bincode = { version = "2.0.0-rc.2", tag = "v2.0.0-rc.2", git = "https://github.c sha3 = "0.10.8" tokio = { version = "1.25", features = ["full"] } ethers = { version = "2.0.14"} +qrcode = "0.14.1" +image = "0.25.4" +rqrr = "0.8.0" diff --git a/batcher/src/main.rs b/batcher/src/main.rs index 5dc4962..5588eb5 100644 --- a/batcher/src/main.rs +++ b/batcher/src/main.rs @@ -4,13 +4,15 @@ mod merkle_tree; use clap::{Parser, Subcommand}; use ethers::prelude::*; use ethers::abi::Abi; -use std::sync::Arc; +use image::Luma; +use qrcode::QrCode; +use std::{path::Path, sync::Arc}; use std::str::FromStr; use std::fs; use serde_json::Value; use bills::{Bills, Bill}; -use merkle_tree::{generate_merkle_proof, generate_merkle_tree, verify_merkle_proof}; +use merkle_tree::{generate_merkle_proof, generate_merkle_tree, verify_merkle_proof, verify_merkle_proof_qr}; #[derive(Parser)] #[command(name = "Esya CLI")] @@ -46,6 +48,14 @@ enum Commands { #[arg(short, long)] certificate_key: String, }, + VerifyQr { + /// Path to the bill JSON file + #[arg(short, long)] + bill_path: String, + /// Path to the proof PNG QR file + #[arg(short, long)] + qr_path: String, + }, } #[tokio::main] @@ -80,6 +90,9 @@ async fn main() -> Result<(), Box> { Commands::VerifyProof { proof_path, bill_path, index, certificate_key } => { verify_proof(proof_path, bill_path, *index, certificate_key, &contract).await?; } + Commands::VerifyQr {bill_path, qr_path} => { + verify_proof_qr(bill_path, qr_path, &contract).await?; + }, } Ok(()) @@ -91,13 +104,28 @@ async fn generate_proof(bills_path: &str, certificate_key: &str, contract: &Cont println!("=== Esyasoft Bills Batcher ==="); // Load bills and generate Merkle tree let bills: Bills = Bills::load_from_file(bills_path)?; + println!("Generating Merkle tree ..."); let merkle_tree = generate_merkle_tree(&bills, merkle_tree_output_path)?; - // Generate proof for each bill - println!("Generating Merkle Tree ..."); + // Generate proof for each bill and the qr codes + println!("Generating proofs and QR codes ..."); for (i, _bill) in bills.bills.iter().enumerate() { - generate_merkle_proof( - merkle_proof_output_path.replace("[n]", i.to_string().as_str()).as_str(), &merkle_tree, i)?; + let proof_path = merkle_proof_output_path.replace("[n]", i.to_string().as_str()); + let proof = generate_merkle_proof(&proof_path, &merkle_tree, i)?; + + // Create the QR code content + let qr_content = format!( + "Certificate Key: {}\nIndex: {}\nProof: {:?}", + certificate_key, i, proof + ); + + // Generate QR code + let code = QrCode::new(qr_content)?; + let image = code.render::>().build(); + + // Save the QR code as a PNG file + let output_path = format!("../output/qr_proof_{}.png", i); + image.save(Path::new(&output_path))?; } println!("Merkle Tree saved in {}", merkle_tree_output_path); @@ -137,6 +165,35 @@ async fn verify_proof(proof_path: &str, bill_path: &str, index: usize, certifica &merkle_root, &bill, index, proof_path) .unwrap(); + println!("Bill verifcation result: {}", match verification_result{ + true => "Success", + false => "Failed" + }); + Ok(()) +} + +async fn verify_proof_qr(bill_path: &str, qr_path: &str, contract: &Contract, LocalWallet>>) -> Result<(), Box> { + // Load bill and verify proof + println!("=== Esyasoft Bill QR Verifier ==="); + println!("loading bill from {}", bill_path); + let bill: Bill = Bill::load_from_file(bill_path)?; + println!("-------------------------------"); + println!("Bill: {}", serde_json::to_string_pretty(&bill)?); + println!("-------------------------------"); + println!("Reading Merkle Root with key {} from contract {} ...", "certificate_key",contract.address()); + // Get the Merkle root from the contract + let merkle_root: [u8; 32] = contract + .method::<_, [u8; 32]>("getMerkleRoot", "certificate_key".to_string())? + .call() + .await?; + println!("--------------------------------"); + println!("Merkle Root: {:?}", merkle_root); + println!("--------------------------------"); + println!("Verifying proof for qr at {} ...", 2); + let verification_result = verify_merkle_proof_qr( + &merkle_root, &bill, qr_path) + .unwrap(); + println!("Bill verifcation result: {}", match verification_result{ true => "Success", false => "Failed" diff --git a/batcher/src/merkle_tree.rs b/batcher/src/merkle_tree.rs index 00b3e7b..8a3e779 100644 --- a/batcher/src/merkle_tree.rs +++ b/batcher/src/merkle_tree.rs @@ -1,8 +1,12 @@ +use qrcode::QrCode; +use image::io::Reader as ImageReader; +use rqrr::PreparedImage; use sha3::{Digest, Keccak256}; use lambdaworks_crypto::merkle_tree::{ merkle::MerkleTree, proof::Proof, traits::IsMerkleTreeBackend, }; use std::io::BufWriter; +use std::path::Path; use std::{ fs::{self, File}, io::{self, Write}, @@ -50,7 +54,7 @@ pub fn generate_merkle_tree(bills: &Bills, output_tree_path: &str) -> Result, pos: usize) -> Result<(), io::Error> { +pub fn generate_merkle_proof(output_tree_path: &str, merkle_tree: &MerkleTree::, pos: usize) -> Result, io::Error> { let Some(proof) = merkle_tree.get_proof_by_pos(pos) else { return Err(io::Error::new(io::ErrorKind::Other, "Index out of bounds")); }; @@ -58,7 +62,8 @@ pub fn generate_merkle_proof(output_tree_path: &str, merkle_tree: &MerkleTree::< let file = File::create(output_tree_path)?; let mut writer = BufWriter::new(file); serde_json::to_writer_pretty(&mut writer, &proof)?; - writer.flush() + writer.flush(); + Ok(proof) } pub fn verify_merkle_proof(root_hash: &[u8; 32], bill: &Bill, index: usize, proof_path: &str) -> Result { @@ -69,3 +74,27 @@ pub fn verify_merkle_proof(root_hash: &[u8; 32], bill: &Bill, index: usize, proo proof.verify::(&root_hash, index, &bill) ) } + +pub fn verify_merkle_proof_qr(root_hash: &[u8; 32], bill: &Bill, qr_path: &str) -> Result> { + // Load the QR code image + let img = ImageReader::open(Path::new(qr_path))?.decode()?; + let luma_img = img.to_luma8(); + + // Use rqrr to decode the QR code + let mut prepared_image = PreparedImage::prepare(luma_img); + let grids = prepared_image.detect_grids(); + let grid = grids.into_iter().next().ok_or("No QR code found in the image")?; + let (_metadata, qr_content) = grid.decode().map_err(|e| format!("Failed to decode QR code: {:?}", e))?; + + // Parse the QR code content + let lines: Vec<&str> = qr_content.lines().collect(); + let certificate_key = lines.get(0).and_then(|line| line.strip_prefix("Certificate Key: ")).unwrap_or("").to_string(); + let index = lines.get(1).and_then(|line| line.strip_prefix("Index: ")).unwrap_or("0").parse::().unwrap_or(0); + let proof = lines.get(2).and_then(|line| line.strip_prefix("Proof: ")).unwrap_or("").to_string(); + + println!("Retrieved from QR: Certificate Key: {}, Index: {}, Proof: {}", certificate_key, index, proof); + + Ok( + true + ) +} diff --git a/data/electricity_bills.json b/data/electricity_bills.json index 2ee3f0a..2cea699 100644 --- a/data/electricity_bills.json +++ b/data/electricity_bills.json @@ -209,1848 +209,6 @@ "meter_id": "MTR0241" } ] - }, - { - "consumer_id": "753935", - "period": "2024-10", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "513 kWh", - "meter_id": "MTR0222" - }, - { - "source": "wind", - "state": "active", - "unit": "293 kWh", - "meter_id": "MTR0323" - }, - { - "source": "hydro", - "state": "active", - "unit": "111 kWh", - "meter_id": "MTR0654" - } - ] - }, - { - "consumer_id": "278386", - "period": "2024-10", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "445 kWh", - "meter_id": "MTR0149" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "534 kWh", - "meter_id": "MTR0618" - }, - { - "source": "solar", - "state": "inactive", - "unit": "996 kWh", - "meter_id": "MTR0490" - } - ] - }, - { - "consumer_id": "532460", - "period": "2024-09", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "923 kWh", - "meter_id": "MTR0975" - }, - { - "source": "grid", - "state": "inactive", - "unit": "701 kWh", - "meter_id": "MTR0342" - } - ] - }, - { - "consumer_id": "874721", - "period": "2024-05", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "604 kWh", - "meter_id": "MTR0679" - }, - { - "source": "solar", - "state": "active", - "unit": "873 kWh", - "meter_id": "MTR0785" - }, - { - "source": "hydro", - "state": "active", - "unit": "789 kWh", - "meter_id": "MTR0562" - } - ] - }, - { - "consumer_id": "693813", - "period": "2024-12", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "815 kWh", - "meter_id": "MTR0607" - } - ] - }, - { - "consumer_id": "566824", - "period": "2024-12", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "298 kWh", - "meter_id": "MTR0662" - } - ] - }, - { - "consumer_id": "892776", - "period": "2024-08", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "444 kWh", - "meter_id": "MTR0784" - }, - { - "source": "wind", - "state": "inactive", - "unit": "720 kWh", - "meter_id": "MTR0083" - } - ] - }, - { - "consumer_id": "302143", - "period": "2024-04", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "699 kWh", - "meter_id": "MTR0159" - } - ] - }, - { - "consumer_id": "234244", - "period": "2024-01", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "182 kWh", - "meter_id": "MTR0340" - } - ] - }, - { - "consumer_id": "345550", - "period": "2024-02", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "787 kWh", - "meter_id": "MTR0155" - } - ] - }, - { - "consumer_id": "874627", - "period": "2024-02", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "102 kWh", - "meter_id": "MTR0447" - }, - { - "source": "solar", - "state": "active", - "unit": "304 kWh", - "meter_id": "MTR0231" - } - ] - }, - { - "consumer_id": "100693", - "period": "2024-02", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "519 kWh", - "meter_id": "MTR0102" - }, - { - "source": "grid", - "state": "active", - "unit": "143 kWh", - "meter_id": "MTR0504" - }, - { - "source": "wind", - "state": "inactive", - "unit": "90 kWh", - "meter_id": "MTR0624" - } - ] - }, - { - "consumer_id": "493982", - "period": "2024-05", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "237 kWh", - "meter_id": "MTR0650" - }, - { - "source": "solar", - "state": "inactive", - "unit": "410 kWh", - "meter_id": "MTR0131" - } - ] - }, - { - "consumer_id": "122063", - "period": "2024-11", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "132 kWh", - "meter_id": "MTR0014" - } - ] - }, - { - "consumer_id": "873684", - "period": "2024-04", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "910 kWh", - "meter_id": "MTR0371" - }, - { - "source": "hydro", - "state": "active", - "unit": "218 kWh", - "meter_id": "MTR0256" - }, - { - "source": "solar", - "state": "active", - "unit": "487 kWh", - "meter_id": "MTR0249" - }, - { - "source": "wind", - "state": "active", - "unit": "42 kWh", - "meter_id": "MTR0986" - } - ] - }, - { - "consumer_id": "772626", - "period": "2024-03", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "748 kWh", - "meter_id": "MTR0563" - }, - { - "source": "solar", - "state": "inactive", - "unit": "986 kWh", - "meter_id": "MTR0485" - }, - { - "source": "wind", - "state": "active", - "unit": "418 kWh", - "meter_id": "MTR0708" - } - ] - }, - { - "consumer_id": "802540", - "period": "2024-04", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "766 kWh", - "meter_id": "MTR0413" - }, - { - "source": "wind", - "state": "inactive", - "unit": "559 kWh", - "meter_id": "MTR0129" - }, - { - "source": "solar", - "state": "inactive", - "unit": "394 kWh", - "meter_id": "MTR0192" - }, - { - "source": "wind", - "state": "active", - "unit": "969 kWh", - "meter_id": "MTR0519" - } - ] - }, - { - "consumer_id": "845565", - "period": "2024-02", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "789 kWh", - "meter_id": "MTR0597" - }, - { - "source": "solar", - "state": "inactive", - "unit": "15 kWh", - "meter_id": "MTR0907" - } - ] - }, - { - "consumer_id": "275540", - "period": "2024-11", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "384 kWh", - "meter_id": "MTR0057" - }, - { - "source": "wind", - "state": "active", - "unit": "735 kWh", - "meter_id": "MTR0098" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "562 kWh", - "meter_id": "MTR0199" - } - ] - }, - { - "consumer_id": "923985", - "period": "2024-06", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "798 kWh", - "meter_id": "MTR0628" - }, - { - "source": "hydro", - "state": "active", - "unit": "269 kWh", - "meter_id": "MTR0612" - }, - { - "source": "grid", - "state": "active", - "unit": "138 kWh", - "meter_id": "MTR0041" - }, - { - "source": "wind", - "state": "active", - "unit": "483 kWh", - "meter_id": "MTR0975" - } - ] - }, - { - "consumer_id": "112956", - "period": "2024-10", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "873 kWh", - "meter_id": "MTR0023" - } - ] - }, - { - "consumer_id": "529225", - "period": "2024-02", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "915 kWh", - "meter_id": "MTR0923" - } - ] - }, - { - "consumer_id": "782387", - "period": "2024-11", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "466 kWh", - "meter_id": "MTR0588" - }, - { - "source": "grid", - "state": "inactive", - "unit": "994 kWh", - "meter_id": "MTR0438" - } - ] - }, - { - "consumer_id": "775084", - "period": "2024-03", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "675 kWh", - "meter_id": "MTR0335" - } - ] - }, - { - "consumer_id": "348114", - "period": "2024-10", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "144 kWh", - "meter_id": "MTR0242" - } - ] - }, - { - "consumer_id": "213344", - "period": "2024-07", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "827 kWh", - "meter_id": "MTR0109" - }, - { - "source": "solar", - "state": "active", - "unit": "990 kWh", - "meter_id": "MTR0787" - } - ] - }, - { - "consumer_id": "445250", - "period": "2024-08", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "688 kWh", - "meter_id": "MTR0447" - }, - { - "source": "wind", - "state": "inactive", - "unit": "796 kWh", - "meter_id": "MTR0709" - } - ] - }, - { - "consumer_id": "488741", - "period": "2024-01", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "23 kWh", - "meter_id": "MTR0861" - } - ] - }, - { - "consumer_id": "970191", - "period": "2024-01", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "384 kWh", - "meter_id": "MTR0172" - } - ] - }, - { - "consumer_id": "186497", - "period": "2024-09", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "906 kWh", - "meter_id": "MTR0617" - }, - { - "source": "wind", - "state": "active", - "unit": "0 kWh", - "meter_id": "MTR0546" - } - ] - }, - { - "consumer_id": "341386", - "period": "2024-01", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "681 kWh", - "meter_id": "MTR0733" - }, - { - "source": "grid", - "state": "inactive", - "unit": "70 kWh", - "meter_id": "MTR0934" - }, - { - "source": "grid", - "state": "active", - "unit": "542 kWh", - "meter_id": "MTR0625" - } - ] - }, - { - "consumer_id": "822916", - "period": "2024-04", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "835 kWh", - "meter_id": "MTR0367" - }, - { - "source": "solar", - "state": "active", - "unit": "563 kWh", - "meter_id": "MTR0773" - }, - { - "source": "hydro", - "state": "active", - "unit": "719 kWh", - "meter_id": "MTR0455" - } - ] - }, - { - "consumer_id": "370588", - "period": "2024-09", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "692 kWh", - "meter_id": "MTR0511" - }, - { - "source": "grid", - "state": "active", - "unit": "497 kWh", - "meter_id": "MTR0102" - }, - { - "source": "wind", - "state": "inactive", - "unit": "559 kWh", - "meter_id": "MTR0029" - }, - { - "source": "wind", - "state": "inactive", - "unit": "457 kWh", - "meter_id": "MTR0297" - } - ] - }, - { - "consumer_id": "938457", - "period": "2024-10", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "284 kWh", - "meter_id": "MTR0781" - }, - { - "source": "wind", - "state": "active", - "unit": "116 kWh", - "meter_id": "MTR0910" - }, - { - "source": "hydro", - "state": "active", - "unit": "116 kWh", - "meter_id": "MTR0009" - } - ] - }, - { - "consumer_id": "369861", - "period": "2024-02", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "802 kWh", - "meter_id": "MTR0846" - }, - { - "source": "hydro", - "state": "active", - "unit": "702 kWh", - "meter_id": "MTR0787" - }, - { - "source": "solar", - "state": "inactive", - "unit": "206 kWh", - "meter_id": "MTR0857" - }, - { - "source": "grid", - "state": "active", - "unit": "300 kWh", - "meter_id": "MTR0529" - } - ] - }, - { - "consumer_id": "475410", - "period": "2024-02", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "230 kWh", - "meter_id": "MTR0680" - }, - { - "source": "solar", - "state": "active", - "unit": "6 kWh", - "meter_id": "MTR0157" - } - ] - }, - { - "consumer_id": "490328", - "period": "2024-04", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "336 kWh", - "meter_id": "MTR0646" - } - ] - }, - { - "consumer_id": "640235", - "period": "2024-11", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "740 kWh", - "meter_id": "MTR0325" - }, - { - "source": "wind", - "state": "active", - "unit": "881 kWh", - "meter_id": "MTR0581" - }, - { - "source": "solar", - "state": "inactive", - "unit": "695 kWh", - "meter_id": "MTR0460" - } - ] - }, - { - "consumer_id": "678762", - "period": "2024-03", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "17 kWh", - "meter_id": "MTR0373" - } - ] - }, - { - "consumer_id": "399740", - "period": "2024-05", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "543 kWh", - "meter_id": "MTR0567" - }, - { - "source": "hydro", - "state": "active", - "unit": "174 kWh", - "meter_id": "MTR0956" - } - ] - }, - { - "consumer_id": "489942", - "period": "2024-01", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "702 kWh", - "meter_id": "MTR0691" - }, - { - "source": "grid", - "state": "active", - "unit": "479 kWh", - "meter_id": "MTR0658" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "344 kWh", - "meter_id": "MTR0526" - }, - { - "source": "solar", - "state": "active", - "unit": "799 kWh", - "meter_id": "MTR0821" - } - ] - }, - { - "consumer_id": "105329", - "period": "2024-03", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "581 kWh", - "meter_id": "MTR0084" - }, - { - "source": "wind", - "state": "active", - "unit": "46 kWh", - "meter_id": "MTR0629" - }, - { - "source": "solar", - "state": "active", - "unit": "514 kWh", - "meter_id": "MTR0558" - } - ] - }, - { - "consumer_id": "919563", - "period": "2024-12", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "908 kWh", - "meter_id": "MTR0515" - }, - { - "source": "solar", - "state": "inactive", - "unit": "247 kWh", - "meter_id": "MTR0625" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "95 kWh", - "meter_id": "MTR0751" - } - ] - }, - { - "consumer_id": "535430", - "period": "2024-05", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "766 kWh", - "meter_id": "MTR0188" - }, - { - "source": "hydro", - "state": "active", - "unit": "66 kWh", - "meter_id": "MTR0435" - }, - { - "source": "grid", - "state": "active", - "unit": "537 kWh", - "meter_id": "MTR0789" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "213 kWh", - "meter_id": "MTR0479" - } - ] - }, - { - "consumer_id": "474413", - "period": "2024-12", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "897 kWh", - "meter_id": "MTR0013" - }, - { - "source": "solar", - "state": "inactive", - "unit": "715 kWh", - "meter_id": "MTR0058" - } - ] - }, - { - "consumer_id": "589315", - "period": "2024-09", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "381 kWh", - "meter_id": "MTR0762" - }, - { - "source": "solar", - "state": "active", - "unit": "412 kWh", - "meter_id": "MTR0686" - }, - { - "source": "grid", - "state": "active", - "unit": "479 kWh", - "meter_id": "MTR0509" - }, - { - "source": "grid", - "state": "active", - "unit": "310 kWh", - "meter_id": "MTR0650" - } - ] - }, - { - "consumer_id": "443002", - "period": "2024-09", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "704 kWh", - "meter_id": "MTR0224" - }, - { - "source": "solar", - "state": "inactive", - "unit": "764 kWh", - "meter_id": "MTR0285" - }, - { - "source": "solar", - "state": "inactive", - "unit": "63 kWh", - "meter_id": "MTR0654" - }, - { - "source": "wind", - "state": "active", - "unit": "367 kWh", - "meter_id": "MTR0340" - } - ] - }, - { - "consumer_id": "139700", - "period": "2024-06", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "828 kWh", - "meter_id": "MTR0251" - }, - { - "source": "grid", - "state": "active", - "unit": "111 kWh", - "meter_id": "MTR0080" - }, - { - "source": "solar", - "state": "active", - "unit": "87 kWh", - "meter_id": "MTR0981" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "930 kWh", - "meter_id": "MTR0653" - } - ] - }, - { - "consumer_id": "353324", - "period": "2024-02", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "999 kWh", - "meter_id": "MTR0498" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "202 kWh", - "meter_id": "MTR0814" - }, - { - "source": "hydro", - "state": "active", - "unit": "42 kWh", - "meter_id": "MTR0051" - } - ] - }, - { - "consumer_id": "323012", - "period": "2024-10", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "418 kWh", - "meter_id": "MTR0299" - }, - { - "source": "wind", - "state": "inactive", - "unit": "215 kWh", - "meter_id": "MTR0508" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "173 kWh", - "meter_id": "MTR0425" - } - ] - }, - { - "consumer_id": "590282", - "period": "2024-06", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "6 kWh", - "meter_id": "MTR0493" - } - ] - }, - { - "consumer_id": "634862", - "period": "2024-01", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "131 kWh", - "meter_id": "MTR0346" - }, - { - "source": "grid", - "state": "inactive", - "unit": "700 kWh", - "meter_id": "MTR0805" - } - ] - }, - { - "consumer_id": "785238", - "period": "2024-02", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "327 kWh", - "meter_id": "MTR0042" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "960 kWh", - "meter_id": "MTR0106" - }, - { - "source": "grid", - "state": "inactive", - "unit": "878 kWh", - "meter_id": "MTR0885" - }, - { - "source": "solar", - "state": "active", - "unit": "922 kWh", - "meter_id": "MTR0278" - } - ] - }, - { - "consumer_id": "804495", - "period": "2024-11", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "980 kWh", - "meter_id": "MTR0087" - } - ] - }, - { - "consumer_id": "252804", - "period": "2024-07", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "193 kWh", - "meter_id": "MTR0232" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "559 kWh", - "meter_id": "MTR0053" - }, - { - "source": "grid", - "state": "inactive", - "unit": "662 kWh", - "meter_id": "MTR0831" - }, - { - "source": "solar", - "state": "inactive", - "unit": "342 kWh", - "meter_id": "MTR0133" - } - ] - }, - { - "consumer_id": "126224", - "period": "2024-05", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "0 kWh", - "meter_id": "MTR0285" - }, - { - "source": "hydro", - "state": "active", - "unit": "423 kWh", - "meter_id": "MTR0171" - } - ] - }, - { - "consumer_id": "538669", - "period": "2024-12", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "969 kWh", - "meter_id": "MTR0803" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "177 kWh", - "meter_id": "MTR0477" - }, - { - "source": "wind", - "state": "active", - "unit": "19 kWh", - "meter_id": "MTR0383" - } - ] - }, - { - "consumer_id": "654820", - "period": "2024-12", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "873 kWh", - "meter_id": "MTR0463" - } - ] - }, - { - "consumer_id": "208210", - "period": "2024-12", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "853 kWh", - "meter_id": "MTR0995" - } - ] - }, - { - "consumer_id": "852994", - "period": "2024-11", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "36 kWh", - "meter_id": "MTR0915" - }, - { - "source": "wind", - "state": "inactive", - "unit": "640 kWh", - "meter_id": "MTR0885" - } - ] - }, - { - "consumer_id": "444660", - "period": "2024-08", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "967 kWh", - "meter_id": "MTR0775" - }, - { - "source": "solar", - "state": "active", - "unit": "355 kWh", - "meter_id": "MTR0890" - } - ] - }, - { - "consumer_id": "596628", - "period": "2024-03", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "852 kWh", - "meter_id": "MTR0890" - } - ] - }, - { - "consumer_id": "699360", - "period": "2024-04", - "consumption_items": [ - { - "source": "hydro", - "state": "inactive", - "unit": "503 kWh", - "meter_id": "MTR0147" - }, - { - "source": "wind", - "state": "inactive", - "unit": "417 kWh", - "meter_id": "MTR0909" - }, - { - "source": "grid", - "state": "inactive", - "unit": "305 kWh", - "meter_id": "MTR0532" - }, - { - "source": "grid", - "state": "active", - "unit": "512 kWh", - "meter_id": "MTR0205" - } - ] - }, - { - "consumer_id": "390112", - "period": "2024-02", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "886 kWh", - "meter_id": "MTR0251" - }, - { - "source": "solar", - "state": "inactive", - "unit": "555 kWh", - "meter_id": "MTR0233" - }, - { - "source": "grid", - "state": "inactive", - "unit": "225 kWh", - "meter_id": "MTR0312" - } - ] - }, - { - "consumer_id": "209429", - "period": "2024-09", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "989 kWh", - "meter_id": "MTR0854" - }, - { - "source": "solar", - "state": "active", - "unit": "864 kWh", - "meter_id": "MTR0294" - }, - { - "source": "grid", - "state": "active", - "unit": "441 kWh", - "meter_id": "MTR0115" - } - ] - }, - { - "consumer_id": "943290", - "period": "2024-03", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "518 kWh", - "meter_id": "MTR0111" - }, - { - "source": "grid", - "state": "inactive", - "unit": "102 kWh", - "meter_id": "MTR0551" - } - ] - }, - { - "consumer_id": "329543", - "period": "2024-10", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "915 kWh", - "meter_id": "MTR0011" - }, - { - "source": "wind", - "state": "inactive", - "unit": "821 kWh", - "meter_id": "MTR0304" - }, - { - "source": "hydro", - "state": "active", - "unit": "773 kWh", - "meter_id": "MTR0111" - } - ] - }, - { - "consumer_id": "819634", - "period": "2024-06", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "644 kWh", - "meter_id": "MTR0297" - }, - { - "source": "grid", - "state": "active", - "unit": "771 kWh", - "meter_id": "MTR0020" - }, - { - "source": "grid", - "state": "active", - "unit": "785 kWh", - "meter_id": "MTR0762" - } - ] - }, - { - "consumer_id": "477352", - "period": "2024-06", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "552 kWh", - "meter_id": "MTR0690" - }, - { - "source": "wind", - "state": "active", - "unit": "289 kWh", - "meter_id": "MTR0956" - } - ] - }, - { - "consumer_id": "845296", - "period": "2024-01", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "491 kWh", - "meter_id": "MTR0852" - } - ] - }, - { - "consumer_id": "395769", - "period": "2024-01", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "97 kWh", - "meter_id": "MTR0938" - }, - { - "source": "grid", - "state": "active", - "unit": "914 kWh", - "meter_id": "MTR0689" - } - ] - }, - { - "consumer_id": "821395", - "period": "2024-06", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "248 kWh", - "meter_id": "MTR0775" - }, - { - "source": "grid", - "state": "inactive", - "unit": "105 kWh", - "meter_id": "MTR0435" - }, - { - "source": "wind", - "state": "active", - "unit": "627 kWh", - "meter_id": "MTR0830" - }, - { - "source": "grid", - "state": "inactive", - "unit": "640 kWh", - "meter_id": "MTR0359" - } - ] - }, - { - "consumer_id": "390558", - "period": "2024-07", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "700 kWh", - "meter_id": "MTR0416" - } - ] - }, - { - "consumer_id": "254360", - "period": "2024-08", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "196 kWh", - "meter_id": "MTR0444" - }, - { - "source": "grid", - "state": "active", - "unit": "849 kWh", - "meter_id": "MTR0576" - }, - { - "source": "grid", - "state": "inactive", - "unit": "573 kWh", - "meter_id": "MTR0472" - } - ] - }, - { - "consumer_id": "310188", - "period": "2024-11", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "959 kWh", - "meter_id": "MTR0223" - }, - { - "source": "solar", - "state": "inactive", - "unit": "477 kWh", - "meter_id": "MTR0520" - } - ] - }, - { - "consumer_id": "106688", - "period": "2024-03", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "118 kWh", - "meter_id": "MTR0980" - }, - { - "source": "grid", - "state": "inactive", - "unit": "226 kWh", - "meter_id": "MTR0544" - } - ] - }, - { - "consumer_id": "938489", - "period": "2024-09", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "938 kWh", - "meter_id": "MTR0711" - }, - { - "source": "hydro", - "state": "active", - "unit": "647 kWh", - "meter_id": "MTR0705" - }, - { - "source": "wind", - "state": "inactive", - "unit": "446 kWh", - "meter_id": "MTR0240" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "102 kWh", - "meter_id": "MTR0109" - } - ] - }, - { - "consumer_id": "208827", - "period": "2024-02", - "consumption_items": [ - { - "source": "grid", - "state": "inactive", - "unit": "315 kWh", - "meter_id": "MTR0992" - }, - { - "source": "hydro", - "state": "active", - "unit": "920 kWh", - "meter_id": "MTR0436" - } - ] - }, - { - "consumer_id": "850686", - "period": "2024-11", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "919 kWh", - "meter_id": "MTR0789" - }, - { - "source": "solar", - "state": "inactive", - "unit": "673 kWh", - "meter_id": "MTR0116" - }, - { - "source": "hydro", - "state": "active", - "unit": "520 kWh", - "meter_id": "MTR0598" - }, - { - "source": "solar", - "state": "inactive", - "unit": "425 kWh", - "meter_id": "MTR0890" - } - ] - }, - { - "consumer_id": "315144", - "period": "2024-04", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "630 kWh", - "meter_id": "MTR0297" - } - ] - }, - { - "consumer_id": "362946", - "period": "2024-07", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "389 kWh", - "meter_id": "MTR0328" - }, - { - "source": "solar", - "state": "active", - "unit": "157 kWh", - "meter_id": "MTR0682" - }, - { - "source": "grid", - "state": "active", - "unit": "102 kWh", - "meter_id": "MTR0808" - } - ] - }, - { - "consumer_id": "691050", - "period": "2024-12", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "183 kWh", - "meter_id": "MTR0519" - } - ] - }, - { - "consumer_id": "801216", - "period": "2024-09", - "consumption_items": [ - { - "source": "wind", - "state": "active", - "unit": "801 kWh", - "meter_id": "MTR0191" - }, - { - "source": "grid", - "state": "active", - "unit": "979 kWh", - "meter_id": "MTR0882" - }, - { - "source": "wind", - "state": "inactive", - "unit": "426 kWh", - "meter_id": "MTR0151" - } - ] - }, - { - "consumer_id": "477851", - "period": "2024-11", - "consumption_items": [ - { - "source": "hydro", - "state": "active", - "unit": "20 kWh", - "meter_id": "MTR0495" - }, - { - "source": "solar", - "state": "inactive", - "unit": "394 kWh", - "meter_id": "MTR0455" - } - ] - }, - { - "consumer_id": "940304", - "period": "2024-11", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "962 kWh", - "meter_id": "MTR0100" - }, - { - "source": "solar", - "state": "active", - "unit": "603 kWh", - "meter_id": "MTR0038" - }, - { - "source": "wind", - "state": "active", - "unit": "869 kWh", - "meter_id": "MTR0282" - } - ] - }, - { - "consumer_id": "462325", - "period": "2024-03", - "consumption_items": [ - { - "source": "solar", - "state": "inactive", - "unit": "270 kWh", - "meter_id": "MTR0671" - }, - { - "source": "hydro", - "state": "inactive", - "unit": "251 kWh", - "meter_id": "MTR0339" - }, - { - "source": "grid", - "state": "inactive", - "unit": "613 kWh", - "meter_id": "MTR0615" - } - ] - }, - { - "consumer_id": "514591", - "period": "2024-05", - "consumption_items": [ - { - "source": "wind", - "state": "inactive", - "unit": "33 kWh", - "meter_id": "MTR0803" - }, - { - "source": "grid", - "state": "active", - "unit": "37 kWh", - "meter_id": "MTR0266" - }, - { - "source": "solar", - "state": "inactive", - "unit": "326 kWh", - "meter_id": "MTR0766" - } - ] - }, - { - "consumer_id": "304932", - "period": "2024-11", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "602 kWh", - "meter_id": "MTR0848" - }, - { - "source": "wind", - "state": "inactive", - "unit": "415 kWh", - "meter_id": "MTR0436" - } - ] - }, - { - "consumer_id": "661583", - "period": "2024-06", - "consumption_items": [ - { - "source": "grid", - "state": "active", - "unit": "346 kWh", - "meter_id": "MTR0715" - }, - { - "source": "wind", - "state": "inactive", - "unit": "608 kWh", - "meter_id": "MTR0888" - }, - { - "source": "grid", - "state": "inactive", - "unit": "694 kWh", - "meter_id": "MTR0598" - }, - { - "source": "hydro", - "state": "active", - "unit": "213 kWh", - "meter_id": "MTR0506" - } - ] - }, - { - "consumer_id": "440599", - "period": "2024-06", - "consumption_items": [ - { - "source": "solar", - "state": "active", - "unit": "315 kWh", - "meter_id": "MTR0466" - }, - { - "source": "hydro", - "state": "active", - "unit": "539 kWh", - "meter_id": "MTR0221" - }, - { - "source": "solar", - "state": "active", - "unit": "335 kWh", - "meter_id": "MTR0986" - } - ] } ] } \ No newline at end of file diff --git a/makefile b/makefile index 143bb6a..25e6ac3 100644 --- a/makefile +++ b/makefile @@ -17,3 +17,5 @@ verify_bill: verify_bill_corrupted: cd batcher && cargo run -- verify-proof --bill-path ../data/electricity_bill_2_corrupted.json --proof-path ../output/merkle_proof_2.json --index 2 --certificate-key GC-2024-4356 +verify_qr: + cd batcher && cargo run -- verify-qr --bill-path ../data/electricity_bill_2.json --qr-path ../output/qr_proof_2.png