Skip to content

Commit

Permalink
reth: 0.2.0-beta.6 -> 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbot95 committed Sep 7, 2024
1 parent 0f87d1c commit 21a7082
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 50 deletions.
48 changes: 45 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.treefmt-nix.follows = "treefmt-nix";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs @ {
Expand Down Expand Up @@ -95,6 +103,7 @@
pkgsUnstable = lib.extras.nix.mkNixpkgs {
inherit system;
nixpkgs = inputs.nixpkgs-unstable;
overlays = [(import inputs.rust-overlay)];
};
pkgs2311 = lib.extras.nix.mkNixpkgs {
inherit system;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
nethermind = callPackageUnstable ./nethermind {};
nimbus = callPackageUnstable ./nimbus {};
prysm = callPackage ./prysm {inherit bls blst;};
reth = callPackageUnstable ./reth {};
reth = callPackageUnstable ./reth {inherit (inputs) crane;};
rocketpool = callPackage ./rocketpool {};
rocketpoold = callPackage ./rocketpoold {inherit bls blst;};
rotki-bin = callPackage2311 ./rotki-bin {};
Expand Down
108 changes: 62 additions & 46 deletions pkgs/reth/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,69 @@
lib,
rustPlatform,
stdenv,
}:
rustPlatform.buildRustPackage rec {
pname = "reth";
version = "0.2.0-beta.6";

src = fetchFromGitHub {
owner = "paradigmxyz";
repo = pname;
rev = "v${version}";
hash = "sha256-ZcQ29AwlTU6rDiknlJbOo8JubXQOJg1UVMSlRb1l8Yk=";
};
pkgs,
crane,
cargo-nextest,
}: let
craneLib = (crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.stable.latest.default);
commonArgs = rec {
pname = "reth";
version = "1.0.1";

cargoLock = {
lockFile = "${src}/Cargo.lock";
outputHashes = {
"alloy-consensus-0.1.0" = "sha256-2TZeQo0d+Yp0M46VNx3OZoyDT4F31cLdOpl1tk3syfg=";
"discv5-0.4.1" = "sha256-agrluN1C9/pS/IMFTVlPOuYl3ZuklnTYb46duVvTPio=";
"revm-inspectors-0.1.0" = "sha256-ZRlYNEHD+wewlttUcMuEoTYg9Hn89JVAr7+hIeMBXog=";
src = fetchFromGitHub {
owner = "paradigmxyz";
repo = pname;
rev = "v${version}";
hash = "sha256-GqBNyPeXIN7q2m3SkhP4BUYXyEQYlkP0JH/pKgEvf7k=";
};
};
strictDeps = true;

nativeBuildInputs = [
rustPlatform.bindgenHook
];

# `x86_64-darwin` seems to have issues with jemalloc
buildNoDefaultFeatures = true;
buildFeatures = lib.optional (stdenv.system != "x86_64-darwin") "jemalloc";

buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];

# Some tests fail due to I/O that is unfriendly with nix sandbox.
checkFlags = [
"--skip=builder::tests::block_number_node_config_test"
"--skip=builder::tests::launch_multiple_nodes"
"--skip=builder::tests::rpc_handles_none_without_http"
"--skip=cli::tests::override_trusted_setup_file"
"--skip=cli::tests::parse_env_filter_directives"
];

meta = with lib; {
description = "Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust";
homepage = "https://github.com/paradigmxyz/reth";
license = with licenses; [mit asl20];
mainProgram = "reth";
platforms = ["aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux"];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];

nativeBuildInputs = [
# Doesn't actually depend on rust version, so using this hook from nixpkgs is fine
rustPlatform.bindgenHook
];
};
}
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.buildPackage (commonArgs
// {
inherit cargoArtifacts;

nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
cargo-nextest
];

# `x86_64-darwin` seems to have issues with jemalloc
cargoExtraArgs =
"--no-default-features"
+ (
if stdenv.system != "x86_64-darwin"
then " --features jemalloc"
else ""
);

cargoTestCommand = "cargo nextest run";
cargoTestExtraArgs = builtins.concatStringsSep " " [
"--hide-progress-bar"
"--workspace"
"--exclude ef-tests"
"-E"
# Only run unit tests (`!kind(test)`) and skip several tests which can't run within the nix sandbox
"'!kind(test) - test(cli::tests::parse_env_filter_directives) - test(tests::test_exex) - test(auth_layer::tests::test_jwt_layer)'"
];

# https://crane.dev/faq/rebuilds-bindgen.html
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";

meta = with lib; {
description = "Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust";
homepage = "https://github.com/paradigmxyz/reth";
license = with licenses; [mit asl20];
mainProgram = "reth";
platforms = ["aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux"];
};
})

0 comments on commit 21a7082

Please sign in to comment.