diff --git a/Cargo.lock b/Cargo.lock index 1e58c0cc..b637399e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,7 +73,7 @@ dependencies = [ "bitflags 2.10.0", "bytes", "bytestring", - "derive_more 2.1.1", + "derive_more 2.1.0", "encoding_rs", "foldhash", "futures-core", @@ -102,7 +102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -215,7 +215,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -226,7 +226,7 @@ checksum = "b6ac1e58cded18cb28ddc17143c4dea5345b3ad575e14f32f66e4054a56eb271" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -270,7 +270,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.17", + "getrandom 0.2.16", "once_cell", "version_check", ] @@ -447,7 +447,7 @@ checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -545,7 +545,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -571,7 +571,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -717,7 +717,7 @@ checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -801,7 +801,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -812,7 +812,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -855,7 +855,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "tokio", - "tower 0.5.3", + "tower 0.5.2", "tower-layer", "tower-service", "tracing", @@ -918,9 +918,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.3" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" +checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" [[package]] name = "bedrock_client" @@ -961,7 +961,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1066,7 +1066,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1101,7 +1101,7 @@ checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1172,9 +1172,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.52" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ "find-msvc-tools", "jobserver", @@ -1217,7 +1217,7 @@ checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1233,9 +1233,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.43" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ "iana-time-zone", "js-sys", @@ -1268,9 +1268,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.54" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" dependencies = [ "clap_builder", "clap_derive", @@ -1278,9 +1278,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.54" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" dependencies = [ "anstream", "anstyle", @@ -1297,14 +1297,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "clap_lex" -version = "0.7.7" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cobs" @@ -1545,7 +1545,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1579,7 +1579,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1593,7 +1593,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1604,7 +1604,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1615,7 +1615,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1633,15 +1633,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.10.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "data-encoding-macro" -version = "0.1.19" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8142a83c17aa9461d637e649271eae18bf2edd00e91f2e105df36c3c16355bdb" +checksum = "47ce6c96ea0102f01122a185683611bd5ac8d99e62bc59dd12e6bda344ee673d" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1649,12 +1649,12 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.17" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab67060fc6b8ef687992d439ca0fa36e7ed17e9a0b16b25b601e8757df720de" +checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1707,7 +1707,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1717,7 +1717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1730,29 +1730,29 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "derive_more" -version = "2.1.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" dependencies = [ "convert_case 0.10.0", "proc-macro2", "quote", "rustc_version", - "syn 2.0.114", + "syn 2.0.111", "unicode-xid", ] @@ -1797,7 +1797,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1878,7 +1878,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -1958,7 +1958,7 @@ checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -2031,9 +2031,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "find-msvc-tools" -version = "0.1.7" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fnv" @@ -2074,7 +2074,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -2164,7 +2164,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -2231,9 +2231,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.17" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "js-sys", @@ -2361,7 +2361,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.13.0", + "indexmap 2.12.1", "slab", "tokio", "tokio-util", @@ -2380,7 +2380,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.4.0", - "indexmap 2.13.0", + "indexmap 2.12.1", "slab", "tokio", "tokio-util", @@ -2848,9 +2848,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.13.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -2914,9 +2914,9 @@ checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "iri-string" -version = "0.7.10" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" dependencies = [ "memchr", "serde", @@ -2968,9 +2968,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.17" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jf-crhf" @@ -3031,9 +3031,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.85" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ "once_cell", "wasm-bindgen", @@ -3105,7 +3105,7 @@ dependencies = [ "thiserror 2.0.17", "tokio", "tokio-stream", - "tower 0.5.3", + "tower 0.5.2", "tracing", "wasm-bindgen-futures", ] @@ -3129,7 +3129,7 @@ dependencies = [ "serde_json", "thiserror 2.0.17", "tokio", - "tower 0.5.3", + "tower 0.5.2", "url", ] @@ -3143,7 +3143,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -3169,7 +3169,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "tower 0.5.3", + "tower 0.5.2", "tracing", ] @@ -3194,7 +3194,7 @@ dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-types", - "tower 0.5.3", + "tower 0.5.2", ] [[package]] @@ -3207,7 +3207,7 @@ dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-types", - "tower 0.5.3", + "tower 0.5.2", "url", ] @@ -3264,9 +3264,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lazy-regex" -version = "3.5.1" +version = "3.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5c13b6857ade4c8ee05c3c3dc97d2ab5415d691213825b90d3211c425c1f907" +checksum = "191898e17ddee19e60bccb3945aa02339e81edd4a8c50e21fd4d48cdecda7b29" dependencies = [ "lazy-regex-proc_macros", "once_cell", @@ -3275,14 +3275,14 @@ dependencies = [ [[package]] name = "lazy-regex-proc_macros" -version = "3.5.1" +version = "3.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a95c68db5d41694cea563c86a4ba4dc02141c16ef64814108cb23def4d5438" +checksum = "c35dc8b0da83d1a9507e12122c80dea71a9c7c613014347392483a83ea593e04" dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -3296,9 +3296,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.180" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libloading" @@ -3332,9 +3332,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.12" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" dependencies = [ "bitflags 2.10.0", "libc", @@ -3678,7 +3678,7 @@ source = "git+https://github.com/logos-blockchain/logos-blockchain.git#451df112f dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -3914,13 +3914,13 @@ dependencies = [ [[package]] name = "match-lookup" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "757aee279b8bdbb9f9e676796fd459e4207a1f986e87886700abf589f5abf771" +checksum = "1265724d8cb29dbbc2b0f06fffb8bf1a8c0cf73a78eede9ba73a4a66c52a981e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 1.0.109", ] [[package]] @@ -3937,7 +3937,7 @@ checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4241,7 +4241,7 @@ checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4294,7 +4294,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4329,7 +4329,7 @@ checksum = "969ccca8ffc4fb105bd131a228107d5c9dd89d9d627edf3295cbe979156f9712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4362,7 +4362,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4426,7 +4426,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4482,9 +4482,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "postcard" @@ -4550,14 +4550,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "proc-macro2" -version = "1.0.105" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -4570,7 +4570,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", "version_check", ] @@ -4635,7 +4635,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4710,9 +4710,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.43" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -4741,7 +4741,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.5", + "rand_core 0.9.3", ] [[package]] @@ -4761,7 +4761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.5", + "rand_core 0.9.3", ] [[package]] @@ -4770,14 +4770,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.17", + "getrandom 0.2.16", ] [[package]] name = "rand_core" -version = "0.9.5" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom 0.3.4", ] @@ -4788,7 +4788,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" dependencies = [ - "rand_core 0.9.5", + "rand_core 0.9.3", ] [[package]] @@ -4815,7 +4815,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ - "getrandom 0.2.17", + "getrandom 0.2.16", "libredox", "thiserror 2.0.17", ] @@ -4837,7 +4837,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -4877,9 +4877,9 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" -version = "0.12.28" +version = "0.12.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" dependencies = [ "base64", "bytes", @@ -4912,7 +4912,7 @@ dependencies = [ "tokio-native-tls", "tokio-rustls", "tokio-util", - "tower 0.5.3", + "tower 0.5.2", "tower-http", "tower-service", "url", @@ -4941,7 +4941,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.17", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -4956,7 +4956,7 @@ dependencies = [ "anyhow", "borsh", "bytemuck", - "derive_more 2.1.1", + "derive_more 2.1.0", "elf", "lazy_static", "postcard", @@ -5033,7 +5033,7 @@ dependencies = [ "anyhow", "bit-vec", "bytemuck", - "derive_more 2.1.1", + "derive_more 2.1.0", "paste", "risc0-binfmt", "risc0-core", @@ -5049,7 +5049,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80f2723fedace48c6c5a505bd8f97ac4e1712bc4cb769083e10536d862b66987" dependencies = [ "bytemuck", - "rand_core 0.9.5", + "rand_core 0.9.3", ] [[package]] @@ -5100,7 +5100,7 @@ dependencies = [ "hex-literal 0.4.1", "metal", "paste", - "rand_core 0.9.5", + "rand_core 0.9.3", "risc0-core", "risc0-zkvm-platform", "serde", @@ -5121,7 +5121,7 @@ dependencies = [ "borsh", "bytemuck", "bytes", - "derive_more 2.1.1", + "derive_more 2.1.0", "hex", "lazy-regex", "prost", @@ -5153,7 +5153,7 @@ checksum = "cfaa10feba15828c788837ddde84b994393936d8f5715228627cfe8625122a40" dependencies = [ "bytemuck", "cfg-if", - "getrandom 0.2.17", + "getrandom 0.2.16", "getrandom 0.3.4", "libm", "num_enum", @@ -5218,9 +5218,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.10" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88" dependencies = [ "const-oid", "digest", @@ -5238,9 +5238,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.17.2" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" +checksum = "a68df0380e5c9d20ce49534f292a36a7514ae21350726efe1865bdb1fa91d278" dependencies = [ "borsh", "proptest", @@ -5275,9 +5275,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags 2.10.0", "errno", @@ -5288,9 +5288,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.36" +version = "0.23.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" dependencies = [ "log", "once_cell", @@ -5369,9 +5369,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.22" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "rzup" @@ -5444,7 +5444,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -5642,7 +5642,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -5653,20 +5653,20 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "serde_json" -version = "1.0.149" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", + "ryu", "serde", "serde_core", - "zmij", ] [[package]] @@ -5711,7 +5711,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.13.0", + "indexmap 2.12.1", "schemars 0.9.0", "schemars 1.2.0", "serde_core", @@ -5729,7 +5729,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -5772,11 +5772,10 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.8" +version = "1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" dependencies = [ - "errno", "libc", ] @@ -5890,7 +5889,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -5911,6 +5910,7 @@ version = "0.1.0" dependencies = [ "borsh", "common", + "nssa", "rocksdb", "thiserror 2.0.17", ] @@ -5939,7 +5939,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -5961,9 +5961,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.114" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -5987,25 +5987,25 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "system-configuration" -version = "0.6.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 2.10.0", + "bitflags 1.3.2", "core-foundation 0.9.4", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ "core-foundation-sys", "libc", @@ -6013,9 +6013,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.24.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", "getrandom 0.3.4", @@ -6051,7 +6051,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -6062,7 +6062,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", "test-case-core", ] @@ -6107,7 +6107,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -6118,35 +6118,35 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "time" -version = "0.3.45" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde_core", + "serde", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.7" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" -version = "0.2.25" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", @@ -6188,9 +6188,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.49.0" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ "bytes", "libc", @@ -6211,7 +6211,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -6294,9 +6294,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.5+spec-1.1.0" +version = "0.7.4+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +checksum = "fe3cea6b2aa3b910092f6abd4053ea464fab5f9c170ba5e9a6aead16ec4af2b6" dependencies = [ "serde_core", ] @@ -6307,7 +6307,7 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.13.0", + "indexmap 2.12.1", "serde", "serde_spanned", "toml_datetime 0.6.11", @@ -6321,17 +6321,17 @@ version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ - "indexmap 2.13.0", - "toml_datetime 0.7.5+spec-1.1.0", + "indexmap 2.12.1", + "toml_datetime 0.7.4+spec-1.0.0", "toml_parser", "winnow", ] [[package]] name = "toml_parser" -version = "1.0.6+spec-1.1.0" +version = "1.0.5+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +checksum = "4c03bee5ce3696f31250db0bbaff18bc43301ce0e8db2ed1f07cbb2acf89984c" dependencies = [ "winnow", ] @@ -6355,9 +6355,9 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", @@ -6382,7 +6382,7 @@ dependencies = [ "http-body", "iri-string", "pin-project-lite", - "tower 0.5.3", + "tower 0.5.2", "tower-layer", "tower-service", ] @@ -6417,9 +6417,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.44" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" dependencies = [ "log", "pin-project-lite", @@ -6435,14 +6435,14 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] name = "tracing-core" -version = "0.1.36" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", "valuable", @@ -6554,15 +6554,14 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.8" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", "percent-encoding", "serde", - "serde_derive", ] [[package]] @@ -6662,9 +6661,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.108" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", @@ -6675,12 +6674,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.58" +version = "0.4.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" dependencies = [ "cfg-if", - "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -6689,9 +6687,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.108" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6699,22 +6697,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.108" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.108" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" dependencies = [ "unicode-ident", ] @@ -6734,9 +6732,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.85" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" dependencies = [ "js-sys", "wasm-bindgen", @@ -6772,9 +6770,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "1.0.5" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" dependencies = [ "rustls-pki-types", ] @@ -6831,7 +6829,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -6842,7 +6840,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -7165,28 +7163,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -7206,7 +7204,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", "synstructure", ] @@ -7221,13 +7219,13 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.4.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] [[package]] @@ -7260,11 +7258,5 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.111", ] - -[[package]] -name = "zmij" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" diff --git a/artifacts/program_methods/amm.bin b/artifacts/program_methods/amm.bin index 179e4c95..01efd324 100644 Binary files a/artifacts/program_methods/amm.bin and b/artifacts/program_methods/amm.bin differ diff --git a/artifacts/program_methods/authenticated_transfer.bin b/artifacts/program_methods/authenticated_transfer.bin index 30d95408..14176e55 100644 Binary files a/artifacts/program_methods/authenticated_transfer.bin and b/artifacts/program_methods/authenticated_transfer.bin differ diff --git a/artifacts/program_methods/pinata.bin b/artifacts/program_methods/pinata.bin index 06235363..20d22bc7 100644 Binary files a/artifacts/program_methods/pinata.bin and b/artifacts/program_methods/pinata.bin differ diff --git a/artifacts/program_methods/pinata_token.bin b/artifacts/program_methods/pinata_token.bin index b07f307d..8ba4f1dd 100644 Binary files a/artifacts/program_methods/pinata_token.bin and b/artifacts/program_methods/pinata_token.bin differ diff --git a/artifacts/program_methods/privacy_preserving_circuit.bin b/artifacts/program_methods/privacy_preserving_circuit.bin index 57284dfd..b937d66f 100644 Binary files a/artifacts/program_methods/privacy_preserving_circuit.bin and b/artifacts/program_methods/privacy_preserving_circuit.bin differ diff --git a/artifacts/program_methods/token.bin b/artifacts/program_methods/token.bin index 2cac2345..2e5fca77 100644 Binary files a/artifacts/program_methods/token.bin and b/artifacts/program_methods/token.bin differ diff --git a/artifacts/test_program_methods/burner.bin b/artifacts/test_program_methods/burner.bin index 2d76aa4f..8b739241 100644 Binary files a/artifacts/test_program_methods/burner.bin and b/artifacts/test_program_methods/burner.bin differ diff --git a/artifacts/test_program_methods/chain_caller.bin b/artifacts/test_program_methods/chain_caller.bin index 97323125..e72262b2 100644 Binary files a/artifacts/test_program_methods/chain_caller.bin and b/artifacts/test_program_methods/chain_caller.bin differ diff --git a/artifacts/test_program_methods/changer_claimer.bin b/artifacts/test_program_methods/changer_claimer.bin index 842ab16c..86c3e695 100644 Binary files a/artifacts/test_program_methods/changer_claimer.bin and b/artifacts/test_program_methods/changer_claimer.bin differ diff --git a/artifacts/test_program_methods/claimer.bin b/artifacts/test_program_methods/claimer.bin index b3bd2fe7..5c23dfe4 100644 Binary files a/artifacts/test_program_methods/claimer.bin and b/artifacts/test_program_methods/claimer.bin differ diff --git a/artifacts/test_program_methods/data_changer.bin b/artifacts/test_program_methods/data_changer.bin index 0d7376d2..ee2d8f2b 100644 Binary files a/artifacts/test_program_methods/data_changer.bin and b/artifacts/test_program_methods/data_changer.bin differ diff --git a/artifacts/test_program_methods/extra_output.bin b/artifacts/test_program_methods/extra_output.bin index 7ce3cd26..39c09989 100644 Binary files a/artifacts/test_program_methods/extra_output.bin and b/artifacts/test_program_methods/extra_output.bin differ diff --git a/artifacts/test_program_methods/malicious_authorization_changer.bin b/artifacts/test_program_methods/malicious_authorization_changer.bin index 9a4244ad..cee9a3b9 100644 Binary files a/artifacts/test_program_methods/malicious_authorization_changer.bin and b/artifacts/test_program_methods/malicious_authorization_changer.bin differ diff --git a/artifacts/test_program_methods/minter.bin b/artifacts/test_program_methods/minter.bin index f6032d1f..285cae2f 100644 Binary files a/artifacts/test_program_methods/minter.bin and b/artifacts/test_program_methods/minter.bin differ diff --git a/artifacts/test_program_methods/missing_output.bin b/artifacts/test_program_methods/missing_output.bin index 1eac8cc6..5b8fb311 100644 Binary files a/artifacts/test_program_methods/missing_output.bin and b/artifacts/test_program_methods/missing_output.bin differ diff --git a/artifacts/test_program_methods/modified_transfer.bin b/artifacts/test_program_methods/modified_transfer.bin index 7c3cc6d1..5bb5fbbd 100644 Binary files a/artifacts/test_program_methods/modified_transfer.bin and b/artifacts/test_program_methods/modified_transfer.bin differ diff --git a/artifacts/test_program_methods/nonce_changer.bin b/artifacts/test_program_methods/nonce_changer.bin index 5fdeee60..ff63175f 100644 Binary files a/artifacts/test_program_methods/nonce_changer.bin and b/artifacts/test_program_methods/nonce_changer.bin differ diff --git a/artifacts/test_program_methods/noop.bin b/artifacts/test_program_methods/noop.bin index 856dbe7b..0fc49a55 100644 Binary files a/artifacts/test_program_methods/noop.bin and b/artifacts/test_program_methods/noop.bin differ diff --git a/artifacts/test_program_methods/program_owner_changer.bin b/artifacts/test_program_methods/program_owner_changer.bin index d17d6cdf..7268da57 100644 Binary files a/artifacts/test_program_methods/program_owner_changer.bin and b/artifacts/test_program_methods/program_owner_changer.bin differ diff --git a/artifacts/test_program_methods/simple_balance_transfer.bin b/artifacts/test_program_methods/simple_balance_transfer.bin index f6105e5a..f597d8ba 100644 Binary files a/artifacts/test_program_methods/simple_balance_transfer.bin and b/artifacts/test_program_methods/simple_balance_transfer.bin differ diff --git a/bedrock_client/src/lib.rs b/bedrock_client/src/lib.rs index f8a9c5e4..b34687c3 100644 --- a/bedrock_client/src/lib.rs +++ b/bedrock_client/src/lib.rs @@ -17,6 +17,8 @@ pub struct BackoffConfig { // Simple wrapper // maybe extend in the future for our purposes +// `Clone` is cheap because `CommonHttpClient` is internally reference counted (`Arc`). +#[derive(Clone)] pub struct BedrockClient { http_client: CommonHttpClient, node_url: Url, diff --git a/common/src/block.rs b/common/src/block.rs index 98b1afb3..391bc57d 100644 --- a/common/src/block.rs +++ b/common/src/block.rs @@ -4,6 +4,7 @@ use sha2::{Digest, Sha256, digest::FixedOutput}; use crate::transaction::EncodedTransaction; pub type HashType = [u8; 32]; +pub type MantleMsgId = [u8; 32]; #[derive(Debug, Clone)] /// Our own hasher. @@ -49,6 +50,7 @@ pub struct Block { pub header: BlockHeader, pub body: BlockBody, pub bedrock_status: BedrockStatus, + pub bedrock_parent_id: MantleMsgId, } #[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)] @@ -60,7 +62,11 @@ pub struct HashableBlockData { } impl HashableBlockData { - pub fn into_pending_block(self, signing_key: &nssa::PrivateKey) -> Block { + pub fn into_pending_block( + self, + signing_key: &nssa::PrivateKey, + bedrock_parent_id: MantleMsgId, + ) -> Block { let data_bytes = borsh::to_vec(&self).unwrap(); let signature = nssa::Signature::new(signing_key, &data_bytes); let hash = OwnHasher::hash(&data_bytes); @@ -76,6 +82,7 @@ impl HashableBlockData { transactions: self.transactions, }, bedrock_status: BedrockStatus::Pending, + bedrock_parent_id, } } diff --git a/common/src/test_utils.rs b/common/src/test_utils.rs index 1125b86e..80703342 100644 --- a/common/src/test_utils.rs +++ b/common/src/test_utils.rs @@ -30,7 +30,7 @@ pub fn produce_dummy_block( transactions, }; - block_data.into_pending_block(&sequencer_sign_key_for_testing()) + block_data.into_pending_block(&sequencer_sign_key_for_testing(), [0; 32]) } pub fn produce_dummy_empty_transaction() -> EncodedTransaction { diff --git a/indexer_service/protocol/src/convert.rs b/indexer_service/protocol/src/convert.rs index 46c8811d..8c6de2f4 100644 --- a/indexer_service/protocol/src/convert.rs +++ b/indexer_service/protocol/src/convert.rs @@ -599,12 +599,14 @@ impl TryFrom for Block { header, body, bedrock_status, + bedrock_parent_id, } = value; Ok(Self { header: header.into(), body: body.try_into()?, bedrock_status: bedrock_status.into(), + bedrock_parent_id: MantleMsgId(bedrock_parent_id), }) } } @@ -617,12 +619,14 @@ impl TryFrom for common::block::Block { header, body, bedrock_status, + bedrock_parent_id, } = value; Ok(Self { header: header.try_into()?, body: body.try_into()?, bedrock_status: bedrock_status.into(), + bedrock_parent_id: bedrock_parent_id.0, }) } } diff --git a/indexer_service/protocol/src/lib.rs b/indexer_service/protocol/src/lib.rs index 8189f7d8..f12bdf5b 100644 --- a/indexer_service/protocol/src/lib.rs +++ b/indexer_service/protocol/src/lib.rs @@ -36,6 +36,7 @@ pub struct Block { pub header: BlockHeader, pub body: BlockBody, pub bedrock_status: BedrockStatus, + pub bedrock_parent_id: MantleMsgId, } #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] @@ -188,6 +189,13 @@ pub struct Hash( pub [u8; 32], ); +#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] +pub struct MantleMsgId( + #[serde(with = "base64::arr")] + #[schemars(with = "String", description = "base64-encoded Bedrock message id")] + pub [u8; 32], +); + #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub enum BedrockStatus { Pending, diff --git a/integration_tests/configs/sequencer/detached/sequencer_config.json b/integration_tests/configs/sequencer/detached/sequencer_config.json index 575d3de3..5c642d37 100644 --- a/integration_tests/configs/sequencer/detached/sequencer_config.json +++ b/integration_tests/configs/sequencer/detached/sequencer_config.json @@ -6,6 +6,7 @@ "max_num_tx_in_block": 20, "mempool_max_size": 10000, "block_create_timeout_millis": 10000, + "retry_pending_blocks_timeout_millis": 240000, "port": 0, "initial_accounts": [ { diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index a4daac80..21e1ca81 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -40,6 +40,7 @@ static LOGGER: LazyLock<()> = LazyLock::new(env_logger::init); pub struct TestContext { sequencer_server_handle: ServerHandle, sequencer_loop_handle: JoinHandle>, + sequencer_retry_pending_blocks_handle: JoinHandle>, indexer_loop_handle: Option>>, sequencer_client: SequencerClient, wallet: WalletCore, @@ -94,10 +95,15 @@ impl TestContext { debug!("Test context setup"); - let (sequencer_server_handle, sequencer_addr, sequencer_loop_handle, temp_sequencer_dir) = - Self::setup_sequencer(sequencer_config) - .await - .context("Failed to setup sequencer")?; + let ( + sequencer_server_handle, + sequencer_addr, + sequencer_loop_handle, + sequencer_retry_pending_blocks_handle, + temp_sequencer_dir, + ) = Self::setup_sequencer(sequencer_config) + .await + .context("Failed to setup sequencer")?; // Convert 0.0.0.0 to 127.0.0.1 for client connections // When binding to port 0, the server binds to 0.0.0.0: @@ -130,6 +136,7 @@ impl TestContext { Ok(Self { sequencer_server_handle, sequencer_loop_handle, + sequencer_retry_pending_blocks_handle, indexer_loop_handle, sequencer_client, wallet, @@ -140,6 +147,7 @@ impl TestContext { Ok(Self { sequencer_server_handle, sequencer_loop_handle, + sequencer_retry_pending_blocks_handle, indexer_loop_handle: None, sequencer_client, wallet, @@ -151,7 +159,13 @@ impl TestContext { async fn setup_sequencer( mut config: SequencerConfig, - ) -> Result<(ServerHandle, SocketAddr, JoinHandle>, TempDir)> { + ) -> Result<( + ServerHandle, + SocketAddr, + JoinHandle>, + JoinHandle>, + TempDir, + )> { let temp_sequencer_dir = tempfile::tempdir().context("Failed to create temp dir for sequencer home")?; @@ -163,13 +177,18 @@ impl TestContext { // Setting port to 0 lets the OS choose a free port for us config.port = 0; - let (sequencer_server_handle, sequencer_addr, sequencer_loop_handle) = - sequencer_runner::startup_sequencer(config).await?; + let ( + sequencer_server_handle, + sequencer_addr, + sequencer_loop_handle, + sequencer_retry_pending_blocks_handle, + ) = sequencer_runner::startup_sequencer(config).await?; Ok(( sequencer_server_handle, sequencer_addr, sequencer_loop_handle, + sequencer_retry_pending_blocks_handle, temp_sequencer_dir, )) } @@ -230,6 +249,7 @@ impl Drop for TestContext { let Self { sequencer_server_handle, sequencer_loop_handle, + sequencer_retry_pending_blocks_handle, indexer_loop_handle, sequencer_client: _, wallet: _, @@ -238,6 +258,7 @@ impl Drop for TestContext { } = self; sequencer_loop_handle.abort(); + sequencer_retry_pending_blocks_handle.abort(); if let Some(indexer_loop_handle) = indexer_loop_handle { indexer_loop_handle.abort(); } diff --git a/integration_tests/tests/tps.rs b/integration_tests/tests/tps.rs index e3e64805..5fc09c4c 100644 --- a/integration_tests/tests/tps.rs +++ b/integration_tests/tests/tps.rs @@ -190,6 +190,7 @@ impl TpsTestManager { initial_commitments: vec![initial_commitment], signing_key: [37; 32], bedrock_config: None, + retry_pending_blocks_timeout_millis: 1000 * 60 * 4, } } } diff --git a/nssa/core/src/commitment.rs b/nssa/core/src/commitment.rs index 52344177..b08e3005 100644 --- a/nssa/core/src/commitment.rs +++ b/nssa/core/src/commitment.rs @@ -5,7 +5,10 @@ use serde::{Deserialize, Serialize}; use crate::{NullifierPublicKey, account::Account}; #[derive(Serialize, Deserialize, BorshSerialize, BorshDeserialize)] -#[cfg_attr(any(feature = "host", test), derive(Debug, Clone, PartialEq, Eq, Hash))] +#[cfg_attr( + any(feature = "host", test), + derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord) +)] pub struct Commitment(pub(super) [u8; 32]); /// A commitment to all zero data. diff --git a/nssa/core/src/nullifier.rs b/nssa/core/src/nullifier.rs index 8d9d59fa..5c420cb1 100644 --- a/nssa/core/src/nullifier.rs +++ b/nssa/core/src/nullifier.rs @@ -42,7 +42,10 @@ impl From<&NullifierSecretKey> for NullifierPublicKey { pub type NullifierSecretKey = [u8; 32]; #[derive(Serialize, Deserialize, BorshSerialize, BorshDeserialize)] -#[cfg_attr(any(feature = "host", test), derive(Debug, Clone, PartialEq, Eq, Hash))] +#[cfg_attr( + any(feature = "host", test), + derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash) +)] pub struct Nullifier(pub(super) [u8; 32]); impl Nullifier { diff --git a/nssa/src/merkle_tree/mod.rs b/nssa/src/merkle_tree/mod.rs index c4501cf8..b3637b13 100644 --- a/nssa/src/merkle_tree/mod.rs +++ b/nssa/src/merkle_tree/mod.rs @@ -1,3 +1,4 @@ +use borsh::{BorshDeserialize, BorshSerialize}; use sha2::{Digest, Sha256}; mod default_values; @@ -20,6 +21,7 @@ fn hash_value(value: &Value) -> Node { } #[cfg_attr(test, derive(Debug, PartialEq, Eq))] +#[derive(BorshSerialize, BorshDeserialize)] pub struct MerkleTree { nodes: Vec, capacity: usize, diff --git a/nssa/src/program.rs b/nssa/src/program.rs index 943b16ed..06c7ad29 100644 --- a/nssa/src/program.rs +++ b/nssa/src/program.rs @@ -1,3 +1,4 @@ +use borsh::{BorshDeserialize, BorshSerialize}; use nssa_core::{ account::AccountWithMetadata, program::{InstructionData, ProgramId, ProgramOutput}, @@ -14,7 +15,7 @@ use crate::{ /// TODO: Make this variable when fees are implemented const MAX_NUM_CYCLES_PUBLIC_EXECUTION: u64 = 1024 * 1024 * 32; // 32M cycles -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, BorshSerialize, BorshDeserialize)] pub struct Program { id: ProgramId, elf: Vec, diff --git a/nssa/src/state.rs b/nssa/src/state.rs index 1a384b2f..d6bf8d60 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -1,5 +1,6 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeSet, HashMap, HashSet}; +use borsh::{BorshDeserialize, BorshSerialize}; use nssa_core::{ Commitment, CommitmentSetDigest, DUMMY_COMMITMENT, MembershipProof, Nullifier, account::{Account, AccountId}, @@ -15,6 +16,8 @@ use crate::{ pub const MAX_NUMBER_CHAINED_CALLS: usize = 10; +#[derive(BorshSerialize, BorshDeserialize)] +#[cfg_attr(test, derive(Debug, PartialEq, Eq))] pub(crate) struct CommitmentSet { merkle_tree: MerkleTree, commitments: HashMap, @@ -60,8 +63,49 @@ impl CommitmentSet { } } -type NullifierSet = HashSet; +#[cfg_attr(test, derive(Debug, PartialEq, Eq))] +struct NullifierSet(BTreeSet); +impl NullifierSet { + fn new() -> Self { + Self(BTreeSet::new()) + } + + fn extend(&mut self, new_nullifiers: Vec) { + self.0.extend(new_nullifiers); + } + + fn contains(&self, nullifier: &Nullifier) -> bool { + self.0.contains(nullifier) + } +} + +impl BorshSerialize for NullifierSet { + fn serialize(&self, writer: &mut W) -> std::io::Result<()> { + self.0.iter().collect::>().serialize(writer) + } +} + +impl BorshDeserialize for NullifierSet { + fn deserialize_reader(reader: &mut R) -> std::io::Result { + let vec = Vec::::deserialize_reader(reader)?; + + let mut set = BTreeSet::new(); + for n in vec { + if !set.insert(n) { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidData, + "duplicate nullifier in NullifierSet", + )); + } + } + + Ok(Self(set)) + } +} + +#[derive(BorshSerialize, BorshDeserialize)] +#[cfg_attr(test, derive(Debug, PartialEq, Eq))] pub struct V02State { public_state: HashMap, private_state: (CommitmentSet, NullifierSet), @@ -4528,4 +4572,15 @@ pub mod tests { // Assert - should fail because the malicious program tries to manipulate is_authorized assert!(matches!(result, Err(NssaError::CircuitProvingError(_)))); } + + #[test] + fn test_state_serialization_roundtrip() { + let account_id_1 = AccountId::new([1; 32]); + let account_id_2 = AccountId::new([2; 32]); + let initial_data = [(account_id_1, 100u128), (account_id_2, 151u128)]; + let state = V02State::new_with_genesis_accounts(&initial_data, &[]).with_test_programs(); + let bytes = borsh::to_vec(&state).unwrap(); + let state_from_bytes: V02State = borsh::from_slice(&bytes).unwrap(); + assert_eq!(state, state_from_bytes); + } } diff --git a/sequencer_core/src/block_settlement_client.rs b/sequencer_core/src/block_settlement_client.rs index 50980d9c..f99a116e 100644 --- a/sequencer_core/src/block_settlement_client.rs +++ b/sequencer_core/src/block_settlement_client.rs @@ -2,7 +2,7 @@ use std::{fs, path::Path, str::FromStr}; use anyhow::{Context, Result, anyhow}; use bedrock_client::BedrockClient; -use common::block::HashableBlockData; +use common::block::Block; use logos_blockchain_core::mantle::{ MantleTx, Op, OpProof, SignedMantleTx, Transaction, TxHash, ledger, ops::channel::{ChannelId, MsgId, inscribe::InscriptionOp}, @@ -15,11 +15,11 @@ use reqwest::Url; use crate::config::BedrockConfig; /// A component that posts block data to logos blockchain +#[derive(Clone)] pub struct BlockSettlementClient { bedrock_client: BedrockClient, bedrock_signing_key: Ed25519Key, bedrock_channel_id: ChannelId, - last_message_id: MsgId, } impl BlockSettlementClient { @@ -30,25 +30,24 @@ impl BlockSettlementClient { .context("Bedrock node address is not a valid url")?; let bedrock_client = BedrockClient::new(None, bedrock_url).context("Failed to initialize bedrock client")?; - let channel_genesis_msg = MsgId::from([0; 32]); Ok(Self { bedrock_client, bedrock_signing_key, bedrock_channel_id: config.channel_id, - last_message_id: channel_genesis_msg, }) } /// Create and sign a transaction for inscribing data - pub fn create_inscribe_tx(&self, data: Vec) -> (SignedMantleTx, MsgId) { + pub fn create_inscribe_tx(&self, block: &Block) -> Result<(SignedMantleTx, MsgId)> { + let inscription_data = borsh::to_vec(block)?; let verifying_key_bytes = self.bedrock_signing_key.public_key().to_bytes(); let verifying_key = Ed25519PublicKey::from_bytes(&verifying_key_bytes).expect("valid ed25519 public key"); let inscribe_op = InscriptionOp { channel_id: self.bedrock_channel_id, - inscription: data, - parent: self.last_message_id, + inscription: inscription_data, + parent: block.bedrock_parent_id.into(), signer: verifying_key, }; let inscribe_op_id = inscribe_op.id(); @@ -78,20 +77,17 @@ impl BlockSettlementClient { ledger_tx_proof: empty_ledger_signature(&tx_hash), mantle_tx: inscribe_tx, }; - (signed_mantle_tx, inscribe_op_id) + Ok((signed_mantle_tx, inscribe_op_id)) } - /// Post a transaction to the node and wait for inclusion - pub async fn post_and_wait(&mut self, block_data: &HashableBlockData) -> Result { - let inscription_data = borsh::to_vec(&block_data)?; - let (tx, new_msg_id) = self.create_inscribe_tx(inscription_data); + /// Post a transaction to the node + pub async fn submit_block_to_bedrock(&self, block: &Block) -> Result { + let (tx, new_msg_id) = self.create_inscribe_tx(block)?; // Post the transaction self.bedrock_client.post_transaction(tx).await?; - self.last_message_id = new_msg_id; - - Ok(block_data.block_id) + Ok(new_msg_id) } } diff --git a/sequencer_core/src/block_store.rs b/sequencer_core/src/block_store.rs index cd9aa194..a0b07445 100644 --- a/sequencer_core/src/block_store.rs +++ b/sequencer_core/src/block_store.rs @@ -2,9 +2,10 @@ use std::{collections::HashMap, path::Path}; use anyhow::Result; use common::{HashType, block::Block, transaction::EncodedTransaction}; +use nssa::V02State; use storage::RocksDBIO; -pub struct SequencerBlockStore { +pub struct SequencerStore { dbio: RocksDBIO, // TODO: Consider adding the hashmap to the database for faster recovery. tx_hash_to_block_map: HashMap, @@ -12,7 +13,7 @@ pub struct SequencerBlockStore { signing_key: nssa::PrivateKey, } -impl SequencerBlockStore { +impl SequencerStore { /// Starting database at the start of new chain. /// Creates files if necessary. /// @@ -42,18 +43,15 @@ impl SequencerBlockStore { /// Reopening existing database pub fn open_db_restart(location: &Path, signing_key: nssa::PrivateKey) -> Result { - SequencerBlockStore::open_db_with_genesis(location, None, signing_key) + SequencerStore::open_db_with_genesis(location, None, signing_key) } pub fn get_block_at_id(&self, id: u64) -> Result { Ok(self.dbio.get_block(id)?) } - pub fn put_block_at_id(&mut self, block: Block) -> Result<()> { - let new_transactions_map = block_to_transactions_map(&block); - self.dbio.put_block(block, false)?; - self.tx_hash_to_block_map.extend(new_transactions_map); - Ok(()) + pub fn delete_block_at_id(&mut self, block_id: u64) -> Result<()> { + Ok(self.dbio.delete_block(block_id)?) } /// Returns the transaction corresponding to the given hash, if it exists in the blockchain. @@ -81,6 +79,21 @@ impl SequencerBlockStore { pub fn signing_key(&self) -> &nssa::PrivateKey { &self.signing_key } + + pub fn get_all_blocks(&self) -> impl Iterator> { + self.dbio.get_all_blocks().map(|res| Ok(res?)) + } + + pub(crate) fn update(&mut self, block: Block, state: &V02State) -> Result<()> { + let new_transactions_map = block_to_transactions_map(&block); + self.dbio.atomic_update(block, state)?; + self.tx_hash_to_block_map.extend(new_transactions_map); + Ok(()) + } + + pub fn get_nssa_state(&self) -> Option { + self.dbio.get_nssa_state().ok() + } } pub(crate) fn block_to_transactions_map(block: &Block) -> HashMap { @@ -113,11 +126,10 @@ mod tests { transactions: vec![], }; - let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key); + let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key, [0; 32]); // Start an empty node store let mut node_store = - SequencerBlockStore::open_db_with_genesis(path, Some(genesis_block), signing_key) - .unwrap(); + SequencerStore::open_db_with_genesis(path, Some(genesis_block), signing_key).unwrap(); let tx = common::test_utils::produce_dummy_empty_transaction(); let block = common::test_utils::produce_dummy_block(1, None, vec![tx.clone()]); @@ -126,7 +138,8 @@ mod tests { let retrieved_tx = node_store.get_transaction_by_hash(tx.hash()); assert_eq!(None, retrieved_tx); // Add the block with the transaction - node_store.put_block_at_id(block).unwrap(); + let dummy_state = V02State::new_with_genesis_accounts(&[], &[]); + node_store.update(block, &dummy_state).unwrap(); // Try again let retrieved_tx = node_store.get_transaction_by_hash(tx.hash()); assert_eq!(Some(tx), retrieved_tx); diff --git a/sequencer_core/src/config.rs b/sequencer_core/src/config.rs index a19b5499..3d69e8af 100644 --- a/sequencer_core/src/config.rs +++ b/sequencer_core/src/config.rs @@ -41,6 +41,8 @@ pub struct SequencerConfig { pub mempool_max_size: usize, /// Interval in which blocks produced pub block_create_timeout_millis: u64, + /// Interval in which pending blocks are retried + pub retry_pending_blocks_timeout_millis: u64, /// Port to listen pub port: u16, /// List of initial accounts data diff --git a/sequencer_core/src/lib.rs b/sequencer_core/src/lib.rs index 89cafc4c..efddcd7e 100644 --- a/sequencer_core/src/lib.rs +++ b/sequencer_core/src/lib.rs @@ -5,15 +5,15 @@ use anyhow::Result; use common::PINATA_BASE58; use common::{ HashType, - block::HashableBlockData, + block::{BedrockStatus, Block, HashableBlockData, MantleMsgId}, transaction::{EncodedTransaction, NSSATransaction}, }; use config::SequencerConfig; -use log::warn; +use log::{info, warn}; use mempool::{MemPool, MemPoolHandle}; use serde::{Deserialize, Serialize}; -use crate::{block_settlement_client::BlockSettlementClient, block_store::SequencerBlockStore}; +use crate::{block_settlement_client::BlockSettlementClient, block_store::SequencerStore}; mod block_settlement_client; pub mod block_store; @@ -21,11 +21,12 @@ pub mod config; pub struct SequencerCore { state: nssa::V02State, - block_store: SequencerBlockStore, + store: SequencerStore, mempool: MemPool, sequencer_config: SequencerConfig, chain_height: u64, block_settlement_client: Option, + last_bedrock_msg_id: MantleMsgId, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] @@ -43,7 +44,11 @@ impl Display for TransactionMalformationError { impl std::error::Error for TransactionMalformationError {} impl SequencerCore { - /// Start Sequencer from configuration and construct transaction sender + /// Starts the sequencer using the provided configuration. + /// If an existing database is found, the sequencer state is loaded from it and + /// assumed to represent the correct latest state consistent with Bedrock-finalized data. + /// If no database is found, the sequencer performs a fresh start from genesis, + /// initializing its state with the accounts defined in the configuration file. pub fn start_from_config(config: SequencerConfig) -> (Self, MemPoolHandle) { let hashable_data = HashableBlockData { block_id: config.genesis_id, @@ -53,37 +58,51 @@ impl SequencerCore { }; let signing_key = nssa::PrivateKey::try_new(config.signing_key).unwrap(); - let genesis_block = hashable_data.into_pending_block(&signing_key); + let channel_genesis_msg_id = [0; 32]; + let genesis_block = hashable_data.into_pending_block(&signing_key, channel_genesis_msg_id); // Sequencer should panic if unable to open db, // as fixing this issue may require actions non-native to program scope - let block_store = SequencerBlockStore::open_db_with_genesis( + let store = SequencerStore::open_db_with_genesis( &config.home.join("rocksdb"), Some(genesis_block), signing_key, ) .unwrap(); - let mut initial_commitments = vec![]; - for init_comm_data in config.initial_commitments.clone() { - let npk = init_comm_data.npk; + let mut state = match store.get_nssa_state() { + Some(state) => { + info!("Found local database. Loading state and pending blocks from it."); + state + } + None => { + info!( + "No database found when starting the sequencer. Creating a fresh new with the initial data in config" + ); + let initial_commitments: Vec = config + .initial_commitments + .iter() + .map(|init_comm_data| { + let npk = &init_comm_data.npk; - let mut acc = init_comm_data.account; + let mut acc = init_comm_data.account.clone(); - acc.program_owner = nssa::program::Program::authenticated_transfer_program().id(); + acc.program_owner = + nssa::program::Program::authenticated_transfer_program().id(); - let comm = nssa_core::Commitment::new(&npk, &acc); + nssa_core::Commitment::new(npk, &acc) + }) + .collect(); - initial_commitments.push(comm); - } + let init_accs: Vec<(nssa::AccountId, u128)> = config + .initial_accounts + .iter() + .map(|acc_data| (acc_data.account_id.parse().unwrap(), acc_data.balance)) + .collect(); - let init_accs: Vec<(nssa::AccountId, u128)> = config - .initial_accounts - .iter() - .map(|acc_data| (acc_data.account_id.parse().unwrap(), acc_data.balance)) - .collect(); - - let mut state = nssa::V02State::new_with_genesis_accounts(&init_accs, &initial_commitments); + nssa::V02State::new_with_genesis_accounts(&init_accs, &initial_commitments) + } + }; #[cfg(feature = "testnet")] state.add_pinata_program(PINATA_BASE58.parse().unwrap()); @@ -94,37 +113,17 @@ impl SequencerCore { .expect("Block settlement client should be constructible") }); - let mut this = Self { + let sequencer_core = Self { state, - block_store, + store, mempool, chain_height: config.genesis_id, sequencer_config: config, block_settlement_client, + last_bedrock_msg_id: channel_genesis_msg_id, }; - this.sync_state_with_stored_blocks(); - - (this, mempool_handle) - } - - /// If there are stored blocks ahead of the current height, this method will load and process - /// all transaction in them in the order they are stored. The NSSA state will be updated - /// accordingly. - fn sync_state_with_stored_blocks(&mut self) { - let mut next_block_id = self.sequencer_config.genesis_id + 1; - while let Ok(block) = self.block_store.get_block_at_id(next_block_id) { - for encoded_transaction in block.body.transactions { - let transaction = NSSATransaction::try_from(&encoded_transaction).unwrap(); - // Process transaction and update state - self.execute_check_transaction_on_state(transaction) - .unwrap(); - // Update the tx hash to block id map. - self.block_store.insert(&encoded_transaction, next_block_id); - } - self.chain_height = next_block_id; - next_block_id += 1; - } + (sequencer_core, mempool_handle) } fn execute_check_transaction_on_state( @@ -148,8 +147,11 @@ impl SequencerCore { pub async fn produce_new_block_and_post_to_settlement_layer(&mut self) -> Result { let block_data = self.produce_new_block_with_mempool_transactions()?; - if let Some(block_settlement) = self.block_settlement_client.as_mut() { - block_settlement.post_and_wait(&block_data).await?; + if let Some(client) = self.block_settlement_client.as_mut() { + let block = + block_data.into_pending_block(self.store.signing_key(), self.last_bedrock_msg_id); + let msg_id = client.submit_block_to_bedrock(&block).await?; + self.last_bedrock_msg_id = msg_id.into(); log::info!("Posted block data to Bedrock"); } @@ -179,11 +181,7 @@ impl SequencerCore { } } - let prev_block_hash = self - .block_store - .get_block_at_id(self.chain_height)? - .header - .hash; + let prev_block_hash = self.store.get_block_at_id(self.chain_height)?.header.hash; let curr_time = chrono::Utc::now().timestamp_millis() as u64; @@ -196,9 +194,9 @@ impl SequencerCore { let block = hashable_data .clone() - .into_pending_block(self.block_store.signing_key()); + .into_pending_block(self.store.signing_key(), self.last_bedrock_msg_id); - self.block_store.put_block_at_id(block)?; + self.store.update(block, &self.state)?; self.chain_height = new_block_height; @@ -224,8 +222,8 @@ impl SequencerCore { &self.state } - pub fn block_store(&self) -> &SequencerBlockStore { - &self.block_store + pub fn block_store(&self) -> &SequencerStore { + &self.store } pub fn chain_height(&self) -> u64 { @@ -235,6 +233,39 @@ impl SequencerCore { pub fn sequencer_config(&self) -> &SequencerConfig { &self.sequencer_config } + + /// Deletes finalized blocks from the sequencer's pending block list. + /// This method must be called when new blocks are finalized on Bedrock. + /// All pending blocks with an ID less than or equal to `last_finalized_block_id` + /// are removed from the database. + pub fn clean_finalized_blocks_from_db(&mut self, last_finalized_block_id: u64) -> Result<()> { + if let Some(first_pending_block_id) = self + .get_pending_blocks()? + .iter() + .map(|block| block.header.block_id) + .min() + { + (first_pending_block_id..=last_finalized_block_id) + .try_for_each(|id| self.store.delete_block_at_id(id)) + } else { + Ok(()) + } + } + + /// Returns the list of stored pending blocks. + pub fn get_pending_blocks(&self) -> Result> { + Ok(self + .store + .get_all_blocks() + .collect::>>()? + .into_iter() + .filter(|block| matches!(block.bedrock_status, BedrockStatus::Pending)) + .collect()) + } + + pub fn block_settlement_client(&self) -> Option { + self.block_settlement_client.clone() + } } // TODO: Introduce type-safe wrapper around checked transaction, e.g. AuthenticatedTransaction @@ -297,6 +328,7 @@ mod tests { initial_commitments: vec![], signing_key: *sequencer_sign_key_for_testing().value(), bedrock_config: None, + retry_pending_blocks_timeout_millis: 1000 * 60 * 4, } } @@ -680,10 +712,7 @@ mod tests { .produce_new_block_with_mempool_transactions() .unwrap() .block_id; - let block = sequencer - .block_store - .get_block_at_id(current_height) - .unwrap(); + let block = sequencer.store.get_block_at_id(current_height).unwrap(); // Only one should be included in the block assert_eq!(block.body.transactions, vec![tx.clone()]); @@ -720,10 +749,7 @@ mod tests { .produce_new_block_with_mempool_transactions() .unwrap() .block_id; - let block = sequencer - .block_store - .get_block_at_id(current_height) - .unwrap(); + let block = sequencer.store.get_block_at_id(current_height).unwrap(); assert_eq!(block.body.transactions, vec![tx.clone()]); // Add same transaction should fail @@ -732,10 +758,7 @@ mod tests { .produce_new_block_with_mempool_transactions() .unwrap() .block_id; - let block = sequencer - .block_store - .get_block_at_id(current_height) - .unwrap(); + let block = sequencer.store.get_block_at_id(current_height).unwrap(); assert!(block.body.transactions.is_empty()); } @@ -768,10 +791,7 @@ mod tests { .produce_new_block_with_mempool_transactions() .unwrap() .block_id; - let block = sequencer - .block_store - .get_block_at_id(current_height) - .unwrap(); + let block = sequencer.store.get_block_at_id(current_height).unwrap(); assert_eq!(block.body.transactions, vec![tx.clone()]); } @@ -791,4 +811,42 @@ mod tests { config.initial_accounts[1].balance + balance_to_move ); } + + #[test] + fn test_get_pending_blocks() { + let config = setup_sequencer_config(); + let (mut sequencer, _mempool_handle) = SequencerCore::start_from_config(config); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + assert_eq!(sequencer.get_pending_blocks().unwrap().len(), 4); + } + + #[test] + fn test_delete_blocks() { + let config = setup_sequencer_config(); + let (mut sequencer, _mempool_handle) = SequencerCore::start_from_config(config); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + sequencer + .produce_new_block_with_mempool_transactions() + .unwrap(); + + let last_finalized_block = 3; + sequencer + .clean_finalized_blocks_from_db(last_finalized_block) + .unwrap(); + + assert_eq!(sequencer.get_pending_blocks().unwrap().len(), 1); + } } diff --git a/sequencer_rpc/src/process.rs b/sequencer_rpc/src/process.rs index 83df4f21..8b4ec7a5 100644 --- a/sequencer_rpc/src/process.rs +++ b/sequencer_rpc/src/process.rs @@ -405,6 +405,7 @@ mod tests { initial_accounts, initial_commitments: vec![], signing_key: *sequencer_sign_key_for_testing().value(), + retry_pending_blocks_timeout_millis: 1000 * 60 * 4, bedrock_config: Some(BedrockConfig { channel_id: [42; 32].into(), node_url: "http://localhost:8080".to_string(), diff --git a/sequencer_runner/configs/debug/sequencer_config.json b/sequencer_runner/configs/debug/sequencer_config.json index 2b0dcd5c..80bfe0a4 100644 --- a/sequencer_runner/configs/debug/sequencer_config.json +++ b/sequencer_runner/configs/debug/sequencer_config.json @@ -5,7 +5,8 @@ "is_genesis_random": true, "max_num_tx_in_block": 20, "mempool_max_size": 1000, - "block_create_timeout_millis": 10000, + "block_create_timeout_millis": 5000, + "retry_pending_blocks_timeout_millis": 7000, "port": 3040, "initial_accounts": [ { diff --git a/sequencer_runner/src/lib.rs b/sequencer_runner/src/lib.rs index fd4a6c08..8dbea525 100644 --- a/sequencer_runner/src/lib.rs +++ b/sequencer_runner/src/lib.rs @@ -4,7 +4,7 @@ use actix_web::dev::ServerHandle; use anyhow::Result; use clap::Parser; use common::rpc_primitives::RpcConfig; -use log::info; +use log::{info, warn}; use sequencer_core::{SequencerCore, config::SequencerConfig}; use sequencer_rpc::new_http_server; use tokio::{sync::Mutex, task::JoinHandle}; @@ -20,8 +20,14 @@ struct Args { pub async fn startup_sequencer( app_config: SequencerConfig, -) -> Result<(ServerHandle, SocketAddr, JoinHandle>)> { +) -> Result<( + ServerHandle, + SocketAddr, + JoinHandle>, + JoinHandle>, +)> { let block_timeout = app_config.block_create_timeout_millis; + let retry_pending_blocks_timeout = app_config.retry_pending_blocks_timeout_millis; let port = app_config.port; let (sequencer_core, mempool_handle) = SequencerCore::start_from_config(app_config); @@ -39,8 +45,41 @@ pub async fn startup_sequencer( let http_server_handle = http_server.handle(); tokio::spawn(http_server); - info!("Starting main sequencer loop"); + info!("Starting pending block retry loop"); + let seq_core_wrapped_for_block_retry = seq_core_wrapped.clone(); + let retry_pending_blocks_handle = tokio::spawn(async move { + loop { + tokio::time::sleep(std::time::Duration::from_millis( + retry_pending_blocks_timeout, + )) + .await; + let (pending_blocks, block_settlement_client) = { + let sequencer_core = seq_core_wrapped_for_block_retry.lock().await; + let client = sequencer_core.block_settlement_client(); + let pending_blocks = sequencer_core + .get_pending_blocks() + .expect("Sequencer should be able to retrieve pending blocks"); + (pending_blocks, client) + }; + + let Some(client) = block_settlement_client else { + continue; + }; + + info!("Resubmitting {} pending blocks", pending_blocks.len()); + for block in &pending_blocks { + if let Err(e) = client.submit_block_to_bedrock(block).await { + warn!( + "Failed to resubmit block with id {} with error {}", + block.header.block_id, e + ); + } + } + } + }); + + info!("Starting main sequencer loop"); let main_loop_handle = tokio::spawn(async move { loop { tokio::time::sleep(std::time::Duration::from_millis(block_timeout)).await; @@ -61,7 +100,12 @@ pub async fn startup_sequencer( } }); - Ok((http_server_handle, addr, main_loop_handle)) + Ok(( + http_server_handle, + addr, + main_loop_handle, + retry_pending_blocks_handle, + )) } pub async fn main_runner() -> Result<()> { @@ -81,9 +125,26 @@ pub async fn main_runner() -> Result<()> { } // ToDo: Add restart on failures - let (_, _, main_loop_handle) = startup_sequencer(app_config).await?; + let (_, _, main_loop_handle, retry_loop_handle) = startup_sequencer(app_config).await?; - main_loop_handle.await??; + info!("Sequencer running. Monitoring concurrent tasks..."); + + tokio::select! { + res = main_loop_handle => { + match res { + Ok(inner_res) => warn!("Main loop exited unexpectedly: {:?}", inner_res), + Err(e) => warn!("Main loop task panicked: {:?}", e), + } + } + res = retry_loop_handle => { + match res { + Ok(inner_res) => warn!("Retry loop exited unexpectedly: {:?}", inner_res), + Err(e) => warn!("Retry loop task panicked: {:?}", e), + } + } + } + + info!("Shutting down sequencer..."); Ok(()) } diff --git a/storage/Cargo.toml b/storage/Cargo.toml index 4678560e..98257526 100644 --- a/storage/Cargo.toml +++ b/storage/Cargo.toml @@ -9,3 +9,4 @@ common.workspace = true thiserror.workspace = true borsh.workspace = true rocksdb.workspace = true +nssa.workspace = true diff --git a/storage/src/lib.rs b/storage/src/lib.rs index 883684c2..b96e0d61 100644 --- a/storage/src/lib.rs +++ b/storage/src/lib.rs @@ -2,8 +2,9 @@ use std::{path::Path, sync::Arc}; use common::block::Block; use error::DbError; +use nssa::V02State; use rocksdb::{ - BoundColumnFamily, ColumnFamilyDescriptor, DBWithThreadMode, MultiThreaded, Options, + BoundColumnFamily, ColumnFamilyDescriptor, DBWithThreadMode, MultiThreaded, Options, WriteBatch, }; pub mod error; @@ -29,15 +30,15 @@ pub const DB_META_FIRST_BLOCK_SET_KEY: &str = "first_block_set"; /// Key base for storing metainformation about the last finalized block on Bedrock pub const DB_META_LAST_FINALIZED_BLOCK_ID: &str = "last_finalized_block_id"; -/// Key base for storing snapshot which describe block id -pub const DB_SNAPSHOT_BLOCK_ID_KEY: &str = "block_id"; +/// Key base for storing the NSSA state +pub const DB_NSSA_STATE_KEY: &str = "nssa_state"; /// Name of block column family pub const CF_BLOCK_NAME: &str = "cf_block"; /// Name of meta column family pub const CF_META_NAME: &str = "cf_meta"; -/// Name of snapshot column family -pub const CF_SNAPSHOT_NAME: &str = "cf_snapshot"; +/// Name of state column family +pub const CF_NSSA_STATE_NAME: &str = "cf_nssa_state"; pub type DbResult = Result; @@ -52,7 +53,7 @@ impl RocksDBIO { // ToDo: Add more column families for different data let cfb = ColumnFamilyDescriptor::new(CF_BLOCK_NAME, cf_opts.clone()); let cfmeta = ColumnFamilyDescriptor::new(CF_META_NAME, cf_opts.clone()); - let cfsnapshot = ColumnFamilyDescriptor::new(CF_SNAPSHOT_NAME, cf_opts.clone()); + let cfstate = ColumnFamilyDescriptor::new(CF_NSSA_STATE_NAME, cf_opts.clone()); let mut db_opts = Options::default(); db_opts.create_missing_column_families(true); @@ -60,7 +61,7 @@ impl RocksDBIO { let db = DBWithThreadMode::::open_cf_descriptors( &db_opts, path, - vec![cfb, cfmeta, cfsnapshot], + vec![cfb, cfmeta, cfstate], ); let dbio = Self { @@ -92,7 +93,7 @@ impl RocksDBIO { // ToDo: Add more column families for different data let _cfb = ColumnFamilyDescriptor::new(CF_BLOCK_NAME, cf_opts.clone()); let _cfmeta = ColumnFamilyDescriptor::new(CF_META_NAME, cf_opts.clone()); - let _cfsnapshot = ColumnFamilyDescriptor::new(CF_SNAPSHOT_NAME, cf_opts.clone()); + let _cfstate = ColumnFamilyDescriptor::new(CF_NSSA_STATE_NAME, cf_opts.clone()); let mut db_opts = Options::default(); db_opts.create_missing_column_families(true); @@ -109,8 +110,8 @@ impl RocksDBIO { self.db.cf_handle(CF_BLOCK_NAME).unwrap() } - pub fn snapshot_column(&self) -> Arc> { - self.db.cf_handle(CF_SNAPSHOT_NAME).unwrap() + pub fn nssa_state_column(&self) -> Arc> { + self.db.cf_handle(CF_NSSA_STATE_NAME).unwrap() } pub fn get_meta_first_block_in_db(&self) -> DbResult { @@ -189,6 +190,24 @@ impl RocksDBIO { Ok(res.is_some()) } + pub fn put_nssa_state_in_db(&self, state: &V02State, batch: &mut WriteBatch) -> DbResult<()> { + let cf_nssa_state = self.nssa_state_column(); + batch.put_cf( + &cf_nssa_state, + borsh::to_vec(&DB_NSSA_STATE_KEY).map_err(|err| { + DbError::borsh_cast_message( + err, + Some("Failed to serialize DB_NSSA_STATE_KEY".to_string()), + ) + })?, + borsh::to_vec(state).map_err(|err| { + DbError::borsh_cast_message(err, Some("Failed to serialize NSSA state".to_string())) + })?, + ); + + Ok(()) + } + pub fn put_meta_first_block_in_db(&self, block: Block) -> DbResult<()> { let cf_meta = self.meta_column(); self.db @@ -209,7 +228,15 @@ impl RocksDBIO { ) .map_err(|rerr| DbError::rocksdb_cast_message(rerr, None))?; - self.put_block(block, true)?; + let mut batch = WriteBatch::default(); + self.put_block(block, true, &mut batch)?; + self.db.write(batch).map_err(|rerr| { + DbError::rocksdb_cast_message( + rerr, + Some("Failed to write first block in db".to_string()), + ) + })?; + Ok(()) } @@ -274,7 +301,7 @@ impl RocksDBIO { Ok(()) } - pub fn put_block(&self, block: Block, first: bool) -> DbResult<()> { + pub fn put_block(&self, block: Block, first: bool, batch: &mut WriteBatch) -> DbResult<()> { let cf_block = self.block_column(); if !first { @@ -285,23 +312,15 @@ impl RocksDBIO { } } - self.db - .put_cf( - &cf_block, - borsh::to_vec(&block.header.block_id).map_err(|err| { - DbError::borsh_cast_message( - err, - Some("Failed to serialize block id".to_string()), - ) - })?, - borsh::to_vec(&block).map_err(|err| { - DbError::borsh_cast_message( - err, - Some("Failed to serialize block data".to_string()), - ) - })?, - ) - .map_err(|rerr| DbError::rocksdb_cast_message(rerr, None))?; + batch.put_cf( + &cf_block, + borsh::to_vec(&block.header.block_id).map_err(|err| { + DbError::borsh_cast_message(err, Some("Failed to serialize block id".to_string())) + })?, + borsh::to_vec(&block).map_err(|err| { + DbError::borsh_cast_message(err, Some("Failed to serialize block data".to_string())) + })?, + ); Ok(()) } @@ -334,32 +353,90 @@ impl RocksDBIO { } } - pub fn get_snapshot_block_id(&self) -> DbResult { - let cf_snapshot = self.snapshot_column(); + pub fn get_nssa_state(&self) -> DbResult { + let cf_nssa_state = self.nssa_state_column(); let res = self .db .get_cf( - &cf_snapshot, - borsh::to_vec(&DB_SNAPSHOT_BLOCK_ID_KEY).map_err(|err| { + &cf_nssa_state, + borsh::to_vec(&DB_NSSA_STATE_KEY).map_err(|err| { DbError::borsh_cast_message( err, - Some("Failed to serialize DB_SNAPSHOT_BLOCK_ID_KEY".to_string()), + Some("Failed to serialize block id".to_string()), ) })?, ) .map_err(|rerr| DbError::rocksdb_cast_message(rerr, None))?; if let Some(data) = res { - Ok(borsh::from_slice::(&data).map_err(|err| { + Ok(borsh::from_slice::(&data).map_err(|serr| { DbError::borsh_cast_message( - err, - Some("Failed to deserialize last block".to_string()), + serr, + Some("Failed to deserialize block data".to_string()), ) })?) } else { Err(DbError::db_interaction_error( - "Snapshot block ID not found".to_string(), + "Block on this id not found".to_string(), )) } } + + pub fn delete_block(&self, block_id: u64) -> DbResult<()> { + let cf_block = self.block_column(); + let key = borsh::to_vec(&block_id).map_err(|err| { + DbError::borsh_cast_message(err, Some("Failed to serialize block id".to_string())) + })?; + + if self + .db + .get_cf(&cf_block, &key) + .map_err(|rerr| DbError::rocksdb_cast_message(rerr, None))? + .is_none() + { + return Err(DbError::db_interaction_error( + "Block on this id not found".to_string(), + )); + } + + self.db + .delete_cf(&cf_block, key) + .map_err(|rerr| DbError::rocksdb_cast_message(rerr, None))?; + + Ok(()) + } + + pub fn get_all_blocks(&self) -> impl Iterator> { + let cf_block = self.block_column(); + self.db + .iterator_cf(&cf_block, rocksdb::IteratorMode::Start) + .map(|res| { + let (_key, value) = res.map_err(|rerr| { + DbError::rocksdb_cast_message( + rerr, + Some("Failed to get key value pair".to_string()), + ) + })?; + + borsh::from_slice::(&value).map_err(|err| { + DbError::borsh_cast_message( + err, + Some("Failed to deserialize block data".to_string()), + ) + }) + }) + } + + pub fn atomic_update(&self, block: Block, state: &V02State) -> DbResult<()> { + let block_id = block.header.block_id; + let mut batch = WriteBatch::default(); + self.put_block(block, false, &mut batch)?; + self.put_nssa_state_in_db(state, &mut batch)?; + self.db.write(batch).map_err(|rerr| { + DbError::rocksdb_cast_message( + rerr, + Some(format!("Failed to udpate db with block {block_id}")), + ) + }) + } }