From 3e59998e0366d97758e69f8f936cd65876faba1c Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Wed, 5 Jun 2024 20:56:30 -0700 Subject: [PATCH 1/5] eth: update alloy deps --- Cargo.lock | 574 +++++++++++++++++++++------------ kinode/Cargo.toml | 32 +- kinode/src/eth/mod.rs | 28 +- kinode/src/eth/subscription.rs | 11 +- lib/Cargo.toml | 2 +- 5 files changed, 409 insertions(+), 238 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a04d3d57..9d317264 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,15 +90,52 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy" +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-contract", + "alloy-core", + "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-pubsub", + "alloy-rpc-client", + "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-wallet", + "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-transport-http", + "alloy-transport-ws", + "reqwest 0.12.4", +] + +[[package]] +name = "alloy-chains" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03fd095a9d70f4b1c5c102c84a4c782867a5c6416dbf6dcd42a63e7c7a89d3c8" +dependencies = [ + "num_enum", + "strum", +] + [[package]] name = "alloy-consensus" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", - "alloy-network", - "alloy-primitives 0.6.4", + "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-primitives", "alloy-rlp", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "c-kzg", + "serde", ] [[package]] @@ -107,9 +144,9 @@ version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa" dependencies = [ "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", - "alloy-primitives 0.7.0", + "alloy-primitives", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "c-kzg", "serde", "sha2", @@ -118,28 +155,44 @@ dependencies = [ [[package]] name = "alloy-contract" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", - "alloy-primitives 0.6.4", - "alloy-providers", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", - "alloy-sol-types 0.6.4", - "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", + "alloy-network", + "alloy-primitives", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-sol-types", + "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "futures", + "futures-util", "thiserror", ] [[package]] -name = "alloy-dyn-abi" -version = "0.6.4" +name = "alloy-core" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2919acdad13336bc5dc26b636cdd6892c2f27fb0d4a58320a00c2713cf6a4e9a" +checksum = "31b8b8d8c4e84449ce8f310ed48e09ce38b8290b163e3d0df68ea445a9ccce3a" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd2404399cb1b50572758e66e9b4bf088e5a3df9007be7126456c7e50af935f" dependencies = [ "alloy-json-abi", - "alloy-primitives 0.6.4", + "alloy-primitives", "alloy-sol-type-parser", - "alloy-sol-types 0.6.4", + "alloy-sol-types", "const-hex", "itoa", "serde", @@ -150,12 +203,15 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-primitives 0.6.4", + "alloy-primitives", "alloy-rlp", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "c-kzg", + "once_cell", "serde", - "thiserror", + "sha2", ] [[package]] @@ -163,31 +219,42 @@ name = "alloy-eips" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa" dependencies = [ - "alloy-primitives 0.7.0", + "alloy-primitives", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "c-kzg", "once_cell", "serde", ] +[[package]] +name = "alloy-genesis" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" +dependencies = [ + "alloy-primitives", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "serde", + "serde_json", +] + [[package]] name = "alloy-genesis" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa" dependencies = [ - "alloy-primitives 0.7.0", - "alloy-serde", + "alloy-primitives", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "serde", ] [[package]] name = "alloy-json-abi" -version = "0.6.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ed0f2a6c3a1c947b4508522a53a190dba8f94dcd4e3e1a5af945a498e78f2f" +checksum = "7c3abf6446a292e19853aaca43590eeb48bf435dfd2c74200259e8f4872f6ce3" dependencies = [ - "alloy-primitives 0.6.4", + "alloy-primitives", "alloy-sol-type-parser", "serde", "serde_json", @@ -196,12 +263,13 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-primitives 0.6.4", + "alloy-primitives", "serde", "serde_json", "thiserror", + "tracing", ] [[package]] @@ -209,7 +277,7 @@ name = "alloy-json-rpc" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa" dependencies = [ - "alloy-primitives 0.7.0", + "alloy-primitives", "serde", "serde_json", "thiserror", @@ -219,91 +287,91 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "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", -] - -[[package]] -name = "alloy-primitives" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d34d8de81e23b6d909c094e23b3d357e01ca36b78a8c5424c501eedbe86f0" -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-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 0.6.4", - "alloy-rpc-client", - "alloy-rpc-trace-types", - "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", + "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-primitives", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-signer", + "alloy-sol-types", "async-trait", "auto_impl", - "reqwest 0.11.27", - "serde", + "futures-utils-wasm", "thiserror", ] +[[package]] +name = "alloy-primitives" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5277af0cbcc483ee6ad2c1e818090b5928d27f04fd6580680f31c1cf8068bcc2" +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-provider" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" +dependencies = [ + "alloy-chains", + "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-primitives", + "alloy-pubsub", + "alloy-rpc-client", + "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-ws", + "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" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "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)", + "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-primitives", + "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "bimap", "futures", "serde", "serde_json", "tokio", + "tokio-stream", "tower", "tracing", ] @@ -333,42 +401,38 @@ dependencies = [ [[package]] name = "alloy-rpc-client" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", - "alloy-primitives 0.6.4", + "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-primitives", "alloy-pubsub", - "alloy-transport 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=05f8162)", "alloy-transport-http", "alloy-transport-ws", "futures", "pin-project", - "reqwest 0.11.27", + "reqwest 0.12.4", "serde", "serde_json", + "tokio", + "tokio-stream", "tower", "tracing", "url", ] -[[package]] -name = "alloy-rpc-trace-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" -dependencies = [ - "alloy-primitives 0.6.4", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", - "serde", - "serde_json", -] - [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-primitives 0.6.4", + "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-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-primitives", "alloy-rlp", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-sol-types", "itertools 0.12.1", "serde", "serde_json", @@ -382,23 +446,45 @@ source = "git+https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d69f433e4 dependencies = [ "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", - "alloy-genesis", - "alloy-primitives 0.7.0", + "alloy-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", + "alloy-primitives", "alloy-rlp", - "alloy-serde", - "alloy-sol-types 0.7.0", + "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", + "alloy-sol-types", "itertools 0.12.1", "serde", "serde_json", "thiserror", ] +[[package]] +name = "alloy-rpc-types-trace" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" +dependencies = [ + "alloy-primitives", + "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)", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-serde" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + [[package]] name = "alloy-serde" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d69f433e45d190902e58b1c996b35adfa" dependencies = [ - "alloy-primitives 0.7.0", + "alloy-primitives", "serde", "serde_json", ] @@ -406,98 +492,99 @@ dependencies = [ [[package]] name = "alloy-signer" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-network", - "alloy-primitives 0.6.4", + "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-primitives", + "alloy-signer", + "async-trait", + "k256", "rand 0.8.5", "thiserror", ] [[package]] name = "alloy-sol-macro" -version = "0.6.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86ec0a47740b20bc5613b8712d0d321d031c4efc58e9645af96085d5cccfc27" +checksum = "30708a79919b082f2692423c8cc72fc250477e4a2ecb0d4a7244cd3cdb299965" dependencies = [ - "const-hex", - "dunce", - "heck 0.4.1", - "indexmap", + "alloy-sol-macro-expander", + "alloy-sol-macro-input", "proc-macro-error", "proc-macro2", "quote", "syn 2.0.60", - "syn-solidity 0.6.4", - "tiny-keccak", ] [[package]] -name = "alloy-sol-macro" -version = "0.7.0" +name = "alloy-sol-macro-expander" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452d929748ac948a10481fff4123affead32c553cf362841c5103dd508bdfc16" +checksum = "1c7a679ac01774ab7e00a567a918d4231ae692c5c8cedaf4e16956c3116d7896" dependencies = [ + "alloy-json-abi", "alloy-sol-macro-input", "const-hex", - "heck 0.4.1", + "heck 0.5.0", "indexmap", "proc-macro-error", "proc-macro2", "quote", "syn 2.0.60", - "syn-solidity 0.7.0", + "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df64e094f6d2099339f9e82b5b38440b159757b6920878f28316243f8166c8d1" +checksum = "356da0c2228aa6675a5faaa08a3e4061b967f924753983d72b9a18d9a3fad44e" dependencies = [ + "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", + "serde_json", "syn 2.0.60", - "syn-solidity 0.7.0", + "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.6.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0045cc89524e1451ccf33e8581355b6027ac7c6e494bb02959d4213ad0d8e91d" +checksum = "81fd4783b0a5840479013e9ce960d2eb7b3be381f722e0fe3d1f7c3bb6bd4ebd" dependencies = [ "winnow 0.6.6", ] [[package]] name = "alloy-sol-types" -version = "0.6.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad09ec5853fa700d12d778ad224dcdec636af424d29fad84fb9a2f16a5b0ef09" +checksum = "6eb5e6234c0b62514992589fe1578f64d418dbc8ef5cd1ab2d7f2f568f599698" dependencies = [ - "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", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", "const-hex", "serde", ] @@ -505,11 +592,12 @@ dependencies = [ [[package]] name = "alloy-transport" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", - "base64 0.21.7", + "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "base64 0.22.0", "futures-util", + "futures-utils-wasm", "serde", "serde_json", "thiserror", @@ -540,23 +628,24 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ - "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", + "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", + "reqwest 0.12.4", "serde_json", "tower", + "tracing", "url", ] [[package]] name = "alloy-transport-ws" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +source = "git+https://github.com/alloy-rs/alloy?rev=05f8162#05f81621e2edd9781e5f95b2fe2489ed979dd0be" dependencies = [ "alloy-pubsub", - "alloy-transport 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=05f8162)", "futures", "http 0.2.12", "serde_json", @@ -645,8 +734,8 @@ checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" name = "app_store" version = "0.3.1" dependencies = [ - "alloy-primitives 0.7.0", - "alloy-sol-types 0.7.0", + "alloy-primitives", + "alloy-sol-types", "anyhow", "bincode", "kinode_process_lib 0.8.0 (git+https://github.com/kinode-dao/process_lib?rev=830a86c)", @@ -806,6 +895,28 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "async-trait" version = "0.1.80" @@ -3022,7 +3133,6 @@ dependencies = [ "elliptic-curve", "once_cell", "sha2", - "signature", ] [[package]] @@ -3072,18 +3182,11 @@ name = "kinode" version = "0.8.0" dependencies = [ "aes-gcm", - "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", - "alloy-contract", - "alloy-network", - "alloy-primitives 0.6.4", - "alloy-providers", - "alloy-pubsub", - "alloy-rpc-client", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", + "alloy", + "alloy-primitives", "alloy-signer", - "alloy-sol-macro 0.6.4", - "alloy-sol-types 0.6.4", - "alloy-transport-ws", + "alloy-sol-macro", + "alloy-sol-types", "anyhow", "async-trait", "base64 0.22.0", @@ -3158,7 +3261,7 @@ version = "0.8.0" source = "git+https://github.com/kinode-dao/process_lib?rev=7820481#78204816d1a2d5213555655c796950a32403eac6" dependencies = [ "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", - "alloy-primitives 0.7.0", + "alloy-primitives", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "anyhow", @@ -3180,7 +3283,7 @@ version = "0.8.0" source = "git+https://github.com/kinode-dao/process_lib.git?rev=7eb3a04#7eb3a04f9be79d1cc3a52fa460faeea7ba3008ed" dependencies = [ "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", - "alloy-primitives 0.7.0", + "alloy-primitives", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "anyhow", @@ -3202,7 +3305,7 @@ version = "0.8.0" source = "git+https://github.com/kinode-dao/process_lib?rev=830a86c#830a86cbcb210ebff82b5df95eae39edd16f022b" dependencies = [ "alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", - "alloy-primitives 0.7.0", + "alloy-primitives", "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "alloy-transport 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=cad7935)", "anyhow", @@ -3257,8 +3360,8 @@ dependencies = [ name = "kns_indexer" version = "0.3.0" dependencies = [ - "alloy-primitives 0.7.0", - "alloy-sol-types 0.7.0", + "alloy-primitives", + "alloy-sol-types", "anyhow", "bincode", "hex", @@ -3291,7 +3394,7 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" name = "lib" version = "0.8.0" dependencies = [ - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=05f8162)", "anyhow", "kit", "lazy_static", @@ -3437,6 +3540,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.3", +] + [[package]] name = "lz4-sys" version = "1.9.4" @@ -3721,6 +3833,26 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "object" version = "0.32.2" @@ -4620,9 +4752,9 @@ checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" [[package]] name = "ruint" -version = "1.12.1" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f308135fef9fc398342da5472ce7c484529df23743fb7c734e0f3d472971e62" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -4644,9 +4776,9 @@ dependencies = [ [[package]] name = "ruint-macro" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rusqlite" @@ -4760,6 +4892,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + [[package]] name = "rusty-fork" version = "0.3.0" @@ -5203,6 +5341,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.60", +] + [[package]] name = "subtle" version = "2.5.0" @@ -5233,21 +5393,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.6.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3d0961cd53c23ea94eeec56ba940f636f6394788976e9f16ca5ee0aca7464a" -dependencies = [ - "paste", - "proc-macro2", - "quote", - "syn 2.0.60", -] - -[[package]] -name = "syn-solidity" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4497156948bd342b52038035a6fa514a89626e37af9d2c52a5e8d8ebcc7ee479" +checksum = "e6fe08d08d84f2c0a77f1e7c46518789d745c2e87a2721791ed7c3c9bc78df28" dependencies = [ "paste", "proc-macro2", @@ -5493,6 +5641,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + [[package]] name = "tokio-tungstenite" version = "0.20.1" diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 929f6d42..df5e5372 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -26,18 +26,26 @@ simulation-mode = [] [dependencies] aes-gcm = "0.10.3" -alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]} -alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } -alloy-primitives = "0.6.2" -alloy-sol-macro = "0.6.2" -alloy-sol-types = "0.6.2" -alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } +alloy = { git = "https://github.com/alloy-rs/alloy", rev = "05f8162", features = [ + "consensus", + "contract", + "json-rpc", + "network", + "provider-ws", + "providers", + "pubsub", + "rpc-client-ws", + "rpc-client", + "rpc-types-eth", + "rpc-types", + "signer-wallet", + "signers", +] } + +alloy-primitives = "0.7.5" +alloy-sol-macro = "0.7.5" +alloy-sol-types = "0.7.5" +alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "05f8162" } anyhow = "1.0.71" async-trait = "0.1.71" base64 = "0.22.0" diff --git a/kinode/src/eth/mod.rs b/kinode/src/eth/mod.rs index bee8c092..621f66e2 100644 --- a/kinode/src/eth/mod.rs +++ b/kinode/src/eth/mod.rs @@ -1,7 +1,6 @@ -use alloy_providers::provider::Provider; -use alloy_pubsub::PubSubFrontend; -use alloy_rpc_client::ClientBuilder; -use alloy_transport_ws::WsConnect; +use alloy::providers::{Provider, ProviderBuilder, RootProvider}; +use alloy::pubsub::PubSubFrontend; +use alloy::rpc::client::WsConnect; use anyhow::Result; use dashmap::DashMap; use lib::types::core::*; @@ -41,7 +40,7 @@ struct ActiveProviders { struct UrlProvider { pub trusted: bool, pub url: String, - pub pubsub: Option>, + pub pubsub: Option>, } #[derive(Debug)] @@ -611,7 +610,7 @@ async fn fulfill_request( } } }; - match pubsub.inner().prepare(method, params.clone()).await { + match pubsub.raw_request(method.into(), params.clone()).await { Ok(value) => { let successful_provider = aps.urls.remove(index); aps.urls.insert(0, successful_provider); @@ -626,6 +625,13 @@ async fn fulfill_request( ), ) .await; + // if ErrorResp, return to user, this is a tx issue. + // match rpc_error { + // RpcError::ErrorResp(_) => { + // // this provider failed and needs to be reset + // url_provider.pubsub = None; + // } + // } // this provider failed and needs to be reset url_provider.pubsub = None; } @@ -853,16 +859,14 @@ async fn handle_eth_config_action( async fn activate_url_provider(provider: &mut UrlProvider) -> Result<()> { match Url::parse(&provider.url)?.scheme() { "ws" | "wss" => { - let connector = WsConnect { - url: provider.url.to_string(), - auth: None, - }; + let ws = WsConnect::new(provider.url.to_string()); + let client = tokio::time::timeout( std::time::Duration::from_secs(10), - ClientBuilder::default().ws(connector), + ProviderBuilder::new().on_ws(ws), ) .await??; - provider.pubsub = Some(Provider::new_with_client(client)); + provider.pubsub = Some(client); Ok(()) } _ => Err(anyhow::anyhow!( diff --git a/kinode/src/eth/subscription.rs b/kinode/src/eth/subscription.rs index 92b1d2e1..072a363f 100644 --- a/kinode/src/eth/subscription.rs +++ b/kinode/src/eth/subscription.rs @@ -1,6 +1,6 @@ use crate::eth::*; -use alloy_pubsub::RawSubscription; -use alloy_rpc_types::pubsub::SubscriptionResult; +use alloy::pubsub::RawSubscription; +use alloy::rpc::types::eth::pubsub::SubscriptionResult; /// cleans itself up when the subscription is closed or fails. pub async fn create_new_subscription( @@ -212,12 +212,11 @@ async fn build_subscription( let kind = serde_json::to_value(&kind).unwrap(); let params = serde_json::to_value(¶ms).unwrap(); match pubsub - .inner() - .prepare("eth_subscribe", [kind, params]) + .subscribe::<[serde_json::Value; 2], serde_json::Value>([kind, params]) .await { - Ok(id) => { - let rx = pubsub.inner().get_raw_subscription(id).await; + Ok(sub) => { + let rx = sub.into_raw(); let successful_provider = aps.urls.remove(index); aps.urls.insert(0, successful_provider); return Ok(Ok(rx)); diff --git a/lib/Cargo.toml b/lib/Cargo.toml index ab1c8016..5f3b4383 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -17,7 +17,7 @@ reqwest = { version = "0.12.4", features = ["blocking"] } tokio = "1.28" [dependencies] -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "05f8162" } lazy_static = "1.4.0" rand = "0.8.4" ring = "0.17.8" From d8c3926e3753e6fba6969ae30be335b12221b46e Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Wed, 5 Jun 2024 21:28:47 -0700 Subject: [PATCH 2/5] register & fakenet: update to new alloy --- kinode/src/fakenet/helpers.rs | 1 - kinode/src/fakenet/mod.rs | 85 +++++++++++++++++------------------ kinode/src/register.rs | 69 +++++++++++++--------------- 3 files changed, 71 insertions(+), 84 deletions(-) diff --git a/kinode/src/fakenet/helpers.rs b/kinode/src/fakenet/helpers.rs index cf543b85..4235b7d0 100644 --- a/kinode/src/fakenet/helpers.rs +++ b/kinode/src/fakenet/helpers.rs @@ -2,7 +2,6 @@ use alloy_sol_macro::sol; use sha3::{Digest, Keccak256}; sol! { - #[sol(rpc)] contract RegisterHelpers { function register( bytes calldata _name, diff --git a/kinode/src/fakenet/mod.rs b/kinode/src/fakenet/mod.rs index 9e2c1276..a34cc116 100644 --- a/kinode/src/fakenet/mod.rs +++ b/kinode/src/fakenet/mod.rs @@ -1,12 +1,11 @@ -use alloy_consensus::TxLegacy; -use alloy_network::{Transaction, TxKind}; +use alloy::network::{eip2718::Encodable2718, EthereumSigner, TransactionBuilder}; +use alloy::providers::{Provider, ProviderBuilder, RootProvider}; +use alloy::pubsub::PubSubFrontend; +use alloy::rpc::client::WsConnect; +use alloy::rpc::types::eth::{TransactionInput, TransactionRequest}; +use alloy::signers::wallet::LocalWallet; use alloy_primitives::{Address, Bytes, FixedBytes, B256, U256}; -use alloy_providers::provider::{Provider, TempProvider}; -use alloy_rpc_client::ClientBuilder; -use alloy_rpc_types::request::{TransactionInput, TransactionRequest}; -use alloy_signer::{LocalWallet, Signer, SignerSync}; use alloy_sol_types::{SolCall, SolValue}; -use alloy_transport_ws::WsConnect; use lib::core::{Identity, NodeRouting}; use std::str::FromStr; @@ -31,17 +30,17 @@ pub async fn register_local( "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", )?; + let wallet_address = wallet.address(); + + let signer: EthereumSigner = wallet.into(); + let dotdev = Address::from_str(FAKE_DOTDEV)?; let kns = Address::from_str(KNS_ADDRESS)?; let endpoint = format!("ws://localhost:{}", fakechain_port); - let ws = WsConnect { - url: endpoint, - auth: None, - }; + let ws = WsConnect::new(endpoint); - let client = ClientBuilder::default().ws(ws).await?; - let provider = Provider::new_with_client(client); + let provider: RootProvider = ProviderBuilder::default().on_ws(ws).await?; let fqdn = dns_encode_fqdn(name); let namehash = encode_namehash(name); @@ -73,10 +72,10 @@ pub async fn register_local( .abi_encode(); let exists_tx = TransactionRequest::default() - .to(Some(dotdev)) + .to(dotdev) .input(TransactionInput::new(exists_call.into())); - let exists = provider.call(exists_tx, None).await; + let exists = provider.call(&exists_tx).await; let (call_input, to) = match exists { Err(_e) => { @@ -106,33 +105,40 @@ pub async fn register_local( }; let multicall = multicallCall { - data: vec![set_ip.abi_encode(), set_key.abi_encode()], + data: vec![ + Bytes::from(set_ip.abi_encode()), + Bytes::from(set_key.abi_encode()), + ], } .abi_encode(); (multicall, kns) } }; - let nonce = provider - .get_transaction_count(wallet.address(), None) - .await?; + let nonce = provider.get_transaction_count(wallet_address).await?; - let mut tx = TxLegacy { - to: TxKind::Call(to), - nonce: nonce.to::(), - input: call_input.into(), - chain_id: Some(31337), - gas_limit: 3000000, - gas_price: 100000000000, + let input = TransactionInput { + input: Some(call_input.into()), ..Default::default() }; - let sig = wallet.sign_transaction_sync(&mut tx)?; - let signed_tx = tx.into_signed(sig); - let mut buf = vec![]; - signed_tx.encode_signed(&mut buf); + let tx = TransactionRequest::default() + .to(to) + .input(input) + .nonce(nonce) + .with_chain_id(31337) + .with_gas_limit(21_000) + .with_max_priority_fee_per_gas(1_000_000_000) + .with_max_fee_per_gas(20_000_000_000); - let _tx_hash = provider.send_raw_transaction(buf.into()).await?; + // Build the transaction using the `EthereumSigner` with the provided signer. + let tx_envelope = tx.build(&signer).await?; + + // Encode the transaction using EIP-2718 encoding. + let tx_encoded = tx_envelope.encoded_2718(); + + // Send the raw transaction and retrieve the transaction receipt. + let _tx_hash = provider.send_raw_transaction(&tx_encoded).await?; Ok(()) } @@ -146,25 +152,16 @@ pub async fn assign_ws_local_helper( ) -> Result<(), anyhow::Error> { let kns = Address::from_str(KNS_ADDRESS)?; let endpoint = format!("ws://localhost:{}", fakechain_port); + let ws = WsConnect::new(endpoint); - let ws = WsConnect { - url: endpoint, - auth: None, - }; - - let client = ClientBuilder::default().ws(ws).await?; - let provider = Provider::new_with_client(client); + let provider: RootProvider = ProviderBuilder::default().on_ws(ws).await?; let namehash = FixedBytes::<32>::from_slice(&keygen::namehash(&our.name)); let ip_call = ipCall { _0: namehash }.abi_encode(); let tx_input = TransactionInput::new(Bytes::from(ip_call)); - let tx = TransactionRequest { - to: Some(kns), - input: tx_input, - ..Default::default() - }; + let tx = TransactionRequest::default().to(kns).input(tx_input); - let Ok(ip_data) = provider.call(tx, None).await else { + let Ok(ip_data) = provider.call(&tx).await else { return Err(anyhow::anyhow!("Failed to fetch node IP data from PKI")); }; diff --git a/kinode/src/register.rs b/kinode/src/register.rs index 5c6b5f54..95aec391 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -1,14 +1,13 @@ use crate::keygen; use crate::KNS_ADDRESS; +use alloy::providers::{Provider, ProviderBuilder, RootProvider}; +use alloy::pubsub::PubSubFrontend; +use alloy::rpc::client::WsConnect; +use alloy::rpc::types::eth::{TransactionInput, TransactionRequest}; use alloy_primitives::{Address as EthAddress, Bytes, FixedBytes, U256}; -use alloy_providers::provider::{Provider, TempProvider}; -use alloy_pubsub::PubSubFrontend; -use alloy_rpc_client::ClientBuilder; -use alloy_rpc_types::request::{TransactionInput, TransactionRequest}; use alloy_signer::Signature; use alloy_sol_macro::sol; use alloy_sol_types::{SolCall, SolValue}; -use alloy_transport_ws::WsConnect; use base64::{engine::general_purpose::STANDARD as base64_standard, Engine}; use lib::types::core::*; use ring::rand::SystemRandom; @@ -254,7 +253,7 @@ pub async fn register( .await; } -pub async fn connect_to_provider(maybe_rpc: Option) -> Provider { +pub async fn connect_to_provider(maybe_rpc: Option) -> RootProvider { // This ETH provider uses public rpc endpoints to verify registration signatures. let url = if let Some(rpc_url) = maybe_rpc { rpc_url @@ -265,12 +264,10 @@ pub async fn connect_to_provider(maybe_rpc: Option) -> Provider) -> Provider>) -> Result { @@ -350,7 +347,7 @@ async fn handle_boot( our: Arc, networking_keypair: Arc>, kns_address: EthAddress, - provider: Arc>, + provider: Arc>, ) -> Result { let mut our = our.as_ref().clone(); @@ -379,13 +376,13 @@ async fn handle_boot( } let namehash = FixedBytes::<32>::from_slice(&keygen::namehash(&our.name)); + let tld_call = nodesCall { _0: namehash }.abi_encode(); let tx_input = TransactionInput::new(Bytes::from(tld_call)); - let tx = TransactionRequest { - to: Some(kns_address), - input: tx_input, - ..Default::default() - }; + + let tx = TransactionRequest::default() + .to(kns_address) + .input(tx_input); // this call can fail if the indexer has not caught up to the transaction // that just got confirmed on our frontend. for this reason, we retry @@ -394,7 +391,7 @@ async fn handle_boot( let mut attempts = 0; let mut tld_result = Err(()); while attempts < 5 { - match provider.call(tx.clone(), None).await { + match provider.call(&tx).await { Ok(tld) => { tld_result = Ok(tld); break; @@ -428,13 +425,11 @@ async fn handle_boot( } .abi_encode(); let tx_input = TransactionInput::new(Bytes::from(auth_call)); - let tx = TransactionRequest { - to: Some(tld_address), - input: tx_input, - ..Default::default() - }; + let tx = TransactionRequest::default() + .to(tld_address) + .input(tx_input); - let Ok(authed) = provider.call(tx, None).await else { + let Ok(authed) = provider.call(&tx).await else { return Ok(warp::reply::with_status( warp::reply::json(&"Failed to fetch associated address for username"), StatusCode::INTERNAL_SERVER_ERROR, @@ -503,7 +498,7 @@ async fn handle_import_keyfile( tcp_networking_port: (u16, bool), sender: Arc, kns_address: EthAddress, - provider: Arc>, + provider: Arc>, ) -> Result { // if keyfile was not present in node and is present from user upload let encoded_keyfile = match base64_standard.decode(info.keyfile.clone()) { @@ -573,7 +568,7 @@ async fn handle_login( sender: Arc, encoded_keyfile: Option>, kns_address: EthAddress, - provider: Arc>, + provider: Arc>, ) -> Result { if encoded_keyfile.is_none() { return Ok(warp::reply::with_status( @@ -701,7 +696,7 @@ async fn confirm_change_network_keys( pub async fn assign_routing( our: &mut Identity, kns_address: EthAddress, - provider: Arc>, + provider: Arc>, ws_networking_port: (u16, bool), tcp_networking_port: (u16, bool), ) -> anyhow::Result<()> { @@ -709,13 +704,11 @@ pub async fn assign_routing( let ip_call = ipCall { _0: namehash }.abi_encode(); let key_call = keyCall { _0: namehash }.abi_encode(); let tx_input = TransactionInput::new(Bytes::from(ip_call)); - let tx = TransactionRequest { - to: Some(kns_address), - input: tx_input, - ..Default::default() - }; + let tx = TransactionRequest::default() + .to(kns_address) + .input(tx_input); - let Ok(ip_data) = provider.call(tx, None).await else { + let Ok(ip_data) = provider.call(&tx).await else { return Err(anyhow::anyhow!("Failed to fetch node IP data from PKI")); }; @@ -725,13 +718,11 @@ pub async fn assign_routing( }; let key_tx_input = TransactionInput::new(Bytes::from(key_call)); - let key_tx = TransactionRequest { - to: Some(kns_address), - input: key_tx_input, - ..Default::default() - }; + let key_tx = TransactionRequest::default() + .to(kns_address) + .input(key_tx_input); - let Ok(public_key) = provider.call(key_tx, None).await else { + let Ok(public_key) = provider.call(&key_tx).await else { return Err(anyhow::anyhow!("Failed to fetch node key from PKI")); }; From 1cfe1e6e743f21addc519e2c3b636eb95d224223 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 6 Jun 2024 20:21:57 -0700 Subject: [PATCH 3/5] eth: fix 'broken' subscriptions --- kinode/src/eth/subscription.rs | 2 +- kinode/src/fakenet/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kinode/src/eth/subscription.rs b/kinode/src/eth/subscription.rs index 08d29905..41d9c8c1 100644 --- a/kinode/src/eth/subscription.rs +++ b/kinode/src/eth/subscription.rs @@ -212,7 +212,7 @@ async fn build_subscription( let kind = serde_json::to_value(&kind).unwrap(); let params = serde_json::to_value(¶ms).unwrap(); match pubsub - .subscribe::<[serde_json::Value; 2], serde_json::Value>([kind, params]) + .subscribe::<[serde_json::Value; 2], SubscriptionResult>([kind, params]) .await { Ok(sub) => { diff --git a/kinode/src/fakenet/mod.rs b/kinode/src/fakenet/mod.rs index a34cc116..582e8f44 100644 --- a/kinode/src/fakenet/mod.rs +++ b/kinode/src/fakenet/mod.rs @@ -127,7 +127,7 @@ pub async fn register_local( .input(input) .nonce(nonce) .with_chain_id(31337) - .with_gas_limit(21_000) + .with_gas_limit(500_000) .with_max_priority_fee_per_gas(1_000_000_000) .with_max_fee_per_gas(20_000_000_000); From f25219c63e1103aef040a21266d4a95db9e40e89 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 7 Jun 2024 09:46:43 -0700 Subject: [PATCH 4/5] fix: remove extra alloy-signer dep --- Cargo.lock | 1 - kinode/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f61d5775..1bf42ecf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3184,7 +3184,6 @@ dependencies = [ "aes-gcm", "alloy", "alloy-primitives", - "alloy-signer", "alloy-sol-macro", "alloy-sol-types", "anyhow", diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index df5e5372..e52596a8 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -45,7 +45,6 @@ alloy = { git = "https://github.com/alloy-rs/alloy", rev = "05f8162", features = alloy-primitives = "0.7.5" alloy-sol-macro = "0.7.5" alloy-sol-types = "0.7.5" -alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "05f8162" } anyhow = "1.0.71" async-trait = "0.1.71" base64 = "0.22.0" From 0ac4b63c5406e649cbcd1fdc1e284b3ad2ecd8c4 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 7 Jun 2024 09:50:55 -0700 Subject: [PATCH 5/5] eth: fix rpcerror ordering --- kinode/src/eth/mod.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/kinode/src/eth/mod.rs b/kinode/src/eth/mod.rs index 49be5562..a9999059 100644 --- a/kinode/src/eth/mod.rs +++ b/kinode/src/eth/mod.rs @@ -618,10 +618,6 @@ async fn fulfill_request( return EthResponse::Response { value }; } Err(rpc_error) => { - // if rpc_error is of type ErrResponse, return to user! - if let RpcError::ErrorResp(err) = rpc_error { - return EthResponse::Err(EthError::RpcError(err)); - } verbose_print( print_tx, &format!( @@ -630,13 +626,10 @@ async fn fulfill_request( ), ) .await; - // if ErrorResp, return to user, this is a tx issue. - // match rpc_error { - // RpcError::ErrorResp(_) => { - // // this provider failed and needs to be reset - // url_provider.pubsub = None; - // } - // } + // if rpc_error is of type ErrResponse, return to user! + if let RpcError::ErrorResp(err) = rpc_error { + return EthResponse::Err(EthError::RpcError(err)); + } // this provider failed and needs to be reset url_provider.pubsub = None; }