diff --git a/Cargo.lock b/Cargo.lock index 16ea17404b..153a37e822 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,7 +73,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -96,6 +111,15 @@ dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-query" version = "1.1.5" @@ -118,12 +142,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" -dependencies = [ - "backtrace", -] +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "arrayref" @@ -160,7 +181,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -177,9 +198,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "aws-config" -version = "1.8.14" +version = "1.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8fc176d53d6fe85017f230405e3255cedb4a02221cb55ed6d76dccbbb099b2" +checksum = "11493b0bad143270fb8ad284a096dd529ba91924c5409adeac856cc1bf047dbc" dependencies = [ "aws-credential-types", "aws-runtime", @@ -197,7 +218,7 @@ dependencies = [ "fastrand", "hex", "http 1.4.0", - "ring", + "sha1", "time", "tokio", "tracing", @@ -207,9 +228,9 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "1.2.12" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e26bbf46abc608f2dc61fd6cb3b7b0665497cc259a21520151ed98f8b37d2c79" +checksum = "8f20799b373a1be121fe3005fba0c2090af9411573878f224df44b42727fcaf7" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -219,9 +240,9 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.15.4" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7b6141e96a8c160799cc2d5adecd5cbbe5054cb8c7c4af53da0f83bb7ad256" +checksum = "94bffc006df10ac2a68c83692d734a465f8ee6c5b384d8545a636f81d858f4bf" dependencies = [ "aws-lc-sys", "zeroize", @@ -229,9 +250,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.37.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b092fe214090261288111db7a2b2c2118e5a7f30dc2569f1732c4069a6840549" +checksum = "4321e568ed89bb5a7d291a7f37997c2c0df89809d7b6d12062c81ddb54aa782e" dependencies = [ "cc", "cmake", @@ -241,9 +262,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.7.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0f92058d22a46adf53ec57a6a96f34447daf02bff52e8fb956c66bcd5c6ac12" +checksum = "5fc0651c57e384202e47153c1260b84a9936e19803d747615edf199dc3b98d17" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -266,9 +287,9 @@ dependencies = [ [[package]] name = "aws-sdk-kms" -version = "1.100.0" +version = "1.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723700afe7459a33d1ac30852e9208b801946c032625cc8c808f57b9563bb5c7" +checksum = "8e6bfd8dfb5a562f9a605bbd5c3aef09db9231c826a1e0488ce3f4338c70dbbb" dependencies = [ "aws-credential-types", "aws-runtime", @@ -290,9 +311,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.94.0" +version = "1.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699da1961a289b23842d88fe2984c6ff68735fdf9bdcbc69ceaeb2491c9bf434" +checksum = "f64a6eded248c6b453966e915d32aeddb48ea63ad17932682774eb026fbef5b1" dependencies = [ "aws-credential-types", "aws-runtime", @@ -314,9 +335,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.96.0" +version = "1.98.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e3a4cb3b124833eafea9afd1a6cc5f8ddf3efefffc6651ef76a03cbc6b4981" +checksum = "db96d720d3c622fcbe08bae1c4b04a72ce6257d8b0584cb5418da00ae20a344f" dependencies = [ "aws-credential-types", "aws-runtime", @@ -338,9 +359,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.98.0" +version = "1.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89c4f19655ab0856375e169865c91264de965bd74c407c7f1e403184b1049409" +checksum = "fafbdda43b93f57f699c5dfe8328db590b967b8a820a13ccdd6687355dfcc7ca" dependencies = [ "aws-credential-types", "aws-runtime", @@ -363,9 +384,9 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f6ae9b71597dc5fd115d52849d7a5556ad9265885ad3492ea8d73b93bbc46e" +checksum = "b0b660013a6683ab23797778e21f1f854744fdf05f68204b4cca4c8c04b5d1f4" dependencies = [ "aws-credential-types", "aws-smithy-http", @@ -385,9 +406,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "1.2.12" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cba48474f1d6807384d06fec085b909f5807e16653c5af5c45dfe89539f0b70" +checksum = "2ffcaf626bdda484571968400c326a244598634dc75fd451325a54ad1a59acfc" dependencies = [ "futures-util", "pin-project-lite", @@ -396,9 +417,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.63.4" +version = "0.63.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4a8a5fe3e4ac7ee871237c340bbce13e982d37543b65700f4419e039f5d78e" +checksum = "ba1ab2dc1c2c3749ead27180d333c42f11be8b0e934058fb4b2258ee8dbe5231" dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", @@ -417,9 +438,9 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" -version = "1.1.10" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0709f0083aa19b704132684bc26d3c868e06bd428ccc4373b0b55c3e8748a58b" +checksum = "6a2f165a7feee6f263028b899d0a181987f4fa7179a6411a32a439fba7c5f769" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -436,7 +457,7 @@ dependencies = [ "hyper-util", "pin-project-lite", "rustls 0.21.12", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-native-certs", "rustls-pki-types", "tokio", @@ -447,27 +468,27 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.62.4" +version = "0.62.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b3a779093e18cad88bbae08dc4261e1d95018c4c5b9356a52bcae7c0b6e9bb" +checksum = "9648b0bb82a2eedd844052c6ad2a1a822d1f8e3adee5fbf668366717e428856a" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-observability" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3f39d5bb871aaf461d59144557f16d5927a5248a983a40654d9cf3b9ba183b" +checksum = "a06c2315d173edbf1920da8ba3a7189695827002e4c0fc961973ab1c54abca9c" dependencies = [ "aws-smithy-runtime-api", ] [[package]] name = "aws-smithy-query" -version = "0.60.14" +version = "0.60.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f76a580e3d8f8961e5d48763214025a2af65c2fa4cd1fb7f270a0e107a71b0" +checksum = "1a56d79744fb3edb5d722ef79d86081e121d3b9422cb209eb03aea6aa4f21ebd" dependencies = [ "aws-smithy-types", "urlencoding", @@ -475,9 +496,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.10.1" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd3dfc18c1ce097cf81fced7192731e63809829c6cbf933c1ec47452d08e1aa" +checksum = "028999056d2d2fd58a697232f9eec4a643cf73a71cf327690a7edad1d2af2110" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -500,9 +521,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.11.4" +version = "1.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c55e0837e9b8526f49e0b9bfa9ee18ddee70e853f5bc09c5d11ebceddcb0fec" +checksum = "876ab3c9c29791ba4ba02b780a3049e21ec63dabda09268b175272c3733a79e6" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -517,9 +538,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.4.4" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576b0d6991c9c32bc14fc340582ef148311f924d41815f641a308b5d11e8e7cd" +checksum = "d2b1117b3b2bbe166d11199b540ceed0d0f7676e36e7b962b5a437a9971eac75" dependencies = [ "base64-simd", "bytes", @@ -543,18 +564,18 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.60.14" +version = "0.60.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b53543b4b86ed43f051644f704a98c7291b3618b67adf057ee77a366fa52fcaa" +checksum = "0ce02add1aa3677d022f8adf81dcbe3046a95f17a1b1e8979c145cd21d3d22b3" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "1.3.12" +version = "1.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c50f3cdf47caa8d01f2be4a6663ea02418e892f9bbfd82c7b9a3a37eaccdd3a" +checksum = "47c8323699dd9b3c8d5b3c13051ae9cdef58fd179957c882f8374dd8725962d9" dependencies = [ "aws-credential-types", "aws-smithy-async", @@ -693,6 +714,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bindgen" version = "0.72.1" @@ -708,7 +738,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -728,9 +758,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "blake3" @@ -766,9 +796,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "byteorder" @@ -810,9 +840,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.54" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", "jobserver", @@ -873,9 +903,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -935,9 +965,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.55" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e34525d5bbbd55da2bb745d34b36121baac88d07619a9a09cfcf4a6c0832785" +checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" dependencies = [ "clap_builder", "clap_derive", @@ -945,11 +975,11 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.55" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a20016a20a3da95bef50ec7238dbd09baeef4311dcdd38ec15aba69812fb61" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "clap_lex", "strsim", @@ -957,21 +987,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.55" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "clap_lex" -version = "0.7.7" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "cmake" @@ -1158,7 +1188,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1182,7 +1212,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1193,7 +1223,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1263,9 +1293,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] @@ -1288,14 +1318,14 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "diesel" -version = "2.3.6" +version = "2.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b6c2fc184a6fb6ebcf5f9a5e3bbfa84d8fd268cdfcce4ed508979a6259494d" +checksum = "f4ae09a41a4b89f94ec1e053623da8340d996bc32c6517d325a9daad9b239358" dependencies = [ "bigdecimal", "diesel_derives", @@ -1318,7 +1348,7 @@ dependencies = [ "dsl_auto_type", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1338,7 +1368,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe2444076b48641147115697648dc743c2c00b61adade0f01ce67133c7babe8c" dependencies = [ - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1367,7 +1397,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1393,7 +1423,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -1468,9 +1498,9 @@ dependencies = [ [[package]] name = "ena" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" dependencies = [ "log", ] @@ -1486,9 +1516,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" dependencies = [ "log", "regex", @@ -1496,11 +1526,11 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" dependencies = [ - "anstream", + "anstream 0.6.21", "anstyle", "env_filter", "jiff", @@ -1547,9 +1577,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "find-msvc-tools" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixed-hash" @@ -1575,7 +1605,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1617,9 +1647,9 @@ dependencies = [ [[package]] name = "fs-err" -version = "3.2.2" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +checksum = "73fde052dbfc920003cfd2c8e2c6e6d4cc7c1091538c3a24226cec0665ab08c0" dependencies = [ "autocfg", ] @@ -1632,9 +1662,9 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -1647,9 +1677,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -1657,15 +1687,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -1674,32 +1704,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-timer" @@ -1709,9 +1739,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -1721,7 +1751,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -1773,21 +1802,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 6.0.0", "wasip2", "wasip3", "wasm-bindgen", @@ -2097,7 +2126,7 @@ dependencies = [ "http 1.4.0", "hyper 1.8.1", "hyper-util", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-native-certs", "rustls-pki-types", "tokio", @@ -2120,14 +2149,13 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ "base64", "bytes", "futures-channel", - "futures-core", "futures-util", "http 1.4.0", "http-body 1.0.1", @@ -2136,7 +2164,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.2", + "socket2 0.6.3", "system-configuration", "tokio", "tower-service", @@ -2146,9 +2174,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2311,9 +2339,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.11.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" [[package]] name = "iri-string" @@ -2363,9 +2391,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.18" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" dependencies = [ "jiff-static", "log", @@ -2376,13 +2404,13 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.18" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -2419,9 +2447,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.85" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -2461,7 +2489,7 @@ dependencies = [ "ena", "itertools 0.14.0", "lalrpop-util", - "petgraph", + "petgraph 0.7.1", "regex", "regex-syntax", "sha3", @@ -2494,9 +2522,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.180" +version = "0.2.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" [[package]] name = "libloading" @@ -2541,9 +2569,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.23" +version = "1.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" +checksum = "d52f4c29e2a68ac30c9087e1b772dc9f44a2b66ed44edf2266cf2be9b03dafc1" dependencies = [ "cc", "pkg-config", @@ -2552,15 +2580,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" @@ -2605,7 +2627,7 @@ dependencies = [ "quote", "regex-syntax", "rustc_version 0.4.1", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -2675,15 +2697,15 @@ checksum = "120fa187be19d9962f0926633453784691731018a2bf936ddb4e29101b79c4a7" [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "miden-agglayer" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e492a6044cf8875a64d7eec130d260f2eda1c783795261f00d5d52837ed027bd" +checksum = "5f1a7383dfd32d47002f72e63976576312f9928632d845f74623393a60da5eb2" dependencies = [ "fs-err", "miden-assembly", @@ -2701,22 +2723,22 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cca9632323bd4e32ae5b21b101ed417a646f5d72196b1bf3f1ca889a148322a" +checksum = "d8aa2b3bc95d9eece8b47edbc6621b5742e212b359ff6b82ebb813b3d9b28985" dependencies = [ "miden-core", + "miden-crypto", "miden-utils-indexing", "thiserror 2.0.18", - "winter-air", - "winter-prover", + "tracing", ] [[package]] name = "miden-assembly" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2395b2917aea613a285d3425d1ca07e6c45442e2b34febdea2081db555df62fc" +checksum = "89369e85051e14e21c52f8e38456b4db958151afb32a3cef0a522e04163ec5c2" dependencies = [ "env_logger", "log", @@ -2729,9 +2751,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f9bed037d137f209b9e7b28811ec78c0536b3f9259d6f4ceb5823c87513b346" +checksum = "9069e6fa110d918662ce77eecfc3d7f906050023fad899f414fc63122e31b771" dependencies = [ "aho-corasick", "env_logger", @@ -2753,9 +2775,9 @@ dependencies = [ [[package]] name = "miden-block-prover" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9564dfb23c529aad68369845b6897a6f62bacdeab7c00db432a5f16670764d4" +checksum = "6cbc5de67dea7cfb63e9927191fc2bc77a81b4e3eebaa6777dc6c6a630855a5b" dependencies = [ "miden-protocol", "thiserror 2.0.18", @@ -2763,9 +2785,9 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8714aa5f86c59e647b7417126b32adc4ef618f835964464f5425549df76b6d03" +checksum = "9a9ebf937ab3ebc6d540cc7c48dd5cfc08da8b19e38757f71229d6b50414268b" dependencies = [ "derive_more", "itertools 0.14.0", @@ -2774,20 +2796,19 @@ dependencies = [ "miden-formatting", "miden-utils-core-derive", "miden-utils-indexing", + "miden-utils-sync", "num-derive", "num-traits", "proptest", "proptest-derive", "thiserror 2.0.18", - "winter-math", - "winter-utils", ] [[package]] name = "miden-core-lib" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb16a4d39202c59a7964d3585cd5af21a46a759ff6452cb5f20723ed5af4362" +checksum = "fa496b3a7546c0022e8d5a92d88726907e380074f1fb634859b5e2094270dacf" dependencies = [ "env_logger", "fs-err", @@ -2796,15 +2817,14 @@ dependencies = [ "miden-crypto", "miden-processor", "miden-utils-sync", - "sha2", "thiserror 2.0.18", ] [[package]] name = "miden-crypto" -version = "0.19.8" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be59336a868de7c379eace9450563c2d7f4a0b7ab936835ec5a340dcd8d9a5ed" +checksum = "56602a204fa7798f7770a98b6b749d34ea2b3929fc25fe869f30cad539d5b5c3" dependencies = [ "blake3", "cc", @@ -2817,8 +2837,26 @@ dependencies = [ "hkdf", "k256", "miden-crypto-derive", + "miden-field", + "miden-serde-utils", "num", "num-complex", + "p3-air", + "p3-blake3", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-goldilocks", + "p3-keccak", + "p3-matrix", + "p3-maybe-rayon", + "p3-merkle-tree", + "p3-miden-air", + "p3-miden-fri", + "p3-miden-prover", + "p3-symmetric", + "p3-util", "rand", "rand_chacha", "rand_core 0.9.5", @@ -2828,27 +2866,24 @@ dependencies = [ "sha3", "subtle", "thiserror 2.0.18", - "winter-crypto", - "winter-math", - "winter-utils", "x25519-dalek", ] [[package]] name = "miden-crypto-derive" -version = "0.19.6" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550b5656b791fec59c0b6089b4d0368db746a34749ccd47e59afb01aa877e9e" +checksum = "6825dc04f78d60190ab1a79b2efe5d39f2c5a6ee30d515b1de0d8f872575d91c" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "miden-debug-types" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd1494f102ad5b9fa43e391d2601186dc601f41ab7dcd8a23ecca9bf3ef930f4" +checksum = "6bbdee85c103fe0979ed05f888da8c0b078446b2feee17a67f56d75d6189adae" dependencies = [ "memchr", "miden-crypto", @@ -2862,6 +2897,23 @@ dependencies = [ "thiserror 2.0.18", ] +[[package]] +name = "miden-field" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546ac41444d6f1ab015daa0bf420759405d3cf0a5cb2b552140ad60443ddf39c" +dependencies = [ + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror 2.0.18", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -2873,25 +2925,25 @@ dependencies = [ [[package]] name = "miden-large-smt-backend-rocksdb" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "miden-crypto", "miden-node-rocksdb-cxx-linkage-fix", "miden-protocol", "rayon", "rocksdb", - "winter-utils", ] [[package]] name = "miden-mast-package" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692185bfbe0ecdb28bf623f1f8c88282cd6727ba081a28e23b301bdde1b45be4" +checksum = "47f6dfbe2e3a2ca9977a46551d378cf4c5232624d50bd604c644eaa95342a5c1" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "miden-debug-types", "thiserror 2.0.18", ] @@ -2901,8 +2953,6 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ - "backtrace", - "backtrace-ext", "cfg-if", "futures", "indenter", @@ -2913,13 +2963,9 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", - "supports-color", - "supports-hyperlinks", - "supports-unicode", - "syn 2.0.114", - "terminal_size 0.3.0", + "syn 2.0.117", "textwrap", "thiserror 2.0.18", "trybuild", @@ -2934,12 +2980,12 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "miden-network-monitor" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "axum", @@ -2967,7 +3013,7 @@ dependencies = [ [[package]] name = "miden-node" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "clap", @@ -2987,7 +3033,7 @@ dependencies = [ [[package]] name = "miden-node-block-producer" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "assert_matches", @@ -3023,7 +3069,7 @@ dependencies = [ [[package]] name = "miden-node-db" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "deadpool", "deadpool-diesel", @@ -3036,15 +3082,15 @@ dependencies = [ [[package]] name = "miden-node-grpc-error-macro" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "miden-node-ntx-builder" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "build-rs", @@ -3074,7 +3120,7 @@ dependencies = [ [[package]] name = "miden-node-proto" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "assert_matches", @@ -3099,7 +3145,7 @@ dependencies = [ [[package]] name = "miden-node-proto-build" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "build-rs", "fs-err", @@ -3110,17 +3156,16 @@ dependencies = [ [[package]] name = "miden-node-rocksdb-cxx-linkage-fix" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" [[package]] name = "miden-node-rpc" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "futures", "http 1.4.0", "mediatype", - "miden-air", "miden-node-proto", "miden-node-proto-build", "miden-node-store", @@ -3146,7 +3191,7 @@ dependencies = [ [[package]] name = "miden-node-store" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "assert_matches", @@ -3183,7 +3228,7 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tokio-stream", - "toml 1.0.3+spec-1.1.0", + "toml 1.0.6+spec-1.1.0", "tonic", "tonic-reflection", "tower-http", @@ -3193,12 +3238,11 @@ dependencies = [ [[package]] name = "miden-node-stress-test" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "clap", "fs-err", "futures", - "miden-air", "miden-node-block-producer", "miden-node-proto", "miden-node-store", @@ -3217,12 +3261,12 @@ name = "miden-node-test-macro" version = "0.1.0" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "miden-node-utils" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "bytes", @@ -3255,7 +3299,7 @@ dependencies = [ [[package]] name = "miden-node-validator" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "aws-config", @@ -3280,9 +3324,9 @@ dependencies = [ [[package]] name = "miden-processor" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e09f7916b1e7505f74a50985a185fdea4c0ceb8f854a34c90db28e3f7da7ab6" +checksum = "13c83cc2f87364c88f6b7d7acb0c7908b63064ed94e0b2b68a0f5990f74a42c5" dependencies = [ "itertools 0.14.0", "miden-air", @@ -3295,14 +3339,13 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tracing", - "winter-prover", ] [[package]] name = "miden-protocol" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a88effeac994eb55b8dc4f93fbfd71a5d916dfaba1099896e27a0ee42c488c1" +checksum = "b02b5a6d8377890114e62de242c786b1db7af13543133ed6581c1581c361fd9b" dependencies = [ "bech32", "fs-err", @@ -3324,39 +3367,41 @@ dependencies = [ "semver 1.0.27", "serde", "thiserror 2.0.18", - "toml 0.9.11+spec-1.1.0", + "toml 1.0.6+spec-1.1.0", "walkdir", - "winter-rand-utils", ] [[package]] name = "miden-protocol-macros" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb28b730005e5f8b08d615ea9216f8cab77b3a7439fa54d5e39d2ec43ef53a3" +checksum = "1868449b5ecd41cce2a2327ee18e3eb80c24209b2af80f15f9cda6ec06384ab0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "miden-prover" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d45e30526be72b8af0fd1d8b24c9cba8ac1187ca335dcee38b8e5e20234e7698" +checksum = "d0fe4c03cc2a5c0404596f10c076e8e265d87fb7a9c5fbe21b15bc12874f7855" dependencies = [ + "bincode", "miden-air", + "miden-core", + "miden-crypto", "miden-debug-types", "miden-processor", + "serde", + "tokio", "tracing", - "winter-maybe-async", - "winter-prover", ] [[package]] name = "miden-remote-prover" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "anyhow", "assert_matches", @@ -3393,11 +3438,11 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" dependencies = [ "build-rs", "fs-err", - "getrandom 0.4.1", + "getrandom 0.4.2", "miden-node-proto-build", "miden-protocol", "miden-tx", @@ -3412,11 +3457,21 @@ dependencies = [ "tonic-web-wasm-client", ] +[[package]] +name = "miden-serde-utils" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bedaf94fb4bb6806e4af99fadce74e4cdd0e8664c571107b255f86b00b3149b" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-standards" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cef036bbfec29acba92751a13d05844bbcf080140201097b419c9ad1927e367" +checksum = "854ef86b5f4df8e34dca535e804cf4fba039af3093c9d561fd4228b17b5541b1" dependencies = [ "fs-err", "miden-assembly", @@ -3432,9 +3487,9 @@ dependencies = [ [[package]] name = "miden-testing" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e980777d0f7e6069942b14d4e7cb3d4d137b323ddfa15722a3bd21e9d13fdd2e" +checksum = "8e93dfc3c8c4e8f9937cf8fe682f2721e2a151b0c0277022e16f8bddf13f74e6" dependencies = [ "anyhow", "itertools 0.14.0", @@ -3451,14 +3506,13 @@ dependencies = [ "rand", "rand_chacha", "thiserror 2.0.18", - "winterfell", ] [[package]] name = "miden-tx" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67e0df9adcf29c9111df65acf408ae05952b8bc6569f571963676f97668d83f" +checksum = "d040615ca6654313c420b2bfee77792733fb4267d1c0feacadf51eaafda8ce7b" dependencies = [ "miden-processor", "miden-protocol", @@ -3470,9 +3524,9 @@ dependencies = [ [[package]] name = "miden-tx-batch-prover" -version = "0.14.0-alpha.1" +version = "0.14.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba29f8f6ecae671eff8b52b4c19eca8db5964c0b45b5d68c3ce38a57a8367931" +checksum = "278dc4968b63494fee1216460ec34f91eb5aa2039f9163452dcdf2260f245c8c" dependencies = [ "miden-protocol", "miden-tx", @@ -3480,9 +3534,9 @@ dependencies = [ [[package]] name = "miden-utils-core-derive" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b1d490e6d7b509622d3c2cc69ffd66ad48bf953dc614579b568fe956ce0a6c" +checksum = "ad5c364abe484d43d171afc320e7560db37ece00fe625569068c1053ed186540" dependencies = [ "proc-macro2", "quote", @@ -3491,9 +3545,9 @@ dependencies = [ [[package]] name = "miden-utils-diagnostics" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52658f6dc091c1c78e8b35ee3e7ff3dad53051971a3c514e461f581333758fe7" +checksum = "467d8eafd735ab1e0db7bf6a6a8b5bcf4c31a56c0cd7f80cba1932d4bb984b12" dependencies = [ "miden-crypto", "miden-debug-types", @@ -3504,35 +3558,38 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeff7bcb7875b222424bdfb657a7cf21a55e036aa7558ebe1f5d2e413b440d0d" +checksum = "bc42cfa3aef68d21238b3ce4c2db00a1278f8075ef492c23c035ab6c75774790" dependencies = [ + "miden-crypto", "thiserror 2.0.18", ] [[package]] name = "miden-utils-sync" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d53d1ab5b275d8052ad9c4121071cb184bc276ee74354b0d8a2075e5c1d1f0" +checksum = "b7e09bb239449e63e9a81f9b4ca5db1762327f44fb50777527fdba6fdbcab890" dependencies = [ "lock_api", "loom", + "once_cell", "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.20.6" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13816663794beb15c8a4721c15252eb21f3b3233525684f60c7888837a98ff4" +checksum = "fbb4d3120e2c9cce41b5dac7507cd86154951938b9effbc322c57983065bfa4a" dependencies = [ + "bincode", "miden-air", "miden-core", + "miden-crypto", "thiserror 2.0.18", "tracing", - "winter-verifier", ] [[package]] @@ -3560,7 +3617,7 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size 0.4.3", + "terminal_size", "textwrap", "unicode-width 0.1.14", ] @@ -3573,7 +3630,7 @@ checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -3583,7 +3640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36c791ecdf977c99f45f23280405d7723727470f6689a5e6dbf513ac547ae10d" dependencies = [ "serde", - "toml 0.9.11+spec-1.1.0", + "toml 0.9.12+spec-1.1.0", ] [[package]] @@ -3728,7 +3785,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -3793,9 +3850,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -3889,9 +3946,341 @@ checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" [[package]] name = "owo-colors" -version = "4.2.3" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d" + +[[package]] +name = "p3-air" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0141a56ed9924ce0265e7e91cd29bbcd230262744b7a7f0c448bfbf212f73182" +dependencies = [ + "p3-field", + "p3-matrix", +] + +[[package]] +name = "p3-blake3" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006330bae15fdda0d460e73e03e7ebf06e8848dfda8355f9d568a7fed7c37719" +dependencies = [ + "blake3", + "p3-symmetric", + "p3-util", +] + +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-commit" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498211e7b9a0f8366b410b4a9283ae82ff2fc91f473b1c5816aa6e90e74b125d" +dependencies = [ + "itertools 0.14.0", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-util", + "serde", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools 0.14.0", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools 0.14.0", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-interpolation" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d877565a94a527c89459fc8ccb0eb58769d8c86456575d1315a1651bd24616d" +dependencies = [ + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", +] + +[[package]] +name = "p3-keccak" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57334537d10316e0f1cda622f0a5b3239f219a5dcd2a95ea87e41e00df6a92" +dependencies = [ + "p3-field", + "p3-symmetric", + "p3-util", + "tiny-keccak", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools 0.14.0", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" +dependencies = [ + "rayon", +] + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-merkle-tree" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d93625a3041effddc72ee2511c919f710b7f91fd0f9931ab8a70aeba586fd6e" +dependencies = [ + "itertools 0.14.0", + "p3-commit", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-symmetric", + "p3-util", + "rand", + "serde", + "thiserror 2.0.18", + "tracing", +] + +[[package]] +name = "p3-miden-air" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a88e6ee9c92ff6c0b64f1ec0d61eda72fb432bda45337d876c46bd43748508" +dependencies = [ + "p3-air", + "p3-field", + "p3-matrix", +] + +[[package]] +name = "p3-miden-fri" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e282998bc1d12dceaa0ed8979fa507b8369d663fa377da695d578f5f3a035935" +dependencies = [ + "itertools 0.14.0", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-interpolation", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-miden-prover" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05a61c10cc2d6a73e192ac34a9884e4f26bd877f3eaea441d7b7ebfdffdf6c7" +dependencies = [ + "itertools 0.14.0", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-interpolation", + "p3-matrix", + "p3-maybe-rayon", + "p3-miden-air", + "p3-miden-uni-stark", + "p3-util", + "serde", + "tracing", +] + +[[package]] +name = "p3-miden-uni-stark" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a78b6a5b5f6bdc55439d343d2a0a2a8e7cb6544b03296f54d2214a84e91e130" +dependencies = [ + "itertools 0.14.0", + "p3-air", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-uni-stark", + "p3-util", + "serde", + "thiserror 2.0.18", + "tracing", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools 0.14.0", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools 0.14.0", + "p3-field", + "serde", +] + +[[package]] +name = "p3-uni-stark" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68d409704a8cbdb6c77f6b83a05c6b16a3c8a2c00d880146fa34181977a0d3ac" +dependencies = [ + "itertools 0.14.0", + "p3-air", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "serde", + "thiserror 2.0.18", + "tracing", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "rayon", + "serde", +] [[package]] name = "page_size" @@ -3948,6 +4337,17 @@ dependencies = [ "indexmap", ] +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + [[package]] name = "phf_shared" version = "0.11.3" @@ -3959,29 +4359,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pin-utils" @@ -4046,15 +4446,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" dependencies = [ "portable-atomic", ] @@ -4106,7 +4506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -4121,9 +4521,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ "toml_edit", ] @@ -4139,9 +4539,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +checksum = "37566cb3fdacef14c0737f9546df7cfeadbfbc9fef10991038bf5015d0c80532" dependencies = [ "bit-set", "bit-vec", @@ -4164,7 +4564,7 @@ checksum = "fb6dc647500e84a25a85b100e76c85b8ace114c209432dc174f20aac11d4ed6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -4179,23 +4579,22 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1" +checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" dependencies = [ "heck", "itertools 0.14.0", "log", "multimap", - "once_cell", - "petgraph", + "petgraph 0.8.3", "prettyplease", "prost", "prost-types", "pulldown-cmark", "pulldown-cmark-to-cmark", "regex", - "syn 2.0.114", + "syn 2.0.117", "tempfile", ] @@ -4209,7 +4608,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -4226,9 +4625,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72" +checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" dependencies = [ "prost", ] @@ -4262,9 +4661,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" +checksum = "83c41efbf8f90ac44de7f3a868f0867851d261b56291732d0cbf7cceaaeb55a6" dependencies = [ "bitflags", "memchr", @@ -4273,9 +4672,9 @@ dependencies = [ [[package]] name = "pulldown-cmark-to-cmark" -version = "21.1.0" +version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8246feae3db61428fd0bb94285c690b460e4517d83152377543ca802357785f1" +checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" dependencies = [ "pulldown-cmark", ] @@ -4313,8 +4712,8 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.36", - "socket2 0.6.2", + "rustls 0.23.37", + "socket2 0.6.3", "thiserror 2.0.18", "tokio", "tracing", @@ -4334,7 +4733,7 @@ dependencies = [ "rand", "ring", "rustc-hash", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "slab", "thiserror 2.0.18", @@ -4352,16 +4751,16 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.2", + "socket2 0.6.3", "tracing", "windows-sys 0.60.2", ] [[package]] name = "quote" -version = "1.0.44" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -4372,6 +4771,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.9.2" @@ -4477,9 +4882,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -4489,9 +4894,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -4506,9 +4911,9 @@ checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "relative-path" @@ -4539,7 +4944,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "rustls-platform-verifier", "serde", @@ -4626,7 +5031,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.1", - "syn 2.0.114", + "syn 2.0.117", "unicode-ident", ] @@ -4662,27 +5067,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustix" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys 0.11.0", + "linux-raw-sys", "windows-sys 0.61.2", ] @@ -4700,9 +5092,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.36" +version = "0.23.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" dependencies = [ "aws-lc-rs", "log", @@ -4747,7 +5139,7 @@ dependencies = [ "jni", "log", "once_cell", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-native-certs", "rustls-platform-verifier-android", "rustls-webpki 0.103.9", @@ -4805,9 +5197,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "same-file" @@ -4829,9 +5221,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" dependencies = [ "windows-sys 0.61.2", ] @@ -4880,9 +5272,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.5.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ "bitflags", "core-foundation 0.10.1", @@ -4893,9 +5285,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.15.0" +version = "2.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" dependencies = [ "core-foundation-sys", "libc", @@ -4953,7 +5345,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -5003,9 +5395,9 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.3.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0b343e184fc3b7bb44dff0705fffcf4b3756ba6aff420dddd8b24ca145e555" +checksum = "911bd979bf1070a3f3aa7b691a3b3e9968f339ceeec89e08c280a8a22207a32f" dependencies = [ "futures-executor", "futures-util", @@ -5018,13 +5410,24 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.3.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f50427f258fb77356e4cd4aa0e87e2bd2c66dbcee41dc405282cae2bfc26c83" +checksum = "0a7d91949b85b0d2fb687445e448b40d322b6b3e4af6b44a29b21d9a5f33e6d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", ] [[package]] @@ -5091,9 +5494,9 @@ checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -5119,12 +5522,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -5136,6 +5539,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spinning_top" version = "0.3.0" @@ -5179,6 +5591,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -5246,9 +5664,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.114" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -5272,14 +5690,14 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "system-configuration" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ "bitflags", "core-foundation 0.9.4", @@ -5304,14 +5722,14 @@ checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" [[package]] name = "tempfile" -version = "3.24.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.2", "once_cell", - "rustix 1.1.3", + "rustix", "windows-sys 0.61.2", ] @@ -5333,23 +5751,13 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix 0.38.44", - "windows-sys 0.48.0", -] - [[package]] name = "terminal_size" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ - "rustix 1.1.3", + "rustix", "windows-sys 0.60.2", ] @@ -5396,7 +5804,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -5407,7 +5815,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -5450,6 +5858,15 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinystr" version = "0.8.2" @@ -5487,9 +5904,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.49.0" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" dependencies = [ "bytes", "libc", @@ -5497,20 +5914,20 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.2", + "socket2 0.6.3", "tokio-macros", "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -5529,7 +5946,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.36", + "rustls 0.23.37", "tokio", ] @@ -5560,24 +5977,22 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.11+spec-1.1.0" +version = "0.9.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ - "indexmap", "serde_core", "serde_spanned", "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", - "toml_writer", "winnow", ] [[package]] name = "toml" -version = "1.0.3+spec-1.1.0" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7614eaf19ad818347db24addfa201729cf2a9b6fdfd9eb0ab870fcacc606c0c" +checksum = "399b1124a3c9e16766831c6bba21e50192572cdd98706ea114f9502509686ffc" dependencies = [ "indexmap", "serde_core", @@ -5608,12 +6023,12 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.23.10+spec-1.0.0" +version = "0.25.4+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +checksum = "7193cbd0ce53dc966037f54351dbbcf0d5a642c7f0038c382ef9e677ce8c13f2" dependencies = [ "indexmap", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime 1.0.0+spec-1.1.0", "toml_parser", "winnow", ] @@ -5635,9 +6050,9 @@ checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" [[package]] name = "tonic" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" +checksum = "fec7c61a0695dc1887c1b53952990f3ad2e3a31453e1f49f10e75424943a93ec" dependencies = [ "async-trait", "axum", @@ -5653,7 +6068,7 @@ dependencies = [ "percent-encoding", "pin-project", "rustls-native-certs", - "socket2 0.6.2", + "socket2 0.6.3", "sync_wrapper", "tokio", "tokio-rustls 0.26.4", @@ -5666,21 +6081,21 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40aaccc9f9eccf2cd82ebc111adc13030d23e887244bc9cfa5d1d636049de3" +checksum = "1882ac3bf5ef12877d7ed57aad87e75154c11931c2ba7e6cde5e22d63522c734" dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "tonic-health" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a82868bf299e0a1d2e8dce0dc33a46c02d6f045b2c1f1d6cc8dc3d0bf1812ef" +checksum = "f4ff0636fef47afb3ec02818f5bceb4377b8abb9d6a386aeade18bd6212f8eb7" dependencies = [ "prost", "tokio", @@ -5691,9 +6106,9 @@ dependencies = [ [[package]] name = "tonic-prost" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66bd50ad6ce1252d87ef024b3d64fe4c3cf54a86fb9ef4c631fdd0ded7aeaa67" +checksum = "a55376a0bbaa4975a3f10d009ad763d8f4108f067c7c2e74f3001fb49778d309" dependencies = [ "bytes", "prost", @@ -5702,25 +6117,25 @@ dependencies = [ [[package]] name = "tonic-prost-build" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a16cba4043dc3ff43fcb3f96b4c5c154c64cbd18ca8dce2ab2c6a451d058a2" +checksum = "f3144df636917574672e93d0f56d7edec49f90305749c668df5101751bb8f95a" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "prost-types", "quote", - "syn 2.0.114", + "syn 2.0.117", "tempfile", "tonic-build", ] [[package]] name = "tonic-reflection" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34da53e8387581d66db16ff01f98a70b426b091fdf76856e289d5c1bd386ed7b" +checksum = "aaf0685a51e6d02b502ba0764002e766b7f3042aed13d9234925b6ffbfa3fca7" dependencies = [ "prost", "prost-types", @@ -5732,9 +6147,9 @@ dependencies = [ [[package]] name = "tonic-web" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75214f6b6bd28c19aa752ac09fdf0eea546095670906c21fe3940e180a4c43f2" +checksum = "29453d84de05f4f1b573db22e6f9f6c95c189a6089a440c9a098aa9dea009299" dependencies = [ "base64", "bytes", @@ -5861,7 +6276,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -5926,9 +6341,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", "nu-ansi-term", @@ -5945,6 +6360,16 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -5953,9 +6378,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.114" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17e807bff86d2a06b52bca4276746584a78375055b6e45843925ce2802b335" +checksum = "47c635f0191bd3a2941013e5062667100969f8c4e9cd787c14f977265d73616e" dependencies = [ "dissimilar", "glob", @@ -5964,7 +6389,7 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml 0.9.11+spec-1.1.0", + "toml 1.0.6+spec-1.1.0", ] [[package]] @@ -5999,9 +6424,9 @@ checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-linebreak" @@ -6076,9 +6501,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.20.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" +checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" dependencies = [ "js-sys", "wasm-bindgen", @@ -6171,9 +6596,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.108" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -6184,9 +6609,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.58" +version = "0.4.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" dependencies = [ "cfg-if", "futures-util", @@ -6198,9 +6623,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.108" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6208,22 +6633,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.108" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.108" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] @@ -6277,9 +6702,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.85" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" dependencies = [ "js-sys", "wasm-bindgen", @@ -6356,7 +6781,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -6367,7 +6792,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -6414,15 +6839,6 @@ dependencies = [ "windows-targets 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -6465,21 +6881,6 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -6519,12 +6920,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -6543,12 +6938,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -6567,12 +6956,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -6603,12 +6986,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -6627,12 +7004,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -6651,12 +7022,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -6675,12 +7040,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -6695,9 +7054,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ "memchr", ] @@ -6754,7 +7113,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -6772,24 +7131,11 @@ dependencies = [ "winter-utils", ] -[[package]] -name = "winter-rand-utils" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4ff3b651754a7bd216f959764d0a5ab6f4b551c9a3a08fb9ccecbed594b614a" -dependencies = [ - "rand", - "winter-utils", -] - [[package]] name = "winter-utils" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9951263ef5317740cd0f49e618db00c72fabb70b75756ea26c4d5efe462c04dd" -dependencies = [ - "rayon", -] [[package]] name = "winter-verifier" @@ -6845,7 +7191,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn 2.0.114", + "syn 2.0.117", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -6861,7 +7207,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -6950,28 +7296,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.34" +version = "0.8.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ddd76bcebeed25db614f82bf31a9f4222d3fbba300e6fb6c00afa26cbd4d9d" +checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.34" +version = "0.8.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8187381b52e32220d50b255276aa16a084ec0a9017a0ca2152a1f55c539758d" +checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] @@ -6991,7 +7337,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", "synstructure", ] @@ -7031,11 +7377,11 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.117", ] [[package]] name = "zmij" -version = "1.0.17" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index 2156ddf8f8..5afae09641 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ license = "MIT" readme = "README.md" repository = "https://github.com/0xMiden/node" rust-version = "1.91" -version = "0.14.0-alpha.5" +version = "0.14.0-beta.1" # Optimize the cryptography for faster tests involving account creation. [profile.test.package.miden-crypto] @@ -46,35 +46,33 @@ debug = true [workspace.dependencies] # Workspace crates. -miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "=0.14.0-alpha.5" } -miden-node-block-producer = { path = "crates/block-producer", version = "=0.14.0-alpha.5" } -miden-node-db = { path = "crates/db", version = "=0.14.0-alpha.5" } -miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "=0.14.0-alpha.5" } -miden-node-ntx-builder = { path = "crates/ntx-builder", version = "=0.14.0-alpha.5" } -miden-node-proto = { path = "crates/proto", version = "=0.14.0-alpha.5" } -miden-node-proto-build = { path = "proto", version = "=0.14.0-alpha.5" } -miden-node-rpc = { path = "crates/rpc", version = "=0.14.0-alpha.5" } -miden-node-store = { path = "crates/store", version = "=0.14.0-alpha.5" } +miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "=0.14.0-beta.1" } +miden-node-block-producer = { path = "crates/block-producer", version = "=0.14.0-beta.1" } +miden-node-db = { path = "crates/db", version = "=0.14.0-beta.1" } +miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "=0.14.0-beta.1" } +miden-node-ntx-builder = { path = "crates/ntx-builder", version = "=0.14.0-beta.1" } +miden-node-proto = { path = "crates/proto", version = "=0.14.0-beta.1" } +miden-node-proto-build = { path = "proto", version = "=0.14.0-beta.1" } +miden-node-rpc = { path = "crates/rpc", version = "=0.14.0-beta.1" } +miden-node-store = { path = "crates/store", version = "=0.14.0-beta.1" } miden-node-test-macro = { path = "crates/test-macro" } -miden-node-utils = { path = "crates/utils", version = "=0.14.0-alpha.5" } -miden-node-validator = { path = "crates/validator", version = "=0.14.0-alpha.5" } -miden-remote-prover-client = { path = "crates/remote-prover-client", version = "=0.14.0-alpha.5" } +miden-node-utils = { path = "crates/utils", version = "=0.14.0-beta.1" } +miden-node-validator = { path = "crates/validator", version = "=0.14.0-beta.1" } +miden-remote-prover-client = { path = "crates/remote-prover-client", version = "=0.14.0-beta.1" } # Temporary workaround until # is part of `rocksdb-rust` release -miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "=0.14.0-alpha.5" } +miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "=0.14.0-beta.1" } # miden-base aka protocol dependencies. These should be updated in sync. -miden-block-prover = { version = "=0.14.0-alpha.1" } -miden-protocol = { default-features = false, version = "=0.14.0-alpha.1" } -miden-standards = { version = "=0.14.0-alpha.1" } -miden-testing = { version = "=0.14.0-alpha.1" } -miden-tx = { default-features = false, version = "=0.14.0-alpha.1" } -miden-tx-batch-prover = { version = "=0.14.0-alpha.1" } +miden-block-prover = { version = "=0.14.0-beta.2" } +miden-protocol = { default-features = false, version = "=0.14.0-beta.2" } +miden-standards = { version = "=0.14.0-beta.2" } +miden-testing = { version = "=0.14.0-beta.2" } +miden-tx = { default-features = false, version = "=0.14.0-beta.2" } +miden-tx-batch-prover = { version = "=0.14.0-beta.2" } # Other miden dependencies. These should align with those expected by miden-base. -miden-air = { features = ["std", "testing"], version = "0.20" } - -miden-crypto = { version = "0.19.7" } +miden-crypto = { version = "0.22" } # External dependencies anyhow = { version = "1.0" } @@ -146,3 +144,5 @@ should_panic_without_expect = "allow" # We don't care about the specific panic # Configure `cargo-typos` [workspace.metadata.typos] files.extend-exclude = ["*.svg"] # Ignore SVG files. + +[patch.crates-io] diff --git a/bin/network-monitor/src/counter.rs b/bin/network-monitor/src/counter.rs index dd004ff0d0..80c1df6917 100644 --- a/bin/network-monitor/src/counter.rs +++ b/bin/network-monitor/src/counter.rs @@ -16,7 +16,7 @@ use miden_protocol::account::auth::AuthSecretKey; use miden_protocol::account::{Account, AccountFile, AccountHeader, AccountId}; use miden_protocol::assembly::Library; use miden_protocol::block::{BlockHeader, BlockNumber}; -use miden_protocol::crypto::dsa::falcon512_rpo::SecretKey; +use miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey; use miden_protocol::note::{ Note, NoteAssets, @@ -28,13 +28,13 @@ use miden_protocol::note::{ NoteType, }; use miden_protocol::transaction::{InputNotes, PartialBlockchain, TransactionArgs}; -use miden_protocol::utils::Deserializable; +use miden_protocol::utils::serde::Deserializable; use miden_protocol::{Felt, Word}; use miden_standards::account::interface::{AccountInterface, AccountInterfaceExt}; use miden_standards::code_builder::CodeBuilder; use miden_standards::note::{NetworkAccountTarget, NoteExecutionHint}; use miden_tx::auth::BasicAuthenticator; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use miden_tx::{LocalTransactionProver, TransactionExecutor}; use rand::{Rng, SeedableRng}; use rand_chacha::ChaCha20Rng; @@ -130,7 +130,7 @@ async fn fetch_counter_value( .try_into() .context("failed to convert slot value to word")?; - let value = slot_value.as_elements().last().expect("Word has 4 elements").as_int(); + let value = slot_value.as_elements().last().expect("Word has 4 elements").as_canonical_u64(); Ok(Some(value)) } @@ -321,7 +321,7 @@ async fn setup_increment_task( .await? .unwrap_or(wallet_account_file.account.clone()); - let AuthSecretKey::Falcon512Rpo(secret_key) = wallet_account_file + let AuthSecretKey::Falcon512Poseidon2(secret_key) = wallet_account_file .auth_secret_keys .first() .expect("wallet account file should have one auth secret key") @@ -821,7 +821,8 @@ async fn create_and_submit_network_note( rng: &mut ChaCha20Rng, ) -> Result<(String, AccountHeader, BlockNumber)> { // Create authenticator for transaction signing - let authenticator = BasicAuthenticator::new(&[AuthSecretKey::Falcon512Rpo(secret_key.clone())]); + let authenticator = + BasicAuthenticator::new(&[AuthSecretKey::Falcon512Poseidon2(secret_key.clone())]); let account_interface = AccountInterface::from_account(wallet_account); @@ -851,7 +852,7 @@ async fn create_and_submit_network_note( // Prove the transaction let prover = LocalTransactionProver::default(); - let proven_tx = prover.prove(executed_tx).context("Failed to prove transaction")?; + let proven_tx = prover.prove(executed_tx).await.context("Failed to prove transaction")?; // Submit the proven transaction let request = ProvenTransaction { diff --git a/bin/network-monitor/src/deploy/counter.rs b/bin/network-monitor/src/deploy/counter.rs index e517beb063..94fbe8b657 100644 --- a/bin/network-monitor/src/deploy/counter.rs +++ b/bin/network-monitor/src/deploy/counter.rs @@ -16,7 +16,7 @@ use miden_protocol::account::{ StorageSlotName, }; use miden_protocol::utils::sync::LazyLock; -use miden_protocol::{Felt, FieldElement, Word}; +use miden_protocol::{Felt, Word}; use miden_standards::code_builder::CodeBuilder; use miden_standards::testing::account_component::IncrNonceAuthComponent; use tracing::instrument; @@ -54,7 +54,7 @@ pub fn create_counter_account(owner_account_id: AccountId) -> Result { let component_code = CodeBuilder::default().compile_component_code("counter::program", script)?; - let metadata = AccountComponentMetadata::new("counter::program").with_supports_all_types(); + let metadata = AccountComponentMetadata::new("counter::program", AccountType::all()); let account_code = AccountComponent::new(component_code, vec![counter_slot, owner_id_slot], metadata)?; diff --git a/bin/network-monitor/src/deploy/mod.rs b/bin/network-monitor/src/deploy/mod.rs index b89c09aa0c..8e427ec97f 100644 --- a/bin/network-monitor/src/deploy/mod.rs +++ b/bin/network-monitor/src/deploy/mod.rs @@ -32,7 +32,7 @@ use miden_protocol::transaction::{ }; use miden_protocol::{MastForest, Word}; use miden_tx::auth::BasicAuthenticator; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use miden_tx::{ DataStore, DataStoreError, @@ -203,7 +203,7 @@ pub async fn deploy_counter_account(counter_account: &Account, rpc_url: &Url) -> let prover = LocalTransactionProver::default(); - let proven_tx = prover.prove(executed_tx).context("Failed to prove transaction")?; + let proven_tx = prover.prove(executed_tx).await.context("Failed to prove transaction")?; let request = ProvenTransaction { transaction: proven_tx.to_bytes(), diff --git a/bin/network-monitor/src/deploy/wallet.rs b/bin/network-monitor/src/deploy/wallet.rs index ba074a60f8..9b9274440d 100644 --- a/bin/network-monitor/src/deploy/wallet.rs +++ b/bin/network-monitor/src/deploy/wallet.rs @@ -6,7 +6,7 @@ use anyhow::Result; use miden_node_utils::crypto::get_rpo_random_coin; use miden_protocol::account::auth::{AuthScheme, AuthSecretKey}; use miden_protocol::account::{Account, AccountFile, AccountStorageMode, AccountType}; -use miden_protocol::crypto::dsa::falcon512_rpo::SecretKey; +use miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey; use miden_standards::AuthMethod; use miden_standards::account::wallets::create_basic_wallet; use rand::{Rng, SeedableRng}; @@ -23,7 +23,7 @@ pub fn create_wallet_account() -> Result<(Account, SecretKey)> { let mut rng = ChaCha20Rng::from_seed(rand::random()); let secret_key = SecretKey::with_rng(&mut get_rpo_random_coin(&mut rng)); let auth = AuthMethod::SingleSig { - approver: (secret_key.public_key().into(), AuthScheme::Falcon512Rpo), + approver: (secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2), }; let init_seed: [u8; 32] = rng.random(); @@ -43,7 +43,7 @@ pub fn save_wallet_account( secret_key: &SecretKey, file_path: &Path, ) -> Result<()> { - let auth_secret_key = AuthSecretKey::Falcon512Rpo(secret_key.clone()); + let auth_secret_key = AuthSecretKey::Falcon512Poseidon2(secret_key.clone()); let account_file = AccountFile::new(account.clone(), vec![auth_secret_key]); account_file.write(file_path)?; Ok(()) diff --git a/bin/network-monitor/src/remote_prover.rs b/bin/network-monitor/src/remote_prover.rs index b103a60c42..471da67739 100644 --- a/bin/network-monitor/src/remote_prover.rs +++ b/bin/network-monitor/src/remote_prover.rs @@ -14,7 +14,7 @@ use miden_protocol::note::NoteType; use miden_protocol::testing::account_id::{ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, ACCOUNT_ID_SENDER}; use miden_protocol::transaction::TransactionInputs; use miden_testing::{Auth, MockChainBuilder}; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use serde::{Deserialize, Serialize}; use tokio::sync::watch; use tokio::time::MissedTickBehavior; @@ -278,7 +278,9 @@ pub async fn generate_mock_transaction() -> anyhow::Result { // Create an account with basic authentication let account = mock_chain_builder - .add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo }) + .add_existing_wallet(Auth::BasicAuth { + auth_scheme: AuthScheme::Falcon512Poseidon2, + }) .context("Failed to add wallet to mock chain")?; // Create a fungible asset diff --git a/bin/node/src/commands/bundled.rs b/bin/node/src/commands/bundled.rs index 2db11c0652..25ed8d0e97 100644 --- a/bin/node/src/commands/bundled.rs +++ b/bin/node/src/commands/bundled.rs @@ -9,7 +9,7 @@ use miden_node_utils::clap::{GrpcOptionsExternal, StorageOptions}; use miden_node_utils::grpc::UrlExt; use miden_node_validator::{Validator, ValidatorSigner}; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey; -use miden_protocol::utils::Deserializable; +use miden_protocol::utils::serde::Deserializable; use tokio::net::TcpListener; use tokio::task::JoinSet; use url::Url; diff --git a/bin/node/src/commands/mod.rs b/bin/node/src/commands/mod.rs index a1b6f8be52..20068cad09 100644 --- a/bin/node/src/commands/mod.rs +++ b/bin/node/src/commands/mod.rs @@ -13,7 +13,7 @@ use miden_node_block_producer::{ use miden_node_utils::clap::duration_to_human_readable_string; use miden_node_validator::ValidatorSigner; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey; -use miden_protocol::utils::Deserializable; +use miden_protocol::utils::serde::Deserializable; use tokio::net::TcpListener; use url::Url; diff --git a/bin/node/src/commands/store.rs b/bin/node/src/commands/store.rs index 53ea3dae96..abcd69c24b 100644 --- a/bin/node/src/commands/store.rs +++ b/bin/node/src/commands/store.rs @@ -7,7 +7,7 @@ use miden_node_utils::clap::{GrpcOptionsInternal, StorageOptions}; use miden_node_utils::fs::ensure_empty_directory; use miden_node_utils::grpc::UrlExt; use miden_protocol::block::ProvenBlock; -use miden_protocol::utils::Deserializable; +use miden_protocol::utils::serde::Deserializable; use url::Url; use super::{ diff --git a/bin/node/src/commands/validator.rs b/bin/node/src/commands/validator.rs index 0068578891..579f1d0fa8 100644 --- a/bin/node/src/commands/validator.rs +++ b/bin/node/src/commands/validator.rs @@ -9,7 +9,7 @@ use miden_node_utils::grpc::UrlExt; use miden_node_utils::signer::BlockSigner; use miden_node_validator::{Validator, ValidatorSigner}; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use url::Url; use crate::commands::{ diff --git a/bin/remote-prover/src/server/prover.rs b/bin/remote-prover/src/server/prover.rs index 6ca76794e5..2931cc70fe 100644 --- a/bin/remote-prover/src/server/prover.rs +++ b/bin/remote-prover/src/server/prover.rs @@ -8,7 +8,7 @@ use miden_protocol::block::BlockProof; use miden_protocol::transaction::{ProvenTransaction, TransactionInputs}; use miden_tx::LocalTransactionProver; use miden_tx_batch_prover::LocalBatchProver; -use tracing::instrument; +use tracing::{Instrument, instrument}; use crate::COMPONENT; use crate::generated::{self as proto}; @@ -33,11 +33,11 @@ impl Prover { /// Proves a [`proto::ProofRequest`] using the appropriate prover implementation as specified /// during construction. - pub fn prove(&self, request: proto::ProofRequest) -> Result { + pub async fn prove(&self, request: proto::ProofRequest) -> Result { match self { - Prover::Transaction(prover) => prover.prove_request(request), - Prover::Batch(prover) => prover.prove_request(request), - Prover::Block(prover) => prover.prove_request(request), + Prover::Transaction(prover) => prover.prove_request(request).await, + Prover::Batch(prover) => prover.prove_request(request).await, + Prover::Block(prover) => prover.prove_request(request).await, } } } @@ -51,30 +51,35 @@ impl Prover { /// /// Implementations of this trait only need to provide the input and outputs types, as well as the /// proof implementation. -trait ProveRequest { - type Input: miden_protocol::utils::Deserializable; - type Output: miden_protocol::utils::Serializable; +#[async_trait::async_trait] +trait ProveRequest: Send + Sync { + type Input: miden_protocol::utils::serde::Deserializable + Send; + type Output: miden_protocol::utils::serde::Serializable + Send; - fn prove(&self, input: Self::Input) -> Result; + async fn prove(&self, input: Self::Input) -> Result; /// Entry-point to the proof request handling. /// /// Decodes the request, proves it, and encodes the response. - fn prove_request(&self, request: proto::ProofRequest) -> Result { - Self::decode_request(request) - .and_then(|input| { - // We cannot #[instrument] the trait's prove method because it lacks an - // implementation, so we do it manually. - tracing::info_span!("prove", target = COMPONENT).in_scope(|| { - self.prove(input).inspect_err(|e| tracing::Span::current().set_error(e)) - }) - }) - .map(|output| Self::encode_response(output)) + async fn prove_request( + &self, + request: proto::ProofRequest, + ) -> Result { + let input = Self::decode_request(request)?; + + let prove_span = tracing::info_span!("prove", target = COMPONENT); + let result = self.prove(input).instrument(prove_span).await; + + if let Err(e) = &result { + tracing::Span::current().set_error(e); + } + + result.map(|output| Self::encode_response(output)) } #[instrument(target=COMPONENT, skip_all, err)] fn decode_request(request: proto::ProofRequest) -> Result { - use miden_protocol::utils::Deserializable; + use miden_protocol::utils::serde::Deserializable; Self::Input::read_from_bytes(&request.payload).map_err(|e| { tonic::Status::invalid_argument(e.as_report_context("failed to decode request")) @@ -83,38 +88,41 @@ trait ProveRequest { #[instrument(target=COMPONENT, skip_all)] fn encode_response(output: Self::Output) -> proto::Proof { - use miden_protocol::utils::Serializable; + use miden_protocol::utils::serde::Serializable; proto::Proof { payload: output.to_bytes() } } } +#[async_trait::async_trait] impl ProveRequest for LocalTransactionProver { type Input = TransactionInputs; type Output = ProvenTransaction; - fn prove(&self, input: Self::Input) -> Result { - self.prove(input).map_err(|e| { + async fn prove(&self, input: Self::Input) -> Result { + LocalTransactionProver::prove(self, input).await.map_err(|e| { tonic::Status::internal(e.as_report_context("failed to prove transaction")) }) } } +#[async_trait::async_trait] impl ProveRequest for LocalBatchProver { type Input = ProposedBatch; type Output = ProvenBatch; - fn prove(&self, input: Self::Input) -> Result { + async fn prove(&self, input: Self::Input) -> Result { self.prove(input) .map_err(|e| tonic::Status::internal(e.as_report_context("failed to prove batch"))) } } +#[async_trait::async_trait] impl ProveRequest for LocalBlockProver { type Input = BlockProofRequest; type Output = BlockProof; - fn prove(&self, input: Self::Input) -> Result { + async fn prove(&self, input: Self::Input) -> Result { let BlockProofRequest { tx_batches, block_header, block_inputs } = input; self.prove(tx_batches, &block_header, block_inputs) .map_err(|e| tonic::Status::internal(e.as_report_context("failed to prove block"))) diff --git a/bin/remote-prover/src/server/service.rs b/bin/remote-prover/src/server/service.rs index 4a72147a65..0658336625 100644 --- a/bin/remote-prover/src/server/service.rs +++ b/bin/remote-prover/src/server/service.rs @@ -76,13 +76,6 @@ impl proto::api_server::Api for ProverService { // This mutex is fair and uses FIFO ordering. let prover = self.acquire_prover().await; - // Blocking in place is fairly safe since we guarantee that only a single request is - // processed at a time. - // - // This has the downside that requests being proven cannot be cancelled since we are now - // outside the async runtime. This could occur if the server timeout is exceeded, or - // the client cancels the request. A different approach is technically possible, but - // would require more complex logic to handle cancellation in tandem with sync. - tokio::task::block_in_place(|| prover.prove(request)).map(tonic::Response::new) + prover.prove(request).await.map(tonic::Response::new) } } diff --git a/bin/remote-prover/src/server/tests.rs b/bin/remote-prover/src/server/tests.rs index f1d526b16d..7ba10b23b1 100644 --- a/bin/remote-prover/src/server/tests.rs +++ b/bin/remote-prover/src/server/tests.rs @@ -12,7 +12,7 @@ use miden_protocol::note::NoteType; use miden_protocol::testing::account_id::{ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, ACCOUNT_ID_SENDER}; use miden_protocol::transaction::{ExecutedTransaction, ProvenTransaction}; use miden_testing::{Auth, MockChainBuilder}; -use miden_tx::utils::{Deserializable, Serializable}; +use miden_tx::utils::serde::{Deserializable, Serializable}; use miden_tx::{LocalTransactionProver, TransactionVerifier}; use miden_tx_batch_prover::LocalBatchProver; use serial_test::serial; @@ -64,7 +64,9 @@ impl ProofRequest { // Create a mock transaction to send to the server let mut mock_chain_builder = MockChainBuilder::new(); let account = mock_chain_builder - .add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo }) + .add_existing_wallet(Auth::BasicAuth { + auth_scheme: AuthScheme::Falcon512Poseidon2, + }) .unwrap(); let fungible_asset_1: Asset = @@ -96,7 +98,9 @@ impl ProofRequest { // Create a mock transaction to send to the server let mut mock_chain_builder = MockChainBuilder::new(); let account = mock_chain_builder - .add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo }) + .add_existing_wallet(Auth::BasicAuth { + auth_scheme: AuthScheme::Falcon512Poseidon2, + }) .unwrap(); let fungible_asset_1: Asset = @@ -123,7 +127,9 @@ impl ProofRequest { let tx = Box::pin(tx.execute()).await.unwrap(); let tx = tokio::task::block_in_place(|| { - LocalTransactionProver::default().prove(tx.tx_inputs().clone()).unwrap() + tokio::runtime::Handle::current() + .block_on(LocalTransactionProver::default().prove(tx.tx_inputs().clone())) + .unwrap() }); ProposedBatch::new( diff --git a/bin/stress-test/Cargo.toml b/bin/stress-test/Cargo.toml index 0be68877dc..452da58606 100644 --- a/bin/stress-test/Cargo.toml +++ b/bin/stress-test/Cargo.toml @@ -20,7 +20,6 @@ workspace = true clap = { features = ["derive"], version = "4.5" } fs-err = { workspace = true } futures = { workspace = true } -miden-air = { features = ["testing"], workspace = true } miden-node-block-producer = { workspace = true } miden-node-proto = { workspace = true } miden-node-store = { workspace = true } diff --git a/bin/stress-test/src/seeding/mod.rs b/bin/stress-test/src/seeding/mod.rs index f6ba165109..c0e5ddb4a4 100644 --- a/bin/stress-test/src/seeding/mod.rs +++ b/bin/stress-test/src/seeding/mod.rs @@ -4,7 +4,6 @@ use std::sync::{Arc, Mutex}; use std::time::Instant; use metrics::SeedingMetrics; -use miden_air::ExecutionProof; use miden_node_block_producer::store::StoreClient; use miden_node_proto::domain::batch::BatchInputs; use miden_node_proto::generated::store::rpc_client::RpcClient; @@ -33,26 +32,30 @@ use miden_protocol::block::{ SignedBlock, }; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey as EcdsaSecretKey; -use miden_protocol::crypto::dsa::falcon512_rpo::{PublicKey, SecretKey}; +use miden_protocol::crypto::dsa::falcon512_poseidon2::{PublicKey, SecretKey}; use miden_protocol::crypto::rand::RpoRandomCoin; use miden_protocol::errors::AssetError; use miden_protocol::note::{Note, NoteHeader, NoteId, NoteInclusionProof}; use miden_protocol::transaction::{ InputNote, + InputNoteCommitment, InputNotes, OrderedTransactionHeaders, OutputNote, ProvenTransaction, - ProvenTransactionBuilder, + PublicOutputNote, TransactionHeader, + TxAccountUpdate, }; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; +use miden_protocol::vm::ExecutionProof; use miden_protocol::{Felt, ONE, Word}; use miden_standards::account::auth::AuthSingleSig; use miden_standards::account::faucets::BasicFungibleFaucet; use miden_standards::account::wallets::BasicWallet; use miden_standards::note::P2idNote; -use rand::Rng; +use rand::rngs::StdRng; +use rand::{Rng, SeedableRng}; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use rayon::prelude::ParallelSlice; use tokio::io::AsyncWriteExt; @@ -174,23 +177,27 @@ async fn generate_blocks( let mut block_txs = Vec::with_capacity(BATCHES_PER_BLOCK * TRANSACTIONS_PER_BATCH); // create public accounts and notes that mint assets for these accounts + // Use separate index offsets for public and private accounts to avoid ID prefix + // collisions (different storage modes can produce the same prefix in v0.14). + let pub_offset = i * (num_public_accounts + num_private_accounts); let (pub_accounts, pub_notes) = create_accounts_and_notes( num_public_accounts, AccountStorageMode::Public, &key_pair, &rng, faucet.id(), - i, + pub_offset, ); // create private accounts and notes that mint assets for these accounts + let priv_offset = pub_offset + num_public_accounts; let (priv_accounts, priv_notes) = create_accounts_and_notes( num_private_accounts, AccountStorageMode::Private, &key_pair, &rng, faucet.id(), - i, + priv_offset, ); let notes = [pub_notes, priv_notes].concat(); @@ -289,14 +296,14 @@ fn create_accounts_and_notes( key_pair: &SecretKey, rng: &Arc>, faucet_id: AccountId, - block_num: usize, + index_offset: usize, ) -> (Vec, Vec) { (0..num_accounts) .into_par_iter() .map(|account_index| { let account = create_account( key_pair.public_key(), - ((block_num * num_accounts) + account_index) as u64, + (index_offset + account_index) as u64, storage_mode, ); let note = { @@ -323,14 +330,16 @@ fn create_note(faucet_id: AccountId, target_id: AccountId, rng: &mut RpoRandomCo .expect("note creation failed") } -/// Creates a new private account with a given public key and anchor block. Generates the seed from -/// the given index. +/// Creates a new account with a given public key. Uses a seeded PRNG derived from the index to +/// generate a high-entropy init seed, avoiding `AccountId` prefix collisions that can occur with +/// low-entropy seeds. fn create_account(public_key: PublicKey, index: u64, storage_mode: AccountStorageMode) -> Account { - let init_seed: Vec<_> = index.to_be_bytes().into_iter().chain([0u8; 24]).collect(); - AccountBuilder::new(init_seed.try_into().unwrap()) + let mut rng = StdRng::seed_from_u64(index); + let init_seed: [u8; 32] = rng.random(); + AccountBuilder::new(init_seed) .account_type(AccountType::RegularAccountImmutableCode) .storage_mode(storage_mode) - .with_auth_component(AuthSingleSig::new(public_key.into(), AuthScheme::Falcon512Rpo)) + .with_auth_component(AuthSingleSig::new(public_key.into(), AuthScheme::Falcon512Poseidon2)) .with_component(BasicWallet) .build() .unwrap() @@ -350,7 +359,7 @@ fn create_faucet() -> Account { .with_component(BasicFungibleFaucet::new(token_symbol, 2, Felt::new(u64::MAX)).unwrap()) .with_auth_component(AuthSingleSig::new( key_pair.public_key().into(), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build() .unwrap() @@ -422,20 +431,24 @@ fn create_consume_note_tx( (AccountUpdateDetails::Private, Word::empty()) }; - ProvenTransactionBuilder::new( + let account_update = TxAccountUpdate::new( account.id(), init_hash, account.to_commitment(), account_delta_commitment, + details, + ) + .unwrap(); + ProvenTransaction::new( + account_update, + vec![InputNoteCommitment::from(input_note)], + Vec::::new(), block_ref.block_num(), block_ref.commitment(), fee_from_block(block_ref).unwrap(), u32::MAX.into(), ExecutionProof::new_dummy(), ) - .add_input_notes(vec![input_note]) - .account_update_details(details) - .build() .unwrap() } @@ -457,11 +470,21 @@ fn create_emit_note_tx( faucet.increment_nonce(ONE).unwrap(); - ProvenTransactionBuilder::new( + let account_update = TxAccountUpdate::new( faucet.id(), initial_account_hash, faucet.to_commitment(), Word::empty(), + AccountUpdateDetails::Private, + ) + .unwrap(); + ProvenTransaction::new( + account_update, + Vec::::new(), + output_notes + .into_iter() + .map(|note| OutputNote::Public(PublicOutputNote::new(note).unwrap())) + .collect::>(), block_ref.block_num(), block_ref.commitment(), FungibleAsset::new( @@ -472,8 +495,6 @@ fn create_emit_note_tx( u32::MAX.into(), ExecutionProof::new_dummy(), ) - .add_output_notes(output_notes.into_iter().map(OutputNote::Full).collect::>()) - .build() .unwrap() } diff --git a/bin/stress-test/src/store/mod.rs b/bin/stress-test/src/store/mod.rs index f1ea6e0f77..a9f1491fe5 100644 --- a/bin/stress-test/src/store/mod.rs +++ b/bin/stress-test/src/store/mod.rs @@ -9,7 +9,7 @@ use miden_node_utils::clap::StorageOptions; use miden_node_utils::tracing::grpc::OtelInterceptor; use miden_protocol::account::AccountId; use miden_protocol::note::{NoteDetails, NoteTag}; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use rand::Rng; use rand::seq::SliceRandom; use tokio::fs; diff --git a/crates/block-producer/src/domain/transaction.rs b/crates/block-producer/src/domain/transaction.rs index f581ca95e8..9b542f58ef 100644 --- a/crates/block-producer/src/domain/transaction.rs +++ b/crates/block-producer/src/domain/transaction.rs @@ -93,7 +93,7 @@ impl AuthenticatedTransaction { self.inner .output_notes() .iter() - .map(miden_protocol::transaction::OutputNote::commitment) + .map(miden_protocol::transaction::OutputNote::to_commitment) } pub fn output_notes(&self) -> impl Iterator + '_ { diff --git a/crates/block-producer/src/errors.rs b/crates/block-producer/src/errors.rs index b610b0534a..bb23cadc4f 100644 --- a/crates/block-producer/src/errors.rs +++ b/crates/block-producer/src/errors.rs @@ -119,7 +119,7 @@ pub enum AddTransactionError { }, #[error("transaction deserialization failed")] - TransactionDeserializationFailed(#[source] miden_protocol::utils::DeserializationError), + TransactionDeserializationFailed(#[source] miden_protocol::utils::serde::DeserializationError), #[error( "transaction expired at block height {expired_at} but the block height limit was {limit}" @@ -167,7 +167,7 @@ impl From for AddTransactionError { #[grpc(internal)] pub enum SubmitProvenBatchError { #[error("batch deserialization failed")] - Deserialization(#[source] miden_protocol::utils::DeserializationError), + Deserialization(#[source] miden_protocol::utils::serde::DeserializationError), } // Batch building errors diff --git a/crates/block-producer/src/mempool/subscription.rs b/crates/block-producer/src/mempool/subscription.rs index a09c1cc864..1da3bf03fe 100644 --- a/crates/block-producer/src/mempool/subscription.rs +++ b/crates/block-producer/src/mempool/subscription.rs @@ -68,8 +68,10 @@ impl SubscriptionProvider { let network_notes = tx .output_notes() .filter_map(|note| match note { - OutputNote::Full(inner) => inner.clone().into_account_target_network_note().ok(), - _ => None, + OutputNote::Public(inner) => { + inner.clone().into_note().into_account_target_network_note().ok() + }, + OutputNote::Private(_) => None, }) .collect(); let account_delta = diff --git a/crates/block-producer/src/store/mod.rs b/crates/block-producer/src/store/mod.rs index fb20bc160e..6b010df7e9 100644 --- a/crates/block-producer/src/store/mod.rs +++ b/crates/block-producer/src/store/mod.rs @@ -14,7 +14,7 @@ use miden_protocol::batch::OrderedBatches; use miden_protocol::block::{BlockHeader, BlockInputs, BlockNumber, SignedBlock}; use miden_protocol::note::Nullifier; use miden_protocol::transaction::ProvenTransaction; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use tracing::{debug, info, instrument}; use url::Url; diff --git a/crates/block-producer/src/test_utils/note.rs b/crates/block-producer/src/test_utils/note.rs index 6defeac83d..c2bd627a78 100644 --- a/crates/block-producer/src/test_utils/note.rs +++ b/crates/block-producer/src/test_utils/note.rs @@ -1,5 +1,5 @@ use miden_protocol::note::Note; -use miden_protocol::transaction::OutputNote; +use miden_protocol::transaction::{OutputNote, PublicOutputNote}; use miden_standards::testing::note::NoteBuilder; use rand_chacha::ChaCha20Rng; use rand_chacha::rand_core::SeedableRng; @@ -12,5 +12,5 @@ pub fn mock_note(num: u8) -> Note { } pub fn mock_output_note(num: u8) -> OutputNote { - OutputNote::Full(mock_note(num)) + OutputNote::Public(PublicOutputNote::new(mock_note(num)).unwrap()) } diff --git a/crates/block-producer/src/test_utils/proven_tx.rs b/crates/block-producer/src/test_utils/proven_tx.rs index b8d67e9fbe..6af29a0ac4 100644 --- a/crates/block-producer/src/test_utils/proven_tx.rs +++ b/crates/block-producer/src/test_utils/proven_tx.rs @@ -4,14 +4,17 @@ use std::sync::Arc; use itertools::Itertools; use miden_node_utils::fee::test_fee; use miden_protocol::account::AccountId; +use miden_protocol::account::delta::AccountUpdateDetails; use miden_protocol::asset::FungibleAsset; use miden_protocol::block::BlockNumber; use miden_protocol::note::{Note, Nullifier}; use miden_protocol::transaction::{ InputNote, + InputNoteCommitment, OutputNote, + PrivateNoteHeader, ProvenTransaction, - ProvenTransactionBuilder, + TxAccountUpdate, }; use miden_protocol::vm::ExecutionProof; use miden_protocol::{Felt, ONE, Word}; @@ -131,7 +134,7 @@ impl MockProvenTxBuilder { .map(|note_index| { let note = Note::mock_noop(Word::from([0, 0, 0, note_index])); - OutputNote::Header(note.header().clone()) + OutputNote::Private(PrivateNoteHeader::new(note.header().clone()).unwrap()) }) .collect(); @@ -139,21 +142,31 @@ impl MockProvenTxBuilder { } pub fn build(self) -> ProvenTransaction { - ProvenTransactionBuilder::new( + let account_update = TxAccountUpdate::new( self.account_id, self.initial_account_commitment, self.final_account_commitment, Word::empty(), + AccountUpdateDetails::Private, + ) + .unwrap(); + let input_notes: Vec = self + .input_notes + .unwrap_or_default() + .into_iter() + .map(InputNoteCommitment::from) + .chain(self.nullifiers.unwrap_or_default().into_iter().map(InputNoteCommitment::from)) + .collect(); + ProvenTransaction::new( + account_update, + input_notes, + self.output_notes.unwrap_or_default(), BlockNumber::GENESIS, Word::empty(), self.fee, self.expiration_block_num, ExecutionProof::new_dummy(), ) - .add_input_notes(self.input_notes.unwrap_or_default()) - .add_input_notes(self.nullifiers.unwrap_or_default()) - .add_output_notes(self.output_notes.unwrap_or_default()) - .build() .unwrap() } } diff --git a/crates/block-producer/src/validator/mod.rs b/crates/block-producer/src/validator/mod.rs index 9844e2d9b3..085ea61f12 100644 --- a/crates/block-producer/src/validator/mod.rs +++ b/crates/block-producer/src/validator/mod.rs @@ -2,7 +2,7 @@ use miden_node_proto::clients::{Builder, ValidatorClient}; use miden_node_proto::generated as proto; use miden_protocol::block::ProposedBlock; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::Signature; -use miden_protocol::utils::{Deserializable, DeserializationError, Serializable}; +use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable}; use thiserror::Error; use tracing::{info, instrument}; use url::Url; diff --git a/crates/db/src/conv.rs b/crates/db/src/conv.rs index 64c853c73d..8da9b50d38 100644 --- a/crates/db/src/conv.rs +++ b/crates/db/src/conv.rs @@ -151,7 +151,7 @@ pub(crate) fn raw_sql_to_nonce(raw: i64) -> Felt { } #[inline(always)] pub(crate) fn nonce_to_raw_sql(nonce: Felt) -> i64 { - nonce.as_int() as i64 + nonce.as_canonical_u64() as i64 } #[inline(always)] diff --git a/crates/large-smt-backend-rocksdb/Cargo.toml b/crates/large-smt-backend-rocksdb/Cargo.toml index d1226512d0..5109ecc9c3 100644 --- a/crates/large-smt-backend-rocksdb/Cargo.toml +++ b/crates/large-smt-backend-rocksdb/Cargo.toml @@ -19,7 +19,6 @@ miden-crypto = { features = ["concurrent", "std"], workspace = true } miden-protocol = { features = ["std"], workspace = true } rayon = { version = "1.10" } rocksdb = { default-features = false, features = ["bindgen-runtime", "lz4"], version = "0.24" } -winter-utils = { version = "0.13" } [build-dependencies] miden-node-rocksdb-cxx-linkage-fix = { workspace = true } diff --git a/crates/large-smt-backend-rocksdb/src/rocksdb.rs b/crates/large-smt-backend-rocksdb/src/rocksdb.rs index 92f187c4d9..b3afe5f164 100644 --- a/crates/large-smt-backend-rocksdb/src/rocksdb.rs +++ b/crates/large-smt-backend-rocksdb/src/rocksdb.rs @@ -6,6 +6,7 @@ use std::sync::Arc; use miden_crypto::Map; use miden_crypto::merkle::NodeIndex; use miden_crypto::merkle::smt::{InnerNode, SmtLeaf, Subtree}; +use miden_crypto::utils::{Deserializable, Serializable}; use rocksdb::{ BlockBasedOptions, Cache, @@ -20,7 +21,6 @@ use rocksdb::{ ReadOptions, WriteBatch, }; -use winter_utils::{Deserializable, Serializable}; use super::{SmtStorage, StorageError, StorageUpdateParts, StorageUpdates, SubtreeUpdate}; use crate::helpers::{insert_into_leaf, map_rocksdb_err, remove_from_leaf}; @@ -44,8 +44,6 @@ const METADATA_CF: &str = "metadata"; /// rebuilding. const DEPTH_24_CF: &str = "depth24"; -/// The key used in the `METADATA_CF` column family to store the SMT's root hash. -const ROOT_KEY: &[u8] = b"smt_root"; /// The key used in the `METADATA_CF` column family to store the total count of non-empty leaves. const LEAF_COUNT_KEY: &[u8] = b"leaf_count"; /// The key used in the `METADATA_CF` column family to store the total count of key-value entries. @@ -264,35 +262,6 @@ impl RocksDbStorage { } impl SmtStorage for RocksDbStorage { - /// Retrieves the SMT root hash from the `METADATA_CF` column family. - /// - /// # Errors - /// - `StorageError::Backend`: If the metadata column family is missing or a RocksDB error - /// occurs. - /// - `StorageError::DeserializationError`: If the retrieved root hash bytes cannot be - /// deserialized. - fn get_root(&self) -> Result, StorageError> { - let cf = self.cf_handle(METADATA_CF)?; - match self.db.get_cf(cf, ROOT_KEY).map_err(map_rocksdb_err)? { - Some(bytes) => { - let digest = Word::read_from_bytes(&bytes)?; - Ok(Some(digest)) - }, - None => Ok(None), - } - } - - /// Stores the SMT root hash in the `METADATA_CF` column family. - /// - /// # Errors - /// - `StorageError::Backend`: If the metadata column family is missing or a RocksDB error - /// occurs. - fn set_root(&self, root: Word) -> Result<(), StorageError> { - let cf = self.cf_handle(METADATA_CF)?; - self.db.put_cf(cf, ROOT_KEY, root.to_bytes()).map_err(map_rocksdb_err)?; - Ok(()) - } - /// Retrieves the total count of non-empty leaves from the `METADATA_CF` column family. /// Returns 0 if the count is not found. /// @@ -355,7 +324,7 @@ impl SmtStorage for RocksDbStorage { /// - `StorageError::DeserializationError`: If existing leaf data is corrupt. #[expect(clippy::single_match_else)] fn insert_value( - &self, + &mut self, index: u64, key: Word, value: Word, @@ -428,7 +397,7 @@ impl SmtStorage for RocksDbStorage { /// # Errors /// - `StorageError::Backend`: If column families are missing or a RocksDB error occurs. /// - `StorageError::DeserializationError`: If existing leaf data is corrupt. - fn remove_value(&self, index: u64, key: Word) -> Result, StorageError> { + fn remove_value(&mut self, index: u64, key: Word) -> Result, StorageError> { let Some(mut leaf) = self.get_leaf(index)? else { return Ok(None); }; @@ -488,7 +457,7 @@ impl SmtStorage for RocksDbStorage { /// /// # Errors /// - `StorageError::Backend`: If column families are missing or a RocksDB error occurs. - fn set_leaves(&self, leaves: Map) -> Result<(), StorageError> { + fn set_leaves(&mut self, leaves: Map) -> Result<(), StorageError> { let cf = self.cf_handle(LEAVES_CF)?; let leaf_count: usize = leaves.len(); let entry_count: usize = leaves.values().map(|leaf| leaf.entries().len()).sum(); @@ -519,7 +488,7 @@ impl SmtStorage for RocksDbStorage { /// - `StorageError::Backend`: If the leaves column family is missing or a RocksDB error occurs. /// - `StorageError::DeserializationError`: If the retrieved (to be returned) leaf data is /// corrupt. - fn remove_leaf(&self, index: u64) -> Result, StorageError> { + fn remove_leaf(&mut self, index: u64) -> Result, StorageError> { let key = Self::index_db_key(index); let cf = self.cf_handle(LEAVES_CF)?; let old_bytes = self.db.get_cf(cf, key).map_err(map_rocksdb_err)?; @@ -676,7 +645,7 @@ impl SmtStorage for RocksDbStorage { /// # Errors /// - Returns `StorageError` if column family lookup, serialization, or the write operation /// fails. - fn set_subtree(&self, subtree: &Subtree) -> Result<(), StorageError> { + fn set_subtree(&mut self, subtree: &Subtree) -> Result<(), StorageError> { let subtrees_cf = self.subtree_cf(subtree.root_index()); let mut batch = WriteBatch::default(); @@ -714,7 +683,7 @@ impl SmtStorage for RocksDbStorage { /// /// # Errors /// - Returns `StorageError::Backend` if any column family lookup or RocksDB write fails. - fn set_subtrees(&self, subtrees: Vec) -> Result<(), StorageError> { + fn set_subtrees(&mut self, subtrees: Vec) -> Result<(), StorageError> { let depth24_cf = self.cf_handle(DEPTH_24_CF)?; let mut batch = WriteBatch::default(); @@ -741,7 +710,7 @@ impl SmtStorage for RocksDbStorage { /// # Errors /// - `StorageError::Backend`: If the subtrees column family is missing or a RocksDB error /// occurs. - fn remove_subtree(&self, index: NodeIndex) -> Result<(), StorageError> { + fn remove_subtree(&mut self, index: NodeIndex) -> Result<(), StorageError> { let subtrees_cf = self.subtree_cf(index); let mut batch = WriteBatch::default(); @@ -790,7 +759,7 @@ impl SmtStorage for RocksDbStorage { /// - `StorageError::Backend`: If `index.depth() < IN_MEMORY_DEPTH`, or if RocksDB errors occur. /// - `StorageError::Value`: If existing Subtree data is corrupt. fn set_inner_node( - &self, + &mut self, index: NodeIndex, node: InnerNode, ) -> Result, StorageError> { @@ -818,7 +787,7 @@ impl SmtStorage for RocksDbStorage { /// # Errors /// - `StorageError::Backend`: If `index.depth() < IN_MEMORY_DEPTH`, or if RocksDB errors occur. /// - `StorageError::Value`: If existing Subtree data is corrupt. - fn remove_inner_node(&self, index: NodeIndex) -> Result, StorageError> { + fn remove_inner_node(&mut self, index: NodeIndex) -> Result, StorageError> { if index.depth() < IN_MEMORY_DEPTH { return Err(StorageError::Unsupported( "Cannot remove inner node from upper part of the tree".into(), @@ -856,7 +825,7 @@ impl SmtStorage for RocksDbStorage { /// /// # Errors /// - `StorageError::Backend`: If any column family is missing or a RocksDB write error occurs. - fn apply(&self, updates: StorageUpdates) -> Result<(), StorageError> { + fn apply(&mut self, updates: StorageUpdates) -> Result<(), StorageError> { use rayon::prelude::*; let mut batch = WriteBatch::default(); @@ -868,7 +837,6 @@ impl SmtStorage for RocksDbStorage { let StorageUpdateParts { leaf_updates, subtree_updates, - new_root, leaf_count_delta, entry_count_delta, } = updates.into_parts(); @@ -943,8 +911,6 @@ impl SmtStorage for RocksDbStorage { batch.put_cf(metadata_cf, ENTRY_COUNT_KEY, new_entry_count.to_be_bytes()); } - batch.put_cf(metadata_cf, ROOT_KEY, new_root.to_bytes()); - let mut write_opts = rocksdb::WriteOptions::default(); // Disable immediate WAL sync to disk for better performance write_opts.set_sync(false); diff --git a/crates/ntx-builder/src/actor/execute.rs b/crates/ntx-builder/src/actor/execute.rs index d06c283c14..e7e01f0de5 100644 --- a/crates/ntx-builder/src/actor/execute.rs +++ b/crates/ntx-builder/src/actor/execute.rs @@ -35,7 +35,7 @@ use miden_protocol::transaction::{ use miden_protocol::vm::FutureMaybeSend; use miden_remote_prover_client::RemoteTransactionProver; use miden_tx::auth::UnreachableAuth; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use miden_tx::{ DataStore, DataStoreError, @@ -51,7 +51,6 @@ use miden_tx::{ TransactionProverError, }; use tokio::sync::Mutex; -use tokio::task::JoinError; use tracing::{Instrument, instrument}; use crate::COMPONENT; @@ -73,8 +72,6 @@ pub enum NtxError { Proving(#[source] TransactionProverError), #[error("failed to submit transaction")] Submission(#[source] tonic::Status), - #[error("the ntx task panicked")] - Panic(#[source] JoinError), } type NtxResult = Result; @@ -302,11 +299,9 @@ impl NtxContext { if let Some(remote) = &self.prover { remote.prove(tx_inputs).await } else { - // Only perform tx inptus clone for local proving. + // Only perform tx inputs clone for local proving. let tx_inputs = tx_inputs.clone(); - tokio::task::spawn_blocking(move || LocalTransactionProver::default().prove(tx_inputs)) - .await - .map_err(NtxError::Panic)? + LocalTransactionProver::default().prove(tx_inputs).await } .map_err(NtxError::Proving) } diff --git a/crates/ntx-builder/src/clients/block_producer.rs b/crates/ntx-builder/src/clients/block_producer.rs index 94227ba22d..8b5d3ffad4 100644 --- a/crates/ntx-builder/src/clients/block_producer.rs +++ b/crates/ntx-builder/src/clients/block_producer.rs @@ -6,7 +6,7 @@ use miden_node_proto::domain::mempool::MempoolEvent; use miden_node_proto::generated::{self as proto}; use miden_node_utils::FlattenResult; use miden_protocol::transaction::ProvenTransaction; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use tokio_stream::StreamExt; use tonic::Status; use tracing::{info, instrument}; diff --git a/crates/ntx-builder/src/clients/store.rs b/crates/ntx-builder/src/clients/store.rs index 1f8c7b5f72..06c26f48b5 100644 --- a/crates/ntx-builder/src/clients/store.rs +++ b/crates/ntx-builder/src/clients/store.rs @@ -27,7 +27,7 @@ use miden_protocol::crypto::merkle::smt::SmtProof; use miden_protocol::note::NoteScript; use miden_protocol::transaction::AccountInputs; use miden_standards::note::AccountTargetNetworkNote; -use miden_tx::utils::{Deserializable, Serializable}; +use miden_tx::utils::serde::{Deserializable, Serializable}; use thiserror::Error; use tracing::{info, instrument}; use url::Url; diff --git a/crates/ntx-builder/src/db/models/conv.rs b/crates/ntx-builder/src/db/models/conv.rs index b32a292538..c50e4f6ac2 100644 --- a/crates/ntx-builder/src/db/models/conv.rs +++ b/crates/ntx-builder/src/db/models/conv.rs @@ -7,7 +7,7 @@ use miden_protocol::account::{Account, AccountId}; use miden_protocol::block::{BlockHeader, BlockNumber}; use miden_protocol::note::{NoteScript, Nullifier}; use miden_protocol::transaction::TransactionId; -use miden_tx::utils::{Deserializable, Serializable}; +use miden_tx::utils::serde::{Deserializable, Serializable}; // SERIALIZATION (domain → DB) // ================================================================================================ diff --git a/crates/ntx-builder/src/db/models/queries/mod.rs b/crates/ntx-builder/src/db/models/queries/mod.rs index 7b6329396d..bd1d25dc5b 100644 --- a/crates/ntx-builder/src/db/models/queries/mod.rs +++ b/crates/ntx-builder/src/db/models/queries/mod.rs @@ -10,7 +10,7 @@ use miden_protocol::block::{BlockHeader, BlockNumber}; use miden_protocol::note::Nullifier; use miden_protocol::transaction::TransactionId; use miden_standards::note::AccountTargetNetworkNote; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use super::account_effect::NetworkAccountEffect; use crate::db::models::conv as conversions; diff --git a/crates/ntx-builder/src/db/models/queries/notes.rs b/crates/ntx-builder/src/db/models/queries/notes.rs index b986953a1f..9d8e328e56 100644 --- a/crates/ntx-builder/src/db/models/queries/notes.rs +++ b/crates/ntx-builder/src/db/models/queries/notes.rs @@ -6,7 +6,7 @@ use miden_node_proto::domain::account::NetworkAccountId; use miden_protocol::block::BlockNumber; use miden_protocol::note::{Note, Nullifier}; use miden_standards::note::AccountTargetNetworkNote; -use miden_tx::utils::{Deserializable, Serializable}; +use miden_tx::utils::serde::{Deserializable, Serializable}; use crate::db::models::conv as conversions; use crate::db::schema; diff --git a/crates/ntx-builder/src/test_utils.rs b/crates/ntx-builder/src/test_utils.rs index 10c00eed64..1c2c743106 100644 --- a/crates/ntx-builder/src/test_utils.rs +++ b/crates/ntx-builder/src/test_utils.rs @@ -32,8 +32,12 @@ pub fn mock_network_account_id_seeded(seed: u8) -> NetworkAccountId { /// Creates a unique `TransactionId` from a seed value. pub fn mock_tx_id(seed: u64) -> TransactionId { + use miden_protocol::testing::account_id::ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET; + let w = |n: u64| Word::try_from([n, 0, 0, 0]).unwrap(); - TransactionId::new(w(seed), w(seed + 1), w(seed + 2), w(seed + 3)) + let faucet_id = AccountId::try_from(ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET).unwrap(); + let fee = miden_protocol::asset::FungibleAsset::new(faucet_id, 0).unwrap(); + TransactionId::new(w(seed), w(seed + 1), w(seed + 2), w(seed + 3), fee) } /// Creates a `AccountTargetNetworkNote` targeting the given network account. diff --git a/crates/proto/src/domain/account.rs b/crates/proto/src/domain/account.rs index aeec888328..3772241c95 100644 --- a/crates/proto/src/domain/account.rs +++ b/crates/proto/src/domain/account.rs @@ -20,7 +20,7 @@ use miden_protocol::block::account_tree::AccountWitness; use miden_protocol::crypto::merkle::SparseMerklePath; use miden_protocol::crypto::merkle::smt::SmtProof; use miden_protocol::note::NoteAttachment; -use miden_protocol::utils::{Deserializable, DeserializationError, Serializable}; +use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable}; use miden_standards::note::{NetworkAccountTarget, NetworkAccountTargetError}; use thiserror::Error; @@ -298,7 +298,7 @@ impl From for proto::account::AccountHeader { vault_root: Some(header.vault_root().into()), storage_commitment: Some(header.storage_commitment().into()), code_commitment: Some(header.code_commitment().into()), - nonce: header.nonce().as_int(), + nonce: header.nonce().as_canonical_u64(), } } } @@ -373,14 +373,9 @@ impl TryFrom for AccountVaultDetails { if too_many_assets { Ok(Self::LimitExceeded) } else { - let parsed_assets = - Result::, ConversionError>::from_iter(assets.into_iter().map(|asset| { - let asset = asset - .asset - .ok_or(proto::primitives::Asset::missing_field(stringify!(asset)))?; - let asset = Word::try_from(asset)?; - Asset::try_from(asset).map_err(ConversionError::AssetError) - }))?; + let parsed_assets = Result::, ConversionError>::from_iter( + assets.into_iter().map(Asset::try_from), + )?; Ok(Self::Assets(parsed_assets)) } } @@ -395,9 +390,7 @@ impl From for proto::rpc::AccountVaultDetails { }, AccountVaultDetails::Assets(assets) => Self { too_many_assets: false, - assets: Vec::from_iter(assets.into_iter().map(|asset| proto::primitives::Asset { - asset: Some(proto::primitives::Digest::from(Word::from(asset))), - })), + assets: Vec::from_iter(assets.into_iter().map(proto::primitives::Asset::from)), }, } } @@ -1008,17 +1001,20 @@ impl TryFrom for Asset { type Error = ConversionError; fn try_from(value: proto::primitives::Asset) -> Result { - let inner = value.asset.ok_or(proto::primitives::Asset::missing_field("asset"))?; - let word = Word::try_from(inner)?; + let key = value.key.ok_or(proto::primitives::Asset::missing_field("key"))?; + let key_word = Word::try_from(key)?; + let value = value.value.ok_or(proto::primitives::Asset::missing_field("value"))?; + let value_word = Word::try_from(value)?; - Asset::try_from(word).map_err(ConversionError::AssetError) + Asset::from_key_value_words(key_word, value_word).map_err(ConversionError::AssetError) } } impl From for proto::primitives::Asset { fn from(asset_from: Asset) -> Self { proto::primitives::Asset { - asset: Some(Word::from(asset_from).into()), + key: Some(asset_from.to_key_word().into()), + value: Some(asset_from.to_value_word().into()), } } } diff --git a/crates/proto/src/domain/batch.rs b/crates/proto/src/domain/batch.rs index 1cccf6ab8b..0c17a7eadf 100644 --- a/crates/proto/src/domain/batch.rs +++ b/crates/proto/src/domain/batch.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use miden_protocol::block::BlockHeader; use miden_protocol::note::{NoteId, NoteInclusionProof}; use miden_protocol::transaction::PartialBlockchain; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use crate::errors::{ConversionError, MissingFieldHelper}; use crate::generated as proto; diff --git a/crates/proto/src/domain/block.rs b/crates/proto/src/domain/block.rs index 112f84e50b..6383c255db 100644 --- a/crates/proto/src/domain/block.rs +++ b/crates/proto/src/domain/block.rs @@ -14,7 +14,7 @@ use miden_protocol::block::{ use miden_protocol::crypto::dsa::ecdsa_k256_keccak::{PublicKey, Signature}; use miden_protocol::note::{NoteId, NoteInclusionProof}; use miden_protocol::transaction::PartialBlockchain; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use thiserror::Error; use crate::errors::{ConversionError, MissingFieldHelper}; diff --git a/crates/proto/src/domain/digest.rs b/crates/proto/src/domain/digest.rs index 08d8c3f9a1..d411c100fd 100644 --- a/crates/proto/src/domain/digest.rs +++ b/crates/proto/src/domain/digest.rs @@ -3,7 +3,7 @@ use std::fmt::{Debug, Display, Formatter}; use hex::{FromHex, ToHex}; use miden_protocol::account::StorageMapKey; use miden_protocol::note::NoteId; -use miden_protocol::{Felt, StarkField, Word}; +use miden_protocol::{Felt, Word}; use crate::errors::ConversionError; use crate::generated as proto; @@ -106,10 +106,10 @@ impl From<&[u64; 4]> for proto::primitives::Digest { impl From<[Felt; 4]> for proto::primitives::Digest { fn from(value: [Felt; 4]) -> Self { Self { - d0: value[0].as_int(), - d1: value[1].as_int(), - d2: value[2].as_int(), - d3: value[3].as_int(), + d0: value[0].as_canonical_u64(), + d1: value[1].as_canonical_u64(), + d2: value[2].as_canonical_u64(), + d3: value[3].as_canonical_u64(), } } } @@ -123,10 +123,10 @@ impl From<&[Felt; 4]> for proto::primitives::Digest { impl From for proto::primitives::Digest { fn from(value: Word) -> Self { Self { - d0: value[0].as_int(), - d1: value[1].as_int(), - d2: value[2].as_int(), - d3: value[3].as_int(), + d0: value[0].as_canonical_u64(), + d1: value[1].as_canonical_u64(), + d2: value[2].as_canonical_u64(), + d3: value[3].as_canonical_u64(), } } } @@ -174,10 +174,7 @@ impl TryFrom for [Felt; 4] { type Error = ConversionError; fn try_from(value: proto::primitives::Digest) -> Result { - if [value.d0, value.d1, value.d2, value.d3] - .iter() - .any(|v| *v >= ::MODULUS) - { + if [value.d0, value.d1, value.d2, value.d3].iter().any(|v| *v >= Felt::ORDER) { return Err(ConversionError::NotAValidFelt); } diff --git a/crates/proto/src/domain/mempool.rs b/crates/proto/src/domain/mempool.rs index c9bf76bfc9..e6b01bd61c 100644 --- a/crates/proto/src/domain/mempool.rs +++ b/crates/proto/src/domain/mempool.rs @@ -4,7 +4,7 @@ use miden_protocol::account::delta::AccountUpdateDetails; use miden_protocol::block::BlockHeader; use miden_protocol::note::Nullifier; use miden_protocol::transaction::TransactionId; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use miden_standards::note::AccountTargetNetworkNote; use crate::errors::{ConversionError, MissingFieldHelper}; diff --git a/crates/proto/src/domain/note.rs b/crates/proto/src/domain/note.rs index 6a750a6582..90ba7b95d9 100644 --- a/crates/proto/src/domain/note.rs +++ b/crates/proto/src/domain/note.rs @@ -13,7 +13,7 @@ use miden_protocol::note::{ NoteTag, NoteType, }; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use miden_protocol::{MastForest, MastNodeId, Word}; use miden_standards::note::AccountTargetNetworkNote; diff --git a/crates/proto/src/domain/proof_request.rs b/crates/proto/src/domain/proof_request.rs index f6a40d7537..2b92bb935e 100644 --- a/crates/proto/src/domain/proof_request.rs +++ b/crates/proto/src/domain/proof_request.rs @@ -3,7 +3,7 @@ use miden_protocol::batch::OrderedBatches; use miden_protocol::block::{BlockHeader, BlockInputs}; -use miden_protocol::utils::{ +use miden_protocol::utils::serde::{ ByteReader, ByteWriter, Deserializable, diff --git a/crates/proto/src/domain/transaction.rs b/crates/proto/src/domain/transaction.rs index 62052eb633..0da1a05762 100644 --- a/crates/proto/src/domain/transaction.rs +++ b/crates/proto/src/domain/transaction.rs @@ -1,7 +1,6 @@ use miden_protocol::Word; use miden_protocol::note::Nullifier; use miden_protocol::transaction::{InputNoteCommitment, TransactionId}; -use miden_protocol::utils::{Deserializable, Serializable}; use crate::errors::{ConversionError, MissingFieldHelper}; use crate::generated as proto; @@ -85,13 +84,6 @@ impl TryFrom for InputNoteCommitment { let header: Option = value.header.map(TryInto::try_into).transpose()?; - // TODO: https://github.com/0xMiden/node/issues/1783 - // InputNoteCommitment has private fields, so we reconstruct it via - // serialization roundtrip using its Serializable/Deserializable impls. - let mut bytes = Vec::new(); - nullifier.write_into(&mut bytes); - header.write_into(&mut bytes); - InputNoteCommitment::read_from_bytes(&bytes) - .map_err(|err| ConversionError::deserialization_error("InputNoteCommitment", err)) + Ok(InputNoteCommitment::from_parts_unchecked(nullifier, header)) } } diff --git a/crates/proto/src/errors/mod.rs b/crates/proto/src/errors/mod.rs index 04493e6960..75d5bf8701 100644 --- a/crates/proto/src/errors/mod.rs +++ b/crates/proto/src/errors/mod.rs @@ -5,7 +5,7 @@ use std::num::TryFromIntError; pub use miden_node_grpc_error_macro::GrpcError; use miden_protocol::crypto::merkle::smt::{SmtLeafError, SmtProofError}; use miden_protocol::errors::{AccountError, AssetError, FeeError, NoteError, StorageSlotNameError}; -use miden_protocol::utils::DeserializationError; +use miden_protocol::utils::serde::DeserializationError; use miden_standards::note::NetworkAccountTargetError; use thiserror::Error; diff --git a/crates/remote-prover-client/src/remote_prover/batch_prover.rs b/crates/remote-prover-client/src/remote_prover/batch_prover.rs index b0d472656a..c5c100f3e1 100644 --- a/crates/remote-prover-client/src/remote_prover/batch_prover.rs +++ b/crates/remote-prover-client/src/remote_prover/batch_prover.rs @@ -10,7 +10,7 @@ use miden_protocol::transaction::{ TransactionHeader, TransactionId, }; -use miden_protocol::utils::{Deserializable, DeserializationError, Serializable}; +use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable}; use tokio::sync::Mutex; use super::generated::api_client::ApiClient; @@ -110,7 +110,6 @@ impl RemoteBatchProver { &self, proposed_batch: ProposedBatch, ) -> Result { - use miden_protocol::utils::Serializable; self.connect().await?; let mut client = self diff --git a/crates/remote-prover-client/src/remote_prover/block_prover.rs b/crates/remote-prover-client/src/remote_prover/block_prover.rs index c1562e5975..e59d605d74 100644 --- a/crates/remote-prover-client/src/remote_prover/block_prover.rs +++ b/crates/remote-prover-client/src/remote_prover/block_prover.rs @@ -6,7 +6,7 @@ use core::time::Duration; use miden_protocol::batch::{OrderedBatches, ProvenBatch}; use miden_protocol::block::{BlockHeader, BlockInputs, BlockProof, ProposedBlock, ProvenBlock}; use miden_protocol::transaction::{OrderedTransactionHeaders, TransactionHeader}; -use miden_protocol::utils::{Deserializable, DeserializationError, Serializable}; +use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable}; use tokio::sync::Mutex; use super::generated::api_client::ApiClient; @@ -108,7 +108,6 @@ impl RemoteBlockProver { block_header: &BlockHeader, block_inputs: BlockInputs, ) -> Result { - use miden_protocol::utils::Serializable; self.connect().await?; let mut client = self diff --git a/crates/remote-prover-client/src/remote_prover/tx_prover.rs b/crates/remote-prover-client/src/remote_prover/tx_prover.rs index 3bee6199fa..be213904c2 100644 --- a/crates/remote-prover-client/src/remote_prover/tx_prover.rs +++ b/crates/remote-prover-client/src/remote_prover/tx_prover.rs @@ -4,7 +4,7 @@ use alloc::sync::Arc; use core::time::Duration; use miden_protocol::transaction::{ProvenTransaction, TransactionInputs}; -use miden_protocol::utils::{Deserializable, DeserializationError, Serializable}; +use miden_protocol::utils::serde::{Deserializable, DeserializationError, Serializable}; use miden_protocol::vm::FutureMaybeSend; use miden_tx::TransactionProverError; use tokio::sync::Mutex; @@ -107,7 +107,6 @@ impl RemoteTransactionProver { tx_inputs: &TransactionInputs, ) -> impl FutureMaybeSend> { async move { - use miden_protocol::utils::Serializable; self.connect().await.map_err(|err| { TransactionProverError::other_with_source( "failed to connect to the remote prover", diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index 537173e67d..60e48c3ded 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -37,7 +37,6 @@ tracing = { workspace = true } url = { workspace = true } [dev-dependencies] -miden-air = { features = ["testing"], workspace = true } miden-node-store = { features = ["rocksdb"], workspace = true } miden-node-utils = { features = ["testing", "tracing-forest"], workspace = true } miden-protocol = { default-features = true, features = ["testing"], workspace = true } diff --git a/crates/rpc/src/server/api.rs b/crates/rpc/src/server/api.rs index a0ec88859a..cbd45855b2 100644 --- a/crates/rpc/src/server/api.rs +++ b/crates/rpc/src/server/api.rs @@ -1,4 +1,4 @@ -use std::sync::{Arc, LazyLock}; +use std::sync::LazyLock; use std::time::Duration; use anyhow::Context; @@ -19,8 +19,12 @@ use miden_node_utils::limiter::{ }; use miden_protocol::batch::ProvenBatch; use miden_protocol::block::{BlockHeader, BlockNumber}; -use miden_protocol::note::{Note, NoteRecipient, NoteScript}; -use miden_protocol::transaction::{OutputNote, ProvenTransaction, ProvenTransactionBuilder}; +use miden_protocol::transaction::{ + OutputNote, + ProvenTransaction, + PublicOutputNote, + TxAccountUpdate, +}; use miden_protocol::utils::serde::{Deserializable, Serializable}; use miden_protocol::{MIN_PROOF_SECURITY_LEVEL, Word}; use miden_tx::TransactionVerifier; @@ -337,23 +341,27 @@ impl api_server::Api for RpcService { })?; // Rebuild a new ProvenTransaction with decorators removed from output notes - let mut builder = ProvenTransactionBuilder::new( + let account_update = TxAccountUpdate::new( tx.account_id(), tx.account_update().initial_state_commitment(), tx.account_update().final_state_commitment(), tx.account_update().account_delta_commitment(), + tx.account_update().details().clone(), + ) + .map_err(|e| Status::invalid_argument(e.to_string()))?; + + let stripped_outputs = strip_output_note_decorators(tx.output_notes().iter()); + let rebuilt_tx = ProvenTransaction::new( + account_update, + tx.input_notes().iter().cloned(), + stripped_outputs, tx.ref_block_num(), tx.ref_block_commitment(), tx.fee(), tx.expiration_block_num(), tx.proof().clone(), ) - .account_update_details(tx.account_update().details().clone()) - .add_input_notes(tx.input_notes().iter().cloned()); - - let stripped_outputs = strip_output_note_decorators(tx.output_notes().iter()); - builder = builder.add_output_notes(stripped_outputs); - let rebuilt_tx = builder.build().map_err(|e| Status::invalid_argument(e.to_string()))?; + .map_err(|e| Status::invalid_argument(e.to_string()))?; let mut request = request; request.transaction = rebuilt_tx.to_bytes(); @@ -492,23 +500,24 @@ impl api_server::Api for RpcService { // HELPERS // ================================================================================================ -/// Strips decorators from full output notes' scripts. +/// Strips decorators from public output notes' scripts. /// /// This removes MAST decorators from note scripts before forwarding to the block producer, /// as decorators are not needed for transaction processing. +/// +/// Note: `PublicOutputNote::new()` already calls `note.minify_script()` internally, so +/// reconstructing the public note through it handles decorator stripping automatically. fn strip_output_note_decorators<'a>( notes: impl Iterator + 'a, ) -> impl Iterator + 'a { notes.map(|note| match note { - OutputNote::Full(note) => { - let mut mast = note.script().mast().clone(); - Arc::make_mut(&mut mast).strip_decorators(); - let script = NoteScript::from_parts(mast, note.script().entrypoint()); - let recipient = NoteRecipient::new(note.serial_num(), script, note.storage().clone()); - let new_note = Note::new(note.assets().clone(), note.metadata().clone(), recipient); - OutputNote::Full(new_note) + OutputNote::Public(public_note) => { + // Reconstruct via PublicOutputNote::new which calls minify_script() internally. + let rebuilt = PublicOutputNote::new(public_note.as_note().clone()) + .expect("rebuilding an already-valid public output note should not fail"); + OutputNote::Public(rebuilt) }, - other => other.clone(), + OutputNote::Private(header) => OutputNote::Private(header.clone()), }) } diff --git a/crates/rpc/src/tests.rs b/crates/rpc/src/tests.rs index 89b7a23c4a..bd72cc1ba2 100644 --- a/crates/rpc/src/tests.rs +++ b/crates/rpc/src/tests.rs @@ -30,8 +30,8 @@ use miden_protocol::account::{ }; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey; use miden_protocol::testing::noop_auth_component::NoopAuthComponent; -use miden_protocol::transaction::{ProvenTransaction, ProvenTransactionBuilder}; -use miden_protocol::utils::Serializable; +use miden_protocol::transaction::{ProvenTransaction, TxAccountUpdate}; +use miden_protocol::utils::serde::Serializable; use miden_protocol::vm::ExecutionProof; use miden_standards::account::wallets::BasicWallet; use tempfile::TempDir; @@ -74,19 +74,25 @@ fn build_test_proven_tx(account: &Account, delta: &AccountDelta) -> ProvenTransa AccountStorageMode::Public, ); - ProvenTransactionBuilder::new( + let account_update = TxAccountUpdate::new( account_id, [8; 32].try_into().unwrap(), account.to_commitment(), delta.to_commitment(), + AccountUpdateDetails::Delta(delta.clone()), + ) + .unwrap(); + + ProvenTransaction::new( + account_update, + Vec::::new(), + Vec::::new(), 0.into(), Word::default(), test_fee(), u32::MAX.into(), ExecutionProof::new_dummy(), ) - .account_update_details(AccountUpdateDetails::Delta(delta.clone())) - .build() .unwrap() } diff --git a/crates/store/Cargo.toml b/crates/store/Cargo.toml index 7c8135d97a..0b6546b609 100644 --- a/crates/store/Cargo.toml +++ b/crates/store/Cargo.toml @@ -53,7 +53,7 @@ url = { workspace = true } [build-dependencies] build-rs = { workspace = true } fs-err = { workspace = true } -miden-agglayer = { features = ["testing"], version = "=0.14.0-alpha.1" } +miden-agglayer = { features = ["testing"], version = "=0.14.0-beta.2" } miden-protocol = { features = ["std"], workspace = true } miden-standards = { workspace = true } diff --git a/crates/store/benches/account_tree.rs b/crates/store/benches/account_tree.rs index e69da7714d..005a3780ec 100644 --- a/crates/store/benches/account_tree.rs +++ b/crates/store/benches/account_tree.rs @@ -8,7 +8,7 @@ use miden_node_store::AccountTreeWithHistory; use miden_protocol::Word; use miden_protocol::account::AccountId; use miden_protocol::block::BlockNumber; -use miden_protocol::block::account_tree::{AccountTree, account_id_to_smt_key}; +use miden_protocol::block::account_tree::{AccountIdKey, AccountTree}; use miden_protocol::crypto::hash::rpo::Rpo256; use miden_protocol::crypto::merkle::smt::LargeSmt; use miden_protocol::testing::account_id::AccountIdBuilder; @@ -79,7 +79,7 @@ fn setup_vanilla_account_tree( let account_id = generate_account_id(&mut seed); let commitment = generate_word(&mut seed); account_ids.push(account_id); - entries.push((account_id_to_smt_key(account_id), commitment)); + entries.push((AccountIdKey::from(account_id).as_word(), commitment)); } let storage = setup_storage(base_path); diff --git a/crates/store/build.rs b/crates/store/build.rs index 5cc15e4db0..bb3f41169d 100644 --- a/crates/store/build.rs +++ b/crates/store/build.rs @@ -11,7 +11,7 @@ use miden_agglayer::{ }; use miden_protocol::account::auth::AuthScheme; use miden_protocol::account::{Account, AccountCode, AccountFile, AccountStorageMode, AccountType}; -use miden_protocol::crypto::dsa::falcon512_rpo::SecretKey; +use miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey; use miden_protocol::crypto::rand::RpoRandomCoin; use miden_protocol::{Felt, Word}; use miden_standards::AuthMethod; @@ -59,7 +59,7 @@ fn generate_agglayer_sample_accounts() { let bridge_admin = create_basic_wallet( [4u8; 32], AuthMethod::SingleSig { - approver: (bridge_admin_key.public_key().into(), AuthScheme::Falcon512Rpo), + approver: (bridge_admin_key.public_key().into(), AuthScheme::Falcon512Poseidon2), }, AccountType::RegularAccountImmutableCode, AccountStorageMode::Public, @@ -69,7 +69,7 @@ fn generate_agglayer_sample_accounts() { let ger_manager = create_basic_wallet( [5u8; 32], AuthMethod::SingleSig { - approver: (ger_manager_key.public_key().into(), AuthScheme::Falcon512Rpo), + approver: (ger_manager_key.public_key().into(), AuthScheme::Falcon512Poseidon2), }, AccountType::RegularAccountImmutableCode, AccountStorageMode::Public, @@ -139,17 +139,17 @@ fn generate_agglayer_sample_accounts() { .expect("Failed to write agglayer_faucet_usdc.mac"); } -/// Strips source location decorators from an account's code MAST forest. +/// Clears debug info from an account's code MAST forest. /// /// This is necessary because the MAST forest embeds absolute file paths from the Cargo build -/// directory, which include a hash that differs between `cargo check` and `cargo build`. Stripping -/// decorators ensures the serialized `.mac` files are identical regardless of which cargo command +/// directory, which include a hash that differs between `cargo check` and `cargo build`. Clearing +/// debug info ensures the serialized `.mac` files are identical regardless of which cargo command /// is used (CI or local builds or tests). fn strip_code_decorators(account: Account) -> Account { let (id, vault, storage, code, nonce, seed) = account.into_parts(); let mut mast = code.mast(); - Arc::make_mut(&mut mast).strip_decorators(); + Arc::make_mut(&mut mast).clear_debug_info(); let code = AccountCode::from_parts(mast, code.procedures().to_vec()); Account::new_unchecked(id, vault, storage, code, nonce, seed) diff --git a/crates/store/src/account_state_forest/mod.rs b/crates/store/src/account_state_forest/mod.rs index 58026cfe23..7211e06c82 100644 --- a/crates/store/src/account_state_forest/mod.rs +++ b/crates/store/src/account_state_forest/mod.rs @@ -1,9 +1,8 @@ -use std::collections::BTreeSet; +use std::collections::{BTreeMap, BTreeSet}; use miden_crypto::hash::rpo::Rpo256; -use miden_crypto::merkle::smt::ForestInMemoryBackend; +use miden_crypto::merkle::smt::{SMT_DEPTH, SmtForest}; use miden_node_proto::domain::account::AccountStorageMapDetails; -use miden_node_utils::ErrorReport; use miden_protocol::account::delta::{AccountDelta, AccountStorageDelta, AccountVaultDelta}; use miden_protocol::account::{ AccountId, @@ -12,21 +11,11 @@ use miden_protocol::account::{ StorageMapWitness, StorageSlotName, }; -use miden_protocol::asset::{Asset, AssetVaultKey, AssetWitness, FungibleAsset}; +use miden_protocol::asset::{AssetVaultKey, AssetWitness, FungibleAsset}; use miden_protocol::block::BlockNumber; -use miden_protocol::crypto::merkle::smt::{ - ForestOperation, - LargeSmtForest, - LargeSmtForestError, - LineageId, - RootInfo, - SMT_DEPTH, - SmtUpdateBatch, - TreeId, -}; use miden_protocol::crypto::merkle::{EmptySubtreeRoots, MerkleError}; use miden_protocol::errors::{AssetError, StorageMapError}; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use miden_protocol::{EMPTY_WORD, Word}; use thiserror::Error; use tracing::instrument; @@ -45,7 +34,7 @@ pub enum AccountStateForestError { #[error(transparent)] Asset(#[from] AssetError), #[error(transparent)] - Forest(#[from] LargeSmtForestError), + Merkle(#[from] MerkleError), } #[derive(Debug, Error)] @@ -63,21 +52,37 @@ pub enum WitnessError { // ACCOUNT STATE FOREST // ================================================================================================ +/// A lineage identifier for trees in the forest. +/// +/// This is a local replacement for the removed `LineageId` type. It uniquely identifies +/// a lineage of SMT trees (e.g., per-account vault or per-account-slot storage map). +#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +struct LineageId([u8; 32]); + +impl LineageId { + fn new(bytes: [u8; 32]) -> Self { + Self(bytes) + } +} + /// Container for forest-related state that needs to be updated atomically. pub(crate) struct AccountStateForest { - /// `LargeSmtForest` for efficient account storage reconstruction. + /// `SmtForest` for efficient account storage reconstruction. /// Populated during block import with storage and vault SMTs. - forest: LargeSmtForest, + forest: SmtForest, + + /// Maps lineage IDs to a version-ordered list of (version, root) pairs. + /// This replaces the lineage/version tracking that was previously internal to + /// `LargeSmtForest`. + lineage_versions: BTreeMap>, } impl AccountStateForest { pub(crate) fn new() -> Self { - Self { forest: Self::create_forest() } - } - - fn create_forest() -> LargeSmtForest { - let backend = ForestInMemoryBackend::new(); - LargeSmtForest::new(backend).expect("in-memory backend should initialize") + Self { + forest: SmtForest::new(), + lineage_versions: BTreeMap::new(), + } } // HELPERS @@ -94,20 +99,19 @@ impl AccountStateForest { account_id: AccountId, slot_name: &StorageSlotName, block_num: BlockNumber, - ) -> TreeId { + ) -> Option { let lineage = Self::storage_lineage_id(account_id, slot_name); - self.lookup_tree_id(lineage, block_num) + self.get_root_at_block(lineage, block_num) } #[cfg(test)] - fn tree_id_for_vault_root(&self, account_id: AccountId, block_num: BlockNumber) -> TreeId { + fn tree_id_for_vault_root( + &self, + account_id: AccountId, + block_num: BlockNumber, + ) -> Option { let lineage = Self::vault_lineage_id(account_id); - self.lookup_tree_id(lineage, block_num) - } - - #[expect(clippy::unused_self)] - fn lookup_tree_id(&self, lineage: LineageId, block_num: BlockNumber) -> TreeId { - TreeId::new(lineage, block_num.as_u64()) + self.get_root_at_block(lineage, block_num) } fn storage_lineage_id(account_id: AccountId, slot_name: &StorageSlotName) -> LineageId { @@ -121,86 +125,68 @@ impl AccountStateForest { LineageId::new(Rpo256::hash(&account_id.to_bytes()).as_bytes()) } - fn build_forest_operations( - entries: impl IntoIterator, - ) -> Vec { - entries - .into_iter() - .map(|(key, value)| { - if value == EMPTY_WORD { - ForestOperation::remove(key) - } else { - ForestOperation::insert(key, value) - } - }) - .collect() + /// Returns the latest root for a lineage, or `None` if the lineage is not tracked. + fn latest_root(&self, lineage: LineageId) -> Option { + self.lineage_versions + .get(&lineage) + .and_then(|versions| versions.last().map(|(_, root)| *root)) } + /// Returns the latest version number for a lineage, or `None` if not tracked. + fn latest_version(&self, lineage: LineageId) -> Option { + self.lineage_versions + .get(&lineage) + .and_then(|versions| versions.last().map(|(v, _)| *v)) + } + + /// Applies forest updates for a lineage at a given block number. + /// + /// Returns the new root. fn apply_forest_updates( &mut self, lineage: LineageId, block_num: BlockNumber, - operations: Vec, + entries: Vec<(Word, Word)>, ) -> Word { - let updates = if operations.is_empty() { - SmtUpdateBatch::empty() - } else { - SmtUpdateBatch::new(operations.into_iter()) - }; let version = block_num.as_u64(); - let tree = if self.forest.latest_version(lineage).is_some() { - self.forest - .update_tree(lineage, version, updates) - .expect("forest update should succeed") + + // Get the current root for this lineage (or empty root). + let current_root = self.latest_root(lineage).unwrap_or_else(Self::empty_smt_root); + + // Apply all entries via batch_insert on the SmtForest. + let new_root = if entries.is_empty() { + current_root } else { self.forest - .add_lineage(lineage, version, updates) + .batch_insert(current_root, entries) .expect("forest update should succeed") }; - tree.root() - } - fn map_forest_error(error: LargeSmtForestError) -> MerkleError { - match error { - LargeSmtForestError::Merkle(merkle) => merkle, - other => MerkleError::InternalError(other.as_report()), - } + // Record the new version. + self.lineage_versions.entry(lineage).or_default().push((version, new_root)); + + new_root } - fn map_forest_error_to_witness(error: LargeSmtForestError) -> WitnessError { - match error { - LargeSmtForestError::Merkle(merkle) => WitnessError::MerkleError(merkle), - other => WitnessError::MerkleError(MerkleError::InternalError(other.as_report())), + /// Finds the root for a lineage at or before the given block number. + fn get_root_at_block(&self, lineage: LineageId, block_num: BlockNumber) -> Option { + let versions = self.lineage_versions.get(&lineage)?; + let target = block_num.as_u64(); + // Find the latest version <= target. + let mut result = None; + for &(v, root) in versions { + if v <= target { + result = Some(root); + } else { + break; + } } + result } // ACCESSORS // -------------------------------------------------------------------------------------------- - fn get_tree_id(&self, lineage: LineageId, block_num: BlockNumber) -> Option { - let tree = self.lookup_tree_id(lineage, block_num); - match self.forest.root_info(tree) { - RootInfo::LatestVersion(_) | RootInfo::HistoricalVersion(_) => Some(tree), - RootInfo::Missing => { - let latest_version = self.forest.latest_version(lineage)?; - if latest_version <= block_num.as_u64() { - Some(TreeId::new(lineage, latest_version)) - } else { - None - } - }, - } - } - - #[cfg(test)] - fn get_tree_root(&self, lineage: LineageId, block_num: BlockNumber) -> Option { - let tree = self.get_tree_id(lineage, block_num)?; - match self.forest.root_info(tree) { - RootInfo::LatestVersion(root) | RootInfo::HistoricalVersion(root) => Some(root), - RootInfo::Missing => None, - } - } - /// Retrieves a vault root for the specified account and block. #[cfg(test)] pub(crate) fn get_vault_root( @@ -209,7 +195,7 @@ impl AccountStateForest { block_num: BlockNumber, ) -> Option { let lineage = Self::vault_lineage_id(account_id); - self.get_tree_root(lineage, block_num) + self.get_root_at_block(lineage, block_num) } /// Retrieves the storage map root for an account slot at the specified block. @@ -221,7 +207,7 @@ impl AccountStateForest { block_num: BlockNumber, ) -> Option { let lineage = Self::storage_lineage_id(account_id, slot_name); - self.get_tree_root(lineage, block_num) + self.get_root_at_block(lineage, block_num) } // WITNESSES and PROOFS @@ -239,9 +225,9 @@ impl AccountStateForest { raw_key: StorageMapKey, ) -> Result { let lineage = Self::storage_lineage_id(account_id, slot_name); - let tree = self.get_tree_id(lineage, block_num).ok_or(WitnessError::RootNotFound)?; + let root = self.get_root_at_block(lineage, block_num).ok_or(WitnessError::RootNotFound)?; let key = raw_key.hash().into(); - let proof = self.forest.open(tree, key).map_err(Self::map_forest_error_to_witness)?; + let proof = self.forest.open(root, key)?; Ok(StorageMapWitness::new(proof, vec![raw_key])?) } @@ -255,13 +241,10 @@ impl AccountStateForest { asset_keys: BTreeSet, ) -> Result, WitnessError> { let lineage = Self::vault_lineage_id(account_id); - let tree = self.get_tree_id(lineage, block_num).ok_or(WitnessError::RootNotFound)?; + let root = self.get_root_at_block(lineage, block_num).ok_or(WitnessError::RootNotFound)?; let witnessees: Result, WitnessError> = Result::from_iter(asset_keys.into_iter().map(|key| { - let proof = self - .forest - .open(tree, key.into()) - .map_err(Self::map_forest_error_to_witness)?; + let proof = self.forest.open(root, key.into())?; let asset = AssetWitness::new(proof)?; Ok(asset) })); @@ -280,11 +263,11 @@ impl AccountStateForest { raw_keys: &[StorageMapKey], ) -> Option> { let lineage = Self::storage_lineage_id(account_id, &slot_name); - let tree = self.get_tree_id(lineage, block_num)?; + let root = self.get_root_at_block(lineage, block_num)?; let proofs = Result::from_iter(raw_keys.iter().map(|raw_key| { let key_hashed = raw_key.hash().into(); - self.forest.open(tree, key_hashed).map_err(Self::map_forest_error) + self.forest.open(root, key_hashed) })); Some(proofs.map(|proofs| AccountStorageMapDetails::from_proofs(slot_name, proofs))) @@ -373,7 +356,7 @@ impl AccountStateForest { /// account, returns an empty SMT root. fn get_latest_vault_root(&self, account_id: AccountId) -> Word { let lineage = Self::vault_lineage_id(account_id); - self.forest.latest_root(lineage).unwrap_or_else(Self::empty_smt_root) + self.latest_root(lineage).unwrap_or_else(Self::empty_smt_root) } /// Inserts asset vault data into the forest for the specified account. Assumes that asset @@ -387,10 +370,7 @@ impl AccountStateForest { let prev_root = self.get_latest_vault_root(account_id); let lineage = Self::vault_lineage_id(account_id); assert_eq!(prev_root, Self::empty_smt_root(), "account should not be in the forest"); - assert!( - self.forest.latest_version(lineage).is_none(), - "account should not be in the forest" - ); + assert!(self.latest_version(lineage).is_none(), "account should not be in the forest"); if vault_delta.is_empty() { let lineage = Self::vault_lineage_id(account_id); @@ -413,14 +393,16 @@ impl AccountStateForest { let amount = (*amount_delta).try_into().expect("full-state amount should be non-negative"); let asset = FungibleAsset::new(*faucet_id, amount)?; - entries.push((asset.vault_key().into(), asset.into())); + entries.push((asset.to_key_word(), asset.to_value_word())); } // process non-fungible assets for (&asset, action) in vault_delta.non_fungible().iter() { - let asset_vault_key = asset.vault_key().into(); + let asset_vault_key: Word = asset.vault_key().into(); match action { - NonFungibleDeltaAction::Add => entries.push((asset_vault_key, asset.into())), + NonFungibleDeltaAction::Add => { + entries.push((asset_vault_key, asset.to_value_word())); + }, NonFungibleDeltaAction::Remove => entries.push((asset_vault_key, EMPTY_WORD)), } } @@ -428,8 +410,7 @@ impl AccountStateForest { let num_entries = entries.len(); let lineage = Self::vault_lineage_id(account_id); - let operations = Self::build_forest_operations(entries); - let new_root = self.apply_forest_updates(lineage, block_num, operations); + let new_root = self.apply_forest_updates(lineage, block_num, entries); tracing::debug!( target: crate::COMPONENT, @@ -477,12 +458,8 @@ impl AccountStateForest { ); let lineage = Self::storage_lineage_id(account_id, slot_name); - assert!( - self.forest.latest_version(lineage).is_none(), - "account should not be in the forest" - ); - let operations = Self::build_forest_operations(hashed_entries); - let new_root = self.apply_forest_updates(lineage, block_num, operations); + assert!(self.latest_version(lineage).is_none(), "account should not be in the forest"); + let new_root = self.apply_forest_updates(lineage, block_num, hashed_entries); let num_entries = raw_map_entries.len(); @@ -528,8 +505,7 @@ impl AccountStateForest { // get the previous vault root; the root could be for an empty or non-empty SMT let lineage = Self::vault_lineage_id(account_id); - let prev_tree = - self.forest.latest_version(lineage).map(|version| TreeId::new(lineage, version)); + let prev_root = self.latest_root(lineage); let mut entries: Vec<(Word, Word)> = Vec::new(); @@ -537,13 +513,16 @@ impl AccountStateForest { for (faucet_id, amount_delta) in vault_delta.fungible().iter() { let delta_abs = amount_delta.unsigned_abs(); let delta = FungibleAsset::new(*faucet_id, delta_abs)?; - let key = Word::from(delta.vault_key()); + let key = delta.to_key_word(); let empty = FungibleAsset::new(*faucet_id, 0)?; - let asset = if let Some(tree) = prev_tree { - self.forest - .get(tree, key)? - .map(FungibleAsset::try_from) + let asset = if let Some(root) = prev_root { + // Open the proof at the key to get the current value + let proof = self.forest.open(root, key)?; + let (_path, leaf) = proof.into_parts(); + let value = leaf.entries().iter().find(|(k, _)| *k == key).map(|(_, v)| *v); + value + .map(|v| FungibleAsset::from_key_value_words(key, v)) .transpose()? .unwrap_or(empty) } else { @@ -559,7 +538,7 @@ impl AccountStateForest { let value = if updated.amount() == 0 { EMPTY_WORD } else { - Word::from(updated) + updated.to_value_word() }; entries.push((key, value)); } @@ -567,7 +546,7 @@ impl AccountStateForest { // Process non-fungible assets for (asset, action) in vault_delta.non_fungible().iter() { let value = match action { - NonFungibleDeltaAction::Add => Word::from(Asset::NonFungible(*asset)), + NonFungibleDeltaAction::Add => asset.to_value_word(), NonFungibleDeltaAction::Remove => EMPTY_WORD, }; entries.push((asset.vault_key().into(), value)); @@ -576,8 +555,7 @@ impl AccountStateForest { let vault_entries = entries.len(); let lineage = Self::vault_lineage_id(account_id); - let operations = Self::build_forest_operations(entries); - let new_root = self.apply_forest_updates(lineage, block_num, operations); + let new_root = self.apply_forest_updates(lineage, block_num, entries); tracing::debug!( target: crate::COMPONENT, @@ -600,7 +578,7 @@ impl AccountStateForest { slot_name: &StorageSlotName, ) -> Word { let lineage = Self::storage_lineage_id(account_id, slot_name); - self.forest.latest_root(lineage).unwrap_or_else(Self::empty_smt_root) + self.latest_root(lineage).unwrap_or_else(Self::empty_smt_root) } /// Updates the forest with storage map changes from a delta. @@ -635,8 +613,7 @@ impl AccountStateForest { delta_entries.iter().map(|(raw_key, value)| (raw_key.hash().into(), *value)), ); - let operations = Self::build_forest_operations(hashed_entries); - let new_root = self.apply_forest_updates(lineage, block_num, operations); + let new_root = self.apply_forest_updates(lineage, block_num, hashed_entries); tracing::debug!( target: crate::COMPONENT, @@ -663,11 +640,45 @@ impl AccountStateForest { let cutoff_block = chain_tip .checked_sub(HISTORICAL_BLOCK_RETENTION) .unwrap_or(BlockNumber::GENESIS); - let before = self.forest.roots().count(); + let cutoff_version = cutoff_block.as_u64(); + + let mut pruned_count = 0; + let mut roots_to_prune = Vec::new(); + + for versions in self.lineage_versions.values_mut() { + // Remove all versions strictly before the cutoff, but always keep at least one + // version (the latest at or before cutoff) so the lineage's current state is + // preserved. + let split_idx = versions.partition_point(|(v, _)| *v < cutoff_version); + + // If all versions are before the cutoff, keep the last one as the current state. + let drain_end = if split_idx >= versions.len() { + split_idx.saturating_sub(1) + } else { + split_idx + }; + + if drain_end > 0 { + let removed: Vec<_> = versions.drain(..drain_end).collect(); + for (_, root) in &removed { + roots_to_prune.push(*root); + } + pruned_count += removed.len(); + } + } + + // Collect all roots still in use across all lineages. + let active_roots: BTreeSet = self + .lineage_versions + .values() + .flat_map(|versions| versions.iter().map(|(_, root)| *root)) + .collect(); - self.forest.truncate(cutoff_block.as_u64()); + // Only pop roots that are no longer referenced by any lineage. + let orphaned_roots: Vec = + roots_to_prune.into_iter().filter(|r| !active_roots.contains(r)).collect(); + self.forest.pop_smts(orphaned_roots); - let after = self.forest.roots().count(); - before.saturating_sub(after) + pruned_count } } diff --git a/crates/store/src/account_state_forest/tests.rs b/crates/store/src/account_state_forest/tests.rs index 9d72151bc6..24f9b4bd28 100644 --- a/crates/store/src/account_state_forest/tests.rs +++ b/crates/store/src/account_state_forest/tests.rs @@ -1,14 +1,14 @@ use assert_matches::assert_matches; use miden_node_proto::domain::account::StorageMapEntries; +use miden_protocol::Felt; use miden_protocol::account::{AccountCode, StorageMapKey}; -use miden_protocol::asset::{Asset, AssetVault, AssetVaultKey, FungibleAsset}; +use miden_protocol::asset::{Asset, AssetVault, FungibleAsset}; use miden_protocol::crypto::merkle::smt::SmtProof; use miden_protocol::testing::account_id::{ ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, ACCOUNT_ID_REGULAR_PUBLIC_ACCOUNT_IMMUTABLE_CODE, ACCOUNT_ID_REGULAR_PUBLIC_ACCOUNT_IMMUTABLE_CODE_2, }; -use miden_protocol::{Felt, FieldElement}; use super::*; @@ -66,8 +66,7 @@ fn empty_smt_root_is_recognized() { #[test] fn account_state_forest_basic_initialization() { let forest = AccountStateForest::new(); - assert_eq!(forest.forest.lineage_count(), 0); - assert_eq!(forest.forest.tree_count(), 0); + assert_eq!(forest.lineage_versions.len(), 0); } #[test] @@ -85,7 +84,7 @@ fn update_account_with_empty_deltas() { forest.update_account(block_num, &delta).unwrap(); assert!(forest.get_vault_root(account_id, block_num).is_none()); - assert_eq!(forest.forest.lineage_count(), 0); + assert_eq!(forest.lineage_versions.len(), 0); } // VAULT TESTS @@ -191,11 +190,11 @@ fn forest_versions_are_continuous_for_sequential_updates() { let delta = dummy_partial_delta(account_id, vault_delta, storage_delta); forest.update_account(block_num, &delta).unwrap(); - let vault_tree = forest.tree_id_for_vault_root(account_id, block_num); - let storage_tree = forest.tree_id_for_root(account_id, &slot_name, block_num); + let vault_root = forest.tree_id_for_vault_root(account_id, block_num).unwrap(); + let storage_root = forest.tree_id_for_root(account_id, &slot_name, block_num).unwrap(); - assert_matches!(forest.forest.open(vault_tree, asset_key), Ok(_)); - assert_matches!(forest.forest.open(storage_tree, storage_key), Ok(_)); + assert_matches!(forest.forest.open(vault_root, asset_key), Ok(_)); + assert_matches!(forest.forest.open(storage_root, storage_key), Ok(_)); } } @@ -279,7 +278,7 @@ fn witness_queries_work_with_sparse_lineage_updates() { assert_matches!( forest .forest - .open(forest.tree_id_for_vault_root(account_id, block_3), asset_key.into()), + .open(forest.tree_id_for_vault_root(account_id, block_3).unwrap(), asset_key.into(),), Ok(_) ); assert_ne!(vault_root_at_3, AccountStateForest::empty_smt_root()); @@ -324,7 +323,7 @@ fn vault_shared_root_retained_when_one_entry_pruned() { let asset_amount = u64::from(HISTORICAL_BLOCK_RETENTION); let amount_increment = asset_amount / u64::from(HISTORICAL_BLOCK_RETENTION); let asset = dummy_fungible_asset(faucet_id, asset_amount); - let asset_key = AssetVaultKey::new_unchecked(asset.vault_key().into()); + let asset_key = asset.vault_key(); let mut vault_delta_1 = AccountVaultDelta::default(); vault_delta_1.add_asset(asset).unwrap(); @@ -350,11 +349,14 @@ fn vault_shared_root_retained_when_one_entry_pruned() { forest.update_account(block_at_51, &delta_2_update).unwrap(); let block_at_52 = BlockNumber::from(HISTORICAL_BLOCK_RETENTION + 2); - let total_roots_removed = forest.prune(block_at_52); + let total_versions_removed = forest.prune(block_at_52); - assert_eq!(total_roots_removed, 0); + // cutoff = 52 - 50 = 2. account2's version 1 is pruned (it also has version 51 >= cutoff). + // account1's version 1 is its only version, so it's retained. + assert_eq!(total_versions_removed, 1); assert!(forest.get_vault_root(account1, block_1).is_some()); - assert!(forest.get_vault_root(account2, block_1).is_some()); + // account2's version 1 was pruned; earliest remaining is version 51. + assert!(forest.get_vault_root(account2, block_1).is_none()); let vault_root_at_52 = forest.get_vault_root(account1, block_at_52); assert_eq!(vault_root_at_52, Some(root1)); @@ -455,15 +457,15 @@ fn test_storage_map_removals() { let delta_2 = dummy_partial_delta(account_id, AccountVaultDelta::default(), storage_delta_2); forest.update_account(block_2, &delta_2).unwrap(); - let tree = forest.tree_id_for_root(account_id, &slot_name, block_2); + let root = forest.tree_id_for_root(account_id, &slot_name, block_2).unwrap(); let key_2_hash = key_2.hash().into(); let key_1_hash = key_1.hash().into(); - let proof_key_2 = forest.forest.open(tree, key_2_hash).unwrap(); + let proof_key_2 = forest.forest.open(root, key_2_hash).unwrap(); assert_eq!(proof_key_2.get(&key_2_hash), Some(value_2)); - let proof_key_1 = forest.forest.open(tree, key_1_hash).unwrap(); + let proof_key_1 = forest.forest.open(root, key_1_hash).unwrap(); assert_eq!(proof_key_1.get(&key_1_hash), Some(EMPTY_WORD)); } @@ -545,7 +547,7 @@ fn storage_map_empty_entries_query() { let account_component = AccountComponent::new( component_code, component_storage, - AccountComponentMetadata::new("test").with_supports_all_types(), + AccountComponentMetadata::new("test", AccountType::all()), ) .unwrap(); @@ -555,7 +557,7 @@ fn storage_map_empty_entries_query() { .with_component(account_component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -692,22 +694,29 @@ fn prune_removes_smt_roots_from_forest() { let retained_block = BlockNumber::from(TEST_PRUNE_CHAIN_TIP); let pruned_block = BlockNumber::from(3u32); - let total_roots_removed = forest.prune(retained_block); - assert_eq!(total_roots_removed, 0); + let total_versions_removed = forest.prune(retained_block); + // cutoff = 55 - 50 = 5. Vault versions 1..=4 pruned (4 entries), storage version 3 pruned + // (1 entry). + assert_eq!(total_versions_removed, 5); assert!(forest.get_vault_root(account_id, retained_block).is_some()); assert!(forest.get_vault_root(account_id, pruned_block).is_none()); assert!(forest.get_storage_map_root(account_id, &slot_name, pruned_block).is_none()); assert!(forest.get_storage_map_root(account_id, &slot_name, retained_block).is_some()); let asset_key: Word = FungibleAsset::new(faucet_id, 0).unwrap().vault_key().into(); - let retained_tree = forest.tree_id_for_vault_root(account_id, retained_block); - let pruned_tree = forest.tree_id_for_vault_root(account_id, pruned_block); - assert_matches!(forest.forest.open(retained_tree, asset_key), Ok(_)); - assert_matches!(forest.forest.open(pruned_tree, asset_key), Err(_)); + let retained_root = forest.tree_id_for_vault_root(account_id, retained_block).unwrap(); + let pruned_root = forest.tree_id_for_vault_root(account_id, pruned_block); + assert_matches!(forest.forest.open(retained_root, asset_key), Ok(_)); + // Pruned root may not exist + if let Some(root) = pruned_root { + assert_matches!(forest.forest.open(root, asset_key), Err(_)); + } let storage_key = StorageMapKey::new(Word::from([1u32, 0, 0, 0])).hash().into(); - let storage_tree = forest.tree_id_for_root(account_id, &slot_name, pruned_block); - assert_matches!(forest.forest.open(storage_tree, storage_key), Err(_)); + let storage_root = forest.tree_id_for_root(account_id, &slot_name, pruned_block); + if let Some(root) = storage_root { + assert_matches!(forest.forest.open(root, storage_key), Err(_)); + } } #[test] @@ -726,10 +735,17 @@ fn prune_respects_retention_boundary() { forest.update_account(block_num, &delta).unwrap(); } - let total_roots_removed = forest.prune(BlockNumber::from(HISTORICAL_BLOCK_RETENTION)); + let total_versions_removed = forest.prune(BlockNumber::from(HISTORICAL_BLOCK_RETENTION)); - assert_eq!(total_roots_removed, 0); - assert_eq!(forest.forest.tree_count(), 11); + // cutoff = HISTORICAL_BLOCK_RETENTION - HISTORICAL_BLOCK_RETENTION = GENESIS, + // so nothing should be pruned (all versions are within retention). + assert_eq!(total_versions_removed, 0); + + // 1 lineage * HISTORICAL_BLOCK_RETENTION versions = 50 versions total. + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + HISTORICAL_BLOCK_RETENTION as usize + ); } #[test] @@ -759,13 +775,24 @@ fn prune_roots_removes_old_entries() { forest.update_account(block_num, &delta).unwrap(); } - assert_eq!(forest.forest.tree_count(), 22); + // 2 lineages (vault + storage) * 100 blocks = 200 version entries. + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + 2 * TEST_CHAIN_LENGTH as usize + ); - let total_roots_removed = forest.prune(BlockNumber::from(TEST_CHAIN_LENGTH)); + let total_versions_removed = forest.prune(BlockNumber::from(TEST_CHAIN_LENGTH)); - assert_eq!(total_roots_removed, 0); + // cutoff = 100 - 50 = 50. All versions strictly before 50 are removed per lineage. + let expected_removed_per_lineage = + (TEST_CHAIN_LENGTH - HISTORICAL_BLOCK_RETENTION) as usize - 1; + assert_eq!(total_versions_removed, 2 * expected_removed_per_lineage); - assert_eq!(forest.forest.tree_count(), 22); + let expected_remaining_per_lineage = TEST_CHAIN_LENGTH as usize - expected_removed_per_lineage; + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + 2 * expected_remaining_per_lineage + ); } #[test] @@ -790,15 +817,24 @@ fn prune_handles_multiple_accounts() { forest.update_account(block_num, &delta2).unwrap(); } - assert_eq!(forest.forest.tree_count(), 22); + // 2 accounts with 1 vault lineage each * 100 blocks = 200 version entries. + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + 2 * TEST_CHAIN_LENGTH as usize + ); - let total_roots_removed = forest.prune(BlockNumber::from(TEST_CHAIN_LENGTH)); + let total_versions_removed = forest.prune(BlockNumber::from(TEST_CHAIN_LENGTH)); - let expected_removed_per_account = (TEST_CHAIN_LENGTH - HISTORICAL_BLOCK_RETENTION) as usize; - assert_eq!(total_roots_removed, 0); - assert!(total_roots_removed <= expected_removed_per_account * 2); + // cutoff = 100 - 50 = 50. All versions strictly before 50 are removed per lineage. + let expected_removed_per_lineage = + (TEST_CHAIN_LENGTH - HISTORICAL_BLOCK_RETENTION) as usize - 1; + assert_eq!(total_versions_removed, 2 * expected_removed_per_lineage); - assert_eq!(forest.forest.tree_count(), 22); + let expected_remaining_per_lineage = TEST_CHAIN_LENGTH as usize - expected_removed_per_lineage; + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + 2 * expected_remaining_per_lineage + ); } #[test] @@ -827,14 +863,25 @@ fn prune_handles_multiple_slots() { forest.update_account(block_num, &delta).unwrap(); } - assert_eq!(forest.forest.tree_count(), 22); + // 2 lineages (slot_a + slot_b) * 100 blocks = 200 version entries. + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + 2 * TEST_CHAIN_LENGTH as usize + ); let chain_tip = BlockNumber::from(TEST_CHAIN_LENGTH); - let total_roots_removed = forest.prune(chain_tip); + let total_versions_removed = forest.prune(chain_tip); - assert_eq!(total_roots_removed, 0); + // cutoff = 100 - 50 = 50. All versions strictly before 50 are removed per lineage. + let expected_removed_per_lineage = + (TEST_CHAIN_LENGTH - HISTORICAL_BLOCK_RETENTION) as usize - 1; + assert_eq!(total_versions_removed, 2 * expected_removed_per_lineage); - assert_eq!(forest.forest.tree_count(), 22); + let expected_remaining_per_lineage = TEST_CHAIN_LENGTH as usize - expected_removed_per_lineage; + assert_eq!( + forest.lineage_versions.values().map(Vec::len).sum::(), + 2 * expected_remaining_per_lineage + ); } #[test] @@ -883,15 +930,25 @@ fn prune_preserves_most_recent_state_per_entity() { dummy_partial_delta(account_id, AccountVaultDelta::default(), storage_delta_at_51); forest.update_account(block_at_51, &delta_at_51).unwrap(); - // Block 100: Prune + // Block 100: Prune (cutoff = 50) let block_100 = BlockNumber::from(100); - let total_roots_removed = forest.prune(block_100); + let total_versions_removed = forest.prune(block_100); - assert_eq!(total_roots_removed, 0); + // map_a has version 1 pruned (version 51 is >= cutoff), vault and map_b keep their only + // version (1) since it's the latest for those lineages. + assert_eq!(total_versions_removed, 1); + // map_a at block 51 still accessible. assert!(forest.get_storage_map_root(account_id, &slot_map_a, block_at_51).is_some()); - assert!(forest.get_storage_map_root(account_id, &slot_map_a, block_1).is_some()); + + // map_a at block 1 is no longer accessible (version 1 was pruned, earliest is 51). + assert!(forest.get_storage_map_root(account_id, &slot_map_a, block_1).is_none()); + + // map_b at block 1 still accessible (only version, retained as latest). assert!(forest.get_storage_map_root(account_id, &slot_map_b, block_1).is_some()); + + // vault at block 1 still accessible (only version, retained as latest). + assert!(forest.get_vault_root(account_id, block_1).is_some()); } #[test] @@ -953,7 +1010,7 @@ fn shared_vault_root_retained_when_one_account_changes() { let block_1 = BlockNumber::GENESIS.child(); let initial_amount = 1000u64; let asset = dummy_fungible_asset(faucet_id, initial_amount); - let asset_key = AssetVaultKey::new_unchecked(asset.vault_key().into()); + let asset_key = asset.vault_key(); let mut vault_delta_1 = AccountVaultDelta::default(); vault_delta_1.add_asset(asset).unwrap(); diff --git a/crates/store/src/accounts/tests.rs b/crates/store/src/accounts/tests.rs index 9f7b5dcbd8..8e489e2ea1 100644 --- a/crates/store/src/accounts/tests.rs +++ b/crates/store/src/accounts/tests.rs @@ -8,7 +8,7 @@ mod account_tree_with_history_tests { use miden_protocol::Word; use miden_protocol::account::AccountId; use miden_protocol::block::BlockNumber; - use miden_protocol::block::account_tree::{AccountTree, account_id_to_smt_key}; + use miden_protocol::block::account_tree::{AccountIdKey, AccountTree}; use miden_protocol::crypto::merkle::smt::{LargeSmt, MemoryStorage}; use miden_protocol::testing::account_id::AccountIdBuilder; @@ -20,7 +20,7 @@ mod account_tree_with_history_tests { ) -> InMemoryAccountTree { let smt_entries = entries .into_iter() - .map(|(id, commitment)| (account_id_to_smt_key(id), commitment)); + .map(|(id, commitment)| (AccountIdKey::from(id).as_word(), commitment)); let smt = LargeSmt::with_entries(MemoryStorage::default(), smt_entries) .expect("Failed to create LargeSmt from entries"); AccountTree::new(smt).expect("Failed to create AccountTree") diff --git a/crates/store/src/blocks.rs b/crates/store/src/blocks.rs index e771332ba9..10319214ac 100644 --- a/crates/store/src/blocks.rs +++ b/crates/store/src/blocks.rs @@ -3,7 +3,7 @@ use std::ops::Not; use std::path::PathBuf; use miden_protocol::block::BlockNumber; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use tracing::instrument; use crate::COMPONENT; diff --git a/crates/store/src/db/mod.rs b/crates/store/src/db/mod.rs index 43df59d5e3..6fb5fd35cb 100644 --- a/crates/store/src/db/mod.rs +++ b/crates/store/src/db/mod.rs @@ -24,7 +24,7 @@ use miden_protocol::note::{ Nullifier, }; use miden_protocol::transaction::{InputNoteCommitment, TransactionId}; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use tokio::sync::oneshot; use tracing::{info, instrument}; @@ -117,7 +117,7 @@ impl AccountVaultValue { let vault_key = Word::read_from_bytes(&vault_key)?; Ok(Self { block_num: BlockNumber::from_raw_sql(block_num)?, - vault_key: AssetVaultKey::new_unchecked(vault_key), + vault_key: AssetVaultKey::try_from(vault_key)?, asset: asset.map(|b| Asset::read_from_bytes(&b)).transpose()?, }) } diff --git a/crates/store/src/db/models/conv.rs b/crates/store/src/db/models/conv.rs index 2176ea0d46..25b6047f9e 100644 --- a/crates/store/src/db/models/conv.rs +++ b/crates/store/src/db/models/conv.rs @@ -204,7 +204,7 @@ pub(crate) fn raw_sql_to_nonce(raw: i64) -> Felt { } #[inline(always)] pub(crate) fn nonce_to_raw_sql(nonce: Felt) -> i64 { - nonce.as_int() as i64 + nonce.as_canonical_u64() as i64 } #[inline(always)] diff --git a/crates/store/src/db/models/queries/accounts.rs b/crates/store/src/db/models/queries/accounts.rs index 0e8ae47b60..0bd83ec6f7 100644 --- a/crates/store/src/db/models/queries/accounts.rs +++ b/crates/store/src/db/models/queries/accounts.rs @@ -36,7 +36,7 @@ use miden_protocol::account::{ }; use miden_protocol::asset::{Asset, AssetVault, AssetVaultKey, FungibleAsset}; use miden_protocol::block::{BlockAccountUpdate, BlockNumber}; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use miden_protocol::{Felt, Word}; use crate::COMPONENT; @@ -298,7 +298,7 @@ pub(crate) fn select_account_commitments_paged( page_size: NonZeroUsize, after_account_id: Option, ) -> Result { - use miden_protocol::utils::Serializable; + use miden_protocol::utils::serde::Serializable; // Fetch one extra to determine if there are more results #[expect(clippy::cast_possible_wrap)] @@ -374,7 +374,7 @@ pub(crate) fn select_public_account_ids_paged( page_size: NonZeroUsize, after_account_id: Option, ) -> Result { - use miden_protocol::utils::Serializable; + use miden_protocol::utils::serde::Serializable; #[expect(clippy::cast_possible_wrap)] let limit = (page_size.get() + 1) as i64; @@ -901,7 +901,7 @@ impl TryFrom for AccountVaultValue { type Error = DatabaseError; fn try_from(raw: AccountVaultUpdateRaw) -> Result { - let vault_key = AssetVaultKey::new_unchecked(Word::read_from_bytes(&raw.vault_key)?); + let vault_key = AssetVaultKey::try_from(Word::read_from_bytes(&raw.vault_key)?)?; let asset = raw.asset.map(|bytes| Asset::read_from_bytes(&bytes)).transpose()?; let block_num = BlockNumber::from_raw_sql(raw.block_num)?; @@ -1151,8 +1151,8 @@ fn prepare_partial_account_update( // Apply nonce delta. let new_nonce_value = state_headers .nonce - .as_int() - .checked_add(delta.nonce_delta().as_int()) + .as_canonical_u64() + .checked_add(delta.nonce_delta().as_canonical_u64()) .ok_or_else(|| { DatabaseError::DataCorrupted(format!("Nonce overflow for account {account_id}")) })?; diff --git a/crates/store/src/db/models/queries/accounts/at_block.rs b/crates/store/src/db/models/queries/accounts/at_block.rs index 41ec035f3f..fc2ddb00e6 100644 --- a/crates/store/src/db/models/queries/accounts/at_block.rs +++ b/crates/store/src/db/models/queries/accounts/at_block.rs @@ -4,8 +4,8 @@ use diesel::{ExpressionMethods, OptionalExtension, QueryDsl, RunQueryDsl, Sqlite use miden_protocol::account::{AccountHeader, AccountId, AccountStorageHeader}; use miden_protocol::asset::Asset; use miden_protocol::block::BlockNumber; -use miden_protocol::utils::{Deserializable, Serializable}; -use miden_protocol::{Felt, FieldElement, Word}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; +use miden_protocol::{Felt, Word}; use crate::db::models::conv::{SqlTypeConvert, raw_sql_to_nonce}; use crate::db::schema; diff --git a/crates/store/src/db/models/queries/accounts/delta.rs b/crates/store/src/db/models/queries/accounts/delta.rs index 4f39352397..ea9214d2b3 100644 --- a/crates/store/src/db/models/queries/accounts/delta.rs +++ b/crates/store/src/db/models/queries/accounts/delta.rs @@ -23,7 +23,7 @@ use miden_protocol::account::{ StorageSlotName, }; use miden_protocol::asset::{Asset, FungibleAsset}; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use miden_protocol::{EMPTY_WORD, Felt, Word}; use crate::db::models::conv::raw_sql_to_nonce; diff --git a/crates/store/src/db/models/queries/accounts/delta/tests.rs b/crates/store/src/db/models/queries/accounts/delta/tests.rs index 986c5204b3..1e73ab4ebe 100644 --- a/crates/store/src/db/models/queries/accounts/delta/tests.rs +++ b/crates/store/src/db/models/queries/accounts/delta/tests.rs @@ -35,7 +35,7 @@ use miden_protocol::testing::account_id::{ ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_1, }; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use miden_protocol::{EMPTY_WORD, Felt, Word}; use miden_standards::account::auth::AuthSingleSig; use miden_standards::code_builder::CodeBuilder; @@ -142,8 +142,7 @@ fn optimized_delta_matches_full_account_method() { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -153,7 +152,7 @@ fn optimized_delta_matches_full_account_method() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -227,7 +226,8 @@ fn optimized_delta_matches_full_account_method() { assert!(!partial_delta.is_full_state(), "Delta should be partial, not full state"); // Construct the expected final account by applying the delta - let expected_nonce = Felt::new(full_account_before.nonce().as_int() + nonce_delta.as_int()); + let expected_nonce = + Felt::new(full_account_before.nonce().as_canonical_u64() + nonce_delta.as_canonical_u64()); let expected_code_commitment = full_account_before.code().commitment(); let mut expected_account = full_account_before.clone(); @@ -342,8 +342,7 @@ fn optimized_delta_updates_non_empty_vault() { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -353,7 +352,7 @@ fn optimized_delta_updates_non_empty_vault() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .with_assets([initial_asset]) .build_existing() @@ -510,8 +509,7 @@ fn optimized_delta_updates_storage_map_header() { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -521,7 +519,7 @@ fn optimized_delta_updates_storage_map_header() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -684,8 +682,7 @@ fn upsert_full_state_delta() { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -695,7 +692,7 @@ fn upsert_full_state_delta() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); diff --git a/crates/store/src/db/models/queries/accounts/tests.rs b/crates/store/src/db/models/queries/accounts/tests.rs index 39c7d55dde..b98ec96b99 100644 --- a/crates/store/src/db/models/queries/accounts/tests.rs +++ b/crates/store/src/db/models/queries/accounts/tests.rs @@ -40,8 +40,8 @@ use miden_protocol::account::{ }; use miden_protocol::block::{BlockAccountUpdate, BlockHeader, BlockNumber}; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey; -use miden_protocol::utils::{Deserializable, Serializable}; -use miden_protocol::{EMPTY_WORD, Felt, FieldElement, Word}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; +use miden_protocol::{EMPTY_WORD, Felt, Word}; use miden_standards::account::auth::AuthSingleSig; use miden_standards::code_builder::CodeBuilder; @@ -154,8 +154,7 @@ fn create_test_account_with_storage() -> (Account, AccountId) { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -165,7 +164,7 @@ fn create_test_account_with_storage() -> (Account, AccountId) { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -218,8 +217,7 @@ fn create_account_with_map_storage( let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -229,7 +227,7 @@ fn create_account_with_map_storage( .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap() @@ -474,8 +472,7 @@ fn test_upsert_accounts_updates_is_latest_flag() { let component_2 = AccountComponent::new( account_component_code, component_storage_modified, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -485,7 +482,7 @@ fn test_upsert_accounts_updates_is_latest_flag() { .with_component(component_2) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -574,8 +571,7 @@ fn test_upsert_accounts_with_multiple_storage_slots() { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -585,7 +581,7 @@ fn test_upsert_accounts_with_multiple_storage_slots() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -644,8 +640,7 @@ fn test_upsert_accounts_with_empty_storage() { let component = AccountComponent::new( account_component_code, vec![], - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -655,7 +650,7 @@ fn test_upsert_accounts_with_empty_storage() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -781,8 +776,7 @@ fn test_select_latest_account_storage_multiple_slots() { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountImmutableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountImmutableCode]), ) .unwrap(); @@ -792,7 +786,7 @@ fn test_select_latest_account_storage_multiple_slots() { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -883,8 +877,11 @@ fn test_select_latest_account_storage_slot_updates() { #[test] fn test_select_account_vault_at_block_historical_with_updates() { use assert_matches::assert_matches; - use miden_protocol::asset::{AssetVaultKey, FungibleAsset}; - use miden_protocol::testing::account_id::ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET; + use miden_protocol::asset::FungibleAsset; + use miden_protocol::testing::account_id::{ + ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, + ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_1, + }; let mut conn = setup_test_db(); let (account, _) = create_test_account_with_storage(); @@ -915,13 +912,8 @@ fn test_select_account_vault_at_block_historical_with_updates() { } // Insert vault asset at block 1: vault_key_1 = 1000 tokens - let vault_key_1 = AssetVaultKey::new_unchecked(Word::from([ - Felt::new(1), - Felt::ZERO, - Felt::ZERO, - Felt::ZERO, - ])); let asset_v1 = Asset::Fungible(FungibleAsset::new(faucet_id, 1000).unwrap()); + let vault_key_1 = asset_v1.vault_key(); insert_account_vault_asset(&mut conn, account_id, block_1, vault_key_1, Some(asset_v1)) .expect("insert vault asset failed"); @@ -931,14 +923,10 @@ fn test_select_account_vault_at_block_historical_with_updates() { insert_account_vault_asset(&mut conn, account_id, block_2, vault_key_1, Some(asset_v2)) .expect("insert vault asset update failed"); - // Add a second vault_key at block 2 - let vault_key_2 = AssetVaultKey::new_unchecked(Word::from([ - Felt::new(2), - Felt::ZERO, - Felt::ZERO, - Felt::ZERO, - ])); - let asset_key2 = Asset::Fungible(FungibleAsset::new(faucet_id, 500).unwrap()); + // Add a second vault_key at block 2 (different faucet for different vault key) + let faucet_id_2 = AccountId::try_from(ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_1).unwrap(); + let asset_key2 = Asset::Fungible(FungibleAsset::new(faucet_id_2, 500).unwrap()); + let vault_key_2 = asset_key2.vault_key(); insert_account_vault_asset(&mut conn, account_id, block_2, vault_key_2, Some(asset_key2)) .expect("insert second vault asset failed"); @@ -1017,12 +1005,7 @@ fn test_select_account_vault_at_block_exponential_updates() { .expect("upsert_accounts failed"); } - let vault_key = AssetVaultKey::new_unchecked(Word::from([ - Felt::new(3), - Felt::ZERO, - Felt::ZERO, - Felt::ZERO, - ])); + let vault_key = AssetVaultKey::new_fungible(faucet_id).unwrap(); for (index, block) in blocks.iter().enumerate() { let amount = 1u64 << index; @@ -1049,7 +1032,7 @@ fn test_select_account_vault_at_block_exponential_updates() { #[test] fn test_select_account_vault_at_block_with_deletion() { use assert_matches::assert_matches; - use miden_protocol::asset::{AssetVaultKey, FungibleAsset}; + use miden_protocol::asset::FungibleAsset; use miden_protocol::testing::account_id::ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET; let mut conn = setup_test_db(); @@ -1081,13 +1064,8 @@ fn test_select_account_vault_at_block_with_deletion() { } // Insert vault asset at block 1 - let vault_key = AssetVaultKey::new_unchecked(Word::from([ - Felt::new(1), - Felt::ZERO, - Felt::ZERO, - Felt::ZERO, - ])); let asset = Asset::Fungible(FungibleAsset::new(faucet_id, 1000).unwrap()); + let vault_key = asset.vault_key(); insert_account_vault_asset(&mut conn, account_id, block_1, vault_key, Some(asset)) .expect("insert vault asset failed"); diff --git a/crates/store/src/db/models/queries/block_headers.rs b/crates/store/src/db/models/queries/block_headers.rs index bfcd34ee7a..59c4ce530b 100644 --- a/crates/store/src/db/models/queries/block_headers.rs +++ b/crates/store/src/db/models/queries/block_headers.rs @@ -15,7 +15,7 @@ use miden_crypto::Word; use miden_crypto::dsa::ecdsa_k256_keccak::Signature; use miden_node_utils::limiter::{QueryParamBlockLimit, QueryParamLimiter}; use miden_protocol::block::{BlockHeader, BlockNumber}; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use super::DatabaseError; use crate::COMPONENT; diff --git a/crates/store/src/db/models/queries/notes.rs b/crates/store/src/db/models/queries/notes.rs index 49bdce4198..cf42ceb58d 100644 --- a/crates/store/src/db/models/queries/notes.rs +++ b/crates/store/src/db/models/queries/notes.rs @@ -49,7 +49,7 @@ use miden_protocol::note::{ NoteType, Nullifier, }; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use miden_standards::note::NetworkAccountTarget; use crate::COMPONENT; diff --git a/crates/store/src/db/models/queries/nullifiers.rs b/crates/store/src/db/models/queries/nullifiers.rs index 84e89ebad5..89f62b4ab3 100644 --- a/crates/store/src/db/models/queries/nullifiers.rs +++ b/crates/store/src/db/models/queries/nullifiers.rs @@ -20,7 +20,7 @@ use miden_node_utils::limiter::{ }; use miden_protocol::block::BlockNumber; use miden_protocol::note::Nullifier; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use super::DatabaseError; use crate::COMPONENT; diff --git a/crates/store/src/db/models/queries/transactions.rs b/crates/store/src/db/models/queries/transactions.rs index 69b3986f15..79d2bdfeb0 100644 --- a/crates/store/src/db/models/queries/transactions.rs +++ b/crates/store/src/db/models/queries/transactions.rs @@ -21,7 +21,7 @@ use miden_protocol::account::AccountId; use miden_protocol::block::BlockNumber; use miden_protocol::note::NoteHeader; use miden_protocol::transaction::{InputNoteCommitment, OrderedTransactionHeaders, TransactionId}; -use miden_protocol::utils::{Deserializable, Serializable}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; use super::DatabaseError; use crate::COMPONENT; diff --git a/crates/store/src/db/models/utils.rs b/crates/store/src/db/models/utils.rs index ef74e86fac..80dc1e9197 100644 --- a/crates/store/src/db/models/utils.rs +++ b/crates/store/src/db/models/utils.rs @@ -1,6 +1,6 @@ use diesel::{Connection, RunQueryDsl, SqliteConnection}; use miden_protocol::note::Nullifier; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use crate::errors::DatabaseError; @@ -23,7 +23,7 @@ pub(crate) fn serialize_vec<'a, D: Serializable + 'a>( /// Returns the high 16 bits of the provided nullifier. pub fn get_nullifier_prefix(nullifier: &Nullifier) -> u16 { - (nullifier.most_significant_felt().as_int() >> 48) as u16 + (nullifier.most_significant_felt().as_canonical_u64() >> 48) as u16 } /// Converts a slice of length `N` to an array, returns `None` if invariant diff --git a/crates/store/src/db/tests.rs b/crates/store/src/db/tests.rs index a9f72b99a3..cf05b09910 100644 --- a/crates/store/src/db/tests.rs +++ b/crates/store/src/db/tests.rs @@ -26,7 +26,7 @@ use miden_protocol::account::{ StorageSlotDelta, StorageSlotName, }; -use miden_protocol::asset::{Asset, AssetVaultKey, FungibleAsset}; +use miden_protocol::asset::{Asset, FungibleAsset}; use miden_protocol::block::{ BlockAccountUpdate, BlockHeader, @@ -52,6 +52,9 @@ use miden_protocol::note::{ use miden_protocol::testing::account_id::{ ACCOUNT_ID_PRIVATE_SENDER, ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, + ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_1, + ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_2, + ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_3, ACCOUNT_ID_REGULAR_PUBLIC_ACCOUNT_IMMUTABLE_CODE, ACCOUNT_ID_REGULAR_PUBLIC_ACCOUNT_IMMUTABLE_CODE_2, }; @@ -63,8 +66,8 @@ use miden_protocol::transaction::{ TransactionHeader, TransactionId, }; -use miden_protocol::utils::{Deserializable, Serializable}; -use miden_protocol::{EMPTY_WORD, Felt, FieldElement, Word}; +use miden_protocol::utils::serde::{Deserializable, Serializable}; +use miden_protocol::{EMPTY_WORD, Felt, Word}; use miden_standards::account::auth::AuthSingleSig; use miden_standards::code_builder::CodeBuilder; use miden_standards::note::{NetworkAccountTarget, NoteExecutionHint, P2idNote}; @@ -476,11 +479,12 @@ fn sync_account_vault_basic_validation() { .unwrap(); } - // Create some test vault assets - let vault_key_1 = AssetVaultKey::new_unchecked(num_to_word(100)); - let vault_key_2 = AssetVaultKey::new_unchecked(num_to_word(200)); + // Create test vault assets from two different faucets to get different vault keys. + let faucet_id_2 = AccountId::try_from(ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_1).unwrap(); let fungible_asset_1 = Asset::Fungible(FungibleAsset::new(public_account_id, 1000).unwrap()); - let fungible_asset_2 = Asset::Fungible(FungibleAsset::new(public_account_id, 2000).unwrap()); + let fungible_asset_2 = Asset::Fungible(FungibleAsset::new(faucet_id_2, 2000).unwrap()); + let vault_key_1 = fungible_asset_1.vault_key(); + let vault_key_2 = fungible_asset_2.vault_key(); // Insert vault assets for the public account at different blocks queries::insert_account_vault_asset( @@ -1317,8 +1321,7 @@ fn create_account_with_code(code_str: &str, seed: [u8; 32]) -> Account { let component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test") - .with_supported_type(AccountType::RegularAccountUpdatableCode), + AccountComponentMetadata::new("test", [AccountType::RegularAccountUpdatableCode]), ) .unwrap(); @@ -1328,7 +1331,7 @@ fn create_account_with_code(code_str: &str, seed: [u8; 32]) -> Account { .with_component(component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap() @@ -1351,19 +1354,21 @@ fn mock_block_transaction(account_id: AccountId, num: u64) -> TransactionHeader NoteMetadata::new(account_id, NoteType::Public).with_tag(NoteTag::new(num as u32)), )]; + let fee = test_fee(); TransactionHeader::new_unchecked( TransactionId::new( initial_state_commitment, final_account_commitment, input_notes_commitment, output_notes_commitment, + fee, ), account_id, initial_state_commitment, final_account_commitment, input_notes, output_notes, - test_fee(), + fee, ) } @@ -1418,7 +1423,7 @@ fn mock_account_code_and_storage( let account_component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("counter_contract").with_supports_all_types(), + AccountComponentMetadata::new("counter_contract", AccountType::all()), ) .unwrap(); @@ -1429,7 +1434,7 @@ fn mock_account_code_and_storage( .with_component(account_component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap() @@ -1582,7 +1587,7 @@ async fn genesis_with_account_assets() { let account_component = AccountComponent::new( account_component_code, Vec::new(), - AccountComponentMetadata::new("foo").with_supports_all_types(), + AccountComponentMetadata::new("foo", AccountType::all()), ) .unwrap(); @@ -1596,7 +1601,7 @@ async fn genesis_with_account_assets() { .with_assets([fungible_asset.into()]) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -1641,7 +1646,7 @@ async fn genesis_with_account_storage_map() { let account_component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("foo").with_supports_all_types(), + AccountComponentMetadata::new("foo", AccountType::all()), ) .unwrap(); @@ -1651,7 +1656,7 @@ async fn genesis_with_account_storage_map() { .with_component(account_component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -1693,7 +1698,7 @@ async fn genesis_with_account_assets_and_storage() { let account_component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("foo").with_supports_all_types(), + AccountComponentMetadata::new("foo", AccountType::all()), ) .unwrap(); @@ -1704,7 +1709,7 @@ async fn genesis_with_account_assets_and_storage() { .with_assets([fungible_asset.into()]) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -1731,7 +1736,7 @@ async fn genesis_with_multiple_accounts() { let account_component1 = AccountComponent::new( account_component_code, Vec::new(), - AccountComponentMetadata::new("foo").with_supports_all_types(), + AccountComponentMetadata::new("foo", AccountType::all()), ) .unwrap(); @@ -1741,7 +1746,7 @@ async fn genesis_with_multiple_accounts() { .with_component(account_component1) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -1755,7 +1760,7 @@ async fn genesis_with_multiple_accounts() { let account_component2 = AccountComponent::new( account_component_code, Vec::new(), - AccountComponentMetadata::new("bar").with_supports_all_types(), + AccountComponentMetadata::new("bar", AccountType::all()), ) .unwrap(); @@ -1766,7 +1771,7 @@ async fn genesis_with_multiple_accounts() { .with_assets([fungible_asset.into()]) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -1785,7 +1790,7 @@ async fn genesis_with_multiple_accounts() { let account_component3 = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("baz").with_supports_all_types(), + AccountComponentMetadata::new("baz", AccountType::all()), ) .unwrap(); @@ -1795,7 +1800,7 @@ async fn genesis_with_multiple_accounts() { .with_component(account_component3) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -1885,7 +1890,13 @@ fn serialization_symmetry_core_types() { assert_eq!(nullifier, restored, "Nullifier serialization must be symmetric"); // TransactionId - let tx_id = TransactionId::new(num_to_word(1), num_to_word(2), num_to_word(3), num_to_word(4)); + let tx_id = TransactionId::new( + num_to_word(1), + num_to_word(2), + num_to_word(3), + num_to_word(4), + test_fee(), + ); let bytes = tx_id.to_bytes(); let restored = TransactionId::read_from_bytes(&bytes).unwrap(); assert_eq!(tx_id, restored, "TransactionId serialization must be symmetric"); @@ -2253,7 +2264,7 @@ fn db_roundtrip_account_storage_with_maps() { let account_component = AccountComponent::new( account_component_code, component_storage, - AccountComponentMetadata::new("test").with_supports_all_types(), + AccountComponentMetadata::new("test", AccountType::all()), ) .unwrap(); @@ -2263,7 +2274,7 @@ fn db_roundtrip_account_storage_with_maps() { .with_component(account_component) .with_auth_component(AuthSingleSig::new( PublicKeyCommitment::from(EMPTY_WORD), - AuthScheme::Falcon512Rpo, + AuthScheme::Falcon512Poseidon2, )) .build_existing() .unwrap(); @@ -2416,13 +2427,15 @@ fn test_prune_history() { .unwrap(); } - // Insert vault assets at different blocks - let vault_key_old = AssetVaultKey::new_unchecked(num_to_word(100)); - let vault_key_cutoff = AssetVaultKey::new_unchecked(num_to_word(200)); - let vault_key_recent = AssetVaultKey::new_unchecked(num_to_word(300)); + // Insert vault assets at different blocks - use different faucets for different vault keys. + let faucet_2 = AccountId::try_from(ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_1).unwrap(); + let faucet_3 = AccountId::try_from(ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_2).unwrap(); let asset_1 = Asset::Fungible(FungibleAsset::new(public_account_id, 1000).unwrap()); - let asset_2 = Asset::Fungible(FungibleAsset::new(public_account_id, 2000).unwrap()); - let asset_3 = Asset::Fungible(FungibleAsset::new(public_account_id, 3000).unwrap()); + let asset_2 = Asset::Fungible(FungibleAsset::new(faucet_2, 2000).unwrap()); + let asset_3 = Asset::Fungible(FungibleAsset::new(faucet_3, 3000).unwrap()); + let vault_key_old = asset_1.vault_key(); + let vault_key_cutoff = asset_2.vault_key(); + let vault_key_recent = asset_3.vault_key(); // Old entry at block_old (should be deleted when cutoff is at block_cutoff for // chain_tip=block_tip) @@ -2608,8 +2621,9 @@ fn test_prune_history() { // Test that is_latest=true entries are never deleted, even if old // Insert an old entry marked as latest - let vault_key_old_latest = AssetVaultKey::new_unchecked(num_to_word(999)); - let asset_old = Asset::Fungible(FungibleAsset::new(public_account_id, 9999).unwrap()); + let faucet_4 = AccountId::try_from(ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET_3).unwrap(); + let asset_old = Asset::Fungible(FungibleAsset::new(faucet_4, 9999).unwrap()); + let vault_key_old_latest = asset_old.vault_key(); queries::insert_account_vault_asset( conn, public_account_id, @@ -2960,8 +2974,10 @@ fn account_state_forest_shared_roots_not_deleted_prematurely() { forest.update_account(block53, &delta1_update).unwrap(); // Prune at block 53 + // cutoff = 53 - 50 = 3: each of the 3 lineages has one version < 3 that gets removed + // (account1 v=1, account2 v=2, account3 v=2), since each also has a newer version. let total_roots_removed = forest.prune(block53); - assert_eq!(total_roots_removed, 0); + assert_eq!(total_roots_removed, 3); // Account2 and Account3 should still be accessible at their recent blocks let account1_root = forest.get_storage_map_root(account1, &slot_name, block53).unwrap(); @@ -3081,9 +3097,11 @@ fn account_state_forest_retains_latest_after_100_blocks_and_pruning() { forest.update_account(block_51, &delta_51).unwrap(); // Prune again at block 100 + // cutoff = 50: both vault and storage lineages have v=1 (< 50) and v=51, so v=1 is pruned + // from each lineage, totaling 2 version entries removed. let total_roots_removed = forest.prune(block_100); - assert_eq!(total_roots_removed, 0); + assert_eq!(total_roots_removed, 2); let vault_root_at_51 = forest .get_vault_root(account_id, block_51) @@ -3105,8 +3123,9 @@ fn account_state_forest_retains_latest_after_100_blocks_and_pruning() { "Witness must verify against storage root" ); + // After pruning, the v=1 entry was removed so querying at block_1 returns None. let vault_root_at_1 = forest.get_vault_root(account_id, block_1); - assert!(vault_root_at_1.is_some()); + assert!(vault_root_at_1.is_none(), "Block 1 vault entry was pruned"); } #[test] @@ -3152,11 +3171,7 @@ fn account_state_forest_preserves_most_recent_vault_only() { // Verify we can get witnesses for the vault and verify against vault root let witnesses = forest - .get_vault_asset_witnesses( - account_id, - block_1, - [AssetVaultKey::new_unchecked(asset.vault_key().into())].into(), - ) + .get_vault_asset_witnesses(account_id, block_1, [asset.vault_key()].into()) .expect("Should be able to get vault witness after pruning"); assert_eq!(witnesses.len(), 1, "Should have one witness"); @@ -3416,10 +3431,10 @@ fn account_state_forest_preserves_mixed_slots_independently() { // Vault: block 1 is most recent, should NOT be pruned // Map A: block 1 is old (block 51 is newer), SHOULD be pruned // Map B: block 1 is most recent, should NOT be pruned - assert_eq!( - total_roots_removed, 0, - "Vault root from block 1 should NOT be pruned (most recent)" - ); + // Vault: block 1 is the only version, kept (all versions before cutoff case). + // Map A: has v=1 and v=51; v=1 < cutoff=50, so 1 version entry removed. + // Map B: block 1 is the only version, kept. + assert_eq!(total_roots_removed, 1, "Only map_a's block 1 version entry should be pruned"); // Verify vault is still accessible let vault_root_at_1 = @@ -3444,7 +3459,7 @@ fn account_state_forest_preserves_mixed_slots_independently() { "Map B should still be from block 1 (most recent)" ); - // Verify map_a block 1 is no longer accessible + // Verify map_a block 1 is no longer accessible (it was pruned) let map_a_root_at_1 = forest.get_storage_map_root(account_id, &slot_map_a, block_1); - assert!(map_a_root_at_1.is_some(), "Map A block 1 should be pruned"); + assert!(map_a_root_at_1.is_none(), "Map A block 1 should be pruned"); } diff --git a/crates/store/src/genesis/config/errors.rs b/crates/store/src/genesis/config/errors.rs index 3ea497d547..3a9721c8b4 100644 --- a/crates/store/src/genesis/config/errors.rs +++ b/crates/store/src/genesis/config/errors.rs @@ -8,7 +8,7 @@ use miden_protocol::errors::{ FeeError, TokenSymbolError, }; -use miden_protocol::utils::DeserializationError; +use miden_protocol::utils::serde::DeserializationError; use miden_standards::account::faucets::FungibleFaucetError; use miden_standards::account::wallets::BasicWalletError; diff --git a/crates/store/src/genesis/config/mod.rs b/crates/store/src/genesis/config/mod.rs index f2cfe40b8f..93b137ea81 100644 --- a/crates/store/src/genesis/config/mod.rs +++ b/crates/store/src/genesis/config/mod.rs @@ -23,9 +23,9 @@ use miden_protocol::account::{ }; use miden_protocol::asset::{FungibleAsset, TokenSymbol}; use miden_protocol::block::FeeParameters; -use miden_protocol::crypto::dsa::falcon512_rpo::SecretKey as RpoSecretKey; +use miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey as RpoSecretKey; use miden_protocol::errors::TokenSymbolError; -use miden_protocol::{Felt, FieldElement, ONE}; +use miden_protocol::{Felt, ONE}; use miden_standards::AuthMethod; use miden_standards::account::auth::AuthSingleSig; use miden_standards::account::faucets::{BasicFungibleFaucet, TokenMetadata}; @@ -222,7 +222,7 @@ impl GenesisConfig { let mut rng = ChaCha20Rng::from_seed(rand::random()); let secret_key = RpoSecretKey::with_rng(&mut get_rpo_random_coin(&mut rng)); let auth = AuthMethod::SingleSig { - approver: (secret_key.public_key().into(), AuthScheme::Falcon512Rpo), + approver: (secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2), }; let init_seed: [u8; 32] = rng.random(); @@ -311,7 +311,7 @@ impl GenesisConfig { // sanity check the total issuance against let basic = BasicFungibleFaucet::try_from(&faucet_account)?; - let max_supply = basic.max_supply().inner(); + let max_supply = basic.max_supply().as_canonical_u64(); if max_supply < total_issuance { return Err(GenesisConfigError::MaxIssuanceExceeded { max_supply, @@ -431,7 +431,8 @@ impl FungibleFaucetConfig { } = self; let mut rng = ChaCha20Rng::from_seed(rand::random()); let secret_key = RpoSecretKey::with_rng(&mut get_rpo_random_coin(&mut rng)); - let auth = AuthSingleSig::new(secret_key.public_key().into(), AuthScheme::Falcon512Rpo); + let auth = + AuthSingleSig::new(secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2); let init_seed: [u8; 32] = rng.random(); let max_supply = Felt::try_from(max_supply) @@ -535,8 +536,10 @@ impl AccountSecrets { let account = account_lut .get(&account_id) .ok_or(GenesisConfigError::MissingGenesisAccount { account_id })?; - let account_file = - AccountFile::new(account.clone(), vec![AuthSecretKey::Falcon512Rpo(secret_key)]); + let account_file = AccountFile::new( + account.clone(), + vec![AuthSecretKey::Falcon512Poseidon2(secret_key)], + ); Ok(AccountFileWithName { name, account_file }) }) } diff --git a/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_eth.mac b/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_eth.mac index b76116b574..5e4c51cdfc 100644 Binary files a/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_eth.mac and b/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_eth.mac differ diff --git a/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_usdc.mac b/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_usdc.mac index 8e0c2650be..263adbaae0 100644 Binary files a/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_usdc.mac and b/crates/store/src/genesis/config/samples/02-with-account-files/agglayer_faucet_usdc.mac differ diff --git a/crates/store/src/genesis/config/samples/02-with-account-files/bridge.mac b/crates/store/src/genesis/config/samples/02-with-account-files/bridge.mac index 9bab86857e..d32bc796a6 100644 Binary files a/crates/store/src/genesis/config/samples/02-with-account-files/bridge.mac and b/crates/store/src/genesis/config/samples/02-with-account-files/bridge.mac differ diff --git a/crates/store/src/genesis/config/tests.rs b/crates/store/src/genesis/config/tests.rs index 0e02125cbf..2b27f3726f 100644 --- a/crates/store/src/genesis/config/tests.rs +++ b/crates/store/src/genesis/config/tests.rs @@ -96,11 +96,11 @@ fn parsing_account_from_file() -> TestResult { // Create a test wallet account and save it to a .mac file let init_seed: [u8; 32] = rand::random(); let mut rng = rand_chacha::ChaCha20Rng::from_seed(rand::random()); - let secret_key = miden_protocol::crypto::dsa::falcon512_rpo::SecretKey::with_rng( + let secret_key = miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey::with_rng( &mut miden_node_utils::crypto::get_rpo_random_coin(&mut rng), ); let auth = AuthMethod::SingleSig { - approver: (secret_key.public_key().into(), AuthScheme::Falcon512Rpo), + approver: (secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2), }; let test_account = create_basic_wallet( @@ -154,10 +154,10 @@ fn parsing_native_faucet_from_file() -> TestResult { // Create a faucet account and save it to a .mac file let init_seed: [u8; 32] = rand::random(); let mut rng = rand_chacha::ChaCha20Rng::from_seed(rand::random()); - let secret_key = miden_protocol::crypto::dsa::falcon512_rpo::SecretKey::with_rng( + let secret_key = miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey::with_rng( &mut miden_node_utils::crypto::get_rpo_random_coin(&mut rng), ); - let auth = AuthSingleSig::new(secret_key.public_key().into(), AuthScheme::Falcon512Rpo); + let auth = AuthSingleSig::new(secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2); let faucet_component = BasicFungibleFaucet::new(TokenSymbol::new("MIDEN").unwrap(), 6, Felt::new(1_000_000_000))?; @@ -216,11 +216,11 @@ fn native_faucet_from_file_must_be_faucet_type() -> TestResult { // Create a regular wallet account (not a faucet) and try to use it as native faucet let init_seed: [u8; 32] = rand::random(); let mut rng = rand_chacha::ChaCha20Rng::from_seed(rand::random()); - let secret_key = miden_protocol::crypto::dsa::falcon512_rpo::SecretKey::with_rng( + let secret_key = miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey::with_rng( &mut miden_node_utils::crypto::get_rpo_random_coin(&mut rng), ); let auth = AuthMethod::SingleSig { - approver: (secret_key.public_key().into(), AuthScheme::Falcon512Rpo), + approver: (secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2), }; let regular_account = create_basic_wallet( diff --git a/crates/store/src/genesis/mod.rs b/crates/store/src/genesis/mod.rs index eb101e1d48..6c4624fb00 100644 --- a/crates/store/src/genesis/mod.rs +++ b/crates/store/src/genesis/mod.rs @@ -2,7 +2,7 @@ use miden_node_utils::signer::BlockSigner; use miden_protocol::Word; use miden_protocol::account::delta::AccountUpdateDetails; use miden_protocol::account::{Account, AccountDelta}; -use miden_protocol::block::account_tree::{AccountTree, account_id_to_smt_key}; +use miden_protocol::block::account_tree::{AccountIdKey, AccountTree}; use miden_protocol::block::{ BlockAccountUpdate, BlockBody, @@ -110,7 +110,10 @@ impl GenesisState { // Convert account updates to SMT entries using account_id_to_smt_key let smt_entries = accounts.iter().map(|update| { - (account_id_to_smt_key(update.account_id()), update.final_state_commitment()) + ( + AccountIdKey::from(update.account_id()).as_word(), + update.final_state_commitment(), + ) }); // Create LargeSmt with MemoryStorage diff --git a/crates/store/src/server/api.rs b/crates/store/src/server/api.rs index 56bfcafb49..25ac5537ae 100644 --- a/crates/store/src/server/api.rs +++ b/crates/store/src/server/api.rs @@ -42,8 +42,8 @@ impl StoreApi { Ok(Response::new(proto::rpc::BlockHeaderByNumberResponse { block_header: block_header.map(Into::into), - chain_length: mmr_proof.as_ref().map(|p| p.forest.num_leaves() as u32), - mmr_path: mmr_proof.map(|p| Into::into(&p.merkle_path)), + chain_length: mmr_proof.as_ref().map(|p| p.forest().num_leaves() as u32), + mmr_path: mmr_proof.map(|p| Into::into(p.merkle_path())), })) } diff --git a/crates/store/src/server/block_producer.rs b/crates/store/src/server/block_producer.rs index 25f6b05f60..92b3652cd8 100644 --- a/crates/store/src/server/block_producer.rs +++ b/crates/store/src/server/block_producer.rs @@ -11,7 +11,7 @@ use miden_node_utils::tracing::OpenTelemetrySpanExt; use miden_protocol::Word; use miden_protocol::batch::OrderedBatches; use miden_protocol::block::{BlockBody, BlockHeader, BlockNumber, SignedBlock}; -use miden_protocol::utils::Deserializable; +use miden_protocol::utils::serde::Deserializable; use tonic::{Request, Response, Status}; use tracing::Instrument; diff --git a/crates/store/src/server/ntx_builder.rs b/crates/store/src/server/ntx_builder.rs index f6e8d4a7a5..4c6251d131 100644 --- a/crates/store/src/server/ntx_builder.rs +++ b/crates/store/src/server/ntx_builder.rs @@ -3,6 +3,7 @@ use std::num::{NonZero, TryFromIntError}; use miden_crypto::merkle::smt::SmtProof; use miden_node_proto::domain::account::AccountInfo; +use miden_node_proto::errors::ConversionError; use miden_node_proto::generated as proto; use miden_node_proto::generated::rpc::BlockRange; use miden_node_proto::generated::store::ntx_builder_server; @@ -216,7 +217,11 @@ impl ntx_builder_server::NtxBuilder for StoreApi { .map(|key_digest| { let word = read_root::(Some(key_digest), "VaultKey") .map_err(invalid_argument)?; - Ok(AssetVaultKey::new_unchecked(word)) + AssetVaultKey::try_from(word).map_err(|e| { + invalid_argument(GetWitnessesError::DeserializationFailed( + ConversionError::from(e), + )) + }) }) .collect::, Status>>()?; diff --git a/crates/store/src/server/rpc_api.rs b/crates/store/src/server/rpc_api.rs index a12fcafae7..2e70876826 100644 --- a/crates/store/src/server/rpc_api.rs +++ b/crates/store/src/server/rpc_api.rs @@ -148,7 +148,7 @@ impl rpc_server::Rpc for StoreApi { block_num: last_block_included.as_u32(), }), block_header: Some(state.block_header.into()), - mmr_path: Some(mmr_proof.merkle_path.into()), + mmr_path: Some(mmr_proof.merkle_path().clone().into()), notes, })) } diff --git a/crates/store/src/state/apply_block.rs b/crates/store/src/state/apply_block.rs index 7949fcbeb6..43d3d406a5 100644 --- a/crates/store/src/state/apply_block.rs +++ b/crates/store/src/state/apply_block.rs @@ -5,7 +5,7 @@ use miden_protocol::account::delta::AccountUpdateDetails; use miden_protocol::block::SignedBlock; use miden_protocol::note::NoteDetails; use miden_protocol::transaction::OutputNote; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use tokio::sync::oneshot; use tracing::{Instrument, info, info_span, instrument}; @@ -179,15 +179,10 @@ impl State { .output_notes() .map(|(note_index, note)| { let (details, nullifier) = match note { - OutputNote::Full(note) => { - (Some(NoteDetails::from(note)), Some(note.nullifier())) - }, - OutputNote::Header(_) => (None, None), - note @ OutputNote::Partial(_) => { - return Err(InvalidBlockError::InvalidOutputNoteType(Box::new( - note.clone(), - ))); + OutputNote::Public(note) => { + (Some(NoteDetails::from(note.as_note())), Some(note.as_note().nullifier())) }, + OutputNote::Private(_) => (None, None), }; let inclusion_path = note_tree.open(note_index); @@ -196,7 +191,7 @@ impl State { block_num, note_index, note_id: note.id().as_word(), - note_commitment: note.commitment(), + note_commitment: note.to_commitment(), metadata: note.metadata().clone(), details, inclusion_path, diff --git a/crates/store/src/state/loader.rs b/crates/store/src/state/loader.rs index 20ef9cdc04..f209eb8282 100644 --- a/crates/store/src/state/loader.rs +++ b/crates/store/src/state/loader.rs @@ -16,13 +16,13 @@ use miden_crypto::merkle::mmr::Mmr; #[cfg(feature = "rocksdb")] use miden_large_smt_backend_rocksdb::RocksDbStorage; use miden_node_utils::clap::RocksDbOptions; -use miden_protocol::block::account_tree::{AccountTree, account_id_to_smt_key}; +use miden_protocol::block::account_tree::{AccountIdKey, AccountTree}; use miden_protocol::block::nullifier_tree::NullifierTree; use miden_protocol::block::{BlockNumber, Blockchain}; #[cfg(not(feature = "rocksdb"))] use miden_protocol::crypto::merkle::smt::MemoryStorage; use miden_protocol::crypto::merkle::smt::{LargeSmt, LargeSmtError, SmtStorage}; -use miden_protocol::{Felt, FieldElement, Word}; +use miden_protocol::{Felt, Word}; #[cfg(feature = "rocksdb")] use tracing::info; use tracing::instrument; @@ -76,6 +76,14 @@ pub fn account_tree_large_smt_error_to_init_error(e: LargeSmtError) -> StateInit LargeSmtError::Storage(err) => { StateInitializationError::AccountTreeIoError(err.as_report()) }, + LargeSmtError::RootMismatch { expected, actual } => { + StateInitializationError::AccountTreeIoError(format!( + "root mismatch: expected {expected:?}, got {actual:?}" + )) + }, + LargeSmtError::StorageNotEmpty => { + StateInitializationError::AccountTreeIoError("storage is not empty".to_string()) + }, } } @@ -158,7 +166,7 @@ impl StorageLoader for MemoryStorage { let entries = page .commitments .into_iter() - .map(|(id, commitment)| (account_id_to_smt_key(id), commitment)); + .map(|(id, commitment)| (AccountIdKey::from(id).as_word(), commitment)); let mutations = smt .compute_mutations(entries) @@ -268,7 +276,7 @@ impl StorageLoader for RocksDbStorage { let entries = page .commitments .into_iter() - .map(|(id, commitment)| (account_id_to_smt_key(id), commitment)); + .map(|(id, commitment)| (AccountIdKey::from(id).as_word(), commitment)); let mutations = smt .compute_mutations(entries) @@ -338,7 +346,7 @@ impl StorageLoader for RocksDbStorage { /// Loads an SMT from persistent storage. #[cfg(feature = "rocksdb")] pub fn load_smt(storage: S) -> Result, StateInitializationError> { - LargeSmt::new(storage).map_err(account_tree_large_smt_error_to_init_error) + LargeSmt::load(storage).map_err(account_tree_large_smt_error_to_init_error) } // TREE LOADING FUNCTIONS diff --git a/crates/validator/src/db/mod.rs b/crates/validator/src/db/mod.rs index 4c8fe665be..70fa432b3b 100644 --- a/crates/validator/src/db/mod.rs +++ b/crates/validator/src/db/mod.rs @@ -9,7 +9,7 @@ use diesel::dsl::exists; use diesel::prelude::*; use miden_node_db::{DatabaseError, Db}; use miden_protocol::transaction::TransactionId; -use miden_protocol::utils::Serializable; +use miden_protocol::utils::serde::Serializable; use tracing::instrument; use crate::COMPONENT; diff --git a/crates/validator/src/db/models.rs b/crates/validator/src/db/models.rs index cb41197b77..0b1e1825c5 100644 --- a/crates/validator/src/db/models.rs +++ b/crates/validator/src/db/models.rs @@ -1,6 +1,6 @@ use diesel::prelude::*; use miden_node_db::SqlTypeConvert; -use miden_tx::utils::Serializable; +use miden_tx::utils::serde::Serializable; use crate::db::schema; use crate::tx_validation::ValidatedTransaction; diff --git a/crates/validator/src/server/mod.rs b/crates/validator/src/server/mod.rs index 6bb79c614a..564e8b89dd 100644 --- a/crates/validator/src/server/mod.rs +++ b/crates/validator/src/server/mod.rs @@ -14,7 +14,7 @@ use miden_node_utils::tracing::OpenTelemetrySpanExt; use miden_node_utils::tracing::grpc::grpc_trace_fn; use miden_protocol::block::ProposedBlock; use miden_protocol::transaction::{ProvenTransaction, TransactionInputs}; -use miden_tx::utils::{Deserializable, Serializable}; +use miden_tx::utils::serde::{Deserializable, Serializable}; use tokio::net::TcpListener; use tokio_stream::wrappers::TcpListenerStream; use tonic::Status; diff --git a/crates/validator/src/signers/kms.rs b/crates/validator/src/signers/kms.rs index d6bd285679..e84576ac1e 100644 --- a/crates/validator/src/signers/kms.rs +++ b/crates/validator/src/signers/kms.rs @@ -5,7 +5,7 @@ use miden_node_utils::signer::BlockSigner; use miden_protocol::block::BlockHeader; use miden_protocol::crypto::dsa::ecdsa_k256_keccak::{PublicKey, Signature}; use miden_protocol::crypto::hash::keccak::Keccak256; -use miden_tx::utils::{DeserializationError, Serializable}; +use miden_protocol::utils::serde::{DeserializationError, Serializable}; // KMS SIGNER ERROR // ================================================================================================ diff --git a/crates/validator/src/tx_validation/validated_tx.rs b/crates/validator/src/tx_validation/validated_tx.rs index 0233c7e8f3..301ac2be28 100644 --- a/crates/validator/src/tx_validation/validated_tx.rs +++ b/crates/validator/src/tx_validation/validated_tx.rs @@ -6,7 +6,7 @@ use miden_protocol::transaction::{ ExecutedTransaction, InputNote, InputNotes, - OutputNotes, + RawOutputNotes, TransactionId, }; @@ -49,7 +49,7 @@ impl ValidatedTransaction { } /// Returns the notes created in this transaction. - pub fn output_notes(&self) -> &OutputNotes { + pub fn output_notes(&self) -> &RawOutputNotes { self.0.output_notes() } diff --git a/proto/proto/types/primitives.proto b/proto/proto/types/primitives.proto index 3c8d279b02..a0c30b812a 100644 --- a/proto/proto/types/primitives.proto +++ b/proto/proto/types/primitives.proto @@ -5,8 +5,10 @@ package primitives; // ================================================================================================ message Asset { - // Asset represented as a word. - primitives.Digest asset = 1; + // Asset vault key represented as a word. + primitives.Digest key = 1; + // Asset value represented as a word. + primitives.Digest value = 2; } // SMT (Sparse Merkle Tree)