From 535a0caf41efc48a8065301bf35954b8b97943a2 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Tue, 18 Jun 2024 20:06:39 -0700 Subject: [PATCH] net: AddName, app_store & kns_indexer: update process_lib, integrations --- Cargo.lock | 361 ++++++++++++++++-- .../packages/app_store/app_store/Cargo.toml | 6 +- .../packages/app_store/app_store/src/state.rs | 22 +- kinode/packages/app_store/pkg/manifest.json | 3 +- .../kimap_indexer/kimap_indexer/Cargo.toml | 2 +- .../kimap_indexer/kimap_indexer/src/lib.rs | 7 + kinode/src/net/mod.rs | 3 + lib/src/core.rs | 6 + 8 files changed, 360 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3a8ee460..f6651bd5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,20 +101,39 @@ dependencies = [ "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-network", - "alloy-provider", + "alloy-network 0.1.0", + "alloy-provider 0.1.0", "alloy-pubsub", - "alloy-rpc-client", + "alloy-rpc-client 0.1.0", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-signer", + "alloy-signer 0.1.0", "alloy-signer-wallet", "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-transport-http", + "alloy-transport-http 0.1.0", "alloy-transport-ws", "reqwest 0.12.4", ] +[[package]] +name = "alloy" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bcb4400a1939e5633939a58500c67123ef5f2e8920e5009d6949552f191be7f" +dependencies = [ + "alloy-consensus 0.1.1", + "alloy-core", + "alloy-eips 0.1.1", + "alloy-genesis 0.1.1", + "alloy-json-rpc 0.1.1", + "alloy-provider 0.1.1", + "alloy-rpc-client 0.1.1", + "alloy-rpc-types 0.1.1", + "alloy-serde 0.1.1", + "alloy-transport-http 0.1.1", + "reqwest 0.12.4", +] + [[package]] name = "alloy-chains" version = "0.1.18" @@ -152,6 +171,20 @@ dependencies = [ "sha2", ] +[[package]] +name = "alloy-consensus" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cc7579e4fb5558af44810f542c90d1145dba8b92c08211c215196160c48d2ea" +dependencies = [ + "alloy-eips 0.1.1", + "alloy-primitives", + "alloy-rlp", + "alloy-serde 0.1.1", + "c-kzg", + "serde", +] + [[package]] name = "alloy-contract" version = "0.1.0" @@ -159,9 +192,9 @@ source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f dependencies = [ "alloy-dyn-abi", "alloy-json-abi", - "alloy-network", + "alloy-network 0.1.0", "alloy-primitives", - "alloy-provider", + "alloy-provider 0.1.0", "alloy-pubsub", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-sol-types", @@ -173,9 +206,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b8b8d8c4e84449ce8f310ed48e09ce38b8290b163e3d0df68ea445a9ccce3a" +checksum = "5af3faff14c12c8b11037e0a093dd157c3702becb8435577a2408534d0758315" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -185,9 +218,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd2404399cb1b50572758e66e9b4bf088e5a3df9007be7126456c7e50af935f" +checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -227,6 +260,21 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-eips" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bdbc8d98cc36ebe17bb5b42d0873137bc76628a4ee0f7e7acad5b8fc59d3597" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "alloy-serde 0.1.1", + "c-kzg", + "once_cell", + "serde", + "sha2", +] + [[package]] name = "alloy-genesis" version = "0.1.0" @@ -249,10 +297,22 @@ dependencies = [ ] [[package]] -name = "alloy-json-abi" -version = "0.7.5" +name = "alloy-genesis" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3abf6446a292e19853aaca43590eeb48bf435dfd2c74200259e8f4872f6ce3" +checksum = "5e10a047066076b32d52b3228e95a4f7793db7a204f648aa1a1ea675085bffd8" +dependencies = [ + "alloy-primitives", + "alloy-serde 0.1.1", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-abi" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -284,6 +344,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "alloy-json-rpc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d06d33b79246313c4103ef9596c721674a926f1ddc8b605aa2bac4d8ba94ee34" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "alloy-network" version = "0.1.0" @@ -294,7 +367,27 @@ dependencies = [ "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-primitives", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-signer", + "alloy-signer 0.1.0", + "alloy-sol-types", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "thiserror", +] + +[[package]] +name = "alloy-network" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef742b478a2db5c27063cde82128dfbecffcd38237d7f682a91d3ecf6aa1836c" +dependencies = [ + "alloy-consensus 0.1.1", + "alloy-eips 0.1.1", + "alloy-json-rpc 0.1.1", + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde 0.1.1", + "alloy-signer 0.1.1", "alloy-sol-types", "async-trait", "auto_impl", @@ -304,9 +397,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277af0cbcc483ee6ad2c1e818090b5928d27f04fd6580680f31c1cf8068bcc2" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" dependencies = [ "alloy-rlp", "bytes", @@ -333,14 +426,14 @@ dependencies = [ "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-network", + "alloy-network 0.1.0", "alloy-primitives", "alloy-pubsub", - "alloy-rpc-client", + "alloy-rpc-client 0.1.0", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "alloy-rpc-types-trace", "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-transport-http", + "alloy-transport-http 0.1.0", "alloy-transport-ws", "async-stream", "async-trait", @@ -358,6 +451,38 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-provider" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200b786259a17acf318b9c423afe9669bec24ce9cdf59de153ff9a4009914bb6" +dependencies = [ + "alloy-chains", + "alloy-consensus 0.1.1", + "alloy-eips 0.1.1", + "alloy-json-rpc 0.1.1", + "alloy-network 0.1.1", + "alloy-primitives", + "alloy-rpc-client 0.1.1", + "alloy-rpc-types-eth", + "alloy-transport 0.1.1", + "alloy-transport-http 0.1.1", + "async-stream", + "async-trait", + "auto_impl", + "dashmap", + "futures", + "futures-utils-wasm", + "lru", + "pin-project", + "reqwest 0.12.4", + "serde", + "serde_json", + "tokio", + "tracing", + "url", +] + [[package]] name = "alloy-pubsub" version = "0.1.0" @@ -407,7 +532,7 @@ dependencies = [ "alloy-primitives", "alloy-pubsub", "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-transport-http", + "alloy-transport-http 0.1.0", "alloy-transport-ws", "futures", "pin-project", @@ -421,6 +546,27 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-rpc-client" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "328a6a14aba6152ddf6d01bac5e17a70dbe9d6f343bf402b995c30bac63a1fbf" +dependencies = [ + "alloy-json-rpc 0.1.1", + "alloy-transport 0.1.1", + "alloy-transport-http 0.1.1", + "futures", + "pin-project", + "reqwest 0.12.4", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", + "url", +] + [[package]] name = "alloy-rpc-types" version = "0.1.0" @@ -457,6 +603,34 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-rpc-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3164e7d8a718a22ede70b2c1d2bb554a8b4bd8e56c07ab630b75c74c06c53752" +dependencies = [ + "alloy-rpc-types-eth", + "alloy-serde 0.1.1", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bce0676f144be1eae71122d1d417885a3b063add0353b35e46cdf1440d6b33b1" +dependencies = [ + "alloy-consensus 0.1.1", + "alloy-eips 0.1.1", + "alloy-primitives", + "alloy-rlp", + "alloy-serde 0.1.1", + "alloy-sol-types", + "itertools 0.13.0", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "alloy-rpc-types-trace" version = "0.1.0" @@ -489,6 +663,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "alloy-serde" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c224916316519558d8c2b6a60dc7626688c08f1b8951774702562dbcb8666ee" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + [[package]] name = "alloy-signer" version = "0.1.0" @@ -502,15 +687,29 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-signer" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "227c5fd0ed6e06e1ccc30593f8ff6d9fb907ac5f03a709a6d687f0943494a229" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve", + "k256", + "thiserror", +] + [[package]] name = "alloy-signer-wallet" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", - "alloy-network", + "alloy-network 0.1.0", "alloy-primitives", - "alloy-signer", + "alloy-signer 0.1.0", "async-trait", "k256", "rand 0.8.5", @@ -519,9 +718,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30708a79919b082f2692423c8cc72fc250477e4a2ecb0d4a7244cd3cdb299965" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -533,9 +732,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a679ac01774ab7e00a567a918d4231ae692c5c8cedaf4e16956c3116d7896" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -552,9 +751,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356da0c2228aa6675a5faaa08a3e4061b967f924753983d72b9a18d9a3fad44e" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" dependencies = [ "alloy-json-abi", "const-hex", @@ -569,18 +768,18 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fd4783b0a5840479013e9ce960d2eb7b3be381f722e0fe3d1f7c3bb6bd4ebd" +checksum = "baa2fbd22d353d8685bd9fee11ba2d8b5c3b1d11e56adb3265fcf1f32bfdf404" dependencies = [ "winnow 0.6.6", ] [[package]] name = "alloy-sol-types" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb5e6234c0b62514992589fe1578f64d418dbc8ef5cd1ab2d7f2f568f599698" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -625,6 +824,24 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "alloy-transport" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3628d81530263fe837a09cd527022f5728202a669973f04270942f4d390b5f5" +dependencies = [ + "alloy-json-rpc 0.1.1", + "base64 0.22.0", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "url", +] + [[package]] name = "alloy-transport-http" version = "0.1.0" @@ -639,6 +856,21 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-transport-http" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f35d34e7a51503c9ff267404a5850bd58f991b7ab524b892f364901e3576376" +dependencies = [ + "alloy-json-rpc 0.1.1", + "alloy-transport 0.1.1", + "reqwest 0.12.4", + "serde_json", + "tower", + "tracing", + "url", +] + [[package]] name = "alloy-transport-ws" version = "0.1.0" @@ -738,7 +970,7 @@ dependencies = [ "alloy-sol-types", "anyhow", "bincode", - "kinode_process_lib 0.8.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.8.0)", + "kinode_process_lib 0.8.3 (git+https://github.com/kinode-dao/process_lib?rev=40a7a60)", "rand 0.8.5", "serde", "serde_json", @@ -3063,6 +3295,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -3186,7 +3427,7 @@ dependencies = [ "anyhow", "bincode", "hex", - "kinode_process_lib 0.8.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.8.0)", + "kinode_process_lib 0.8.3 (git+https://github.com/kinode-dao/process_lib?rev=c8442ef)", "rmp-serde", "serde", "serde_json", @@ -3198,7 +3439,7 @@ name = "kinode" version = "0.8.0" dependencies = [ "aes-gcm", - "alloy", + "alloy 0.1.0", "alloy-primitives", "alloy-sol-macro", "alloy-sol-types", @@ -3314,6 +3555,50 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "kinode_process_lib" +version = "0.8.3" +source = "git+https://github.com/kinode-dao/process_lib?rev=40a7a60#40a7a60528df14585aab717c6c0f78aff5f74dd2" +dependencies = [ + "alloy 0.1.1", + "alloy-primitives", + "alloy-sol-macro", + "alloy-sol-types", + "anyhow", + "bincode", + "http 1.1.0", + "mime_guess", + "rand 0.8.5", + "rmp-serde", + "serde", + "serde_json", + "thiserror", + "url", + "wit-bindgen", +] + +[[package]] +name = "kinode_process_lib" +version = "0.8.3" +source = "git+https://github.com/kinode-dao/process_lib?rev=c8442ef#c8442ef6e0f6aefc1d8caa30b32a991303da8dd9" +dependencies = [ + "alloy 0.1.1", + "alloy-primitives", + "alloy-sol-macro", + "alloy-sol-types", + "anyhow", + "bincode", + "http 1.1.0", + "mime_guess", + "rand 0.8.5", + "rmp-serde", + "serde", + "serde_json", + "thiserror", + "url", + "wit-bindgen", +] + [[package]] name = "kit" version = "0.4.2" @@ -5371,9 +5656,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fe08d08d84f2c0a77f1e7c46518789d745c2e87a2721791ed7c3c9bc78df28" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" dependencies = [ "paste", "proc-macro2", diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index 0a5d2319..01bd7bdd 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" simulation-mode = [] [dependencies] -alloy-primitives = "0.7.0" -alloy-sol-types = "0.7.0" +alloy-primitives = "0.7.6" +alloy-sol-types = "0.7.6" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.0" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "40a7a60" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/app_store/app_store/src/state.rs b/kinode/packages/app_store/app_store/src/state.rs index 5e84df90..ba8258a5 100644 --- a/kinode/packages/app_store/app_store/src/state.rs +++ b/kinode/packages/app_store/app_store/src/state.rs @@ -3,7 +3,9 @@ use crate::{utils, DownloadRequest, LocalRequest}; use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::kernel_types::Erc721Metadata; use kinode_process_lib::{ - eth, kernel_types as kt, net, println, vfs, Address, Message, NodeId, PackageId, Request, + eth, kernel_types as kt, + net::{self, get_name}, + println, vfs, Address, Message, NodeId, PackageId, Request, }; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; @@ -231,7 +233,7 @@ impl State { } self.downloaded_packages .insert(package_id.to_owned(), package_state); - kinode_process_lib::set_state(&serde_json::to_vec(self)?); + // kinode_process_lib::set_state(&serde_json::to_vec(self)?); Ok(()) } @@ -249,7 +251,7 @@ impl State { true }) .unwrap_or(false); - kinode_process_lib::set_state(&serde_json::to_vec(self).unwrap()); + // kinode_process_lib::set_state(&serde_json::to_vec(self).unwrap()); res } @@ -353,7 +355,7 @@ impl State { pub fn uninstall(&mut self, package_id: &PackageId) -> anyhow::Result<()> { utils::uninstall(package_id)?; self.downloaded_packages.remove(package_id); - kinode_process_lib::set_state(&serde_json::to_vec(self)?); + // kinode_process_lib::set_state(&serde_json::to_vec(self)?); println!("uninstalled {package_id}"); Ok(()) } @@ -379,9 +381,15 @@ impl State { .map_err(|_| AppStoreLogError::DecodeLogError)?; // get package_name from the api (add to process_lib)! - // let node_name = get_name(note.nodehash)?; + let name = get_name(¬e.nodehash.to_string(), None).map_err(|e| { + println!("Error decoding name: {:?}", e); + AppStoreLogError::DecodeLogError + })?; let note_str = String::from_utf8_lossy(¬e.note).to_string(); + + println!("got note {note_str} for {name}"); + match note_str.as_str() { "metadata-uri" => { let _metadata_url = String::from_utf8_lossy(¬e.data).to_string(); @@ -553,7 +561,7 @@ impl State { } self.last_saved_block = block_number; if update_listings { - kinode_process_lib::set_state(&serde_json::to_vec(self).unwrap()); + // kinode_process_lib::set_state(&serde_json::to_vec(self).unwrap()); } Ok(()) } @@ -575,7 +583,7 @@ impl State { } } } - kinode_process_lib::set_state(&serde_json::to_vec(self).unwrap()); + // kinode_process_lib::set_state(&serde_json::to_vec(self).unwrap()); } } diff --git a/kinode/packages/app_store/pkg/manifest.json b/kinode/packages/app_store/pkg/manifest.json index 14181b63..3c7fff86 100644 --- a/kinode/packages/app_store/pkg/manifest.json +++ b/kinode/packages/app_store/pkg/manifest.json @@ -33,6 +33,7 @@ ], "grant_capabilities": [ "eth:distro:sys", + "net:distro:sys", "http_client:distro:sys", "http_server:distro:sys", "kns_indexer:kns_indexer:sys", @@ -41,4 +42,4 @@ ], "public": false } -] \ No newline at end of file +] diff --git a/kinode/packages/kimap_indexer/kimap_indexer/Cargo.toml b/kinode/packages/kimap_indexer/kimap_indexer/Cargo.toml index ff0e0143..5fdc8e5a 100644 --- a/kinode/packages/kimap_indexer/kimap_indexer/Cargo.toml +++ b/kinode/packages/kimap_indexer/kimap_indexer/Cargo.toml @@ -12,7 +12,7 @@ alloy-primitives = "0.7.0" alloy-sol-types = "0.7.0" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.8.0" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "c8442ef" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/kimap_indexer/kimap_indexer/src/lib.rs b/kinode/packages/kimap_indexer/kimap_indexer/src/lib.rs index cfb4303d..0ed2d669 100644 --- a/kinode/packages/kimap_indexer/kimap_indexer/src/lib.rs +++ b/kinode/packages/kimap_indexer/kimap_indexer/src/lib.rs @@ -330,6 +330,13 @@ fn handle_log( routers: Vec::new(), }); + Request::new() + .target((&our.node, "net", "distro", "sys")) + .body(rmp_serde::to_vec(&net::NetAction::AddName( + child_hash, + name.clone(), + ))?) + .send()?; node = Some(name); } Note::SIGNATURE_HASH => { diff --git a/kinode/src/net/mod.rs b/kinode/src/net/mod.rs index d4a64189..8dfc5cce 100644 --- a/kinode/src/net/mod.rs +++ b/kinode/src/net/mod.rs @@ -172,6 +172,9 @@ async fn handle_local_request( utils::ingest_log(log, &data.pki, &data.names); } } + Ok(NetAction::AddName(hash, name)) => { + data.names.insert(hash, name); + } Ok(gets) => { let (response_body, response_blob) = match gets { NetAction::GetPeers => ( diff --git a/lib/src/core.rs b/lib/src/core.rs index 3f8ce517..fa7dd6e9 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1817,6 +1817,10 @@ pub enum TimerAction { // networking protocol types // +// TODO: granular caps. +// "root": ConnectionRequest, KnsUpdate, KnsBatchUpdate, AddName, Sign? +// note: AddName is for no KnsEntry but still want to add a namehash + /// Must be parsed from message pack vector. /// all Get actions must be sent from local process. used for debugging #[derive(Clone, Debug, Serialize, Deserialize)] @@ -1829,6 +1833,8 @@ pub enum NetAction { /// in the future could get from remote provider KnsUpdate(KnsUpdate), KnsBatchUpdate(Vec), + /// add a (namehash -> name) to our representation of the PKI + AddName(String, String), /// get a list of peers we are connected to GetPeers, /// get the [`Identity`] struct for a single peer