mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-22 03:04:35 +03:00
Merge branch 'develop' into dr/settings-page
This commit is contained in:
commit
258cb2c7df
367
Cargo.lock
generated
367
Cargo.lock
generated
@ -78,7 +78,7 @@ name = "alias"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -90,36 +90,85 @@ version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
||||
|
||||
[[package]]
|
||||
name = "alloy-consensus"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=cad7935)",
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-rlp",
|
||||
"alloy-serde",
|
||||
"c-kzg",
|
||||
"serde",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eips"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-rlp",
|
||||
"serde",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eips"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-rlp",
|
||||
"alloy-serde",
|
||||
"c-kzg",
|
||||
"once_cell",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-genesis"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-serde",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-json-rpc"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-primitives 0.6.4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-json-rpc"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-primitives 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-network"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
"alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-rlp",
|
||||
"serde",
|
||||
]
|
||||
@ -146,17 +195,39 @@ dependencies = [
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-primitives"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99bbad0a6b588ef4aec1b5ddbbfdacd9ef04e00b979617765b03174318ee1f3a"
|
||||
dependencies = [
|
||||
"alloy-rlp",
|
||||
"bytes",
|
||||
"cfg-if",
|
||||
"const-hex",
|
||||
"derive_more",
|
||||
"hex-literal",
|
||||
"itoa",
|
||||
"k256",
|
||||
"keccak-asm",
|
||||
"proptest",
|
||||
"rand 0.8.5",
|
||||
"ruint",
|
||||
"serde",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-providers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-network",
|
||||
"alloy-primitives",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-rpc-client",
|
||||
"alloy-rpc-trace-types",
|
||||
"alloy-rpc-types",
|
||||
"alloy-transport",
|
||||
"alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-transport-http",
|
||||
"async-trait",
|
||||
"auto_impl",
|
||||
@ -170,9 +241,9 @@ name = "alloy-pubsub"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
"alloy-transport",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"bimap",
|
||||
"futures",
|
||||
"serde",
|
||||
@ -209,10 +280,10 @@ name = "alloy-rpc-client"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-pubsub",
|
||||
"alloy-transport",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-transport-http",
|
||||
"alloy-transport-ws",
|
||||
"futures",
|
||||
@ -230,8 +301,8 @@ name = "alloy-rpc-trace-types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
@ -241,7 +312,7 @@ name = "alloy-rpc-types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-rlp",
|
||||
"itertools 0.12.1",
|
||||
"serde",
|
||||
@ -249,13 +320,41 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=cad7935)",
|
||||
"alloy-genesis",
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-rlp",
|
||||
"alloy-serde",
|
||||
"alloy-sol-types 0.7.0",
|
||||
"itertools 0.12.1",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-serde"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-primitives 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-signer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-network",
|
||||
"alloy-primitives",
|
||||
"alloy-primitives 0.6.4",
|
||||
"async-trait",
|
||||
"auto_impl",
|
||||
"elliptic-curve",
|
||||
@ -278,18 +377,63 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.60",
|
||||
"syn-solidity",
|
||||
"syn-solidity 0.6.4",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-macro"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "452d929748ac948a10481fff4123affead32c553cf362841c5103dd508bdfc16"
|
||||
dependencies = [
|
||||
"alloy-sol-macro-input",
|
||||
"const-hex",
|
||||
"heck 0.4.1",
|
||||
"indexmap",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.60",
|
||||
"syn-solidity 0.7.0",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-macro-input"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df64e094f6d2099339f9e82b5b38440b159757b6920878f28316243f8166c8d1"
|
||||
dependencies = [
|
||||
"const-hex",
|
||||
"dunce",
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.60",
|
||||
"syn-solidity 0.7.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-types"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad09ec5853fa700d12d778ad224dcdec636af424d29fad84fb9a2f16a5b0ef09"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-macro",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-sol-macro 0.6.4",
|
||||
"const-hex",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-types"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43bc2d6dfc2a19fd56644494479510f98b1ee929e04cf0d4aa45e98baa3e545b"
|
||||
dependencies = [
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-sol-macro 0.7.0",
|
||||
"const-hex",
|
||||
"serde",
|
||||
]
|
||||
@ -299,7 +443,7 @@ name = "alloy-transport"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"base64 0.21.7",
|
||||
"futures-util",
|
||||
"serde",
|
||||
@ -311,13 +455,31 @@ dependencies = [
|
||||
"wasm-bindgen-futures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa"
|
||||
dependencies = [
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=cad7935)",
|
||||
"base64 0.22.0",
|
||||
"futures-util",
|
||||
"futures-utils-wasm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tower",
|
||||
"url",
|
||||
"wasm-bindgen-futures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport-http"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-transport",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"reqwest 0.11.27",
|
||||
"serde_json",
|
||||
"tower",
|
||||
@ -330,7 +492,7 @@ version = "0.1.0"
|
||||
source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08"
|
||||
dependencies = [
|
||||
"alloy-pubsub",
|
||||
"alloy-transport",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"futures",
|
||||
"http 0.2.12",
|
||||
"serde_json",
|
||||
@ -417,13 +579,13 @@ checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
|
||||
|
||||
[[package]]
|
||||
name = "app_store"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-types",
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-sol-types 0.7.0",
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -778,6 +940,18 @@ dependencies = [
|
||||
"generic-array 0.14.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blst"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"glob",
|
||||
"threadpool",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.16.0"
|
||||
@ -826,6 +1000,20 @@ dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "c-kzg"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3130f3d8717cc02e668a896af24984d5d5d4e8bf12e278e982e0f1bd88a0f9af"
|
||||
dependencies = [
|
||||
"blst",
|
||||
"cc",
|
||||
"glob",
|
||||
"hex",
|
||||
"libc",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cap-fs-ext"
|
||||
version = "3.0.0"
|
||||
@ -908,7 +1096,7 @@ name = "cat"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -966,12 +1154,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chess"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.0",
|
||||
"bincode",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"pleco",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -1683,7 +1871,7 @@ name = "download"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -1714,7 +1902,7 @@ name = "echo"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -1934,7 +2122,7 @@ version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -2042,6 +2230,12 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-utils-wasm"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9"
|
||||
|
||||
[[package]]
|
||||
name = "fxhash"
|
||||
version = "0.2.1"
|
||||
@ -2088,7 +2282,7 @@ dependencies = [
|
||||
name = "get_block"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -2288,7 +2482,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
|
||||
name = "hi"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -2314,11 +2508,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "homepage"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -2629,7 +2823,7 @@ name = "install"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -2788,17 +2982,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kinode"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"alloy-primitives",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-providers",
|
||||
"alloy-pubsub",
|
||||
"alloy-rpc-client",
|
||||
"alloy-rpc-types",
|
||||
"alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-signer",
|
||||
"alloy-sol-macro",
|
||||
"alloy-sol-types",
|
||||
"alloy-sol-macro 0.6.4",
|
||||
"alloy-sol-types 0.6.4",
|
||||
"alloy-transport-ws",
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -2861,7 +3055,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kinode_lib"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
dependencies = [
|
||||
"lib",
|
||||
]
|
||||
@ -2871,10 +3065,10 @@ name = "kinode_process_lib"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/kinode-dao/process_lib?rev=84b3d84#84b3d84c7c31185f15691a288f1b45dbffb18fe2"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types",
|
||||
"alloy-transport",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-primitives 0.6.4",
|
||||
"alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"http 1.1.0",
|
||||
@ -2889,13 +3083,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kinode_process_lib"
|
||||
version = "0.6.1"
|
||||
source = "git+https://github.com/kinode-dao/process_lib?tag=v0.6.1#37a20b0249dc2c86ae6c2c69cfb199fb177f1520"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/kinode-dao/process_lib?tag=v0.7.0#b7c0abee62df683e6c78069c87072a1d52602408"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types",
|
||||
"alloy-transport",
|
||||
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=cad7935)",
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=cad7935)",
|
||||
"alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=cad7935)",
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"http 1.1.0",
|
||||
@ -2945,14 +3139,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kns_indexer"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-types",
|
||||
"alloy-primitives 0.7.0",
|
||||
"alloy-sol-types 0.7.0",
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"hex",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -2979,9 +3173,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
|
||||
|
||||
[[package]]
|
||||
name = "lib"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
dependencies = [
|
||||
"alloy-rpc-types",
|
||||
"alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||
"anyhow",
|
||||
"kit",
|
||||
"lazy_static",
|
||||
@ -3153,7 +3347,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -3285,7 +3479,7 @@ dependencies = [
|
||||
name = "namehash_to_name"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"wit-bindgen",
|
||||
@ -3313,7 +3507,7 @@ dependencies = [
|
||||
name = "net_diagnostics"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"wit-bindgen",
|
||||
@ -3606,7 +3800,7 @@ dependencies = [
|
||||
name = "peer"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"wit-bindgen",
|
||||
@ -3616,7 +3810,7 @@ dependencies = [
|
||||
name = "peers"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"wit-bindgen",
|
||||
@ -4843,7 +5037,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
name = "state"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -4924,6 +5118,18 @@ dependencies = [
|
||||
"syn 2.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn-solidity"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4497156948bd342b52038035a6fa514a89626e37af9d2c52a5e8d8ebcc7ee479"
|
||||
dependencies = [
|
||||
"paste",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
@ -4993,11 +5199,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "terminal"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"rand 0.8.5",
|
||||
"regex",
|
||||
"serde",
|
||||
@ -5011,7 +5217,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
@ -5020,12 +5226,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tester"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"indexmap",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
@ -5062,6 +5268,15 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "threadpool"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
|
||||
dependencies = [
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.36"
|
||||
@ -5257,7 +5472,7 @@ name = "top"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
@ -5579,7 +5794,7 @@ name = "uninstall"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"kinode_process_lib 0.6.1",
|
||||
"kinode_process_lib 0.7.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "kinode_lib"
|
||||
authors = ["KinodeDAO"]
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
edition = "2021"
|
||||
description = "A general-purpose sovereign cloud computing platform"
|
||||
homepage = "https://kinode.org"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "kinode"
|
||||
authors = ["KinodeDAO"]
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
edition = "2021"
|
||||
description = "A general-purpose sovereign cloud computing platform"
|
||||
homepage = "https://kinode.org"
|
||||
|
@ -1,17 +1,17 @@
|
||||
[package]
|
||||
name = "app_store"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
alloy-primitives = "0.6.2"
|
||||
alloy-sol-types = "0.6.2"
|
||||
alloy-primitives = "0.7.0"
|
||||
alloy-sol-types = "0.7.0"
|
||||
anyhow = "1.0"
|
||||
bincode = "1.3.3"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rand = "0.8"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -41,6 +41,7 @@ const ICON: &str = include_str!("icon");
|
||||
|
||||
const CHAIN_ID: u64 = 10; // optimism
|
||||
const CONTRACT_ADDRESS: &str = "0x52185B6a6017E6f079B994452F234f7C2533787B"; // optimism
|
||||
const CONTRACT_FIRST_BLOCK: u64 = 118_590_088;
|
||||
|
||||
const EVENTS: [&str; 3] = [
|
||||
"AppRegistered(uint256,string,bytes,string,bytes32)",
|
||||
|
@ -111,7 +111,7 @@ impl State {
|
||||
crate::print_to_terminal(1, "producing new state");
|
||||
let mut state = State {
|
||||
contract_address,
|
||||
last_saved_block: 1,
|
||||
last_saved_block: crate::CONTRACT_FIRST_BLOCK,
|
||||
package_hashes: HashMap::new(),
|
||||
listed_packages: HashMap::new(),
|
||||
downloaded_packages: HashMap::new(),
|
||||
@ -371,14 +371,16 @@ impl State {
|
||||
.ok_or(anyhow::anyhow!("got log with no block number"))?
|
||||
.try_into()?;
|
||||
|
||||
// let package_hash: alloy_primitives::U256 = log.topics[1].into();
|
||||
// let package_hash = package_hash.to_string();
|
||||
|
||||
match log.topics[0] {
|
||||
match log.topics()[0] {
|
||||
AppRegistered::SIGNATURE_HASH => {
|
||||
let package_hash = log.topics[1];
|
||||
let (package_name, publisher_dnswire, metadata_url, metadata_hash) =
|
||||
AppRegistered::abi_decode_data(&log.data, true)?;
|
||||
let package_hash = log.topics()[1];
|
||||
|
||||
let app = AppRegistered::decode_log_data(log.data(), false)?;
|
||||
let package_name = app.packageName;
|
||||
let publisher_dnswire = app.publisherName;
|
||||
let metadata_url = app.metadataUrl;
|
||||
let metadata_hash = app.metadataHash;
|
||||
|
||||
let package_hash = package_hash.to_string();
|
||||
let metadata_hash = metadata_hash.to_string();
|
||||
|
||||
@ -390,13 +392,14 @@ impl State {
|
||||
),
|
||||
);
|
||||
|
||||
if generate_package_hash(&package_name, publisher_dnswire.as_slice())
|
||||
if generate_package_hash(&package_name, publisher_dnswire.to_vec().as_slice())
|
||||
!= package_hash
|
||||
{
|
||||
return Err(anyhow::anyhow!("got log with mismatched package hash"));
|
||||
}
|
||||
|
||||
let Ok(publisher_name) = dnswire_decode(publisher_dnswire.as_slice()) else {
|
||||
let Ok(publisher_name) = dnswire_decode(publisher_dnswire.to_vec().as_slice())
|
||||
else {
|
||||
return Err(anyhow::anyhow!("got log with invalid publisher name"));
|
||||
};
|
||||
|
||||
@ -430,9 +433,12 @@ impl State {
|
||||
self.insert_listing(package_hash, listing);
|
||||
}
|
||||
AppMetadataUpdated::SIGNATURE_HASH => {
|
||||
let package_hash = log.topics[1].to_string();
|
||||
let (metadata_url, metadata_hash) =
|
||||
AppMetadataUpdated::abi_decode_data(&log.data, false)?;
|
||||
let package_hash = log.topics()[1].to_string();
|
||||
|
||||
let upd = AppMetadataUpdated::decode_log_data(log.data(), false)?;
|
||||
let metadata_url = upd.metadataUrl;
|
||||
let metadata_hash = upd.metadataHash;
|
||||
|
||||
let metadata_hash = metadata_hash.to_string();
|
||||
|
||||
let current_listing = self
|
||||
@ -484,9 +490,9 @@ impl State {
|
||||
}
|
||||
}
|
||||
Transfer::SIGNATURE_HASH => {
|
||||
let from = alloy_primitives::Address::from_word(log.topics[1]);
|
||||
let to = alloy_primitives::Address::from_word(log.topics[2]);
|
||||
let package_hash = log.topics[3].to_string();
|
||||
let from = alloy_primitives::Address::from_word(log.topics()[1]);
|
||||
let to = alloy_primitives::Address::from_word(log.topics()[2]);
|
||||
let package_hash = log.topics()[3].to_string();
|
||||
|
||||
if from == alloy_primitives::Address::ZERO {
|
||||
match self.get_listing_with_hash_mut(&package_hash) {
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -9,7 +9,7 @@ simulation-mode = []
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
bincode = "1.3.3"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rand = "0.8"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"image": "",
|
||||
"properties": {
|
||||
"package_name": "app_store",
|
||||
"current_version": "0.3.0",
|
||||
"current_version": "0.3.1",
|
||||
"publisher": "sys",
|
||||
"mirrors": [],
|
||||
"code_hashes": {
|
||||
"0.3.0": ""
|
||||
"0.3.1": ""
|
||||
}
|
||||
},
|
||||
"external_url": "https://kinode.org",
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "chess"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
@ -10,7 +10,7 @@ simulation-mode = []
|
||||
anyhow = "1.0"
|
||||
base64 = "0.22.0"
|
||||
bincode = "1.3.3"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
pleco = "0.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"image": "",
|
||||
"properties": {
|
||||
"package_name": "chess",
|
||||
"current_version": "0.2.0",
|
||||
"current_version": "0.2.1",
|
||||
"publisher": "sys",
|
||||
"mirrors": [],
|
||||
"code_hashes": {
|
||||
"0.2.0": ""
|
||||
"0.2.1": ""
|
||||
}
|
||||
},
|
||||
"external_url": "https://kinode.org",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "homepage"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
@ -9,7 +9,7 @@ simulation-mode = []
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
bincode = "1.3.3"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"image": "",
|
||||
"properties": {
|
||||
"package_name": "homepage",
|
||||
"current_version": "0.1.0",
|
||||
"current_version": "0.1.1",
|
||||
"publisher": "sys",
|
||||
"mirrors": [],
|
||||
"code_hashes": {
|
||||
"0.1.0": ""
|
||||
"0.1.1": ""
|
||||
}
|
||||
},
|
||||
"external_url": "https://kinode.org",
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kns_indexer"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
@ -8,11 +8,11 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
alloy-primitives = "0.6.2"
|
||||
alloy-sol-types = "0.6.2"
|
||||
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.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rmp-serde = "1.1.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -17,6 +17,7 @@ wit_bindgen::generate!({
|
||||
|
||||
// perhaps a constant in process_lib?
|
||||
const KNS_OPTIMISM_ADDRESS: &'static str = "0xca5b5811c0c40aab3295f932b1b5112eb7bb4bd6";
|
||||
const KNS_FIRST_BLOCK: u64 = 114_923_786;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
struct State {
|
||||
@ -132,7 +133,7 @@ fn init(our: Address) {
|
||||
contract_address,
|
||||
names: HashMap::new(),
|
||||
nodes: HashMap::new(),
|
||||
block: 1,
|
||||
block: KNS_FIRST_BLOCK,
|
||||
}
|
||||
} else {
|
||||
println!("loading in {} persisted PKI entries", s.nodes.len());
|
||||
@ -144,7 +145,7 @@ fn init(our: Address) {
|
||||
contract_address: contract_address.clone(),
|
||||
names: HashMap::new(),
|
||||
nodes: HashMap::new(),
|
||||
block: 1,
|
||||
block: KNS_FIRST_BLOCK,
|
||||
},
|
||||
};
|
||||
|
||||
@ -188,7 +189,12 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
||||
match eth_provider.get_logs(&filter) {
|
||||
Ok(logs) => {
|
||||
for log in logs {
|
||||
handle_log(&our, &mut state, &log)?;
|
||||
match handle_log(&our, &mut state, &log) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
println!("log-handling error! {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -295,7 +301,12 @@ fn handle_eth_message(
|
||||
match eth_result {
|
||||
Ok(eth::EthSub { result, .. }) => {
|
||||
if let eth::SubscriptionResult::Log(log) = result {
|
||||
handle_log(our, state, &log)?;
|
||||
match handle_log(our, state, &log) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
println!("log-handling error! {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_e) => {
|
||||
@ -345,7 +356,7 @@ fn handle_eth_message(
|
||||
}
|
||||
|
||||
fn handle_log(our: &Address, state: &mut State, log: ð::Log) -> anyhow::Result<()> {
|
||||
let node_id = log.topics[1];
|
||||
let node_id = log.topics()[1];
|
||||
|
||||
let name = match state.names.entry(node_id.to_string()) {
|
||||
Entry::Occupied(o) => o.into_mut(),
|
||||
@ -359,15 +370,15 @@ fn handle_log(our: &Address, state: &mut State, log: ð::Log) -> anyhow::Resul
|
||||
|
||||
let mut send = true;
|
||||
|
||||
match log.topics[0] {
|
||||
match log.topics()[0] {
|
||||
KeyUpdate::SIGNATURE_HASH => {
|
||||
node.public_key = KeyUpdate::abi_decode_data(&log.data, true)
|
||||
node.public_key = KeyUpdate::decode_log_data(log.data(), true)
|
||||
.unwrap()
|
||||
.0
|
||||
.key
|
||||
.to_string();
|
||||
}
|
||||
IpUpdate::SIGNATURE_HASH => {
|
||||
let ip = IpUpdate::abi_decode_data(&log.data, true).unwrap().0;
|
||||
let ip = IpUpdate::decode_log_data(log.data(), true).unwrap().ip;
|
||||
node.ip = format!(
|
||||
"{}.{}.{}.{}",
|
||||
(ip >> 24) & 0xFF,
|
||||
@ -380,15 +391,15 @@ fn handle_log(our: &Address, state: &mut State, log: ð::Log) -> anyhow::Resul
|
||||
node.routers = vec![];
|
||||
}
|
||||
WsUpdate::SIGNATURE_HASH => {
|
||||
node.port = WsUpdate::abi_decode_data(&log.data, true).unwrap().0;
|
||||
node.port = WsUpdate::decode_log_data(log.data(), true).unwrap().port;
|
||||
// when we get port data, we should delete any router data,
|
||||
// since the assignment of port indicates an direct node
|
||||
node.routers = vec![];
|
||||
}
|
||||
RoutingUpdate::SIGNATURE_HASH => {
|
||||
node.routers = RoutingUpdate::abi_decode_data(&log.data, true)
|
||||
node.routers = RoutingUpdate::decode_log_data(log.data(), true)
|
||||
.unwrap()
|
||||
.0
|
||||
.routers
|
||||
.iter()
|
||||
.map(|r| r.to_string())
|
||||
.collect::<Vec<String>>();
|
||||
@ -413,7 +424,7 @@ fn handle_log(our: &Address, state: &mut State, log: ð::Log) -> anyhow::Resul
|
||||
}
|
||||
|
||||
// if new block is > 100 from last block, save state
|
||||
let block = log.block_number.expect("expect").to::<u64>();
|
||||
let block = log.block_number.expect("expect");
|
||||
if block > state.block + 100 {
|
||||
kinode_process_lib::print_to_terminal(
|
||||
1,
|
||||
@ -430,9 +441,12 @@ fn handle_log(our: &Address, state: &mut State, log: ð::Log) -> anyhow::Resul
|
||||
}
|
||||
|
||||
fn get_name(log: ð::Log) -> anyhow::Result<String> {
|
||||
let decoded =
|
||||
NodeRegistered::abi_decode_data(&log.data, true).map_err(|e| anyhow::anyhow!(e))?;
|
||||
dnswire_decode(decoded.0.clone()).map_err(|e| anyhow::anyhow!(e))
|
||||
let decoded = NodeRegistered::decode_log_data(log.data(), false).map_err(|_e| {
|
||||
anyhow::anyhow!(
|
||||
"got event other than NodeRegistered without knowing about existing node name"
|
||||
)
|
||||
})?;
|
||||
dnswire_decode(decoded.name.to_vec()).map_err(|e| anyhow::anyhow!(e))
|
||||
}
|
||||
|
||||
fn dnswire_decode(wire_format_bytes: Vec<u8>) -> Result<String, FromUtf8Error> {
|
||||
|
@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "KNS Indexer",
|
||||
"description": "Kinode OS pki indexer",
|
||||
"description": "Kinode OS PKI indexer",
|
||||
"image": "",
|
||||
"properties": {
|
||||
"package_name": "kns_indexer",
|
||||
"current_version": "0.1.0",
|
||||
"current_version": "0.2.1",
|
||||
"publisher": "sys",
|
||||
"mirrors": [],
|
||||
"code_hashes": {
|
||||
"0.1.0": ""
|
||||
"0.2.1": ""
|
||||
}
|
||||
},
|
||||
"external_url": "https://kinode.org",
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -9,7 +9,7 @@ simulation-mode = []
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
clap = "4.4.18"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
regex = "1.10.3"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"image": "",
|
||||
"properties": {
|
||||
"package_name": "terminal",
|
||||
"current_version": "0.1.0",
|
||||
"current_version": "0.1.1",
|
||||
"publisher": "sys",
|
||||
"mirrors": [],
|
||||
"code_hashes": {
|
||||
"0.1.0": ""
|
||||
"0.1.1": ""
|
||||
}
|
||||
},
|
||||
"external_url": "https://kinode.org",
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rmp-serde = "1.1.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rmp-serde = "1.1.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rmp-serde = "1.1.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rmp-serde = "1.1.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "terminal"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
@ -9,7 +9,7 @@ simulation-mode = []
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
bincode = "1.3.3"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
rand = "0.8"
|
||||
regex = "1.10.3"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
@ -295,7 +295,7 @@ fn handle_run(our: &Address, process: &ProcessId, args: String) -> anyhow::Resul
|
||||
}
|
||||
}
|
||||
print_to_terminal(
|
||||
2,
|
||||
3,
|
||||
&format!(
|
||||
"{}: Process {{\n wasm_bytes_handle: {},\n wit_version: {},\n on_exit: {:?},\n public: {}\n capabilities: {}\n}}",
|
||||
parsed_new_process_id.clone(),
|
||||
|
@ -8,7 +8,7 @@ simulation-mode = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wit-bindgen = "0.24.0"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"image": "",
|
||||
"properties": {
|
||||
"package_name": "tester",
|
||||
"current_version": "0.1.0",
|
||||
"current_version": "0.1.1",
|
||||
"publisher": "sys",
|
||||
"mirrors": [],
|
||||
"code_hashes": {
|
||||
"0.1.0": ""
|
||||
"0.1.1": ""
|
||||
}
|
||||
},
|
||||
"external_url": "https://kinode.org",
|
||||
|
@ -9,7 +9,7 @@ simulation-mode = []
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
bincode = "1.3.3"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tester"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
@ -10,7 +10,7 @@ simulation-mode = []
|
||||
anyhow = "1.0"
|
||||
bincode = "1.3.3"
|
||||
indexmap = "2.1"
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.1" }
|
||||
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.7.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0"
|
||||
|
@ -1,11 +1,4 @@
|
||||
[
|
||||
{
|
||||
"chain_id": 1,
|
||||
"trusted": false,
|
||||
"provider": {
|
||||
"RpcUrl": "wss://ethereum.publicnode.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 31337,
|
||||
"trusted": true,
|
||||
@ -13,6 +6,13 @@
|
||||
"RpcUrl": "wss://localhost:8545"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 1,
|
||||
"trusted": false,
|
||||
"provider": {
|
||||
"RpcUrl": "wss://ethereum.publicnode.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 10,
|
||||
"trusted": false,
|
||||
@ -21,18 +21,18 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 10,
|
||||
"chain_id": 1,
|
||||
"trusted": false,
|
||||
"provider": {
|
||||
"Node": {
|
||||
"use_as_provider": true,
|
||||
"kns_update": {
|
||||
"name": "default-router-1.os",
|
||||
"name": "providerfren.os",
|
||||
"owner": "",
|
||||
"node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d",
|
||||
"public_key": "0xe1f7a266eafe46c79494d4dcce4222d81e5767511b295f1ed26c37221aecb80b",
|
||||
"node": "",
|
||||
"public_key": "0x54f5a8a4c625d5925e63ed3f0203b63e007e3f822d7858bd98b1fd9704c99451",
|
||||
"ip": "147.135.114.167",
|
||||
"port": 9000,
|
||||
"port": 9999,
|
||||
"routers": []
|
||||
}
|
||||
}
|
||||
@ -45,30 +45,12 @@
|
||||
"Node": {
|
||||
"use_as_provider": true,
|
||||
"kns_update": {
|
||||
"name": "default-router-2.os",
|
||||
"name": "providerfren.os",
|
||||
"owner": "",
|
||||
"node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458",
|
||||
"public_key": "0xcc2752e30ba865ab6baa1b819b0291b71f1136245234274b274df5950c3abcc4",
|
||||
"node": "",
|
||||
"public_key": "0x54f5a8a4c625d5925e63ed3f0203b63e007e3f822d7858bd98b1fd9704c99451",
|
||||
"ip": "147.135.114.167",
|
||||
"port": 9001,
|
||||
"routers": []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 10,
|
||||
"trusted": false,
|
||||
"provider": {
|
||||
"Node": {
|
||||
"use_as_provider": true,
|
||||
"kns_update": {
|
||||
"name": "default-router-3.os",
|
||||
"owner": "",
|
||||
"node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a",
|
||||
"public_key": "0xe992841b17212206a3929b4cc065ad2854875d48fc7177e260005b9eb8d4f123",
|
||||
"ip": "147.135.114.167",
|
||||
"port": 9005,
|
||||
"port": 9999,
|
||||
"routers": []
|
||||
}
|
||||
}
|
||||
@ -81,48 +63,12 @@
|
||||
"Node": {
|
||||
"use_as_provider": true,
|
||||
"kns_update": {
|
||||
"name": "default-router-3.os",
|
||||
"name": "providerfren.os",
|
||||
"owner": "",
|
||||
"node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a",
|
||||
"public_key": "0xe992841b17212206a3929b4cc065ad2854875d48fc7177e260005b9eb8d4f123",
|
||||
"node": "",
|
||||
"public_key": "0x54f5a8a4c625d5925e63ed3f0203b63e007e3f822d7858bd98b1fd9704c99451",
|
||||
"ip": "147.135.114.167",
|
||||
"port": 9005,
|
||||
"routers": []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 11155111,
|
||||
"trusted": false,
|
||||
"provider": {
|
||||
"Node": {
|
||||
"use_as_provider": true,
|
||||
"kns_update": {
|
||||
"name": "default-router-2.os",
|
||||
"owner": "",
|
||||
"node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458",
|
||||
"public_key": "0xcc2752e30ba865ab6baa1b819b0291b71f1136245234274b274df5950c3abcc4",
|
||||
"ip": "147.135.114.167",
|
||||
"port": 9001,
|
||||
"routers": []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"chain_id": 11155111,
|
||||
"trusted": false,
|
||||
"provider": {
|
||||
"Node": {
|
||||
"use_as_provider": true,
|
||||
"kns_update": {
|
||||
"name": "default-router-1.os",
|
||||
"owner": "",
|
||||
"node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d",
|
||||
"public_key": "0xe1f7a266eafe46c79494d4dcce4222d81e5767511b295f1ed26c37221aecb80b",
|
||||
"ip": "147.135.114.167",
|
||||
"port": 9000,
|
||||
"port": 9999,
|
||||
"routers": []
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,13 @@ mod subscription;
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum IncomingReq {
|
||||
/// requests for an RPC action that can come from processes on this node or others
|
||||
EthAction(EthAction),
|
||||
/// requests that must come from this node to modify provider settings / fetch them
|
||||
EthConfigAction(EthConfigAction),
|
||||
/// subscription updates coming in from a remote provider
|
||||
EthSubResult(EthSubResult),
|
||||
/// a remote node who uses our provider keeping their subscription alive
|
||||
SubKeepalive(u64),
|
||||
}
|
||||
|
||||
@ -42,11 +46,14 @@ struct UrlProvider {
|
||||
|
||||
#[derive(Debug)]
|
||||
struct NodeProvider {
|
||||
/// NOT CURRENTLY USED
|
||||
pub trusted: bool,
|
||||
/// semi-temporary flag to mark if this provider is currently usable
|
||||
/// future updates will make this more dynamic
|
||||
pub usable: bool,
|
||||
pub name: String,
|
||||
/// the KNS update that describes this node provider
|
||||
/// kept so we can re-serialize to SavedConfigs
|
||||
pub kns_update: KnsUpdate,
|
||||
}
|
||||
|
||||
impl ActiveProviders {
|
||||
@ -59,7 +66,7 @@ impl ActiveProviders {
|
||||
self.nodes.push(NodeProvider {
|
||||
trusted: new.trusted,
|
||||
usable: use_as_provider,
|
||||
name: kns_update.name,
|
||||
kns_update,
|
||||
});
|
||||
}
|
||||
NodeOrRpcUrl::RpcUrl(url) => {
|
||||
@ -74,7 +81,7 @@ impl ActiveProviders {
|
||||
|
||||
fn remove_provider(&mut self, remove: &str) {
|
||||
self.urls.retain(|x| x.url != remove);
|
||||
self.nodes.retain(|x| x.name != remove);
|
||||
self.nodes.retain(|x| x.kns_update.name != remove);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +164,9 @@ pub async fn provider(
|
||||
caps_oracle: CapMessageSender,
|
||||
print_tx: PrintSender,
|
||||
) -> Result<()> {
|
||||
// load access settings if they've been saved
|
||||
// load access settings if they've been persisted to disk
|
||||
// this merely describes whether our provider is available to other nodes
|
||||
// and if so, which nodes are allowed to access it (public/whitelist/blacklist)
|
||||
let access_settings: AccessSettings =
|
||||
match tokio::fs::read_to_string(format!("{}/.eth_access_settings", home_directory_path))
|
||||
.await
|
||||
@ -169,11 +178,6 @@ pub async fn provider(
|
||||
allow: HashSet::new(),
|
||||
deny: HashSet::new(),
|
||||
};
|
||||
let _ = tokio::fs::write(
|
||||
format!("{}/.eth_access_settings", home_directory_path),
|
||||
serde_json::to_string(&access_settings).unwrap(),
|
||||
)
|
||||
.await;
|
||||
access_settings
|
||||
}
|
||||
};
|
||||
@ -183,6 +187,9 @@ pub async fn provider(
|
||||
)
|
||||
.await;
|
||||
|
||||
// initialize module state
|
||||
// fill out providers based on saved configs (possibly persisted, given to us)
|
||||
// this can be a mix of node providers and rpc providers
|
||||
let mut state = ModuleState {
|
||||
our: Arc::new(our),
|
||||
home_directory_path,
|
||||
@ -208,14 +215,13 @@ pub async fn provider(
|
||||
|
||||
verbose_print(&state.print_tx, "eth: provider initialized").await;
|
||||
|
||||
// main loop: handle incoming network errors and incoming kernel messages
|
||||
loop {
|
||||
tokio::select! {
|
||||
Some(wrapped_error) = net_error_recv.recv() => {
|
||||
handle_network_error(
|
||||
wrapped_error,
|
||||
&state.active_subscriptions,
|
||||
&state.response_channels,
|
||||
&state.print_tx
|
||||
&state,
|
||||
).await;
|
||||
}
|
||||
Some(km) = recv_in_client.recv() => {
|
||||
@ -241,40 +247,54 @@ pub async fn provider(
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_network_error(
|
||||
wrapped_error: WrappedSendError,
|
||||
active_subscriptions: &ActiveSubscriptions,
|
||||
response_channels: &ResponseChannels,
|
||||
print_tx: &PrintSender,
|
||||
) {
|
||||
verbose_print(&print_tx, "eth: got network error").await;
|
||||
// if we hold active subscriptions for the remote node that this error refers to,
|
||||
// close them here -- they will need to resubscribe
|
||||
// TODO is this necessary?
|
||||
if let Some((_who, sub_map)) = active_subscriptions.remove(&wrapped_error.error.target) {
|
||||
for (_sub_id, sub) in sub_map.iter() {
|
||||
if let ActiveSub::Local(handle) = sub {
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
"eth: closing local sub in response to network error",
|
||||
)
|
||||
.await;
|
||||
handle.abort();
|
||||
}
|
||||
/// network errors only come from remote provider nodes we tried to access,
|
||||
/// or from remote nodes that are using us as a provider.
|
||||
///
|
||||
/// if we tried to access them, we will have a response channel to send the error to.
|
||||
/// if they are using us as a provider, close the subscription associated with the target.
|
||||
async fn handle_network_error(wrapped_error: WrappedSendError, state: &ModuleState) {
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
&format!(
|
||||
"eth: got network error from {}",
|
||||
&wrapped_error.error.target
|
||||
),
|
||||
)
|
||||
.await;
|
||||
|
||||
// close all subscriptions held by the process that we (possibly) tried to send an update to
|
||||
if let Some((_who, sub_map)) = state
|
||||
.active_subscriptions
|
||||
.remove(&wrapped_error.error.target)
|
||||
{
|
||||
for (sub_id, sub) in sub_map.iter() {
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
&format!(
|
||||
"eth: closed subscription {} in response to network error",
|
||||
sub_id
|
||||
),
|
||||
)
|
||||
.await;
|
||||
sub.close(*sub_id, state).await;
|
||||
}
|
||||
}
|
||||
// we got an error from a remote node provider --
|
||||
// forward it to response channel if it exists
|
||||
if let Some(chan) = response_channels.get(&wrapped_error.id) {
|
||||
// can't close channel here, as response may be an error
|
||||
// and fulfill_request may wish to try other providers.
|
||||
verbose_print(&print_tx, "eth: sent network error to response channel").await;
|
||||
|
||||
// forward error to response channel if it exists
|
||||
if let Some(chan) = state.response_channels.get(&wrapped_error.id) {
|
||||
// don't close channel here, as channel holder will wish to try other providers.
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
"eth: forwarded network error to response channel",
|
||||
)
|
||||
.await;
|
||||
let _ = chan.send(Err(wrapped_error)).await;
|
||||
}
|
||||
}
|
||||
|
||||
/// handle incoming requests, namely [`EthAction`] and [`EthConfigAction`].
|
||||
/// also handle responses that are passthroughs from remote provider nodes.
|
||||
/// handle incoming requests and responses.
|
||||
/// requests must be one of types in [`IncomingReq`].
|
||||
/// responses are passthroughs from remote provider nodes.
|
||||
async fn handle_message(
|
||||
state: &mut ModuleState,
|
||||
km: KernelMessage,
|
||||
@ -335,6 +355,8 @@ async fn handle_message(
|
||||
{
|
||||
if provider_node == &km.source.node {
|
||||
if let Ok(()) = sender.send(eth_sub_result).await {
|
||||
// successfully sent a subscription update from a
|
||||
// remote provider to one of our processes
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
@ -344,7 +366,7 @@ async fn handle_message(
|
||||
// so they can stop sending us updates
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
"eth: got eth_sub_result but no matching sub found",
|
||||
"eth: got eth_sub_result but no matching sub found, unsubscribing",
|
||||
)
|
||||
.await;
|
||||
kernel_message(
|
||||
@ -367,6 +389,26 @@ async fn handle_message(
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
"eth: got sub_keepalive but no matching sub found",
|
||||
)
|
||||
.await;
|
||||
// send a response with an EthSubError
|
||||
kernel_message(
|
||||
&state.our.clone(),
|
||||
km.id,
|
||||
km.source.clone(),
|
||||
None,
|
||||
false,
|
||||
None,
|
||||
EthSubResult::Err(EthSubError {
|
||||
id: sub_id,
|
||||
error: "Subscription not found".to_string(),
|
||||
}),
|
||||
&state.send_to_loop,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -382,7 +424,10 @@ async fn handle_eth_action(
|
||||
) -> Result<(), EthError> {
|
||||
// check our access settings if the request is from a remote node
|
||||
if km.source.node != *state.our {
|
||||
if state.access_settings.deny.contains(&km.source.node) {
|
||||
if state.access_settings.deny.contains(&km.source.node)
|
||||
|| (!state.access_settings.public
|
||||
&& !state.access_settings.allow.contains(&km.source.node))
|
||||
{
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
"eth: got eth_action from unauthorized remote source",
|
||||
@ -390,21 +435,19 @@ async fn handle_eth_action(
|
||||
.await;
|
||||
return Err(EthError::PermissionDenied);
|
||||
}
|
||||
if !state.access_settings.public {
|
||||
if !state.access_settings.allow.contains(&km.source.node) {
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
"eth: got eth_action from unauthorized remote source",
|
||||
)
|
||||
.await;
|
||||
return Err(EthError::PermissionDenied);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
verbose_print(
|
||||
&state.print_tx,
|
||||
&format!("eth: handling eth_action {eth_action:?}"),
|
||||
&format!(
|
||||
"eth: handling {} from {}",
|
||||
match ð_action {
|
||||
EthAction::SubscribeLogs { .. } => "subscribe",
|
||||
EthAction::UnsubscribeLogs(_) => "unsubscribe",
|
||||
EthAction::Request { .. } => "request",
|
||||
},
|
||||
km.source
|
||||
),
|
||||
)
|
||||
.await;
|
||||
|
||||
@ -414,19 +457,15 @@ async fn handle_eth_action(
|
||||
// before returning an error.
|
||||
match eth_action {
|
||||
EthAction::SubscribeLogs { sub_id, .. } => {
|
||||
tokio::spawn(subscription::create_new_subscription(
|
||||
state.our.to_string(),
|
||||
subscription::create_new_subscription(
|
||||
state,
|
||||
km.id,
|
||||
km.source.clone(),
|
||||
km.rsvp,
|
||||
state.send_to_loop.clone(),
|
||||
sub_id,
|
||||
eth_action,
|
||||
state.providers.clone(),
|
||||
state.active_subscriptions.clone(),
|
||||
state.response_channels.clone(),
|
||||
state.print_tx.clone(),
|
||||
));
|
||||
)
|
||||
.await;
|
||||
}
|
||||
EthAction::UnsubscribeLogs(sub_id) => {
|
||||
let mut sub_map = state
|
||||
@ -509,29 +548,62 @@ async fn fulfill_request(
|
||||
let Some(mut aps) = providers.get_mut(&chain_id) else {
|
||||
return EthResponse::Err(EthError::NoRpcForChain);
|
||||
};
|
||||
|
||||
// first, try any url providers we have for this chain,
|
||||
// then if we have none or they all fail, go to node provider.
|
||||
// then if we have none or they all fail, go to node providers.
|
||||
// finally, if no provider works, return an error.
|
||||
for url_provider in &mut aps.urls {
|
||||
|
||||
// bump the successful provider to the front of the list for future requests
|
||||
for (index, url_provider) in aps.urls.iter_mut().enumerate() {
|
||||
let pubsub = match &url_provider.pubsub {
|
||||
Some(pubsub) => pubsub,
|
||||
None => {
|
||||
if let Ok(()) = activate_url_provider(url_provider).await {
|
||||
verbose_print(print_tx, "eth: activated a url provider").await;
|
||||
verbose_print(
|
||||
print_tx,
|
||||
&format!("eth: activated url provider {}", url_provider.url),
|
||||
)
|
||||
.await;
|
||||
url_provider.pubsub.as_ref().unwrap()
|
||||
} else {
|
||||
verbose_print(
|
||||
print_tx,
|
||||
&format!("eth: could not activate url provider {}", url_provider.url),
|
||||
)
|
||||
.await;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
};
|
||||
let Ok(value) = pubsub.inner().prepare(method, params.clone()).await else {
|
||||
// this provider failed and needs to be reset
|
||||
url_provider.pubsub = None;
|
||||
continue;
|
||||
};
|
||||
return EthResponse::Response { value };
|
||||
match pubsub.inner().prepare(method, params.clone()).await {
|
||||
Ok(value) => {
|
||||
let successful_provider = aps.urls.remove(index);
|
||||
aps.urls.insert(0, successful_provider);
|
||||
return EthResponse::Response { value };
|
||||
}
|
||||
Err(rpc_error) => {
|
||||
verbose_print(
|
||||
print_tx,
|
||||
&format!(
|
||||
"eth: got error from url provider {}: {}",
|
||||
url_provider.url, rpc_error
|
||||
),
|
||||
)
|
||||
.await;
|
||||
// this provider failed and needs to be reset
|
||||
url_provider.pubsub = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
for node_provider in &mut aps.nodes {
|
||||
verbose_print(
|
||||
print_tx,
|
||||
&format!(
|
||||
"eth: attempting to fulfill via {}",
|
||||
node_provider.kns_update.name
|
||||
),
|
||||
)
|
||||
.await;
|
||||
let response = forward_to_node_provider(
|
||||
our,
|
||||
km_id,
|
||||
@ -563,14 +635,14 @@ async fn forward_to_node_provider(
|
||||
send_to_loop: &MessageSender,
|
||||
receiver: &mut ProcessMessageReceiver,
|
||||
) -> EthResponse {
|
||||
if !node_provider.usable || node_provider.name == our {
|
||||
if !node_provider.usable || node_provider.kns_update.name == our {
|
||||
return EthResponse::Err(EthError::PermissionDenied);
|
||||
}
|
||||
kernel_message(
|
||||
our,
|
||||
km_id,
|
||||
Address {
|
||||
node: node_provider.name.clone(),
|
||||
node: node_provider.kns_update.name.clone(),
|
||||
process: ETH_PROCESS_ID.clone(),
|
||||
},
|
||||
rsvp,
|
||||
@ -585,15 +657,13 @@ async fn forward_to_node_provider(
|
||||
else {
|
||||
return EthResponse::Err(EthError::RpcTimeout);
|
||||
};
|
||||
let Message::Response((resp, _context)) = response_km.message else {
|
||||
// if we hit this, they spoofed a request with same id, ignore and possibly punish
|
||||
return EthResponse::Err(EthError::RpcMalformedResponse);
|
||||
};
|
||||
let Ok(eth_response) = serde_json::from_slice::<EthResponse>(&resp.body) else {
|
||||
// if we hit this, they sent a malformed response, ignore and possibly punish
|
||||
return EthResponse::Err(EthError::RpcMalformedResponse);
|
||||
};
|
||||
eth_response
|
||||
if let Message::Response((resp, _context)) = response_km.message {
|
||||
if let Ok(eth_response) = serde_json::from_slice::<EthResponse>(&resp.body) {
|
||||
return eth_response;
|
||||
}
|
||||
}
|
||||
// if we hit this, they sent a malformed response, ignore and possibly punish
|
||||
EthResponse::Err(EthError::RpcMalformedResponse)
|
||||
}
|
||||
|
||||
async fn handle_eth_config_action(
|
||||
@ -627,6 +697,7 @@ async fn handle_eth_config_action(
|
||||
)
|
||||
.await;
|
||||
|
||||
let mut save_settings = false;
|
||||
let mut save_providers = false;
|
||||
|
||||
// modify our providers and access settings based on config action
|
||||
@ -650,21 +721,27 @@ async fn handle_eth_config_action(
|
||||
}
|
||||
EthConfigAction::SetPublic => {
|
||||
state.access_settings.public = true;
|
||||
save_settings = true;
|
||||
}
|
||||
EthConfigAction::SetPrivate => {
|
||||
state.access_settings.public = false;
|
||||
save_settings = true;
|
||||
}
|
||||
EthConfigAction::AllowNode(node) => {
|
||||
state.access_settings.allow.insert(node);
|
||||
save_settings = true;
|
||||
}
|
||||
EthConfigAction::UnallowNode(node) => {
|
||||
state.access_settings.allow.remove(&node);
|
||||
save_settings = true;
|
||||
}
|
||||
EthConfigAction::DenyNode(node) => {
|
||||
state.access_settings.deny.insert(node);
|
||||
save_settings = true;
|
||||
}
|
||||
EthConfigAction::UndenyNode(node) => {
|
||||
state.access_settings.deny.remove(&node);
|
||||
save_settings = true;
|
||||
}
|
||||
EthConfigAction::SetProviders(new_providers) => {
|
||||
let new_map = DashMap::new();
|
||||
@ -713,20 +790,26 @@ async fn handle_eth_config_action(
|
||||
};
|
||||
}
|
||||
}
|
||||
// save providers and access settings to disk
|
||||
let _ = tokio::fs::write(
|
||||
format!("{}/.eth_access_settings", state.home_directory_path),
|
||||
serde_json::to_string(&state.access_settings).unwrap(),
|
||||
)
|
||||
.await;
|
||||
verbose_print(&state.print_tx, "eth: saved new access settings").await;
|
||||
// save providers and/or access settings, depending on necessity, to disk
|
||||
if save_settings {
|
||||
if let Ok(()) = tokio::fs::write(
|
||||
format!("{}/.eth_access_settings", state.home_directory_path),
|
||||
serde_json::to_string(&state.access_settings).unwrap(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
verbose_print(&state.print_tx, "eth: saved new access settings").await;
|
||||
};
|
||||
}
|
||||
if save_providers {
|
||||
let _ = tokio::fs::write(
|
||||
if let Ok(()) = tokio::fs::write(
|
||||
format!("{}/.eth_providers", state.home_directory_path),
|
||||
serde_json::to_string(&providers_to_saved_configs(&state.providers)).unwrap(),
|
||||
)
|
||||
.await;
|
||||
verbose_print(&state.print_tx, "eth: saved new provider settings").await;
|
||||
.await
|
||||
{
|
||||
verbose_print(&state.print_tx, "eth: saved new provider settings").await;
|
||||
};
|
||||
}
|
||||
EthConfigResponse::Ok
|
||||
}
|
||||
@ -767,15 +850,7 @@ fn providers_to_saved_configs(providers: &Providers) -> SavedConfigs {
|
||||
.chain(entry.nodes.iter().map(|node_provider| ProviderConfig {
|
||||
chain_id: *entry.key(),
|
||||
provider: NodeOrRpcUrl::Node {
|
||||
kns_update: KnsUpdate {
|
||||
name: node_provider.name.clone(),
|
||||
owner: "".to_string(),
|
||||
node: "".to_string(),
|
||||
public_key: "".to_string(),
|
||||
ip: "".to_string(),
|
||||
port: 0,
|
||||
routers: vec![],
|
||||
},
|
||||
kns_update: node_provider.kns_update.clone(),
|
||||
use_as_provider: node_provider.usable,
|
||||
},
|
||||
trusted: node_provider.trusted,
|
||||
|
@ -4,123 +4,82 @@ use alloy_rpc_types::pubsub::SubscriptionResult;
|
||||
|
||||
/// cleans itself up when the subscription is closed or fails.
|
||||
pub async fn create_new_subscription(
|
||||
our: String,
|
||||
state: &ModuleState,
|
||||
km_id: u64,
|
||||
target: Address,
|
||||
rsvp: Option<Address>,
|
||||
send_to_loop: MessageSender,
|
||||
sub_id: u64,
|
||||
eth_action: EthAction,
|
||||
providers: Providers,
|
||||
active_subscriptions: ActiveSubscriptions,
|
||||
response_channels: ResponseChannels,
|
||||
print_tx: PrintSender,
|
||||
) {
|
||||
verbose_print(&print_tx, "eth: creating new subscription").await;
|
||||
match build_subscription(
|
||||
&our,
|
||||
km_id,
|
||||
&target,
|
||||
&send_to_loop,
|
||||
ð_action,
|
||||
&providers,
|
||||
&response_channels,
|
||||
&print_tx,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(maybe_raw_sub) => {
|
||||
// send a response to the target that the subscription was successful
|
||||
kernel_message(
|
||||
let our = state.our.clone();
|
||||
let send_to_loop = state.send_to_loop.clone();
|
||||
let active_subscriptions = state.active_subscriptions.clone();
|
||||
let providers = state.providers.clone();
|
||||
let response_channels = state.response_channels.clone();
|
||||
let print_tx = state.print_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
match tokio::time::timeout(
|
||||
std::time::Duration::from_secs(30),
|
||||
build_subscription(
|
||||
&our,
|
||||
km_id,
|
||||
target.clone(),
|
||||
rsvp.clone(),
|
||||
false,
|
||||
None,
|
||||
EthResponse::Ok,
|
||||
&target,
|
||||
&send_to_loop,
|
||||
)
|
||||
.await;
|
||||
let mut subs = active_subscriptions
|
||||
.entry(target.clone())
|
||||
.or_insert(HashMap::new());
|
||||
let active_subscriptions = active_subscriptions.clone();
|
||||
match maybe_raw_sub {
|
||||
Ok(rx) => {
|
||||
subs.insert(
|
||||
sub_id,
|
||||
// this is a local sub, as in, we connect to the rpc endpt
|
||||
ActiveSub::Local(tokio::spawn(async move {
|
||||
// await the subscription error and kill it if so
|
||||
if let Err(e) = maintain_local_subscription(
|
||||
&our,
|
||||
sub_id,
|
||||
rx,
|
||||
&target,
|
||||
&rsvp,
|
||||
&send_to_loop,
|
||||
)
|
||||
.await
|
||||
{
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
"eth: closed local subscription due to error",
|
||||
)
|
||||
.await;
|
||||
kernel_message(
|
||||
ð_action,
|
||||
&providers,
|
||||
&response_channels,
|
||||
&print_tx,
|
||||
),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Ok(maybe_raw_sub)) => {
|
||||
// send a response to the target that the subscription was successful
|
||||
kernel_message(
|
||||
&our,
|
||||
km_id,
|
||||
target.clone(),
|
||||
rsvp.clone(),
|
||||
false,
|
||||
None,
|
||||
EthResponse::Ok,
|
||||
&send_to_loop,
|
||||
)
|
||||
.await;
|
||||
let mut subs = active_subscriptions
|
||||
.entry(target.clone())
|
||||
.or_insert(HashMap::new());
|
||||
let active_subscriptions = active_subscriptions.clone();
|
||||
match maybe_raw_sub {
|
||||
Ok(rx) => {
|
||||
let our = our.clone();
|
||||
let send_to_loop = send_to_loop.clone();
|
||||
let print_tx = print_tx.clone();
|
||||
subs.insert(
|
||||
sub_id,
|
||||
// this is a local sub, as in, we connect to the rpc endpoint
|
||||
ActiveSub::Local(tokio::spawn(async move {
|
||||
// await the subscription error and kill it if so
|
||||
if let Err(e) = maintain_local_subscription(
|
||||
&our,
|
||||
rand::random(),
|
||||
target.clone(),
|
||||
rsvp,
|
||||
true,
|
||||
None,
|
||||
EthSubResult::Err(e),
|
||||
&send_to_loop,
|
||||
)
|
||||
.await;
|
||||
active_subscriptions.entry(target).and_modify(|sub_map| {
|
||||
sub_map.remove(&km_id);
|
||||
});
|
||||
}
|
||||
})),
|
||||
);
|
||||
}
|
||||
Err((provider_node, remote_sub_id)) => {
|
||||
// this is a remote sub, given by a relay node
|
||||
let (sender, rx) = tokio::sync::mpsc::channel(10);
|
||||
let keepalive_km_id = rand::random();
|
||||
let (keepalive_err_sender, keepalive_err_receiver) =
|
||||
tokio::sync::mpsc::channel(1);
|
||||
response_channels.insert(keepalive_km_id, keepalive_err_sender);
|
||||
subs.insert(
|
||||
remote_sub_id,
|
||||
ActiveSub::Remote {
|
||||
provider_node: provider_node.clone(),
|
||||
handle: tokio::spawn(async move {
|
||||
if let Err(e) = maintain_remote_subscription(
|
||||
&our,
|
||||
&provider_node,
|
||||
remote_sub_id,
|
||||
sub_id,
|
||||
keepalive_km_id,
|
||||
rx,
|
||||
keepalive_err_receiver,
|
||||
&target,
|
||||
&rsvp,
|
||||
&send_to_loop,
|
||||
)
|
||||
.await
|
||||
{
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
"eth: closed subscription with provider node due to error",
|
||||
"eth: closed local subscription due to error",
|
||||
)
|
||||
.await;
|
||||
kernel_message(
|
||||
&our,
|
||||
rand::random(),
|
||||
target.clone(),
|
||||
None,
|
||||
rsvp,
|
||||
true,
|
||||
None,
|
||||
EthSubResult::Err(e),
|
||||
@ -128,21 +87,84 @@ pub async fn create_new_subscription(
|
||||
)
|
||||
.await;
|
||||
active_subscriptions.entry(target).and_modify(|sub_map| {
|
||||
sub_map.remove(&sub_id);
|
||||
sub_map.remove(&km_id);
|
||||
});
|
||||
response_channels.remove(&keepalive_km_id);
|
||||
}
|
||||
}),
|
||||
sender,
|
||||
},
|
||||
);
|
||||
})),
|
||||
);
|
||||
}
|
||||
Err((provider_node, remote_sub_id)) => {
|
||||
// this is a remote sub, given by a relay node
|
||||
let (sender, rx) = tokio::sync::mpsc::channel(10);
|
||||
let keepalive_km_id = rand::random();
|
||||
let (keepalive_err_sender, keepalive_err_receiver) =
|
||||
tokio::sync::mpsc::channel(1);
|
||||
response_channels.insert(keepalive_km_id, keepalive_err_sender);
|
||||
let our = our.clone();
|
||||
let send_to_loop = send_to_loop.clone();
|
||||
let print_tx = print_tx.clone();
|
||||
let response_channels = response_channels.clone();
|
||||
subs.insert(
|
||||
remote_sub_id,
|
||||
ActiveSub::Remote {
|
||||
provider_node: provider_node.clone(),
|
||||
handle: tokio::spawn(async move {
|
||||
if let Err(e) = maintain_remote_subscription(
|
||||
&our,
|
||||
&provider_node,
|
||||
remote_sub_id,
|
||||
sub_id,
|
||||
keepalive_km_id,
|
||||
rx,
|
||||
keepalive_err_receiver,
|
||||
&target,
|
||||
&send_to_loop,
|
||||
)
|
||||
.await
|
||||
{
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
"eth: closed subscription with provider node due to error",
|
||||
)
|
||||
.await;
|
||||
kernel_message(
|
||||
&our,
|
||||
rand::random(),
|
||||
target.clone(),
|
||||
None,
|
||||
true,
|
||||
None,
|
||||
EthSubResult::Err(e),
|
||||
&send_to_loop,
|
||||
)
|
||||
.await;
|
||||
active_subscriptions.entry(target).and_modify(|sub_map| {
|
||||
sub_map.remove(&sub_id);
|
||||
});
|
||||
response_channels.remove(&keepalive_km_id);
|
||||
}
|
||||
}),
|
||||
sender,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
error_message(&our, km_id, target.clone(), e, &send_to_loop).await;
|
||||
}
|
||||
Err(_) => {
|
||||
error_message(
|
||||
&our,
|
||||
km_id,
|
||||
target.clone(),
|
||||
EthError::RpcTimeout,
|
||||
&send_to_loop,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
error_message(&our, km_id, target.clone(), e, &send_to_loop).await;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// terrible abuse of result in return type, yes, sorry
|
||||
@ -171,38 +193,71 @@ async fn build_subscription(
|
||||
// first, try any url providers we have for this chain,
|
||||
// then if we have none or they all fail, go to node providers.
|
||||
// finally, if no provider works, return an error.
|
||||
for url_provider in &mut aps.urls {
|
||||
|
||||
// bump the successful provider to the front of the list for future requests
|
||||
for (index, url_provider) in aps.urls.iter_mut().enumerate() {
|
||||
let pubsub = match &url_provider.pubsub {
|
||||
Some(pubsub) => pubsub,
|
||||
None => {
|
||||
if let Ok(()) = activate_url_provider(url_provider).await {
|
||||
verbose_print(print_tx, "eth: activated a url provider").await;
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
&format!("eth: activated url provider {}", url_provider.url),
|
||||
)
|
||||
.await;
|
||||
url_provider.pubsub.as_ref().unwrap()
|
||||
} else {
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
&format!("eth: could not activate url provider {}", url_provider.url),
|
||||
)
|
||||
.await;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
};
|
||||
let kind = serde_json::to_value(&kind).unwrap();
|
||||
let params = serde_json::to_value(¶ms).unwrap();
|
||||
if let Ok(id) = pubsub
|
||||
match pubsub
|
||||
.inner()
|
||||
.prepare("eth_subscribe", [kind, params])
|
||||
.await
|
||||
{
|
||||
let rx = pubsub.inner().get_raw_subscription(id).await;
|
||||
return Ok(Ok(rx));
|
||||
Ok(id) => {
|
||||
let rx = pubsub.inner().get_raw_subscription(id).await;
|
||||
let successful_provider = aps.urls.remove(index);
|
||||
aps.urls.insert(0, successful_provider);
|
||||
return Ok(Ok(rx));
|
||||
}
|
||||
Err(rpc_error) => {
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
&format!(
|
||||
"eth: got error from url provider {}: {}",
|
||||
url_provider.url, rpc_error
|
||||
),
|
||||
)
|
||||
.await;
|
||||
// this provider failed and needs to be reset
|
||||
url_provider.pubsub = None;
|
||||
}
|
||||
}
|
||||
// this provider failed and needs to be reset
|
||||
url_provider.pubsub = None;
|
||||
}
|
||||
// now we need a response channel
|
||||
|
||||
let (sender, mut response_receiver) = tokio::sync::mpsc::channel(1);
|
||||
response_channels.insert(km_id, sender);
|
||||
// we need to create our own unique sub id because in the remote provider node,
|
||||
// all subs will be identified under our process address.
|
||||
let remote_sub_id = rand::random();
|
||||
for node_provider in &mut aps.nodes {
|
||||
verbose_print(
|
||||
&print_tx,
|
||||
&format!(
|
||||
"eth: attempting to fulfill via {}",
|
||||
node_provider.kns_update.name
|
||||
),
|
||||
)
|
||||
.await;
|
||||
match forward_to_node_provider(
|
||||
&our,
|
||||
km_id,
|
||||
@ -232,7 +287,7 @@ async fn build_subscription(
|
||||
)
|
||||
.await;
|
||||
response_channels.remove(&km_id);
|
||||
return Ok(Err((node_provider.name.clone(), remote_sub_id)));
|
||||
return Ok(Err((node_provider.kns_update.name.clone(), remote_sub_id)));
|
||||
}
|
||||
EthResponse::Response { .. } => {
|
||||
// the response to a SubscribeLogs request must be an 'ok'
|
||||
|
@ -1144,8 +1144,14 @@ async fn handle_app_message(
|
||||
.send(Printout {
|
||||
verbosity: 2,
|
||||
content: format!(
|
||||
"binding path {path} for {}, authenticated={authenticated}, local={local_only}, cached={cache}",
|
||||
km.source.process
|
||||
"http: binding {path}, {}, {}, {}",
|
||||
if authenticated {
|
||||
"authenticated"
|
||||
} else {
|
||||
"unauthenticated"
|
||||
},
|
||||
if local_only { "local only" } else { "open" },
|
||||
if cache { "cached" } else { "dynamic" },
|
||||
),
|
||||
})
|
||||
.await;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![feature(async_closure)]
|
||||
#![feature(btree_extract_if)]
|
||||
|
||||
use anyhow::Result;
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "lib"
|
||||
authors = ["KinodeDAO"]
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
edition = "2021"
|
||||
description = "A general-purpose sovereign cloud computing platform"
|
||||
homepage = "https://kinode.org"
|
||||
|
@ -155,7 +155,7 @@ pub struct ProviderConfig {
|
||||
pub enum NodeOrRpcUrl {
|
||||
Node {
|
||||
kns_update: crate::core::KnsUpdate,
|
||||
use_as_provider: bool, // for routers inside saved config
|
||||
use_as_provider: bool, // false for just-routers inside saved config
|
||||
},
|
||||
RpcUrl(String),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user