diff --git a/.config/dictionaries/project.dic b/.config/dictionaries/project.dic index 3a0d621fa..9ddf3dc0b 100644 --- a/.config/dictionaries/project.dic +++ b/.config/dictionaries/project.dic @@ -99,6 +99,7 @@ libsqlite libtest linkat lintfix +logcall ltbase mapref mathrm @@ -160,14 +161,15 @@ rfind Rmax Rmin rngs -rsplit rollouts +rsplit rusqlite rustc rustdoc rustdocflags rustflags rustls +rustup saibatizoku sandboxed sandboxing @@ -222,5 +224,3 @@ xprv xpub zilla zillable -rustup -logcall diff --git a/hermes/Cargo.lock b/hermes/Cargo.lock index 535a3bea4..048fa7c74 100644 --- a/hermes/Cargo.lock +++ b/hermes/Cargo.lock @@ -507,9 +507,9 @@ dependencies = [ [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" [[package]] name = "bech32" @@ -519,9 +519,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bech32" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" +checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "bimap" @@ -580,9 +580,9 @@ dependencies = [ [[package]] name = "bip39" -version = "2.2.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d193de1f7487df1914d3a568b772458861d33f9c54249612cc2893d6915054" +checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" dependencies = [ "bitcoin_hashes", "serde", @@ -604,19 +604,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" -[[package]] -name = "bitcoin-internals" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" - [[package]] name = "bitcoin_hashes" -version = "0.13.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b" dependencies = [ - "bitcoin-internals", "hex-conservative", ] @@ -871,6 +864,20 @@ name = "bytemuck" version = "1.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] [[package]] name = "byteorder" @@ -1135,6 +1142,29 @@ dependencies = [ "uuid", ] +[[package]] +name = "catalyst-types" +version = "0.0.11" +source = "git+https://github.com/input-output-hk/catalyst-libs.git?tag=catalyst-types%2Fv0.0.11#7a32dd981b5de571dc08a751f58f55d4b6fabaff" +dependencies = [ + "base64-url", + "chrono", + "displaydoc", + "ed25519-dalek", + "fluent-uri", + "fmmap", + "jsonschema 0.28.3", + "minicbor 0.25.1", + "num-traits", + "orx-concurrent-vec", + "serde", + "serde_json", + "strum 0.27.2", + "thiserror 2.0.17", + "tracing", + "uuid", +] + [[package]] name = "cbor4ii" version = "0.2.14" @@ -1163,9 +1193,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.48" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ "find-msvc-tools", "jobserver", @@ -1434,6 +1464,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1671,9 +1710,9 @@ dependencies = [ [[package]] name = "criterion" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0dfe5e9e71bdcf4e4954f7d14da74d1cdb92a3a07686452d1509652684b1aab" +checksum = "4d883447757bb0ee46f233e9dc22eb84d93a9508c9b868687b274fc431d886bf" dependencies = [ "alloca", "anes", @@ -1696,9 +1735,9 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de36c2bee19fba779808f92bf5d9b0fa5a40095c277aba10c458a12b35d21d6" +checksum = "ed943f81ea2faa8dcecbbfa50164acf95d555afec96a27871663b300e387b2e4" dependencies = [ "cast", "itertools 0.13.0", @@ -2053,21 +2092,23 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version", "syn 2.0.111", "unicode-xid", ] @@ -2408,6 +2449,17 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +[[package]] +name = "fancy-regex" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + [[package]] name = "fancy-regex" version = "0.16.2" @@ -2865,9 +2917,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" +checksum = "3e2b37e2f62729cdada11f0e6b3b6fe383c69c29fc619e391223e12856af308c" dependencies = [ "bitflags 2.10.0", "libc", @@ -3128,7 +3180,7 @@ dependencies = [ "hyper", "hyper-util", "iana-time-zone", - "jsonschema", + "jsonschema 0.33.0", "keyed-lock", "libsqlite3-sys", "libtest-mimic", @@ -3172,17 +3224,23 @@ dependencies = [ [[package]] name = "hermes-ipfs" -version = "0.0.7" -source = "git+https://github.com/input-output-hk/catalyst-libs.git?tag=hermes-ipfs%2Fv0.0.7#44776e3e61a92b5b5b762a51fb04a236ebe0fb78" +version = "0.0.9" +source = "git+https://github.com/input-output-hk/catalyst-libs.git?branch=feat%2Fdoc-sync-timers#34de5330f838ae158c1af9c36c89e76423caac0d" dependencies = [ "anyhow", + "bytemuck", + "catalyst-types 0.0.11", "connexa", "derive_more", + "ed25519-dalek", "futures", "ipld-core", "libp2p", + "minicbor 0.25.1", + "rand 0.9.2", "rust-ipfs", "tokio", + "tracing", ] [[package]] @@ -3199,9 +3257,12 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-conservative" -version = "0.1.2" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" +checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" +dependencies = [ + "arrayvec", +] [[package]] name = "hex-literal" @@ -3482,9 +3543,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" dependencies = [ "base64 0.22.1", "bytes", @@ -3578,9 +3639,9 @@ checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" dependencies = [ "icu_collections", "icu_locale_core", @@ -3592,9 +3653,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" [[package]] name = "icu_provider" @@ -3883,6 +3944,31 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonschema" +version = "0.28.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f66fe41fa46a5c83ed1c717b7e0b4635988f427083108c8cf0a882cc13441" +dependencies = [ + "ahash", + "base64 0.22.1", + "bytecount", + "email_address", + "fancy-regex 0.14.0", + "fraction", + "idna", + "itoa", + "num-cmp", + "once_cell", + "percent-encoding", + "referencing 0.28.3", + "regex-syntax", + "reqwest", + "serde", + "serde_json", + "uuid-simd", +] + [[package]] name = "jsonschema" version = "0.33.0" @@ -3893,7 +3979,7 @@ dependencies = [ "base64 0.22.1", "bytecount", "email_address", - "fancy-regex", + "fancy-regex 0.16.2", "fraction", "idna", "itoa", @@ -3901,7 +3987,7 @@ dependencies = [ "num-traits", "once_cell", "percent-encoding", - "referencing", + "referencing 0.33.0", "regex", "regex-syntax", "reqwest", @@ -3988,15 +4074,15 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.177" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libgit2-sys" -version = "0.18.2+1.9.1" +version = "0.18.3+1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" +checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" dependencies = [ "cc", "libc", @@ -4250,9 +4336,9 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104e13b51e4711ff5738caa1fb54467c8604c2e94d607e27745bcf709068774" +checksum = "f0c7892c221730ba55f7196e98b0b8ba5e04b4155651736036628e9f73ed6fc3" dependencies = [ "asn1_der", "bs58", @@ -4728,21 +4814,21 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" dependencies = [ - "serde", + "serde_core", "value-bag", ] [[package]] name = "logcall" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e8309d7cbf9e9f27139956138cb375f14621cdb2f4cdd91468467ec04b6784" +checksum = "f25eafa59f810ac51403c1cf6d3277d88a1a8743ce481abee45c940eaecbc4ac" dependencies = [ - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "syn 2.0.111", @@ -4926,9 +5012,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", "wasi 0.11.1+wasi-snapshot-preview1", @@ -4982,7 +5068,7 @@ checksum = "0253a5237371e7795495e740766f49d6da85e736127239bee067020ac0f0a629" dependencies = [ "anyhow", "async-trait", - "bech32 0.11.0", + "bech32 0.11.1", "blake2 0.10.6", "chrono", "ciborium", @@ -6253,30 +6339,6 @@ dependencies = [ "toml_edit", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro-error-attr2" version = "2.0.0" @@ -6688,6 +6750,19 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "referencing" +version = "0.28.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0dcb5ab28989ad7c91eb1b9531a37a1a137cc69a0499aee4117cae4a107c464" +dependencies = [ + "ahash", + "fluent-uri", + "once_cell", + "percent-encoding", + "serde_json", +] + [[package]] name = "referencing" version = "0.33.0" @@ -6747,9 +6822,9 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" -version = "0.12.24" +version = "0.12.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" +checksum = "b6eff9328d40131d43bd911d42d79eb6a47312002a4daefc9e37f17e74a7701a" dependencies = [ "base64 0.22.1", "bytes", @@ -7638,7 +7713,7 @@ version = "0.1.0" dependencies = [ "anyhow", "base64 0.22.1", - "bech32 0.11.0", + "bech32 0.11.1", "cardano-blockchain-types", "catalyst-types 0.0.10", "chrono", @@ -7687,9 +7762,9 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "similar" @@ -7741,9 +7816,9 @@ dependencies = [ [[package]] name = "slotmap" -version = "1.0.7" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" dependencies = [ "version_check", ] @@ -7866,9 +7941,9 @@ checksum = "7b3c8667cd96245cbb600b8dec5680a7319edd719c5aa2b5d23c6bff94f39765" [[package]] name = "stringzilla" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c928ccc97d701d7960025d6b9118d4d377b5519bde9b98daf0b1a3a12bbfb14" +checksum = "f1c02528de89ff79752ed6f92ed9e29b41f6f2afcc3b2c50df0dd305c3978a5f" dependencies = [ "cc", ] @@ -8483,9 +8558,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.23.7" +version = "0.23.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" dependencies = [ "indexmap 2.12.1", "toml_datetime", @@ -8519,9 +8594,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ "bitflags 2.10.0", "bytes", @@ -8759,9 +8834,15 @@ checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "unicode-script" -version = "0.5.7" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb421b350c9aff471779e262955939f565ec18b86c15364e6bdf0d662ca7c1f" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-vo" @@ -9131,12 +9212,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.242.0" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67f90e55bc9c6ee6954a757cc6eb3424d96b442e5252ed10fea627e518878d36" +checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" dependencies = [ "leb128fmt", - "wasmparser 0.242.0", + "wasmparser 0.243.0", ] [[package]] @@ -9213,17 +9294,6 @@ dependencies = [ "semver", ] -[[package]] -name = "wasmparser" -version = "0.242.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3c6e611f4cd748d85c767815823b777dc56afca793fcda27beae4e85028849" -dependencies = [ - "bitflags 2.10.0", - "indexmap 2.12.1", - "semver", -] - [[package]] name = "wasmparser" version = "0.243.0" @@ -9541,24 +9611,24 @@ dependencies = [ [[package]] name = "wast" -version = "242.0.0" +version = "243.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50a61ae2997784a4ae2a47b3a99f7cf0ad2a54db09624a28a0c2e9d7a24408ce" +checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width", - "wasm-encoder 0.242.0", + "wasm-encoder 0.243.0", ] [[package]] name = "wat" -version = "1.242.0" +version = "1.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ae8cf6adfb79b5d89cb3fe68bd56aaab9409d9cf23b588097eae7d75585dae2" +checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" dependencies = [ - "wast 242.0.0", + "wast 243.0.0", ] [[package]] @@ -10537,9 +10607,9 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f06ae92f42f5e5c42443fd094f245eb656abf56dd7cce9b8b263236565e00f2" +checksum = "51f936044d677be1a1168fae1d03b583a285a5dd9d8cbf7b24c23aa1fc775235" [[package]] name = "zstd" diff --git a/hermes/bin/Cargo.toml b/hermes/bin/Cargo.toml index 707d1922a..2c2e9e8f1 100644 --- a/hermes/bin/Cargo.toml +++ b/hermes/bin/Cargo.toml @@ -31,7 +31,7 @@ path = "tests/integration/tests/mod.rs" [dependencies] # Catalyst Internal Crates -hermes-ipfs = { version = "0.0.7", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "hermes-ipfs/v0.0.7" } +hermes-ipfs = { version = "0.0.9", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "feat/doc-sync-timers", features = ["doc-sync"] } cardano-blockchain-types = { version = "0.0.9", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cardano-blockchain-types/v0.0.9" } cardano-chain-follower = { version = "0.0.19", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cardano-chain-follower/v0.0.19" } catalyst-types = { version = "0.0.7", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "catalyst-types/v0.0.7" } diff --git a/hermes/bin/src/runtime_extensions/hermes/doc_sync/host.rs b/hermes/bin/src/runtime_extensions/hermes/doc_sync/host.rs index 8b158882c..1e04152b8 100644 --- a/hermes/bin/src/runtime_extensions/hermes/doc_sync/host.rs +++ b/hermes/bin/src/runtime_extensions/hermes/doc_sync/host.rs @@ -1,9 +1,15 @@ //! Doc Sync host module. +use std::sync::Arc; + use cardano_chain_follower::pallas_codec::minicbor::{self, Encode, Encoder, data::Tag}; +use hermes_ipfs::doc_sync::timers::{config::SyncTimersConfig, state::SyncTimersState}; use stringzilla::stringzilla::Sha256; use wasmtime::component::Resource; +use super::ChannelState; use crate::{ + app::ApplicationName, + ipfs::hermes_ipfs_publish, runtime_context::HermesRuntimeContext, runtime_extensions::{ bindings::hermes::{ @@ -108,30 +114,44 @@ impl HostSyncChannel for HermesRuntimeContext { wasmtime::Error::msg(format!("BLAKE2b hash output length must be 4 bytes: {err}")) })?; + // 1. Create a channel resource. let resource: u32 = u32::from_be_bytes(*prefix_bytes); - - // Code block is used to minimize locking scope. - { - let entry = DOC_SYNC_STATE.entry(resource).or_insert(name.clone()); - if &name != entry.value() { - return Err(wasmtime::Error::msg(format!( - "Collision occurred with previous value = {} and new one = {name}", - entry.value() - ))); - } + let mut channel_state = DOC_SYNC_STATE + .entry(resource) + .or_insert_with(|| ChannelState::new(&name)); + // Same resource key cannot be reused for a different channel + if channel_state.channel_name != name { + return Err(wasmtime::Error::msg(format!( + "Collision occurred with previous value = {} and new one = {name}", + channel_state.channel_name + ))); } - // When the channel is created, subscribe to .new . - if let Err(err) = self.pubsub_subscribe(format!("{name}.new")) { - // FIXME - Do we want to remove the entry from the map here? + // 2. When the channel is created, subscribe to .new . + let topic_new = format!("{name}.new"); + if let Err(err) = self.pubsub_subscribe(topic_new.clone()) { DOC_SYNC_STATE.remove(&resource); return Err(wasmtime::Error::msg(format!( - "Subscription to {name}.new failed: {err}", + "Subscription to {topic_new} failed: {err}", ))); } - tracing::info!("Created Doc Sync Channel: {name}"); + // 3. When subscribe is successful, create and start the timer + if channel_state.timers.is_none() { + let timers = { + let app_name = self.app_name().clone(); + + let callback = Arc::new(move || { + send_new_keepalive(&name, &app_name).map_err(|e| anyhow::anyhow!("{e:?}",)) + }); + + SyncTimersState::new(SyncTimersConfig::default(), callback) + }; + timers.start_quiet_timer(); + channel_state.timers = Some(timers); + } + Ok(wasmtime::component::Resource::new_own(resource)) } @@ -366,13 +386,12 @@ fn publish( rep: u32, ) -> wasmtime::Result> { const STEP: u8 = 5; - let channel_name = DOC_SYNC_STATE + let channel_state = DOC_SYNC_STATE .get(&rep) .ok_or_else(|| wasmtime::Error::msg("Channel not found"))? - .value() .clone(); - let topic_new = format!("{channel_name}.new"); + let topic_new = format!("{}.new", channel_state.channel_name); // The channel should already be subscribed to the `.new` topic (subscription // is performed in `new()`). Invoking the subscription again to ensure @@ -400,6 +419,10 @@ fn publish( tracing::info!(" Document is successfully stored in IPFS"); } + if let Some(timers) = channel_state.timers { + timers.reset_quiet_timer(); + } + Ok(Ok(())) } @@ -428,6 +451,17 @@ fn is_pre_publish_completed( } } +/// Sending new keep alive message for .new topic. +fn send_new_keepalive( + channel_name: &str, + app_name: &ApplicationName, +) -> anyhow::Result<()> { + let new_topic = format!("{channel_name}.new"); + hermes_ipfs_publish(app_name, &new_topic, vec![]) + .map_err(|e| anyhow::Error::msg(format!("Keepalive publish failed: {e:?}")))?; + Ok(()) +} + #[cfg(test)] mod tests { use test_case::test_case; diff --git a/hermes/bin/src/runtime_extensions/hermes/doc_sync/mod.rs b/hermes/bin/src/runtime_extensions/hermes/doc_sync/mod.rs index f422e60de..eb5047cc8 100644 --- a/hermes/bin/src/runtime_extensions/hermes/doc_sync/mod.rs +++ b/hermes/bin/src/runtime_extensions/hermes/doc_sync/mod.rs @@ -1,18 +1,40 @@ //! Doc Sync extension implementation. +use std::sync::Arc; + use dashmap::DashMap; +use hermes_ipfs::doc_sync::timers::state::SyncTimersState; use once_cell::sync::Lazy; mod event; mod host; -/// Initialize state. Which is mapping from String hash to String itself. +/// In-memory representation for an opened doc-sync channel. +#[derive(Clone)] +pub(super) struct ChannelState { + /// Name of the channel. + pub channel_name: String, + /// Timer state. + pub timers: Option>, +} + +impl ChannelState { + /// Create a new state entry for the provided channel name. + fn new(channel_name: &str) -> Self { + Self { + channel_name: channel_name.to_string(), + timers: None, + } + } +} + +/// Initialize state. Maps hashing prefix to channel metadata. /// /// Note: /// /// If large amount of sync channels is expected it would lead to great /// amount of collision, so should be more strictly stored. -pub(super) type State = DashMap; +pub(super) type State = DashMap; /// Global state to hold the resources. static DOC_SYNC_STATE: Lazy = Lazy::new(DashMap::new); diff --git a/hermes/clippy.toml b/hermes/clippy.toml index 3504a361f..a03fd62fd 100644 --- a/hermes/clippy.toml +++ b/hermes/clippy.toml @@ -2,4 +2,4 @@ allow-unwrap-in-tests = true allow-expect-in-tests = true allow-panic-in-tests = true allow-indexing-slicing-in-tests = true -arithmetic-side-effects-allowed = ["num_bigint::BigInt"] \ No newline at end of file +arithmetic-side-effects-allowed = ["num_bigint::BigInt"]