diff --git a/Cargo.lock b/Cargo.lock index 8a318331a..454e7f25f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -141,43 +141,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "anymap2" @@ -287,7 +287,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "synstructure 0.13.1", ] @@ -310,7 +310,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -354,8 +354,8 @@ checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.1", - "futures-lite 2.3.0", + "fastrand 2.2.0", + "futures-lite 2.5.0", "slab", ] @@ -370,7 +370,7 @@ dependencies = [ "async-io", "async-lock", "blocking", - "futures-lite 2.3.0", + "futures-lite 2.5.0", "once_cell", ] @@ -466,17 +466,17 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ "async-lock", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.3.0", + "futures-lite 2.5.0", "parking", - "polling 3.7.3", + "polling 3.7.4", "rustix", "slab", "tracing", @@ -517,7 +517,7 @@ dependencies = [ "blocking", "cfg-if", "event-listener 5.3.1", - "futures-lite 2.3.0", + "futures-lite 2.5.0", "rustix", "tracing", ] @@ -530,7 +530,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -575,7 +575,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", - "futures-lite 2.3.0", + "futures-lite 2.5.0", "gloo-timers", "kv-log-macro", "log", @@ -606,7 +606,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -623,7 +623,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -876,9 +876,9 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" +checksum = "8f850665a0385e070b64c38d2354e6c104c8479c59868d1e48a0c13ee2c7a1c1" dependencies = [ "autocfg", "libm", @@ -1011,7 +1011,7 @@ dependencies = [ "async-channel 2.3.1", "async-task", "futures-io", - "futures-lite 2.3.0", + "futures-lite 2.5.0", "piper", ] @@ -1027,9 +1027,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "f5327f6c99920069d1fe374aa743be1af0031dea9f250852cdf1ae6a0861ee24" dependencies = [ "borsh-derive", "cfg_aliases 0.2.1", @@ -1037,16 +1037,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "10aedd8f1a81a8aafbfde924b0e3061cd6fedd6f6bbcfc6a76e6fd426d7bfe26" dependencies = [ "once_cell", "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.85", - "syn_derive", + "syn 2.0.87", ] [[package]] @@ -1259,9 +1258,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.31" +version = "1.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf" dependencies = [ "jobserver", "libc", @@ -1494,7 +1493,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1531,9 +1530,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" @@ -2019,7 +2018,7 @@ dependencies = [ "lazy-regex", "linked-hash-map", "once_cell", - "pin-project 1.1.6", + "pin-project 1.1.7", "regex", "sealed", "serde", @@ -2039,7 +2038,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.85", + "syn 2.0.87", "synthez", ] @@ -2074,9 +2073,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.77+curl-8.10.1" +version = "0.4.78+curl-8.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f469e8a5991f277a208224f6c7ad72ecb5f986e36d09ae1f2c1bb9259478a480" +checksum = "8eec768341c5c7789611ae51cf6c459099f22e64a5d5d0ce4892434e33821eaf" dependencies = [ "cc", "libc", @@ -2115,7 +2114,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2174,7 +2173,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2196,7 +2195,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2373,7 +2372,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2450,7 +2449,7 @@ dependencies = [ "dsl_auto_type", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2470,7 +2469,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2544,7 +2543,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2579,7 +2578,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2693,7 +2692,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2734,7 +2733,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -2867,9 +2866,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fd-lock" @@ -3076,11 +3075,11 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ - "fastrand 2.1.1", + "fastrand 2.2.0", "futures-core", "futures-io", "parking", @@ -3095,7 +3094,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -3105,7 +3104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" dependencies = [ "futures-io", - "rustls 0.23.15", + "rustls 0.23.16", "rustls-pki-types", ] @@ -3226,7 +3225,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.85", + "syn 2.0.87", "textwrap 0.16.1", "thiserror", "typed-builder", @@ -3403,9 +3402,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" dependencies = [ "allocator-api2", "equivalent", @@ -3591,7 +3590,7 @@ dependencies = [ "once_cell", "rand", "ring 0.17.8", - "rustls 0.23.15", + "rustls 0.23.16", "rustls-pemfile 2.2.0", "thiserror", "time", @@ -3900,9 +3899,9 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ "hyper 1.5.0", "hyper-util", @@ -3926,9 +3925,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes 1.8.0", "futures-channel", @@ -3954,7 +3953,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core 0.51.1", ] [[package]] @@ -3966,6 +3965,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec 1.13.2", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "idea" version = "0.5.1" @@ -4001,6 +4118,27 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec 1.13.2", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "if-addrs" version = "0.10.2" @@ -4145,7 +4283,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", "serde", ] @@ -4518,7 +4656,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -4589,9 +4727,9 @@ checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libgit2-sys" @@ -4617,9 +4755,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libnghttp2-sys" @@ -4661,7 +4799,7 @@ dependencies = [ "libp2p-upnp", "libp2p-yamux", "multiaddr 0.18.1", - "pin-project 1.1.6", + "pin-project 1.1.7", "rw-stream-sink", "thiserror", ] @@ -4725,11 +4863,11 @@ dependencies = [ "futures-timer", "libp2p-identity", "multiaddr 0.18.1", - "multihash 0.19.1", + "multihash 0.19.2", "multistream-select", "once_cell", "parking_lot 0.12.3", - "pin-project 1.1.6", + "pin-project 1.1.7", "quick-protobuf", "rand", "rw-stream-sink", @@ -4838,7 +4976,7 @@ dependencies = [ "bs58 0.5.1", "ed25519-dalek", "hkdf", - "multihash 0.19.1", + "multihash 0.19.2", "quick-protobuf", "rand", "serde", @@ -4895,7 +5033,7 @@ dependencies = [ "libp2p-ping", "libp2p-relay", "libp2p-swarm", - "pin-project 1.1.6", + "pin-project 1.1.7", "prometheus-client", "web-time", ] @@ -4912,7 +5050,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "multiaddr 0.18.1", - "multihash 0.19.1", + "multihash 0.19.2", "once_cell", "quick-protobuf", "rand", @@ -4975,7 +5113,7 @@ dependencies = [ "quinn", "rand", "ring 0.17.8", - "rustls 0.23.15", + "rustls 0.23.16", "socket2", "thiserror", "tokio", @@ -5065,7 +5203,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -5095,7 +5233,7 @@ dependencies = [ "libp2p-identity", "rcgen 0.11.3", "ring 0.17.8", - "rustls 0.23.15", + "rustls 0.23.16", "rustls-webpki 0.101.7", "thiserror", "x509-parser 0.16.0", @@ -5261,7 +5399,7 @@ checksum = "3b51f1d220e3fa869e24cfd75915efe3164bd09bb11b3165db3f37f57bf673e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -5279,6 +5417,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lmdb-zero" version = "0.4.4" @@ -5357,7 +5501,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] @@ -5492,7 +5636,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -5565,7 +5709,7 @@ dependencies = [ [[package]] name = "minotari_app_grpc" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "argon2", "base64 0.13.1", @@ -5595,7 +5739,7 @@ dependencies = [ [[package]] name = "minotari_app_utilities" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "clap 3.2.25", "dialoguer 0.10.4", @@ -5617,7 +5761,7 @@ dependencies = [ [[package]] name = "minotari_console_wallet" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "blake2", "chrono", @@ -5674,7 +5818,7 @@ dependencies = [ [[package]] name = "minotari_ledger_wallet_common" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "bs58 0.5.1", ] @@ -5682,7 +5826,7 @@ dependencies = [ [[package]] name = "minotari_ledger_wallet_comms" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "borsh", "dialoguer 0.11.0", @@ -5705,7 +5849,7 @@ dependencies = [ [[package]] name = "minotari_node" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "anyhow", "async-trait", @@ -5753,7 +5897,7 @@ dependencies = [ [[package]] name = "minotari_node_grpc_client" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "minotari_app_grpc", ] @@ -5761,7 +5905,7 @@ dependencies = [ [[package]] name = "minotari_wallet" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "argon2", "async-trait", @@ -5811,7 +5955,7 @@ dependencies = [ [[package]] name = "minotari_wallet_grpc_client" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "minotari_app_grpc", "tari_common_types", @@ -5934,7 +6078,7 @@ dependencies = [ "data-encoding", "libp2p-identity", "multibase", - "multihash 0.19.1", + "multihash 0.19.2", "percent-encoding", "serde", "static_assertions", @@ -5966,12 +6110,12 @@ dependencies = [ [[package]] name = "multihash" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" +checksum = "cc41f430805af9d1cf4adae4ed2149c759b877b01d909a1f40256188d09345d2" dependencies = [ "core2", - "unsigned-varint 0.7.2", + "unsigned-varint 0.8.0", ] [[package]] @@ -6007,7 +6151,7 @@ source = "git+https://github.com/tari-project/rust-libp2p.git?rev=3d918ccbf5ae1c dependencies = [ "bytes 1.8.0", "futures 0.3.31", - "pin-project 1.1.6", + "pin-project 1.1.7", "smallvec 1.13.2", "tracing", "unsigned-varint 0.8.0", @@ -6250,7 +6394,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -6380,7 +6524,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -6673,7 +6817,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -6775,11 +6919,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ - "pin-project-internal 1.1.6", + "pin-project-internal 1.1.7", ] [[package]] @@ -6795,20 +6939,20 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -6823,7 +6967,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.1.1", + "fastrand 2.2.0", "futures-io", ] @@ -6872,9 +7016,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.7.3" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", @@ -6952,7 +7096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -7063,7 +7207,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -7136,7 +7280,7 @@ checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes 1.8.0", "heck 0.5.0", - "itertools 0.12.1", + "itertools 0.11.0", "log", "multimap 0.10.0", "once_cell", @@ -7145,7 +7289,7 @@ dependencies = [ "prost 0.12.6", "prost-types 0.12.6", "regex", - "syn 2.0.85", + "syn 2.0.87", "tempfile", ] @@ -7157,7 +7301,7 @@ checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" dependencies = [ "bytes 1.8.0", "heck 0.5.0", - "itertools 0.13.0", + "itertools 0.11.0", "log", "multimap 0.10.0", "once_cell", @@ -7166,7 +7310,7 @@ dependencies = [ "prost 0.13.3", "prost-types 0.13.3", "regex", - "syn 2.0.85", + "syn 2.0.87", "tempfile", ] @@ -7203,10 +7347,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -7216,10 +7360,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -7381,7 +7525,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.15", + "rustls 0.23.16", "socket2", "thiserror", "tokio", @@ -7398,7 +7542,7 @@ dependencies = [ "rand", "ring 0.17.8", "rustc-hash", - "rustls 0.23.15", + "rustls 0.23.16", "slab", "thiserror", "tinyvec", @@ -7407,10 +7551,11 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ + "cfg_aliases 0.2.1", "libc", "once_cell", "socket2", @@ -7594,9 +7739,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -7939,9 +8084,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" dependencies = [ "bitflags 2.6.0", "errno", @@ -7964,9 +8109,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.15" +version = "0.23.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" +checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" dependencies = [ "log", "once_cell", @@ -8081,7 +8226,7 @@ version = "0.4.0" source = "git+https://github.com/tari-project/rust-libp2p.git?rev=3d918ccbf5ae1cbec0815a2156079b0fba4ba558#3d918ccbf5ae1cbec0815a2156079b0fba4ba558" dependencies = [ "futures 0.3.31", - "pin-project 1.1.6", + "pin-project 1.1.7", "static_assertions", ] @@ -8161,7 +8306,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8218,9 +8363,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.213" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] @@ -8248,13 +8393,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.213" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8297,7 +8442,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8346,7 +8491,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8584,7 +8729,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8833,7 +8978,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8889,27 +9034,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.85", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -8942,7 +9075,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -8951,7 +9084,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3d2c2202510a1e186e63e596d9318c91a8cbe85cd1a56a7be0c333e5f59ec8d" dependencies = [ - "syn 2.0.85", + "syn 2.0.87", "synthez-codegen", "synthez-core", ] @@ -8962,7 +9095,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f724aa6d44b7162f3158a57bccd871a77b39a4aef737e01bcdff41f4772c7746" dependencies = [ - "syn 2.0.85", + "syn 2.0.87", "synthez-core", ] @@ -8975,7 +9108,7 @@ dependencies = [ "proc-macro2", "quote", "sealed", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -9080,7 +9213,7 @@ dependencies = [ [[package]] name = "tari_common" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "anyhow", "cargo_toml", @@ -9106,7 +9239,7 @@ dependencies = [ [[package]] name = "tari_common_sqlite" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "diesel", "diesel_migrations", @@ -9120,7 +9253,7 @@ dependencies = [ [[package]] name = "tari_common_types" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "base64 0.21.7", "bitflags 2.6.0", @@ -9146,7 +9279,7 @@ dependencies = [ [[package]] name = "tari_comms" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "anyhow", "async-trait", @@ -9165,7 +9298,7 @@ dependencies = [ "multiaddr 0.14.0", "nom", "once_cell", - "pin-project 1.1.6", + "pin-project 1.1.7", "prost 0.13.3", "rand", "serde", @@ -9190,7 +9323,7 @@ dependencies = [ [[package]] name = "tari_comms_dht" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -9225,7 +9358,7 @@ dependencies = [ [[package]] name = "tari_comms_rpc_macros" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "proc-macro2", "quote", @@ -9258,7 +9391,7 @@ dependencies = [ [[package]] name = "tari_contacts" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "chrono", "diesel", @@ -9291,7 +9424,7 @@ dependencies = [ [[package]] name = "tari_core" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "async-trait", "bincode 1.3.3", @@ -9396,6 +9529,7 @@ dependencies = [ "libp2p-identity", "log", "mini-moka", + "minotari_app_grpc", "multiaddr 0.18.1", "prost 0.12.6", "rand", @@ -9749,7 +9883,7 @@ dependencies = [ [[package]] name = "tari_features" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" [[package]] name = "tari_generate" @@ -9771,7 +9905,7 @@ dependencies = [ [[package]] name = "tari_hashing" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "borsh", "digest", @@ -9874,7 +10008,7 @@ dependencies = [ [[package]] name = "tari_key_manager" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "argon2", "async-trait", @@ -9907,7 +10041,7 @@ dependencies = [ [[package]] name = "tari_libtor" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "derivative", "libtor", @@ -9922,7 +10056,7 @@ dependencies = [ [[package]] name = "tari_max_size" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "borsh", "serde", @@ -9933,7 +10067,7 @@ dependencies = [ [[package]] name = "tari_metrics" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "once_cell", "prometheus", @@ -9943,7 +10077,7 @@ dependencies = [ [[package]] name = "tari_mmr" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "borsh", "digest", @@ -9973,7 +10107,7 @@ dependencies = [ [[package]] name = "tari_p2p" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "anyhow", "fs2", @@ -9986,7 +10120,7 @@ dependencies = [ "prost 0.13.3", "rand", "reqwest", - "rustls 0.23.15", + "rustls 0.23.16", "semver", "serde", "tari_common", @@ -10016,7 +10150,7 @@ dependencies = [ "libp2p-substream", "log", "once_cell", - "pin-project 1.1.6", + "pin-project 1.1.7", "prost 0.12.6", "prost-build 0.12.6", "proto_builder", @@ -10077,7 +10211,7 @@ dependencies = [ [[package]] name = "tari_script" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "blake2", "borsh", @@ -10095,7 +10229,7 @@ dependencies = [ [[package]] name = "tari_service_framework" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "anyhow", "async-trait", @@ -10110,7 +10244,7 @@ dependencies = [ [[package]] name = "tari_shutdown" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "futures 0.3.31", ] @@ -10183,7 +10317,7 @@ dependencies = [ [[package]] name = "tari_storage" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "bincode 1.3.3", "lmdb-zero", @@ -10312,7 +10446,7 @@ dependencies = [ [[package]] name = "tari_test_utils" version = "1.7.0-pre.3" -source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9012114a0a049369014d2ee00505cbabf0fad5c6" +source = "git+https://github.com/tari-project/tari.git?branch=feature-dan2#9005c119dd090ee95d294755b0756abcffffdd43" dependencies = [ "futures 0.3.31", "rand", @@ -10567,12 +10701,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand 2.1.1", + "fastrand 2.2.0", "once_cell", "rustix", "windows-sys 0.59.0", @@ -10630,22 +10764,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10728,6 +10862,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -10745,9 +10889,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes 1.8.0", @@ -10780,7 +10924,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -10809,7 +10953,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.15", + "rustls 0.23.16", "rustls-pki-types", "tokio", ] @@ -10928,7 +11072,7 @@ dependencies = [ "hyper 0.14.31", "hyper-timeout 0.4.1", "percent-encoding", - "pin-project 1.1.6", + "pin-project 1.1.7", "prost 0.11.9", "tokio", "tokio-stream", @@ -10954,10 +11098,10 @@ dependencies = [ "http-body 1.0.1", "http-body-util", "hyper 1.5.0", - "hyper-timeout 0.5.1", + "hyper-timeout 0.5.2", "hyper-util", "percent-encoding", - "pin-project 1.1.6", + "pin-project 1.1.7", "prost 0.13.3", "rustls-native-certs", "rustls-pemfile 2.2.0", @@ -10982,7 +11126,7 @@ dependencies = [ "prost-build 0.13.3", "prost-types 0.13.3", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11008,7 +11152,7 @@ dependencies = [ "futures-util", "hdrhistogram", "indexmap 1.9.3", - "pin-project 1.1.6", + "pin-project 1.1.7", "pin-project-lite", "rand", "slab", @@ -11090,7 +11234,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11109,7 +11253,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.1.6", + "pin-project 1.1.7", "tracing", ] @@ -11196,7 +11340,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "termcolor", ] @@ -11278,7 +11422,7 @@ checksum = "29a3151c41d0b13e3d011f98adc24434560ef06673a155a6c7f66b9879eecce2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -11416,12 +11560,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna 1.0.3", "percent-encoding", "serde", ] @@ -11438,6 +11582,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -11586,7 +11742,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -11620,7 +11776,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -12136,15 +12292,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-core" version = "0.58.0" @@ -12166,7 +12313,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12177,7 +12324,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -12409,6 +12556,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -12467,9 +12626,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.22" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" +checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f" [[package]] name = "xmltree" @@ -12507,7 +12666,7 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.3", - "pin-project 1.1.6", + "pin-project 1.1.7", "rand", "static_assertions", ] @@ -12522,7 +12681,7 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.3", - "pin-project 1.1.6", + "pin-project 1.1.7", "rand", "static_assertions", "web-time", @@ -12537,6 +12696,30 @@ dependencies = [ "time", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure 0.13.1", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -12555,7 +12738,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure 0.13.1", ] [[package]] @@ -12575,7 +12779,29 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 543b0f281..c85c86513 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,26 +131,6 @@ tari_p2p = { git = "https://github.com/tari-project/tari.git", branch = "feature tari_shutdown = { git = "https://github.com/tari-project/tari.git", branch = "feature-dan2" } tari_storage = { git = "https://github.com/tari-project/tari.git", branch = "feature-dan2" } -#minotari_app_grpc = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#minotari_app_utilities = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#minotari_console_wallet = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#minotari_node = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#minotari_node_grpc_client = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#minotari_wallet = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#minotari_wallet_grpc_client = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_common = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_common_types = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_hashing = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -# -## avoid including default features so each crate can choose which ones to import -#tari_core = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2", default-features = false } -#tari_key_manager = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_metrics = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_mmr = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_p2p = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_shutdown = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } -#tari_storage = { git = "https://github.com/sdbondi/tari.git", branch = "update-feature-dan2" } - tari_crypto = "0.21.0" tari_utilities = "0.8.0" @@ -297,3 +277,29 @@ overflow-checks = true #tari_libtor = { git = "https://github.com/account/tari.git", branch = "my-branch" } #tari_hashing = { git = "https://github.com/account/tari.git", branch = "my-branch" } + +#[patch."https://github.com/tari-project/tari.git"] +#minotari_app_grpc = { path = "../tari/applications/minotari_app_grpc" } +#minotari_wallet_grpc_client = { path = "../tari/clients/rust/wallet_grpc_client" } +#minotari_node_grpc_client = { path = "../tari/clients/rust/base_node_grpc_client" } +#tari_common = { path = "../tari/common" } +#tari_common_types = { path = "../tari/base_layer/common_types" } +#tari_comms = { path = "../tari/comms/core" } +#tari_comms_rpc_macros = { path = "../tari/comms/rpc_macros" } +#tari_core = { path = "../tari/base_layer/core" } +#tari_key_manager = { path = "../tari/base_layer/key_manager" } +#tari_mmr = { path = "../tari/base_layer/mmr" } +#tari_p2p = { path = "../tari/base_layer/p2p" } +#tari_shutdown = { path = "../tari/infrastructure/shutdown" } +#tari_storage = { path = "../tari/infrastructure/storage" } +#tari_script = { path = "../tari/infrastructure/tari_script" } +#minotari_wallet = { path = "../tari/base_layer/wallet" } +#minotari_console_wallet = { path = "../tari/applications/minotari_console_wallet" } +#tari_service_framework = { path = "../tari/base_layer/service_framework" } +#tari_comms_dht = { path = "../tari/comms/dht" } +#minotari_app_utilities = { path = "../tari/applications/minotari_app_utilities" } +#minotari_node = { path = "../tari/applications/minotari_node" } +#tari_metrics = { path = "../tari/infrastructure/metrics" } +#tari_libtor = { path = "../tari/infrastructure/libtor" } +#tari_hashing = { path = "../tari/hashing" } + diff --git a/applications/tari_dan_app_utilities/Cargo.toml b/applications/tari_dan_app_utilities/Cargo.toml index 2f33963c3..ea4f5a5cd 100644 --- a/applications/tari_dan_app_utilities/Cargo.toml +++ b/applications/tari_dan_app_utilities/Cargo.toml @@ -29,6 +29,7 @@ tari_bor = { workspace = true, default-features = true } tari_indexer_lib = { workspace = true } tari_networking = { workspace = true } tari_validator_node_rpc = { workspace = true } +minotari_app_grpc = { workspace = true } anyhow = { workspace = true } async-trait = { workspace = true } diff --git a/applications/tari_dan_app_utilities/src/base_layer_scanner.rs b/applications/tari_dan_app_utilities/src/base_layer_scanner.rs index 6a26f12ac..22d995a1f 100644 --- a/applications/tari_dan_app_utilities/src/base_layer_scanner.rs +++ b/applications/tari_dan_app_utilities/src/base_layer_scanner.rs @@ -23,6 +23,7 @@ use std::time::Duration; use log::*; +use minotari_app_grpc::tari_rpc::ValidatorNodeChangeState; use tari_base_node_client::{ grpc::GrpcBaseNodeClient, types::{BaseLayerMetadata, BlockInfo}, @@ -42,7 +43,7 @@ use tari_core::transactions::{ }; use tari_crypto::{ ristretto::RistrettoPublicKey, - tari_utilities::{hex::Hex, ByteArray}, + tari_utilities::{hex::Hex, ByteArray, ByteArrayError}, }; use tari_dan_common_types::{optional::Optional, NodeAddressable, VersionedSubstateId}; use tari_dan_storage::{ @@ -106,6 +107,7 @@ pub struct BaseLayerScanner { last_scanned_height: u64, last_scanned_tip: Option, last_scanned_hash: Option, + last_scanned_validator_node_mr: Option, next_block_hash: Option, base_node_client: GrpcBaseNodeClient, epoch_manager: EpochManagerHandle, @@ -141,6 +143,7 @@ impl BaseLayerScanner { last_scanned_tip: None, last_scanned_height: 0, last_scanned_hash: None, + last_scanned_validator_node_mr: None, next_block_hash: None, base_node_client, epoch_manager, @@ -223,6 +226,7 @@ impl BaseLayerScanner { ); // TODO: we need to figure out where the fork happened, and delete data after the fork. self.last_scanned_hash = None; + self.last_scanned_validator_node_mr = None; self.last_scanned_height = 0; self.sync_blockchain().await?; }, @@ -278,6 +282,7 @@ impl BaseLayerScanner { Some(end_height) => end_height, }; let mut scan = tip.tip_hash; + let mut current_last_validator_nodes_mr = self.last_scanned_validator_node_mr; loop { let header = self.base_node_client.get_header_by_hash(scan).await?; if let Some(last_tip) = self.last_scanned_tip { @@ -290,9 +295,60 @@ impl BaseLayerScanner { // This will be processed down below. break; } + current_last_validator_nodes_mr = Some(header.validator_node_mr); self.epoch_manager.add_block_hash(header.height, scan).await?; scan = header.prev_hash; } + + // syncing validator node changes + if current_last_validator_nodes_mr != self.last_scanned_validator_node_mr { + info!(target: LOG_TARGET, + "⛓️ Syncing validator nodes (sidechain ID: {:?}) from base node (height range: {}-{})", + self.validator_node_sidechain_id, + start_scan_height, + end_height, + ); + + let node_changes = self + .base_node_client + .get_validator_node_changes(start_scan_height, end_height, self.validator_node_sidechain_id.as_ref()) + .await + .map_err(BaseLayerScannerError::BaseNodeError)?; + + for node_change in node_changes { + if node_change.registration.is_none() { + warn!( + target: LOG_TARGET, + "Can't register validator node \"{}\" because it has empty registration!", + node_change.public_key.to_hex(), + ); + continue; + } + let registration = ValidatorNodeRegistration::try_from(node_change.registration.clone().unwrap()) + .map_err(BaseLayerScannerError::GrpcConversion)?; + match node_change.state() { + ValidatorNodeChangeState::Add => { + self.add_validator_node_registration( + node_change.start_height, + registration, + node_change.minimum_value_promise.into(), + ) + .await?; + }, + ValidatorNodeChangeState::Remove => { + self.remove_validator_node_registration( + PublicKey::from_canonical_bytes(node_change.public_key.as_slice()) + .map_err(BaseLayerScannerError::PublicKeyConversion)?, + registration.sidechain_id().cloned(), + ) + .await?; + }, + } + } + + self.last_scanned_validator_node_mr = current_last_validator_nodes_mr; + } + for current_height in start_scan_height..=end_height { let utxos = self .base_node_client @@ -329,27 +385,7 @@ impl BaseLayerScanner { }; match sidechain_feature { SideChainFeature::ValidatorNodeRegistration(reg) => { - info!( - target: LOG_TARGET, - "⛓️ Validator node registration UTXO for {} sidechain {} found at height {}", - reg.public_key(), - reg.sidechain_id().map(|v| v.to_hex()).unwrap_or("None".to_string()), - current_height, - ); - if reg.sidechain_id() == self.validator_node_sidechain_id.as_ref() { - self.register_validator_node_registration( - current_height, - reg.clone(), - output.minimum_value_promise, - ) - .await?; - } else { - warn!( - target: LOG_TARGET, - "Ignoring validator node registration for sidechain ID {:?}. Expected sidechain ID: {:?}", - reg.sidechain_id().map(|v| v.to_hex()), - self.validator_node_sidechain_id.as_ref().map(|v| v.to_hex())); - } + trace!(target: LOG_TARGET, "New validator node registration scanned: {reg:?}"); }, SideChainFeature::CodeTemplateRegistration(reg) => { if reg.sidechain_id != self.template_sidechain_id { @@ -496,7 +532,7 @@ impl BaseLayerScanner { Ok(()) } - async fn register_validator_node_registration( + async fn add_validator_node_registration( &mut self, height: u64, registration: ValidatorNodeRegistration, @@ -516,6 +552,25 @@ impl BaseLayerScanner { Ok(()) } + async fn remove_validator_node_registration( + &mut self, + public_key: PublicKey, + sidechain_id: Option, + ) -> Result<(), BaseLayerScannerError> { + info!( + target: LOG_TARGET, + "⛓️ Remove validator node registration for {}(side chain ID: {:?})", + public_key, + sidechain_id + ); + + self.epoch_manager + .remove_validator_node_registration(public_key, sidechain_id) + .await?; + + Ok(()) + } + async fn register_code_template_registration( &mut self, template_name: String, @@ -574,6 +629,10 @@ pub enum BaseLayerScannerError { commitment: Box, source: StorageError, }, + #[error("Public key conversion error: {0}")] + PublicKeyConversion(ByteArrayError), + #[error("GRPC conversion error: {0}")] + GrpcConversion(String), } enum BlockchainProgression { diff --git a/applications/tari_indexer/src/bootstrap.rs b/applications/tari_indexer/src/bootstrap.rs index 9a8911011..5393d8661 100644 --- a/applications/tari_indexer/src/bootstrap.rs +++ b/applications/tari_indexer/src/bootstrap.rs @@ -125,7 +125,6 @@ pub async fn spawn_services( .try_into() .context("committee_size must be non-zero")?, validator_node_sidechain_id: config.indexer.sidechain_id.clone(), - max_vns_per_epoch_activated: consensus_constants.max_vns_per_epoch_activated, }, global_db.clone(), base_node_client.clone(), diff --git a/applications/tari_swarm_daemon/src/process_manager/manager.rs b/applications/tari_swarm_daemon/src/process_manager/manager.rs index cfd1d7101..f642e5029 100644 --- a/applications/tari_swarm_daemon/src/process_manager/manager.rs +++ b/applications/tari_swarm_daemon/src/process_manager/manager.rs @@ -108,19 +108,19 @@ impl ProcessManager { }; let num_blocks = num_vns + u64::try_from(templates_to_register.len()).unwrap(); - // Mine some initial funds, guessing 10 blocks extra to allow for coinbase maturity - self.mine(num_blocks + 10).await.context("initial mining failed")?; - self.wait_for_wallet_funds(num_blocks) - .await - .context("waiting for wallet funds")?; - if !self.skip_registration { + // Mine some initial funds, guessing 10 blocks extra to allow for coinbase maturity + self.mine(num_blocks + 10).await.context("initial mining failed")?; + self.wait_for_wallet_funds(num_blocks) + .await + .context("waiting for wallet funds")?; + self.register_all_validator_nodes() .await .context("registering validator node via GRPC")?; - } - for templates in templates_to_register { - self.register_template(templates).await?; + for templates in templates_to_register { + self.register_template(templates).await?; + } } if num_blocks > 0 { diff --git a/applications/tari_swarm_daemon/webui/src/routes/Main.tsx b/applications/tari_swarm_daemon/webui/src/routes/Main.tsx index d7937b4c4..0b4918ca1 100644 --- a/applications/tari_swarm_daemon/webui/src/routes/Main.tsx +++ b/applications/tari_swarm_daemon/webui/src/routes/Main.tsx @@ -1,603 +1,607 @@ // Copyright 2024 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -import {ChangeEvent, useEffect, useState} from "react"; -import {jsonRpc} from "../utils/json_rpc"; -import {ExecutedTransaction} from "../Types.ts"; +import { ChangeEvent, useEffect, useState } from "react"; +import { jsonRpc } from "../utils/json_rpc"; +import { ExecutedTransaction } from "../Types.ts"; import MinotariWallet from "../components/MinotariWallet"; import NodeControls from "../components/NodeControls.tsx"; import MinotariNodes from "../components/MinotariNodes.tsx"; enum Executable { - BaseNode = 1, - Wallet = 2, - Miner = 3, - ValidatorNode = 4, - Indexer = 5, - DanWallet = 6, - Templates = 7, + BaseNode = 1, + Wallet = 2, + Miner = 3, + ValidatorNode = 4, + Indexer = 5, + DanWallet = 6, + Templates = 7, } async function jsonRpc2(address: string, method: string, params: any = null) { - let id = 0; - id += 1; - const response = await fetch(address, { - method: "POST", - body: JSON.stringify({ - method: method, - jsonrpc: "2.0", - id: id, - params: params, - }), - headers: { - "Content-Type": "application/json", - }, - }); - const json = await response.json(); - if (json.error) { - throw json.error; - } - return json.result; + let id = 0; + id += 1; + const response = await fetch(address, { + method: "POST", + body: JSON.stringify({ + method: method, + jsonrpc: "2.0", + id: id, + params: params, + }), + headers: { + "Content-Type": "application/json", + }, + }); + const json = await response.json(); + if (json.error) { + throw json.error; + } + return json.result; } -function ExtraInfoVN({name, url, addTxToPool, autoRefresh, state, horizontal}: { - name: string, - url: string, - addTxToPool: any, - autoRefresh: boolean, - state: any, - horizontal: boolean +function ExtraInfoVN({ name, url, addTxToPool, autoRefresh, state, horizontal }: { + name: string, + url: string, + addTxToPool: any, + autoRefresh: boolean, + state: any, + horizontal: boolean }) { - const [committeeInfo, setCommitteeInfo] = useState(null); - const [epoch, setEpoch] = useState(null); - const [height, setHeight] = useState(null); - const [pool, setPool] = useState([]); - const [copied, setCopied] = useState(null); - const [missingTxStates, setMissingTxStates] = useState({}); // {tx_id: [vn1, vn2, ...]} - const [publicKey, setPublicKey] = useState(null); - const [peerId, setPeerId] = useState(null); - const [tick, setTick] = useState(0); - useEffect(() => { - if (autoRefresh) { - const timer = setInterval(() => { - setTick(tick + 1); - }, 1000); - return () => clearInterval(timer); - } - }, [tick, autoRefresh]); - useEffect(() => { - jsonRpc2(url, "get_epoch_manager_stats").then((resp) => { - // setRow(resp.committee_info.shard + 1); - setCommitteeInfo(resp.committee_info); - setHeight(resp.current_block_height); - setEpoch(resp.current_epoch); - }).catch((resp) => { - console.error("err", resp); - }); - jsonRpc2(url, "get_tx_pool").then((resp) => { - setPool(resp.tx_pool); - addTxToPool(resp.tx_pool.filter((tx: any) => Boolean(tx?.transaction)).map((tx: any) => tx.transaction.id).sort()); - }); - jsonRpc2(url, "get_identity").then((resp) => { - setPublicKey(resp.public_key); - setPeerId(resp.peer_id); - }); - let missing_tx = new Set(); - for (const k in state) { - if (k != name && state[k].length > 0) { - missing_tx = new Set([...missing_tx, ...state[k]]); - } - } - const my_txs = new Set(state[name]); - missing_tx = new Set([...missing_tx].filter((tx) => !my_txs.has(tx))); - const promises = Array.from(missing_tx).map((tx) => jsonRpc2(url, "get_transaction", [tx]) - .then((resp) => resp.transaction as ExecutedTransaction) - .catch((resp) => { - throw {resp, tx}; - })); - Promise.allSettled(promises).then((results) => { - const newState: Map = new Map(); - for (const result of results) { - if (result.status == "fulfilled") { - const tx = result.value; - newState.set(tx.transaction.id, { - known: true, - abort_details: tx.abort_details, - final_decision: tx.final_decision, - }); - } else { - newState.set(result.reason.tx, {known: false}); - } - } - if (JSON.stringify(newState) != JSON.stringify(missingTxStates)) { - setMissingTxStates(newState); - } - }); - // for (let tx of missing_tx) { - // jsonRpc2(url, "get_transaction", [tx]).then((resp) => { - // setMissingTxStates((state) => ({ ...state, [tx]: { known: true, abort_details: resp.transaction.abort_details, final_decision: resp.transaction.final_decision } })); - // // console.log(resp); - // }).catch((resp) => { setMissingTxStates((state) => ({ ...state, [tx]: { know: false } })); }); - // } - }, [tick, state]); - const shorten = (str: string) => { - if (str.length > 20) { - return str.slice(0, 3) + "..." + str.slice(-3); - } - return str; - }; - useEffect(() => { - if (copied) { - setTimeout(() => setCopied(null), 1000); - } - }, [copied]); - const copyToClipboard = (str: string) => { - setCopied(str); - navigator.clipboard.writeText(str); - }; - const showMissingTx = (missingTxStates: { [key: string]: any }) => { - if (Object.keys(missingTxStates).length == 0) { - return null; - } - return ( - <> -
-

Transaction from others TXs pools

-
- Tx Id - Known - Abort details - Final decision - {Object.keys(missingTxStates).map((tx) => { - const {known, abort_details, final_decision} = missingTxStates[tx]; - return ( - <> -
copyToClipboard(tx)}>{copied == tx ? "Copied" : shorten(tx)}
-
{known && "Yes" || "No"}
-
{abort_details || unknown}
-
{final_decision || unknown}
- - ); - })} -
- ); - }; - const showPool = (pool: Array) => { - if (pool.length == 0) { - return null; + const [epochManagerStats, setEpochManagerStats] = useState(null); + const [pool, setPool] = useState([]); + const [copied, setCopied] = useState(null); + const [missingTxStates, setMissingTxStates] = useState({}); // {tx_id: [vn1, vn2, ...]} + const [publicKey, setPublicKey] = useState(null); + const [peerId, setPeerId] = useState(null); + const [tick, setTick] = useState(0); + useEffect(() => { + if (autoRefresh) { + const timer = setInterval(() => { + setTick(tick + 1); + }, 1000); + return () => clearInterval(timer); + } + }, [tick, autoRefresh]); + useEffect(() => { + jsonRpc2(url, "get_epoch_manager_stats").then((resp) => { + // setRow(resp.committee_info.shard + 1); + setEpochManagerStats(resp); + }).catch((resp) => { + console.error("err", resp); + }); + jsonRpc2(url, "get_tx_pool").then((resp) => { + setPool(resp.tx_pool); + addTxToPool(resp.tx_pool.filter((tx: any) => Boolean(tx?.transaction)).map((tx: any) => tx.transaction.id).sort()); + }); + jsonRpc2(url, "get_identity").then((resp) => { + setPublicKey(resp.public_key); + setPeerId(resp.peer_id); + }); + let missing_tx = new Set(); + for (const k in state) { + if (k != name && state[k].length > 0) { + missing_tx = new Set([...missing_tx, ...state[k]]); + } + } + const my_txs = new Set(state[name]); + missing_tx = new Set([...missing_tx].filter((tx) => !my_txs.has(tx))); + const promises = Array.from(missing_tx).map((tx) => jsonRpc2(url, "get_transaction", [tx]) + .then((resp) => resp.transaction as ExecutedTransaction) + .catch((resp) => { + throw { resp, tx }; + })); + Promise.allSettled(promises).then((results) => { + const newState: Map = new Map(); + for (const result of results) { + if (result.status == "fulfilled") { + const tx = result.value; + newState.set(tx.transaction.id, { + known: true, + abort_details: tx.abort_details, + final_decision: tx.final_decision, + }); + } else { + newState.set(result.reason.tx, { known: false }); } - return (<> -
-

Pool transactions {pool.length}

- - - - - - - - {pool.map((rec, i) => ( - - - - - - ))} -
Tx IdReadyDecisionStage
copyToClipboard(rec.transaction_id)}>{copied && "Copied" || shorten(rec.transaction_id)}{(rec.is_ready) ? "Yes" : "No"}{getDecision(rec)}{rec.stage}
- - ); - }; + } + if (JSON.stringify(newState) != JSON.stringify(missingTxStates)) { + setMissingTxStates(newState); + } + }); + // for (let tx of missing_tx) { + // jsonRpc2(url, "get_transaction", [tx]).then((resp) => { + // setMissingTxStates((state) => ({ ...state, [tx]: { known: true, abort_details: resp.transaction.abort_details, final_decision: resp.transaction.final_decision } })); + // // console.log(resp); + // }).catch((resp) => { setMissingTxStates((state) => ({ ...state, [tx]: { know: false } })); }); + // } + }, [tick, state]); + const shorten = (str: string) => { + if (str.length > 20) { + return str.slice(0, 3) + "..." + str.slice(-3); + } + return str; + }; + useEffect(() => { + if (copied) { + setTimeout(() => setCopied(null), 1000); + } + }, [copied]); + const copyToClipboard = (str: string) => { + setCopied(str); + navigator.clipboard.writeText(str); + }; + const showMissingTx = (missingTxStates: { [key: string]: any }) => { + if (Object.keys(missingTxStates).length == 0) { + return null; + } return ( -
-
-
-
Shard Group
-
Height
-
Epoch
-
Public key
-
Peer id
-
{committeeInfo?.shard_group.start}-{committeeInfo?.shard_group.end_inclusive} ({committeeInfo?.num_shard_group_members} members)
-
{height}
-
{epoch}
-
{publicKey}
-
{peerId}
-
- {showPool(pool)} - {showMissingTx(missingTxStates)} + <> +
+

Transaction from others TXs pools

+
+ Tx Id + Known + Abort details + Final decision + {Object.keys(missingTxStates).map((tx) => { + const { known, abort_details, final_decision } = missingTxStates[tx]; + return ( + <> +
copyToClipboard(tx)}>{copied == tx ? "Copied" : shorten(tx)}
+
{known && "Yes" || "No"}
+
{abort_details || unknown}
+
{final_decision || unknown}
+ + ); + })}
+ ); + }; + const showPool = (pool: Array) => { + if (pool.length == 0) { + return null; + } + return (<> +
+

Pool transactions {pool.length}

+ + + + + + + + {pool.map((rec, i) => ( + + + + + + ))} +
Tx IdReadyDecisionStage
copyToClipboard(rec.transaction_id)}>{copied && "Copied" || shorten(rec.transaction_id)}{(rec.is_ready) ? "Yes" : "No"}{getDecision(rec)}{rec.stage}
+ ); + }; + + const { + committee_info: committeeInfo, + current_block_height: height, + current_epoch: epoch, + start_epoch: startEpoch, + } = epochManagerStats || {} as any; + + return ( +
+
+
+
Shard Group
+
Height
+
Epoch
+
Public key
+
Peer id
+
{committeeInfo ? `${committeeInfo?.shard_group.start}-${committeeInfo?.shard_group.end_inclusive} (${committeeInfo?.num_shard_group_members} members)` : "--"}
+
{height}
+
{epoch}{startEpoch ? ` (since epoch ${startEpoch})` : " "}
+
{publicKey}
+
{peerId}
+
+ {showPool(pool)} + {showMissingTx(missingTxStates)} +
+ ); } function ShowInfo(params: any) { - const { - children, - executable, - name, - node, - logs, - stdoutLogs, - showLogs, - autoRefresh, - updateState, - state, - horizontal, - onReload, - } = params; - // const [unprocessedTx, setUnprocessedTx] = useState([]); - const nameInfo = name && ( -
-

-            Name
-            {name}
-        
- ); - const jrpcInfo = node?.jrpc && ( + const { + children, + executable, + name, + node, + logs, + stdoutLogs, + showLogs, + autoRefresh, + updateState, + state, + horizontal, + onReload, + } = params; + // const [unprocessedTx, setUnprocessedTx] = useState([]); + const nameInfo = name && ( +
+

+      Name
+      {name}
+    
+ ); + const jrpcInfo = node?.jrpc && ( + + ); + const grpcInfo = node?.grpc && ( +
+ GRPC + {node.grpc} +
+ ); + const httpInfo = node?.web && ( +
+ HTTP + {node.web} +
+ ); + const logInfo = logs && ( + <> +
+ Logs - ); - const grpcInfo = node?.grpc && ( -
- GRPC - {node.grpc} + {logs?.map((e: any) => ( + + ))}
- ); - const httpInfo = node?.web && ( +
+
- HTTP - {node.web} -
- ); - const logInfo = logs && ( - <> -
- Logs -
- {logs?.map((e: any) => ( - - ))} -
+ {stdoutLogs?.map((e: any) => ( +
+ stdout
-
-
- {stdoutLogs?.map((e: any) => ( -
- stdout -
- ))} -
-
- - ); - const addTxToPool = (tx: any) => { - updateState({name: name, state: tx}); - }; + ))} +
+
+ + ); + const addTxToPool = (tx: any) => { + updateState({ name: name, state: tx }); + }; - const handleOnStart = () => { - jsonRpc("start", name).then(onReload); - }; + const handleOnStart = () => { + jsonRpc("start", name).then(onReload); + }; - const handleOnStop = () => { - jsonRpc("stop", name).then(onReload); - }; + const handleOnStop = () => { + jsonRpc("stop", name).then(onReload); + }; - const handleDeleteData = () => { - jsonRpc("delete_data", {name}).then(onReload); - }; + const handleDeleteData = () => { + jsonRpc("delete_data", { name }).then(onReload); + }; - return ( -
- {nameInfo} - {httpInfo} - {jrpcInfo} - {grpcInfo} - {showLogs && logInfo} - {executable === Executable.ValidatorNode && node?.jrpc && - } - {executable !== Executable.Templates && - handleOnStart()} - onStop={() => handleOnStop()} - onDeleteData={() => handleDeleteData()} - />} - {children} -
- ); + return ( +
+ {nameInfo} + {httpInfo} + {jrpcInfo} + {grpcInfo} + {showLogs && logInfo} + {executable === Executable.ValidatorNode && node?.jrpc && + } + {executable !== Executable.Templates && + handleOnStart()} + onStop={() => handleOnStop()} + onDeleteData={() => handleDeleteData()} + />} + {children} +
+ ); } function ShowInfos(params: any) { - const {nodes, logs, stdoutLogs, name, showLogs, autoRefresh, horizontal, onReload} = params; - const [state, setState] = useState<{ [key: string]: any }>({}); - let executable: Executable; - switch (name) { - case "vn": - executable = Executable.ValidatorNode; - break; - case "dan": - executable = Executable.DanWallet; - break; - case "indexer": - executable = Executable.Indexer; - break; - default: - console.log(`Unknown name ${name}`); - break; + const { nodes, logs, stdoutLogs, name, showLogs, autoRefresh, horizontal, onReload } = params; + const [state, setState] = useState<{ [key: string]: any }>({}); + let executable: Executable; + switch (name) { + case "vn": + executable = Executable.ValidatorNode; + break; + case "dan": + executable = Executable.DanWallet; + break; + case "indexer": + executable = Executable.Indexer; + break; + default: + console.log(`Unknown name ${name}`); + break; + } + const updateState = (partial_state: { name: string, state: any }) => { + if (JSON.stringify(state[partial_state.name]) != JSON.stringify(partial_state.state)) { + setState((state) => ({ ...state, [partial_state.name]: partial_state.state })); } - const updateState = (partial_state: { name: string, state: any }) => { - if (JSON.stringify(state[partial_state.name]) != JSON.stringify(partial_state.state)) { - setState((state) => ({...state, [partial_state.name]: partial_state.state})); - } - }; + }; - const sortedNodes = Object.keys(nodes).map((key) => [key, nodes[key]]); - sortedNodes.sort((a, b) => { - if (a[1].instance_id > b[1].instance_id) { - return 1; - } - if (a[1].instance_id < b[1].instance_id) { - return -1; - } - return 0; - }); + const sortedNodes = Object.keys(nodes).map((key) => [key, nodes[key]]); + sortedNodes.sort((a, b) => { + if (a[1].instance_id > b[1].instance_id) { + return 1; + } + if (a[1].instance_id < b[1].instance_id) { + return -1; + } + return 0; + }); - return ( -
- {sortedNodes.map(([key, node]) => - )} -
- ); + return ( +
+ {sortedNodes.map(([key, node]) => + )} +
+ ); } export default function Main() { - const [vns, setVns] = useState({}); - const [danWallet, setDanWallets] = useState({}); - const [indexers, setIndexers] = useState({}); - const [logs, setLogs] = useState({}); - const [stdoutLogs, setStdoutLogs] = useState({}); - const [connectorSample, setConnectorSample] = useState(null); - const [selectedFile, setSelectedFile] = useState(null); - const [showLogs, setShowLogs] = useState(false); - const [autoRefresh, setAutoRefresh] = useState(true); - const [horizontal, setHorizontal] = useState(false); - const [instances, setInstances] = useState([]); - const [isMining, setIsMining] = useState(false); - const [miningInterval, setMiningInterval] = useState(120); + const [vns, setVns] = useState({}); + const [danWallet, setDanWallets] = useState({}); + const [indexers, setIndexers] = useState({}); + const [logs, setLogs] = useState({}); + const [stdoutLogs, setStdoutLogs] = useState({}); + const [connectorSample, setConnectorSample] = useState(null); + const [selectedFile, setSelectedFile] = useState(null); + const [showLogs, setShowLogs] = useState(false); + const [autoRefresh, setAutoRefresh] = useState(true); + const [horizontal, setHorizontal] = useState(false); + const [instances, setInstances] = useState([]); + const [isMining, setIsMining] = useState(false); + const [miningInterval, setMiningInterval] = useState(120); - const getInfo = () => { - jsonRpc("vns") + const getInfo = () => { + jsonRpc("vns") + .then((resp) => { + setVns(resp.nodes); + Object.keys(resp.nodes).map((index) => { + jsonRpc("get_logs", `vn ${index}`) .then((resp) => { - setVns(resp.nodes); - Object.keys(resp.nodes).map((index) => { - jsonRpc("get_logs", `vn ${index}`) - .then((resp) => { - setLogs((state: any) => ({...state, [`vn ${index}`]: resp})); - }) - .catch((error) => console.log(error)); - jsonRpc("get_stdout", `vn ${index}`) - .then((resp) => { - setStdoutLogs((state: any) => ({...state, [`vn ${index}`]: resp})); - }) - .catch((error) => console.log(error)); - }); + setLogs((state: any) => ({ ...state, [`vn ${index}`]: resp })); }) - .catch((error) => { - console.log(error); - }); - jsonRpc("dan_wallets") + .catch((error) => console.log(error)); + jsonRpc("get_stdout", `vn ${index}`) .then((resp) => { - setDanWallets(resp.nodes); - Object.keys(resp.nodes).map((index) => { - jsonRpc("get_logs", `dan ${index}`) - .then((resp) => { - setLogs((state: any) => ({...state, [`dan ${index}`]: resp})); - }) - .catch((error) => console.log(error)); - jsonRpc("get_stdout", `dan ${index}`) - .then((resp) => { - setStdoutLogs((state: any) => ({...state, [`dan ${index}`]: resp})); - }) - .catch((error) => console.log(error)); - }); + setStdoutLogs((state: any) => ({ ...state, [`vn ${index}`]: resp })); }) - .catch((error) => { - console.log(error); - }); - jsonRpc("indexers") + .catch((error) => console.log(error)); + }); + }) + .catch((error) => { + console.log(error); + }); + jsonRpc("dan_wallets") + .then((resp) => { + setDanWallets(resp.nodes); + Object.keys(resp.nodes).map((index) => { + jsonRpc("get_logs", `dan ${index}`) .then((resp) => { - setIndexers(resp.nodes); - Object.keys(resp.nodes).map((index) => { - jsonRpc("get_logs", `indexer ${index}`) - .then((resp) => { - setLogs((state: any) => ({...state, [`indexer ${index}`]: resp})); - }) - .catch((error) => console.log(error)); - jsonRpc("get_stdout", `indexer ${index}`) - .then((resp) => { - setStdoutLogs((state: any) => ({...state, [`indexer ${index}`]: resp})); - }) - .catch((error) => console.log(error)); - }); + setLogs((state: any) => ({ ...state, [`dan ${index}`]: resp })); }) - .catch((error) => { - console.log(error); - }); - jsonRpc("http_connector") + .catch((error) => console.log(error)); + jsonRpc("get_stdout", `dan ${index}`) .then((resp) => { - setConnectorSample(resp); + setStdoutLogs((state: any) => ({ ...state, [`dan ${index}`]: resp })); }) - .catch((error) => { - console.log(error); - }); - jsonRpc("get_logs", "node").then((resp) => { - setLogs((state: any) => ({...state, node: resp})); - }); - jsonRpc("get_logs", "wallet").then((resp) => { - setLogs((state: any) => ({...state, wallet: resp})); - }); - jsonRpc("get_logs", "miner").then((resp) => { - setLogs((state: any) => ({...state, miner: resp})); + .catch((error) => console.log(error)); }); - jsonRpc("get_stdout", "node").then((resp) => { - setStdoutLogs((state: any) => ({...state, node: resp})); - }); - jsonRpc("get_stdout", "wallet").then((resp) => { - setStdoutLogs((state: any) => ({...state, wallet: resp})); - }); - jsonRpc("get_stdout", "miner").then((resp) => { - setStdoutLogs((state: any) => ({...state, miner: resp})); - }); - jsonRpc("list_instances", {by_type: null}).then(({instances}) => setInstances(instances)); - jsonRpc("is_mining", {}).then((resp: { result: boolean }) => { - setIsMining(resp.result); + }) + .catch((error) => { + console.log(error); + }); + jsonRpc("indexers") + .then((resp) => { + setIndexers(resp.nodes); + Object.keys(resp.nodes).map((index) => { + jsonRpc("get_logs", `indexer ${index}`) + .then((resp) => { + setLogs((state: any) => ({ ...state, [`indexer ${index}`]: resp })); + }) + .catch((error) => console.log(error)); + jsonRpc("get_stdout", `indexer ${index}`) + .then((resp) => { + setStdoutLogs((state: any) => ({ ...state, [`indexer ${index}`]: resp })); + }) + .catch((error) => console.log(error)); }); - }; + }) + .catch((error) => { + console.log(error); + }); + jsonRpc("http_connector") + .then((resp) => { + setConnectorSample(resp); + }) + .catch((error) => { + console.log(error); + }); + jsonRpc("get_logs", "node").then((resp) => { + setLogs((state: any) => ({ ...state, node: resp })); + }); + jsonRpc("get_logs", "wallet").then((resp) => { + setLogs((state: any) => ({ ...state, wallet: resp })); + }); + jsonRpc("get_logs", "miner").then((resp) => { + setLogs((state: any) => ({ ...state, miner: resp })); + }); + jsonRpc("get_stdout", "node").then((resp) => { + setStdoutLogs((state: any) => ({ ...state, node: resp })); + }); + jsonRpc("get_stdout", "wallet").then((resp) => { + setStdoutLogs((state: any) => ({ ...state, wallet: resp })); + }); + jsonRpc("get_stdout", "miner").then((resp) => { + setStdoutLogs((state: any) => ({ ...state, miner: resp })); + }); + jsonRpc("list_instances", { by_type: null }).then(({ instances }) => setInstances(instances)); + jsonRpc("is_mining", {}).then((resp: { result: boolean }) => { + setIsMining(resp.result); + }); + }; - useEffect(getInfo, []); + useEffect(getInfo, []); - const handleFileChange = (event: ChangeEvent) => { - const file = event.target.files?.item(0); - if (file) { - setSelectedFile(file); - } - }; + const handleFileChange = (event: ChangeEvent) => { + const file = event.target.files?.item(0); + if (file) { + setSelectedFile(file); + } + }; - const handleFileUpload = () => { - if (!selectedFile) { - return; - } - const address = import.meta.env.VITE_DAEMON_JRPC_ADDRESS || ""; //Current host - const formData = new FormData(); - formData.append("file", selectedFile); - fetch(`${address}/upload_template`, {method: "POST", body: formData}).then((resp) => { - console.log("resp", resp); - }); - }; + const handleFileUpload = () => { + if (!selectedFile) { + return; + } + const address = import.meta.env.VITE_DAEMON_JRPC_ADDRESS || ""; //Current host + const formData = new FormData(); + formData.append("file", selectedFile); + fetch(`${address}/upload_template`, { method: "POST", body: formData }).then((resp) => { + console.log("resp", resp); + }); + }; - const stopAll = () => { - jsonRpc("stop_all", {instance_type: "TariValidatorNode"}).then(getInfo); - }; + const stopAll = () => { + jsonRpc("stop_all", { instance_type: "TariValidatorNode" }).then(getInfo); + }; - const startAll = () => { - jsonRpc("start_all", {instance_type: "TariValidatorNode"}).then(getInfo); - }; + const startAll = () => { + jsonRpc("start_all", { instance_type: "TariValidatorNode" }).then(getInfo); + }; - return ( -
- - - - - -
Base layer
-
- - - - -

Periodic Mining

-
- setMiningInterval(Number(e.target.value))} - value={miningInterval}/>sec/block -
-
- - -
-
-
-
Validator Nodes
- -
-
-
Dan Wallets
- -
-
-
Indexers
- -
-
Templates
-
- - - - -
- {connectorSample && ( - - )} -
All Instances
-
- - - - - - - - - - {instances.filter((i: any) => i.is_running).map((instance: any, i: number) => - - - - )} - -
NamePortsBase Path
#{instance.id} {instance.name} ({instance.instance_type}){JSON.stringify(instance.ports)}{instance.base_path}
-
+ return ( +
+ + + + + +
Base layer
+
+ + + + +

Periodic Mining

+
+ setMiningInterval(Number(e.target.value))} + value={miningInterval} />sec/block +
+
+ + +
+
+
+
Validator Nodes
+ +
+
+
Dan Wallets
+ +
+
+
Indexers
+ +
+
Templates
+
+ + + + +
+ {connectorSample && ( + - ); + )} +
All Instances
+
+ + + + + + + + + + {instances.filter((i: any) => i.is_running).map((instance: any, i: number) => + + + + )} + +
NamePortsBase Path
#{instance.id} {instance.name} ({instance.instance_type}){JSON.stringify(instance.ports)}{instance.base_path}
+
+
+ ); } function getDecision(tx: any): string { - if (!tx) { - return "-"; - } + if (!tx) { + return "-"; + } - if (tx.remote_decision == "Abort") { - return "Abort"; - } + if (tx.remote_decision == "Abort") { + return "Abort"; + } - return tx.local_decision || tx.original_decision; + return tx.local_decision || tx.original_decision; } \ No newline at end of file diff --git a/applications/tari_validator_node/src/bootstrap.rs b/applications/tari_validator_node/src/bootstrap.rs index b348db926..d10ad7400 100644 --- a/applications/tari_validator_node/src/bootstrap.rs +++ b/applications/tari_validator_node/src/bootstrap.rs @@ -25,7 +25,7 @@ use std::{collections::HashMap, fs, io, ops::Deref, str::FromStr}; use anyhow::{anyhow, Context}; use futures::{future, FutureExt}; use libp2p::identity; -use log::info; +use log::*; use minotari_app_utilities::identity_management; use serde::Serialize; use tari_base_node_client::grpc::GrpcBaseNodeClient; @@ -222,20 +222,29 @@ pub async fn spawn_services( .context("committee size must be non-zero")?, validator_node_sidechain_id: config.validator_node.validator_node_sidechain_id.clone(), num_preshards: consensus_constants.num_preshards, - max_vns_per_epoch_activated: consensus_constants.max_vns_per_epoch_activated, }; // Epoch manager - let (epoch_manager, join_handle) = tari_epoch_manager::base_layer::spawn_service( + let (epoch_manager, epoch_manager_join_handle) = tari_epoch_manager::base_layer::spawn_service( epoch_manager_config, global_db.clone(), base_node_client.clone(), keypair.public_key().clone(), shutdown.clone(), ); - handles.push(join_handle); // Create registration file - create_registration_file(config, &epoch_manager, &keypair).await?; + if let Err(err) = create_registration_file(config, &epoch_manager, &keypair).await { + error!(target: LOG_TARGET, "Error creating registration file: {}", err); + if epoch_manager_join_handle.is_finished() { + return epoch_manager_join_handle + .await? + .and_then(|_| Err(anyhow!("Epoch manager exited in bootstrap"))) + .map_err(|err| anyhow!("Epoch manager crashed: {err}")); + } else { + return Err(err); + } + } + handles.push(epoch_manager_join_handle); info!(target: LOG_TARGET, "Template manager initializing"); // Template manager diff --git a/applications/tari_validator_node/src/json_rpc/handlers.rs b/applications/tari_validator_node/src/json_rpc/handlers.rs index 343280283..0ab0ee7a2 100644 --- a/applications/tari_validator_node/src/json_rpc/handlers.rs +++ b/applications/tari_validator_node/src/json_rpc/handlers.rs @@ -596,6 +596,26 @@ impl JsonRpcHandlers { ), ) })?; + let local_vn_start_epoch = self + .epoch_manager + .get_our_validator_node(current_epoch) + .await + .map(|vn| vn.start_epoch) + .map(Some) + .or_else(|err| { + if err.is_not_registered_error() { + Ok(None) + } else { + Err(JsonRpcResponse::error( + answer_id, + JsonRpcError::new( + JsonRpcErrorReason::InternalError, + format!("Could not get committee shard:{}", err), + json::Value::Null, + ), + )) + } + })?; let committee_info = self .epoch_manager .get_local_committee_info(current_epoch) @@ -620,6 +640,7 @@ impl JsonRpcHandlers { current_block_height, current_block_hash, is_valid: committee_info.is_some(), + start_epoch: local_vn_start_epoch, committee_info, }; Ok(JsonRpcResponse::success(answer_id, response)) diff --git a/applications/tari_watcher/src/constants.rs b/applications/tari_watcher/src/constants.rs index 9145816ad..2b99ad447 100644 --- a/applications/tari_watcher/src/constants.rs +++ b/applications/tari_watcher/src/constants.rs @@ -9,5 +9,3 @@ pub const DEFAULT_VALIDATOR_KEY_PATH: &str = "data/vn1/esmeralda/registration.js pub const DEFAULT_VALIDATOR_NODE_BINARY_PATH: &str = "target/release/tari_validator_node"; pub const DEFAULT_BASE_NODE_GRPC_URL: &str = "http://127.0.0.1:12001"; // note: protocol pub const DEFAULT_BASE_WALLET_GRPC_URL: &str = "http://127.0.0.1:12003"; // note: protocol - -pub const DEFAULT_THRESHOLD_WARN_EXPIRATION: u64 = 100; // warn at this many blocks before the registration expires diff --git a/applications/tari_watcher/src/helpers.rs b/applications/tari_watcher/src/helpers.rs index 7a23583af..ec3320a4d 100644 --- a/applications/tari_watcher/src/helpers.rs +++ b/applications/tari_watcher/src/helpers.rs @@ -6,13 +6,13 @@ use std::{ path::{Path, PathBuf}, }; -use minotari_app_grpc::tari_rpc::{ConsensusConstants, GetActiveValidatorNodesResponse}; +use minotari_app_grpc::tari_rpc::GetActiveValidatorNodesResponse; use tari_common_types::types::PublicKey; use tari_core::transactions::transaction_components::ValidatorNodeSignature; use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::ByteArray}; use tokio::fs; -use crate::{config::Config, constants::DEFAULT_THRESHOLD_WARN_EXPIRATION}; +use crate::config::Config; pub async fn read_config_file(path: PathBuf) -> anyhow::Result { let content = fs::read_to_string(&path).await.map_err(|_| { @@ -63,29 +63,3 @@ pub fn to_vn_public_keys(vns: Vec) -> Vec, needle: PublicKey) -> bool { vns.iter().any(|vn| vn.eq(&needle)) } - -pub fn is_close_to_expiry( - constants: ConsensusConstants, - current_block: u64, - last_registered_block: Option, -) -> bool { - // if we haven't registered yet in this session, return false - if last_registered_block.is_none() { - return false; - } - let epoch_length = constants.epoch_length; - let validity_period = constants.validator_node_validity_period; - let registration_duration = validity_period * epoch_length; - // check if the current block is an epoch or less away from expiring - current_block + epoch_length >= last_registered_block.unwrap() + registration_duration -} - -pub fn is_warning_close_to_expiry( - constants: ConsensusConstants, - current_block: u64, - last_registered_block: u64, -) -> bool { - let registration_duration = constants.epoch_length * constants.validator_node_validity_period; - // if we have approached the expiration threshold - current_block + DEFAULT_THRESHOLD_WARN_EXPIRATION >= last_registered_block + registration_duration -} diff --git a/applications/tari_watcher/src/main.rs b/applications/tari_watcher/src/main.rs index e0541da1a..c72839fc3 100644 --- a/applications/tari_watcher/src/main.rs +++ b/applications/tari_watcher/src/main.rs @@ -108,12 +108,9 @@ struct Handlers { } async fn spawn_manager(config: Config, shutdown: ShutdownSignal, trigger: Shutdown) -> anyhow::Result { - let (manager, mut manager_handle) = ProcessManager::new(config, shutdown, trigger); + let (manager, manager_handle) = ProcessManager::new(config, shutdown, trigger); let cr = manager.start_request_handler().await?; - let status = manager_handle.get_tip_info().await?; - // in the case the consensus constants have changed since the genesis block, use the latest ones - let constants = manager_handle.get_consensus_constants(status.height()).await?; - start_receivers(cr.rx_log, cr.rx_alert, cr.cfg_alert, constants).await; + start_receivers(cr.rx_log, cr.rx_alert, cr.cfg_alert).await; Ok(Handlers { manager: manager_handle, diff --git a/applications/tari_watcher/src/manager.rs b/applications/tari_watcher/src/manager.rs index 1c40e432c..014bed09a 100644 --- a/applications/tari_watcher/src/manager.rs +++ b/applications/tari_watcher/src/manager.rs @@ -65,7 +65,6 @@ impl ProcessManager { let cc = self.start_child_process().await; - let mut last_registered_at_block = 0; info!("Setup completed: connected to base node and wallet, ready to receive requests"); let task_handle = tokio::spawn(async move { loop { @@ -81,15 +80,6 @@ impl ProcessManager { } }; - // send latest block height to logging - if let Err(e) = cc.tx_log.send(ProcessStatus::WarnExpiration(response.height(), last_registered_at_block)).await { - error!("Failed to send tip status update to monitoring: {}", e); - } - // send latest block height to alerting - if let Err(e) = cc.tx_alert.send(ProcessStatus::WarnExpiration(response.height(), last_registered_at_block)).await { - error!("Failed to send tip status update to alerting: {}", e); - } - drop(reply.send(Ok(response))); } ManagerRequest::GetActiveValidatorNodes { reply } => { @@ -110,7 +100,6 @@ impl ProcessManager { continue; } }; - last_registered_at_block = block; // send registration response to logger if let Err(e) = cc.tx_log.send(ProcessStatus::Submitted(Transaction::new(response.clone(), block))).await { @@ -179,16 +168,14 @@ pub async fn start_receivers( rx_log: mpsc::Receiver, rx_alert: mpsc::Receiver, cfg_alert: Channels, - constants: ConsensusConstants, ) { - let const_copy = constants.clone(); // spawn logging and alerting tasks to process status updates tokio::spawn(async move { - process_status_log(rx_log, const_copy).await; + process_status_log(rx_log).await; warn!("Logging task has exited"); }); tokio::spawn(async move { - process_status_alert(rx_alert, cfg_alert, constants).await; + process_status_alert(rx_alert, cfg_alert).await; warn!("Alerting task has exited"); }); } diff --git a/applications/tari_watcher/src/monitoring.rs b/applications/tari_watcher/src/monitoring.rs index 801d921b3..dc98b5c82 100644 --- a/applications/tari_watcher/src/monitoring.rs +++ b/applications/tari_watcher/src/monitoring.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause use log::*; -use minotari_app_grpc::tari_rpc::{ConsensusConstants, RegisterValidatorNodeResponse}; +use minotari_app_grpc::tari_rpc::RegisterValidatorNodeResponse; use tokio::{ process::Child, sync::mpsc, @@ -12,7 +12,6 @@ use tokio::{ use crate::{ alerting::{Alerting, MatterMostNotifier, TelegramNotifier}, config::Channels, - helpers::is_warning_close_to_expiry, }; #[derive(Copy, Clone, Debug)] @@ -37,7 +36,6 @@ pub enum ProcessStatus { Crashed, InternalError(String), Submitted(Transaction), - WarnExpiration(u64, u64), // current block and last registered block } pub async fn monitor_child( @@ -100,7 +98,7 @@ pub async fn monitor_child( } } -pub async fn process_status_log(mut rx: mpsc::Receiver, constants: ConsensusConstants) { +pub async fn process_status_log(mut rx: mpsc::Receiver) { loop { if let Some(status) = rx.recv().await { match status { @@ -128,16 +126,6 @@ pub async fn process_status_log(mut rx: mpsc::Receiver, constants tx.id, tx.block ); }, - ProcessStatus::WarnExpiration(block, last_reg_block) => { - if is_warning_close_to_expiry(constants.clone(), block, last_reg_block) { - let expiration_block = - last_reg_block + constants.validator_node_validity_period * constants.epoch_length; - warn!( - "Validator node registration expires at block {}, current block: {}", - expiration_block, block - ); - } - }, } } } @@ -176,7 +164,7 @@ fn setup_alerting_clients(cfg: Channels) -> (Option, Option< (mattermost, telegram) } -pub async fn process_status_alert(mut rx: mpsc::Receiver, cfg: Channels, constants: ConsensusConstants) { +pub async fn process_status_alert(mut rx: mpsc::Receiver, cfg: Channels) { let (mut mattermost, mut telegram) = setup_alerting_clients(cfg); loop { @@ -249,28 +237,6 @@ pub async fn process_status_alert(mut rx: mpsc::Receiver, cfg: Ch .expect("Failed to send alert to Telegram"); } }, - ProcessStatus::WarnExpiration(block, last_reg_block) => { - if is_warning_close_to_expiry(constants.clone(), block, last_reg_block) { - let expiration_block = - last_reg_block + constants.validator_node_validity_period * constants.epoch_length; - if let Some(mm) = &mut mattermost { - mm.alert(&format!( - "Validator node registration expires at block {}, current block: {}", - expiration_block, block, - )) - .await - .expect("Failed to send alert to MatterMost"); - } - if let Some(tg) = &mut telegram { - tg.alert(&format!( - "Validator node registration expires at block {}, current block: {}", - expiration_block, block, - )) - .await - .expect("Failed to send alert to Telegram"); - } - } - }, } } } diff --git a/applications/tari_watcher/src/registration.rs b/applications/tari_watcher/src/registration.rs index 825b24643..4a7e91818 100644 --- a/applications/tari_watcher/src/registration.rs +++ b/applications/tari_watcher/src/registration.rs @@ -7,7 +7,7 @@ use tokio::time::{self, Duration, MissedTickBehavior}; use crate::{ config::Config, - helpers::{contains_key, is_close_to_expiry, read_registration_file, to_vn_public_keys}, + helpers::{contains_key, read_registration_file, to_vn_public_keys}, manager::ManagerHandle, }; @@ -22,7 +22,6 @@ pub async fn registration_loop(config: Config, mut handle: ManagerHandle) -> any let mut interval = time::interval(REGISTRATION_LOOP_INTERVAL); interval.set_missed_tick_behavior(MissedTickBehavior::Delay); let mut last_block_hash: Option = None; - let mut last_registered: Option = None; let mut recently_registered = false; loop { @@ -71,10 +70,7 @@ pub async fn registration_loop(config: Config, mut handle: ManagerHandle) -> any } // if the node is already registered and not close to expiring in the next epoch, skip registration - if contains_key(active_keys.clone(), public_key.clone()) && - !is_close_to_expiry(constants.unwrap(), current_block, last_registered) || - recently_registered - { + if contains_key(active_keys.clone(), public_key.clone()) || recently_registered { info!("VN has an active registration and will not expire in the next epoch, skip"); recently_registered = false; continue; @@ -98,7 +94,6 @@ pub async fn registration_loop(config: Config, mut handle: ManagerHandle) -> any current_block, tx.transaction_id ); - last_registered = Some(current_block); // give the network another tick to process the registration recently_registered = true; } diff --git a/bindings/dist/index.d.ts b/bindings/dist/index.d.ts index f3d1f8ad3..4ca5f8260 100644 --- a/bindings/dist/index.d.ts +++ b/bindings/dist/index.d.ts @@ -30,6 +30,7 @@ export * from "./types/EntityId"; export * from "./types/Epoch"; export * from "./types/Era"; export * from "./types/Event"; +export * from "./types/EvictNodeAtom"; export * from "./types/Evidence"; export * from "./types/ExecutedTransaction"; export * from "./types/ExecuteResult"; diff --git a/bindings/dist/index.js b/bindings/dist/index.js index c93a6eb9d..4dfb6fe4b 100644 --- a/bindings/dist/index.js +++ b/bindings/dist/index.js @@ -32,6 +32,7 @@ export * from "./types/EntityId"; export * from "./types/Epoch"; export * from "./types/Era"; export * from "./types/Event"; +export * from "./types/EvictNodeAtom"; export * from "./types/Evidence"; export * from "./types/ExecutedTransaction"; export * from "./types/ExecuteResult"; diff --git a/bindings/dist/types/EvictNodeAtom.d.ts b/bindings/dist/types/EvictNodeAtom.d.ts new file mode 100644 index 000000000..a2eb1e265 --- /dev/null +++ b/bindings/dist/types/EvictNodeAtom.d.ts @@ -0,0 +1,3 @@ +export interface EvictNodeAtom { + public_key: string; +} diff --git a/bindings/dist/types/EvictNodeAtom.js b/bindings/dist/types/EvictNodeAtom.js new file mode 100644 index 000000000..e5b481d1e --- /dev/null +++ b/bindings/dist/types/EvictNodeAtom.js @@ -0,0 +1,2 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +export {}; diff --git a/bindings/dist/types/validator-node-client/GetEpochManagerStatsResponse.d.ts b/bindings/dist/types/validator-node-client/GetEpochManagerStatsResponse.d.ts index c21f212a6..dd7351a3e 100644 --- a/bindings/dist/types/validator-node-client/GetEpochManagerStatsResponse.d.ts +++ b/bindings/dist/types/validator-node-client/GetEpochManagerStatsResponse.d.ts @@ -5,5 +5,6 @@ export interface GetEpochManagerStatsResponse { current_block_height: number; current_block_hash: string; is_valid: boolean; + start_epoch: Epoch | null; committee_info: CommitteeInfo | null; } diff --git a/bindings/dist/types/validator-node-client/ValidatorNode.d.ts b/bindings/dist/types/validator-node-client/ValidatorNode.d.ts index be534b89f..b302aa839 100644 --- a/bindings/dist/types/validator-node-client/ValidatorNode.d.ts +++ b/bindings/dist/types/validator-node-client/ValidatorNode.d.ts @@ -5,6 +5,5 @@ export interface ValidatorNode { public_key: string; shard_key: SubstateAddress; start_epoch: Epoch; - end_epoch: Epoch; fee_claim_public_key: string; } diff --git a/bindings/src/index.ts b/bindings/src/index.ts index 48f04cc35..d3345a466 100644 --- a/bindings/src/index.ts +++ b/bindings/src/index.ts @@ -33,6 +33,7 @@ export * from "./types/EntityId"; export * from "./types/Epoch"; export * from "./types/Era"; export * from "./types/Event"; +export * from "./types/EvictNodeAtom"; export * from "./types/Evidence"; export * from "./types/ExecutedTransaction"; export * from "./types/ExecuteResult"; diff --git a/bindings/src/types/EvictNodeAtom.ts b/bindings/src/types/EvictNodeAtom.ts new file mode 100644 index 000000000..b1fd2c0ce --- /dev/null +++ b/bindings/src/types/EvictNodeAtom.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface EvictNodeAtom { + public_key: string; +} diff --git a/bindings/src/types/validator-node-client/GetEpochManagerStatsResponse.ts b/bindings/src/types/validator-node-client/GetEpochManagerStatsResponse.ts index 3a835902f..1dbcbc672 100644 --- a/bindings/src/types/validator-node-client/GetEpochManagerStatsResponse.ts +++ b/bindings/src/types/validator-node-client/GetEpochManagerStatsResponse.ts @@ -7,5 +7,6 @@ export interface GetEpochManagerStatsResponse { current_block_height: number; current_block_hash: string; is_valid: boolean; + start_epoch: Epoch | null; committee_info: CommitteeInfo | null; } diff --git a/bindings/src/types/validator-node-client/ValidatorNode.ts b/bindings/src/types/validator-node-client/ValidatorNode.ts index 47efb1591..cdfcd3f6c 100644 --- a/bindings/src/types/validator-node-client/ValidatorNode.ts +++ b/bindings/src/types/validator-node-client/ValidatorNode.ts @@ -7,6 +7,5 @@ export interface ValidatorNode { public_key: string; shard_key: SubstateAddress; start_epoch: Epoch; - end_epoch: Epoch; fee_claim_public_key: string; } diff --git a/clients/base_node_client/src/grpc.rs b/clients/base_node_client/src/grpc.rs index c08d89428..316a37bd4 100644 --- a/clients/base_node_client/src/grpc.rs +++ b/clients/base_node_client/src/grpc.rs @@ -26,7 +26,12 @@ use std::convert::TryInto; use async_trait::async_trait; use log::*; -use minotari_app_grpc::tari_rpc::{self as grpc, GetShardKeyRequest}; +use minotari_app_grpc::tari_rpc::{ + self as grpc, + GetShardKeyRequest, + GetValidatorNodeChangesRequest, + ValidatorNodeChange, +}; use minotari_node_grpc_client::BaseNodeGrpcClient; use tari_common_types::types::{FixedHash, PublicKey}; use tari_core::{blocks::BlockHeader, transactions::transaction_components::CodeTemplateRegistration}; @@ -115,6 +120,28 @@ impl BaseNodeClient for GrpcBaseNodeClient { }) } + async fn get_validator_node_changes( + &mut self, + start_height: u64, + end_height: u64, + sidechain_id: Option<&PublicKey>, + ) -> Result, BaseNodeClientError> { + let client = self.connection().await?; + let result = client + .get_validator_node_changes(GetValidatorNodeChangesRequest { + start_height, + end_height, + sidechain_id: match sidechain_id { + None => vec![], + Some(sidechain_id) => sidechain_id.to_vec(), + }, + }) + .await? + .into_inner(); + + Ok(result.changes) + } + async fn get_validator_nodes(&mut self, height: u64) -> Result, BaseNodeClientError> { let inner = self.connection().await?; @@ -259,7 +286,6 @@ impl BaseNodeClient for GrpcBaseNodeClient { let result = inner.get_constants(request).await?.into_inner(); let consensus_constants = BaseLayerConsensusConstants { - validator_node_registration_expiry: result.validator_node_validity_period, epoch_length: result.epoch_length, validator_node_registration_min_deposit_amount: result .validator_node_registration_min_deposit_amount diff --git a/clients/base_node_client/src/traits.rs b/clients/base_node_client/src/traits.rs index ffbb51c09..020177b5c 100644 --- a/clients/base_node_client/src/traits.rs +++ b/clients/base_node_client/src/traits.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause use async_trait::async_trait; +use minotari_app_grpc::tari_rpc::ValidatorNodeChange; use tari_common_types::types::{FixedHash, PublicKey}; use tari_core::{blocks::BlockHeader, transactions::transaction_components::CodeTemplateRegistration}; use tari_dan_common_types::SubstateAddress; @@ -15,6 +16,12 @@ use crate::{ pub trait BaseNodeClient: Send + Sync + Clone { async fn test_connection(&mut self) -> Result<(), BaseNodeClientError>; async fn get_tip_info(&mut self) -> Result; + async fn get_validator_node_changes( + &mut self, + start_height: u64, + end_height: u64, + sidechain_id: Option<&PublicKey>, + ) -> Result, BaseNodeClientError>; async fn get_validator_nodes(&mut self, height: u64) -> Result, BaseNodeClientError>; async fn get_shard_key( &mut self, diff --git a/clients/base_node_client/src/types.rs b/clients/base_node_client/src/types.rs index b2c90a1e9..409e701a1 100644 --- a/clients/base_node_client/src/types.rs +++ b/clients/base_node_client/src/types.rs @@ -43,7 +43,6 @@ pub struct BaseLayerValidatorNode { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct BaseLayerConsensusConstants { - pub validator_node_registration_expiry: u64, pub epoch_length: u64, pub validator_node_registration_min_deposit_amount: MicroMinotari, } @@ -57,10 +56,6 @@ impl BaseLayerConsensusConstants { epoch.0 * self.epoch_length } - pub fn validator_node_registration_expiry(&self) -> Epoch { - Epoch(self.validator_node_registration_expiry) - } - pub fn validator_node_registration_min_deposit_amount(&self) -> MicroMinotari { self.validator_node_registration_min_deposit_amount } diff --git a/clients/validator_node_client/src/types.rs b/clients/validator_node_client/src/types.rs index 83916b295..4cdbba6bd 100644 --- a/clients/validator_node_client/src/types.rs +++ b/clients/validator_node_client/src/types.rs @@ -513,7 +513,6 @@ pub struct ValidatorNode { pub public_key: PublicKey, pub shard_key: SubstateAddress, pub start_epoch: Epoch, - pub end_epoch: Epoch, #[cfg_attr(feature = "ts", ts(type = "string"))] pub fee_claim_public_key: PublicKey, } @@ -525,7 +524,6 @@ impl From> for ValidatorNode { public_key: value.public_key, shard_key: value.shard_key, start_epoch: value.start_epoch, - end_epoch: value.end_epoch, fee_claim_public_key: value.fee_claim_public_key, } } @@ -675,6 +673,7 @@ pub struct GetEpochManagerStatsResponse { #[cfg_attr(feature = "ts", ts(type = "string"))] pub current_block_hash: FixedHash, pub is_valid: bool, + pub start_epoch: Option, pub committee_info: Option, } diff --git a/dan_layer/consensus/src/consensus_constants.rs b/dan_layer/consensus/src/consensus_constants.rs index fe14a366d..4eb090db7 100644 --- a/dan_layer/consensus/src/consensus_constants.rs +++ b/dan_layer/consensus/src/consensus_constants.rs @@ -45,9 +45,6 @@ pub struct ConsensusConstants { pub max_block_size: usize, /// The value that fees are divided by to determine the amount of fees to burn. 0 means no fees are burned. pub fee_exhaust_divisor: u64, - /// Maximum number of validator nodes to be activated in an epoch. - /// This is to give enough time to the network to catch up with new validator nodes and do syncing. - pub max_vns_per_epoch_activated: u64, pub epochs_per_era: Epoch, } @@ -65,7 +62,6 @@ impl ConsensusConstants { missed_proposal_recovery_threshold: 5, max_block_size: 500, fee_exhaust_divisor: 20, // 5% - max_vns_per_epoch_activated: 50, epochs_per_era: Epoch(10), } } diff --git a/dan_layer/consensus_tests/src/support/epoch_manager.rs b/dan_layer/consensus_tests/src/support/epoch_manager.rs index 863853a02..9ce5171bb 100644 --- a/dan_layer/consensus_tests/src/support/epoch_manager.rs +++ b/dan_layer/consensus_tests/src/support/epoch_manager.rs @@ -66,7 +66,6 @@ impl TestEpochManager { shard_key, registered_at_base_height: our_validator_node.registered_at_base_height, start_epoch: our_validator_node.start_epoch, - end_epoch: our_validator_node.end_epoch, fee_claim_public_key: PublicKey::default(), sidechain_id: None, }); @@ -77,7 +76,6 @@ impl TestEpochManager { shard_key, registered_at_base_height: 0, start_epoch: Epoch(0), - end_epoch: Epoch(1), fee_claim_public_key: PublicKey::default(), sidechain_id: None, }); @@ -100,7 +98,6 @@ impl TestEpochManager { None, 0, Epoch(0), - Epoch(1), ), ); state.address_shard.insert(address.clone(), shard_group); @@ -110,15 +107,13 @@ impl TestEpochManager { } } - pub async fn all_validators( - &self, - ) -> Vec<(TestAddress, ShardGroup, SubstateAddress, PublicKey, u64, Epoch, Epoch)> { + pub async fn all_validators(&self) -> Vec<(TestAddress, ShardGroup, SubstateAddress, PublicKey, u64, Epoch)> { self.state_lock() .await .validator_shards .iter() .filter_map( - |(a, (shard, substate_address, pk, sidechain_id, registered_at, start_epoch, end_epoch))| { + |(a, (shard, substate_address, pk, sidechain_id, registered_at, start_epoch))| { if sidechain_id.is_none() { Some(( a.clone(), @@ -127,7 +122,6 @@ impl TestEpochManager { pk.clone(), *registered_at, *start_epoch, - *end_epoch, )) } else { None @@ -173,7 +167,7 @@ impl EpochManagerReader for TestEpochManager { _epoch: Epoch, addr: &Self::Addr, ) -> Result, EpochManagerError> { - let (_shard, shard_key, public_key, sidechain_id, registered_at_base_height, start_epoch, end_epoch) = + let (_shard, shard_key, public_key, sidechain_id, registered_at_base_height, start_epoch) = self.state_lock().await.validator_shards[addr].clone(); Ok(ValidatorNode { @@ -182,7 +176,6 @@ impl EpochManagerReader for TestEpochManager { shard_key, registered_at_base_height, start_epoch, - end_epoch, fee_claim_public_key: PublicKey::default(), sidechain_id, }) @@ -318,10 +311,10 @@ impl EpochManagerReader for TestEpochManager { public_key: PublicKey, ) -> Result, EpochManagerError> { let lock = self.state_lock().await; - let (address, (_shard, shard_key, public_key, sidechain_id, registered_at, start_epoch, end_epoch)) = lock + let (address, (_shard, shard_key, public_key, sidechain_id, registered_at, start_epoch)) = lock .validator_shards .iter() - .find(|(_, (_, _, pk, _, _, _, _))| *pk == public_key) + .find(|(_, (_, _, pk, _, _, _))| *pk == public_key) .unwrap(); Ok(ValidatorNode { @@ -330,7 +323,6 @@ impl EpochManagerReader for TestEpochManager { shard_key: *shard_key, registered_at_base_height: *registered_at, start_epoch: *start_epoch, - end_epoch: *end_epoch, fee_claim_public_key: PublicKey::default(), sidechain_id: sidechain_id.clone(), }) @@ -353,18 +345,7 @@ pub struct TestEpochManagerState { pub last_block_of_current_epoch: FixedHash, pub is_epoch_active: bool, #[allow(clippy::type_complexity)] - pub validator_shards: HashMap< - TestAddress, - ( - ShardGroup, - SubstateAddress, - PublicKey, - Option, - u64, - Epoch, - Epoch, - ), - >, + pub validator_shards: HashMap, u64, Epoch)>, pub committees: HashMap>, pub address_shard: HashMap, } diff --git a/dan_layer/consensus_tests/src/support/harness.rs b/dan_layer/consensus_tests/src/support/harness.rs index b10c647a7..d1107f2af 100644 --- a/dan_layer/consensus_tests/src/support/harness.rs +++ b/dan_layer/consensus_tests/src/support/harness.rs @@ -537,7 +537,6 @@ impl TestBuilder { missed_proposal_recovery_threshold: 5, max_block_size: 500, fee_exhaust_divisor: 20, - max_vns_per_epoch_activated: 5, epochs_per_era: Epoch(10), }, }, @@ -610,14 +609,14 @@ impl TestBuilder { .await .into_iter() // Dont start failed nodes - .filter(|(addr, _, _, pk, _, _, _)| { + .filter(|(addr, _, _, pk, _, _)| { if failure_nodes.contains(addr) { log::info!("❗️ {addr} {pk} is a failure node and will not be spawned"); return false; } true }) - .map(|(address, shard_group, shard_addr, _, _, _, _)| { + .map(|(address, shard_group, shard_addr, _, _, _)| { let sql_address = sql_address.replace("{}", &address.0); let (sk, pk) = helpers::derive_keypair_from_address(&address); diff --git a/dan_layer/epoch_manager/src/base_layer/base_layer_epoch_manager.rs b/dan_layer/epoch_manager/src/base_layer/base_layer_epoch_manager.rs index 2f3bbc0dc..43893ce99 100644 --- a/dan_layer/epoch_manager/src/base_layer/base_layer_epoch_manager.rs +++ b/dan_layer/epoch_manager/src/base_layer/base_layer_epoch_manager.rs @@ -186,20 +186,6 @@ impl Ok(()) } - fn validator_nodes_count( - &self, - next_epoch: Epoch, - sidechain_id: Option<&PublicKey>, - ) -> Result { - let mut tx = self.global_db.create_transaction()?; - let result = self - .global_db - .validator_nodes(&mut tx) - .count_by_epoch(next_epoch, sidechain_id)?; - tx.commit()?; - Ok(result) - } - pub async fn add_validator_node_registration( &mut self, block_height: u64, @@ -213,15 +199,7 @@ impl } let constants = self.base_layer_consensus_constants().await?; - let mut next_epoch = constants.height_to_epoch(block_height) + Epoch(1); - let validator_node_expiry = constants.validator_node_registration_expiry; - - // find the next available epoch - let mut next_epoch_vn_count = self.validator_nodes_count(next_epoch, registration.sidechain_id())?; - while next_epoch_vn_count >= self.config.max_vns_per_epoch_activated { - next_epoch += Epoch(1); - next_epoch_vn_count = self.validator_nodes_count(next_epoch, registration.sidechain_id())?; - } + let next_epoch = constants.height_to_epoch(block_height) + Epoch(1); let next_epoch_height = constants.epoch_to_height(next_epoch); @@ -243,7 +221,6 @@ impl shard_key, block_height, next_epoch, - next_epoch + Epoch(validator_node_expiry), registration.claim_public_key().clone(), registration.sidechain_id().cloned(), )?; @@ -269,6 +246,28 @@ impl Ok(()) } + pub async fn remove_validator_node_registration( + &mut self, + public_key: PublicKey, + sidechain_id: Option, + ) -> Result<(), EpochManagerError> { + if sidechain_id != self.config.validator_node_sidechain_id { + return Err(EpochManagerError::ValidatorNodeRegistrationSidechainIdMismatch { + expected: self.config.validator_node_sidechain_id.as_ref().map(|v| v.to_hex()), + actual: sidechain_id.map(|v| v.to_hex()), + }); + } + info!(target: LOG_TARGET, "Remove validator node({}) registration", public_key); + + let mut tx = self.global_db.create_transaction()?; + self.global_db + .validator_nodes(&mut tx) + .remove(public_key, sidechain_id)?; + tx.commit()?; + + Ok(()) + } + fn insert_current_epoch(&mut self, epoch: Epoch, header: BlockHeader) -> Result<(), EpochManagerError> { let epoch_height = epoch.0; let db_epoch = DbEpoch { @@ -565,22 +564,6 @@ impl } } - pub async fn remaining_registration_epochs(&mut self) -> Result, EpochManagerError> { - let last_registration_epoch = match self.last_registration_epoch()? { - Some(epoch) => epoch, - None => return Ok(None), - }; - - let constants = self.get_base_layer_consensus_constants().await?; - let expiry = constants.validator_node_registration_expiry(); - - // Note this can be negative in some cases - let num_blocks_since_last_reg = self.current_epoch.saturating_sub(last_registration_epoch); - - // None indicates that we are not registered, or a previous registration has expired - Ok(expiry.checked_sub(num_blocks_since_last_reg)) - } - pub fn get_our_validator_node(&self, epoch: Epoch) -> Result, EpochManagerError> { let vn = self .get_validator_node_by_public_key(epoch, &self.node_public_key)? diff --git a/dan_layer/epoch_manager/src/base_layer/config.rs b/dan_layer/epoch_manager/src/base_layer/config.rs index fee3cd129..e332d9335 100644 --- a/dan_layer/epoch_manager/src/base_layer/config.rs +++ b/dan_layer/epoch_manager/src/base_layer/config.rs @@ -12,7 +12,4 @@ pub struct EpochManagerConfig { pub committee_size: NonZeroU32, pub validator_node_sidechain_id: Option, pub num_preshards: NumPreshards, - /// Maximum number of validator nodes to be activated in an epoch. - /// This is to give enough time to the network to catch up with new validator nodes and do syncing. - pub max_vns_per_epoch_activated: u64, } diff --git a/dan_layer/epoch_manager/src/base_layer/epoch_manager_service.rs b/dan_layer/epoch_manager/src/base_layer/epoch_manager_service.rs index 84c474c41..e9d7249c9 100644 --- a/dan_layer/epoch_manager/src/base_layer/epoch_manager_service.rs +++ b/dan_layer/epoch_manager/src/base_layer/epoch_manager_service.rs @@ -23,7 +23,7 @@ use log::{error, info, trace}; use tari_base_node_client::grpc::GrpcBaseNodeClient; use tari_common_types::types::PublicKey; -use tari_dan_common_types::{DerivableFromPublicKey, NodeAddressable}; +use tari_dan_common_types::{optional::IsNotFoundError, DerivableFromPublicKey, NodeAddressable}; use tari_dan_storage::global::GlobalDb; use tari_dan_storage_sqlite::global::SqliteGlobalDbAdapter; use tari_shutdown::ShutdownSignal; @@ -74,7 +74,6 @@ impl pub async fn run(&mut self, mut shutdown: ShutdownSignal) -> Result<(), EpochManagerError> { info!(target: LOG_TARGET, "Starting epoch manager"); - info!(target: LOG_TARGET, "Loading initial state"); // first, load initial state self.inner.load_initial_state().await?; @@ -204,6 +203,17 @@ impl .await, context, ), + EpochManagerRequest::RemoveValidatorNodeRegistration { + public_key, + sidechain_id, + reply, + } => handle( + reply, + self.inner + .remove_validator_node_registration(public_key, sidechain_id) + .await, + context, + ), // TODO: This should be rather be a state machine event EpochManagerRequest::NotifyScanningComplete { reply } => { handle(reply, self.inner.on_scanning_complete().await, context) @@ -211,9 +221,6 @@ impl EpochManagerRequest::WaitForInitialScanningToComplete { reply } => { self.inner.add_notify_on_scanning_complete(reply); }, - EpochManagerRequest::RemainingRegistrationEpochs { reply } => { - handle(reply, self.inner.remaining_registration_epochs().await, context) - }, EpochManagerRequest::GetBaseLayerConsensusConstants { reply } => handle( reply, self.inner.get_base_layer_consensus_constants().await.cloned(), @@ -265,7 +272,10 @@ fn handle( context: &str, ) { if let Err(ref e) = result { - error!(target: LOG_TARGET, "Request {} failed with error: {}", context, e); + // These responses are not errors + if !e.is_not_registered_error() && !e.is_not_found_error() { + error!(target: LOG_TARGET, "Request {} failed with error: {}", context, e); + } } if reply.send(result).is_err() { error!(target: LOG_TARGET, "Requester abandoned request"); diff --git a/dan_layer/epoch_manager/src/base_layer/handle.rs b/dan_layer/epoch_manager/src/base_layer/handle.rs index 5717ca78d..4f78e449a 100644 --- a/dan_layer/epoch_manager/src/base_layer/handle.rs +++ b/dan_layer/epoch_manager/src/base_layer/handle.rs @@ -92,16 +92,6 @@ impl EpochManagerHandle { rx.await.map_err(|_| EpochManagerError::ReceiveError)? } - /// Returns the number of epochs remaining for the current registration if registered, otherwise None - pub async fn remaining_registration_epochs(&self) -> Result, EpochManagerError> { - let (tx, rx) = oneshot::channel(); - self.tx_request - .send(EpochManagerRequest::RemainingRegistrationEpochs { reply: tx }) - .await - .map_err(|_| EpochManagerError::SendError)?; - rx.await.map_err(|_| EpochManagerError::ReceiveError)? - } - pub async fn add_validator_node_registration( &self, block_height: u64, @@ -121,6 +111,23 @@ impl EpochManagerHandle { rx.await.map_err(|_| EpochManagerError::ReceiveError)? } + pub async fn remove_validator_node_registration( + &self, + public_key: PublicKey, + sidechain_id: Option, + ) -> Result<(), EpochManagerError> { + let (tx, rx) = oneshot::channel(); + self.tx_request + .send(EpochManagerRequest::RemoveValidatorNodeRegistration { + public_key, + sidechain_id, + reply: tx, + }) + .await + .map_err(|_| EpochManagerError::SendError)?; + rx.await.map_err(|_| EpochManagerError::ReceiveError)? + } + pub async fn current_block_info(&self) -> Result<(u64, FixedHash), EpochManagerError> { let (tx, rx) = oneshot::channel(); self.tx_request diff --git a/dan_layer/epoch_manager/src/base_layer/types.rs b/dan_layer/epoch_manager/src/base_layer/types.rs index 951c73e0b..3f96e706c 100644 --- a/dan_layer/epoch_manager/src/base_layer/types.rs +++ b/dan_layer/epoch_manager/src/base_layer/types.rs @@ -54,6 +54,11 @@ pub enum EpochManagerRequest { value: MicroMinotari, reply: Reply<()>, }, + RemoveValidatorNodeRegistration { + public_key: PublicKey, + sidechain_id: Option, + reply: Reply<()>, + }, AddBlockHash { block_height: u64, block_hash: FixedHash, @@ -99,9 +104,6 @@ pub enum EpochManagerRequest { WaitForInitialScanningToComplete { reply: Reply<()>, }, - RemainingRegistrationEpochs { - reply: Reply>, - }, GetBaseLayerConsensusConstants { reply: Reply, }, diff --git a/dan_layer/storage/src/global/backend_adapter.rs b/dan_layer/storage/src/global/backend_adapter.rs index ef564c55d..f01a40e6f 100644 --- a/dan_layer/storage/src/global/backend_adapter.rs +++ b/dan_layer/storage/src/global/backend_adapter.rs @@ -84,10 +84,17 @@ pub trait GlobalDbAdapter: AtomicDb + Send + Sync + Clone { shard_key: SubstateAddress, registered_at_base_height: u64, start_epoch: Epoch, - end_epoch: Epoch, fee_claim_public_key: PublicKey, sidechain_id: Option, ) -> Result<(), Self::Error>; + + fn remove_validator_node( + &self, + tx: &mut Self::DbTransaction<'_>, + public_key: PublicKey, + sidechain_id: Option, + ) -> Result<(), Self::Error>; + fn get_validator_nodes_within_epoch( &self, tx: &mut Self::DbTransaction<'_>, diff --git a/dan_layer/storage/src/global/models/validator_node.rs b/dan_layer/storage/src/global/models/validator_node.rs index 42038c1e0..59bf9036a 100644 --- a/dan_layer/storage/src/global/models/validator_node.rs +++ b/dan_layer/storage/src/global/models/validator_node.rs @@ -13,7 +13,6 @@ pub struct ValidatorNode { pub shard_key: SubstateAddress, pub registered_at_base_height: u64, pub start_epoch: Epoch, - pub end_epoch: Epoch, pub fee_claim_public_key: PublicKey, pub sidechain_id: Option, } diff --git a/dan_layer/storage/src/global/validator_node_db.rs b/dan_layer/storage/src/global/validator_node_db.rs index 1647dd444..74aa616a1 100644 --- a/dan_layer/storage/src/global/validator_node_db.rs +++ b/dan_layer/storage/src/global/validator_node_db.rs @@ -44,7 +44,6 @@ impl<'a, 'tx, TGlobalDbAdapter: GlobalDbAdapter> ValidatorNodeDb<'a, 'tx, TGloba shard_key: SubstateAddress, registered_at_base_height: u64, start_epoch: Epoch, - end_epoch: Epoch, fee_claim_public_key: PublicKey, sidechain_id: Option, ) -> Result<(), TGlobalDbAdapter::Error> { @@ -56,26 +55,25 @@ impl<'a, 'tx, TGlobalDbAdapter: GlobalDbAdapter> ValidatorNodeDb<'a, 'tx, TGloba shard_key, registered_at_base_height, start_epoch, - end_epoch, fee_claim_public_key, sidechain_id, ) .map_err(TGlobalDbAdapter::Error::into) } - pub fn count(&mut self, epoch: Epoch, sidechain_id: Option<&PublicKey>) -> Result { + pub fn remove( + &mut self, + public_key: PublicKey, + sidechain_id: Option, + ) -> Result<(), TGlobalDbAdapter::Error> { self.backend - .validator_nodes_count(self.tx, epoch, sidechain_id) + .remove_validator_node(self.tx, public_key, sidechain_id) .map_err(TGlobalDbAdapter::Error::into) } - pub fn count_by_epoch( - &mut self, - epoch: Epoch, - sidechain_id: Option<&PublicKey>, - ) -> Result { + pub fn count(&mut self, epoch: Epoch, sidechain_id: Option<&PublicKey>) -> Result { self.backend - .validator_nodes_count_by_start_epoch(self.tx, epoch, sidechain_id) + .validator_nodes_count(self.tx, epoch, sidechain_id) .map_err(TGlobalDbAdapter::Error::into) } diff --git a/dan_layer/storage_sqlite/migrations/2022-09-30-212244_create_vns_and_committees/up.sql b/dan_layer/storage_sqlite/migrations/2022-09-30-212244_create_vns_and_committees/up.sql index 1c69f48f6..0cb895abb 100644 --- a/dan_layer/storage_sqlite/migrations/2022-09-30-212244_create_vns_and_committees/up.sql +++ b/dan_layer/storage_sqlite/migrations/2022-09-30-212244_create_vns_and_committees/up.sql @@ -26,7 +26,6 @@ create table validator_nodes public_key blob not null, shard_key blob not null, registered_at_base_height bigint not null, - start_epoch bigint not null, - end_epoch bigint not null + start_epoch bigint not null ); diff --git a/dan_layer/storage_sqlite/migrations/2024-04-12-000000_create_committes/up.sql b/dan_layer/storage_sqlite/migrations/2024-04-12-000000_create_committes/up.sql index 155281236..54fb867fb 100644 --- a/dan_layer/storage_sqlite/migrations/2024-04-12-000000_create_committes/up.sql +++ b/dan_layer/storage_sqlite/migrations/2024-04-12-000000_create_committes/up.sql @@ -5,7 +5,7 @@ CREATE TABLE committees epoch BIGINT NOT NULL, shard_start INTEGER NOT NULL, shard_end INTEGER NOT NULL, - FOREIGN KEY (validator_node_id) REFERENCES validator_nodes (id) + FOREIGN KEY (validator_node_id) REFERENCES validator_nodes (id) ON DELETE CASCADE ); CREATE INDEX committees_validator_node_id_epoch_index ON committees (validator_node_id, epoch); diff --git a/dan_layer/storage_sqlite/src/global/backend_adapter.rs b/dan_layer/storage_sqlite/src/global/backend_adapter.rs index 42c3bca4d..0a8aeb7a7 100644 --- a/dan_layer/storage_sqlite/src/global/backend_adapter.rs +++ b/dan_layer/storage_sqlite/src/global/backend_adapter.rs @@ -79,7 +79,7 @@ use crate::{ TemplateModel, TemplateUpdateModel, }, - schema::templates, + schema::{templates, validator_nodes::dsl::validator_nodes}, serialization::serialize_json, }, SqliteTransaction, @@ -368,7 +368,6 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { shard_key: SubstateAddress, registered_at_base_height: u64, start_epoch: Epoch, - end_epoch: Epoch, fee_claim_public_key: PublicKey, sidechain_id: Option, ) -> Result<(), Self::Error> { @@ -382,7 +381,6 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { validator_nodes::shard_key.eq(shard_key.as_bytes()), validator_nodes::registered_at_base_height.eq(registered_at_base_height as i64), validator_nodes::start_epoch.eq(start_epoch.as_u64() as i64), - validator_nodes::end_epoch.eq(end_epoch.as_u64() as i64), validator_nodes::fee_claim_public_key.eq(ByteArray::as_bytes(&fee_claim_public_key)), validator_nodes::sidechain_id.eq(sidechain_id.as_ref().map(|id| id.as_bytes()).unwrap_or(&[0u8; 32])), )) @@ -395,6 +393,30 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { Ok(()) } + fn remove_validator_node( + &self, + tx: &mut Self::DbTransaction<'_>, + public_key: PublicKey, + sidechain_id: Option, + ) -> Result<(), Self::Error> { + use crate::global::schema::validator_nodes; + diesel::delete( + validator_nodes + .filter( + validator_nodes::sidechain_id + .eq(sidechain_id.as_ref().map(|id| id.as_bytes()).unwrap_or(&[0u8; 32])), + ) + .filter(validator_nodes::public_key.eq(ByteArray::as_bytes(&public_key))), + ) + .execute(tx.connection()) + .map_err(|source| SqliteStorageError::DieselError { + source, + operation: "remove::validator_nodes".to_string(), + })?; + + Ok(()) + } + fn get_validator_node_by_address( &self, tx: &mut Self::DbTransaction<'_>, @@ -411,13 +433,11 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { validator_nodes::shard_key, validator_nodes::registered_at_base_height, validator_nodes::start_epoch, - validator_nodes::end_epoch, validator_nodes::fee_claim_public_key, validator_nodes::address, validator_nodes::sidechain_id, )) .filter(validator_nodes::start_epoch.le(epoch.as_u64() as i64)) - .filter(validator_nodes::end_epoch.gt(epoch.as_u64() as i64)) .filter(validator_nodes::address.eq(serialize_json(address)?)) .filter(validator_nodes::sidechain_id.eq(sidechain_id.map(ByteArray::as_bytes).unwrap_or(&[0u8; 32]))) .order_by(validator_nodes::registered_at_base_height.desc()) @@ -442,7 +462,6 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { let vn = validator_nodes::table .filter(validator_nodes::start_epoch.le(epoch.as_u64() as i64)) - .filter(validator_nodes::end_epoch.gt(epoch.as_u64() as i64)) .filter(validator_nodes::public_key.eq(ByteArray::as_bytes(public_key))) .filter(validator_nodes::sidechain_id.eq(sidechain_id.map(ByteArray::as_bytes).unwrap_or(&[0u8; 32]))) .order_by(validator_nodes::registered_at_base_height.desc()) @@ -465,11 +484,9 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { let db_sidechain_id = sidechain_id.map(|id| id.as_bytes()).unwrap_or(&[0u8; 32]); let count = sql_query( - "SELECT COUNT(distinct public_key) as cnt FROM validator_nodes WHERE start_epoch <= ? AND end_epoch >= ? \ - AND sidechain_id = ?", + "SELECT COUNT(distinct public_key) as cnt FROM validator_nodes WHERE start_epoch <= ? AND sidechain_id = ?", ) .bind::(epoch.as_u64() as i64) - .bind::(epoch.as_u64() as i64) .bind::(db_sidechain_id) .get_result::(tx.connection()) .map_err(|source| SqliteStorageError::DieselError { @@ -585,7 +602,6 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { .select(validator_nodes::id) .filter(validator_nodes::shard_key.eq(shard_key.as_bytes())) .filter(validator_nodes::start_epoch.le(epoch.as_u64() as i64)) - .filter(validator_nodes::end_epoch.gt(epoch.as_u64() as i64)) .filter(validator_nodes::sidechain_id.eq(db_sidechain_id)) .order_by(validator_nodes::registered_at_base_height.desc()) .first::(tx.connection()) @@ -627,13 +643,11 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { validator_nodes::shard_key, validator_nodes::registered_at_base_height, validator_nodes::start_epoch, - validator_nodes::end_epoch, validator_nodes::fee_claim_public_key, validator_nodes::address, validator_nodes::sidechain_id )) .filter(validator_nodes::start_epoch.le(epoch.as_u64() as i64)) - .filter(validator_nodes::end_epoch.gt(epoch.as_u64() as i64)) // SQLite compares BLOB types using memcmp which, IIRC, compares bytes "left to right"/big-endian which is // the same way convert shard IDs to 256-bit integers when allocating committee shards. .filter(validator_nodes::shard_key.ge(shard_range.start().as_bytes())) @@ -706,13 +720,11 @@ impl GlobalDbAdapter for SqliteGlobalDbAdapter { validator_nodes::shard_key, validator_nodes::registered_at_base_height, validator_nodes::start_epoch, - validator_nodes::end_epoch, validator_nodes::fee_claim_public_key, validator_nodes::address, validator_nodes::sidechain_id, )) .filter(validator_nodes::start_epoch.le(epoch.as_u64() as i64)) - .filter(validator_nodes::end_epoch.gt(epoch.as_u64() as i64)) .filter(validator_nodes::sidechain_id.eq(db_sidechain_id)) .get_results::(tx.connection()) .map_err(|source| SqliteStorageError::DieselError { diff --git a/dan_layer/storage_sqlite/src/global/models/validator_node.rs b/dan_layer/storage_sqlite/src/global/models/validator_node.rs index 4ee014a7d..df882967a 100644 --- a/dan_layer/storage_sqlite/src/global/models/validator_node.rs +++ b/dan_layer/storage_sqlite/src/global/models/validator_node.rs @@ -38,7 +38,6 @@ pub struct DbValidatorNode { pub shard_key: Vec, pub registered_at_base_height: i64, pub start_epoch: i64, - pub end_epoch: i64, pub fee_claim_public_key: Vec, pub address: String, pub sidechain_id: Vec, @@ -57,7 +56,6 @@ impl TryFrom for ValidatorNode { })?, registered_at_base_height: vn.registered_at_base_height as u64, start_epoch: Epoch(vn.start_epoch as u64), - end_epoch: Epoch(vn.end_epoch as u64), fee_claim_public_key: PublicKey::from_canonical_bytes(&vn.fee_claim_public_key).map_err(|_| { SqliteStorageError::MalformedDbData(format!( "Invalid fee claim public key in validator node record id={}", diff --git a/dan_layer/storage_sqlite/src/global/schema.rs b/dan_layer/storage_sqlite/src/global/schema.rs index 46544e178..e3cc6ffb8 100644 --- a/dan_layer/storage_sqlite/src/global/schema.rs +++ b/dan_layer/storage_sqlite/src/global/schema.rs @@ -63,7 +63,6 @@ diesel::table! { shard_key -> Binary, registered_at_base_height -> BigInt, start_epoch -> BigInt, - end_epoch -> BigInt, fee_claim_public_key -> Binary, address -> Text, sidechain_id -> Binary, diff --git a/dan_layer/storage_sqlite/tests/global_db.rs b/dan_layer/storage_sqlite/tests/global_db.rs index cbfd68289..aa91c3570 100644 --- a/dan_layer/storage_sqlite/tests/global_db.rs +++ b/dan_layer/storage_sqlite/tests/global_db.rs @@ -35,13 +35,7 @@ fn insert_vns( sidechain_id: Option, ) { for _ in 0..num { - insert_vn_with_public_key( - validator_nodes, - new_public_key(), - epoch, - epoch + Epoch(1), - sidechain_id.clone(), - ) + insert_vn_with_public_key(validator_nodes, new_public_key(), epoch, sidechain_id.clone()) } } @@ -49,7 +43,6 @@ fn insert_vn_with_public_key( validator_nodes: &mut ValidatorNodeDb<'_, '_, SqliteGlobalDbAdapter>, public_key: PublicKey, start_epoch: Epoch, - end_epoch: Epoch, sidechain_id: Option, ) { validator_nodes @@ -59,7 +52,6 @@ fn insert_vn_with_public_key( derived_substate_address(&public_key), 0, start_epoch, - end_epoch, public_key, sidechain_id, ) @@ -94,7 +86,7 @@ fn change_committee_shard_group() { let mut tx = db.create_transaction().unwrap(); let mut validator_nodes = db.validator_nodes(&mut tx); let pk = new_public_key(); - insert_vn_with_public_key(&mut validator_nodes, pk.clone(), Epoch(0), Epoch(4), None); + insert_vn_with_public_key(&mut validator_nodes, pk.clone(), Epoch(0), None); set_committee_shard_group(&mut validator_nodes, &pk, ShardGroup::new(1, 2), Epoch(0)); set_committee_shard_group(&mut validator_nodes, &pk, ShardGroup::new(3, 4), Epoch(1)); set_committee_shard_group(&mut validator_nodes, &pk, ShardGroup::new(7, 8), Epoch(2)); diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 0c8ee9f2f..adc217766 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -45,7 +45,7 @@ tari_comms = { git = "https://github.com/tari-project/tari.git", branch = "featu tari_comms_dht = { git = "https://github.com/tari-project/tari.git", branch = "feature-dan2" } anyhow = { workspace = true } -# if we set this version in the workspace it would break other crates +# if we set this version in the workspace it would break other crates base64 = "0.21.0" config = { workspace = true } cucumber = { workspace = true, features = ["default", "libtest", "output-junit"] } diff --git a/integration_tests/src/base_node.rs b/integration_tests/src/base_node.rs index ae933ff03..8b4623fe8 100644 --- a/integration_tests/src/base_node.rs +++ b/integration_tests/src/base_node.rs @@ -132,6 +132,7 @@ pub async fn spawn_base_node(world: &mut TariWorld, bn_name: String) { GrpcMethod::GetTemplateRegistrations, GrpcMethod::GetHeaderByHash, GrpcMethod::GetSideChainUtxos, + GrpcMethod::GetValidatorNodeChanges, ] .into(); diff --git a/integration_tests/tests/features/claim_burn.feature b/integration_tests/tests/features/claim_burn.feature index bcac12f76..d1ad22ae2 100644 --- a/integration_tests/tests/features/claim_burn.feature +++ b/integration_tests/tests/features/claim_burn.feature @@ -6,7 +6,6 @@ Feature: Claim Burn @concurrent # @serial @fixed - @doit Scenario: Claim base layer burn funds with wallet daemon # Initialize a base node, wallet, miner and VN Given a base node BASE @@ -18,8 +17,8 @@ Feature: Claim Burn When miner MINER mines 4 new blocks When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks - Then VN has scanned to height 17 + When miner MINER mines 26 new blocks + Then VN has scanned to height 27 Then the validator node VN is listed as registered # Initialize an indexer @@ -36,7 +35,7 @@ Feature: Claim Burn # unfortunately have to wait for this to get into the mempool.... Then there is 1 transaction in the mempool of BASE within 10 seconds When miner MINER mines 13 new blocks - Then VN has scanned to height 30 + Then VN has scanned to height 40 When I convert commitment COMMITMENT into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds @@ -57,8 +56,8 @@ Feature: Claim Burn When miner MINER mines 4 new blocks When wallet WALLET has at least 10000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks - Then VN has scanned to height 17 + When miner MINER mines 26 new blocks + Then VN has scanned to height 27 Then the validator node VN is listed as registered # Initialize an indexer @@ -75,7 +74,7 @@ Feature: Claim Burn # unfortunately have to wait for this to get into the mempool.... Then there is 1 transaction in the mempool of BASE within 10 seconds When miner MINER mines 13 new blocks - Then VN has scanned to height 30 + Then VN has scanned to height 40 When I convert commitment COMMITMENT into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds diff --git a/integration_tests/tests/features/committee.feature b/integration_tests/tests/features/committee.feature index bd2fac12f..c26fce759 100644 --- a/integration_tests/tests/features/committee.feature +++ b/integration_tests/tests/features/committee.feature @@ -28,9 +28,9 @@ Feature: Committee scenarios # Register the "counter" template When base wallet WALLET registers the template "counter" - When miner MINER mines 15 new blocks - Then VAL_1 has scanned to height 18 - Then VAL_2 has scanned to height 18 + When miner MINER mines 25 new blocks + Then VAL_1 has scanned to height 28 + Then VAL_2 has scanned to height 28 Then the validator node VAL_1 is listed as registered Then the validator node VAL_2 is listed as registered Then the template "counter" is listed as registered by the validator node VAL_1 diff --git a/integration_tests/tests/features/concurrency.feature b/integration_tests/tests/features/concurrency.feature index cdea04e27..1f0e7c32e 100644 --- a/integration_tests/tests/features/concurrency.feature +++ b/integration_tests/tests/features/concurrency.feature @@ -20,7 +20,7 @@ Feature: Concurrency When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -30,7 +30,7 @@ Feature: Concurrency # Register the "counter" template When base wallet WALLET registers the template "counter" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 # Create the sender account When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins diff --git a/integration_tests/tests/features/counter.feature b/integration_tests/tests/features/counter.feature index 2b899a42e..8a6347dde 100644 --- a/integration_tests/tests/features/counter.feature +++ b/integration_tests/tests/features/counter.feature @@ -19,7 +19,7 @@ Feature: Counter template When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -29,7 +29,7 @@ Feature: Counter template # Register the "counter" template When base wallet WALLET registers the template "counter" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 # Create the sender account When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins @@ -44,7 +44,7 @@ Feature: Counter template # Check that the counter has been increased When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "1" - + Scenario: Counter template registration and invocation multiple times # Initialize a base node, wallet, miner and VN @@ -59,7 +59,7 @@ Feature: Counter template When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -69,7 +69,7 @@ Feature: Counter template # Register the "counter" template When base wallet WALLET registers the template "counter" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 # Create the sender account When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins diff --git a/integration_tests/tests/features/epoch_change.feature b/integration_tests/tests/features/epoch_change.feature index 05d3ab420..9e431d409 100644 --- a/integration_tests/tests/features/epoch_change.feature +++ b/integration_tests/tests/features/epoch_change.feature @@ -24,8 +24,8 @@ Feature: Epoch change When base wallet WALLET registers the template "faucet" # Mine them into registered epoch - When miner MINER mines 16 new blocks - Then VAL has scanned to height 19 + When miner MINER mines 26 new blocks + Then VAL has scanned to height 29 Then the validator node VAL is listed as registered Then the template "faucet" is listed as registered by the validator node VAL @@ -42,8 +42,8 @@ Feature: Epoch change When Block count on VN VAL is at least 6 When miner MINER mines 5 new blocks - Then VAL has scanned to height 24 - Then the validator node VAL switches to epoch 2 + Then VAL has scanned to height 34 + Then the validator node VAL has ended epoch 2 # @serial # Scenario: Committee is split into two during epoch change diff --git a/integration_tests/tests/features/fungible.feature b/integration_tests/tests/features/fungible.feature index 67d3dff67..0c10677c9 100644 --- a/integration_tests/tests/features/fungible.feature +++ b/integration_tests/tests/features/fungible.feature @@ -4,7 +4,7 @@ @concurrent @fungible Feature: Fungible tokens - + Scenario: Mint fungible tokens ##### Setup @@ -20,7 +20,7 @@ Feature: Fungible tokens When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -30,7 +30,7 @@ Feature: Fungible tokens # Register the "faucet" template When base wallet WALLET registers the template "faucet" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 Then the template "faucet" is listed as registered by the validator node VN ##### Scenario diff --git a/integration_tests/tests/features/indexer.feature b/integration_tests/tests/features/indexer.feature index e40a4bccd..afd1dead7 100644 --- a/integration_tests/tests/features/indexer.feature +++ b/integration_tests/tests/features/indexer.feature @@ -20,7 +20,7 @@ Feature: Indexer node When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -31,7 +31,7 @@ Feature: Indexer node When base wallet WALLET registers the template "counter" When base wallet WALLET registers the template "basic_nft" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 Then the template "counter" is listed as registered by the validator node VN Then the template "basic_nft" is listed as registered by the validator node VN @@ -113,7 +113,7 @@ Feature: Indexer node When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -145,7 +145,7 @@ Feature: Indexer node When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -155,7 +155,7 @@ Feature: Indexer node # Register template When base wallet WALLET registers the template "faucet" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 Then the template "faucet" is listed as registered by the validator node VN When I create an account ACC_1 via the wallet daemon WALLET_D with 10000 free coins diff --git a/integration_tests/tests/features/nft.feature b/integration_tests/tests/features/nft.feature index 1fbe8bf36..1e8ebf72a 100644 --- a/integration_tests/tests/features/nft.feature +++ b/integration_tests/tests/features/nft.feature @@ -20,7 +20,7 @@ Feature: NFTs When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -30,7 +30,7 @@ Feature: NFTs # Register the "basic_nft" template When base wallet WALLET registers the template "basic_nft" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 Then the template "basic_nft" is listed as registered by the validator node VN ###### Scenario @@ -93,7 +93,7 @@ Feature: NFTs When miner MINER mines 10 new blocks When wallet WALLET has at least 2000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize indexer and connect wallet daemon @@ -104,7 +104,7 @@ Feature: NFTs # Register the "basic_nft" template When base wallet WALLET registers the template "basic_nft" When miner MINER mines 20 new blocks - Then VN has scanned to height 43 + Then VN has scanned to height 53 Then the template "basic_nft" is listed as registered by the validator node VN diff --git a/integration_tests/tests/features/state_sync.feature b/integration_tests/tests/features/state_sync.feature index 9a59d66d1..be480296d 100644 --- a/integration_tests/tests/features/state_sync.feature +++ b/integration_tests/tests/features/state_sync.feature @@ -21,9 +21,9 @@ Feature: State Sync When miner MINER mines 4 new blocks When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks - Then VN has scanned to height 17 - And indexer IDX has scanned to height 17 + When miner MINER mines 26 new blocks + Then VN has scanned to height 27 + And indexer IDX has scanned to height 27 Then the validator node VN is listed as registered When indexer IDX connects to all other validators @@ -42,17 +42,17 @@ Feature: State Sync When indexer IDX connects to all other validators When validator node VN2 sends a registration transaction to base wallet WALLET - When miner MINER mines 20 new blocks - Then VN has scanned to height 37 - Then VN2 has scanned to height 37 + When miner MINER mines 23 new blocks + Then VN has scanned to height 50 + Then VN2 has scanned to height 50 Then the validator node VN2 is listed as registered - When I wait for validator VN has leaf block height of at least 1 at epoch 3 - When I wait for validator VN2 has leaf block height of at least 1 at epoch 3 + When I wait for validator VN has leaf block height of at least 1 at epoch 5 + When I wait for validator VN2 has leaf block height of at least 1 at epoch 5 When I create an account UNUSED4 via the wallet daemon WALLET_D When I create an account UNUSED5 via the wallet daemon WALLET_D - When I wait for validator VN has leaf block height of at least 5 at epoch 3 - When I wait for validator VN2 has leaf block height of at least 5 at epoch 3 + When I wait for validator VN has leaf block height of at least 5 at epoch 5 + When I wait for validator VN2 has leaf block height of at least 5 at epoch 5 diff --git a/integration_tests/tests/features/substates.feature b/integration_tests/tests/features/substates.feature index 2c9601b15..82b3d18a6 100644 --- a/integration_tests/tests/features/substates.feature +++ b/integration_tests/tests/features/substates.feature @@ -23,8 +23,8 @@ Feature: Substates # Register the "counter" template When base wallet WALLET registers the template "counter" - When miner MINER mines 13 new blocks - Then VAL_1 has scanned to height 16 + When miner MINER mines 23 new blocks + Then VAL_1 has scanned to height 26 Then the validator node VAL_1 is listed as registered Then the template "counter" is listed as registered by the validator node VAL_1 diff --git a/integration_tests/tests/features/transfer.feature b/integration_tests/tests/features/transfer.feature index e24da39c8..04f021dbb 100644 --- a/integration_tests/tests/features/transfer.feature +++ b/integration_tests/tests/features/transfer.feature @@ -16,7 +16,7 @@ Feature: Account transfers When miner MINER mines 4 new blocks When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize an indexer @@ -31,8 +31,8 @@ Feature: Account transfers When miner MINER mines 15 new blocks Then the validator node VN is listed as registered Then the template "faucet" is listed as registered by the validator node VN - Then VN has scanned to height 32 - Then indexer IDX has scanned to height 32 + Then VN has scanned to height 42 + Then indexer IDX has scanned to height 42 # Create the sender account When I create an account ACCOUNT via the wallet daemon WALLET_D with 10000 free coins @@ -43,8 +43,8 @@ Feature: Account transfers # Burn some tari in the base layer to have funds for fees in the sender account When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACCOUNT, range proof RANGEPROOF and claim public key CLAIM_PUBKEY When miner MINER mines 13 new blocks - Then VN has scanned to height 45 - Then indexer IDX has scanned to height 45 + Then VN has scanned to height 55 + Then indexer IDX has scanned to height 55 When I convert commitment COMMITMENT into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds @@ -93,7 +93,7 @@ Feature: Account transfers When miner MINER mines 4 new blocks When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize an indexer @@ -109,8 +109,8 @@ Feature: Account transfers Then the validator node VN is listed as registered Then the template "faucet" is listed as registered by the validator node VN - Then VN has scanned to height 32 - Then indexer IDX has scanned to height 32 + Then VN has scanned to height 42 + Then indexer IDX has scanned to height 42 # Create the sender account with some tokens When I create an account ACCOUNT_1 via the wallet daemon WALLET_D with 10000 free coins @@ -122,8 +122,8 @@ Feature: Account transfers # Burn some tari in the base layer to have funds for fees in the sender account When I burn 10T on wallet WALLET with wallet daemon WALLET_D into commitment COMMITMENT with proof PROOF for ACCOUNT_1, range proof RANGEPROOF and claim public key CLAIM_PUBKEY When miner MINER mines 13 new blocks - Then VN has scanned to height 45 - Then indexer IDX has scanned to height 45 + Then VN has scanned to height 55 + Then indexer IDX has scanned to height 55 When I convert commitment COMMITMENT into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds @@ -168,7 +168,7 @@ Feature: Account transfers When miner MINER mines 4 new blocks When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize an indexer @@ -177,8 +177,8 @@ Feature: Account transfers # Initialize the wallet daemon Given a wallet daemon WALLET_D connected to indexer IDX - Then VN has scanned to height 17 - Then indexer IDX has scanned to height 17 + Then VN has scanned to height 27 + Then indexer IDX has scanned to height 27 # Create the sender account When I create an account ACC_1 via the wallet daemon WALLET_D with 10000 free coins diff --git a/integration_tests/tests/features/wallet_daemon.feature b/integration_tests/tests/features/wallet_daemon.feature index cc08fe4d8..b66294733 100644 --- a/integration_tests/tests/features/wallet_daemon.feature +++ b/integration_tests/tests/features/wallet_daemon.feature @@ -20,8 +20,8 @@ Feature: Wallet Daemon # VN registration When validator node VAL_1 sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks - Then VAL_1 has scanned to height 17 + When miner MINER mines 26 new blocks + Then VAL_1 has scanned to height 27 Then the validator node VAL_1 is listed as registered # Initialize an indexer @@ -35,8 +35,8 @@ Feature: Wallet Daemon # Mine some blocks until the UTXOs are scanned When miner MINER mines 5 new blocks - Then VAL_1 has scanned to height 22 - Then indexer IDX has scanned to height 22 + Then VAL_1 has scanned to height 32 + Then indexer IDX has scanned to height 32 Then the template "faucet" is listed as registered by the validator node VAL_1 # Create two accounts to test sending the tokens @@ -96,7 +96,7 @@ Feature: Wallet Daemon When miner MINER mines 4 new blocks When wallet WALLET has at least 5000 T When validator node VN sends a registration transaction to base wallet WALLET - When miner MINER mines 16 new blocks + When miner MINER mines 26 new blocks Then the validator node VN is listed as registered # Initialize an indexer @@ -114,7 +114,7 @@ Feature: Wallet Daemon # unfortunately have to wait for this to get into the mempool.... Then there is 1 transaction in the mempool of BASE within 10 seconds When miner MINER mines 13 new blocks - Then VN has scanned to height 30 + Then VN has scanned to height 40 When I convert commitment COMMITMENT into COMM_ADDRESS address Then validator node VN has state at COMM_ADDRESS within 20 seconds @@ -126,7 +126,7 @@ Feature: Wallet Daemon When I check the confidential balance of ACCOUNT_1 on wallet daemon WALLET_D the amount is at least 10000 # When account ACCOUNT_1 reveals 100 burned tokens via wallet daemon WALLET_D Then I make a confidential transfer with amount 5 from ACCOUNT_1 to ACCOUNT_2 creating output OUTPUT_TX1 via the wallet_daemon WALLET_D - + Scenario: Create and mint account NFT # Initialize a base node, wallet, miner and VN Given a network with registered validator VAL_1 and wallet daemon WALLET_D diff --git a/integration_tests/tests/steps/network.rs b/integration_tests/tests/steps/network.rs index 69f741806..3d50daf1c 100644 --- a/integration_tests/tests/steps/network.rs +++ b/integration_tests/tests/steps/network.rs @@ -41,6 +41,6 @@ async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: S miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 6).await; wallet::check_balance(world, WALLET_NAME.to_string(), 20, "T".to_string()).await; validator_node::send_vn_registration_with_claim_wallet(world, vn_name.clone(), WALLET_NAME.to_string()).await; - miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 16).await; + miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 26).await; validator_node::assert_vn_is_registered(world, vn_name).await; } diff --git a/integration_tests/tests/steps/validator_node.rs b/integration_tests/tests/steps/validator_node.rs index dbb13df2b..e3033ce2e 100644 --- a/integration_tests/tests/steps/validator_node.rs +++ b/integration_tests/tests/steps/validator_node.rs @@ -246,10 +246,10 @@ pub async fn assert_vn_is_registered(world: &mut TariWorld, vn_name: String) { loop { // wait for the validator to pick up the registration let stats = client.get_epoch_manager_stats().await.unwrap(); - if stats.current_block_height >= height || stats.is_valid { + if stats.current_block_height >= height || stats.committee_info.is_some() { break; } - if count > 10 { + if count > 20 { panic!("Timed out waiting for validator node to pick up registration"); } count += 1; @@ -495,7 +495,7 @@ async fn when_count(world: &mut TariWorld, vn_name: String, count: u64) { panic!("Block count on VN {vn_name} is less than {count}"); } -#[then(expr = "the validator node {word} switches to epoch {int}")] +#[then(expr = "the validator node {word} has ended epoch {int}")] async fn then_validator_node_switches_epoch(world: &mut TariWorld, vn_name: String, epoch: u64) { let vn = world.get_validator_node(&vn_name); let mut client = vn.create_client(); @@ -506,18 +506,17 @@ async fn then_validator_node_switches_epoch(world: &mut TariWorld, vn_name: Stri offset: 0, ordering_index: None, ordering: None, - filter_index: None, - filter: None, + filter_index: Some(1), + filter: Some(epoch.to_string()), }) .await .unwrap(); let blocks = list_block.blocks; assert!( - blocks.iter().all(|b| b.epoch().as_u64() <= epoch), + blocks.iter().all(|b| b.epoch().as_u64() <= epoch + 1), "Epoch is greater than expected" ); - if blocks.iter().any(|b| b.epoch().as_u64() == epoch) { - assert!(blocks.iter().any(|b| b.is_epoch_end()), "No end epoch block found"); + if blocks.iter().any(|b| b.epoch().as_u64() == epoch && b.is_epoch_end()) { return; }