diff --git a/target_chains/fuel/contracts/Cargo.lock b/target_chains/fuel/contracts/Cargo.lock index b9f49f61f3..63016e0459 100644 --- a/target_chains/fuel/contracts/Cargo.lock +++ b/target_chains/fuel/contracts/Cargo.lock @@ -223,21 +223,21 @@ checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" [[package]] name = "async-graphql" -version = "4.0.16" +version = "7.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9ed522678d412d77effe47b3c82314ac36952a35e6e852093dd48287c421f80" +checksum = "2b76aba2f176af685c2229633881a3adeae51f87ae1811781e73910b7001c93e" dependencies = [ "async-graphql-derive", "async-graphql-parser", "async-graphql-value", "async-stream", "async-trait", - "base64 0.13.1", + "base64 0.22.0", "bytes", "fnv", "futures-util", - "http", - "indexmap 1.9.3", + "http 1.1.0", + "indexmap 2.2.6", "mime", "multer", "num-traits", @@ -247,8 +247,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "static_assertions", - "tempfile", + "static_assertions_next", "thiserror", "tracing", "tracing-futures", @@ -256,25 +255,26 @@ dependencies = [ [[package]] name = "async-graphql-derive" -version = "4.0.16" +version = "7.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c121a894495d7d3fc3d4e15e0a9843e422e4d1d9e3c514d8062a1c94b35b005d" +checksum = "72e2e26a6b44bc61df3ca8546402cf9204c28e30c06084cc8e75cd5e34d4f150" dependencies = [ "Inflector", "async-graphql-parser", - "darling 0.14.4", - "proc-macro-crate 1.3.1", + "darling 0.20.9", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 1.0.109", + "strum 0.26.3", + "syn 2.0.60", "thiserror", ] [[package]] name = "async-graphql-parser" -version = "4.0.16" +version = "7.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b6c386f398145c6180206c1869c2279f5a3d45db5be4e0266148c6ac5c6ad68" +checksum = "f801451484b4977d6fe67b29030f81353cabdcbb754e5a064f39493582dac0cf" dependencies = [ "async-graphql-value", "pest", @@ -284,12 +284,12 @@ dependencies = [ [[package]] name = "async-graphql-value" -version = "4.0.16" +version = "7.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a941b499fead4a3fb5392cabf42446566d18c86313f69f2deab69560394d65f" +checksum = "69117c43c01d81a69890a9f5dd6235f2f027ca8d1ec62d6d3c5e01ca0edb4f2b" dependencies = [ "bytes", - "indexmap 1.9.3", + "indexmap 2.2.6", "serde", "serde_json", ] @@ -398,7 +398,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" dependencies = [ - "http", + "http 0.2.12", "log", "url", ] @@ -420,7 +420,7 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", + "http 0.2.12", "http-body", "hyper", "itoa", @@ -449,7 +449,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", + "http 0.2.12", "http-body", "mime", "tower-layer", @@ -1038,15 +1038,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ct-logs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" -dependencies = [ - "sct 0.6.1", -] - [[package]] name = "ctr" version = "0.9.2" @@ -1134,16 +1125,6 @@ dependencies = [ "darling_macro 0.13.4", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - [[package]] name = "darling" version = "0.20.9" @@ -1168,20 +1149,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - [[package]] name = "darling_core" version = "0.20.9" @@ -1207,17 +1174,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.9" @@ -1559,16 +1515,17 @@ dependencies = [ [[package]] name = "eventsource-client" -version = "0.10.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9146112ee3ce031aa5aebe3e049e10b1d353b9c7630cc6be488c2c62cc5d9c42" +checksum = "4c80c6714d1a380314fcb11a22eeff022e1e1c9642f0bb54e15dc9cb29f37b29" dependencies = [ "futures", "hyper", - "hyper-rustls 0.22.1", + "hyper-rustls", "hyper-timeout", "log", "pin-project", + "rand", "tokio", ] @@ -1676,9 +1633,9 @@ dependencies = [ [[package]] name = "fuel-asm" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42df651415e443094f86102473b7f9fa23633ab6c3c98dd3f713adde251acf0f" +checksum = "491f1777538b0e1d479609d0d75bca5242c7fd3394f2ddd4ea55b8c96bcc8387" dependencies = [ "bitflags 2.5.0", "fuel-types", @@ -1688,9 +1645,9 @@ dependencies = [ [[package]] name = "fuel-core" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b030e12851d70598e12722886b899e28884d168367fc20d9a809951dd599004" +checksum = "e4a3327a090d1275bd49922b30a73d6833e79221cae62656f896fc6d3bb716a4" dependencies = [ "anyhow", "async-graphql", @@ -1703,6 +1660,7 @@ dependencies = [ "fuel-core-consensus-module", "fuel-core-database", "fuel-core-executor", + "fuel-core-gas-price-service", "fuel-core-importer", "fuel-core-metrics", "fuel-core-p2p", @@ -1718,6 +1676,7 @@ dependencies = [ "hyper", "indicatif", "itertools 0.12.1", + "postcard", "rand", "serde", "serde_json", @@ -1725,6 +1684,7 @@ dependencies = [ "strum_macros 0.25.3", "thiserror", "tokio", + "tokio-rayon", "tokio-stream", "tokio-util", "tower-http", @@ -1734,9 +1694,9 @@ dependencies = [ [[package]] name = "fuel-core-chain-config" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d202fe1dfeb98882bdc5a0206a58e469d76fd09d952c4050bb979102bd690398" +checksum = "05c13f888fb9b705b64bbcb56d022345cf85a86535d646bf53e20771eb4b986a" dependencies = [ "anyhow", "bech32", @@ -1754,9 +1714,9 @@ dependencies = [ [[package]] name = "fuel-core-client" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc636a8706e36c713606ee4226fdef5260e3650ba0e8a57f0fc06258d0078a34" +checksum = "2bd1910fce3eebe33b5acba656e092e5ede267acb4b1c3f17c122a0477270091" dependencies = [ "anyhow", "cynic", @@ -1765,7 +1725,7 @@ dependencies = [ "fuel-core-types", "futures", "hex", - "hyper-rustls 0.24.2", + "hyper-rustls", "itertools 0.12.1", "reqwest", "schemafy_lib", @@ -1778,9 +1738,9 @@ dependencies = [ [[package]] name = "fuel-core-consensus-module" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f99179c08972efffe7628f0ff8d59028218b126347a6f9eba86f71e20966eeb" +checksum = "3b2e7b793cd76350fc8da9386ad0e8b15eb1fc45c75cc223761af1ed730736c7" dependencies = [ "anyhow", "fuel-core-chain-config", @@ -1791,9 +1751,9 @@ dependencies = [ [[package]] name = "fuel-core-database" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5b1fd08a72609ebf0c8106359a37a4b205055be15e9f4fc30a4c0b5f0644c6b" +checksum = "8e030f58d7b41fbebe984f6cd53b18e448eae3433fa8af7f39ec5f13fd917e04" dependencies = [ "anyhow", "derive_more", @@ -1803,9 +1763,9 @@ dependencies = [ [[package]] name = "fuel-core-executor" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f98d89798007bc781d56e02681144683f5c645ee0725e7717e38694e8e5e31d" +checksum = "862f492af8ce138f3fd607eadfa3ef22a66f64773f451b55181b59f624265cfc" dependencies = [ "anyhow", "fuel-core-storage", @@ -1816,30 +1776,47 @@ dependencies = [ "tracing", ] +[[package]] +name = "fuel-core-gas-price-service" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d3d418865a81e23b212894f77ef6a697ea3c8c6f19d09c1923c4db245f5af01" +dependencies = [ + "anyhow", + "async-trait", + "fuel-core-services", + "fuel-core-types", + "fuel-gas-price-algorithm", + "futures", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "fuel-core-importer" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51837a53f2d8b78a701aee61b99c7f1873f23e864f01f4b4d0644a06e1f7c41" +checksum = "dc96f6d33842303b97cf586dc028d32c03e5fb7a9f35a109002c51c3f5fbc67a" dependencies = [ "anyhow", "derive_more", "fuel-core-metrics", "fuel-core-storage", "fuel-core-types", + "parking_lot", + "rayon", "tokio", - "tokio-rayon", "tracing", ] [[package]] name = "fuel-core-metrics" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bacc62bc4fec2fe6a818a1a7145b892bd486d69266190ca8dd31a036a3a327b7" +checksum = "b1e2f22f6c4ce2696c29c14083c465f276c8d8eca67f051cb7d09a72442ceb5e" dependencies = [ - "axum", - "once_cell", + "parking_lot", "pin-project-lite", "prometheus-client", "regex", @@ -1848,9 +1825,9 @@ dependencies = [ [[package]] name = "fuel-core-p2p" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6496068f0f5736f9e51bba8f8bb04cb83f68df2f6142e410fe62854b47621b3" +checksum = "1462fc6e7a911329ee5370274e7a3c5a111ab2a744e7878c3907d7724f3dddca" dependencies = [ "anyhow", "async-trait", @@ -1869,6 +1846,7 @@ dependencies = [ "quick-protobuf", "quick-protobuf-codec", "rand", + "rayon", "serde", "serde_with", "sha2 0.10.8", @@ -1880,9 +1858,9 @@ dependencies = [ [[package]] name = "fuel-core-poa" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68d189ecd635688ddc896b44c8497b29c04bb4a3719a24eea0ca9691a6f76d5e" +checksum = "c646e9246bc333e365d130f5a854fb9c33f9237e178d87c75a7d136d1f3211f9" dependencies = [ "anyhow", "async-trait", @@ -1897,9 +1875,9 @@ dependencies = [ [[package]] name = "fuel-core-producer" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2901a7ba2c0e724bbb88a3111fdb9844f5faf9f0bd4005944f61f093730b4d" +checksum = "45bae5851da4bb97f440f003fa517d23aa32505ec51cfdd0eb87644c4c7621a9" dependencies = [ "anyhow", "async-trait", @@ -1913,9 +1891,9 @@ dependencies = [ [[package]] name = "fuel-core-services" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2ab4d3931b8cafdb2e69fe8ca97918a168d74c73c070481ca0e552cc37bb93" +checksum = "ff8a175199e0e7b1373ac10d45eb26563c1e8299298c9589ab60efb1c7cae6ac" dependencies = [ "anyhow", "async-trait", @@ -1928,9 +1906,9 @@ dependencies = [ [[package]] name = "fuel-core-storage" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e039c1c6ebef314c74c34728e1f2199dcf9ede041d6f5c6e11479517c8f4d320" +checksum = "6a3ee3b462cc9b7e62b3ae04d5e3b792e6742c479bd75d6bc0987443a92b5299" dependencies = [ "anyhow", "derive_more", @@ -1952,9 +1930,9 @@ dependencies = [ [[package]] name = "fuel-core-txpool" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985684e2d67d5018e9227a4f9ed79cac02b23b207e457ee95833ab047769c2ac" +checksum = "c7b359054dda9026718b9b23e82c172dbb52eb6d29c1b9589b9d2edac6714e31" dependencies = [ "anyhow", "async-trait", @@ -1962,8 +1940,8 @@ dependencies = [ "fuel-core-services", "fuel-core-storage", "fuel-core-types", - "futures", "mockall", + "num-rational", "parking_lot", "tokio", "tokio-rayon", @@ -1973,9 +1951,9 @@ dependencies = [ [[package]] name = "fuel-core-types" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf038dd8df8d3aa665a13295c9ef888ba8118600cccdf8fb4587410e0e102fdf" +checksum = "615783f63b40075d1bf64a42b4fd4edce076458c94b0fab2278a570b2b7a8e0e" dependencies = [ "anyhow", "bs58", @@ -1992,9 +1970,9 @@ dependencies = [ [[package]] name = "fuel-core-upgradable-executor" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc54c84a7dc13f76930761ebca391b167caa096dc2bdb2413b5a2400bf65f99d" +checksum = "aec85090083710f81142760b897289b4852cbba10b3d2e24236bf9e19987d87b" dependencies = [ "fuel-core-executor", "fuel-core-storage", @@ -2003,9 +1981,9 @@ dependencies = [ [[package]] name = "fuel-crypto" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71cef93970fb8a26d3a683ae211833c6bbf391066887f501bd5859f29992b59a" +checksum = "f74f03ba9b27f375a0482b1afe20d5b8cfd032fedba683a584cdbd6d10147439" dependencies = [ "coins-bip32", "coins-bip39", @@ -2024,9 +2002,9 @@ dependencies = [ [[package]] name = "fuel-derive" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b85e8e508b26d088262075fcfe9921b7009c931fef1cc55fe1dafb116c99884" +checksum = "89ad30ad1a11e5a811ae67b6b0cb6785ce21bcd5ef0afd442fd963d5be95d09d" dependencies = [ "proc-macro2", "quote", @@ -2034,11 +2012,20 @@ dependencies = [ "synstructure", ] +[[package]] +name = "fuel-gas-price-algorithm" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15d5a513428ce53a7713261c01059c2f5f376d86eeb23a6a6befb778da561da1" +dependencies = [ + "thiserror", +] + [[package]] name = "fuel-merkle" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5198b4eab5a19b0034971da88199dae7dd61806ebd8df366d6af1f17cda2e151" +checksum = "5433c41ffbf531eed1380148cd68e37f9dd7e25966a9c59518f6b09e346e80e2" dependencies = [ "derive_more", "digest 0.10.7", @@ -2051,15 +2038,15 @@ dependencies = [ [[package]] name = "fuel-storage" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa738e9c244f3f312af09faef108ec9a285f02afcefbc579c19c242cea742dd0" +checksum = "ce3fc3cd96fe312442cdf35966b96d66becd02582b505f856f74953f57adf020" [[package]] name = "fuel-tx" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e4b4ea79ffe711af7bbf363b25f383fc6e481e652cf55a5ef8b5a458fcf4ef9" +checksum = "e00cc42ae3121b1881a6ae8306696d1bea73adca424216d9f676ee91d3927c74" dependencies = [ "bitflags 2.5.0", "derivative", @@ -2080,9 +2067,9 @@ dependencies = [ [[package]] name = "fuel-types" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455cf5275d96f6907e81ed1825c4e6a9dd79f7c1c37a4e15134562f83024c7e7" +checksum = "ae98e143dec4e6cb114a92435e314f1d4815e17e8fded24332fb285319d60167" dependencies = [ "fuel-derive", "hex", @@ -2092,9 +2079,9 @@ dependencies = [ [[package]] name = "fuel-vm" -version = "0.49.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8811f949db8ce61cc68dcf81644047df4ee23be55879efcfe9f1aa5adc378965" +checksum = "641a2ee5a3398633fa243fba3343cbe2225ae335a09141f6b94041720cfc3520" dependencies = [ "anyhow", "async-trait", @@ -2126,9 +2113,9 @@ dependencies = [ [[package]] name = "fuels" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eeb6fa017c6d695cf4468d21c640857ba1c74d31fdac3277ad4414593a14a7b" +checksum = "601ed66a0485065471cd9c8bab2db7cfa58bc7ed5d2e68bd26fc573ac2575827" dependencies = [ "fuel-core", "fuel-core-client", @@ -2143,9 +2130,9 @@ dependencies = [ [[package]] name = "fuels-accounts" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a55f3ba7346cb73a5565fd7b6ab2c0016be052863323ca076e6ac9fec719759" +checksum = "fed97e653906fe0bc60b5d7a7421f3c5fe766f516b762def8f4ccac707ac4bc3" dependencies = [ "async-trait", "chrono", @@ -2157,6 +2144,7 @@ dependencies = [ "fuel-tx", "fuel-types", "fuels-core", + "itertools 0.12.1", "rand", "semver", "tai64", @@ -2167,9 +2155,9 @@ dependencies = [ [[package]] name = "fuels-code-gen" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8db288a46989c20bc48dee787008959a2a7c17061fe78cf4ae4c1263c80692e1" +checksum = "1edef30656b740ca9c279a7bcfe9e366557c271a2751e36316f780f18dc99c85" dependencies = [ "Inflector", "fuel-abi-types", @@ -2183,9 +2171,9 @@ dependencies = [ [[package]] name = "fuels-core" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63d0abdc7230e4adb619a3735c237af545dcfdf86f4096b9d1daaf315838987e" +checksum = "ff741c9f1ba2c701b50c76a98a5655d8bc0f275f7ae2dd0e724f8fc36eeb8a9f" dependencies = [ "async-trait", "bech32", @@ -2202,6 +2190,7 @@ dependencies = [ "fuels-macros", "hex", "itertools 0.12.1", + "postcard", "serde", "serde_json", "thiserror", @@ -2210,23 +2199,22 @@ dependencies = [ [[package]] name = "fuels-macros" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e137a52541dbd0345bf000301091b5266644fd4de04bb8238457c5c70b9ac4e" +checksum = "bba1c2fd149a310879249144f2589336708ae860563a45b792907ae34ae6b959" dependencies = [ "fuels-code-gen", "itertools 0.12.1", "proc-macro2", "quote", - "rand", "syn 2.0.60", ] [[package]] name = "fuels-programs" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ada44df4a718da78add027d1204af8154265fc2f64b60cc28b1bba597df7e5d6" +checksum = "a45652fa07c48d5fba2ee50ddd279eead2c55b251b3d426d2189394b475330e9" dependencies = [ "async-trait", "fuel-abi-types", @@ -2243,9 +2231,9 @@ dependencies = [ [[package]] name = "fuels-test-helpers" -version = "0.62.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46d53ef79da8600d8ef580c0acc859be80b07eef0c9ddc19c61bb04b3cf4c15" +checksum = "967a140a51095d071c84970365c37f856f4f098b835cb609b934dff4b8296cce" dependencies = [ "fuel-core", "fuel-core-chain-config", @@ -2489,7 +2477,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", "indexmap 2.2.6", "slab", "tokio", @@ -2695,6 +2683,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -2702,7 +2701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", "pin-project-lite", ] @@ -2735,7 +2734,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.12", "http-body", "httparse", "httpdate", @@ -2748,23 +2747,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" -dependencies = [ - "ct-logs", - "futures-util", - "hyper", - "log", - "rustls 0.19.1", - "rustls-native-certs 0.5.0", - "tokio", - "tokio-rustls 0.22.0", - "webpki", -] - [[package]] name = "hyper-rustls" version = "0.24.2" @@ -2772,13 +2754,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", + "http 0.2.12", "hyper", "log", "rustls 0.21.12", - "rustls-native-certs 0.6.3", + "rustls-native-certs", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls", "webpki-roots", ] @@ -2911,7 +2893,7 @@ dependencies = [ "attohttpc", "bytes", "futures", - "http", + "http 0.2.12", "hyper", "log", "rand", @@ -3726,16 +3708,15 @@ dependencies = [ [[package]] name = "multer" -version = "2.1.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" dependencies = [ "bytes", "encoding_rs", "futures-util", - "http", + "http 1.1.0", "httparse", - "log", "memchr", "mime", "spin 0.9.8", @@ -3975,11 +3956,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -4189,9 +4169,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.9" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ "memchr", "thiserror", @@ -4394,7 +4374,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", ] [[package]] @@ -4714,10 +4703,10 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.12", "http-body", "hyper", - "hyper-rustls 0.24.2", + "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -4736,7 +4725,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", - "tokio-rustls 0.24.1", + "tokio-rustls", "tower-service", "url", "wasm-bindgen", @@ -4863,19 +4852,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64 0.13.1", - "log", - "ring 0.16.20", - "sct 0.6.1", - "webpki", -] - [[package]] name = "rustls" version = "0.21.12" @@ -4885,7 +4861,7 @@ dependencies = [ "log", "ring 0.17.8", "rustls-webpki 0.101.7", - "sct 0.7.1", + "sct", ] [[package]] @@ -4902,18 +4878,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-native-certs" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" -dependencies = [ - "openssl-probe", - "rustls 0.19.1", - "schannel", - "security-framework", -] - [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -5071,16 +5035,6 @@ dependencies = [ "sha2 0.10.8", ] -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", -] - [[package]] name = "sct" version = "0.7.1" @@ -5437,6 +5391,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "static_assertions_next" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7beae5182595e9a8b683fa98c4317f956c9a2dec3b9716990d20023cc60c766" + [[package]] name = "strsim" version = "0.10.0" @@ -5467,6 +5427,15 @@ dependencies = [ "strum_macros 0.25.3", ] +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros 0.26.4", +] + [[package]] name = "strum_macros" version = "0.24.3" @@ -5493,6 +5462,19 @@ dependencies = [ "syn 2.0.60", ] +[[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" @@ -5718,17 +5700,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls 0.19.1", - "tokio", - "webpki", -] - [[package]] name = "tokio-rustls" version = "0.24.1" @@ -5791,6 +5762,17 @@ dependencies = [ "winnow", ] +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow", +] + [[package]] name = "tower" version = "0.4.13" @@ -5817,7 +5799,7 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", + "http 0.2.12", "http-body", "http-range-header", "pin-project-lite", @@ -6133,16 +6115,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", -] - [[package]] name = "webpki-roots" version = "0.25.4" diff --git a/target_chains/fuel/contracts/Cargo.toml b/target_chains/fuel/contracts/Cargo.toml index ce24f2ad49..e438088d8a 100644 --- a/target_chains/fuel/contracts/Cargo.toml +++ b/target_chains/fuel/contracts/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" [dependencies] rand = "0.8.5" base64 = "0.22" -fuels = { version = "0.62.0", features = ["fuel-core-lib"] } +fuels = { version = "0.65.1", features = ["fuel-core-lib"] } tokio = { version = "1.12", features = ["rt", "macros"] } hex = "0.4.3" reqwest = "0.11.27" diff --git a/target_chains/fuel/contracts/Forc.lock b/target_chains/fuel/contracts/Forc.lock index 77b7e3c954..a04fdf35c7 100644 --- a/target_chains/fuel/contracts/Forc.lock +++ b/target_chains/fuel/contracts/Forc.lock @@ -1,6 +1,6 @@ [[package]] name = "core" -source = "path+from-root-E19CE48B3E858B72" +source = "path+from-root-2AB5BCE55EAAEFF4" [[package]] name = "pyth-contract" @@ -32,7 +32,7 @@ dependencies = ["std"] [[package]] name = "std" -source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6" +source = "git+https://github.com/fuellabs/sway?tag=v0.62.0#efda0397c7bee77de73bd726ec0b732d57614973" dependencies = ["core"] [[package]] diff --git a/target_chains/fuel/contracts/README.md b/target_chains/fuel/contracts/README.md index 65ce3f2268..a02aafa667 100644 --- a/target_chains/fuel/contracts/README.md +++ b/target_chains/fuel/contracts/README.md @@ -1,17 +1,15 @@ # Pyth-integration -> **_NOTE:_** The project is a WIP. - An implementation of a [Pyth Network](https://pyth.network/) oracle contract in Sway. Utilising minimal, internal [Wormhole](https://docs.wormhole.com/wormhole/) functionality and state. ## Interfaces The project provides four interfaces for interaction with the oracle contract: -- [PythCore](./pyth-interface/src/interface.sw#L20) - provides the core functionality to required to utilise the oracle; getting fees, updating prices and fetching prices. -- [PythInit](./pyth-interface/src/interface.sw#L250) - provides the functionality to setup the oracle's state. -- [PythInfo](./pyth-interface/src/interface.sw#L255) - provides additional information about the oracle's state. -- [WormholeGuardians](./pyth-interface/src/interface.sw#L283) - provides functionality to maintain and query the wormhole-state-elements used by the oracle. +- [PythCore](./pyth-interface/src/interface.sw#L24) - provides the core functionality to required to utilise the oracle; getting fees, updating prices and fetching prices. +- [PythInit](./pyth-interface/src/interface.sw#L263) - provides the functionality to setup the oracle's state. +- [PythInfo](./pyth-interface/src/interface.sw#L277) - provides additional information about the oracle's state. +- [WormholeGuardians](./pyth-interface/src/interface.sw#L308) - provides functionality to maintain and query the wormhole-state-elements used by the oracle. ## Running the project @@ -37,7 +35,7 @@ cargo test Before deploying the oracle contract; the `deployer` must be set to the address of the deploying wallet in the storage block, so that the deployer can setup the contract with the `constructor()` method. -Parameters for the `constructor()` method can be seen in the [tests of the method](./pyth-contract/tests/functions/pyth_init/constuctor.rs#L28), which at the time of writing uses the real up-to-date values as per Pyth's documentation and EVM integrations. Care should be taken to ensure that the most up-to-date values are used for the `constructor()` method's parameters. +Parameters for the `constructor()` method can be seen in the [tests of the method](./tests/utils/interface/pyth_init.rs#L7), which at the time of writing uses the real up-to-date values as per Pyth's documentation and EVM integrations. Care should be taken to ensure that the most up-to-date values are used for the `constructor()` method's parameters. #### Fuel Beta-5 network deployment: diff --git a/target_chains/fuel/contracts/fuel-toolchain.toml b/target_chains/fuel/contracts/fuel-toolchain.toml index b12c6fa697..c75d9768ce 100644 --- a/target_chains/fuel/contracts/fuel-toolchain.toml +++ b/target_chains/fuel/contracts/fuel-toolchain.toml @@ -2,5 +2,5 @@ channel = "latest-aarch64-apple-darwin" [components] -forc = "0.60.0" -fuel-core = "0.26.0" +forc = "0.62.0" +fuel-core = "0.31.0" diff --git a/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-abi.json b/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-abi.json index 6f67266c0f..9ae67f369c 100644 --- a/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-abi.json +++ b/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-abi.json @@ -1838,7 +1838,7 @@ "type": 6, "typeArguments": [] }, - "offset": 129616 + "offset": 117008 } ] } diff --git a/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-storage_slots.json b/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-storage_slots.json index f242d95f08..4223d3df55 100644 --- a/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-storage_slots.json +++ b/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-storage_slots.json @@ -1,50 +1,50 @@ [ { - "key": "6294951dcb0a9111a517be5cf4785670ff4e166fb5ab9c33b17e6881b48e964f", + "key": "11672498f6e54d64f7c94ceafab63ce9c33b957b083d82f9301e18c4bbcdd43e", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "71217a24656901c411894bb65eb78a828dafa5a6844488ef5024eb5ac0cff79c", + "key": "1fea2a1870fafe58b3f658d2a10d75f7d4b599036bb925958e3650097753f03f", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "71217a24656901c411894bb65eb78a828dafa5a6844488ef5024eb5ac0cff79d", + "key": "1fea2a1870fafe58b3f658d2a10d75f7d4b599036bb925958e3650097753f040", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "7f91d1a929dce734e7f930bbb279ccfccdb5474227502ea8845815c74bd930a7", + "key": "1feab27058c4ed60cb36c15c123efafc983fdbc10f4cfac4f1b23fdb8c36fb7d", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "8a89a0cce819e0426e565819a9a98711329087da5a802fb16edd223c47fa44ef", + "key": "1feab27058c4ed60cb36c15c123efafc983fdbc10f4cfac4f1b23fdb8c36fb7e", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "94b2b70d20da552763c7614981b2a4d984380d7ed4e54c01b28c914e79e44bd5", + "key": "2978ac0e4bdc20e0a96c04e8adb0639e5efdff01601aa4f7887421e795e4b96a", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "94b2b70d20da552763c7614981b2a4d984380d7ed4e54c01b28c914e79e44bd6", + "key": "357565afd3b58fa5509545cd95377655dcb331b733af6f4439699d27dcf450eb", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "a9203bbb8366ca9d708705dce980acbb54d44fb753370ffe4c7d351b46b2abbc", + "key": "358560d9e39bf0d62ad9ffeba18c167b0e4e6722c6eb24f55cbc64054c51b905", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "b48b753af346966d0d169c0b2e3234611f65d5cfdb57c7b6e7cd6ca93707bee0", + "key": "358560d9e39bf0d62ad9ffeba18c167b0e4e6722c6eb24f55cbc64054c51b906", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "c7e08cdde76020f08f4ce5c3257422ae67f9676992689b64b85f35aa58752d9e", + "key": "480744474aef380dda93aae5f17de10f991ca301c7ae8a925ab40229da966cf8", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "c7e08cdde76020f08f4ce5c3257422ae67f9676992689b64b85f35aa58752d9f", + "key": "d16fb5609ac0a5d5c45145524cbd88ae218f3be85b76bb42239b7eb916305d6d", "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - "key": "d02e07f5a716bd3b6670aaf9a73352164e6b946c24db14f72005b7029e67d96a", + "key": "f9e12c6c1c57daf9e6a5ff000b582628bec999880e26917559121db757ba5653", "value": "0000000000000000000000000000000000000000000000000000000000000000" } ] diff --git a/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract.bin b/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract.bin index 1fb98bab48..dccb66dea4 100644 Binary files a/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract.bin and b/target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract.bin differ diff --git a/target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw b/target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw index 7e4d61ce54..6d03562a70 100644 --- a/target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw +++ b/target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw @@ -333,7 +333,7 @@ impl PriceFeed { let (_, slice) = encoded_proof.split_at(current_offset); let (encoded_message, _) = slice.split_at(message_size); current_offset += message_size; - let end_offset = validate_proof(encoded_proof, current_offset, digest, encoded_message); + let end_offset = validate_proof(encoded_proof, current_offset, digest, encoded_message.clone()); // Message type of 0 is a Price Feed require( encoded_message diff --git a/target_chains/fuel/contracts/pyth-interface/src/pyth_merkle_proof.sw b/target_chains/fuel/contracts/pyth-interface/src/pyth_merkle_proof.sw index d73c7805a4..a26f91fcb0 100644 --- a/target_chains/fuel/contracts/pyth-interface/src/pyth_merkle_proof.sw +++ b/target_chains/fuel/contracts/pyth-interface/src/pyth_merkle_proof.sw @@ -42,7 +42,6 @@ pub fn validate_proof( leaf_data: Bytes, ) -> u64 { let mut current_digest = leaf_hash(leaf_data); - let proof_size = encoded_proof.get(proof_offset).unwrap().as_u64(); proof_offset += 1; diff --git a/target_chains/fuel/contracts/src/pyth_utils.rs b/target_chains/fuel/contracts/src/pyth_utils.rs index 88e713a81b..379d6bda6d 100644 --- a/target_chains/fuel/contracts/src/pyth_utils.rs +++ b/target_chains/fuel/contracts/src/pyth_utils.rs @@ -7,8 +7,12 @@ use crate::constants::{ use base64::{engine::general_purpose, prelude::Engine}; use fuels::{ prelude::{abigen, CallParameters, Contract, LoadConfiguration, TxPolicies, WalletUnlocked}, - programs::call_response::FuelCallResponse, - types::{errors::Error, Address, Bits256, Bytes, Identity}, + programs::responses::CallResponse, + tx::Receipt, + types::{ + errors::{transaction::Reason, Error}, + Address, Bits256, Bytes, Identity, + }, }; use rand::Rng; use reqwest; @@ -163,7 +167,7 @@ pub fn create_governance_instruction_payload( } impl Pyth { - pub async fn price(&self, price_feed_id: Bits256) -> Result, Error> { + pub async fn price(&self, price_feed_id: Bits256) -> Result, Error> { self.instance .methods() .price(price_feed_id) @@ -175,7 +179,7 @@ impl Pyth { &self, fee: u64, update_data: &[Bytes], - ) -> Result, Error> { + ) -> Result, Error> { self.instance .methods() .update_price_feeds(update_data.to_vec()) @@ -184,7 +188,7 @@ impl Pyth { .await } - pub async fn update_fee(&self, update_data: &[Bytes]) -> Result, Error> { + pub async fn update_fee(&self, update_data: &[Bytes]) -> Result, Error> { self.instance .methods() .update_fee(update_data.to_vec()) @@ -200,7 +204,7 @@ impl Pyth { wormhole_guardian_set_addresses: Vec, wormhole_guardian_set_index: u32, chain_id: u16, - ) -> Result, Error> { + ) -> Result, Error> { self.instance .methods() .constructor( @@ -240,7 +244,7 @@ impl Pyth { }) } - pub async fn current_guardian_set_index(&self) -> Result, Error> { + pub async fn current_guardian_set_index(&self) -> Result, Error> { self.instance .methods() .current_guardian_set_index() @@ -376,3 +380,25 @@ pub fn default_data_sources() -> Vec { }, ] } + +pub fn handle_error(e: Error) -> Error { + if let Error::Transaction(Reason::Reverted { + reason: _, + revert_id: _, + receipts, + }) = &e + { + for r in receipts { + match r { + Receipt::Log { ra, .. } => { + println!("{:?}", ra); + } + Receipt::LogData { data, .. } => { + println!("{:?}", hex::encode(data.clone().unwrap())); + } + _ => {} + } + } + } + e +} diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price.rs index 93dc3d6f8b..bf0a7dccf9 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price.rs @@ -42,8 +42,7 @@ mod success { .value; update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()) - .await - .unwrap(); + .await; let eth_usd_ema_price = ema_price(&deployer.instance, default_price_feed_ids()[0]) .await @@ -90,8 +89,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await - .unwrap(); + .await; let eth_usd_ema_price = ema_price(&deployer.instance, default_price_feed_ids()[0]) .await diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_no_older_than.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_no_older_than.rs index 2eecac7fa2..68ee825856 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_no_older_than.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_no_older_than.rs @@ -42,8 +42,7 @@ mod success { .value; update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()) - .await - .unwrap(); + .await; let eth_usd_ema_price = ema_price_no_older_than( &deployer.instance, @@ -98,8 +97,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await - .unwrap(); + .await; let eth_usd_ema_price = ema_price_no_older_than( &deployer.instance, diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_unsafe.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_unsafe.rs index f48efa45ac..dacfb7db44 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_unsafe.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/ema_price_unsafe.rs @@ -42,8 +42,7 @@ mod success { .value; update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()) - .await - .unwrap(); + .await; let eth_usd_ema_price = ema_price_unsafe(&deployer.instance, default_price_feed_ids()[0]) .await @@ -90,8 +89,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await - .unwrap(); + .await; let eth_usd_ema_price = ema_price_unsafe(&deployer.instance, default_price_feed_ids()[0]) .await diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/price.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/price.rs index 581a145d8e..b7d0e7ab7f 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/price.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/price.rs @@ -40,7 +40,7 @@ mod success { .await .value; - update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await.unwrap(); + update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await; let eth_usd_price = price(&deployer.instance, default_price_feed_ids()[0]) .await @@ -87,7 +87,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await.unwrap(); + .await; let eth_usd_price = price(&deployer.instance, default_price_feed_ids()[0]) .await diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/price_no_older_than.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/price_no_older_than.rs index a02e83ba4d..b67032cdf1 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/price_no_older_than.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/price_no_older_than.rs @@ -43,8 +43,7 @@ mod success { .value; update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()) - .await - .unwrap(); + .await; let eth_usd_price = price_no_older_than( &deployer.instance, @@ -99,8 +98,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await - .unwrap(); + .await; let eth_usd_price = price_no_older_than( &deployer.instance, diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/price_unsafe.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/price_unsafe.rs index 2363452d64..c8b5d421b5 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/price_unsafe.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/price_unsafe.rs @@ -40,7 +40,7 @@ mod success { .await .value; - update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await.unwrap(); + update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await; let eth_usd_price = price_unsafe(&deployer.instance, default_price_feed_ids()[0]) .await @@ -87,7 +87,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await.unwrap(); + .await; let eth_usd_price = price_unsafe(&deployer.instance, default_price_feed_ids()[0]) .await diff --git a/target_chains/fuel/contracts/tests/functions/pyth_core/update_price_feeds.rs b/target_chains/fuel/contracts/tests/functions/pyth_core/update_price_feeds.rs index 071dbd8e5a..47caaf8b89 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_core/update_price_feeds.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_core/update_price_feeds.rs @@ -5,7 +5,6 @@ use crate::utils::interface::{ }; use crate::utils::setup::setup_environment; -use fuels::types::errors::{transaction::Reason, Error}; use pyth_sdk::{ constants::{ DEFAULT_SINGLE_UPDATE_FEE, DEFAULT_VALID_TIME_PERIOD, DUMMY_CHAIN_ID, @@ -56,9 +55,7 @@ mod success { (false, false) ); - update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()) - .await - .unwrap(); + update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await; // Final values assert_eq!( @@ -113,8 +110,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await - .unwrap(); + .await; // Final values assert_eq!( @@ -132,6 +128,10 @@ mod success { } mod failure { + use fuels::{ + programs::calls::CallParameters, + types::errors::{transaction::Reason, Error}, + }; use super::*; @@ -169,18 +169,21 @@ mod failure { (false, false) ); - let response = update_price_feeds( - &deployer.instance, - fee, - test_corrupted_proof_accumulator_update_data_bytes(), - ) - .await; + // Manually call the function to test the panic + let result = deployer + .instance + .methods() + .update_price_feeds(test_corrupted_proof_accumulator_update_data_bytes()) + .call_params(CallParameters::default().with_amount(fee)) + .unwrap() + .call() + .await; - let is_error = response.is_err(); + let is_error = result.is_err(); assert!(is_error); - let error = response.unwrap_err(); + let error = result.unwrap_err(); if let Error::Transaction(Reason::Reverted { reason, diff --git a/target_chains/fuel/contracts/tests/functions/pyth_info/price_feed_unsafe.rs b/target_chains/fuel/contracts/tests/functions/pyth_info/price_feed_unsafe.rs index 523cf92365..c06b6e808c 100644 --- a/target_chains/fuel/contracts/tests/functions/pyth_info/price_feed_unsafe.rs +++ b/target_chains/fuel/contracts/tests/functions/pyth_info/price_feed_unsafe.rs @@ -41,7 +41,7 @@ mod success { .await .value; - update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await.unwrap(); + update_price_feeds(&deployer.instance, fee, test_batch_update_data_bytes()).await; let eth_usd_price_feed = price_feed_unsafe(&deployer.instance, default_price_feed_ids()[0]) .await @@ -81,7 +81,7 @@ mod success { fee, test_accumulator_update_data_bytes(), ) - .await.unwrap(); + .await; let eth_usd_price_feed = price_feed_unsafe(&deployer.instance, default_price_feed_ids()[0]) .await diff --git a/target_chains/fuel/contracts/tests/utils/interface/pyth_core.rs b/target_chains/fuel/contracts/tests/utils/interface/pyth_core.rs index 779f29eaa8..a0798c3030 100644 --- a/target_chains/fuel/contracts/tests/utils/interface/pyth_core.rs +++ b/target_chains/fuel/contracts/tests/utils/interface/pyth_core.rs @@ -1,22 +1,22 @@ use fuels::{ accounts::wallet::WalletUnlocked, prelude::{Bytes, CallParameters, TxPolicies}, - programs::call_response::FuelCallResponse, - types::errors::Error, + programs::responses::CallResponse, types::Bits256, }; -use pyth_sdk::pyth_utils::{Price, PriceFeed, PythOracleContract}; +use pyth_sdk::pyth_utils::{handle_error, Price, PriceFeed, PythOracleContract}; pub(crate) async fn ema_price( contract: &PythOracleContract, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .ema_price(price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } @@ -24,24 +24,26 @@ pub(crate) async fn ema_price_no_older_than( contract: &PythOracleContract, time_period: u64, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .ema_price_no_older_than(time_period, price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn ema_price_unsafe( contract: &PythOracleContract, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .ema_price_unsafe(price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } @@ -52,7 +54,7 @@ pub(crate) async fn parse_price_feed_updates( min_publish_time: u64, price_feed_ids: Vec, update_data: Vec, -) -> FuelCallResponse> { +) -> CallResponse> { contract .methods() .parse_price_feed_updates( @@ -66,18 +68,20 @@ pub(crate) async fn parse_price_feed_updates( .unwrap() .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn price( contract: &PythOracleContract, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .price(price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } @@ -85,36 +89,39 @@ pub(crate) async fn price_no_older_than( contract: &PythOracleContract, time_period: u64, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .price_no_older_than(time_period, price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn price_unsafe( contract: &PythOracleContract, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .price_unsafe(price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn update_fee( contract: &PythOracleContract, update_data: Vec, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .update_fee(update_data) .call() .await + .map_err(handle_error) .unwrap() } @@ -122,7 +129,7 @@ pub(crate) async fn update_price_feeds( contract: &PythOracleContract, fee: u64, update_data: Vec, -) -> Result, Error> { +) -> CallResponse<()> { contract .methods() .update_price_feeds(update_data) @@ -130,6 +137,8 @@ pub(crate) async fn update_price_feeds( .unwrap() .call() .await + .map_err(handle_error) + .unwrap() } pub(crate) async fn update_price_feeds_if_necessary( @@ -138,7 +147,7 @@ pub(crate) async fn update_price_feeds_if_necessary( price_feed_ids: Vec, publish_times: Vec, update_data: Vec, -) -> FuelCallResponse<()> { +) -> CallResponse<()> { contract .methods() .update_price_feeds_if_necessary(price_feed_ids, publish_times, update_data) @@ -146,11 +155,18 @@ pub(crate) async fn update_price_feeds_if_necessary( .unwrap() .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn valid_time_period( contract: &PythOracleContract, -) -> FuelCallResponse { - contract.methods().valid_time_period().call().await.unwrap() +) -> CallResponse { + contract + .methods() + .valid_time_period() + .call() + .await + .map_err(handle_error) + .unwrap() } diff --git a/target_chains/fuel/contracts/tests/utils/interface/pyth_governance.rs b/target_chains/fuel/contracts/tests/utils/interface/pyth_governance.rs index 54145c80db..3b37a4781c 100644 --- a/target_chains/fuel/contracts/tests/utils/interface/pyth_governance.rs +++ b/target_chains/fuel/contracts/tests/utils/interface/pyth_governance.rs @@ -1,27 +1,27 @@ -use fuels::{ - accounts::wallet::WalletUnlocked, programs::call_response::FuelCallResponse, types::Bytes, -}; -use pyth_sdk::pyth_utils::{DataSource, PythOracleContract}; +use fuels::{accounts::wallet::WalletUnlocked, programs::responses::CallResponse, types::Bytes}; +use pyth_sdk::pyth_utils::{handle_error, DataSource, PythOracleContract}; pub(crate) async fn execute_governance_instruction( contract: &PythOracleContract, encoded_vm: Bytes, -) -> FuelCallResponse<()> { +) -> CallResponse<()> { contract .methods() .execute_governance_instruction(encoded_vm) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn governance_data_source( contract: &PythOracleContract, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .governance_data_source() .call() .await + .map_err(handle_error) .unwrap() } diff --git a/target_chains/fuel/contracts/tests/utils/interface/pyth_info.rs b/target_chains/fuel/contracts/tests/utils/interface/pyth_info.rs index e7b737018d..e4a6467e80 100644 --- a/target_chains/fuel/contracts/tests/utils/interface/pyth_info.rs +++ b/target_chains/fuel/contracts/tests/utils/interface/pyth_info.rs @@ -1,64 +1,70 @@ -use fuels::{ - accounts::wallet::WalletUnlocked, programs::call_response::FuelCallResponse, types::Bits256, -}; +use fuels::{accounts::wallet::WalletUnlocked, programs::responses::CallResponse, types::Bits256}; -use pyth_sdk::pyth_utils::{DataSource, PriceFeed, PythOracleContract, State}; +use pyth_sdk::pyth_utils::{handle_error, DataSource, PriceFeed, PythOracleContract, State}; -pub(crate) async fn owner( - contract: &PythOracleContract, -) -> FuelCallResponse { +pub(crate) async fn owner(contract: &PythOracleContract) -> CallResponse { contract.methods().owner().call().await.unwrap() } pub(crate) async fn price_feed_exists( contract: &PythOracleContract, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .price_feed_exists(price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn price_feed_unsafe( contract: &PythOracleContract, price_feed_id: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .price_feed_unsafe(price_feed_id) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn single_update_fee( contract: &PythOracleContract, -) -> FuelCallResponse { - contract.methods().single_update_fee().call().await.unwrap() +) -> CallResponse { + contract + .methods() + .single_update_fee() + .call() + .await + .map_err(handle_error) + .unwrap() } pub(crate) async fn is_valid_data_source( contract: &PythOracleContract, data_source: &DataSource, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .is_valid_data_source(data_source.clone()) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn valid_data_sources( contract: &PythOracleContract, -) -> FuelCallResponse> { +) -> CallResponse> { contract .methods() .valid_data_sources() .call() .await + .map_err(handle_error) .unwrap() } diff --git a/target_chains/fuel/contracts/tests/utils/interface/pyth_init.rs b/target_chains/fuel/contracts/tests/utils/interface/pyth_init.rs index 3188ad2b10..1e4f9c25b7 100644 --- a/target_chains/fuel/contracts/tests/utils/interface/pyth_init.rs +++ b/target_chains/fuel/contracts/tests/utils/interface/pyth_init.rs @@ -1,9 +1,6 @@ -use fuels::{ - accounts::wallet::WalletUnlocked, programs::call_response::FuelCallResponse, - types::Bits256, -}; +use fuels::{accounts::wallet::WalletUnlocked, programs::responses::CallResponse, types::Bits256}; -use pyth_sdk::pyth_utils::{DataSource, PythOracleContract}; +use pyth_sdk::pyth_utils::{handle_error, DataSource, PythOracleContract}; pub(crate) async fn constructor( contract: &PythOracleContract, @@ -15,7 +12,7 @@ pub(crate) async fn constructor( wormhole_guardian_set_addresses: Vec, wormhole_guardian_set_index: u32, chain_id: u16, -) -> FuelCallResponse<()> { +) -> CallResponse<()> { contract .methods() .constructor( @@ -30,5 +27,6 @@ pub(crate) async fn constructor( ) .call() .await + .map_err(handle_error) .unwrap() } diff --git a/target_chains/fuel/contracts/tests/utils/interface/wormhole_guardians.rs b/target_chains/fuel/contracts/tests/utils/interface/wormhole_guardians.rs index e35e97f051..702b8bba3b 100644 --- a/target_chains/fuel/contracts/tests/utils/interface/wormhole_guardians.rs +++ b/target_chains/fuel/contracts/tests/utils/interface/wormhole_guardians.rs @@ -1,59 +1,69 @@ use fuels::{ accounts::wallet::WalletUnlocked, - programs::call_response::FuelCallResponse, + programs::responses::CallResponse, types::{Bits256, Bytes}, }; -use pyth_sdk::pyth_utils::{DataSource, GuardianSet, PythOracleContract}; +use pyth_sdk::pyth_utils::{handle_error, DataSource, GuardianSet, PythOracleContract}; pub(crate) async fn current_guardian_set_index( contract: &PythOracleContract, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .current_guardian_set_index() .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn current_wormhole_provider( contract: &PythOracleContract, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .current_wormhole_provider() .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn governance_action_is_consumed( contract: &PythOracleContract, governance_action_hash: Bits256, -) -> FuelCallResponse { +) -> CallResponse { contract .methods() .governance_action_is_consumed(governance_action_hash) .call() .await + .map_err(handle_error) .unwrap() } pub(crate) async fn guardian_set( contract: &PythOracleContract, index: u32, -) -> FuelCallResponse { - contract.methods().guardian_set(index).call().await.unwrap() +) -> CallResponse { + contract + .methods() + .guardian_set(index) + .call() + .await + .map_err(handle_error) + .unwrap() } pub(crate) async fn submit_new_guardian_set( contract: &PythOracleContract, encoded_vm: Bytes, -) -> FuelCallResponse<()> { +) -> CallResponse<()> { contract .methods() .submit_new_guardian_set(encoded_vm) .call() .await + .map_err(handle_error) .unwrap() }