summary refs log tree commit diff
path: root/pkgs/applications/blockchains/lighthouse
diff options
context:
space:
mode:
authorAlex Wied <centromere@users.noreply.github.com>2022-08-29 17:34:33 -0400
committerAlex Wied <centromere@users.noreply.github.com>2022-10-03 17:44:35 -0400
commit59e3addfebc751fa3f9843dda1a831591bb86c3f (patch)
tree7a94f5a9b11fa9e90ff6a2a681a5a53a46495783 /pkgs/applications/blockchains/lighthouse
parent9b6e32ee67b4a556b4642f9fa1c91b9ebc7fc518 (diff)
lighthouse: init at 3.1.2
Diffstat (limited to 'pkgs/applications/blockchains/lighthouse')
-rw-r--r--pkgs/applications/blockchains/lighthouse/default.nix103
1 files changed, 103 insertions, 0 deletions
diff --git a/pkgs/applications/blockchains/lighthouse/default.nix b/pkgs/applications/blockchains/lighthouse/default.nix
new file mode 100644
index 0000000000000..fc95295d3d9e6
--- /dev/null
+++ b/pkgs/applications/blockchains/lighthouse/default.nix
@@ -0,0 +1,103 @@
+{ clang
+, cmake
+, fetchFromGitHub
+, fetchurl
+, lib
+, lighthouse
+, llvmPackages
+, nodePackages
+, perl
+, protobuf
+, rustPlatform
+, Security
+, stdenv
+, testers
+, unzip
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "lighthouse";
+  version = "3.1.2";
+
+  # lighthouse/common/deposit_contract/build.rs
+  depositContractSpecVersion = "0.12.1";
+  testnetDepositContractSpecVersion = "0.9.2.1";
+
+  src = fetchFromGitHub {
+    owner = "sigp";
+    repo = "lighthouse";
+    rev = "v${version}";
+    hash = "sha256-EJFg6ZjxxijxJNMwKRh0cYeqwujUV3OJgXBvBRsnbVI=";
+  };
+
+  cargoHash = "sha256-iXqRtBqvM9URQsL8qGmpr3CNX2fpbtDOaluibAX/lWo=";
+
+  buildFeatures = [ "modern" "gnosis" ];
+
+  nativeBuildInputs = [ clang cmake perl protobuf ];
+
+  buildInputs = lib.optionals stdenv.isDarwin [
+    Security
+  ];
+
+  LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
+
+  depositContractSpec = fetchurl {
+    url = "https://raw.githubusercontent.com/ethereum/eth2.0-specs/v${depositContractSpecVersion}/deposit_contract/contracts/validator_registration.json";
+    hash = "sha256-ZslAe1wkmkg8Tua/AmmEfBmjqMVcGIiYHwi+WssEwa8=";
+  };
+
+  testnetDepositContractSpec = fetchurl {
+    url = "https://raw.githubusercontent.com/sigp/unsafe-eth2-deposit-contract/v${testnetDepositContractSpecVersion}/unsafe_validator_registration.json";
+    hash = "sha256-aeTeHRT3QtxBRSNMCITIWmx89vGtox2OzSff8vZ+RYY=";
+  };
+
+  LIGHTHOUSE_DEPOSIT_CONTRACT_SPEC_URL = "file://${depositContractSpec}";
+  LIGHTHOUSE_DEPOSIT_CONTRACT_TESTNET_URL = "file://${testnetDepositContractSpec}";
+
+  cargoBuildFlags = [
+    "--package lighthouse"
+  ];
+
+  __darwinAllowLocalNetworking = true;
+
+  checkFeatures = [ ];
+
+  # All of these tests require network access
+  cargoTestFlags = [
+    "--workspace"
+    "--exclude beacon_node"
+    "--exclude http_api"
+    "--exclude beacon_chain"
+    "--exclude lighthouse"
+    "--exclude lighthouse_network"
+    "--exclude slashing_protection"
+    "--exclude web3signer_tests"
+  ];
+
+  # All of these tests require network access
+  checkFlags = [
+    "--skip service::tests::tests::test_dht_persistence"
+    "--skip time::test::test_reinsertion_updates_timeout"
+  ] ++ lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [
+    "--skip subnet_service::tests::sync_committee_service::same_subscription_with_lower_until_epoch"
+    "--skip subnet_service::tests::sync_committee_service::subscribe_and_unsubscribe"
+  ];
+
+  checkInputs = [
+    nodePackages.ganache
+  ];
+
+  passthru.tests.version = testers.testVersion {
+    package = lighthouse;
+    command = "lighthouse --version";
+    version = "v${lighthouse.version}";
+  };
+
+  meta = with lib; {
+    description = "Ethereum consensus client in Rust";
+    homepage = "https://lighthouse.sigmaprime.io/";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ centromere pmw ];
+  };
+}