diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 66fb4aecad..099fec055d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,11 +26,16 @@ jobs: - uses: actions/checkout@v4 name: Checkout Repository + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + components: rustfmt + - uses: Swatinem/rust-cache@v2 name: Enable Rust Caching - name: Format Check - run: cargo fmt -- --check + run: cargo +nightly fmt -- --check - name: Check (embedded-db) run: | diff --git a/.typos.toml b/.typos.toml index bd8457462f..eee48b9695 100644 --- a/.typos.toml +++ b/.typos.toml @@ -11,5 +11,6 @@ extend-exclude = [ "contract-bindings-alloy", "contract-bindings-ethers", "node-metrics/src/api/node_validator/v0/example_prometheus_metrics_output.txt", - "hotshot-orchestrator/run-config.toml" + "hotshot-orchestrator/run-config.toml", + "hotshot-macros/src/lib.rs" ] diff --git a/flake.nix b/flake.nix index c735c6e7b9..1e6a605157 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,10 @@ }; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.nixpkgs-legacy-foundry.url = "github:NixOS/nixpkgs/9abb87b552b7f55ac8916b6fc9e5cb486656a2f3"; + + inputs.foundry-nix.url = "github:shazow/foundry.nix/monthly"; # Use monthly branch for permanent releases + inputs.rust-overlay.url = "github:oxalica/rust-overlay"; inputs.nixpkgs-cross-overlay.url = @@ -29,6 +33,8 @@ outputs = { self , nixpkgs + , nixpkgs-legacy-foundry + , foundry-nix , rust-overlay , nixpkgs-cross-overlay , flake-utils @@ -61,6 +67,7 @@ overlays = [ (import rust-overlay) + foundry-nix.overlay solc-bin.overlays.default (final: prev: { solhint = @@ -186,7 +193,7 @@ buildInputs = [ # Rust dependencies pkg-config - openssl_3 # match ubuntu 24.04 that we use on CI and as base image in docker + openssl curl protobuf # to compile libp2p-autonat stableToolchain @@ -217,25 +224,7 @@ coreutils # Ethereum contracts, solidity, ... - # TODO: remove alloy patch when forge includes this fix: https://github.com/alloy-rs/core/pull/864 - # foundry - (foundry.overrideAttrs { - # Set the resolve limit to 128 by replacing the value in the vendored dependencies. - postPatch = '' - pushd $cargoDepsCopy/alloy-sol-macro-expander - - oldHash=$(sha256sum src/expand/mod.rs | cut -d " " -f 1) - - substituteInPlace src/expand/mod.rs \ - --replace-warn \ - 'const RESOLVE_LIMIT: usize = 32;' 'const RESOLVE_LIMIT: usize = 128;' - - substituteInPlace .cargo-checksum.json \ - --replace-warn $oldHash $(sha256sum src/expand/mod.rs | cut -d " " -f 1) - - popd - ''; - }) + foundry-bin solc nodePackages.prettier solhint @@ -255,10 +244,28 @@ # Add rust binaries to PATH for native demo export PATH="$PWD/$CARGO_TARGET_DIR/debug:$PATH" + + # Needed to compile with the sqlite-unbundled feature + export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; '' + self.checks.${system}.pre-commit-check.shellHook; RUST_SRC_PATH = "${stableToolchain}/lib/rustlib/src/rust/library"; FOUNDRY_SOLC = "${solc}/bin/solc"; }); + # A shell with foundry v0.3.0 which can still build ethers-rs bindings. + # Can be removed when we are no longer using the ethers-rs bindings. + devShells.legacyFoundry = + let + overlays = [ + solc-bin.overlays.default + ]; + pkgs = import nixpkgs-legacy-foundry { inherit system overlays; }; + in + mkShell { + packages = with pkgs; [ + solc + foundry + ]; + }; devShells.crossShell = crossShell { config = "x86_64-unknown-linux-musl"; }; devShells.armCrossShell = @@ -273,7 +280,7 @@ buildInputs = [ # Rust dependencies pkg-config - openssl_3 + openssl curl protobuf # to compile libp2p-autonat toolchain @@ -287,7 +294,7 @@ buildInputs = [ # Rust dependencies pkg-config - openssl_3 + openssl curl protobuf # to compile libp2p-autonat toolchain @@ -310,7 +317,7 @@ buildInputs = [ # Rust dependencies pkg-config - openssl_3 + openssl curl protobuf # to compile libp2p-autonat stableToolchain