diff --git a/Cargo.lock b/Cargo.lock index 211149d..7eb3182 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,8 +123,8 @@ checksum = "cf7d535e1381be3de2c0716c0a1c1e32ad9df1042cddcf7bc18d743569e53319" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "regex", "syn 1.0.109", ] @@ -138,8 +138,8 @@ dependencies = [ "anchor-syn", "anyhow", "bs58 0.4.0", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "rustversion", "syn 1.0.109", ] @@ -151,7 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1be64a48e395fe00b8217287f226078be2cf32dae42fdf8a885b997945c3d28" dependencies = [ "anchor-syn", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "syn 1.0.109", ] @@ -162,8 +162,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38ea6713d1938c0da03656ff8a693b17dc0396da66d1ba320557f07e86eca0d4" dependencies = [ "anchor-syn", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -175,8 +175,8 @@ checksum = "d401f11efb3644285685f8339829a9786d43ed7490bb1699f33c478d04d5a582" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -189,8 +189,8 @@ dependencies = [ "anchor-syn", "anyhow", "heck 0.3.3", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -202,8 +202,8 @@ checksum = "6ad769993b5266714e8939e47fbdede90e5c030333c7522d99a4d4748cf26712" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -215,8 +215,8 @@ checksum = "4e677fae4a016a554acdd0e3b7f178d3acafaa7e7ffac6b8690cf4e171f1c116" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -228,8 +228,8 @@ checksum = "340beef6809d1c3fcc7ae219153d981e95a8a277ff31985bd7050e32645dc9a8" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -266,9 +266,9 @@ dependencies = [ "anyhow", "bs58 0.3.1", "heck 0.3.3", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "proc-macro2-diagnostics", - "quote 1.0.29", + "quote 1.0.32", "serde", "serde_json", "sha2 0.9.9", @@ -392,8 +392,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "synstructure", ] @@ -404,8 +404,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -421,7 +421,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" dependencies = [ - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] @@ -562,9 +562,9 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -579,9 +579,9 @@ version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -684,6 +684,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "backon" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a6197b2120bb2185a267f6515038558b019e92b832bb0320e96d66268dcf9" +dependencies = [ + "fastrand", + "futures-core", + "pin-project", + "tokio", +] + [[package]] name = "backtrace" version = "0.3.67" @@ -707,8 +719,8 @@ checksum = "33b8de67cc41132507eeece2584804efcb15f85ba516e34c944b7667f480397a" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -875,7 +887,7 @@ dependencies = [ "borsh-derive-internal 0.9.3", "borsh-schema-derive-internal 0.9.3", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "syn 1.0.109", ] @@ -888,7 +900,7 @@ dependencies = [ "borsh-derive-internal 0.10.3", "borsh-schema-derive-internal 0.10.3", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "syn 1.0.109", ] @@ -898,8 +910,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -909,8 +921,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -920,8 +932,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -931,8 +943,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1011,8 +1023,8 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1031,9 +1043,9 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -1173,8 +1185,8 @@ checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ "heck 0.4.1", "proc-macro-error", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1185,9 +1197,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -1290,21 +1302,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" - [[package]] name = "crc32fast" version = "1.3.2" @@ -1434,10 +1431,10 @@ checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "strsim 0.10.0", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -1447,8 +1444,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core", - "quote 1.0.29", - "syn 2.0.23", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -1578,9 +1575,9 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -1707,8 +1704,8 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8958699f9359f0b04e691a13850d48b7de329138023876d07cbd024c2c820598" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1719,8 +1716,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11f36e95862220b211a6e2aa5eca09b4fa391b13cd52ceb8035a24bf65a79de2" dependencies = [ "once_cell", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1911,9 +1908,9 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -2173,25 +2170,32 @@ dependencies = [ [[package]] name = "holaplex-hub-core" -version = "0.2.1" -source = "git+https://github.com/holaplex/hub-core?branch=stable#c8eaef51ea8729686a1d74e2e8d9fc1a14f4dcb8" +version = "0.5.0" +source = "git+https://github.com/holaplex/hub-core?branch=stable#711b8a0c9a1056490dff05acadf5a2b354612f01" dependencies = [ "anyhow", "async-trait", + "backon", + "bs58 0.5.0", "chrono", "clap 4.3.3", "dotenv", "futures-util", + "holaplex-hub-core-macros", "holaplex-hub-core-schemas", "hostname", + "jsonrpsee-core", "num_cpus", "pin-project-lite", "prost", "prost-types", "rdkafka", "reqwest", + "sea-orm", "serde_json", "serde_with", + "solana-client", + "solana-sdk", "thiserror", "tokio", "tracing", @@ -2204,7 +2208,7 @@ dependencies = [ [[package]] name = "holaplex-hub-core-build" version = "0.2.1" -source = "git+https://github.com/holaplex/hub-core?branch=stable#c8eaef51ea8729686a1d74e2e8d9fc1a14f4dcb8" +source = "git+https://github.com/holaplex/hub-core?branch=stable#711b8a0c9a1056490dff05acadf5a2b354612f01" dependencies = [ "anyhow", "dotenv", @@ -2220,10 +2224,21 @@ dependencies = [ "url", ] +[[package]] +name = "holaplex-hub-core-macros" +version = "0.1.0" +source = "git+https://github.com/holaplex/hub-core?branch=stable#711b8a0c9a1056490dff05acadf5a2b354612f01" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", + "thiserror", +] + [[package]] name = "holaplex-hub-core-schemas" -version = "0.2.1" -source = "git+https://github.com/holaplex/hub-core?branch=stable#c8eaef51ea8729686a1d74e2e8d9fc1a14f4dcb8" +version = "0.3.1" +source = "git+https://github.com/holaplex/hub-core?branch=stable#711b8a0c9a1056490dff05acadf5a2b354612f01" dependencies = [ "holaplex-hub-core-build", "prost", @@ -2235,7 +2250,6 @@ version = "0.1.0" dependencies = [ "anchor-lang", "bincode", - "bs58 0.5.0", "holaplex-hub-core", "holaplex-hub-nfts-solana-core", "holaplex-hub-nfts-solana-entity", @@ -2253,7 +2267,6 @@ dependencies = [ "spl-associated-token-account", "spl-noop", "spl-token", - "tokio-retry", ] [[package]] @@ -2266,14 +2279,14 @@ dependencies = [ "mpl-bubblegum", "mpl-token-metadata", "prost", - "sea-orm 0.11.3", + "sea-orm", ] [[package]] name = "holaplex-hub-nfts-solana-entity" version = "0.1.0" dependencies = [ - "sea-orm 0.11.3", + "sea-orm", "serde", ] @@ -2567,9 +2580,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1822d18e4384a5e79d94dc9e4d1239cfa9fad24e55b44d2efeff5b394c9fece4" +checksum = "e5f3783308bddc49d0218307f66a09330c106fbd792c58bac5c8dc294fdd0f98" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -2580,9 +2593,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c6832a55f662b5a6ecc844db24b8b9c387453f923de863062c60ce33d62b81" +checksum = "5aaa4c4d5fb801dcc316d81f76422db259809037a86b3194ae538dd026b05ed7" dependencies = [ "anyhow", "async-trait", @@ -2599,9 +2612,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1705c65069729e3dccff6fd91ee431d5d31cabcf00ce68a62a2c6435ac713af9" +checksum = "aa7165efcbfbc951d180162ff28fe91b657ed81925e37a35e4a396ce12109f96" dependencies = [ "async-trait", "hyper", @@ -2618,22 +2631,22 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6027ac0b197ce9543097d02a290f550ce1d9432bf301524b013053c0b75cc94" +checksum = "21dc12b1d4f16a86e8c522823c4fab219c88c03eb7c924ec0501a64bf12e058b" dependencies = [ "heck 0.4.1", "proc-macro-crate 1.3.1", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] [[package]] name = "jsonrpsee-types" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5bf6c75ce2a4217421154adfc65a24d2b46e77286e59bba5d9fa6544ccc8f4" +checksum = "00aa7cc87bc42e04e26c8ac3e7186142f7fd2949c763d9b6a7e64a69672d8fb2" dependencies = [ "anyhow", "beef", @@ -2970,7 +2983,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12989bc45715b0ee91944855130131479f9c772e198a910c3eb0ea327d5bffc3" dependencies = [ - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] @@ -3094,8 +3107,8 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3167,8 +3180,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3229,9 +3242,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -3286,8 +3299,8 @@ checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" dependencies = [ "Inflector", "proc-macro-error", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3424,9 +3437,9 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -3498,7 +3511,7 @@ version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" dependencies = [ - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "syn 1.0.109", ] @@ -3528,8 +3541,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "version_check", ] @@ -3540,8 +3553,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "version_check", ] @@ -3556,9 +3569,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -3569,8 +3582,8 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "version_check", "yansi", @@ -3616,8 +3629,8 @@ checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3654,8 +3667,8 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3732,11 +3745,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", ] [[package]] @@ -4045,8 +4058,8 @@ version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4259,34 +4272,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sea-orm" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88694d01b528a94f90ad87f8d2f546d060d070eee180315c67d158cb69476034" -dependencies = [ - "async-stream", - "async-trait", - "chrono", - "futures", - "futures-util", - "log", - "ouroboros", - "rust_decimal", - "sea-orm-macros 0.10.7", - "sea-query 0.27.2", - "sea-query-binder 0.2.2", - "sea-strum", - "serde", - "serde_json", - "sqlx", - "thiserror", - "time 0.3.22", - "tracing", - "url", - "uuid", -] - [[package]] name = "sea-orm" version = "0.11.3" @@ -4301,9 +4286,9 @@ dependencies = [ "log", "ouroboros", "rust_decimal", - "sea-orm-macros 0.11.3", - "sea-query 0.28.5", - "sea-query-binder 0.3.1", + "sea-orm-macros", + "sea-query", + "sea-query-binder", "sea-strum", "serde", "serde_json", @@ -4331,19 +4316,6 @@ dependencies = [ "url", ] -[[package]] -name = "sea-orm-macros" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7216195de9c6b2474fd0efab486173dccd0eff21f28cc54aa4c0205d52fb3af0" -dependencies = [ - "bae", - "heck 0.3.3", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 1.0.109", -] - [[package]] name = "sea-orm-macros" version = "0.11.3" @@ -4352,8 +4324,8 @@ checksum = "28936f26d62234ff0be16f80115dbdeb3237fe9c25cf18fbcd1e3b3592360f20" dependencies = [ "bae", "heck 0.3.3", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4367,27 +4339,13 @@ dependencies = [ "clap 3.2.25", "dotenvy", "futures", - "sea-orm 0.11.3", + "sea-orm", "sea-orm-cli", "sea-schema", "tracing", "tracing-subscriber", ] -[[package]] -name = "sea-query" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4f0fc4d8e44e1d51c739a68d336252a18bc59553778075d5e32649be6ec92ed" -dependencies = [ - "chrono", - "rust_decimal", - "sea-query-derive 0.2.0", - "serde_json", - "time 0.3.22", - "uuid", -] - [[package]] name = "sea-query" version = "0.28.5" @@ -4397,23 +4355,8 @@ dependencies = [ "bigdecimal", "chrono", "rust_decimal", - "sea-query-derive 0.3.0", - "serde_json", - "time 0.3.22", - "uuid", -] - -[[package]] -name = "sea-query-binder" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2585b89c985cfacfe0ec9fc9e7bb055b776c1a2581c4e3c6185af2b8bf8865" -dependencies = [ - "chrono", - "rust_decimal", - "sea-query 0.27.2", + "sea-query-derive", "serde_json", - "sqlx", "time 0.3.22", "uuid", ] @@ -4427,26 +4370,13 @@ dependencies = [ "bigdecimal", "chrono", "rust_decimal", - "sea-query 0.28.5", + "sea-query", "serde_json", "sqlx", "time 0.3.22", "uuid", ] -[[package]] -name = "sea-query-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cdc022b4f606353fe5dc85b09713a04e433323b70163e81513b141c6ae6eb5" -dependencies = [ - "heck 0.3.3", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 1.0.109", - "thiserror", -] - [[package]] name = "sea-query-derive" version = "0.3.0" @@ -4454,8 +4384,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63f62030c60f3a691f5fe251713b4e220b306e50a71e1d6f9cce1f24bb781978" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "thiserror", ] @@ -4467,7 +4397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eeb2940bb5a10bc6cd05b450ce6cd3993e27fddd7eface2becb97fc5af3a040e" dependencies = [ "futures", - "sea-query 0.28.5", + "sea-query", "sea-schema-derive", ] @@ -4478,8 +4408,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56821b7076f5096b8f726e2791ad255a99c82498e08ec477a65a96c461ff1927" dependencies = [ "heck 0.3.3", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4499,8 +4429,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69b4397b825df6ccf1e98bcdabef3bbcfc47ff5853983467850eeab878384f21" dependencies = [ "heck 0.3.3", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "rustversion", "syn 1.0.109", ] @@ -4564,9 +4494,9 @@ version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -4615,9 +4545,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ "darling", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -4715,8 +4645,8 @@ version = "0.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63927d22a1e8b74bda98cc6e151fcdf178b7abb0dc6c4f81e0bbf5ffe2fc4ec8" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "shank_macro_impl", "syn 1.0.109", ] @@ -4728,8 +4658,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ce03403df682f80f4dc1efafa87a4d0cb89b03726d0565e6364bdca5b9a441" dependencies = [ "anyhow", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "serde", "syn 1.0.109", ] @@ -5033,8 +4963,8 @@ version = "1.14.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbce93c3e02ed81ce0fee3fda2ebd27ff83b2c29e539ac834cef18e6c506b7a" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "rustc_version", "syn 1.0.109", ] @@ -5045,7 +4975,6 @@ version = "0.1.0" dependencies = [ "anchor-lang", "backoff", - "bs58 0.5.0", "dashmap", "futures", "hex", @@ -5053,7 +4982,7 @@ dependencies = [ "holaplex-hub-nfts-solana-core", "holaplex-hub-nfts-solana-entity", "mpl-bubblegum", - "sea-orm 0.10.7", + "sea-orm", "solana-client", "solana-program", "solana-sdk", @@ -5309,8 +5238,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19aa23da3d994c1ede69ff48a0f34f6c7600ae6ea7309344dc357349c463695c" dependencies = [ "bs58 0.4.0", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "rustversion", "syn 1.0.109", ] @@ -5582,7 +5511,6 @@ dependencies = [ "byteorder", "bytes", "chrono", - "crc", "crossbeam-queue", "dirs", "dotenvy", @@ -5637,10 +5565,9 @@ dependencies = [ "either", "heck 0.4.1", "once_cell", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "serde_json", - "sha2 0.10.6", "sqlx-core", "sqlx-rt", "syn 1.0.109", @@ -5703,19 +5630,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.23" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "unicode-ident", ] @@ -5731,8 +5658,8 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "unicode-xid 0.2.4", ] @@ -5783,22 +5710,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -5918,9 +5845,9 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -5933,17 +5860,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" -dependencies = [ - "pin-project", - "rand 0.8.5", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" @@ -6073,9 +5989,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" dependencies = [ "prettyplease", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "prost-build", - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] @@ -6143,9 +6059,9 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -6359,7 +6275,6 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" dependencies = [ - "getrandom 0.2.10", "serde", ] @@ -6446,9 +6361,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -6470,7 +6385,7 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" dependencies = [ - "quote 1.0.29", + "quote 1.0.32", "wasm-bindgen-macro-support", ] @@ -6480,9 +6395,9 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6853,9 +6768,9 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] diff --git a/consumer/Cargo.toml b/consumer/Cargo.toml index ff1f1aa..9ca79a3 100644 --- a/consumer/Cargo.toml +++ b/consumer/Cargo.toml @@ -30,14 +30,12 @@ mpl-bubblegum = "0.7.0" mpl-token-metadata = "1.8.3" holaplex-hub-nfts-solana-core = { path = "../core" } holaplex-hub-nfts-solana-entity = { path = "../entity" } -jsonrpsee = { version = "0.18.2", features = ["macros", "http-client"] } -bs58 = "0.5.0" -rand = "0.8.5" -tokio-retry = "0.3.0" +jsonrpsee = { version = "0.19.0", features = ["macros", "http-client"] } +rand = "0.8.5" [dependencies.hub-core] package = "holaplex-hub-core" -version = "0.2.0" +version = "0.5.0" git = "https://github.com/holaplex/hub-core" branch = "stable" -features = ["kafka"] +features = ["jsonrpsee-core", "kafka", "sea-orm", "solana"] diff --git a/consumer/src/asset_api.rs b/consumer/src/asset_api.rs index 30f0f27..bf54cb8 100644 --- a/consumer/src/asset_api.rs +++ b/consumer/src/asset_api.rs @@ -1,8 +1,10 @@ -use core::fmt; -use std::collections::HashMap; +use std::{collections::HashMap, fmt}; +use hub_core::bs58; use solana_program::pubkey::Pubkey; + mod b58 { + use hub_core::bs58; use serde::{de::Visitor, Deserializer, Serializer}; pub fn serialize(bytes: &[u8], ser: S) -> Result { diff --git a/consumer/src/events.rs b/consumer/src/events.rs index ed9cdba..7a44397 100644 --- a/consumer/src/events.rs +++ b/consumer/src/events.rs @@ -36,14 +36,16 @@ use crate::{ solana::{CompressedRef, EditionRef, Solana, SolanaAssetIdError, UncompressedRef}, }; -#[derive(Debug, thiserror::Error)] +#[derive(Debug, thiserror::Error, Triage)] pub enum ProcessorErrorKind { #[error("Associated record not found in database")] + #[transient] RecordNotFound, #[error("Transaction status not found in treasury event payload")] TransactionStatusNotFound, #[error("Error processing Solana operation")] + #[transient] Solana(#[source] Error), #[error("Error sending message")] SendError(#[from] SendError), @@ -59,7 +61,7 @@ pub enum ProcessorErrorKind { AssetId(#[from] SolanaAssetIdError), } -#[derive(Debug, thiserror::Error)] +#[derive(Debug, thiserror::Error, Triage)] #[error("Error handling {} of {}", src.name(), evt.name())] pub struct ProcessorError { #[source] diff --git a/consumer/src/import.rs b/consumer/src/import.rs index 469e13c..d398d13 100644 --- a/consumer/src/import.rs +++ b/consumer/src/import.rs @@ -5,17 +5,22 @@ use holaplex_hub_nfts_solana_core::{ CollectionImport, File, Metadata, SolanaCollectionPayload, SolanaCreator, SolanaMintPayload, SolanaNftEventKey, SolanaNftEvents, }, - sea_orm::{EntityTrait, ModelTrait, Set}, + sea_orm::{DbErr, EntityTrait, ModelTrait, Set}, Collection, Services, }; use holaplex_hub_nfts_solana_entity::{collection_mints, collections, prelude::CollectionMints}; use hub_core::{ - chrono::Utc, futures_util::stream, prelude::*, producer::Producer, reqwest, util::DebugShim, - uuid::Uuid, + backon::{ExponentialBuilder, Retryable}, + chrono::Utc, + futures_util::stream, + prelude::*, + producer::{Producer, SendError}, + reqwest, thiserror, + util::DebugShim, + uuid::{self, Uuid}, }; use mpl_token_metadata::pda::{find_master_edition_account, find_metadata_account}; use spl_associated_token_account::get_associated_token_address; -use tokio_retry::{strategy::ExponentialBackoff, Retry}; use crate::{ asset_api::{self, Asset, RpcClient}, @@ -24,6 +29,29 @@ use crate::{ const CONCURRENT_REQUESTS: usize = 64; +#[derive(Debug, thiserror::Error, Triage)] +pub enum ProcessorError { + #[error("Missing update authority (index 0) on asset")] + #[transient] + MissingUpdateAuthority, + + #[error("Error fetching metadata JSON")] + JsonFetch(#[source] reqwest::Error), + #[error("JSONRPC error")] + JsonRpc(#[from] jsonrpsee::core::Error), + #[error("Invalid UUID")] + InvalidUuid(#[from] uuid::Error), + #[error("Invalid conversion from byte slice to public key")] + #[permanent] + InvalidPubkey(#[source] std::array::TryFromSliceError), + #[error("Database error")] + DbError(#[from] DbErr), + #[error("Error sending message")] + SendError(#[from] SendError), +} + +type Result = std::result::Result; + // TODO: could this just be a newtype over events::Processor? #[derive(Debug, Clone)] pub struct Processor { @@ -119,11 +147,8 @@ impl Processor { } let mut buffered = stream::iter(futures).buffer_unordered(CONCURRENT_REQUESTS); - while let Some(result) = buffered.next().await { - match result { - Ok(model) => mints.push(model), - Err(e) => bail!("Error: {}", e), - } + while let Some(model) = buffered.next().await { + mints.push(model?); } CollectionMints::insert_many(mints).exec(conn).await?; @@ -145,8 +170,15 @@ impl Processor { ) -> Result { let conn = self.db.get(); let producer = &self.producer; - let owner = collection.ownership.owner.try_into()?; - let mint = collection.id.try_into()?; + let owner = collection + .ownership + .owner + .try_into() + .map_err(ProcessorError::InvalidPubkey)?; + let mint = collection + .id + .try_into() + .map_err(ProcessorError::InvalidPubkey)?; let seller_fee_basis_points = collection.royalty.basis_points; let json_uri = collection.content.json_uri.clone(); @@ -179,22 +211,25 @@ impl Processor { let update_authority = &collection .authorities .get(0) - .context("Invalid index")? + .ok_or(ProcessorError::MissingUpdateAuthority)? .address; let ata = get_associated_token_address(&owner, &mint); let (metadata_pubkey, _) = find_metadata_account(&mint); let (master_edition, _) = find_master_edition_account(&mint); - let collection_model = Collection::create(conn, collections::ActiveModel { - master_edition: Set(master_edition.to_string()), - update_authority: Set(update_authority.to_string()), - associated_token_account: Set(ata.to_string()), - owner: Set(owner.to_string()), - mint: Set(mint.to_string()), - metadata: Set(metadata_pubkey.to_string()), - ..Default::default() - }) + let collection_model = Collection::create( + conn, + collections::ActiveModel { + master_edition: Set(master_edition.to_string()), + update_authority: Set(update_authority.to_string()), + associated_token_account: Set(ata.to_string()), + owner: Set(owner.to_string()), + mint: Set(mint.to_string()), + metadata: Set(metadata_pubkey.to_string()), + ..Default::default() + }, + ) .await?; producer @@ -231,18 +266,20 @@ impl Processor { } async fn get_metadata_json(uri: String) -> Result { - let json_metadata_fut = || async { + let json_metadata = (|| async { reqwest::get(uri.clone()) .await? .json::() .await - }; - - let json_metadata = Retry::spawn( - ExponentialBackoff::from_millis(20).take(10), - json_metadata_fut, + }) + .retry( + &ExponentialBuilder::default() + .with_jitter() + .with_min_delay(Duration::from_millis(200)) + .with_max_times(10), ) - .await?; + .await + .map_err(ProcessorError::JsonFetch)?; Ok(json_metadata) } @@ -255,15 +292,19 @@ impl Processor { asset: Asset, ) -> Result { let producer = self.producer.clone(); - let owner = asset.ownership.owner.try_into()?; - let mint = asset.id.try_into()?; + let owner = asset + .ownership + .owner + .try_into() + .map_err(ProcessorError::InvalidPubkey)?; + let mint = asset.id.try_into().map_err(ProcessorError::InvalidPubkey)?; let ata = get_associated_token_address(&owner, &mint); let seller_fee_basis_points = asset.royalty.basis_points; let update_authority = asset .authorities .get(0) - .context("Invalid index")? + .ok_or(ProcessorError::MissingUpdateAuthority)? .address .clone(); diff --git a/consumer/src/main.rs b/consumer/src/main.rs index aa34289..6dc4fc0 100644 --- a/consumer/src/main.rs +++ b/consumer/src/main.rs @@ -1,6 +1,6 @@ use holaplex_hub_nfts_solana::{events, import, solana::Solana, Args}; use holaplex_hub_nfts_solana_core::{db::Connection, proto::SolanaNftEvents, Services}; -use hub_core::{prelude::*, tokio}; +use hub_core::{prelude::*, triage}; pub fn main() { let opts = hub_core::StartConfig { @@ -25,36 +25,30 @@ pub fn main() { import::Processor::new(solana.clone(), connection.clone(), producer.clone()); let event_processor = events::Processor::new(solana, connection, producer); - let mut stream = cons.stream(); - loop { - let import_processor = import_processor.clone(); - let event_processor = event_processor.clone(); - - match stream.next().await { - Some(Ok(msg)) => { - info!(?msg, "message received"); - - tokio::spawn(async move { - if let Some(()) = import_processor - .process(&msg) - .await - .map_err(|e| error!("Error processing import: {e:?}"))? - { - return Ok(()); - } - - event_processor - .process(msg) - .await - .map_err(|e| error!("Error processing event: {:?}", Error::new(e))) - }); - }, - None => (), - Some(Err(e)) => { - warn!("failed to get message {:?}", e); - }, - } - } + cons.consume::<_, _, _, triage::BoxedSync>( + |b| { + b.with_jitter() + .with_min_delay(Duration::from_millis(500)) + .with_max_delay(Duration::from_secs(90)) + }, + move |e| async move { + if let Some(()) = import_processor + .process(&e) + .await + .map_err(|e| Box::new(e) as triage::BoxedSync)? + { + return Ok(()); + } + + event_processor + .process(e) + .await + .map_err(|e| Box::new(e) as triage::BoxedSync) + }, + ) + .await; + + Ok(()) }) }); } diff --git a/consumer/src/solana.rs b/consumer/src/solana.rs index 80f1216..adbb03e 100644 --- a/consumer/src/solana.rs +++ b/consumer/src/solana.rs @@ -7,7 +7,7 @@ use holaplex_hub_nfts_solana_core::proto::{ use holaplex_hub_nfts_solana_entity::{ collection_mints, collections, compression_leafs, update_revisions, }; -use hub_core::{anyhow::Result, clap, prelude::*, thiserror, uuid::Uuid}; +use hub_core::{anyhow::Result, bs58, clap, prelude::*, thiserror, uuid::Uuid}; use mpl_bubblegum::state::metaplex_adapter::{ Collection, Creator as BubblegumCreator, TokenProgramVersion, }; @@ -103,13 +103,13 @@ enum SolanaErrorNotFoundMessage { Metadata, } -#[derive(Debug, thiserror::Error)] +#[derive(Debug, thiserror::Error, Triage)] pub enum SolanaAssetIdError { #[error("The transaction has no meta field")] NoTransactionMeta, - #[error("no inner instruction found")] + #[error("No inner instruction found")] NoInnerInstruction, - #[error("Solana rpc error")] + #[error("Solana RPC error")] Rpc(#[from] solana_client::client_error::ClientError), #[error("No nonce found in log messages")] NoNonce, diff --git a/core/Cargo.toml b/core/Cargo.toml index b2576d7..84f0f43 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -28,7 +28,7 @@ mpl-bubblegum = "0.7.0" [dependencies.hub-core] package = "holaplex-hub-core" -version = "0.2.0" +version = "0.5.0" git = "https://github.com/holaplex/hub-core" branch = "stable" features = ["kafka"] diff --git a/core/src/lib.rs b/core/src/lib.rs index ab34488..f947abf 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -21,7 +21,7 @@ pub mod proto { include!(concat!(env!("OUT_DIR"), "/treasury.proto.rs")); } -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum Services { Nfts(proto::NftEventKey, proto::NftEvents), Treasury(proto::TreasuryEventKey, proto::TreasuryEvents), diff --git a/indexer/Cargo.toml b/indexer/Cargo.toml index f0727fe..e870660 100644 --- a/indexer/Cargo.toml +++ b/indexer/Cargo.toml @@ -12,12 +12,11 @@ keywords = ["hub", "holaplex", "web3"] categories = ["cryptography::cryptocurrencies", "web-programming"] [dependencies] -sea-orm = { version = "^0.10.0", features = [ +sea-orm = { version = "^0.11.0", features = [ "debug-print", "runtime-tokio-rustls", "sqlx-postgres", ] } -bs58 = "0.5.0" futures = "0.3.24" hex = "0.4.3" solana-sdk = "1.14" @@ -34,7 +33,7 @@ backoff = { version = "0.4.0", features = ["tokio"] } [dependencies.hub-core] package = "holaplex-hub-core" -version = "0.2.0" +version = "0.5.0" git = "https://github.com/holaplex/hub-core" branch = "stable" diff --git a/indexer/src/connector.rs b/indexer/src/connector.rs index 423cd95..8f5359e 100644 --- a/indexer/src/connector.rs +++ b/indexer/src/connector.rs @@ -34,14 +34,17 @@ impl GeyserGrpcConnector { slots.insert("client".to_owned(), SubscribeRequestFilterSlots {}); let mut transactions = HashMap::new(); - transactions.insert("client".to_string(), SubscribeRequestFilterTransactions { - vote: Some(false), - failed: Some(false), - signature: None, - account_include: vec![spl_token::ID.to_string(), mpl_bubblegum::ID.to_string()], - account_exclude: Vec::new(), - account_required: Vec::new(), - }); + transactions.insert( + "client".to_string(), + SubscribeRequestFilterTransactions { + vote: Some(false), + failed: Some(false), + signature: None, + account_include: vec![spl_token::ID.to_string(), mpl_bubblegum::ID.to_string()], + account_exclude: Vec::new(), + account_required: Vec::new(), + }, + ); SubscribeRequest { accounts: HashMap::new(),