From 91170fd89a34c2b3ff54817763f1a0285ac050b2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:06:05 +0000 Subject: [PATCH 1/7] Weekly `cargo update` (#1438) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automation to keep dependencies in `Cargo.lock` current. The following is the output from `cargo update`: ```txt  Updating async-trait v0.1.73 -> v0.1.74  Updating bitflags v2.4.0 -> v2.4.1  Updating const_format v0.2.31 -> v0.2.32  Updating const_format_proc_macros v0.2.31 -> v0.2.32  Updating cpufeatures v0.2.9 -> v0.2.10  Updating deranged v0.3.8 -> v0.3.9  Updating ed25519 v2.2.2 -> v2.2.3  Updating flate2 v1.0.27 -> v1.0.28  Updating hashbrown v0.14.1 -> v0.14.2  Updating if-watch v3.0.1 -> v3.1.0  Updating libp2p-identity v0.2.5 -> v0.2.7  Updating lock_api v0.4.10 -> v0.4.11  Updating os_str_bytes v6.5.1 -> v6.6.1  Updating parking v2.1.1 -> v2.2.0  Updating parking_lot_core v0.9.8 -> v0.9.9  Adding powerfmt v0.2.0  Adding redox_syscall v0.4.1  Updating regex v1.10.0 -> v1.10.2  Updating regex-automata v0.4.1 -> v0.4.3  Updating regex-syntax v0.8.1 -> v0.8.2  Updating ring v0.17.3 -> v0.17.5  Removing rustix v0.37.24  Removing rustix v0.38.18  Adding rustix v0.37.26  Adding rustix v0.38.20  Updating scale-info v2.9.0 -> v2.10.0  Updating scale-info-derive v2.9.0 -> v2.10.0  Updating serde v1.0.188 -> v1.0.189  Updating serde_derive v1.0.188 -> v1.0.189  Removing socket2 v0.4.9  Removing socket2 v0.5.4  Adding socket2 v0.4.10  Adding socket2 v0.5.5  Updating strum_macros v0.25.2 -> v0.25.3  Updating thiserror v1.0.49 -> v1.0.50  Updating thiserror-impl v1.0.49 -> v1.0.50  Updating time v0.3.29 -> v0.3.30  Updating tracing v0.1.37 -> v0.1.40  Updating tracing-attributes v0.1.26 -> v0.1.27  Updating tracing-core v0.1.31 -> v0.1.32  Updating uuid v1.4.1 -> v1.5.0  Updating windows v0.34.0 -> v0.51.1  Adding windows-core v0.51.1  Removing windows_aarch64_msvc v0.34.0  Removing windows_i686_gnu v0.34.0  Removing windows_i686_msvc v0.34.0  Removing windows_x86_64_gnu v0.34.0  Removing windows_x86_64_msvc v0.34.0  Updating winnow v0.5.16 -> v0.5.17 ``` Co-authored-by: github-actions --- Cargo.lock | 279 ++++++++++++++++++++++++++--------------------------- 1 file changed, 136 insertions(+), 143 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 700302fe7aa..6dbe38188ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -455,9 +455,9 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.24", + "rustix 0.37.26", "slab", - "socket2 0.4.9", + "socket2 0.4.10", "waker-fn", ] @@ -494,9 +494,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -728,9 +728,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bitvec" @@ -810,7 +810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", - "regex-automata 0.4.1", + "regex-automata 0.4.3", "serde", ] @@ -1233,18 +1233,18 @@ checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "const_format" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ "proc-macro2", "quote", @@ -1336,9 +1336,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" dependencies = [ "libc", ] @@ -1745,7 +1745,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.4.1", + "uuid 1.5.0", ] [[package]] @@ -1799,9 +1799,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] [[package]] name = "derivative" @@ -2031,9 +2034,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8 0.10.2", "signature 2.1.0", @@ -2060,7 +2063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ "curve25519-dalek 4.1.1", - "ed25519 2.2.2", + "ed25519 2.2.3", "rand_core 0.6.4", "serde", "sha2 0.10.8", @@ -2638,9 +2641,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "libz-sys", @@ -2750,7 +2753,7 @@ dependencies = [ "tokio-stream", "tower-http", "tracing", - "uuid 1.4.1", + "uuid 1.5.0", ] [[package]] @@ -2946,7 +2949,7 @@ dependencies = [ "anyhow", "clap 4.4.6", "fuel-core-types", - "libp2p-identity 0.2.5", + "libp2p-identity 0.2.7", "serde_json", ] @@ -3260,7 +3263,7 @@ dependencies = [ "fuel-crypto", "fuel-merkle", "fuel-types", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "itertools 0.10.5", "num-integer", "rand 0.8.5", @@ -3300,7 +3303,7 @@ dependencies = [ "fuel-storage", "fuel-tx", "fuel-types", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "itertools 0.10.5", "libm", "paste", @@ -3628,9 +3631,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash 0.8.3", "allocator-api2", @@ -3838,7 +3841,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.13", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -3940,9 +3943,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9465340214b296cd17a0009acdb890d6160010b8adf8f78a00d0d7ab270f79f" +checksum = "bbb892e5777fe09e16f3d44de7802f4daa7267ecbe8c466f19d94e25bb0c303e" dependencies = [ "async-io", "core-foundation", @@ -4019,7 +4022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", ] [[package]] @@ -4095,7 +4098,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.4", + "socket2 0.5.5", "widestring", "windows-sys 0.48.0", "winreg", @@ -4114,7 +4117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix 0.38.18", + "rustix 0.38.20", "windows-sys 0.48.0", ] @@ -4466,9 +4469,9 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bf6e730ec5e7022958da53ffb03b326e681b7316939012ae9b3c7449a812d4" +checksum = "cdd6317441f361babc74c2989c6484eb0726045399b6648de039e1805ea96972" dependencies = [ "asn1_der", "bs58 0.5.0", @@ -4477,7 +4480,6 @@ dependencies = [ "log", "multihash 0.19.1", "quick-protobuf", - "rand 0.8.5", "sha2 0.10.8", "thiserror", "zeroize", @@ -4525,7 +4527,7 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "trust-dns-proto", "void", @@ -4694,7 +4696,7 @@ dependencies = [ "libc", "libp2p-core 0.38.0", "log", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", ] @@ -4887,9 +4889,9 @@ checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -5305,7 +5307,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "libc", ] @@ -5488,9 +5490,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "os_str_bytes" -version = "6.5.1" +version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "overload" @@ -5560,9 +5562,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -5582,7 +5584,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", + "parking_lot_core 0.9.9", ] [[package]] @@ -5601,13 +5603,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -5930,6 +5932,12 @@ dependencies = [ "serde", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "pprof" version = "0.12.1" @@ -6144,7 +6152,7 @@ checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.0", + "bitflags 2.4.1", "lazy_static", "num-traits", "rand 0.8.5", @@ -6484,6 +6492,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -6497,14 +6514,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.0" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.1", - "regex-syntax 0.8.1", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -6518,13 +6535,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.1", + "regex-syntax 0.8.2", ] [[package]] @@ -6541,9 +6558,9 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "regex-syntax" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" @@ -6635,9 +6652,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.3" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", "getrandom 0.2.10", @@ -6797,9 +6814,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.24" +version = "0.37.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4279d76516df406a8bd37e7dff53fd37d1a093f997a3c34a5c21658c126db06d" +checksum = "84f3f8f960ed3b5a59055428714943298bf3fa2d4a1d53135084e0544829d995" dependencies = [ "bitflags 1.3.2", "errno", @@ -6811,11 +6828,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.18" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys 0.4.10", @@ -6967,9 +6984,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ "cfg-if", "derive_more", @@ -6979,9 +6996,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7176,18 +7193,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", @@ -7421,9 +7438,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -7431,9 +7448,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -7573,7 +7590,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros 0.25.2", + "strum_macros 0.25.3", ] [[package]] @@ -7591,9 +7608,9 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", @@ -7665,7 +7682,7 @@ dependencies = [ "debugid", "memmap2", "stable_deref_trait", - "uuid 1.4.1", + "uuid 1.5.0", ] [[package]] @@ -7776,7 +7793,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix 0.38.18", + "rustix 0.38.20", "windows-sys 0.48.0", ] @@ -7848,18 +7865,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -7907,12 +7924,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -7981,7 +7999,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite 0.2.13", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -8174,11 +8192,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite 0.2.13", "tracing-attributes", @@ -8198,9 +8215,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -8209,9 +8226,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -8289,7 +8306,7 @@ dependencies = [ "lazy_static", "rand 0.8.5", "smallvec", - "socket2 0.4.9", + "socket2 0.4.10", "thiserror", "tinyvec", "tokio", @@ -8513,9 +8530,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom 0.2.10", ] @@ -8706,7 +8723,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.3", + "ring 0.17.5", "untrusted 0.9.0", ] @@ -8848,7 +8865,7 @@ dependencies = [ "tokio", "turn", "url", - "uuid 1.4.1", + "uuid 1.5.0", "waitgroup", "webrtc-mdns", "webrtc-util", @@ -8861,7 +8878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" dependencies = [ "log", - "socket2 0.4.9", + "socket2 0.4.10", "thiserror", "tokio", "webrtc-util", @@ -8951,7 +8968,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.18", + "rustix 0.38.20", ] [[package]] @@ -8993,15 +9010,21 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.34.0" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows_aarch64_msvc 0.34.0", - "windows_i686_gnu 0.34.0", - "windows_i686_msvc 0.34.0", - "windows_x86_64_gnu 0.34.0", - "windows_x86_64_msvc 0.34.0", + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -9064,12 +9087,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" -[[package]] -name = "windows_aarch64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -9082,12 +9099,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_i686_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -9100,12 +9111,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" -[[package]] -name = "windows_i686_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -9118,12 +9123,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_x86_64_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -9148,12 +9147,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" -[[package]] -name = "windows_x86_64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -9168,9 +9161,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.16" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" dependencies = [ "memchr", ] From 2a452909ecfb3f7a6b7d4d01a5d14f3e408c6d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaya=20G=C3=B6kalp?= Date: Mon, 23 Oct 2023 13:31:27 +0300 Subject: [PATCH 2/7] ci: add beta releasy to fuel-core (#1400) ## Description This adds releasy-beta to fuel-core which will ping fuels-rs repo every time there is a new commit to the master of this repo. Once we ensure everything works nicely we will start working with all repos with the same procedure. --------- Co-authored-by: Green Baneling --- .../workflows/releasy-dependency-commits.yml | 20 +++++++++++++++++++ .github/workflows/repo-plan.toml | 14 +++++++++++++ CHANGELOG.md | 3 ++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/releasy-dependency-commits.yml create mode 100644 .github/workflows/repo-plan.toml diff --git a/.github/workflows/releasy-dependency-commits.yml b/.github/workflows/releasy-dependency-commits.yml new file mode 100644 index 00000000000..2912a72990f --- /dev/null +++ b/.github/workflows/releasy-dependency-commits.yml @@ -0,0 +1,20 @@ +name: Notify downstream repos + +on: + push: + branches: + - main + +jobs: + + notify: + runs-on: ubuntu-latest + env: + DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - run: | + git clone https://github.com/FuelLabs/releasy && cd releasy && git checkout kayagokalp/releasy-handle && cd .. + cargo install --path ./releasy/releasy-emit + releasy-emit --event new-commit-to-dependency --path ./.github/workflows/repo-plan.toml --event-commit-hash ${GITHUB_SHA} + name: Install and run releasy diff --git a/.github/workflows/repo-plan.toml b/.github/workflows/repo-plan.toml new file mode 100644 index 00000000000..6d915f5c147 --- /dev/null +++ b/.github/workflows/repo-plan.toml @@ -0,0 +1,14 @@ +[current-repo] +name = "fuel-core" +owner = "FuelLabs" + +[repo.fuels-rs.details] +name = "fuels-rs" +owner = "FuelLabs" + +[repo.fuel-core.details] +name = "fuel-core" +owner = "FuelLabs" + +[repo.fuels-rs] +dependencies = ["fuel-core"] diff --git a/CHANGELOG.md b/CHANGELOG.md index 85a31d08256..85f2d561cb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ Description of the upcoming release here. - [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL for GraphQL requests. - [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions. -- [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility +- [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility. +- [#1400](https://github.com/FuelLabs/fuel-core/pull/1400): Add releasy beta to fuel-core so that new commits to fuel-core master triggers fuels-rs. - [#1371](https://github.com/FuelLabs/fuel-core/pull/1371): Add new client function for querying the `MessageStatus` for a specific message (by `Nonce`) - [#1356](https://github.com/FuelLabs/fuel-core/pull/1356): Add peer reputation reporting to heartbeat code - [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Added new metrics related to block importing, such as tps, sync delays etc From daafeb3418eae4788d0f6f94280eb5065557f7a5 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Mon, 23 Oct 2023 03:43:20 -0700 Subject: [PATCH 3/7] setup a cron job to test beta-4 continuously (#1436) fixes: #1420 Uses a recurring github action to run e2e tests against the beta-4 environment. Successful run demonstrated here: https://github.com/FuelLabs/fuel-core/actions/runs/6593133202/job/17915110825?pr=1436 --- .github/workflows/e2e-test-beta4-dev.yml | 19 +++++++++++++++++++ .../workflows/e2e_config/beta-4.toml.template | 9 +++++++++ CHANGELOG.md | 1 + 3 files changed, 29 insertions(+) create mode 100644 .github/workflows/e2e-test-beta4-dev.yml create mode 100644 .github/workflows/e2e_config/beta-4.toml.template diff --git a/.github/workflows/e2e-test-beta4-dev.yml b/.github/workflows/e2e-test-beta4-dev.yml new file mode 100644 index 00000000000..739d0ed4d51 --- /dev/null +++ b/.github/workflows/e2e-test-beta4-dev.yml @@ -0,0 +1,19 @@ +name: E2E Test Beta-4 + +on: + schedule: + - cron: '* * * * *' + +jobs: + e2e_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup e2e config secrets + run: | + export e2e_wallet_a="${{ secrets.E2E_WALLET_A }}" + export e2e_wallet_b="${{ secrets.E2E_WALLET_B }}" + envsubst < ${{ github.workspace }}/.github/workflows/e2e_config/beta-4.toml.template > ${{ github.workspace }}/.github/workflows/e2e_config/beta-4.toml + + - name: Run e2e tests with docker + run: docker run -v ${{ github.workspace }}/.github/workflows/e2e_config:/etc/e2e_config -e FUEL_CORE_E2E_CONFIG='/etc/e2e_config/beta-4.toml' ghcr.io/fuellabs/fuel-core-e2e-client:v0.20.7 ./fuel-core-e2e-client -- alice diff --git a/.github/workflows/e2e_config/beta-4.toml.template b/.github/workflows/e2e_config/beta-4.toml.template new file mode 100644 index 00000000000..e827d4e51a4 --- /dev/null +++ b/.github/workflows/e2e_config/beta-4.toml.template @@ -0,0 +1,9 @@ +endpoint = "https://beta-4.fuel.network/graphql" +wallet_sync_timeout = "10s" +full_test = false + +[wallet_a] +secret = "${e2e_wallet_a}" + +[wallet_b] +secret = "${e2e_wallet_b}" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 85f2d561cb6..6ec51d0b33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Description of the upcoming release here. ### Added +- [#1436](https://github.com/FuelLabs/fuel-core/pull/1436): Add a github action to continuously test beta-4 - [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL for GraphQL requests. - [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions. - [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility. From 77bb5bfaa452c87e80cc63529abdeed2a3692fc5 Mon Sep 17 00:00:00 2001 From: Brandon Vrooman Date: Mon, 23 Oct 2023 07:03:41 -0400 Subject: [PATCH 4/7] chore: Use MerkleRootCalculator when only BMT root is needed (#1439) Related issues: - https://github.com/FuelLabs/fuel-vm/issues/610 This PR updates all relevant usages of `binary::in_memory::MerkleTree` inside `fuel-core` to use `binary::root_calculator::MerkleRootCalculator` for calculating BMT roots. --------- Co-authored-by: xgreenx --- CHANGELOG.md | 1 + crates/fuel-core/src/database/storage.rs | 2 +- crates/services/sync/src/import/test_helpers.rs | 3 ++- crates/types/src/blockchain/header.rs | 6 ++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ec51d0b33a..ee84575edfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Description of the upcoming release here. ### Changed +- [#1439](https://github.com/FuelLabs/fuel-core/pull/1439): Reduced memory BMT consumption during creation of the header. - [#1434](https://github.com/FuelLabs/fuel-core/pull/1434): Continue gossiping transactions to reserved peers regardless of gossiping reputation score. - [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): The Relayer now queries Ethereum for its latest finalized block instead of using a configurable "finalization period" to presume finality. - [#1397](https://github.com/FuelLabs/fuel-core/pull/1397): Improved keygen. Created a crate to be included from forc plugins and upgraded internal library to drop requirement of protoc to build diff --git a/crates/fuel-core/src/database/storage.rs b/crates/fuel-core/src/database/storage.rs index 6ca02fb40b0..0dba6ceb4ea 100644 --- a/crates/fuel-core/src/database/storage.rs +++ b/crates/fuel-core/src/database/storage.rs @@ -45,7 +45,7 @@ pub struct DenseMerkleMetadata { impl Default for DenseMerkleMetadata { fn default() -> Self { - let empty_merkle_tree = binary::in_memory::MerkleTree::new(); + let empty_merkle_tree = binary::root_calculator::MerkleRootCalculator::new(); Self { root: empty_merkle_tree.root(), version: 0, diff --git a/crates/services/sync/src/import/test_helpers.rs b/crates/services/sync/src/import/test_helpers.rs index 1329ec82d9f..125c0afd797 100644 --- a/crates/services/sync/src/import/test_helpers.rs +++ b/crates/services/sync/src/import/test_helpers.rs @@ -43,7 +43,8 @@ pub fn empty_header>(i: I) -> SealedBlockHeader { let height = i.into(); header.consensus.height = height; let transaction_tree = - fuel_core_types::fuel_merkle::binary::in_memory::MerkleTree::new(); + fuel_core_types::fuel_merkle::binary::root_calculator::MerkleRootCalculator::new( + ); header.application.generated.transactions_root = transaction_tree.root().into(); let consensus = Consensus::default(); diff --git a/crates/types/src/blockchain/header.rs b/crates/types/src/blockchain/header.rs index fb5e3a86f40..c27dbde55f5 100644 --- a/crates/types/src/blockchain/header.rs +++ b/crates/types/src/blockchain/header.rs @@ -244,7 +244,8 @@ impl PartialBlockHeader { let transactions_root = generate_txns_root(transactions); // Generate the message merkle root. - let mut message_tree = fuel_merkle::binary::in_memory::MerkleTree::new(); + let mut message_tree = + fuel_merkle::binary::root_calculator::MerkleRootCalculator::new(); for id in message_ids { message_tree.push(id.as_ref()); } @@ -285,7 +286,8 @@ fn generate_txns_root(transactions: &[Transaction]) -> Bytes32 { // Remove `clone` when we can use `to_bytes` without mutability. let transaction_ids = transactions.iter().map(|tx| tx.clone().to_bytes()); // Generate the transaction merkle root. - let mut transaction_tree = fuel_merkle::binary::in_memory::MerkleTree::new(); + let mut transaction_tree = + fuel_merkle::binary::root_calculator::MerkleRootCalculator::new(); for id in transaction_ids { transaction_tree.push(id.as_ref()); } From fb22c6675c1d6c28a3f02a67846ec52a47878762 Mon Sep 17 00:00:00 2001 From: Mitchell Turner Date: Mon, 23 Oct 2023 05:53:37 -0700 Subject: [PATCH 5/7] Crypto op code sanity checks (#1430) https://github.com/FuelLabs/fuel-core/issues/1386 Results: ``` block target estimation/crypto/eck1 opcode time: [4.8418 ms 4.8650 ms 4.8882 ms] block target estimation/crypto/ecr1 opcode time: [18.634 ms 18.791 ms 18.992 ms] block target estimation/crypto/ed19 opcode time: [2.6451 ms 2.6698 ms 2.6963 ms] ``` s256: ``` block target estimation/crypto/s256 opcode 1 time: [3.1244 ms 3.1409 ms 3.1575 ms] Found 6 outliers among 100 measurements (6.00%) 3 (3.00%) low mild 3 (3.00%) high mild block target estimation/crypto/s256 opcode 10 time: [3.1082 ms 3.1299 ms 3.1515 ms] Found 2 outliers among 100 measurements (2.00%) 1 (1.00%) low mild 1 (1.00%) high severe block target estimation/crypto/s256 opcode 100 time: [4.1553 ms 4.1781 ms 4.2026 ms] block target estimation/crypto/s256 opcode 1000 time: [8.3133 ms 8.3554 ms 8.3990 ms] block target estimation/crypto/s256 opcode 10000 time: [10.562 ms 10.611 ms 10.661 ms] block target estimation/crypto/s256 opcode 19753 time: [10.794 ms 10.847 ms 10.902 ms] block target estimation/crypto/s256 opcode 29629 time: [10.694 ms 10.773 ms 10.853 ms] block target estimation/crypto/s256 opcode 44444 time: [10.724 ms 10.795 ms 10.870 ms] block target estimation/crypto/s256 opcode 66666 time: [10.745 ms 10.810 ms 10.879 ms] block target estimation/crypto/s256 opcode 100000 time: [10.551 ms 10.608 ms 10.665 ms] ``` k256: ``` block target estimation/crypto/k256 opcode 1 time: [4.0653 ms 4.0881 ms 4.1123 ms] block target estimation/crypto/k256 opcode 10 time: [4.0803 ms 4.1121 ms 4.1500 ms] block target estimation/crypto/k256 opcode 100 time: [3.9216 ms 3.9472 ms 3.9730 ms] block target estimation/crypto/k256 opcode 1000 time: [19.240 ms 19.610 ms 20.102 ms] block target estimation/crypto/k256 opcode 10000 time: [46.020 ms 46.250 ms 46.491 ms] Benchmarking block target estimation/crypto/k256 opcode 19753: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.0s, or reduce sample count to 90. block target estimation/crypto/k256 opcode 19753 time: [51.484 ms 51.795 ms 52.121 ms] Benchmarking block target estimation/crypto/k256 opcode 29629: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.1s, or reduce sample count to 90. block target estimation/crypto/k256 opcode 29629 time: [53.408 ms 54.647 ms 56.676 ms] Benchmarking block target estimation/crypto/k256 opcode 44444: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.2s, or reduce sample count to 90. block target estimation/crypto/k256 opcode 44444 time: [54.142 ms 54.426 ms 54.716 ms] Benchmarking block target estimation/crypto/k256 opcode 66666: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.3s, or reduce sample count to 90. block target estimation/crypto/k256 opcode 66666 time: [55.453 ms 55.730 ms 56.009 ms] Benchmarking block target estimation/crypto/k256 opcode 100000: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.4s, or reduce sample count to 90. block target estimation/crypto/k256 opcode 100000 time: [54.617 ms 55.698 ms 57.215 ms] ``` --------- Co-authored-by: Green Baneling --- CHANGELOG.md | 3 +- benches/benches/block_target_gas.rs | 88 +-------- .../benches/block_target_gas_set/crypto.rs | 171 ++++++++++++++++++ benches/benches/block_target_gas_set/mod.rs | 2 + benches/benches/utils.rs | 12 ++ benches/benches/vm_set/crypto.rs | 2 +- benches/benches/vm_set/mem.rs | 3 +- benches/benches/vm_set/mod.rs | 12 -- 8 files changed, 196 insertions(+), 97 deletions(-) create mode 100644 benches/benches/block_target_gas_set/crypto.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index ee84575edfe..3a5abb65272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ Description of the upcoming release here. ### Added -- [#1436](https://github.com/FuelLabs/fuel-core/pull/1436): Add a github action to continuously test beta-4 +- [#1436](https://github.com/FuelLabs/fuel-core/pull/1436): Add a github action to continuously test beta-4. +- [#1430](https://github.com/FuelLabs/fuel-core/pull/1430): Add "sanity" benchmarks for crypto opcodes. - [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL for GraphQL requests. - [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions. - [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility. diff --git a/benches/benches/block_target_gas.rs b/benches/benches/block_target_gas.rs index 384563ab06c..e2de497ec83 100644 --- a/benches/benches/block_target_gas.rs +++ b/benches/benches/block_target_gas.rs @@ -1,4 +1,7 @@ -use block_target_gas_set::alu::run_alu; +use block_target_gas_set::{ + alu::run_alu, + crypto::run_crypto, +}; use criterion::{ criterion_group, criterion_main, @@ -170,89 +173,10 @@ fn block_target_gas(c: &mut Criterion) { vec![], ); - let message = fuel_core_types::fuel_crypto::Message::new(b"foo"); - let ecr1_secret = p256::ecdsa::SigningKey::random(&mut rand::thread_rng()); - let ecr1_signature = secp256r1::sign_prehashed(&ecr1_secret, &message) - .expect("Failed to sign with secp256r1"); - - run( - "Script with ecr1 opcode and infinite loop", - &mut group, - [ - op::gtf_args(0x20, 0x00, GTFArgs::ScriptData), - op::addi( - 0x21, - 0x20, - ecr1_signature.as_ref().len().try_into().unwrap(), - ), - op::addi(0x22, 0x21, message.as_ref().len().try_into().unwrap()), - op::movi(0x10, PublicKey::LEN.try_into().unwrap()), - op::aloc(0x10), - op::move_(0x11, RegId::HP), - op::ecr1(0x11, 0x20, 0x21), - op::jmpb(RegId::ZERO, 0), - ] - .to_vec(), - ecr1_signature - .as_ref() - .iter() - .chain(message.as_ref()) - .copied() - .collect(), - ); - - let ed19_keypair = - ed25519_dalek::Keypair::generate(&mut ed25519_dalek_old_rand::rngs::OsRng {}); - let ed19_signature = ed19_keypair.sign(&*message); - - run( - "Script with ed19 opcode and infinite loop", - &mut group, - [ - op::gtf_args(0x20, 0x00, GTFArgs::ScriptData), - op::addi( - 0x21, - 0x20, - ed19_keypair.public.as_ref().len().try_into().unwrap(), - ), - op::addi( - 0x22, - 0x21, - ed19_signature.as_ref().len().try_into().unwrap(), - ), - op::addi(0x22, 0x21, message.as_ref().len().try_into().unwrap()), - op::movi(0x10, ed25519_dalek::PUBLIC_KEY_LENGTH.try_into().unwrap()), - op::aloc(0x10), - op::move_(0x11, RegId::HP), - op::ed19(0x20, 0x21, 0x22), - op::jmpb(RegId::ZERO, 0), - ] - .to_vec(), - ed19_keypair - .public - .as_ref() - .iter() - .chain(ed19_signature.as_ref()) - .chain(message.as_ref()) - .copied() - .collect(), - ); - - // The test is supper long because we don't use `DependentCost` for k256 opcode - // run( - // "Script with k256 opcode and infinite loop", - // &mut group, - // [ - // op::movi(0x10, 1 << 18 - 1), - // op::aloc(0x10), - // op::k256(RegId::HP, RegId::ZERO, 0x10), - // op::jmpb(RegId::ZERO, 0), - // ] - // .to_vec(), - // ); - run_alu(&mut group); + run_crypto(&mut group); + group.finish(); } diff --git a/benches/benches/block_target_gas_set/crypto.rs b/benches/benches/block_target_gas_set/crypto.rs new file mode 100644 index 00000000000..c94598e0ee0 --- /dev/null +++ b/benches/benches/block_target_gas_set/crypto.rs @@ -0,0 +1,171 @@ +use crate::{ + utils::generate_linear_costs, + *, +}; +use rand::{ + rngs::StdRng, + SeedableRng, +}; + +// ECK1: Secp251k1 signature recovery +// ECR1: Secp256r1 signature recovery +// ED19: edDSA curve25519 verification +// K256: keccak-256 +// S256: SHA-2-256 +pub fn run_crypto(group: &mut BenchmarkGroup) { + let rng = &mut StdRng::seed_from_u64(2322u64); + + let message = Message::new(b"foo"); + + let eck1_secret = SecretKey::random(rng); + let eck1_signature = Signature::sign(&eck1_secret, &message); + run( + "crypto/eck1 opcode valid", + group, + [ + op::gtf_args(0x20, 0x00, GTFArgs::ScriptData), + op::addi( + 0x21, + 0x20, + eck1_signature.as_ref().len().try_into().unwrap(), + ), + op::movi(0x10, PublicKey::LEN.try_into().unwrap()), + op::aloc(0x10), + op::eck1(RegId::HP, 0x20, 0x21), + op::jmpb(RegId::ZERO, 0), + ] + .to_vec(), + eck1_signature + .iter() + .chain(message.iter()) + .copied() + .collect(), + ); + + let wrong_message = Message::new(b"bar"); + + run( + "crypto/eck1 opcode invalid", + group, + [ + op::gtf_args(0x20, 0x00, GTFArgs::ScriptData), + op::addi( + 0x21, + 0x20, + eck1_signature.as_ref().len().try_into().unwrap(), + ), + op::movi(0x10, PublicKey::LEN.try_into().unwrap()), + op::aloc(0x10), + op::eck1(RegId::HP, 0x20, 0x21), + op::jmpb(RegId::ZERO, 0), + ] + .to_vec(), + eck1_signature + .iter() + .chain(wrong_message.iter()) + .copied() + .collect(), + ); + + let message = fuel_core_types::fuel_crypto::Message::new(b"foo"); + let ecr1_secret = p256::ecdsa::SigningKey::random(&mut rand::thread_rng()); + let ecr1_signature = secp256r1::sign_prehashed(&ecr1_secret, &message) + .expect("Failed to sign with secp256r1"); + + run( + "crypto/ecr1 opcode", + group, + [ + op::gtf_args(0x20, 0x00, GTFArgs::ScriptData), + op::addi( + 0x21, + 0x20, + ecr1_signature.as_ref().len().try_into().unwrap(), + ), + op::movi(0x10, PublicKey::LEN.try_into().unwrap()), + op::aloc(0x10), + op::move_(0x11, RegId::HP), + op::ecr1(0x11, 0x20, 0x21), + op::jmpb(RegId::ZERO, 0), + ] + .to_vec(), + ecr1_signature + .as_ref() + .iter() + .chain(message.as_ref()) + .copied() + .collect(), + ); + + let message = fuel_core_types::fuel_crypto::Message::new(b"foo"); + let ed19_keypair = + ed25519_dalek::Keypair::generate(&mut ed25519_dalek_old_rand::rngs::OsRng {}); + let ed19_signature = ed19_keypair.sign(&*message); + + run( + "crypto/ed19 opcode", + group, + [ + op::gtf_args(0x20, 0x00, GTFArgs::ScriptData), + op::addi( + 0x21, + 0x20, + ed19_keypair.public.as_ref().len().try_into().unwrap(), + ), + op::addi( + 0x22, + 0x21, + ed19_signature.as_ref().len().try_into().unwrap(), + ), + op::addi(0x22, 0x21, message.as_ref().len().try_into().unwrap()), + op::movi(0x10, ed25519_dalek::PUBLIC_KEY_LENGTH.try_into().unwrap()), + op::aloc(0x10), + op::move_(0x11, RegId::HP), + op::ed19(0x20, 0x21, 0x22), + op::jmpb(RegId::ZERO, 0), + ] + .to_vec(), + ed19_keypair + .public + .as_ref() + .iter() + .chain(ed19_signature.as_ref()) + .chain(message.as_ref()) + .copied() + .collect(), + ); + + for i in generate_linear_costs() { + let id = format!("crypto/s256 opcode {:?}", i); + run( + &id, + group, + [ + op::movi(0x11, 32), + op::aloc(0x11), + op::movi(0x10, i), + op::s256(RegId::HP, RegId::ZERO, 0x10), + op::jmpb(RegId::ZERO, 0), + ] + .to_vec(), + vec![], + ) + } + + for i in generate_linear_costs() { + let id = format!("crypto/k256 opcode {:?}", i); + run( + &id, + group, + [ + op::movi(0x11, 32), + op::aloc(0x11), + op::movi(0x10, i), + op::k256(RegId::HP, RegId::ZERO, 0x10), + op::jmpb(RegId::ZERO, 0), + ] + .to_vec(), + vec![], + ) + } +} diff --git a/benches/benches/block_target_gas_set/mod.rs b/benches/benches/block_target_gas_set/mod.rs index 0040cfb0d73..cae18be40ce 100644 --- a/benches/benches/block_target_gas_set/mod.rs +++ b/benches/benches/block_target_gas_set/mod.rs @@ -1 +1,3 @@ pub mod alu; + +pub mod crypto; diff --git a/benches/benches/utils.rs b/benches/benches/utils.rs index 7353dd197b5..3ebc5321b04 100644 --- a/benches/benches/utils.rs +++ b/benches/benches/utils.rs @@ -1,3 +1,4 @@ +use core::iter::successors; use ethnum::U256; use fuel_core_types::fuel_asm::{ op, @@ -25,3 +26,14 @@ pub fn make_u128(reg: u8, v: u128) -> Vec { pub fn make_u256(reg: u8, v: U256) -> Vec { aloc_bytearray(reg, v.to_be_bytes()) } + +pub fn generate_linear_costs() -> Vec { + let mut linear = vec![1, 10, 100, 1000, 10_000]; + let mut l = successors(Some(100_000.0f64), |n| Some(n / 1.5)) + .take(5) + .map(|f| f as u32) + .collect::>(); + l.sort_unstable(); + linear.extend(l); + linear +} diff --git a/benches/benches/vm_set/crypto.rs b/benches/benches/vm_set/crypto.rs index 96618feec5e..19c59a61a35 100644 --- a/benches/benches/vm_set/crypto.rs +++ b/benches/benches/vm_set/crypto.rs @@ -73,7 +73,7 @@ pub fn run(c: &mut Criterion) { ), ); - let linear = super::generate_linear_costs(); + let linear = super::utils::generate_linear_costs(); let mut bench_k256 = c.benchmark_group("k256"); for i in &linear { diff --git a/benches/benches/vm_set/mem.rs b/benches/benches/vm_set/mem.rs index a545c3c4c5b..0b4c6b713cb 100644 --- a/benches/benches/vm_set/mem.rs +++ b/benches/benches/vm_set/mem.rs @@ -1,5 +1,6 @@ use super::run_group_ref; +use crate::utils::generate_linear_costs; use criterion::{ Criterion, Throughput, @@ -53,7 +54,7 @@ pub fn run(c: &mut Criterion) { ]), ); - let linear = super::generate_linear_costs(); + let linear = generate_linear_costs(); run_group_ref( &mut c.benchmark_group("cfei"), diff --git a/benches/benches/vm_set/mod.rs b/benches/benches/vm_set/mod.rs index a0bd339fb06..71753e8cb16 100644 --- a/benches/benches/vm_set/mod.rs +++ b/benches/benches/vm_set/mod.rs @@ -7,15 +7,3 @@ pub mod mem; pub use super::run_group_ref; use super::utils; -use core::iter::successors; - -fn generate_linear_costs() -> Vec { - let mut linear = vec![1, 10, 100, 1000, 10_000]; - let mut l = successors(Some(100_000.0f64), |n| Some(n / 1.5)) - .take(5) - .map(|f| f as u32) - .collect::>(); - l.sort_unstable(); - linear.extend(l); - linear -} From a47486696b4b776cf1a3201862621e104b836276 Mon Sep 17 00:00:00 2001 From: Hannes Karppila Date: Mon, 23 Oct 2023 17:08:41 +0300 Subject: [PATCH 6/7] Update gas benchmarks for some storage opcodes (#1408) Closes #1239. Closes #1255. --------- Co-authored-by: Green Baneling Co-authored-by: Brandon Vrooman --- CHANGELOG.md | 1 + benches/benches/vm_set/blockchain.rs | 258 +++++++++++-------- benches/src/lib.rs | 22 +- crates/fuel-core/src/database.rs | 24 +- crates/fuel-core/src/database/vm_database.rs | 7 + crates/fuel-core/src/state/rocks_db.rs | 5 + 6 files changed, 197 insertions(+), 120 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a5abb65272..379fdbc57f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ Description of the upcoming release here. - [#1392](https://github.com/FuelLabs/fuel-core/pull/1392): Fixed an overflow in `message_proof`. - [#1393](https://github.com/FuelLabs/fuel-core/pull/1393): Increase heartbeat timeout from `2` to `60` seconds, as suggested in [this issue](https://github.com/FuelLabs/fuel-core/issues/1330). - [#1395](https://github.com/FuelLabs/fuel-core/pull/1395): Add DependentCost benchmarks for `k256`, `s256` and `mcpi` instructions. +- [#1408](https://github.com/FuelLabs/fuel-core/pull/1408): Update gas benchmarks for storage opcodes to use a pre-populated database to get more accurate worst-case costs. #### Breaking - [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): All subscriptions and requests have a TTL now. So each subscription lifecycle is limited in time. If the subscription is closed because of TTL, it means that you subscribed after your transaction had been dropped by the network. diff --git a/benches/benches/vm_set/blockchain.rs b/benches/benches/vm_set/blockchain.rs index 5fb5b59da9f..f0cb9d63658 100644 --- a/benches/benches/vm_set/blockchain.rs +++ b/benches/benches/vm_set/blockchain.rs @@ -1,4 +1,9 @@ -use std::iter::successors; +use std::{ + env, + iter::successors, + path::PathBuf, + sync::Arc, +}; use super::run_group_ref; @@ -6,9 +11,11 @@ use criterion::{ Criterion, Throughput, }; -use fuel_core::database::vm_database::VmDatabase; +use fuel_core::{ + database::vm_database::VmDatabase, + state::rocks_db::RocksDb, +}; use fuel_core_benches::*; -use fuel_core_storage::ContractsAssetsStorage; use fuel_core_types::{ fuel_asm::{ op, @@ -16,15 +23,13 @@ use fuel_core_types::{ RegId, }, fuel_tx::{ + ContractIdExt, Input, Output, Word, }, fuel_types::*, - fuel_vm::{ - consts::*, - InterpreterStorage, - }, + fuel_vm::consts::*, }; use rand::{ rngs::StdRng, @@ -32,6 +37,87 @@ use rand::{ SeedableRng, }; +/// Reimplementation of `tempdir::TempDir` that allows creating a new +/// instance without actually creating a new directory on the filesystem. +/// This is needed since rocksdb requires empty directory for checkpoints. +pub struct ShallowTempDir { + path: PathBuf, +} +impl ShallowTempDir { + pub fn new() -> Self { + let mut rng = rand::thread_rng(); + let mut path = env::temp_dir(); + path.push(format!("fuel-core-bench-rocksdb-{}", rng.next_u64())); + Self { path } + } +} +impl Drop for ShallowTempDir { + fn drop(&mut self) { + // Ignore errors + let _ = std::fs::remove_dir_all(&self.path); + } +} + +pub struct BenchDb { + db: RocksDb, + /// Used for RAII cleanup. Contents of this directory are deleted on drop. + _tmp_dir: ShallowTempDir, +} + +impl BenchDb { + const STATE_SIZE: u64 = 10_000_000; + + fn new(contract: &ContractId) -> anyhow::Result { + let tmp_dir = ShallowTempDir::new(); + + let db = Arc::new(RocksDb::default_open(&tmp_dir.path, None).unwrap()); + + let mut database = Database::new(db.clone()); + database.init_contract_state( + contract, + (0..Self::STATE_SIZE).map(|k| { + let mut key = Bytes32::zeroed(); + key.as_mut()[..8].copy_from_slice(&k.to_be_bytes()); + (key, key) + }), + )?; + database.init_contract_balances( + &ContractId::zeroed(), + (0..Self::STATE_SIZE).map(|k| { + let key = k / 2; + let mut sub_id = Bytes32::zeroed(); + sub_id.as_mut()[..8].copy_from_slice(&key.to_be_bytes()); + + let asset = if k % 2 == 0 { + VmBench::CONTRACT.asset_id(&sub_id) + } else { + AssetId::new(*sub_id) + }; + (asset, key + 1_000) + }), + )?; + + drop(database); // Drops one reference to the db wrapper, but we still hold the last one + Ok(Self { + _tmp_dir: tmp_dir, + db: Arc::into_inner(db).expect("All other references must be dropped"), + }) + } + + /// Create a new separate database instance using a rocksdb checkpoint + fn checkpoint(&self) -> VmDatabase { + let tmp_dir = ShallowTempDir::new(); + self.db + .checkpoint(&tmp_dir.path) + .expect("Unable to create checkpoint"); + let db = RocksDb::default_open(&tmp_dir.path, None).unwrap(); + let database = Database::new(Arc::new(db)).with_drop(Box::new(move || { + drop(tmp_dir); + })); + VmDatabase::default_from_database(database) + } +} + pub fn run(c: &mut Criterion) { let rng = &mut StdRng::seed_from_u64(2322u64); @@ -42,9 +128,12 @@ pub fn run(c: &mut Criterion) { .collect::>(); l.sort_unstable(); linear.extend(l); + let asset: AssetId = rng.gen(); let contract: ContractId = rng.gen(); + let db = BenchDb::new(&contract).expect("Unable to fill contract storage"); + run_group_ref( &mut c.benchmark_group("bal"), "bal", @@ -54,45 +143,24 @@ pub fn run(c: &mut Criterion) { op::gtf_args(0x10, 0x00, GTFArgs::ScriptData), op::addi(0x11, 0x10, asset.len().try_into().unwrap()), ]) - .with_dummy_contract(contract) - .with_prepare_db(move |mut db| { - let mut asset_inc = AssetId::zeroed(); - - asset_inc.as_mut()[..8].copy_from_slice(&1_u64.to_be_bytes()); - - db.merkle_contract_asset_id_balance_insert(&contract, &asset_inc, 1)?; - - db.merkle_contract_asset_id_balance_insert(&contract, &asset, 100)?; - - Ok(db) - }), + .with_dummy_contract(contract), ); run_group_ref( &mut c.benchmark_group("sww"), "sww", - VmBench::contract(rng, op::sww(RegId::ZERO, 0x29, RegId::ONE)) - .expect("failed to prepare contract") - .with_prepare_db(move |mut db| { - let mut key = Bytes32::zeroed(); - - key.as_mut()[..8].copy_from_slice(&1_u64.to_be_bytes()); - - db.merkle_contract_state_insert(&contract, &key, &key)?; - - Ok(db) - }), + VmBench::contract_using_db( + rng, + db.checkpoint(), + op::sww(RegId::ZERO, 0x29, RegId::ONE), + ) + .expect("failed to prepare contract"), ); - { - let mut input = VmBench::contract(rng, op::srw(0x13, 0x14, 0x15)) - .expect("failed to prepare contract") - .with_prepare_db(move |mut db| { - let key = Bytes32::zeroed(); - db.merkle_contract_state_insert(&ContractId::zeroed(), &key, &key)?; - - Ok(db) - }); + { + let mut input = + VmBench::contract_using_db(rng, db.checkpoint(), op::srw(0x13, 0x14, 0x15)) + .expect("failed to prepare contract"); input.prepare_script.extend(vec![op::movi(0x15, 2000)]); run_group_ref(&mut c.benchmark_group("srw"), "srw", input); } @@ -110,21 +178,10 @@ pub fn run(c: &mut Criterion) { op::addi(0x11, 0x11, WORD_SIZE.try_into().unwrap()), op::movi(0x12, i as u32), ]; - let mut bench = VmBench::contract(rng, op::scwq(0x11, 0x29, 0x12)) - .expect("failed to prepare contract") - .with_post_call(post_call) - .with_prepare_db(move |mut db| { - let slots = (0u64..i).map(|key_number| { - let mut key = Bytes32::zeroed(); - key.as_mut()[..8].copy_from_slice(&key_number.to_be_bytes()); - (key, key) - }); - db.database_mut() - .init_contract_state(&contract, slots) - .unwrap(); - - Ok(db) - }); + let mut bench = + VmBench::contract_using_db(rng, db.checkpoint(), op::scwq(0x11, 0x29, 0x12)) + .expect("failed to prepare contract") + .with_post_call(post_call); bench.data.extend(data); scwq.throughput(Throughput::Bytes(i)); @@ -147,21 +204,13 @@ pub fn run(c: &mut Criterion) { op::addi(0x11, 0x11, WORD_SIZE.try_into().unwrap()), op::movi(0x12, i as u32), ]; - let mut bench = VmBench::contract(rng, op::swwq(0x10, 0x11, 0x20, 0x12)) - .expect("failed to prepare contract") - .with_post_call(post_call) - .with_prepare_db(move |mut db| { - let slots = (0u64..i).map(|key_number| { - let mut key = Bytes32::zeroed(); - key.as_mut()[..8].copy_from_slice(&key_number.to_be_bytes()); - (key, key) - }); - db.database_mut() - .init_contract_state(&contract, slots) - .unwrap(); - - Ok(db) - }); + let mut bench = VmBench::contract_using_db( + rng, + db.checkpoint(), + op::swwq(0x10, 0x11, 0x20, 0x12), + ) + .expect("failed to prepare contract") + .with_post_call(post_call); bench.data.extend(data); swwq.throughput(Throughput::Bytes(i)); @@ -203,6 +252,7 @@ pub fn run(c: &mut Criterion) { &mut call, format!("{i}"), VmBench::new(op::call(0x10, RegId::ZERO, 0x11, 0x12)) + .with_db(db.checkpoint()) .with_contract_code(code) .with_data(data) .with_prepare_script(prepare_script), @@ -346,15 +396,20 @@ pub fn run(c: &mut Criterion) { run_group_ref( &mut c.benchmark_group("mint"), "mint", - VmBench::contract(rng, op::mint(RegId::ZERO, RegId::ZERO)) - .expect("failed to prepare contract"), + VmBench::contract_using_db( + rng, + db.checkpoint(), + op::mint(RegId::ONE, RegId::ZERO), + ) + .expect("failed to prepare contract"), ); run_group_ref( &mut c.benchmark_group("burn"), "burn", - VmBench::contract(rng, op::mint(RegId::ZERO, RegId::ZERO)) - .expect("failed to prepare contract"), + VmBench::contract_using_db(rng, db.checkpoint(), op::burn(RegId::ONE, RegId::HP)) + .expect("failed to prepare contract") + .prepend_prepare_script(vec![op::movi(0x10, 32), op::aloc(0x10)]), ); run_group_ref( @@ -368,17 +423,9 @@ pub fn run(c: &mut Criterion) { ); { - let mut input = VmBench::contract(rng, op::tr(0x15, 0x14, 0x15)) - .expect("failed to prepare contract") - .with_prepare_db(move |mut db| { - db.merkle_contract_asset_id_balance_insert( - &ContractId::zeroed(), - &AssetId::zeroed(), - 200, - )?; - - Ok(db) - }); + let mut input = + VmBench::contract_using_db(rng, db.checkpoint(), op::tr(0x15, 0x14, 0x15)) + .expect("failed to prepare contract"); input .prepare_script .extend(vec![op::movi(0x15, 2000), op::movi(0x14, 100)]); @@ -386,17 +433,12 @@ pub fn run(c: &mut Criterion) { } { - let mut input = VmBench::contract(rng, op::tro(0x15, 0x16, 0x14, 0x15)) - .expect("failed to prepare contract") - .with_prepare_db(move |mut db| { - db.merkle_contract_asset_id_balance_insert( - &ContractId::zeroed(), - &AssetId::zeroed(), - 200, - )?; - - Ok(db) - }); + let mut input = VmBench::contract_using_db( + rng, + db.checkpoint(), + op::tro(RegId::ZERO, 0x15, 0x14, RegId::HP), + ) + .expect("failed to prepare contract"); let coin_output = Output::variable(Address::zeroed(), 100, AssetId::zeroed()); input.outputs.push(coin_output); let predicate = op::ret(RegId::ONE).to_bytes().to_vec(); @@ -416,10 +458,16 @@ pub fn run(c: &mut Criterion) { let index = input.outputs.len() - 1; input.prepare_script.extend(vec![ - op::movi(0x15, 2000), op::movi(0x14, 100), - op::movi(0x16, index.try_into().unwrap()), + op::movi(0x15, index.try_into().unwrap()), + op::movi(0x20, 32), + op::aloc(0x20), ]); + for (i, v) in (*AssetId::zeroed()).into_iter().enumerate() { + input.prepare_script.push(op::movi(0x20, v as u32)); + input.prepare_script.push(op::sb(RegId::HP, 0x20, i as u16)); + } + run_group_ref(&mut c.benchmark_group("tro"), "tro", input); } @@ -456,16 +504,12 @@ pub fn run(c: &mut Criterion) { let mut smo = c.benchmark_group("smo"); for i in linear.clone() { - let mut input = VmBench::contract(rng, op::smo(0x15, 0x16, 0x17, 0x18)) - .expect("failed to prepare contract"); - input.prepare_db = Some(Box::new(|mut db: VmDatabase| { - db.merkle_contract_asset_id_balance_insert( - &ContractId::default(), - &AssetId::default(), - Word::MAX, - )?; - Ok(db) - })); + let mut input = VmBench::contract_using_db( + rng, + db.checkpoint(), + op::smo(0x15, 0x16, 0x17, 0x18), + ) + .expect("failed to prepare contract"); input.post_call.extend(vec![ op::gtf_args(0x15, 0x00, GTFArgs::ScriptData), // Offset 32 + 8 + 8 + 32 diff --git a/benches/src/lib.rs b/benches/src/lib.rs index 72738c67af7..38b7c9c0382 100644 --- a/benches/src/lib.rs +++ b/benches/src/lib.rs @@ -136,6 +136,17 @@ impl VmBench { } pub fn contract(rng: &mut R, instruction: Instruction) -> anyhow::Result + where + R: Rng, + { + Self::contract_using_db(rng, new_db(), instruction) + } + + pub fn contract_using_db( + rng: &mut R, + mut db: VmDatabase, + instruction: Instruction, + ) -> anyhow::Result where R: Rng, { @@ -160,8 +171,6 @@ impl VmBench { let input = Input::contract(utxo_id, balance_root, state_root, tx_pointer, id); let output = Output::contract(0, rng.gen(), rng.gen()); - let mut db = new_db(); - db.deploy_contract_with_id(&salt, &[], &contract, &state_root, &id)?; let data = id @@ -226,11 +235,20 @@ impl VmBench { self } + /// Replaces the current prepare script with the given one. + /// Not that if you've constructed this instance with `contract` or `using_contract_db`, + /// then this will remove the script added by it. Use `extend_prepare_script` instead. pub fn with_prepare_script(mut self, prepare_script: Vec) -> Self { self.prepare_script = prepare_script; self } + /// Adds more instructions before the current prepare script. + pub fn prepend_prepare_script(mut self, prepare_script: Vec) -> Self { + self.prepare_script.extend(prepare_script); + self + } + pub fn with_post_call(mut self, post_call: Vec) -> Self { self.post_call = post_call; self diff --git a/crates/fuel-core/src/database.rs b/crates/fuel-core/src/database.rs index 7059d92ba46..5f70bd7ab38 100644 --- a/crates/fuel-core/src/database.rs +++ b/crates/fuel-core/src/database.rs @@ -151,22 +151,19 @@ pub struct Database { _drop: Arc, } -trait DropFnTrait: FnOnce() + Send + Sync {} -impl DropFnTrait for F where F: FnOnce() + Send + Sync {} -type DropFn = Box; - -impl fmt::Debug for DropFn { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "DropFn") - } -} - -#[derive(Debug, Default)] +type DropFn = Box; +#[derive(Default)] struct DropResources { // move resources into this closure to have them dropped when db drops drop: Option, } +impl fmt::Debug for DropResources { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "DropResources") + } +} + impl From for DropResources { fn from(closure: F) -> Self { Self { @@ -191,6 +188,11 @@ impl Database { } } + pub fn with_drop(mut self, drop: DropFn) -> Self { + self._drop = Arc::new(drop.into()); + self + } + #[cfg(feature = "rocksdb")] pub fn open(path: &Path, capacity: impl Into>) -> DatabaseResult { use anyhow::Context; diff --git a/crates/fuel-core/src/database/vm_database.rs b/crates/fuel-core/src/database/vm_database.rs index e881093d03f..df4ecf3ebdb 100644 --- a/crates/fuel-core/src/database/vm_database.rs +++ b/crates/fuel-core/src/database/vm_database.rs @@ -86,6 +86,13 @@ impl VmDatabase { } } + pub fn default_from_database(database: Database) -> Self { + Self { + database, + ..Default::default() + } + } + pub fn database_mut(&mut self) -> &mut Database { &mut self.database } diff --git a/crates/fuel-core/src/state/rocks_db.rs b/crates/fuel-core/src/state/rocks_db.rs index 889b6aa63ed..f0dd9074fd4 100644 --- a/crates/fuel-core/src/state/rocks_db.rs +++ b/crates/fuel-core/src/state/rocks_db.rs @@ -21,6 +21,7 @@ use fuel_core_storage::iter::{ IntoBoxedIter, }; use rocksdb::{ + checkpoint::Checkpoint, BoundColumnFamily, Cache, ColumnFamilyDescriptor, @@ -98,6 +99,10 @@ impl RocksDb { Ok(rocks_db) } + pub fn checkpoint>(&self, path: P) -> Result<(), rocksdb::Error> { + Checkpoint::new(&self.db)?.create_checkpoint(path) + } + fn cf(&self, column: Column) -> Arc { self.db .cf_handle(&RocksDb::col_name(column)) From bbd0992a7a7b6af2ac2fb08a0977b6e81e07041d Mon Sep 17 00:00:00 2001 From: Cesar <142530682+cr-fuel@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:31:44 -0300 Subject: [PATCH 7/7] Split keygen into a create and a binary (#1426) Split so it can be inherited from other binaries https://github.com/FuelLabs/sway/issues/5170 --- .github/workflows/ci.yml | 12 ++++----- CHANGELOG.md | 1 + Cargo.lock | 38 ++++++++++++++++++++++++++++ Cargo.toml | 4 ++- bin/keygen/Cargo.toml | 6 ++--- crates/keygen/Cargo.toml | 20 +++++++++++++++ {bin => crates}/keygen/src/keygen.rs | 35 ++++++++++++++++++++++++- {bin => crates}/keygen/src/lib.rs | 0 docs/developers/debugging.md | 4 +-- 9 files changed, 106 insertions(+), 14 deletions(-) create mode 100644 crates/keygen/Cargo.toml rename {bin => crates}/keygen/src/keygen.rs (83%) rename {bin => crates}/keygen/src/lib.rs (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6e2700a769..ba27ab235e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -478,13 +478,13 @@ jobs: - name: Build fuel-core and fuel-core-keygen run: | cross build --profile=release --target ${{ matrix.job.target }} --no-default-features --features "production" -p fuel-core-bin - cross build --profile=release --target ${{ matrix.job.target }} -p fuel-core-keygen + cross build --profile=release --target ${{ matrix.job.target }} -p fuel-core-keygen-bin - name: Strip release binary linux x86_64 if: matrix.job.platform == 'linux' run: | strip "target/${{ matrix.job.target }}/release/fuel-core" - strip "target/${{ matrix.job.target }}/release/fuel-core-keygen" + strip "target/${{ matrix.job.target }}/release/fuel-core-keygen-bin" - name: Strip release binary aarch64-linux-gnu if: matrix.job.target == 'aarch64-unknown-linux-gnu' @@ -498,13 +498,13 @@ jobs: "$PWD/target:/target:Z" \ aarch64-linux-gnu:latest \ aarch64-linux-gnu-strip \ - /target/aarch64-unknown-linux-gnu/release/fuel-core-keygen + /target/aarch64-unknown-linux-gnu/release/fuel-core-keygen-bin - name: Strip release binary mac if: matrix.job.os == 'macos-latest' run: | strip -x "target/${{ matrix.job.target }}/release/fuel-core" - strip -x "target/${{ matrix.job.target }}/release/fuel-core-keygen" + strip -x "target/${{ matrix.job.target }}/release/fuel-core-keygen-bin" - name: Prepare Binary Artifact env: @@ -523,7 +523,7 @@ jobs: # create zip file mkdir -pv "$ARTIFACT" cp "target/${{ matrix.job.target }}/release/fuel-core" "$ARTIFACT" - cp "target/${{ matrix.job.target }}/release/fuel-core-keygen" "$ARTIFACT" + cp "target/${{ matrix.job.target }}/release/fuel-core-keygen-bin" "$ARTIFACT" tar -czvf "$ZIP_FILE_NAME" "$ARTIFACT" - name: Upload Binary Artifact @@ -604,4 +604,4 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/audit-check@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 379fdbc57f8..02b676698c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Description of the upcoming release here. - [#1436](https://github.com/FuelLabs/fuel-core/pull/1436): Add a github action to continuously test beta-4. - [#1430](https://github.com/FuelLabs/fuel-core/pull/1430): Add "sanity" benchmarks for crypto opcodes. - [#1432](https://github.com/FuelLabs/fuel-core/pull/1432): Add a new `--api-request-timeout` argument to control TTL for GraphQL requests. +- [#1426](https://github.com/FuelLabs/fuel-core/pull/1426) Split keygen into a create and a binary - [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions. - [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility. - [#1400](https://github.com/FuelLabs/fuel-core/pull/1400): Add releasy beta to fuel-core so that new commits to fuel-core master triggers fuels-rs. diff --git a/Cargo.lock b/Cargo.lock index 6dbe38188ab..a389f07cc47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2947,10 +2947,21 @@ name = "fuel-core-keygen" version = "0.20.4" dependencies = [ "anyhow", + "atty", "clap 4.4.6", "fuel-core-types", "libp2p-identity 0.2.7", "serde_json", + "termion", +] + +[[package]] +name = "fuel-core-keygen-bin" +version = "0.20.4" +dependencies = [ + "anyhow", + "clap 4.4.6", + "fuel-core-keygen", ] [[package]] @@ -5406,6 +5417,12 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" + [[package]] name = "object" version = "0.32.1" @@ -6501,6 +6518,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_termios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +dependencies = [ + "redox_syscall 0.2.16", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -7817,6 +7843,18 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "termion" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "659c1f379f3408c7e5e84c7d0da6d93404e3800b6b9d063ba24436419302ec90" +dependencies = [ + "libc", + "numtoa", + "redox_syscall 0.2.16", + "redox_termios", +] + [[package]] name = "termtree" version = "0.4.1" diff --git a/Cargo.toml b/Cargo.toml index d7f9bdc939a..4bbc97a3e14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ members = [ "crates/client", "crates/database", "crates/fuel-core", + "crates/keygen", "crates/metrics", "crates/services", "crates/services/consensus_module", @@ -52,7 +53,8 @@ version = "0.20.4" fuel-core = { version = "0.20.4", path = "./crates/fuel-core", default-features = false } fuel-core-client-bin = { version = "0.20.4", path = "./bin/client" } fuel-core-bin = { version = "0.20.4", path = "./bin/fuel-core" } -fuel-core-keygen = { version = "0.20.4", path = "./bin/keygen" } +fuel-core-keygen = { version = "0.20.4", path = "./crates/keygen" } +fuel-core-keygen-bin = { version = "0.20.4", path = "./bin/keygen" } fuel-core-chain-config = { version = "0.20.4", path = "./crates/chain-config" } fuel-core-client = { version = "0.20.4", path = "./crates/client" } fuel-core-database = { version = "0.20.4", path = "./crates/database" } diff --git a/bin/keygen/Cargo.toml b/bin/keygen/Cargo.toml index b74b70fb958..71735bcc491 100644 --- a/bin/keygen/Cargo.toml +++ b/bin/keygen/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fuel-core-keygen" +name = "fuel-core-keygen-bin" version = { workspace = true } edition = { workspace = true } homepage = { workspace = true } @@ -12,6 +12,4 @@ description = "Command line utilities for fuel-core key management" [dependencies] anyhow = { workspace = true } clap = { workspace = true, features = ["derive", "env"] } -fuel-core-types = { workspace = true, features = ["serde", "random"] } -libp2p-identity = { version = "0.2.4", features = ["secp256k1", "peerid"] } -serde_json = { workspace = true, features = ["raw_value"] } +fuel-core-keygen = { workspace = true } diff --git a/crates/keygen/Cargo.toml b/crates/keygen/Cargo.toml new file mode 100644 index 00000000000..53569f0123e --- /dev/null +++ b/crates/keygen/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "fuel-core-keygen" +authors = { workspace = true } +categories = { workspace = true } +version = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +keywords = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +description = "Create to create command line utilities for fuel-core key management" + +[dependencies] +anyhow = { workspace = true } +atty = "0.2.14" +clap = { workspace = true, features = ["derive", "env"] } +fuel-core-types = { workspace = true, features = ["serde", "random"] } +libp2p-identity = { version = "0.2.4", features = ["secp256k1", "peerid"] } +serde_json = { workspace = true, features = ["raw_value"] } +termion = "2.0.1" diff --git a/bin/keygen/src/keygen.rs b/crates/keygen/src/keygen.rs similarity index 83% rename from bin/keygen/src/keygen.rs rename to crates/keygen/src/keygen.rs index 151461c16f7..ba817f7040a 100644 --- a/bin/keygen/src/keygen.rs +++ b/crates/keygen/src/keygen.rs @@ -2,6 +2,7 @@ use crate::{ BLOCK_PRODUCTION, P2P, }; +use atty::Stream; use clap::ValueEnum; use fuel_core_types::{ fuel_crypto::{ @@ -20,9 +21,16 @@ use libp2p_identity::{ }; use serde_json::json; use std::{ + io::{ + stdin, + stdout, + Read, + Write, + }, ops::Deref, str::FromStr, }; +use termion::screen::IntoAlternateScreen; /// Generate a random new secret & public key in the format expected by fuel-core #[derive(Debug, clap::Args)] @@ -126,6 +134,27 @@ impl ParseSecret { } } +fn wait_for_keypress() { + let mut single_key = [0u8]; + stdin().read_exact(&mut single_key).unwrap(); +} + +fn display_string_discreetly( + discreet_string: &str, + continue_message: &str, +) -> anyhow::Result<()> { + if atty::is(Stream::Stdout) { + let mut screen = stdout().into_alternate_screen()?; + writeln!(screen, "{discreet_string}")?; + screen.flush()?; + println!("{continue_message}"); + wait_for_keypress(); + } else { + println!("{discreet_string}"); + } + Ok(()) +} + fn print_value(output: serde_json::Value, pretty: bool) -> anyhow::Result<()> { let output = if pretty { serde_json::to_string_pretty(&output) @@ -133,6 +162,10 @@ fn print_value(output: serde_json::Value, pretty: bool) -> anyhow::Result<()> { serde_json::to_string(&output) } .map_err(anyhow::Error::msg); - println!("{}", output?); + + let _ = display_string_discreetly( + &output?, + "### Do not share or lose this private key! Press any key to complete. ###", + ); Ok(()) } diff --git a/bin/keygen/src/lib.rs b/crates/keygen/src/lib.rs similarity index 100% rename from bin/keygen/src/lib.rs rename to crates/keygen/src/lib.rs diff --git a/docs/developers/debugging.md b/docs/developers/debugging.md index 08b2ab2b81c..06b41322d5d 100644 --- a/docs/developers/debugging.md +++ b/docs/developers/debugging.md @@ -50,10 +50,10 @@ Using environment variables for CLI arguments allows these values to be reused a When running the client with the P2P service enabled, i.e., building the binary with the `p2p` feature and supplying the runtime argument `--enable-p2p`, the client will connect to a Fuel network. This requires additional CLI arguments, including the `--keypair` and `--network` arguments. -A key pair can be generated by running the utility binary `fuel-core-keygen`: +A key pair can be generated by running the utility binary `fuel-core-keygen-bin`: ```bash -cargo run --bin fuel-core-keygen new +cargo run --bin fuel-core-keygen-bin new ``` The resulting key pair printed to the console contains an address and secret. The `secret` can be provided to the `--keypair` argument when running the node.