From f54a487c9a35194813add1df8158924392b29d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20F=2E=20=C5=A0?= Date: Wed, 22 Nov 2023 14:03:07 +0100 Subject: [PATCH] Introduce CCIP support (#25) * Initital local CCIP testing * Complete CCIP support & fixes * Cargo.lock --- server/Cargo.lock | 100 +++++++++----- server/src/main.rs | 6 +- server/src/routes/mod.rs | 1 + shared/Cargo.lock | 139 +++++++++++++------- shared/Cargo.toml | 10 +- shared/src/models/eip155/mod.rs | 6 +- shared/src/models/lookup/addr.rs | 10 +- shared/src/models/lookup/image.rs | 5 +- shared/src/models/lookup/mod.rs | 59 ++++++++- shared/src/models/lookup/multicoin.rs | 5 +- shared/src/models/lookup/text.rs | 6 +- shared/src/models/profile/error.rs | 9 +- shared/src/models/profile/from_name.rs | 28 +++- shared/src/models/universal_resolver/mod.rs | 30 +++-- shared/src/utils/eip55.rs | 3 + worker/Cargo.lock | 127 ++++++++++++------ worker/src/http_util.rs | 1 + 17 files changed, 372 insertions(+), 173 deletions(-) diff --git a/server/Cargo.lock b/server/Cargo.lock index f3205e4..b0ee4c6 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -393,9 +393,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", @@ -931,7 +931,7 @@ dependencies = [ "dotenvy", "enstate_shared", "ethers", - "ethers-ccip-read", + "ethers-ccip-read 0.1.1 (git+https://github.com/ensdomains/ethers-ccip-read?branch=main)", "ethers-contract", "ethers-core", "futures", @@ -972,6 +972,7 @@ dependencies = [ "crc16", "crc32fast", "ethers", + "ethers-ccip-read 0.1.1 (git+https://github.com/v3xlabs/rust-ethers-ccip-read?branch=rework)", "ethers-contract", "ethers-core", "getrandom", @@ -1121,11 +1122,28 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ethers-ccip-read" +version = "0.1.1" +source = "git+https://github.com/v3xlabs/rust-ethers-ccip-read?branch=rework#2db3c12f15dd0aa01b96c85247740a1eb0c33a50" +dependencies = [ + "async-recursion", + "async-trait", + "ethers-core", + "ethers-providers", + "futures-util", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "ethers-contract" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79269278125006bb0552349c03593ffa9702112ca88bc7046cc669f148fb47c" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" dependencies = [ "const-hex", "ethers-contract-abigen", @@ -1142,9 +1160,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" dependencies = [ "Inflector", "const-hex", @@ -1166,9 +1184,9 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" dependencies = [ "Inflector", "const-hex", @@ -1182,9 +1200,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" dependencies = [ "arrayvec", "bytes", @@ -1212,10 +1230,11 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" +checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" dependencies = [ + "chrono", "ethers-core", "reqwest", "semver", @@ -1254,9 +1273,9 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ "async-trait", "auto_impl", @@ -2145,9 +2164,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -2616,7 +2635,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -3179,18 +3198,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -3199,9 +3218,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -3220,9 +3239,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -3663,9 +3682,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -3682,9 +3701,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -3753,21 +3772,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.21.0", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -3777,6 +3796,17 @@ name = "toml_edit" version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.2", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.0.2", "serde", diff --git a/server/src/main.rs b/server/src/main.rs index e7e0141..42dc2d7 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -24,7 +24,11 @@ mod state; async fn main() { dotenv().ok(); - let filter = EnvFilter::new(format!("enstate={}", Level::DEBUG)); + let filter = EnvFilter::new(format!( + "enstate={},ethers_ccip_read={}", + Level::DEBUG, + Level::DEBUG + )); let subscriber = FmtSubscriber::builder() // all spans/events with a level higher than TRACE (e.g, debug, info, warn, etc.) diff --git a/server/src/routes/mod.rs b/server/src/routes/mod.rs index 7b62a6b..027c5b4 100644 --- a/server/src/routes/mod.rs +++ b/server/src/routes/mod.rs @@ -28,6 +28,7 @@ pub type RouteError = (StatusCode, Json); pub fn profile_http_error_mapper(err: ProfileError) -> RouteError { let status = match err { ProfileError::NotFound => StatusCode::NOT_FOUND, + ProfileError::CCIPError(_) => StatusCode::BAD_GATEWAY, _ => StatusCode::INTERNAL_SERVER_ERROR, }; diff --git a/shared/Cargo.lock b/shared/Cargo.lock index 7a4382d..02fab3e 100644 --- a/shared/Cargo.lock +++ b/shared/Cargo.lock @@ -83,6 +83,17 @@ dependencies = [ "term", ] +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "async-trait" version = "0.1.74" @@ -315,9 +326,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", @@ -809,6 +820,7 @@ dependencies = [ "crc16", "crc32fast", "ethers", + "ethers-ccip-read", "ethers-contract", "ethers-core", "getrandom", @@ -944,11 +956,29 @@ dependencies = [ "serde_json", ] +[[package]] +name = "ethers-ccip-read" +version = "0.1.1" +source = "git+https://github.com/v3xlabs/rust-ethers-ccip-read?branch=rework#4bc0e480539d3636186a97daa51790bc7698b05a" +dependencies = [ + "async-recursion", + "async-trait", + "ethers-core", + "ethers-providers", + "futures-util", + "getrandom", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "ethers-contract" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79269278125006bb0552349c03593ffa9702112ca88bc7046cc669f148fb47c" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" dependencies = [ "const-hex", "ethers-contract-abigen", @@ -965,9 +995,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" dependencies = [ "Inflector", "const-hex", @@ -989,9 +1019,9 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" dependencies = [ "Inflector", "const-hex", @@ -1005,9 +1035,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" dependencies = [ "arrayvec", "bytes", @@ -1035,10 +1065,11 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" +checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" dependencies = [ + "chrono", "ethers-core", "reqwest", "semver", @@ -1077,9 +1108,9 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ "async-trait", "auto_impl", @@ -1088,6 +1119,7 @@ dependencies = [ "const-hex", "enr", "ethers-core", + "futures-channel", "futures-core", "futures-timer", "futures-util", @@ -1280,9 +1312,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1290,9 +1322,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" @@ -1307,9 +1339,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-locks" @@ -1323,9 +1355,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -1334,15 +1366,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -1356,9 +1388,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -1936,9 +1968,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -2391,7 +2423,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -2880,18 +2912,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -2900,9 +2932,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -2911,9 +2943,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -3314,9 +3346,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -3333,9 +3365,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -3393,21 +3425,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.21.0", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -3417,6 +3449,17 @@ name = "toml_edit" version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.2", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.0.2", "serde", diff --git a/shared/Cargo.toml b/shared/Cargo.toml index f737f2a..1885012 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -10,7 +10,7 @@ wasm-opt = false [dependencies] ethers = "2" anyhow = "1.0.71" -ethers-core = "2.0.9" +ethers-core = "2.0.11" hex-literal = "0.4.1" tracing = "0.1.27" bs58 = "0.5.0" @@ -22,9 +22,8 @@ blake2 = "0.10.6" sha2 = "0.10.7" thiserror = "1.0.48" lazy_static = "1.4.0" -# ethers-ccip-read = { git = "https://github.com/ensdomains/ethers-ccip-read", branch = "main" } serde = { version = "1.0", features = ["derive"] } -ethers-contract = "2.0.9" +ethers-contract = "2.0.11" serde_with = "3.4.0" async-trait = "0.1.74" regex = "1.9.5" @@ -33,9 +32,8 @@ rustc-hex = "2.0.1" serde_json = "1.0.96" crc32fast = "1.3.2" hex = "0.4.3" -reqwest = "*" - -# ethers-ccip-read = { git = "https://github.com/ensdomains/ethers-ccip-read" } +reqwest = "0.11.22" +ethers-ccip-read = { git = "https://github.com/v3xlabs/rust-ethers-ccip-read", branch = "rework" } # needed to enable the "js" feature for compatibility with wasm, # see https://docs.rs/getrandom/#webassembly-support diff --git a/shared/src/models/eip155/mod.rs b/shared/src/models/eip155/mod.rs index 7fa39c0..36f899c 100644 --- a/shared/src/models/eip155/mod.rs +++ b/shared/src/models/eip155/mod.rs @@ -1,4 +1,6 @@ +use ethers::middleware::Middleware; use ethers::providers::{Http, Provider, ProviderError}; +use ethers_ccip_read::CCIPReadMiddleware; use ethers_core::{ abi::{ParamType, Token}, types::{transaction::eip2718::TypedTransaction, Bytes, H160, U256}, @@ -54,7 +56,7 @@ pub async fn resolve_eip155( contract_type: EIP155ContractType, contract_address: &str, token_id: U256, - provider: &Provider, + provider: &CCIPReadMiddleware>, opensea_api_key: &str, ) -> Result { let chain_id: u64 = chain_id.into(); @@ -84,7 +86,7 @@ pub async fn resolve_eip155( typed_transaction.set_to(contract_h160); typed_transaction.set_data(Bytes::from(transaction_data)); - let res = provider.call_raw(&typed_transaction).await?; + let res = provider.provider().call_raw(&typed_transaction).await?; let res_data = res.to_vec(); diff --git a/shared/src/models/lookup/addr.rs b/shared/src/models/lookup/addr.rs index cb7b051..78882c1 100644 --- a/shared/src/models/lookup/addr.rs +++ b/shared/src/models/lookup/addr.rs @@ -26,12 +26,10 @@ impl ENSLookup for Addr { async fn decode(&self, data: &[u8], _: Arc) -> Result { let decoded_abi = ethers_core::abi::decode(&[ParamType::Address], data) .map_err(|_| ENSLookupError::AbiDecodeError)?; - let address = decoded_abi - .get(0) - .ok_or(ENSLookupError::AbiDecodeError)? - .clone() - .into_address() - .ok_or(ENSLookupError::AbiDecodeError)?; + + let Some(Token::Address(address)) = decoded_abi.get(0) else { + return Err(ENSLookupError::AbiDecodeError); + }; Ok(format!("{address:?}")) } diff --git a/shared/src/models/lookup/image.rs b/shared/src/models/lookup/image.rs index 7dca617..cbb532b 100644 --- a/shared/src/models/lookup/image.rs +++ b/shared/src/models/lookup/image.rs @@ -14,7 +14,7 @@ use tracing::info; use crate::models::eip155::{resolve_eip155, EIP155ContractType}; use crate::models::multicoin::cointype::evm::ChainId; -use super::{ENSLookup, ENSLookupError, LookupState}; +use super::{abi_decode_universal_ccip, ENSLookup, ENSLookupError, LookupState}; pub struct Image { pub ipfs_gateway: String, @@ -57,8 +57,7 @@ impl ENSLookup for Image { } async fn decode(&self, data: &[u8], state: Arc) -> Result { - let decoded_abi = ethers_core::abi::decode(&[ParamType::String], data) - .map_err(|_| ENSLookupError::AbiDecodeError)?; + let decoded_abi = abi_decode_universal_ccip(data, &[ParamType::String])?; let value = decoded_abi.get(0).ok_or(ENSLookupError::AbiDecodeError)?; let value = value.to_string(); diff --git a/shared/src/models/lookup/mod.rs b/shared/src/models/lookup/mod.rs index e21a63d..277f703 100644 --- a/shared/src/models/lookup/mod.rs +++ b/shared/src/models/lookup/mod.rs @@ -3,7 +3,11 @@ use std::sync::Arc; use async_trait::async_trait; use ethers::providers::{Http, Provider}; +use ethers_ccip_read::CCIPReadMiddleware; +use ethers_core::abi; +use ethers_core::abi::Token; use ethers_core::types::H256; +use lazy_static::lazy_static; use thiserror::Error; use crate::models::eip155::EIP155Error; @@ -17,9 +21,12 @@ pub mod text; #[derive(Error, Debug)] pub enum ENSLookupError { - #[error("ABI error")] + #[error("ABI decode error")] AbiDecodeError, + #[error("ABI error: {0}")] + AbiError(#[from] abi::Error), + #[error("MulticoinDecoderError: {0}")] MulticoinDecoder(#[from] MulticoinDecoderError), @@ -29,8 +36,8 @@ pub enum ENSLookupError { #[error("EIP155: {0}")] EIP155Error(#[from] EIP155Error), - #[error(transparent)] - Unknown(#[from] anyhow::Error), + #[error("CCIP resolution error ({}): {}", status, message)] + CCIPError { status: u16, message: String }, } #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] @@ -53,8 +60,50 @@ impl Display for dyn ENSLookup + Send + Sync { write!(f, "ENSLookup({})", self.name()) } } - pub struct LookupState { - pub rpc: Arc>, + pub rpc: Arc>>, pub opensea_api_key: String, } + +lazy_static! { + static ref UNIVERSAL_RESOLVER_CCIP_ERROR: &'static [abi::ParamType; 1] = + Box::leak(Box::new([abi::ParamType::Array(Box::from( + abi::ParamType::Tuple(vec![abi::ParamType::Uint(16), abi::ParamType::String]), + ))])); +} + +pub fn abi_decode_universal_ccip( + data: &[u8], + types: &[abi::ParamType], +) -> Result, ENSLookupError> { + abi::decode(types, data).map_err(|err| { + if data.len() < 4 { + return ENSLookupError::AbiError(err); + } + + let results = abi::decode(*UNIVERSAL_RESOLVER_CCIP_ERROR, &data[4..]); + + let Ok(results) = results else { + return ENSLookupError::AbiError(err); + }; + + let Some(Token::Array(errors)) = results.get(0) else { + return ENSLookupError::AbiError(err); + }; + + let Some(Token::Tuple(tuple)) = errors.get(0) else { + return ENSLookupError::AbiError(err); + }; + + let (Some(Token::Uint(status)), Some(Token::String(message))) = + (tuple.get(0), tuple.get(1)) + else { + return ENSLookupError::AbiError(err); + }; + + ENSLookupError::CCIPError { + status: status.as_u32() as u16, + message: message.to_string(), + } + }) +} diff --git a/shared/src/models/lookup/multicoin.rs b/shared/src/models/lookup/multicoin.rs index 92df65f..b5fec00 100644 --- a/shared/src/models/lookup/multicoin.rs +++ b/shared/src/models/lookup/multicoin.rs @@ -9,7 +9,7 @@ use hex_literal::hex; use crate::models::multicoin::cointype::coins::CoinType; -use super::{ENSLookup, ENSLookupError, LookupState}; +use super::{abi_decode_universal_ccip, ENSLookup, ENSLookupError, LookupState}; pub struct Multicoin { pub coin_type: CoinType, @@ -30,8 +30,7 @@ impl ENSLookup for Multicoin { } async fn decode(&self, data: &[u8], _: Arc) -> Result { - let decoded_abi = ethers_core::abi::decode(&[ParamType::Bytes], data) - .map_err(|_| ENSLookupError::AbiDecodeError)?; + let decoded_abi = abi_decode_universal_ccip(data, &[ParamType::Bytes])?; let value = decoded_abi .get(0) diff --git a/shared/src/models/lookup/text.rs b/shared/src/models/lookup/text.rs index 0a6fac6..6559fb1 100644 --- a/shared/src/models/lookup/text.rs +++ b/shared/src/models/lookup/text.rs @@ -7,7 +7,8 @@ use ethers_core::{ }; use hex_literal::hex; -use super::{ENSLookup, ENSLookupError, LookupState}; +use super::{abi_decode_universal_ccip, ENSLookup, ENSLookupError, LookupState}; + pub struct Text { key: String, } @@ -41,8 +42,7 @@ impl ENSLookup for Text { } async fn decode(&self, data: &[u8], _: Arc) -> Result { - let decoded_abi = ethers_core::abi::decode(&[ParamType::String], data) - .map_err(|_| ENSLookupError::AbiDecodeError)?; + let decoded_abi = abi_decode_universal_ccip(data, &[ParamType::String])?; let value = decoded_abi.get(0).ok_or(ENSLookupError::AbiDecodeError)?; let value = value.to_string(); diff --git a/shared/src/models/profile/error.rs b/shared/src/models/profile/error.rs index 0684da9..81417cd 100644 --- a/shared/src/models/profile/error.rs +++ b/shared/src/models/profile/error.rs @@ -1,4 +1,6 @@ -use ethers::providers::ProviderError; +use ethers::prelude::Http; +use ethers::providers::{Provider, ProviderError}; +use ethers_ccip_read::CCIPReadMiddlewareError; use thiserror::Error; #[allow(clippy::module_name_repetitions)] @@ -7,9 +9,12 @@ pub enum ProfileError { #[error("Not Found")] NotFound, - #[error("RPC error {0}")] + #[error("RPC error: {0}")] RPCError(#[from] ProviderError), + #[error("CCIP error: {0}")] + CCIPError(#[from] CCIPReadMiddlewareError>), + #[error("DNS encode error: {0}")] DNSEncodeError(String), diff --git a/shared/src/models/profile/from_name.rs b/shared/src/models/profile/from_name.rs index ad7d2af..8304237 100644 --- a/shared/src/models/profile/from_name.rs +++ b/shared/src/models/profile/from_name.rs @@ -1,13 +1,17 @@ use std::str::FromStr; use std::{collections::BTreeMap, sync::Arc}; +use ethers::middleware::MiddlewareBuilder; use ethers::providers::{Http, Provider}; +use ethers_ccip_read::CCIPReadMiddleware; use tracing::info; use crate::cache::CacheError; use crate::models::lookup::image::Image; +use crate::models::lookup::multicoin::Multicoin; +use crate::models::lookup::ENSLookupError; use crate::models::{ - lookup::{addr::Addr, multicoin::Multicoin, text::Text, ENSLookup, LookupState}, + lookup::{addr::Addr, text::Text, ENSLookup, LookupState}, multicoin::cointype::coins::CoinType, profile::Profile, universal_resolver::resolve_universal, @@ -28,6 +32,8 @@ impl Profile { ) -> Result { let cache_key = format!("n:{name}"); + let rpc = rpc.wrap_into(CCIPReadMiddleware::new); + info!( name = name, cache_key = cache_key, @@ -88,8 +94,14 @@ impl Profile { let rpc = Arc::new(rpc); - // Execute Universal Resolver Lookup - let (data, resolver) = resolve_universal(name, &calldata, &rpc).await?; + // ens CCIP unwrapper is limited to 50 sub-requests, i.e. per request + let calldata_chunks = calldata.chunks(50).collect::>(); + + let (mut data, resolver) = resolve_universal(name, calldata_chunks[0], &rpc).await?; + + for &chunk in &calldata_chunks[1..] { + data = [data, resolve_universal(name, chunk, &rpc).await?.0].concat(); + } let mut results: Vec> = Vec::new(); let mut errors = BTreeMap::default(); @@ -113,7 +125,15 @@ impl Profile { } } Err(error) => { - errors.insert(calldata.name(), error.to_string()); + if !matches!( + error, + ENSLookupError::CCIPError { + status: _, + message: _ + } + ) { + errors.insert(calldata.name(), error.to_string()); + }; results.push(None); } } diff --git a/shared/src/models/universal_resolver/mod.rs b/shared/src/models/universal_resolver/mod.rs index 030bd07..97bdddf 100644 --- a/shared/src/models/universal_resolver/mod.rs +++ b/shared/src/models/universal_resolver/mod.rs @@ -3,6 +3,7 @@ use ethers::{ providers::{namehash, Http, Middleware, Provider}, types::{transaction::eip2718::TypedTransaction, Address, Bytes}, }; +use ethers_ccip_read::{CCIPReadMiddleware, CCIPReadMiddlewareError}; use ethers_contract::abigen; use ethers_core::abi::{ParamType, Token}; use lazy_static::lazy_static; @@ -32,7 +33,7 @@ const MAGIC_UNIVERSAL_RESOLVER_ERROR_MESSAGE: &str = pub async fn resolve_universal( name: &str, data: &[Box], - provider: &Provider, + provider: &CCIPReadMiddleware>, ) -> Result<(Vec>, Address), ProfileError> { let name_hash = namehash(name); @@ -66,30 +67,28 @@ pub async fn resolve_universal( .call(&typed_transaction, None) .await .map_err(|err| { - let JsonRpcClientError(rpc_err) = &err else { - return ProfileError::RPCError(err); + let CCIPReadMiddlewareError::MiddlewareError(provider_error) = err else { + return ProfileError::CCIPError(err); }; - let Some(rpc_err_raw) = rpc_err.as_error_response() else { - return ProfileError::RPCError(err); + let JsonRpcClientError(rpc_err) = &provider_error else { + return ProfileError::RPCError(provider_error); }; - if rpc_err_raw.message == MAGIC_UNIVERSAL_RESOLVER_ERROR_MESSAGE { + if matches!(rpc_err.as_error_response(), Some(rpc_err_raw) if rpc_err_raw.message == MAGIC_UNIVERSAL_RESOLVER_ERROR_MESSAGE) { return ProfileError::NotFound; } - ProfileError::RPCError(err) + ProfileError::RPCError(provider_error) })?; - let res_data = res.to_vec(); - // Abi Decode let result = ethers_core::abi::decode( &[ ParamType::Array(Box::new(ParamType::Bytes)), ParamType::Address, ], - res_data.as_slice(), + res.as_ref(), ) .map_err(|_| ProfileError::ImplementationError("ABI decode failed".to_string()))?; @@ -125,6 +124,7 @@ mod tests { use std::str::FromStr; use ethers::providers::{Http, Provider}; + use ethers_ccip_read::CCIPReadMiddleware; use ethers_core::abi::ParamType; use ethers_core::types::Address; @@ -146,9 +146,13 @@ mod tests { Text::from("location").to_boxed(), ]; - let res = universal_resolver::resolve_universal("antony.sh", &calldata, &provider) - .await - .unwrap(); + let res = universal_resolver::resolve_universal( + "antony.sh", + &calldata, + &CCIPReadMiddleware::new(provider), + ) + .await + .unwrap(); let address = ethers_core::abi::decode(&[ParamType::Address], &res.0[0]) .unwrap() diff --git a/shared/src/utils/eip55.rs b/shared/src/utils/eip55.rs index 0d7e43e..de06592 100644 --- a/shared/src/utils/eip55.rs +++ b/shared/src/utils/eip55.rs @@ -51,6 +51,9 @@ impl FromStr for EIP55Address { pub fn encode_rskip60(data: &[u8], chain: RSKIPChain) -> String { let raw = hex::encode(data).to_ascii_lowercase(); + if data.len() > 20 { + return raw; + } let hash = ethers::utils::keccak256(format!( "{:}{raw}", match chain { diff --git a/worker/Cargo.lock b/worker/Cargo.lock index 39e0498..2f83af2 100644 --- a/worker/Cargo.lock +++ b/worker/Cargo.lock @@ -83,6 +83,17 @@ dependencies = [ "term", ] +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "async-trait" version = "0.1.74" @@ -315,9 +326,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", @@ -857,6 +868,7 @@ dependencies = [ "crc16", "crc32fast", "ethers", + "ethers-ccip-read", "ethers-contract", "ethers-core", "getrandom", @@ -991,11 +1003,29 @@ dependencies = [ "serde_json", ] +[[package]] +name = "ethers-ccip-read" +version = "0.1.1" +source = "git+https://github.com/v3xlabs/rust-ethers-ccip-read?branch=rework#4bc0e480539d3636186a97daa51790bc7698b05a" +dependencies = [ + "async-recursion", + "async-trait", + "ethers-core", + "ethers-providers", + "futures-util", + "getrandom", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "ethers-contract" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79269278125006bb0552349c03593ffa9702112ca88bc7046cc669f148fb47c" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" dependencies = [ "const-hex", "ethers-contract-abigen", @@ -1012,9 +1042,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" dependencies = [ "Inflector", "const-hex", @@ -1036,9 +1066,9 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" dependencies = [ "Inflector", "const-hex", @@ -1052,9 +1082,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" dependencies = [ "arrayvec", "bytes", @@ -1082,10 +1112,11 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" +checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" dependencies = [ + "chrono", "ethers-core", "reqwest", "semver", @@ -1124,9 +1155,9 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ "async-trait", "auto_impl", @@ -1135,6 +1166,7 @@ dependencies = [ "const-hex", "enr", "ethers-core", + "futures-channel", "futures-core", "futures-timer", "futures-util", @@ -1327,9 +1359,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1337,9 +1369,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" @@ -1354,9 +1386,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-locks" @@ -1370,9 +1402,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -1381,15 +1413,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -1403,9 +1435,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -2474,7 +2506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -2969,9 +3001,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] @@ -3000,9 +3032,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -3011,9 +3043,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -3022,9 +3054,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -3481,21 +3513,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.21.0", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -3505,6 +3537,17 @@ name = "toml_edit" version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.2", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.0.2", "serde", diff --git a/worker/src/http_util.rs b/worker/src/http_util.rs index 877ddc3..7541ef8 100644 --- a/worker/src/http_util.rs +++ b/worker/src/http_util.rs @@ -12,6 +12,7 @@ pub struct ErrorResponse { pub fn profile_http_error_mapper(err: ProfileError) -> Response { let status = match err { ProfileError::NotFound => StatusCode::NOT_FOUND, + ProfileError::CCIPError(_) => StatusCode::BAD_GATEWAY, _ => StatusCode::INTERNAL_SERVER_ERROR, };