diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6232a8..00046b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,7 +205,21 @@ jobs: echo "crate_name=$CRATE_NAME" >> $GITHUB_OUTPUT echo "Building crate: $CRATE_NAME" + - name: Check if crate has binary target + id: check_binary + run: | + CRATE_NAME="${{ steps.extract_crate.outputs.crate_name }}" + # Check if the crate's Cargo.toml has a [[bin]] section or src/main.rs + if [ -f "${CRATE_NAME}/src/main.rs" ] || grep -q '^\[\[bin\]\]' "${CRATE_NAME}/Cargo.toml" 2>/dev/null; then + echo "has_binary=true" >> $GITHUB_OUTPUT + echo "Crate $CRATE_NAME has binary target" + else + echo "has_binary=false" >> $GITHUB_OUTPUT + echo "Crate $CRATE_NAME is library-only, skipping binary build" + fi + - name: Install toolchain + if: steps.check_binary.outputs.has_binary == 'true' uses: actions-rs/toolchain@v1 with: profile: minimal @@ -214,36 +228,42 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 + if: steps.check_binary.outputs.has_binary == 'true' with: cache-on-failure: true key: "${{ matrix.job.target }}" - name: Use Cross + if: steps.check_binary.outputs.has_binary == 'true' uses: baptiste0928/cargo-install@v1 with: crate: cross cache-key: "${{ matrix.job.target }}" - name: Build ${{ steps.extract_crate.outputs.crate_name }} + if: steps.check_binary.outputs.has_binary == 'true' run: | cross build --profile=release --target ${{ matrix.job.target }} -p ${{ steps.extract_crate.outputs.crate_name }} + - name: Strip release binary x86_64-linux-gnu - if: matrix.job.target == 'x86_64-unknown-linux-gnu' + if: steps.check_binary.outputs.has_binary == 'true' && matrix.job.target == 'x86_64-unknown-linux-gnu' run: strip "target/${{ matrix.job.target }}/release/${{ steps.extract_crate.outputs.crate_name }}" - name: Strip release binary aarch64-linux-gnu - if: matrix.job.target == 'aarch64-unknown-linux-gnu' + if: steps.check_binary.outputs.has_binary == 'true' && matrix.job.target == 'aarch64-unknown-linux-gnu' run: | docker run --rm -v \ "$PWD/target:/target:Z" \ ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main \ aarch64-linux-gnu-strip \ /target/aarch64-unknown-linux-gnu/release/${{ steps.extract_crate.outputs.crate_name }} + - name: Strip release binary mac - if: matrix.job.os == 'macos-latest' + if: steps.check_binary.outputs.has_binary == 'true' && matrix.job.os == 'macos-latest' run: strip -x "target/${{ matrix.job.target }}/release/${{ steps.extract_crate.outputs.crate_name }}" - name: Prep assets + if: steps.check_binary.outputs.has_binary == 'true' id: prep_assets env: PLATFORM_NAME: ${{ matrix.job.platform }} @@ -262,9 +282,10 @@ jobs: mkdir -pv "$ARTIFACT" cp "target/${{ matrix.job.target }}/release/${CRATE_NAME}" "$ARTIFACT" tar -czvf $ZIP_FILE_NAME "$ARTIFACT" + - name: Upload release archive uses: softprops/action-gh-release@v2 - if: github.ref_type == 'tag' + if: steps.check_binary.outputs.has_binary == 'true' && github.ref_type == 'tag' with: files: ${{ env.ZIP_FILE_NAME }} diff --git a/Cargo.lock b/Cargo.lock index 8ec5f66..6b585d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,6 +45,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom 0.2.15", "once_cell", "version_check", "zerocopy 0.7.35", @@ -86,6 +87,22 @@ dependencies = [ "libc", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "annotate-snippets" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d9b665789884a7e8fb06c84b295e923b03ca51edbb7d08f91a6a50322ecbfe6" +dependencies = [ + "anstyle", + "unicode-width", +] + [[package]] name = "ansiterm" version = "0.12.2" @@ -157,6 +174,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "asn1_der" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" + [[package]] name = "assert-json-diff" version = "2.0.2" @@ -287,6 +310,15 @@ dependencies = [ "serde", ] +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -324,6 +356,12 @@ version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +[[package]] +name = "byte-slice-cast" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" + [[package]] name = "byteorder" version = "1.5.0" @@ -336,6 +374,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.2.17" @@ -369,7 +413,34 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-link", + "windows-link 0.1.1", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", ] [[package]] @@ -492,6 +563,26 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const_format" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -543,6 +634,15 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -552,12 +652,82 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools 0.10.5", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools 0.10.5", +] + [[package]] name = "critical-section" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.3" @@ -586,6 +756,27 @@ dependencies = [ "typenum", ] +[[package]] +name = "csv" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52cd9d68cf7efc6ddfaaee42e7288d3a99d613d4b50f76ce9827ae0c6e14f938" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde_core", +] + +[[package]] +name = "csv-core" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" +dependencies = [ + "memchr", +] + [[package]] name = "ctr" version = "0.9.2" @@ -797,6 +988,48 @@ dependencies = [ "subtle", ] +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -808,6 +1041,12 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "doc-comment" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" + [[package]] name = "document-features" version = "0.2.11" @@ -817,6 +1056,12 @@ dependencies = [ "litrs", ] +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + [[package]] name = "dtoa" version = "1.0.10" @@ -862,13 +1107,25 @@ dependencies = [ "zeroize", ] +[[package]] +name = "educe" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" +dependencies = [ + "enum-ordinalize 3.1.15", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "educe" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" dependencies = [ - "enum-ordinalize", + "enum-ordinalize 4.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -912,6 +1169,12 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + [[package]] name = "enum-iterator" version = "1.5.0" @@ -932,6 +1195,19 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "enum-ordinalize" +version = "3.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "enum-ordinalize" version = "4.3.0" @@ -990,6 +1266,33 @@ dependencies = [ "uuid", ] +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + [[package]] name = "ethnum" version = "1.5.0" @@ -1012,12 +1315,40 @@ dependencies = [ "tokio", ] +[[package]] +name = "extension-trait" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd65f1b59dd22d680c7a626cc4a000c1e03d241c51c3e034d2bc9f1e90734f9b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "fd-lock" +version = "4.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" +dependencies = [ + "cfg-if", + "rustix 1.0.3", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -1034,15 +1365,44 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "filecheck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fe00b427b7c4835f8b82170eb7b9a63634376b63d73b9a9093367e82570bbaa" +dependencies = [ + "regex", + "thiserror 1.0.69", +] + [[package]] name = "fixed-hash" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", "static_assertions", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1050,37 +1410,114 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "forc-tracing" -version = "0.68.8" +name = "foldhash" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36a046da28526264755d87c0b4dfd6e13a5153eb00d271d3a34b8ab1412f224" -dependencies = [ - "ansiterm", - "regex", - "tracing", - "tracing-subscriber", -] +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] -name = "forc-wallet" -version = "0.16.2" +name = "forc-crypto" +version = "0.71.0" dependencies = [ "anyhow", + "async-trait", "clap", - "eth-keystore", - "forc-tracing", - "fuel-core-client", - "fuels", + "criterion", + "forc-tracing 0.70.2", + "forc-util", + "fuel-core-types 0.47.1", + "fuel-crypto 0.65.0", + "fuels-accounts 0.76.0", + "fuels-core 0.76.0", "futures", "hex", - "home", + "libp2p-identity", "rand 0.8.5", - "rpassword", + "rayon", + "regex", + "serde", "serde_json", + "serde_yaml", + "sha3", "tempfile", "termion", "tokio", - "url", + "tracing", +] + +[[package]] +name = "forc-tracing" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366dda3a5c16608a9d8a2c6a37eb27a242e822ad45053711bd643914a2638534" +dependencies = [ + "ansiterm", + "regex", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "forc-tracing" +version = "0.71.0" +dependencies = [ + "ansiterm", + "regex", + "serial_test", + "tracing", + "tracing-subscriber", + "tracing-test", +] + +[[package]] +name = "forc-util" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "850cae9cfb2c0b24ad70d7d5ea12a4d63e87c192785f5e21353005c19ff8cdb5" +dependencies = [ + "annotate-snippets", + "ansiterm", + "anyhow", + "clap", + "dirs", + "fd-lock", + "forc-tracing 0.70.2", + "fuel-asm 0.65.0", + "hex", + "paste", + "regex", + "serde", + "serde_json", + "sha2", + "sway-core", + "sway-error", + "sway-types", + "sway-utils", + "tracing", + "tracing-subscriber", + "unicode-xid", +] + +[[package]] +name = "forc-wallet" +version = "0.16.2" +dependencies = [ + "anyhow", + "clap", + "eth-keystore", + "forc-tracing 0.70.2", + "fuel-core-client 0.46.0", + "fuels", + "futures", + "hex", + "home", + "rand 0.8.5", + "rpassword", + "serde_json", + "tempfile", + "termion", + "tokio", + "url", "wiremock", ] @@ -1095,9 +1532,9 @@ dependencies = [ [[package]] name = "fuel-abi-types" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1e66dabe110e398990f0a37c517a2d8c435f7d6a974e9295a475b39597a1d5" +checksum = "472b28d88f9d49dde82679ae6adfaff75a95f3f0b324f90eaa42a6ac3270d4ce" dependencies = [ "itertools 0.10.5", "lazy_static", @@ -1118,11 +1555,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8961271ed5c974d8a9f12912d87be57fe899638f24948b3ffe4d63dfdf1063f" dependencies = [ "bitflags", - "fuel-types", + "fuel-types 0.62.0", "serde", "strum 0.24.1", ] +[[package]] +name = "fuel-asm" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49ae81d896972a39cfbe6e5659624d08aa889d30950d2831cca1c50bce95898f" +dependencies = [ + "bitflags", + "fuel-types 0.65.0", + "serde", + "strum 0.24.1", +] + +[[package]] +name = "fuel-compression" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55258ae5ef436d6b6c024db4dbe80784c8eafc5062b8b90f365db416e6b4e7bc" +dependencies = [ + "fuel-derive 0.65.0", + "fuel-types 0.65.0", + "serde", +] + [[package]] name = "fuel-core-chain-config" version = "0.46.0" @@ -1131,9 +1591,9 @@ checksum = "a22eafbabed0229dfc8af85619855887fc662a185c58cb3d578a63c8a372d327" dependencies = [ "anyhow", "bech32", - "educe", - "fuel-core-storage", - "fuel-core-types", + "educe 0.6.0", + "fuel-core-storage 0.46.0", + "fuel-core-types 0.46.0", "itertools 0.12.1", "postcard", "rand 0.8.5", @@ -1143,6 +1603,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "fuel-core-chain-config" +version = "0.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3dd8cd17fe300a711ef9ac6c014f1cf76a98212f68eb247e0b5e4b81108f933" +dependencies = [ + "anyhow", + "educe 0.6.0", + "fuel-core-storage 0.47.1", + "fuel-core-types 0.47.1", + "itertools 0.12.1", + "postcard", + "serde", + "serde_with", +] + [[package]] name = "fuel-core-client" version = "0.46.0" @@ -1154,7 +1630,33 @@ dependencies = [ "cynic", "derive_more 0.99.19", "eventsource-client", - "fuel-core-types", + "fuel-core-types 0.46.0", + "futures", + "hex", + "hyper-rustls 0.24.2", + "itertools 0.12.1", + "postcard", + "reqwest", + "schemafy_lib", + "serde", + "serde_json", + "tai64", + "thiserror 1.0.69", + "tracing", +] + +[[package]] +name = "fuel-core-client" +version = "0.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd34ff2c9ad4ed347982759b93ee72f9d31492cd49101fe1b0189a3cb32b434" +dependencies = [ + "anyhow", + "base64 0.22.1", + "cynic", + "derive_more 0.99.19", + "eventsource-client", + "fuel-core-types 0.47.1", "futures", "hex", "hyper-rustls 0.24.2", @@ -1193,10 +1695,10 @@ checksum = "e192252556882c140aed056f6de69c79aebf0416dd492605315870b28bd48e3d" dependencies = [ "anyhow", "async-trait", - "fuel-core-chain-config", + "fuel-core-chain-config 0.46.0", "fuel-core-services", - "fuel-core-storage", - "fuel-core-types", + "fuel-core-storage 0.46.0", + "fuel-core-types 0.46.0", "serde", "serde_json", "thiserror 2.0.12", @@ -1230,8 +1732,30 @@ dependencies = [ "anyhow", "derive_more 0.99.19", "enum-iterator", - "fuel-core-types", - "fuel-vm", + "fuel-core-types 0.46.0", + "fuel-vm 0.62.0", + "impl-tools", + "itertools 0.12.1", + "num_enum", + "paste", + "postcard", + "primitive-types", + "serde", + "strum 0.25.0", + "strum_macros 0.25.3", +] + +[[package]] +name = "fuel-core-storage" +version = "0.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e565d1cf1a528868988bb1165a7ccbc2f410dea356ddbf01032931fbde5c11e" +dependencies = [ + "anyhow", + "derive_more 0.99.19", + "enum-iterator", + "fuel-core-types 0.47.1", + "fuel-vm 0.65.0", "impl-tools", "itertools 0.12.1", "num_enum", @@ -1254,8 +1778,8 @@ dependencies = [ "derive_more 0.99.19", "ed25519", "ed25519-dalek", - "educe", - "fuel-vm", + "educe 0.6.0", + "fuel-vm 0.62.0", "k256", "rand 0.8.5", "secrecy", @@ -1264,6 +1788,27 @@ dependencies = [ "zeroize", ] +[[package]] +name = "fuel-core-types" +version = "0.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9726f08ebe75b92c894626b804dd0a8f8efbe5fc3f25ded79a4d292812647e3d" +dependencies = [ + "anyhow", + "bs58", + "derive_more 0.99.19", + "ed25519", + "ed25519-dalek", + "educe 0.6.0", + "fuel-vm 0.65.0", + "k256", + "parking_lot", + "secrecy", + "serde", + "tai64", + "zeroize", +] + [[package]] name = "fuel-crypto" version = "0.62.0" @@ -1275,7 +1820,28 @@ dependencies = [ "coins-bip39", "ecdsa", "ed25519-dalek", - "fuel-types", + "fuel-types 0.62.0", + "k256", + "p256", + "rand 0.8.5", + "secp256k1", + "serde", + "sha2", + "zeroize", +] + +[[package]] +name = "fuel-crypto" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1bbd5d5d9809d517dab5f92a8c915403d83375efb6f3f5dd3994ff1e4ae28fe" +dependencies = [ + "base64ct", + "coins-bip32", + "coins-bip39", + "ecdsa", + "ed25519-dalek", + "fuel-types 0.65.0", "k256", "p256", "rand 0.8.5", @@ -1297,6 +1863,65 @@ dependencies = [ "synstructure", ] +[[package]] +name = "fuel-derive" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb4078dbab152ef822bc092bd542796270031152ff8c96008b9006fb8c52ce53" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "synstructure", +] + +[[package]] +name = "fuel-ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ad09e8685a72f0c004f4ca74f799d0e7f3d0a883cac0a8de6b6c5d6d0a2c75" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror 1.0.69", + "uint", +] + +[[package]] +name = "fuel-etk-asm" +version = "0.3.1-dev" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51a7d3bc506ec00d5967578290cdeed4969e7a97d36e7eb46e7dc8522e9c5af5" +dependencies = [ + "fuel-etk-ops", + "hex", + "num-bigint", + "pest", + "pest_derive", + "rand 0.8.5", + "sha3", + "snafu", +] + +[[package]] +name = "fuel-etk-ops" +version = "0.3.1-dev" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eed51e8869a40529c44dc6d971f3509f2a3aa55dc9b213d6f88ee2da38a3d44" +dependencies = [ + "educe 0.4.23", + "indexmap 1.9.3", + "quote", + "serde", + "snafu", + "toml 0.5.11", +] + [[package]] name = "fuel-merkle" version = "0.62.0" @@ -1305,7 +1930,22 @@ checksum = "ec01781b757227d9553b178f788f7d922688dcc45cf616ec9c871cd1a591a910" dependencies = [ "derive_more 0.99.19", "digest", - "fuel-storage", + "fuel-storage 0.62.0", + "hashbrown 0.13.2", + "hex", + "serde", + "sha2", +] + +[[package]] +name = "fuel-merkle" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5ecc75b1771d36c86293fef3b63ebcd5fa5bafbc51d356d92ff60ebac59f636" +dependencies = [ + "derive_more 0.99.19", + "digest", + "fuel-storage 0.65.0", "hashbrown 0.13.2", "hex", "serde", @@ -1318,6 +1958,12 @@ version = "0.62.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca73c81646409e9cacac532ff790567d629bc6c512c10ff986536e2335de22c9" +[[package]] +name = "fuel-storage" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b46be43225f70c17f9e028f80a583c275fb2dec1e2a4e9100aa6385a2c86a" + [[package]] name = "fuel-tx" version = "0.62.0" @@ -1326,11 +1972,34 @@ checksum = "a74c65a78258d1e8ccc3400692e557910422c3d1a992a88ff384799ccc69c46a" dependencies = [ "bitflags", "derive_more 1.0.0", - "educe", - "fuel-asm", - "fuel-crypto", - "fuel-merkle", - "fuel-types", + "educe 0.6.0", + "fuel-asm 0.62.0", + "fuel-crypto 0.62.0", + "fuel-merkle 0.62.0", + "fuel-types 0.62.0", + "hashbrown 0.14.5", + "itertools 0.10.5", + "postcard", + "rand 0.8.5", + "serde", + "strum 0.24.1", + "strum_macros 0.24.3", +] + +[[package]] +name = "fuel-tx" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6c26aca0167279221e6ea9bc688f4f9688d2e5a42533c05f1bdf97f1d200b1b" +dependencies = [ + "bitflags", + "derive_more 1.0.0", + "educe 0.6.0", + "fuel-asm 0.65.0", + "fuel-compression", + "fuel-crypto 0.65.0", + "fuel-merkle 0.65.0", + "fuel-types 0.65.0", "hashbrown 0.14.5", "itertools 0.10.5", "postcard", @@ -1346,7 +2015,20 @@ version = "0.62.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b07f2043e0f0cbef39c49ccf74c158609e0abd989684fa73389e5720b19f6d9" dependencies = [ - "fuel-derive", + "fuel-derive 0.62.0", + "hex", + "rand 0.8.5", + "serde", +] + +[[package]] +name = "fuel-types" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b128048cde245d6e895cb7f7824d38d3e4d9f1b4cb5d514c7186bd79308af6a9" +dependencies = [ + "educe 0.6.0", + "fuel-derive 0.65.0", "hex", "rand 0.8.5", "serde", @@ -1363,14 +2045,14 @@ dependencies = [ "backtrace", "bitflags", "derive_more 0.99.19", - "educe", + "educe 0.6.0", "ethnum", - "fuel-asm", - "fuel-crypto", - "fuel-merkle", - "fuel-storage", - "fuel-tx", - "fuel-types", + "fuel-asm 0.62.0", + "fuel-crypto 0.62.0", + "fuel-merkle 0.62.0", + "fuel-storage 0.62.0", + "fuel-tx 0.62.0", + "fuel-types 0.62.0", "hashbrown 0.14.5", "itertools 0.10.5", "libm", @@ -1387,37 +2069,69 @@ dependencies = [ "tai64", ] +[[package]] +name = "fuel-vm" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1632d884ec82f140f21f9943f0bcda8dfcdad02a94a032f67051e27eb1e8054" +dependencies = [ + "async-trait", + "backtrace", + "bitflags", + "derive_more 0.99.19", + "educe 0.6.0", + "ethnum", + "fuel-asm 0.65.0", + "fuel-crypto 0.65.0", + "fuel-merkle 0.65.0", + "fuel-storage 0.65.0", + "fuel-tx 0.65.0", + "fuel-types 0.65.0", + "hashbrown 0.14.5", + "itertools 0.10.5", + "libm", + "paste", + "percent-encoding", + "primitive-types", + "serde", + "serde_with", + "sha3", + "static_assertions", + "strum 0.24.1", + "substrate-bn", +] + [[package]] name = "fuels" -version = "0.75.0" +version = "0.75.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e84d197bd0ff3c351dd42f8ff74af60f8db2ea68675d66156351ce648e05182b" +checksum = "71925fa65411ca3d3b15f659e502b722a4f23772a1ba707ca1a47a0bca71140e" dependencies = [ - "fuel-core-client", - "fuel-crypto", - "fuel-tx", - "fuels-accounts", - "fuels-core", - "fuels-macros", + "fuel-core-client 0.46.0", + "fuel-crypto 0.62.0", + "fuel-tx 0.62.0", + "fuels-accounts 0.75.1", + "fuels-core 0.75.1", + "fuels-macros 0.75.1", "fuels-programs", "fuels-test-helpers", ] [[package]] name = "fuels-accounts" -version = "0.75.0" +version = "0.75.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1b1a05bbd6ee27c13d3e4d7c019716046c2110a93aaf5f40a0e551784052e4" +checksum = "053a093a9b8c5f008eacb8e86ae079631723bede0d795fafc5821d2f63184961" dependencies = [ "async-trait", "chrono", "cynic", - "fuel-core-client", - "fuel-core-types", - "fuel-crypto", - "fuel-tx", - "fuel-types", - "fuels-core", + "fuel-core-client 0.46.0", + "fuel-core-types 0.46.0", + "fuel-crypto 0.62.0", + "fuel-tx 0.62.0", + "fuel-types 0.62.0", + "fuels-core 0.75.1", "futures", "itertools 0.12.1", "k256", @@ -1429,11 +2143,53 @@ dependencies = [ "zeroize", ] +[[package]] +name = "fuels-accounts" +version = "0.76.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2af2d57d6b20289978ccf81397ca385a4f0f9220111b7e27109111ba721b9" +dependencies = [ + "async-trait", + "chrono", + "cynic", + "fuel-core-client 0.47.1", + "fuel-core-types 0.47.1", + "fuel-crypto 0.65.0", + "fuel-tx 0.65.0", + "fuel-types 0.65.0", + "fuels-core 0.76.0", + "futures", + "itertools 0.12.1", + "k256", + "rand 0.8.5", + "semver", + "tai64", + "thiserror 1.0.69", + "tokio", + "zeroize", +] + +[[package]] +name = "fuels-code-gen" +version = "0.75.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d264cafc426d0c69bef87921d32e2078679b304b375ee203bca61b82f8992982" +dependencies = [ + "Inflector", + "fuel-abi-types", + "itertools 0.12.1", + "proc-macro2", + "quote", + "regex", + "serde_json", + "syn 2.0.100", +] + [[package]] name = "fuels-code-gen" -version = "0.75.0" +version = "0.76.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be6d92ae49e4814e56063c11acc590f0b55152c592673adfab6a8a74b3b48c7" +checksum = "b5d6a0c6d15b5bbba10b5862488c34fbeb06e82036409b6e663dedd68430aec9" dependencies = [ "Inflector", "fuel-abi-types", @@ -1447,24 +2203,24 @@ dependencies = [ [[package]] name = "fuels-core" -version = "0.75.0" +version = "0.75.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f09094ba09cdc0706c97cd1eb18f65968565ab88778145a603a8f6615a2ca6a1" +checksum = "7b5206ac929045d956700b1dcd51a4ff65a3684a8c784bf07a7b2c9754ccecbf" dependencies = [ "async-trait", "auto_impl", "chrono", "fuel-abi-types", - "fuel-asm", - "fuel-core-chain-config", - "fuel-core-client", - "fuel-core-types", - "fuel-crypto", - "fuel-tx", - "fuel-types", - "fuel-vm", - "fuels-code-gen", - "fuels-macros", + "fuel-asm 0.62.0", + "fuel-core-chain-config 0.46.0", + "fuel-core-client 0.46.0", + "fuel-core-types 0.46.0", + "fuel-crypto 0.62.0", + "fuel-tx 0.62.0", + "fuel-types 0.62.0", + "fuel-vm 0.62.0", + "fuels-code-gen 0.75.1", + "fuels-macros 0.75.1", "hex", "itertools 0.12.1", "postcard", @@ -1475,13 +2231,56 @@ dependencies = [ "uint", ] +[[package]] +name = "fuels-core" +version = "0.76.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d857ff8b9a0034c86c63c53c079098ffd674d47089dd1a8c93bda3cf7e976885" +dependencies = [ + "async-trait", + "auto_impl", + "chrono", + "fuel-abi-types", + "fuel-asm 0.65.0", + "fuel-core-chain-config 0.47.1", + "fuel-core-client 0.47.1", + "fuel-core-types 0.47.1", + "fuel-crypto 0.65.0", + "fuel-tx 0.65.0", + "fuel-types 0.65.0", + "fuel-vm 0.65.0", + "fuels-code-gen 0.76.0", + "fuels-macros 0.76.0", + "hex", + "itertools 0.12.1", + "postcard", + "serde", + "serde_json", + "sha2", + "thiserror 1.0.69", + "uint", +] + +[[package]] +name = "fuels-macros" +version = "0.75.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2e6fb142046e3ea6008dbef19028e2f14fbb2bf3ce8b8b5a68444bd34d597f5" +dependencies = [ + "fuels-code-gen 0.75.1", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "fuels-macros" -version = "0.75.0" +version = "0.76.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "569508657ce08c29b4b8641d7e1deb15664c59c1af51a0a6741cf8e3280df3a7" +checksum = "eb02dbec62f9441a199d08b584489f6f91f301e189b1299caeb21154c256ffeb" dependencies = [ - "fuels-code-gen", + "fuels-code-gen 0.76.0", "itertools 0.12.1", "proc-macro2", "quote", @@ -1490,17 +2289,17 @@ dependencies = [ [[package]] name = "fuels-programs" -version = "0.75.0" +version = "0.75.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3bfb402b158e499d83ea3c4605cb38bd8a2c80690132c0ff97c20fb2253f62" +checksum = "e6d8633dded2082dfaf004ea89b3313e342c1aeb232906a3f8ae3aec0b8ad946" dependencies = [ "async-trait", "fuel-abi-types", - "fuel-asm", - "fuel-tx", - "fuel-types", - "fuels-accounts", - "fuels-core", + "fuel-asm 0.62.0", + "fuel-tx 0.62.0", + "fuel-types 0.62.0", + "fuels-accounts 0.75.1", + "fuels-core 0.75.1", "itertools 0.12.1", "rand 0.8.5", "serde_json", @@ -1509,20 +2308,20 @@ dependencies = [ [[package]] name = "fuels-test-helpers" -version = "0.75.0" +version = "0.75.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63c438b05669d8d2849084407e35eaf739db34a07042cd7161c569592172c2c3" +checksum = "acc96b30b63b228c87a18bcd61a9a8e5bcd1fca62f4cc5729346c3538b363e48" dependencies = [ - "fuel-core-chain-config", - "fuel-core-client", + "fuel-core-chain-config 0.46.0", + "fuel-core-client 0.46.0", "fuel-core-poa", "fuel-core-services", - "fuel-core-types", - "fuel-crypto", - "fuel-tx", - "fuel-types", - "fuels-accounts", - "fuels-core", + "fuel-core-types 0.46.0", + "fuel-crypto 0.62.0", + "fuel-tx 0.62.0", + "fuel-types 0.62.0", + "fuels-accounts 0.75.1", + "fuels-core 0.75.1", "futures", "portpicker", "rand 0.8.5", @@ -1675,6 +2474,11 @@ name = "gimli" version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "indexmap 2.8.0", + "stable_deref_trait", +] [[package]] name = "glob" @@ -1682,6 +2486,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "graph-cycles" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6ad932c6dd3cfaf16b66754a42f87bbeefd591530c4b6a8334270a7df3e853" +dependencies = [ + "ahash", + "petgraph", + "thiserror 1.0.69", +] + [[package]] name = "group" version = "0.13.0" @@ -1731,6 +2546,17 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy 0.8.31", +] + [[package]] name = "hash32" version = "0.2.1" @@ -1771,6 +2597,9 @@ name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", +] [[package]] name = "heapless" @@ -1804,6 +2633,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + [[package]] name = "hex" version = "0.4.3" @@ -1822,6 +2657,15 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + [[package]] name = "hmac" version = "0.12.1" @@ -1925,7 +2769,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -2013,7 +2857,7 @@ dependencies = [ "http-body 1.0.1", "hyper 1.6.0", "pin-project-lite", - "socket2", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -2188,6 +3032,47 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-tools" version = "0.10.3" @@ -2212,6 +3097,23 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "in_definite" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84ff257c3eca5d5c195af795266168c9666f02395a5627c07af9b332e8f6534" + [[package]] name = "indexmap" version = "1.9.3" @@ -2231,9 +3133,19 @@ checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown 0.15.2", + "rayon", "serde", ] +[[package]] +name = "indoc" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] + [[package]] name = "inout" version = "0.1.4" @@ -2249,6 +3161,17 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +[[package]] +name = "is-terminal" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" +dependencies = [ + "hermit-abi 0.5.2", + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -2273,6 +3196,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.15" @@ -2332,9 +3264,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.171" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libm" @@ -2342,6 +3274,24 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +[[package]] +name = "libp2p-identity" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3104e13b51e4711ff5738caa1fb54467c8604c2e94d607e27745bcf709068774" +dependencies = [ + "asn1_der", + "bs58", + "hkdf", + "k256", + "multihash", + "quick-protobuf", + "sha2", + "thiserror 2.0.12", + "tracing", + "zeroize", +] + [[package]] name = "libredox" version = "0.1.3" @@ -2454,6 +3404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ "adler2", + "simd-adler32", ] [[package]] @@ -2467,13 +3418,43 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "multihash" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b430e7953c29dd6a09afc29ff0bb69c6e306329ee6794700aee27b76a1aea8d" +dependencies = [ + "core2", + "unsigned-varint", +] + +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" -version = "0.50.1" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "serde", ] [[package]] @@ -2482,6 +3463,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2497,7 +3487,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] @@ -2534,7 +3524,12 @@ version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ + "crc32fast", + "flate2", + "hashbrown 0.15.2", + "indexmap 2.8.0", "memchr", + "ruzstd", ] [[package]] @@ -2543,12 +3538,24 @@ version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "ouroboros" version = "0.18.5" @@ -2573,6 +3580,12 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + [[package]] name = "p256" version = "0.13.2" @@ -2585,6 +3598,43 @@ dependencies = [ "sha2", ] +[[package]] +name = "pad" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "parity-scale-codec" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "const_format", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "rustversion", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "parking_lot" version = "0.12.3" @@ -2633,6 +3683,33 @@ dependencies = [ "hmac", ] +[[package]] +name = "peg" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9928cfca101b36ec5163e70049ee5368a8a1c3c6efc9ca9c5f9cc2f816152477" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6298ab04c202fa5b5d52ba03269fb7b74550b150323038878fe6c372d8280f71" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "132dca9b868d927b35b5dd728167b2dee150eb1ad686008fc71ccb298b776fca" + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -2648,6 +3725,101 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "pest_meta" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" +dependencies = [ + "pest", + "sha2", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.8.0", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.10" @@ -2690,6 +3862,34 @@ dependencies = [ "spki", ] +[[package]] +name = "plotters" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" + +[[package]] +name = "plotters-svg" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" +dependencies = [ + "plotters-backend", +] + [[package]] name = "portpicker" version = "0.1.1" @@ -2724,7 +3924,32 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.24", + "zerocopy 0.8.31", +] + +[[package]] +name = "prettydiff" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abec3fb083c10660b3854367697da94c674e9e82aa7511014dc958beeb7215e9" +dependencies = [ + "owo-colors", + "pad", + "prettytable-rs", +] + +[[package]] +name = "prettytable-rs" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eea25e07510aa6ab6547308ebe3c036016d162b8da920dbb079e3ba8acf3d95a" +dependencies = [ + "csv", + "encode_unicode", + "is-terminal", + "lazy_static", + "term", + "unicode-width", ] [[package]] @@ -2743,6 +3968,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", "uint", ] @@ -2837,6 +4065,15 @@ dependencies = [ "psl-types", ] +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + [[package]] name = "quinn" version = "0.11.7" @@ -2848,9 +4085,9 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", + "rustc-hash 2.1.1", "rustls 0.23.25", - "socket2", + "socket2 0.5.8", "thiserror 2.0.12", "tokio", "tracing", @@ -2867,7 +4104,7 @@ dependencies = [ "getrandom 0.3.2", "rand 0.9.0", "ring", - "rustc-hash", + "rustc-hash 2.1.1", "rustls 0.23.25", "rustls-pki-types", "slab", @@ -2886,7 +4123,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.5.8", "tracing", "windows-sys 0.59.0", ] @@ -2931,7 +4168,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", - "zerocopy 0.8.24", + "zerocopy 0.8.31", ] [[package]] @@ -2972,6 +4209,35 @@ dependencies = [ "getrandom 0.3.2", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.10" @@ -2987,6 +4253,17 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20145670ba436b55d91fc92d25e71160fbfbdd57831631c8d7d36377a476f1cb" +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror 1.0.69", +] + [[package]] name = "ref-cast" version = "1.0.24" @@ -3120,6 +4397,26 @@ dependencies = [ "digest", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "ropey" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5" +dependencies = [ + "smallvec", + "str_indices", +] + [[package]] name = "rpassword" version = "7.3.1" @@ -3177,6 +4474,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-hash" version = "2.1.1" @@ -3316,6 +4619,15 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +[[package]] +name = "ruzstd" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +dependencies = [ + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.20" @@ -3331,6 +4643,24 @@ dependencies = [ "cipher", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scc" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" +dependencies = [ + "sdd", +] + [[package]] name = "schannel" version = "0.1.27" @@ -3394,6 +4724,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sdd" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" + [[package]] name = "sec1" version = "0.7.3" @@ -3468,24 +4804,44 @@ checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", "syn 2.0.100", ] +[[package]] +name = "serde_ignored" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115dffd5f3853e06e746965a20dcbae6ee747ae30b543d91b0e089668bb07798" +dependencies = [ + "serde", + "serde_core", +] + [[package]] name = "serde_json" version = "1.0.140" @@ -3498,6 +4854,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3540,6 +4905,44 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.8.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "serial_test" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" +dependencies = [ + "futures", + "log", + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "sha2" version = "0.10.8" @@ -3595,6 +4998,28 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -3604,12 +5029,44 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slotmap" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +dependencies = [ + "version_check", +] + [[package]] name = "smallvec" version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +[[package]] +name = "snafu" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" +dependencies = [ + "backtrace", + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "socket2" version = "0.5.8" @@ -3620,6 +5077,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "spin" version = "0.9.8" @@ -3651,6 +5118,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "str_indices" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" + [[package]] name = "strsim" version = "0.10.0" @@ -3678,6 +5151,15 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +[[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" @@ -3704,6 +5186,19 @@ dependencies = [ "syn 2.0.100", ] +[[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.100", +] + [[package]] name = "substrate-bn" version = "0.6.0" @@ -3723,6 +5218,202 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "sway-ast" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70155cb5ecc63cb1a767b54fadffb8e81d51775ee05aae9f2a32bb464a23e114" +dependencies = [ + "extension-trait", + "num-bigint", + "num-traits", + "serde", + "sway-error", + "sway-types", +] + +[[package]] +name = "sway-core" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c99f8cba966753e03a39323039cc17dff73079c1b786015ebb54add10ba7a201" +dependencies = [ + "clap", + "dirs", + "either", + "fuel-abi-types", + "fuel-ethabi", + "fuel-etk-asm", + "fuel-etk-ops", + "fuel-vm 0.65.0", + "gimli", + "graph-cycles", + "hashbrown 0.14.5", + "im", + "indexmap 2.8.0", + "itertools 0.13.0", + "lazy_static", + "object", + "parking_lot", + "paste", + "pest", + "pest_derive", + "petgraph", + "rustc-hash 1.1.0", + "serde", + "serde_json", + "sha2", + "strum 0.26.3", + "sway-ast", + "sway-error", + "sway-features", + "sway-ir", + "sway-parse", + "sway-types", + "sway-utils", + "swayfmt", + "sysinfo", + "thiserror 1.0.69", + "toml 0.8.20", + "tracing", + "uint", + "vec1", +] + +[[package]] +name = "sway-error" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e31ce0eed5f8cc9d9a801332192610aefc31ded27cfbe19ec92e8ea47698dc" +dependencies = [ + "either", + "in_definite", + "num-traits", + "smallvec", + "strsim 0.11.1", + "sway-types", + "thiserror 1.0.69", +] + +[[package]] +name = "sway-features" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d64638c45e91183e8bc6ac0976172eaada1f247506b22c63f49157a36c26822c" +dependencies = [ + "clap", + "paste", + "sway-error", + "sway-types", +] + +[[package]] +name = "sway-ir" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f13550e9e541c7de1e34e625ae69b3cd1f450c8e9065d9cac8102292505eed97" +dependencies = [ + "anyhow", + "downcast-rs", + "filecheck", + "indexmap 2.8.0", + "itertools 0.13.0", + "once_cell", + "peg", + "prettydiff", + "rustc-hash 1.1.0", + "serde", + "slotmap", + "sway-features", + "sway-ir-macros", + "sway-types", + "sway-utils", +] + +[[package]] +name = "sway-ir-macros" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7b4510c009789a37cd79aa4aaff940cb4cc7cae72c9677033381b81b238781" +dependencies = [ + "itertools 0.13.0", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "sway-parse" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23657cf795a655afd5b7814fb35c6bcd9a8003e219e2141815f124b732da533" +dependencies = [ + "extension-trait", + "num-bigint", + "num-traits", + "phf", + "sway-ast", + "sway-error", + "sway-features", + "sway-types", + "thiserror 1.0.69", + "unicode-bidi", + "unicode-xid", +] + +[[package]] +name = "sway-types" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b28c7cccc9adf3b31622f80d9b28fc6dcb8fcf9908b9a7691a66e571ac36134" +dependencies = [ + "fuel-asm 0.65.0", + "fuel-crypto 0.65.0", + "fuel-tx 0.65.0", + "indexmap 2.8.0", + "lazy_static", + "num-bigint", + "num-traits", + "parking_lot", + "rustc-hash 1.1.0", + "serde", + "sway-utils", + "thiserror 1.0.69", + "toml 0.8.20", +] + +[[package]] +name = "sway-utils" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e1c1143fa90040a7c5d8757bc1c6c2a261c023f9803beff45625fb734481ce5" +dependencies = [ + "serde", + "walkdir", +] + +[[package]] +name = "swayfmt" +version = "0.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7001b7aad1f4a7c9352e31228fba4bdf0436a8edbcbf57e96e74385a0840ece4" +dependencies = [ + "anyhow", + "forc-tracing 0.70.2", + "indoc", + "ropey", + "serde", + "serde_ignored", + "sway-ast", + "sway-error", + "sway-features", + "sway-parse", + "sway-types", + "sway-utils", + "thiserror 1.0.69", + "toml 0.8.20", +] + [[package]] name = "syn" version = "1.0.109" @@ -3765,6 +5456,21 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "sysinfo" +version = "0.29.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" +dependencies = [ + "cfg-if", + "core-foundation-sys", + "libc", + "ntapi", + "once_cell", + "rayon", + "winapi", +] + [[package]] name = "tai64" version = "4.0.0" @@ -3793,6 +5499,17 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + [[package]] name = "termion" version = "4.0.4" @@ -3886,6 +5603,15 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinystr" version = "0.7.6" @@ -3896,6 +5622,16 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.9.0" @@ -3913,20 +5649,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.44.2" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.6.1", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3941,9 +5676,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", @@ -3994,11 +5729,35 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -4007,6 +5766,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap 2.8.0", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -4040,9 +5801,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -4051,9 +5812,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -4062,9 +5823,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", "valuable", @@ -4093,9 +5854,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", @@ -4112,18 +5873,55 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracing-test" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "557b891436fe0d5e0e363427fc7f217abf9ccd510d5136549847bdcbcd011d68" +dependencies = [ + "tracing-core", + "tracing-subscriber", + "tracing-test-macro", +] + +[[package]] +name = "tracing-test-macro" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" +dependencies = [ + "quote", + "syn 2.0.100", +] + [[package]] name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typenum" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "uint" version = "0.9.5" @@ -4136,18 +5934,42 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "unicode-xid" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + [[package]] name = "untrusted" version = "0.9.0" @@ -4199,12 +6021,28 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" +[[package]] +name = "vec1" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab68b56840f69efb0fefbe3ab6661499217ffdc58e2eef7c3f6f69835386322" + [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -4363,6 +6201,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -4384,6 +6231,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-registry" version = "0.4.0" @@ -4392,7 +6245,7 @@ checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ "windows-result", "windows-strings", - "windows-targets 0.53.0", + "windows-targets 0.53.5", ] [[package]] @@ -4401,7 +6254,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -4410,7 +6263,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -4440,6 +6293,24 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -4473,10 +6344,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.0" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ + "windows-link 0.2.1", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -4735,11 +6607,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ - "zerocopy-derive 0.8.24", + "zerocopy-derive 0.8.31", ] [[package]] @@ -4755,9 +6627,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index db5b59b..e6756be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,9 @@ [workspace] resolver = "2" members = [ - "forc-wallet" + "forc-crypto", + "forc-tracing", + "forc-wallet", ] [workspace.package] @@ -10,5 +12,42 @@ homepage = "https://fuel.network/" license = "Apache-2.0" repository = "https://github.com/FuelLabs/forc" + [workspace.dependencies] -fuels = "0.75" +# External Fuel dependencies +fuel-core-types = { version = "0.47", default-features = false } +forc-util = "0.70.2" + +# External dependencies +ansiterm = "0.12" +anyhow = "1.0" +async-trait = "0.1" +clap = "4.5" +criterion = "0.5" +eth-keystore = "0.5" +futures = { version = "0.3", default-features = false } +hex = "0.4" +home = "0.5" +libp2p-identity = "0.2" +rand = "0.8" +rayon = "1.7" +regex = "1.10" +rpassword = "7.2" +serde = "1.0" +serde_json = "1.0" +serde_yaml = "0.9" +sha3 = "0.10" +tempfile = "3" +termion = "4.0" +tokio = "1.48" +tracing = "0.1" +tracing-subscriber = "0.3.22" +tracing-test = "0.2" +serial_test = "3" +url = "2.5" + +[workspace.lints.rust] +missing_docs = "allow" + +[workspace.lints.clippy] +all = "warn" \ No newline at end of file diff --git a/RELEASING.md b/RELEASING.md index fe1a9f7..d87e999 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -48,7 +48,8 @@ When you publish a GitHub release with a tag like `forc-wallet-0.16.0`, the CI w #### 2. Build Release Binaries (`build-release` job) - Extracts the crate name from the tag -- Builds the binary for **only that crate** across multiple platforms: +- **Checks if the crate has a binary target** (skips library-only crates) +- For binary crates, builds across multiple platforms: - **Linux**: x86_64 and aarch64 (ARM64) - **macOS**: x86_64 (Intel) and aarch64 (Apple Silicon) - Strips debug symbols to reduce binary size @@ -56,6 +57,8 @@ When you publish a GitHub release with a tag like `forc-wallet-0.16.0`, the CI w - Example: `forc-wallet-0.16.0-x86_64-unknown-linux-gnu.tar.gz` - Uploads all binary archives to the GitHub release +**Note:** Library-only crates (like `forc-tracing`) are published to crates.io but do not produce release binaries. + #### 3. Update Compatibility Tracking (`update-releases` job) - Runs after successful crate publication @@ -81,6 +84,10 @@ This creates an append-only log of releases and their dependencies, useful for ` Current workspace members: -- `forc-wallet` - A forc plugin for generating or importing wallets using mnemonic phrases +| Crate | Type | Description | +|-------|------|-------------| +| `forc-wallet` | binary | A forc plugin for generating or importing wallets using mnemonic phrases | +| `forc-crypto` | binary | A forc plugin for cryptographic operations (hashing, key generation, vanity addresses) | +| `forc-tracing` | library | Tracing utility shared between forc crates | As new crates are added to the workspace, they can be released independently using the same process. diff --git a/forc-crypto/CHANGELOG.md b/forc-crypto/CHANGELOG.md new file mode 100644 index 0000000..19d5268 --- /dev/null +++ b/forc-crypto/CHANGELOG.md @@ -0,0 +1,13 @@ +# 0.71.0 (December 8th, 2025) + +### Changed + +- repo: migrated from `FuelLabs/sway` to `FuelLabs/forc` monorepo + +No functional changes from v0.70.2. + +# 0.70.2 (November 19th, 2025) + +- Previous release from `FuelLabs/sway` repository + +For historical changelog entries prior to the migration, see the [sway repository](https://github.com/FuelLabs/sway). diff --git a/forc-crypto/Cargo.toml b/forc-crypto/Cargo.toml new file mode 100644 index 0000000..0efe3ed --- /dev/null +++ b/forc-crypto/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "forc-crypto" +# When releasing to crates.io: +# - Remove path dependencies +# - Update CHANGELOG.md. +# - Create "forc-crypto-0.71.x" git tag. +version = "0.71.0" +description = "A `forc` plugin for handling various cryptographic operations and conversions." +edition = "2021" +authors.workspace = true +homepage.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +clap = { workspace = true, features = ["derive", "env"] } +forc-tracing = "0.70.2" +forc-util.workspace = true +fuel-core-types.workspace = true +fuel-crypto = { version = "0.65", features = ["random"] } +fuels-accounts = "0.76" +fuels-core = "0.76" +futures.workspace = true +hex.workspace = true +libp2p-identity = { workspace = true, features = ["peerid", "secp256k1"] } +rand.workspace = true +rayon.workspace = true +regex.workspace = true +serde.workspace = true +serde_json.workspace = true +serde_yaml.workspace = true +sha3.workspace = true +termion.workspace = true +tokio = { workspace = true, features = ["macros", "rt-multi-thread", "process"] } +tracing.workspace = true + +[dev-dependencies] +criterion.workspace = true +tempfile.workspace = true + +[[bench]] +name = "bench_main" +harness = false + +[lints] +workspace = true diff --git a/forc-crypto/benches/bench_main.rs b/forc-crypto/benches/bench_main.rs new file mode 100644 index 0000000..6759239 --- /dev/null +++ b/forc-crypto/benches/bench_main.rs @@ -0,0 +1,73 @@ +use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use forc_crypto::keys::vanity::{find_vanity_address_with_timeout, HexMatcher, RegexMatcher}; +use rayon::iter::Either; + +fn benchmark_vanity_address(c: &mut Criterion) { + let mut group = c.benchmark_group("Vanity Address Generation"); + + // Benchmark HexMatcher with prefix + group.bench_function("HexMatcher (starts with 'a')", |b| { + b.iter(|| { + let matcher = Either::Right(HexMatcher::new("a", "").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), false, None) + }) + }); + + // Benchmark HexMatcher with suffix + group.bench_function("HexMatcher (ends with 'f')", |b| { + b.iter(|| { + let matcher = Either::Right(HexMatcher::new("", "f").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), false, None) + }) + }); + + // Benchmark HexMatcher with both prefix and suffix + group.bench_function("HexMatcher (starts with 'a' ends with 'f')", |b| { + b.iter(|| { + let matcher = Either::Right(HexMatcher::new("a", "f").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), false, None) + }) + }); + + // Benchmark RegexMatcher with simple pattern + group.bench_function("RegexMatcher (starts with 'a')", |b| { + b.iter(|| { + let matcher = Either::Left(RegexMatcher::new("^a.*").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), false, None) + }) + }); + + // Benchmark RegexMatcher with complex pattern + group.bench_function("RegexMatcher (contains two consecutive digits)", |b| { + b.iter(|| { + let matcher = Either::Left(RegexMatcher::new(r"[0-9]{2}").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), false, None) + }) + }); + + // Benchmark with mnemonic generation + group.bench_function("HexMatcher with Mnemonic (starts with 'a')", |b| { + b.iter(|| { + let matcher = Either::Right(HexMatcher::new("a", "").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), true, None) + }) + }); + + group.bench_function("RegexMatcher with Mnemonic (starts with 'a')", |b| { + b.iter(|| { + let matcher = Either::Left(RegexMatcher::new("^a.*").unwrap()); + find_vanity_address_with_timeout(black_box(matcher), true, None) + }) + }); + + group.finish(); +} + +criterion_group! { + name = benches; + config = Criterion::default() + .sample_size(10) // Reduced sample size due to potentially long-running benchmarks + .measurement_time(std::time::Duration::from_secs(20)); + targets = benchmark_vanity_address +} +criterion_main!(benches); diff --git a/forc-crypto/src/address.rs b/forc-crypto/src/address.rs new file mode 100644 index 0000000..1bc81b5 --- /dev/null +++ b/forc-crypto/src/address.rs @@ -0,0 +1,41 @@ +use anyhow::anyhow; +use fuel_crypto::fuel_types::Address; +use serde_json::json; +use std::str::{from_utf8, FromStr}; + +forc_util::cli_examples! { + crate::Command { + [ Convert an address to another format => "forc crypto address fuel12e0xwx34nfp7jrzvn9mp5qkac3yvp7h8fx37ghl7klf82vv2wkys6wd523" ] + } +} + +#[derive(Debug, clap::Args)] +#[clap( + version, + about = "Converts an address to another format", + after_help = help(), +)] +pub struct Args { + /// The address to convert. It can be either a valid address in hex format + pub address: String, +} + +/// Takes a valid address in any supported format and returns them in all +/// supported format. This is meant to be a tool that can be used to convert any +/// address format to all other formats +pub fn dump_address>(data: T) -> anyhow::Result { + let bytes_32: Result<[u8; 32], _> = data.as_ref().try_into(); + let addr = match bytes_32 { + Ok(bytes) => Address::from(bytes), + Err(_) => handle_string_conversion(data)?, + }; + + Ok(json!({ + "Address": addr.to_string(), + })) +} + +fn handle_string_conversion>(data: T) -> anyhow::Result
{ + let addr = from_utf8(data.as_ref())?; + Address::from_str(addr).map_err(|_| anyhow!("{} cannot be parsed to a valid address", addr)) +} diff --git a/forc-crypto/src/args.rs b/forc-crypto/src/args.rs new file mode 100644 index 0000000..4201894 --- /dev/null +++ b/forc-crypto/src/args.rs @@ -0,0 +1,151 @@ +//! A `forc` plugin for converting a given string or path to their hash. + +use std::{ + fs::read, + io::{self, BufRead}, + path::Path, +}; + +forc_util::cli_examples! { + crate::Command { + [ Hashes an argument with SHA256 => "forc crypto sha256 test" ] + [ Hashes an argument with Keccak256 => "forc crypto keccak256 test" ] + [ Hashes a file path with SHA256 => "forc crypto sha256 {file}" ] + [ Hashes a file path with Keccak256 => "forc crypto keccak256 {file}" ] + } +} + +#[derive(Debug, Clone, clap::Args)] +#[clap( + version, + about = "Hashes the argument or file with this algorithm", + after_help = help(), +)] +pub struct HashArgs { + /// This argument is optional, it can be either: + /// + /// 1. A path to a file. If that is the case, the content of the file is + /// loaded + /// + /// 2. A binary string encoded as a hex string. If that is the case, the + /// hex is decoded and passed as a Vec + /// + /// 3. A string. This is the last option, if the string is "-", "stdin" + /// is read instead. Otherwise the raw string is converted to a Vec + /// and passed + /// + /// 4. If it is not provided, "stdin" is read + content_or_filepath: Option, +} + +fn checked_read_file>(path: &Option

) -> Option> { + path.as_ref().map(read)?.ok() +} + +fn checked_read_stdin(content: &Option, mut stdin: R) -> Option> { + match content.as_ref().map(|x| x.as_str()) { + Some("-") | None => { + let mut buffer = Vec::new(); + if stdin.read_to_end(&mut buffer).is_ok() { + Some(buffer) + } else { + Some(vec![]) + } + } + _ => None, + } +} + +fn read_as_binary(content: &Option) -> Vec { + content + .as_ref() + .map(|x| { + if let Some(hex) = x.trim().strip_prefix("0x") { + if let Ok(bin) = hex::decode(hex) { + bin + } else { + x.as_bytes().to_vec() + } + } else { + x.as_bytes().to_vec() + } + }) + .unwrap_or_default() +} + +/// Reads the arg and returns a vector of bytes +/// +/// These are the rules +/// 1. If None, stdin is read. +/// 2. If it's a String and it happens to be a file path, its content will be returned +/// 3. If it's a String and it is "-", stdin is read +/// 4. If the string starts with "0x", it will be treated as a hex string. Only +/// fully valid hex strings are accepted. +/// 5. Otherwise the String will be converted to a vector of bytes +pub fn read_content_filepath_or_stdin(arg: Option) -> Vec { + match checked_read_file(&arg) { + Some(bytes) => bytes, + None => match checked_read_stdin(&arg, io::stdin().lock()) { + Some(bytes) => bytes, + None => read_as_binary(&arg), + }, + } +} + +/// The HashArgs takes no or a single argument, it can be either a string or a +/// path to a file. It can be consumed and converted to a Vec using the From +/// trait. +/// +/// This is a wrapper around `read_content_filepath_or_stdin` +impl From for Vec { + fn from(value: HashArgs) -> Self { + read_content_filepath_or_stdin(value.content_or_filepath) + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_checked_read_file() { + assert!(checked_read_file(&Some("not a file")).is_none()); + assert!(checked_read_file(&Some("Cargo.toml")).is_some()); + assert!(checked_read_file::(&None).is_none()); + } + + #[test] + fn test_checked_stdin() { + let stdin = b"I'm a test from stdin"; + assert_eq!( + None, + checked_read_stdin(&Some("value".to_owned()), &stdin[..]) + ); + assert_eq!( + Some(b"I'm a test from stdin".to_vec()), + checked_read_stdin(&None, &stdin[..]) + ); + assert_eq!( + Some(b"I'm a test from stdin".to_vec()), + checked_read_stdin(&Some("-".to_owned()), &stdin[..]) + ); + assert_eq!(None, checked_read_stdin(&Some("".to_owned()), &stdin[..])); + } + + #[test] + fn test_read_binary() { + let x = " 0xff"; + assert_eq!(vec![255u8], read_as_binary(&Some(x.to_owned()))); + let x = "0xFF"; + assert_eq!(vec![255u8], read_as_binary(&Some(x.to_owned()))); + let x = " 0xFf"; + assert_eq!(vec![255u8], read_as_binary(&Some(x.to_owned()))); + let x = " 0xFfx"; + assert_eq!(b" 0xFfx".to_vec(), read_as_binary(&Some(x.to_owned()))); + let x = " some random data\n\n\0"; + assert_eq!( + b" some random data\n\n\0".to_vec(), + read_as_binary(&Some(x.to_owned())) + ); + } +} diff --git a/forc-crypto/src/keccak256.rs b/forc-crypto/src/keccak256.rs new file mode 100644 index 0000000..3d9911d --- /dev/null +++ b/forc-crypto/src/keccak256.rs @@ -0,0 +1,9 @@ +use serde_json::json; +use sha3::{Digest, Keccak256}; + +/// Hashes a given data using Keccak256 +pub fn hash>>(data: T) -> anyhow::Result { + let mut hasher = Keccak256::new(); + hasher.update(data.into()); + Ok(json!(hex::encode(hasher.finalize()))) +} diff --git a/forc-crypto/src/keys/get_public_key.rs b/forc-crypto/src/keys/get_public_key.rs new file mode 100644 index 0000000..a942bce --- /dev/null +++ b/forc-crypto/src/keys/get_public_key.rs @@ -0,0 +1,66 @@ +use crate::args::read_content_filepath_or_stdin; +use anyhow::Result; +use fuel_crypto::{fuel_types::Address, Message, Signature}; +use serde_json::json; + +forc_util::cli_examples! { + crate::Command { + [ Get the public key from a message and its signature => r#"forc crypto get-public-key \ + 0x1eff08081394b72239a0cf7ff6b499213dcb7a338bedbd75d072d504588ef27a1f74d5ceb2f111ec02ede097fb09ed00aa9867922ed39299dae0b1afc0fa8661 \ + "This is a message that is signed""# ] + } +} + +/// Parse a secret key to view the associated public key +#[derive(Debug, clap::Args)] +#[clap( + author, + version, + about = "Get the public key from a message and its signature", + after_long_help = help(), +)] +pub struct Arg { + /// A private key in hex format + signature: Signature, + /// A message + message: Option, +} + +pub fn handler(arg: Arg) -> Result { + let message = Message::new(read_content_filepath_or_stdin(arg.message)); + let public_key = Signature::recover(&arg.signature, &message)?; + + let bytes = *public_key.hash(); + + let addr = Address::from(bytes); + + Ok(json!({ + "PublicKey": public_key.to_string(), + "Address": addr.to_string(), + })) +} + +#[cfg(test)] +mod test { + use std::str::FromStr; + + use super::*; + + #[test] + fn expect_output() { + let arg = Arg { + signature: Signature::from_str("0x1eff08081394b72239a0cf7ff6b499213dcb7a338bedbd75d072d504588ef27a1f74d5ceb2f111ec02ede097fb09ed00aa9867922ed39299dae0b1afc0fa8661").unwrap(), + message: Some("This is a message that is signed".to_string()), + }; + let json = handler(arg).unwrap(); + assert_eq!( + "4ef69bcba1cf6d1b4c05d746362d6e1af6245f2f71506f1516c7d52bf5d9ed9a", + json.as_object() + .unwrap() + .get("Address") + .unwrap() + .as_str() + .unwrap(), + ) + } +} diff --git a/forc-crypto/src/keys/mod.rs b/forc-crypto/src/keys/mod.rs new file mode 100644 index 0000000..8935b5f --- /dev/null +++ b/forc-crypto/src/keys/mod.rs @@ -0,0 +1,22 @@ +use clap::ValueEnum; + +pub mod get_public_key; +pub mod new_key; +pub mod parse_secret; +pub mod vanity; + +#[derive(Clone, Debug, Default, ValueEnum)] +pub enum KeyType { + #[default] + BlockProduction, + Peering, +} + +impl From for &'static str { + fn from(key_type: KeyType) -> Self { + match key_type { + KeyType::BlockProduction => "block-production", + KeyType::Peering => "p2p", + } + } +} diff --git a/forc-crypto/src/keys/new_key.rs b/forc-crypto/src/keys/new_key.rs new file mode 100644 index 0000000..4fedaba --- /dev/null +++ b/forc-crypto/src/keys/new_key.rs @@ -0,0 +1,66 @@ +use super::KeyType; +use anyhow::Result; +use fuel_core_types::{ + fuel_crypto::{ + rand::{prelude::StdRng, SeedableRng}, + SecretKey, + }, + fuel_tx::Input, +}; +use libp2p_identity::{secp256k1, Keypair, PeerId}; +use serde_json::json; +use std::ops::Deref; + +forc_util::cli_examples! { + crate::Command { + [ Creates a new key default for block production => "forc crypto new-key" ] + [ Creates a new key for peering => "forc crypto new-key -k peering" ] + [ Creates a new key for block production => "forc crypto new-key -k block-production" ] + } +} + +/// Creates a new key for use with fuel-core +#[derive(Debug, clap::Args)] +#[clap(version, after_help = help())] +pub struct Arg { + /// Key type to generate. It can either be `block-production` or `peering`. + #[clap( + long = "key-type", + short = 'k', + value_enum, + default_value = <&'static str>::from(KeyType::BlockProduction), + )] + key_type: KeyType, +} + +pub fn handler(arg: Arg) -> Result { + let mut rng = StdRng::from_entropy(); + let secret = SecretKey::random(&mut rng); + let public_key = secret.public_key(); + let secret_str = secret.to_string(); + + let output = match arg.key_type { + KeyType::BlockProduction => { + let address = Input::owner(&public_key); + json!({ + "secret": secret_str, + "address": address, + "type": >::into(KeyType::BlockProduction), + }) + } + KeyType::Peering => { + let mut bytes = *secret.deref(); + let p2p_secret = secp256k1::SecretKey::try_from_bytes(&mut bytes) + .expect("Should be a valid private key"); + let p2p_keypair = secp256k1::Keypair::from(p2p_secret); + let libp2p_keypair = Keypair::from(p2p_keypair); + let peer_id = PeerId::from_public_key(&libp2p_keypair.public()); + json!({ + "secret": secret_str, + "peer_id": peer_id.to_string(), + "type": >::into(KeyType::Peering), + }) + } + }; + Ok(output) +} diff --git a/forc-crypto/src/keys/parse_secret.rs b/forc-crypto/src/keys/parse_secret.rs new file mode 100644 index 0000000..a266aa6 --- /dev/null +++ b/forc-crypto/src/keys/parse_secret.rs @@ -0,0 +1,60 @@ +use super::KeyType; +use anyhow::Result; +use fuel_core_types::{fuel_crypto::SecretKey, fuel_tx::Input}; +use libp2p_identity::{secp256k1, Keypair, PeerId}; +use serde_json::json; +use std::{ops::Deref, str::FromStr}; + +forc_util::cli_examples! { + crate::Command { + [ Parses the secret of a block production => "forc crypto parse-secret \"f5204427d0ab9a311266c96a377f7c329cb8a41b9088225b6fcf40eefb423e28\"" ] + [ Parses the secret of a peering => "forc crypto parse-secret -k peering \"f5204427d0ab9a311266c96a377f7c329cb8a41b9088225b6fcf40eefb423e28\"" ] + } +} + +/// Parses a private key to view the associated public key +#[derive(Debug, clap::Args)] +#[clap( + version, + after_help = help(), +)] +pub struct Arg { + /// A private key in hex format + secret: String, + /// Key type to generate. It can either be `block-production` or `peering`. + #[clap( + long = "key-type", + short = 'k', + value_enum, + default_value = <&'static str>::from(KeyType::BlockProduction), + )] + key_type: KeyType, +} + +pub fn handler(arg: Arg) -> Result { + let secret = SecretKey::from_str(&arg.secret)?; + let output = match arg.key_type { + KeyType::BlockProduction => { + let address = Input::owner(&secret.public_key()); + let output = json!({ + "address": address.to_string(), + "type": >::into(KeyType::BlockProduction), + }); + output + } + KeyType::Peering => { + let mut bytes = *secret.deref(); + let p2p_secret = secp256k1::SecretKey::try_from_bytes(&mut bytes) + .expect("Should be a valid private key"); + let p2p_keypair = secp256k1::Keypair::from(p2p_secret); + let libp2p_keypair = Keypair::from(p2p_keypair); + let peer_id = PeerId::from_public_key(&libp2p_keypair.public()); + let output = json!({ + "peer_id": peer_id.to_string(), + "type": >::into(KeyType::Peering), + }); + output + } + }; + Ok(output) +} diff --git a/forc-crypto/src/keys/vanity.rs b/forc-crypto/src/keys/vanity.rs new file mode 100644 index 0000000..bebc262 --- /dev/null +++ b/forc-crypto/src/keys/vanity.rs @@ -0,0 +1,451 @@ +use fuel_crypto::{fuel_types::Address, PublicKey, SecretKey}; +use fuels_accounts::signers::{ + derivation::DEFAULT_DERIVATION_PATH, private_key::generate_mnemonic_phrase, +}; +use fuels_core::types::checksum_address::checksum_encode; +use rayon::iter::{self, Either, ParallelIterator}; +use regex::Regex; +use serde_json::json; +use std::{ + path::PathBuf, + time::{Duration, Instant}, +}; +use tokio::runtime::Runtime; + +forc_util::cli_examples! { + crate::Command { + [ Generate a checksummed vanity address with a given prefix => "forc crypto vanity --starts-with \"aaa\"" ] + [ Generate a checksummed vanity address with a given suffix => "forc crypto vanity --ends-with \"aaa\"" ] + [ Generate a checksummed vanity address with a given prefix and suffix => "forc crypto vanity --starts-with \"00\" --ends-with \"ff\"" ] + [ Generate a checksummed vanity address with a given regex pattern => "forc crypto vanity --regex \"^00.*ff$\"" ] + } +} + +fn validate_hex_string(s: &str) -> Result { + if !s.chars().all(|c| c.is_ascii_hexdigit()) { + return Err("Pattern must contain only hex characters (0-9, a-f)".to_string()); + } + Ok(s.to_string()) +} + +fn validate_regex_pattern(s: &str) -> Result { + if s.len() > 128 { + return Err("Regex pattern too long: max 128 characters".to_string()); + } + + if let Err(e) = Regex::new(&format!("(?i){s}")) { + return Err(format!("Invalid regex pattern: {e}")); + } + + Ok(s.to_string()) +} + +#[derive(Debug, clap::Parser)] +#[clap( + version, + about = "Generate a vanity address", + after_help = "Generate vanity addresses for the Fuel blockchain" +)] +pub struct Arg { + /// Desired hex string prefix for the address + #[arg( + long, + value_name = "HEX_STRING", + required_unless_present = "ends_with", + required_unless_present = "regex", + conflicts_with = "regex", + value_parser = validate_hex_string, + )] + pub starts_with: Option, + + /// Desired hex string suffix for the address + #[arg(long, value_name = "HEX_STRING", conflicts_with = "regex", value_parser = validate_hex_string)] + pub ends_with: Option, + + /// Desired regex pattern to match the entire address (case-insensitive) + #[arg(long, value_name = "PATTERN", conflicts_with = "starts_with", value_parser = validate_regex_pattern)] + pub regex: Option, + + /// Timeout in seconds for address generation + #[arg(long, value_name = "SECONDS")] + pub timeout: Option, + + /// Return mnemonic with address (default false) + #[arg(long)] + pub mnemonic: bool, + + /// Path to save the generated vanity address to. + #[arg(long, value_hint = clap::ValueHint::FilePath, value_name = "PATH")] + pub save_path: Option, +} + +impl Arg { + pub fn validate(&self) -> anyhow::Result<()> { + let total_length = self.starts_with.as_ref().map_or(0, |s| s.len()) + + self.ends_with.as_ref().map_or(0, |s| s.len()); + if total_length > 64 { + return Err(anyhow::anyhow!( + "Combined pattern length exceeds 64 characters" + )); + } + Ok(()) + } +} + +pub fn handler(args: Arg) -> anyhow::Result { + args.validate()?; + + let Arg { + starts_with, + ends_with, + regex, + mnemonic, + timeout, + save_path, + } = args; + + let matcher = if let Some(pattern) = regex { + Either::Left(RegexMatcher::new(&pattern)?) + } else { + let starts_with = starts_with.as_deref().unwrap_or(""); + let ends_with = ends_with.as_deref().unwrap_or(""); + Either::Right(HexMatcher::new(starts_with, ends_with)?) + }; + + println!("Starting to generate vanity address..."); + let start_time = Instant::now(); + + let result = find_vanity_address_with_timeout(matcher, mnemonic, timeout)?; + let (address, secret_key, mnemonic) = result; + + let duration = start_time.elapsed(); + println!( + "Successfully found vanity address in {:.3} seconds.\n", + duration.as_secs_f64() + ); + + let checksum_address = checksum_encode(&address.to_string())?; + let result = if let Some(mnemonic) = mnemonic { + json!({ + "Address": checksum_address, + "PrivateKey": hex::encode(secret_key.as_ref()), + "Mnemonic": mnemonic, + }) + } else { + json!({ + "Address": checksum_address, + "PrivateKey": hex::encode(secret_key.as_ref()), + }) + }; + + if let Some(path) = save_path { + std::fs::write(path, serde_json::to_string_pretty(&result)?)?; + } + + Ok(result) +} + +pub trait VanityMatcher: Send + Sync + 'static { + fn is_match(&self, addr: &Address) -> bool; +} + +pub struct HexMatcher { + prefix: String, + suffix: String, +} + +impl HexMatcher { + pub fn new(prefix: &str, suffix: &str) -> anyhow::Result { + Ok(Self { + prefix: prefix.to_lowercase(), + suffix: suffix.to_lowercase(), + }) + } +} + +impl VanityMatcher for HexMatcher { + fn is_match(&self, addr: &Address) -> bool { + let hex_addr = hex::encode(addr.as_ref()).to_lowercase(); + hex_addr.starts_with(&self.prefix) && hex_addr.ends_with(&self.suffix) + } +} + +pub struct RegexMatcher { + re: Regex, +} + +impl RegexMatcher { + pub fn new(pattern: &str) -> anyhow::Result { + let re = Regex::new(&format!("(?i){pattern}"))?; + Ok(Self { re }) + } +} + +impl VanityMatcher for RegexMatcher { + fn is_match(&self, addr: &Address) -> bool { + let addr = hex::encode(addr.as_ref()); + self.re.is_match(&addr) + } +} + +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; + +pub fn find_vanity_address_with_timeout( + matcher: Either, + use_mnemonic: bool, + timeout_secs: Option, +) -> anyhow::Result<(Address, SecretKey, Option)> { + let should_stop = Arc::new(AtomicBool::new(false)); + let should_stop_clone = should_stop.clone(); + + let generate_wallet = move || { + let breakpoint = if use_mnemonic { 1_000 } else { 100_000 }; + let start = Instant::now(); + let attempts = std::sync::atomic::AtomicUsize::new(0); + + wallet_generator(use_mnemonic) + .find_any(|result| { + // Check if we should stop due to timeout + if should_stop.load(Ordering::Relaxed) { + return true; // This will cause find_any to return the current result + } + + let current = attempts.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + if current != 0 && current.is_multiple_of(breakpoint) { + let elapsed = start.elapsed().as_secs_f64(); + let rate = current as f64 / elapsed; + println!("└─ tried {current} addresses ({rate:.2} addresses/sec)..."); + } + + if let Ok((addr, _, _)) = result { + match &matcher { + Either::Left(regex_matcher) => regex_matcher.is_match(addr), + Either::Right(hex_matcher) => hex_matcher.is_match(addr), + } + } else { + false + } + }) + .ok_or_else(|| anyhow::anyhow!("No matching address found"))? + }; + + let Some(secs) = timeout_secs else { + return generate_wallet(); + }; + + Runtime::new()?.block_on(async { + let generation_task = tokio::task::spawn_blocking(generate_wallet); + + tokio::select! { + result = generation_task => { + match result { + Ok(wallet_result) => wallet_result, + Err(_) => Err(anyhow::anyhow!("No matching address found")), + } + } + _ = tokio::time::sleep(Duration::from_secs(secs)) => { + // Signal all threads to stop + should_stop_clone.store(true, Ordering::Relaxed); + // Wait a short time for threads to notice the stop signal + tokio::time::sleep(Duration::from_millis(100)).await; + Err(anyhow::anyhow!("Vanity address generation timed out after {} seconds", secs)) + } + } + }) +} + +#[inline] +fn wallet_generator( + use_mnemonic: bool, +) -> impl ParallelIterator)>> { + iter::repeat(()).map(move |()| generate_wallet(use_mnemonic)) +} + +fn generate_wallet(use_mnemonic: bool) -> anyhow::Result<(Address, SecretKey, Option)> { + let mut rng = rand::thread_rng(); + + let (private_key, mnemonic) = if use_mnemonic { + let mnemonic = generate_mnemonic_phrase(&mut rng, 24)?; + let private_key = + SecretKey::new_from_mnemonic_phrase_with_path(&mnemonic, DEFAULT_DERIVATION_PATH)?; + (private_key, Some(mnemonic)) + } else { + (SecretKey::random(&mut rng), None) + }; + + let public = PublicKey::from(&private_key); + let hashed = public.hash(); + let address = Address::from(*hashed); + + Ok((address, private_key, mnemonic)) +} + +#[cfg(test)] +mod tests { + use super::*; + use clap::Parser; + + // Helper function to parse args and get validation errors + fn parse_args(args: Vec<&str>) -> Result { + let args = + Arg::try_parse_from(std::iter::once("test").chain(args)).map_err(|e| e.to_string())?; + args.validate().map_err(|e| e.to_string())?; + Ok(args) + } + + #[test] + fn test_invalid_hex_characters() { + let result = parse_args(vec!["--starts-with", "xyz"]); + assert!(result.is_err()); + assert_eq!(result.unwrap_err(), "error: invalid value 'xyz' for '--starts-with ': Pattern must contain only hex characters (0-9, a-f)\n\nFor more information, try '--help'.\n"); + } + + #[test] + fn test_pattern_too_long() { + let result = parse_args(vec![ + "--starts-with", + &"a".repeat(32), + "--ends-with", + &"b".repeat(33), + ]); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err(), + "Combined pattern length exceeds 64 characters" + ); + } + + #[test] + fn test_invalid_regex_syntax() { + let result = parse_args(vec!["--regex", "["]); + assert!(result.is_err()); + assert_eq!(result.unwrap_err(), "error: invalid value '[' for '--regex ': Invalid regex pattern: regex parse error:\n (?i)[\n ^\nerror: unclosed character class\n\nFor more information, try '--help'.\n"); + } + + #[test] + fn test_regex_too_long() { + let result = parse_args(vec!["--regex", &"a".repeat(129)]); + assert!(result.is_err()); + assert_eq!(result.unwrap_err(), "error: invalid value 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for '--regex ': Regex pattern too long: max 128 characters\n\nFor more information, try '--help'.\n"); + } + + #[test] + fn test_conflicting_args() { + let result = parse_args(vec!["--starts-with", "aa", "--regex", "^aa"]); + assert!(result.is_err()); + assert_eq!(result.unwrap_err(), "error: the argument '--starts-with ' cannot be used with '--regex '\n\nUsage: test --starts-with \n\nFor more information, try '--help'.\n"); + } + + #[test] + fn test_timeout_respected() { + // This pattern should take a long time to generate + let args = parse_args(vec!["--starts-with", "fffffffffffff", "--timeout", "1"]).unwrap(); + + let result = handler(args); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "Vanity address generation timed out after 1 seconds" + ); + } + + // Test actual functionality with minimal patterns + #[test] + fn test_valid_short_prefix() { + let args = parse_args(vec!["--starts-with", "a"]).unwrap(); + let result = handler(args).unwrap(); + let address = result["Address"].as_str().unwrap(); + assert!( + address.to_lowercase().starts_with("0xa"), + "Address should start with 'a'" + ); + } + + #[test] + fn test_valid_short_suffix() { + let args = parse_args(vec!["--ends-with", "a"]).unwrap(); + let result = handler(args).unwrap(); + let address = result["Address"].as_str().unwrap(); + assert!( + address.to_lowercase().ends_with('a'), + "Address should end with 'a'" + ); + } + + #[test] + fn test_both_prefix_and_suffix() { + let args = parse_args(vec!["--starts-with", "a", "--ends-with", "b"]).unwrap(); + let result = handler(args).unwrap(); + let address = result["Address"].as_str().unwrap().to_lowercase(); + assert!(address.starts_with("0xa"), "Address should start with 'a'"); + assert!(address.ends_with('b'), "Address should end with 'b'"); + } + + #[test] + fn test_simple_regex() { + let args = parse_args(vec!["--regex", "^a.*b$"]).unwrap(); + let result = handler(args).unwrap(); + let address = result["Address"].as_str().unwrap().to_lowercase(); + assert!(address.starts_with("0xa"), "Address should start with 'a'"); + assert!(address.ends_with('b'), "Address should end with 'b'"); + } + + #[test] + fn test_simple_regex_uppercase() { + let args = parse_args(vec!["--regex", "^A.*B$"]).unwrap(); + let result = handler(args).unwrap(); + let address = result["Address"].as_str().unwrap().to_lowercase(); + assert!(address.starts_with("0xa"), "Address should start with 'a'"); + assert!(address.ends_with('b'), "Address should end with 'b'"); + } + + #[test] + fn test_mnemonic_generation() { + let args = parse_args(vec!["--starts-with", "a", "--mnemonic"]).unwrap(); + let result = handler(args).unwrap(); + + assert!(result["Mnemonic"].is_string(), "Mnemonic should be present"); + assert_eq!( + result["Mnemonic"] + .as_str() + .unwrap() + .split_whitespace() + .count(), + 24, + "Mnemonic should have 24 words" + ); + + let address = result["Address"].as_str().unwrap(); + assert!( + address.to_lowercase().starts_with("0xa"), + "Address should start with 'a'" + ); + } + + #[test] + fn test_save_path() { + let tmp = tempfile::NamedTempFile::new().unwrap(); + let args = parse_args(vec![ + "--starts-with", + "a", + "--save-path", + tmp.path().to_str().unwrap(), + ]) + .unwrap(); + + handler(args).unwrap(); + + assert!(tmp.path().exists(), "File should exist"); + let content = std::fs::read_to_string(tmp.path()).unwrap(); + let saved_result: serde_json::Value = serde_json::from_str(&content).unwrap(); + assert!( + saved_result["Address"].is_string(), + "Saved result should contain an Address" + ); + assert!( + saved_result["PrivateKey"].is_string(), + "Saved result should contain a PrivateKey" + ); + } +} diff --git a/forc-crypto/src/lib.rs b/forc-crypto/src/lib.rs new file mode 100644 index 0000000..7c89d84 --- /dev/null +++ b/forc-crypto/src/lib.rs @@ -0,0 +1,37 @@ +pub mod address; +pub mod args; +pub mod keccak256; +pub mod keys; +pub mod sha256; + +pub(crate) fn help() -> &'static str { + Box::leak( + format!( + "EXAMPLES:\n{}{}{}{}{}{}", + args::examples(), + address::examples(), + keys::new_key::examples(), + keys::parse_secret::examples(), + keys::get_public_key::examples(), + keys::vanity::examples(), + ) + .into_boxed_str(), + ) +} + +/// Forc plugin for hashing arbitrary data +#[derive(Debug, clap::Parser)] +#[clap( + name = "forc-crypto", + after_help = help(), + version +)] +pub enum Command { + Keccak256(args::HashArgs), + Sha256(args::HashArgs), + Address(address::Args), + GetPublicKey(keys::get_public_key::Arg), + NewKey(keys::new_key::Arg), + ParseSecret(keys::parse_secret::Arg), + Vanity(keys::vanity::Arg), +} diff --git a/forc-crypto/src/main.rs b/forc-crypto/src/main.rs new file mode 100644 index 0000000..ca38eeb --- /dev/null +++ b/forc-crypto/src/main.rs @@ -0,0 +1,70 @@ +//! A `forc` plugin for converting a given string or path to their hash. + +use anyhow::Result; +use clap::Parser; +use forc_crypto::{address, keccak256, keys, sha256, Command}; +use forc_tracing::{init_tracing_subscriber, println_error}; +use std::{ + default::Default, + io::{stdin, stdout, IsTerminal, Read, Write}, +}; +use termion::screen::IntoAlternateScreen; + +fn main() { + init_tracing_subscriber(Default::default()); + if let Err(err) = run() { + println_error(&format!("{err}")); + std::process::exit(1); + } +} + +fn run() -> Result<()> { + let app = Command::parse(); + let content = match app { + Command::Keccak256(arg) => keccak256::hash(arg)?, + Command::GetPublicKey(arg) => keys::get_public_key::handler(arg)?, + Command::Vanity(arg) => keys::vanity::handler(arg)?, + Command::Sha256(arg) => sha256::hash(arg)?, + Command::Address(arg) => address::dump_address(arg.address)?, + Command::NewKey(arg) => keys::new_key::handler(arg)?, + Command::ParseSecret(arg) => keys::parse_secret::handler(arg)?, + }; + + display_output(content) +} + +fn wait_for_keypress() { + let mut single_key = [0u8]; + stdin().read_exact(&mut single_key).unwrap(); +} + +fn has_sensible_info(message: &T) -> bool +where + T: serde::Serialize, +{ + match serde_json::to_value(message) { + Ok(serde_json::Value::Object(map)) => map.get("secret").is_some(), + _ => false, + } +} + +pub fn display_output(message: T) -> anyhow::Result<()> +where + T: serde::Serialize, +{ + if stdout().is_terminal() { + let text = serde_yaml::to_string(&message).expect("valid string"); + if has_sensible_info(&message) { + let mut screen = stdout().into_alternate_screen()?; + writeln!(screen, "{text}",)?; + screen.flush()?; + println!("### Do not share or lose this private key! Press any key to exit. ###"); + wait_for_keypress(); + } else { + println!("{text}"); + } + } else { + print!("{}", serde_json::to_string(&message).expect("valid json")); + } + Ok(()) +} diff --git a/forc-crypto/src/sha256.rs b/forc-crypto/src/sha256.rs new file mode 100644 index 0000000..38b984c --- /dev/null +++ b/forc-crypto/src/sha256.rs @@ -0,0 +1,9 @@ +use fuel_crypto::Hasher; +use serde_json::json; + +/// Hashes a given data to Sha256 +pub fn hash>>(data: T) -> anyhow::Result { + let mut hasher = Hasher::default(); + hasher.input(data.into()); + Ok(json!(hex::encode(hasher.finalize()))) +} diff --git a/forc-tracing/CHANGELOG.md b/forc-tracing/CHANGELOG.md new file mode 100644 index 0000000..19d5268 --- /dev/null +++ b/forc-tracing/CHANGELOG.md @@ -0,0 +1,13 @@ +# 0.71.0 (December 8th, 2025) + +### Changed + +- repo: migrated from `FuelLabs/sway` to `FuelLabs/forc` monorepo + +No functional changes from v0.70.2. + +# 0.70.2 (November 19th, 2025) + +- Previous release from `FuelLabs/sway` repository + +For historical changelog entries prior to the migration, see the [sway repository](https://github.com/FuelLabs/sway). diff --git a/forc-tracing/Cargo.toml b/forc-tracing/Cargo.toml new file mode 100644 index 0000000..63e97fa --- /dev/null +++ b/forc-tracing/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "forc-tracing" +# When releasing to crates.io: +# - Remove path dependencies +# - Update CHANGELOG.md. +# - Create "forc-tracing-0.71.x" git tag. +version = "0.71.0" +description = "Tracing utility shared between forc crates." +edition = "2021" +authors.workspace = true +homepage.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +ansiterm.workspace = true +regex.workspace = true +tracing.workspace = true +tracing-subscriber = { workspace = true, features = ["ansi", "env-filter", "json"] } + +[dev-dependencies] +serial_test.workspace = true +tracing-test.workspace = true + +[lints] +workspace = true diff --git a/forc-tracing/src/lib.rs b/forc-tracing/src/lib.rs new file mode 100644 index 0000000..2d4dd28 --- /dev/null +++ b/forc-tracing/src/lib.rs @@ -0,0 +1,413 @@ +//! Utility items shared between forc crates. + +use ansiterm::Colour; +use std::str; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::{env, io}; +use tracing::{Level, Metadata}; +pub use tracing_subscriber::{ + self, + filter::{filter_fn, EnvFilter, LevelFilter}, + fmt::{format::FmtSpan, MakeWriter}, + layer::SubscriberExt, +}; + +const ACTION_COLUMN_WIDTH: usize = 12; + +// Global flag to track if JSON output mode is active +static JSON_MODE_ACTIVE: AtomicBool = AtomicBool::new(false); + +/// Check if JSON mode is currently active +fn is_json_mode_active() -> bool { + JSON_MODE_ACTIVE.load(Ordering::SeqCst) +} + +/// Returns the indentation for the action prefix relative to [ACTION_COLUMN_WIDTH]. +fn get_action_indentation(action: &str) -> String { + if action.len() < ACTION_COLUMN_WIDTH { + " ".repeat(ACTION_COLUMN_WIDTH - action.len()) + } else { + String::new() + } +} + +enum TextStyle { + Plain, + Bold, + Label(String), + Action(String), +} + +enum LogLevel { + #[allow(dead_code)] + Trace, + Debug, + Info, + Warn, + Error, +} + +/// Common function to handle all kinds of output with color and styling +fn print_message(text: &str, color: Colour, style: TextStyle, level: LogLevel) { + let log_msg = match (is_json_mode_active(), style) { + // JSON mode formatting (no colors) + (true, TextStyle::Plain | TextStyle::Bold) => text.to_string(), + (true, TextStyle::Label(label)) => format!("{label}: {text}"), + (true, TextStyle::Action(action)) => { + let indent = get_action_indentation(&action); + format!("{indent}{action} {text}") + } + + // Normal mode formatting (with colors) + (false, TextStyle::Plain) => format!("{}", color.paint(text)), + (false, TextStyle::Bold) => format!("{}", color.bold().paint(text)), + (false, TextStyle::Label(label)) => format!("{} {}", color.bold().paint(label), text), + (false, TextStyle::Action(action)) => { + let indent = get_action_indentation(&action); + format!("{}{} {}", indent, color.bold().paint(action), text) + } + }; + + match level { + LogLevel::Trace => tracing::trace!("{}", log_msg), + LogLevel::Debug => tracing::debug!("{}", log_msg), + LogLevel::Info => tracing::info!("{}", log_msg), + LogLevel::Warn => tracing::warn!("{}", log_msg), + LogLevel::Error => tracing::error!("{}", log_msg), + } +} + +/// Prints a label with a green-bold label prefix like "Compiling ". +pub fn println_label_green(label: &str, txt: &str) { + print_message( + txt, + Colour::Green, + TextStyle::Label(label.to_string()), + LogLevel::Info, + ); +} + +/// Prints an action message with a green-bold prefix like " Compiling ". +pub fn println_action_green(action: &str, txt: &str) { + println_action(action, txt, Colour::Green); +} + +/// Prints a label with a red-bold label prefix like "error: ". +pub fn println_label_red(label: &str, txt: &str) { + print_message( + txt, + Colour::Red, + TextStyle::Label(label.to_string()), + LogLevel::Info, + ); +} + +/// Prints an action message with a red-bold prefix like " Removing ". +pub fn println_action_red(action: &str, txt: &str) { + println_action(action, txt, Colour::Red); +} + +/// Prints an action message with a yellow-bold prefix like " Finished ". +pub fn println_action_yellow(action: &str, txt: &str) { + println_action(action, txt, Colour::Yellow); +} + +fn println_action(action: &str, txt: &str, color: Colour) { + print_message( + txt, + color, + TextStyle::Action(action.to_string()), + LogLevel::Info, + ); +} + +/// Prints a warning message to stdout with the yellow prefix "warning: ". +pub fn println_warning(txt: &str) { + print_message( + txt, + Colour::Yellow, + TextStyle::Label("warning:".to_string()), + LogLevel::Warn, + ); +} + +/// Prints a warning message to stdout with the yellow prefix "warning: " only in verbose mode. +pub fn println_warning_verbose(txt: &str) { + print_message( + txt, + Colour::Yellow, + TextStyle::Label("warning:".to_string()), + LogLevel::Debug, + ); +} + +/// Prints a warning message to stderr with the red prefix "error: ". +pub fn println_error(txt: &str) { + print_message( + txt, + Colour::Red, + TextStyle::Label("error:".to_string()), + LogLevel::Error, + ); +} + +pub fn println_red(txt: &str) { + print_message(txt, Colour::Red, TextStyle::Plain, LogLevel::Info); +} + +pub fn println_green(txt: &str) { + print_message(txt, Colour::Green, TextStyle::Plain, LogLevel::Info); +} + +pub fn println_yellow(txt: &str) { + print_message(txt, Colour::Yellow, TextStyle::Plain, LogLevel::Info); +} + +pub fn println_green_bold(txt: &str) { + print_message(txt, Colour::Green, TextStyle::Bold, LogLevel::Info); +} + +pub fn println_yellow_bold(txt: &str) { + print_message(txt, Colour::Yellow, TextStyle::Bold, LogLevel::Info); +} + +pub fn println_yellow_err(txt: &str) { + print_message(txt, Colour::Yellow, TextStyle::Plain, LogLevel::Error); +} + +pub fn println_red_err(txt: &str) { + print_message(txt, Colour::Red, TextStyle::Plain, LogLevel::Error); +} + +const LOG_FILTER: &str = "RUST_LOG"; + +#[derive(PartialEq, Eq)] +pub enum TracingWriter { + /// Write ERROR and WARN to stderr and everything else to stdout. + Stdio, + /// Write everything to stdout. + Stdout, + /// Write everything to stderr. + Stderr, + /// Write everything as structured JSON to stdout. + Json, +} + +#[derive(Default)] +pub struct TracingSubscriberOptions { + pub verbosity: Option, + pub silent: Option, + pub log_level: Option, + pub writer_mode: Option, + pub regex_filter: Option, +} + +// This allows us to write ERROR and WARN level logs to stderr and everything else to stdout. +// https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html +impl<'a> MakeWriter<'a> for TracingWriter { + type Writer = Box; + + fn make_writer(&'a self) -> Self::Writer { + match self { + TracingWriter::Stderr => Box::new(io::stderr()), + // We must have an implementation of `make_writer` that makes + // a "default" writer without any configuring metadata. Let's + // just return stdout in that case. + _ => Box::new(io::stdout()), + } + } + + fn make_writer_for(&'a self, meta: &Metadata<'_>) -> Self::Writer { + // Here's where we can implement our special behavior. We'll + // check if the metadata's verbosity level is WARN or ERROR, + // and return stderr in that case. + if *self == TracingWriter::Stderr + || (*self == TracingWriter::Stdio && meta.level() <= &Level::WARN) + { + return Box::new(io::stderr()); + } + + // Otherwise, we'll return stdout. + Box::new(io::stdout()) + } +} + +/// A subscriber built from default `tracing_subscriber::fmt::SubscriberBuilder` such that it would match directly using `println!` throughout the repo. +/// +/// `RUST_LOG` environment variable can be used to set different minimum level for the subscriber, default is `INFO`. +pub fn init_tracing_subscriber(options: TracingSubscriberOptions) { + let env_filter = match env::var_os(LOG_FILTER) { + Some(_) => EnvFilter::try_from_default_env().expect("Invalid `RUST_LOG` provided"), + None => EnvFilter::new("info"), + }; + + let level_filter = options + .log_level + .or_else(|| { + options.verbosity.and_then(|verbosity| match verbosity { + 1 => Some(LevelFilter::DEBUG), // matches --verbose or -v + 2 => Some(LevelFilter::TRACE), // matches -vv + _ => None, + }) + }) + .or_else(|| { + options + .silent + .and_then(|silent| silent.then_some(LevelFilter::OFF)) + }); + + let writer_mode = match options.writer_mode { + Some(TracingWriter::Json) => { + JSON_MODE_ACTIVE.store(true, Ordering::SeqCst); + TracingWriter::Json + } + Some(TracingWriter::Stderr) => TracingWriter::Stderr, + _ => TracingWriter::Stdio, + }; + + let builder = tracing_subscriber::fmt::Subscriber::builder() + .with_env_filter(env_filter) + .with_ansi(true) + .with_level(false) + .with_file(false) + .with_line_number(false) + .without_time() + .with_target(false) + .with_writer(writer_mode); + + // Use regex to filter logs - if provided; otherwise allow all logs + let filter = filter_fn(move |metadata| { + if let Some(ref regex_filter) = options.regex_filter { + let regex = regex::Regex::new(regex_filter).unwrap(); + regex.is_match(metadata.target()) + } else { + true + } + }); + + match (is_json_mode_active(), level_filter) { + (true, Some(level)) => { + let subscriber = builder.json().with_max_level(level).finish().with(filter); + tracing::subscriber::set_global_default(subscriber).expect("setting subscriber failed"); + } + (true, None) => { + let subscriber = builder.json().finish().with(filter); + tracing::subscriber::set_global_default(subscriber).expect("setting subscriber failed"); + } + (false, Some(level)) => { + let subscriber = builder.with_max_level(level).finish().with(filter); + tracing::subscriber::set_global_default(subscriber).expect("setting subscriber failed"); + } + (false, None) => { + let subscriber = builder.finish().with(filter); + tracing::subscriber::set_global_default(subscriber).expect("setting subscriber failed"); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use serial_test::serial; + use tracing_test::traced_test; + + // Helper function to set up each test with consistent JSON mode state + fn setup_test() { + JSON_MODE_ACTIVE.store(false, Ordering::SeqCst); + } + + #[traced_test] + #[test] + #[serial] + fn test_println_label_green() { + setup_test(); + + let txt = "main.sw"; + println_label_green("Compiling", txt); + + // tracing-test escapes ANSI codes to literal text + assert!(logs_contain(r"\x1b[1;32mCompiling\x1b[0m main.sw")); + } + + #[traced_test] + #[test] + #[serial] + fn test_println_label_red() { + setup_test(); + + let txt = "main.sw"; + println_label_red("Error", txt); + + // tracing-test escapes ANSI codes to literal text + assert!(logs_contain(r"\x1b[1;31mError\x1b[0m main.sw")); + } + + #[traced_test] + #[test] + #[serial] + fn test_println_action_green() { + setup_test(); + + let txt = "main.sw"; + println_action_green("Compiling", txt); + + // tracing-test escapes ANSI codes to literal text + assert!(logs_contain(r" \x1b[1;32mCompiling\x1b[0m main.sw")); + } + + #[traced_test] + #[test] + #[serial] + fn test_println_action_green_long() { + setup_test(); + + let txt = "main.sw"; + println_action_green("Supercalifragilistic", txt); + + // tracing-test escapes ANSI codes to literal text + assert!(logs_contain( + r"\x1b[1;32mSupercalifragilistic\x1b[0m main.sw" + )); + } + + #[traced_test] + #[test] + #[serial] + fn test_println_action_red() { + setup_test(); + + let txt = "main"; + println_action_red("Removing", txt); + + // tracing-test escapes ANSI codes to literal text + assert!(logs_contain(r" \x1b[1;31mRemoving\x1b[0m main")); + } + + #[traced_test] + #[test] + #[serial] + fn test_json_mode_println_functions() { + setup_test(); + + JSON_MODE_ACTIVE.store(true, Ordering::SeqCst); + + // Call various print functions and capture the output + println_label_green("Label", "Value"); + assert!(logs_contain("Label: Value")); + + println_action_green("Action", "Target"); + assert!(logs_contain("Action")); + assert!(logs_contain("Target")); + + println_green("Green text"); + assert!(logs_contain("Green text")); + + println_warning("This is a warning"); + assert!(logs_contain("This is a warning")); + + println_error("This is an error"); + assert!(logs_contain("This is an error")); + + JSON_MODE_ACTIVE.store(false, Ordering::SeqCst); + } +} diff --git a/forc-wallet/Cargo.toml b/forc-wallet/Cargo.toml index 21a510c..cf6ebe3 100644 --- a/forc-wallet/Cargo.toml +++ b/forc-wallet/Cargo.toml @@ -13,23 +13,20 @@ license.workspace = true repository.workspace = true [dependencies] -anyhow = "1.0" -clap = { version = "4.2.4", features = ["derive"] } -eth-keystore = { version = "0.5" } -forc-tracing = "0.68" - -# Dependencies from the `fuels-rs` repository: -fuels.workspace = true - -futures = "0.3" -hex = "0.4" -home = "0.5.3" +anyhow.workspace = true +clap = { workspace = true, features = ["derive"] } +eth-keystore.workspace = true +forc-tracing = "0.70.2" +fuels = "0.75" +futures.workspace = true +hex.workspace = true +home.workspace = true rand = { version = "0.8", default-features = false } -rpassword = "7.2" -serde_json = "1.0" -termion = "4.0" -tokio = { version = "1.44", features = ["full"] } -url = "2.5" +rpassword.workspace = true +serde_json.workspace = true +termion.workspace = true +tokio = { workspace = true, features = ["full"] } +url.workspace = true [lib] name = "forc_wallet"