From dcddff81d49362e4b5b4f689fd7cbcf540f40cd6 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Tue, 23 Mar 2021 19:41:54 +1000 Subject: [PATCH 01/22] flakified KEVM / EVM --- flake.lock | 79 +++++++++++++++++++++ flake.nix | 81 +++++++++++++++++++++ nix/default.nix | 25 ------- nix/entrypoint.nix | 8 +++ nix/entrypoint.sh | 33 +++++++++ nix/pkgs/default.nix | 9 --- nix/pkgs/kevm.nix | 25 +++++++ nix/pkgs/mantis/default.nix | 6 +- nix/pkgs/mantis/wrapped.nix | 8 ++- nix/sources.json | 74 -------------------- nix/sources.nix | 136 ------------------------------------ 11 files changed, 233 insertions(+), 251 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 nix/default.nix create mode 100644 nix/entrypoint.nix create mode 100644 nix/entrypoint.sh delete mode 100644 nix/pkgs/default.nix create mode 100644 nix/pkgs/kevm.nix delete mode 100644 nix/sources.json delete mode 100644 nix/sources.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..fbced7baae --- /dev/null +++ b/flake.lock @@ -0,0 +1,79 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1614513358, + "narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5466c5bbece17adaab2d82fae80b46e807611bf3", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1610118011, + "narHash": "sha256-a17vwGBOqmAsy/Wkvf10ygDyfgjJpvlPyNnf7SAk+Ac=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a98302aa9b9628915878a6ea9776c40a0bb02950", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a98302aa9b9628915878a6ea9776c40a0bb02950", + "type": "github" + } + }, + "nixpkgs-sbt": { + "flake": false, + "locked": { + "lastModified": 1591564272, + "narHash": "sha256-Z+4hmPx21+vYx9jp19+3jaT/Whl8IzmH1G/fGyFv7FY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e2bb73ce5f786b83e984b80199112f86b8a6cc9d", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e2bb73ce5f786b83e984b80199112f86b8a6cc9d", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs-sbt": "nixpkgs-sbt", + "sbtix": "sbtix" + } + }, + "sbtix": { + "flake": false, + "locked": { + "lastModified": 1563807309, + "narHash": "sha256-L8EW6s/21q3R2VmjNngfkl80sOas4BWHTxssM2o+76Y=", + "owner": "input-output-hk", + "repo": "Sbtix", + "rev": "7b969a5641fce10500ca51cbe88af4ea160d7064", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "Sbtix", + "rev": "7b969a5641fce10500ca51cbe88af4ea160d7064", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..3aca3871e4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,81 @@ +{ + description = "Mantis flake"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = + "github:nixos/nixpkgs?rev=a98302aa9b9628915878a6ea9776c40a0bb02950"; + nixpkgs-sbt = { + url = "github:nixos/nixpkgs?rev=e2bb73ce5f786b83e984b80199112f86b8a6cc9d"; + flake = false; + }; + sbtix = { + url = + "github:input-output-hk/Sbtix?rev=7b969a5641fce10500ca51cbe88af4ea160d7064"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, flake-utils, nixpkgs-sbt, ... }@inputs: + let + overlay = final: prev: { + inherit (import nixpkgs-sbt { inherit (final) system; }) sbt; + sbtix = final.callPackage ./sbtix.nix { }; + + mantisPkgs = final.callPackage ./nix/pkgs/mantis { + src = builtins.fetchGit { + url = "https://github.com/input-output-hk/mantis"; + rev = self.rev or "482340d5e6ab635e5a5047e9b670d59b4ad366c2"; + ref = "develop"; + submodules = true; + }; + }; + + jdk = prev.openjdk8_headless; + jre = prev.openjdk8_headless.jre; + + inherit (final.mantisPkgs) mantis; + + kevm = final.callPackage ./nix/pkgs/kevm.nix { }; + + mantis-entrypoint = final.callPackage ./nix/entrypoint.nix { }; + }; + + pkgsForSystem = system: + (import nixpkgs) { + inherit system; + overlays = [ overlay ]; + }; + + mkHydraUtils = mkPkgs: + let + # nothing in lib should really depend on the system + libPkgs = mkPkgs "x86_64-linux"; + # [attrset] -> attrset + recursiveMerge = libPkgs.lib.foldr libPkgs.lib.recursiveUpdate { }; + mkHydraJobsForSystem = attrs: system: + recursiveMerge + (map (n: { "${n}"."${system}" = (mkPkgs system)."${n}"; }) attrs); + in { + collectHydraSets = jobSets: { hydraJobs = recursiveMerge jobSets; }; + mkHydraSet = attrs: systems: + recursiveMerge (map (mkHydraJobsForSystem attrs) systems); + }; + + hydraUtils = mkHydraUtils pkgsForSystem; + inherit (hydraUtils) collectHydraSets mkHydraSet; + + in flake-utils.lib.eachDefaultSystem (system: rec { + pkgs = pkgsForSystem system; + legacyPackages = pkgs; + + defaultPackage = pkgs.mantis; + devShell = pkgs.mkShell { nativeBuildInputs = with pkgs; [ solc sbt ]; }; + apps.mantis = flake-utils.lib.mkApp { drv = pkgs.mantis; }; + defaultApp = apps.mantis; + }) // (collectHydraSets [ + (mkHydraSet [ "mantis" ] [ "x86_64-linux" "x86_64-darwin" ]) + (mkHydraSet [ "kevm" ] [ "x86_64-linux" ]) + (mkHydraSet [ "mantis-entrypoint" ] [ "x86_64-linux" ]) + ]); +} diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index c8c53cef9f..0000000000 --- a/nix/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ system ? builtins.currentSystem, sources ? import ./sources.nix, src ? ../. }: - -let - overlay = final: prev: { - inherit sources; - inherit (import sources.gitignore { inherit (prev) lib; }) gitignoreSource; - - sbtix = prev.callPackage ../sbtix.nix { - jdk = prev.openjdk8_headless; - jre = prev.openjdk8_headless.jre; - }; - - mantisPkgs = final.callPackage ./pkgs/mantis { - inherit (prev.openjdk8_headless) jre; - inherit src; - }; - - inherit (final.mantisPkgs) mantis; - - mkSrc = import sources.nix-mksrc { inherit (final) lib; }; - }; -in import sources.nixpkgs { - inherit system; - overlays = [ overlay ]; -} diff --git a/nix/entrypoint.nix b/nix/entrypoint.nix new file mode 100644 index 0000000000..5e46dc78ba --- /dev/null +++ b/nix/entrypoint.nix @@ -0,0 +1,8 @@ +{ lib, writeShellScript, awscli, mantis-kevm, coreutils, gnugrep }: +writeShellScript "mantis" '' + set -exuo pipefail + + export PATH="${lib.makeBinPath [ coreutils mantis-kevm awscli gnugrep ]}" + + ${builtins.readFile ./entrypoint.sh} +'' diff --git a/nix/entrypoint.sh b/nix/entrypoint.sh new file mode 100644 index 0000000000..73fae1308e --- /dev/null +++ b/nix/entrypoint.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -exuo pipefail + +mkdir -p /tmp "$NOMAD_TASK_DIR/mantis" +cd "$NOMAD_TASK_DIR" + +if [ -n "${DAG_NAME:-}" ]; then + if [ -f "ethash/$DAG_NAME" ]; then + echo "found existing DAG" + sha256sum "ethash/$DAG_NAME" + else + mkdir -p ethash + aws \ + --endpoint-url "$MONITORING_ADDR" \ + s3 cp \ + "s3://mantis-kevm-dag/$DAG_NAME" \ + "ethash/$DAG_NAME" \ + || echo "Unable to download DAG, skipping." + fi +fi + +set +x +echo "Waiting for $REQUIRED_PEER_COUNT peers to show up in the config" +until [ "$(grep -c enode mantis.conf)" -ge "$REQUIRED_PEER_COUNT" ]; do + sleep 1 +done +set -x + +ulimit -c unlimited +cp mantis.conf running.conf + +exec mantis "-Duser.home=$NOMAD_TASK_DIR" "$@" diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix deleted file mode 100644 index 9f402da515..0000000000 --- a/nix/pkgs/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, lib, newScope, sources, src, impure ? false }: - -lib.makeScope newScope (self: - with self; - let callPackages = lib.callPackagesWith (pkgs // self); - in { - inherit sources src impure; - jdk = prev.openjdk8_headless; - }) diff --git a/nix/pkgs/kevm.nix b/nix/pkgs/kevm.nix new file mode 100644 index 0000000000..a452ffbcfb --- /dev/null +++ b/nix/pkgs/kevm.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, dockerTools, secp256k1, gmp5, mpfr, zlib }: +let libPath = lib.makeLibraryPath [ secp256k1 gmp5 mpfr zlib ]; +in stdenv.mkDerivation { + name = "kevm"; + + src = dockerTools.pullImage { + imageName = "inputoutput/mantis"; + imageDigest = + "sha256:594ed009f1bc1f12b86e11136441602107c3d580476002d9bae58b258a74ac1b"; + sha256 = "sha256-JT+FarGQlgYoO392Ne1ofdqmishZLfH+OwV2CXTYwdA="; + }; + + installPhase = '' + mkdir -p tmp $out/bin + tar --delay-directory-restore -C tmp -xf layer.tar || true + + cp tmp/bin/kevm-vm $out/bin + chmod 0755 $out/bin/kevm-vm + + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${libPath}" \ + "$out/bin/kevm-vm" + ''; +} diff --git a/nix/pkgs/mantis/default.nix b/nix/pkgs/mantis/default.nix index 6ff24989e7..ffd6c83856 100644 --- a/nix/pkgs/mantis/default.nix +++ b/nix/pkgs/mantis/default.nix @@ -1,8 +1,6 @@ -{ src, mkSrc, lib, gitignoreSource, callPackage, jre }: rec { +{ src, lib, callPackage, jre }: rec { - mantis-source = mkSrc src; - - mantis-unwrapped = callPackage ./unwrapped.nix { src = mantis-source; }; + mantis-unwrapped = callPackage ./unwrapped.nix { inherit src; }; mantis = callPackage ./wrapped.nix { mantis = mantis-unwrapped; diff --git a/nix/pkgs/mantis/wrapped.nix b/nix/pkgs/mantis/wrapped.nix index 135da02d1f..d92805fe82 100644 --- a/nix/pkgs/mantis/wrapped.nix +++ b/nix/pkgs/mantis/wrapped.nix @@ -1,9 +1,9 @@ -{ lib, stdenv, mantis, makeWrapper, jre, gawk }: +{ lib, stdenv, mantis, makeWrapper, jre, gawk, gnused, kevm }: let inherit (stdenv.lib) optionalString makeLibraryPath; inherit (stdenv) cc isDarwin; LD_LIBRARY_PATH = makeLibraryPath [ cc.cc.lib ]; - PATH = lib.makeBinPath [ jre gawk ]; + PATH = lib.makeBinPath [ jre gawk gnused kevm ]; in stdenv.mkDerivation { pname = "mantis"; version = let @@ -23,11 +23,13 @@ in stdenv.mkDerivation { for p in $(find $out/bin/* -executable); do wrapProgram "$p" \ - --prefix PATH : ${PATH} \ + --set PATH ${PATH} \ ${ optionalString (!isDarwin) "--prefix LD_LIBRARY_PATH : ${LD_LIBRARY_PATH}" } done + + ln -s ${kevm}/bin/kevm-vm $out/bin ''; } diff --git a/nix/sources.json b/nix/sources.json deleted file mode 100644 index ea990796c7..0000000000 --- a/nix/sources.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "Sbtix": { - "branch": "master", - "description": "Generates Nix definitions for your SBT builds", - "homepage": null, - "owner": "input-output-hk", - "repo": "Sbtix", - "rev": "7b969a5641fce10500ca51cbe88af4ea160d7064", - "sha256": "19pg7rm36b0v9y3ibq5cwsq38pwj3xw3d8srv78svmpnrzm1dh9g", - "type": "tarball", - "url": "https://github.com/input-output-hk/Sbtix/archive/7b969a5641fce10500ca51cbe88af4ea160d7064.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "gitignore": { - "branch": "master", - "description": "Nix function for filtering local git sources", - "homepage": "", - "owner": "hercules-ci", - "repo": "gitignore", - "rev": "ec5dd0536a5e4c3a99c797b86180f7261197c124", - "sha256": "0k2r8y21rn4kr5dmddd3906x0733fs3bb8hzfpabkdav3wcy3klv", - "type": "tarball", - "url": "https://github.com/hercules-ci/gitignore/archive/ec5dd0536a5e4c3a99c797b86180f7261197c124.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "niv": { - "branch": "master", - "description": "Easy dependency management for Nix projects", - "homepage": "https://github.com/nmattia/niv", - "owner": "nmattia", - "repo": "niv", - "rev": "f73bf8d584148677b01859677a63191c31911eae", - "sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs", - "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nix-mksrc": { - "branch": "master", - "description": null, - "homepage": "", - "owner": "input-output-hk", - "repo": "nix-mksrc", - "rev": "c446c2da50209f06d75df9f06f9faa738939b54d", - "sha256": "1mnp88fvg9rkl211zsg1mjkx0kk63l9q4fdy3a4avbq8z9bjb1gf", - "type": "tarball", - "url": "https://github.com/input-output-hk/nix-mksrc/archive/c446c2da50209f06d75df9f06f9faa738939b54d.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixkite": { - "branch": "master", - "description": "Nixkite is a Buildkite pipeline generation tool using the NixOS module system", - "homepage": null, - "owner": "input-output-hk", - "repo": "nixkite", - "rev": "11c40d1591e294a2da275aaeb9e21a45319a4673", - "sha256": "1cfiqv4n54g9xkm5zvypxfrr8ajpbggvpjn6dp1l9kfc2aknpgiz", - "type": "tarball", - "url": "https://github.com/input-output-hk/nixkite/archive/11c40d1591e294a2da275aaeb9e21a45319a4673.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs": { - "branch": "nixos-20.03", - "description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels", - "homepage": null, - "owner": "NixOS", - "repo": "nixpkgs-channels", - "rev": "e2bb73ce5f786b83e984b80199112f86b8a6cc9d", - "sha256": "0mpcdwhippvgsj3kj8vw35dgz94dnzgxgsfqqzcfpmvnzjc23vk7", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs-channels/archive/e2bb73ce5f786b83e984b80199112f86b8a6cc9d.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - } -} diff --git a/nix/sources.nix b/nix/sources.nix deleted file mode 100644 index 718ea6fe26..0000000000 --- a/nix/sources.nix +++ /dev/null @@ -1,136 +0,0 @@ -# This file has been generated by Niv. - -let - - # - # The fetchers. fetch_ fetches specs of type . - # - - fetch_file = pkgs: spec: - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; } - else - pkgs.fetchurl { inherit (spec) url sha256; }; - - fetch_tarball = pkgs: spec: - if spec.builtin or true then - builtins_fetchTarball { inherit (spec) url sha256; } - else - pkgs.fetchzip { inherit (spec) url sha256; }; - - fetch_git = spec: - builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; - - fetch_builtin-tarball = spec: - builtins.trace - '' - WARNING: - The niv type "builtin-tarball" will soon be deprecated. You should - instead use `builtin = true`. - - $ niv modify -a type=tarball -a builtin=true - '' - builtins_fetchTarball { inherit (spec) url sha256; }; - - fetch_builtin-url = spec: - builtins.trace - '' - WARNING: - The niv type "builtin-url" will soon be deprecated. You should - instead use `builtin = true`. - - $ niv modify -a type=file -a builtin=true - '' - (builtins_fetchurl { inherit (spec) url sha256; }); - - # - # Various helpers - # - - # The set of packages used when specs are fetched using non-builtins. - mkPkgs = sources: - if hasNixpkgsPath - then - if hasThisAsNixpkgsPath - then import (builtins_fetchTarball { inherit (mkNixpkgs sources) url sha256; }) {} - else import {} - else - import (builtins_fetchTarball { inherit (mkNixpkgs sources) url sha256; }) {}; - - mkNixpkgs = sources: - if builtins.hasAttr "nixpkgs" sources - then sources.nixpkgs - else abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - hasNixpkgsPath = (builtins.tryEval ).success; - hasThisAsNixpkgsPath = - (builtins.tryEval ).success && == ./.; - - # The actual fetching function. - fetch = pkgs: name: spec: - - if ! builtins.hasAttr "type" spec then - abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then fetch_file pkgs spec - else if spec.type == "tarball" then fetch_tarball pkgs spec - else if spec.type == "git" then fetch_git spec - else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec - else if spec.type == "builtin-url" then fetch_builtin-url spec - else - abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; - - # Ports of functions for older nix versions - - # a Nix version of mapAttrs if the built-in doesn't exist - mapAttrs = builtins.mapAttrs or ( - f: set: with builtins; - listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) - ); - - # fetchTarball version that is compatible between all the versions of Nix - builtins_fetchTarball = { url, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchTarball; - in - if lessThan nixVersion "1.12" then - fetchTarball { inherit url; } - else - fetchTarball attrs; - - # fetchurl version that is compatible between all the versions of Nix - builtins_fetchurl = { url, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchurl; - in - if lessThan nixVersion "1.12" then - fetchurl { inherit url; } - else - fetchurl attrs; - - # Create the final "sources" from the config - mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = fetch config.pkgs name spec; } - ) config.sources; - - # The "config" used by the fetchers - mkConfig = - { sourcesFile ? ./sources.json - }: rec { - # The sources, i.e. the attribute set of spec name to spec - sources = builtins.fromJSON (builtins.readFile sourcesFile); - # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers - pkgs = mkPkgs sources; - }; -in -mkSources (mkConfig {}) // - { __functor = _: settings: mkSources (mkConfig settings); } From 843f141470dc828d52ce137b4cc62a907d314afd Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Tue, 23 Mar 2021 22:46:53 +1000 Subject: [PATCH 02/22] Fixed the VMs --- flake.nix | 2 +- nix/entrypoint.nix | 4 ++-- nix/pkgs/mantis/wrapped.nix | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 3aca3871e4..45423efbdc 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,7 @@ src = builtins.fetchGit { url = "https://github.com/input-output-hk/mantis"; rev = self.rev or "482340d5e6ab635e5a5047e9b670d59b4ad366c2"; - ref = "develop"; + ref = "3.1.0-flake"; submodules = true; }; }; diff --git a/nix/entrypoint.nix b/nix/entrypoint.nix index 5e46dc78ba..2a70631b8b 100644 --- a/nix/entrypoint.nix +++ b/nix/entrypoint.nix @@ -1,8 +1,8 @@ -{ lib, writeShellScript, awscli, mantis-kevm, coreutils, gnugrep }: +{ lib, writeShellScript, awscli, mantis, coreutils, gnugrep }: writeShellScript "mantis" '' set -exuo pipefail - export PATH="${lib.makeBinPath [ coreutils mantis-kevm awscli gnugrep ]}" + export PATH="${lib.makeBinPath [ coreutils mantis awscli gnugrep ]}" ${builtins.readFile ./entrypoint.sh} '' diff --git a/nix/pkgs/mantis/wrapped.nix b/nix/pkgs/mantis/wrapped.nix index d92805fe82..a80c63e0c6 100644 --- a/nix/pkgs/mantis/wrapped.nix +++ b/nix/pkgs/mantis/wrapped.nix @@ -1,9 +1,9 @@ -{ lib, stdenv, mantis, makeWrapper, jre, gawk, gnused, kevm }: +{ lib, stdenv, mantis, makeWrapper, jre, gawk, gnused, kevm, coreutils }: let inherit (stdenv.lib) optionalString makeLibraryPath; inherit (stdenv) cc isDarwin; LD_LIBRARY_PATH = makeLibraryPath [ cc.cc.lib ]; - PATH = lib.makeBinPath [ jre gawk gnused kevm ]; + PATH = lib.makeBinPath [ jre gawk gnused kevm coreutils ]; in stdenv.mkDerivation { pname = "mantis"; version = let From ccb2dd70efa26b4e2512861718453260a0a3ed13 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Tue, 23 Mar 2021 18:57:08 +0100 Subject: [PATCH 03/22] attempt entrypoint fix --- nix/entrypoint.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/entrypoint.nix b/nix/entrypoint.nix index 2a70631b8b..4312201380 100644 --- a/nix/entrypoint.nix +++ b/nix/entrypoint.nix @@ -1,5 +1,5 @@ -{ lib, writeShellScript, awscli, mantis, coreutils, gnugrep }: -writeShellScript "mantis" '' +{ lib, writeShellScriptBin, awscli, mantis, coreutils, gnugrep }: +writeShellScriptBin "mantis-entrypoint" '' set -exuo pipefail export PATH="${lib.makeBinPath [ coreutils mantis awscli gnugrep ]}" From a338dcf27226df147015997288efa5b61ce3fdc7 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Tue, 23 Mar 2021 23:49:45 +0100 Subject: [PATCH 04/22] also build iele --- flake.nix | 5 +++-- nix/pkgs/iele.nix | 25 +++++++++++++++++++++++++ nix/pkgs/mantis/wrapped.nix | 5 +++-- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 nix/pkgs/iele.nix diff --git a/flake.nix b/flake.nix index 45423efbdc..a3321938e3 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,8 @@ kevm = final.callPackage ./nix/pkgs/kevm.nix { }; + iele = final.callPackage ./nix/pkgs/iele.nix { }; + mantis-entrypoint = final.callPackage ./nix/entrypoint.nix { }; }; @@ -75,7 +77,6 @@ defaultApp = apps.mantis; }) // (collectHydraSets [ (mkHydraSet [ "mantis" ] [ "x86_64-linux" "x86_64-darwin" ]) - (mkHydraSet [ "kevm" ] [ "x86_64-linux" ]) - (mkHydraSet [ "mantis-entrypoint" ] [ "x86_64-linux" ]) + (mkHydraSet [ "kevm" "iele" "mantis-entrypoint" ] [ "x86_64-linux" ]) ]); } diff --git a/nix/pkgs/iele.nix b/nix/pkgs/iele.nix new file mode 100644 index 0000000000..e31f6b887a --- /dev/null +++ b/nix/pkgs/iele.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, dockerTools, secp256k1, gmp5, mpfr, zlib }: +let libPath = lib.makeLibraryPath [ secp256k1 gmp5 mpfr zlib ]; +in stdenv.mkDerivation { + name = "iele"; + + src = dockerTools.pullImage { + imageName = "inputoutput/mantis"; + imageDigest = + "sha256:594ed009f1bc1f12b86e11136441602107c3d580476002d9bae58b258a74ac1b"; + sha256 = "sha256-JT+FarGQlgYoO392Ne1ofdqmishZLfH+OwV2CXTYwdA="; + }; + + installPhase = '' + mkdir -p tmp $out/bin + tar --delay-directory-restore -C tmp -xf layer.tar || true + + cp tmp/bin/iele-vm $out/bin + chmod 0755 $out/bin/iele-vm + + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${libPath}" \ + "$out/bin/iele-vm" + ''; +} diff --git a/nix/pkgs/mantis/wrapped.nix b/nix/pkgs/mantis/wrapped.nix index a80c63e0c6..edc7e3fe88 100644 --- a/nix/pkgs/mantis/wrapped.nix +++ b/nix/pkgs/mantis/wrapped.nix @@ -1,9 +1,9 @@ -{ lib, stdenv, mantis, makeWrapper, jre, gawk, gnused, kevm, coreutils }: +{ lib, stdenv, mantis, makeWrapper, jre, gawk, gnused, kevm, iele, coreutils }: let inherit (stdenv.lib) optionalString makeLibraryPath; inherit (stdenv) cc isDarwin; LD_LIBRARY_PATH = makeLibraryPath [ cc.cc.lib ]; - PATH = lib.makeBinPath [ jre gawk gnused kevm coreutils ]; + PATH = lib.makeBinPath [ jre gawk gnused kevm iele coreutils ]; in stdenv.mkDerivation { pname = "mantis"; version = let @@ -31,5 +31,6 @@ in stdenv.mkDerivation { done ln -s ${kevm}/bin/kevm-vm $out/bin + ln -s ${iele}/bin/iele-vm $out/bin ''; } From 571765e92dd732157f01927c13ca2c6fb3e5dd39 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 24 Mar 2021 09:30:09 +0100 Subject: [PATCH 05/22] add explorer and faucet packages --- flake.lock | 116 +++++++++++++++++++++++++++++++++++++++++---- flake.nix | 46 ++++++++---------- nix/entrypoint.nix | 4 +- nix/overlay.nix | 66 ++++++++++++++++++++++++++ nix/pkgs/nginx.nix | 14 ++++++ 5 files changed, 208 insertions(+), 38 deletions(-) create mode 100644 nix/overlay.nix create mode 100644 nix/pkgs/nginx.nix diff --git a/flake.lock b/flake.lock index fbced7baae..86e310428d 100644 --- a/flake.lock +++ b/flake.lock @@ -15,20 +15,86 @@ "type": "github" } }, - "nixpkgs": { + "flake-utils_2": { "locked": { - "lastModified": 1610118011, - "narHash": "sha256-a17vwGBOqmAsy/Wkvf10ygDyfgjJpvlPyNnf7SAk+Ac=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a98302aa9b9628915878a6ea9776c40a0bb02950", + "lastModified": 1601282935, + "narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "588973065fce51f4763287f0fda87a174d78bf48", "type": "github" }, "original": { - "owner": "nixos", + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "mantis-explorer": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1614341279, + "narHash": "sha256-MsktksQES7SAZabF/emZTnIG8lVDZ2bw455WOCmcZcU=", + "owner": "input-output-hk", + "repo": "mantis-explorer", + "rev": "d72aa0d5d182b6700bb31cfea3f28284f0619430", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "mantis-explorer", + "type": "github" + } + }, + "mantis-faucet-web": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1614341313, + "narHash": "sha256-xu2wOsgQLedyyR/E0zn81SIe5t188D08/q+6LTMYG3k=", + "owner": "input-output-hk", + "repo": "mantis-faucet-web", + "rev": "9da14f10408254597d6a709723b21d5f52f42de2", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "mantis-faucet-web", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1603802751, + "narHash": "sha256-K3CeF3CYy7LCu0J1NnSdo77oVIkcwf0cXDAA/HFjP58=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "a98302aa9b9628915878a6ea9776c40a0bb02950", + "rev": "8a1fdce8d3482b60ac13678a8eab838777b51549", "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs-sbt": { @@ -48,10 +114,42 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1606940130, + "narHash": "sha256-feZRQOfUWLfTuYUTEUxGadrS0QksS+TLHOx7kz8vgIY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1176af94d32008050a447dd1c1a2c8c459aa9dcb", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1610118011, + "narHash": "sha256-a17vwGBOqmAsy/Wkvf10ygDyfgjJpvlPyNnf7SAk+Ac=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a98302aa9b9628915878a6ea9776c40a0bb02950", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a98302aa9b9628915878a6ea9776c40a0bb02950", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", + "mantis-explorer": "mantis-explorer", + "mantis-faucet-web": "mantis-faucet-web", + "nixpkgs": "nixpkgs_3", "nixpkgs-sbt": "nixpkgs-sbt", "sbtix": "sbtix" } diff --git a/flake.nix b/flake.nix index a3321938e3..892046e995 100644 --- a/flake.nix +++ b/flake.nix @@ -14,34 +14,13 @@ "github:input-output-hk/Sbtix?rev=7b969a5641fce10500ca51cbe88af4ea160d7064"; flake = false; }; + mantis-faucet-web.url = "github:input-output-hk/mantis-faucet-web"; + mantis-explorer.url = "github:input-output-hk/mantis-explorer"; }; - outputs = { self, nixpkgs, flake-utils, nixpkgs-sbt, ... }@inputs: + outputs = { self, nixpkgs, flake-utils, ... }@inputs: let - overlay = final: prev: { - inherit (import nixpkgs-sbt { inherit (final) system; }) sbt; - sbtix = final.callPackage ./sbtix.nix { }; - - mantisPkgs = final.callPackage ./nix/pkgs/mantis { - src = builtins.fetchGit { - url = "https://github.com/input-output-hk/mantis"; - rev = self.rev or "482340d5e6ab635e5a5047e9b670d59b4ad366c2"; - ref = "3.1.0-flake"; - submodules = true; - }; - }; - - jdk = prev.openjdk8_headless; - jre = prev.openjdk8_headless.jre; - - inherit (final.mantisPkgs) mantis; - - kevm = final.callPackage ./nix/pkgs/kevm.nix { }; - - iele = final.callPackage ./nix/pkgs/iele.nix { }; - - mantis-entrypoint = final.callPackage ./nix/entrypoint.nix { }; - }; + overlay = import ./nix/overlay.nix inputs; pkgsForSystem = system: (import nixpkgs) { @@ -76,7 +55,20 @@ apps.mantis = flake-utils.lib.mkApp { drv = pkgs.mantis; }; defaultApp = apps.mantis; }) // (collectHydraSets [ - (mkHydraSet [ "mantis" ] [ "x86_64-linux" "x86_64-darwin" ]) - (mkHydraSet [ "kevm" "iele" "mantis-entrypoint" ] [ "x86_64-linux" ]) + (mkHydraSet [ + "mantis" + "kevm" + "iele" + + "mantis-entrypoint" + + "mantis-explorer-evm" + "mantis-explorer-iele" + "mantis-explorer-kevm" + + "mantis-faucet-web-evm" + "mantis-faucet-web-iele" + "mantis-faucet-web-kevm" + ] [ "x86_64-linux" ]) ]); } diff --git a/nix/entrypoint.nix b/nix/entrypoint.nix index 4312201380..b846ec6d18 100644 --- a/nix/entrypoint.nix +++ b/nix/entrypoint.nix @@ -1,5 +1,5 @@ -{ lib, writeShellScriptBin, awscli, mantis, coreutils, gnugrep }: -writeShellScriptBin "mantis-entrypoint" '' +{ lib, writeBashBinChecked, awscli, mantis, coreutils, gnugrep }: +writeBashBinChecked "mantis-entrypoint" '' set -exuo pipefail export PATH="${lib.makeBinPath [ coreutils mantis awscli gnugrep ]}" diff --git a/nix/overlay.nix b/nix/overlay.nix new file mode 100644 index 0000000000..098c169f60 --- /dev/null +++ b/nix/overlay.nix @@ -0,0 +1,66 @@ +inputs: final: prev: { + # Little convenience function helping us to containing the bash + # madness: forcing our bash scripts to be shellChecked. + writeBashChecked = final.writers.makeScriptWriter { + interpreter = "${final.bash}/bin/bash"; + check = final.writers.writeBash "shellcheck-check" '' + ${final.shellcheck}/bin/shellcheck -x "$1" + ''; + }; + writeBashBinChecked = name: final.writeBashChecked "/bin/${name}"; + + mantisPkgs = final.callPackage ./pkgs/mantis { + src = builtins.fetchGit { + url = "https://github.com/input-output-hk/mantis"; + rev = inputs.self.rev or "482340d5e6ab635e5a5047e9b670d59b4ad366c2"; + ref = "3.1.0-flake"; + submodules = true; + }; + }; + + inherit (final.mantisPkgs) mantis; + + inherit (import inputs.nixpkgs-sbt { inherit (final) system; }) sbt; + + sbtix = final.callPackage ../sbtix.nix { }; + + jdk = prev.openjdk8_headless; + jre = prev.openjdk8_headless.jre; + kevm = final.callPackage ./pkgs/kevm.nix { }; + iele = final.callPackage ./pkgs/iele.nix { }; + mantis-entrypoint = final.callPackage ./entrypoint.nix { }; + + mantis-faucet-web = + inputs.mantis-faucet-web.defaultPackage.${final.system}.overrideAttrs + (old: { + FAUCET_NODE_URL = "https://mantis-testnet-faucet.mantis.ws"; + MANTIS_VM = "Mantis Testnet"; + }); + + makeFaucet = name: + (final.callPackage ./pkgs/nginx.nix { + package = final.mantis-faucet-web.overrideAttrs (old: + { + MANTIS_VM = prev.lib.toUpper name; + FAUCET_NODE_URL = "https://faucet-${prev.lib.toLower name}.portal.dev.cardano.org"; + } + ); + target = "/mantis-faucet"; + }); + + makeExplorer = MANTIS_VM: + (prev.callPackage ./pkgs/nginx.nix { + package = + inputs.mantis-explorer.defaultPackage.${final.system}.overrideAttrs + (old: { inherit MANTIS_VM; }); + target = "/mantis-explorer"; + }); + + mantis-explorer-evm = final.makeExplorer "EVM"; + mantis-explorer-iele = final.makeExplorer "IELE"; + mantis-explorer-kevm = final.makeExplorer "KEVM"; + + mantis-faucet-web-evm = final.makeFaucet "EVM"; + mantis-faucet-web-iele = final.makeFaucet "IELE"; + mantis-faucet-web-kevm = final.makeFaucet "KEVM"; +} diff --git a/nix/pkgs/nginx.nix b/nix/pkgs/nginx.nix new file mode 100644 index 0000000000..b63bf49ab9 --- /dev/null +++ b/nix/pkgs/nginx.nix @@ -0,0 +1,14 @@ +{ lib, writeBashBinChecked, nginx, coreutils, package, target }: +writeBashBinChecked "entrypoint" '' + export PATH="${lib.makeBinPath [ nginx coreutils ]}" + mkdir -p /var/cache/nginx + ln -fs ${package} ${target} + + config="$1" + echo "waiting for valid nginx config..." + until nginx -t -c "$config"; do + sleep 1 + done + + exec nginx -g 'error_log stderr;' -c "$@" +'' From 993280b1e15d6460492ad432cf1d52979bc667ef Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 24 Mar 2021 09:44:54 +0100 Subject: [PATCH 06/22] minor cleanup --- nix/overlay.nix | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/nix/overlay.nix b/nix/overlay.nix index 098c169f60..9652ec0dd6 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -30,21 +30,15 @@ inputs: final: prev: { iele = final.callPackage ./pkgs/iele.nix { }; mantis-entrypoint = final.callPackage ./entrypoint.nix { }; - mantis-faucet-web = - inputs.mantis-faucet-web.defaultPackage.${final.system}.overrideAttrs - (old: { - FAUCET_NODE_URL = "https://mantis-testnet-faucet.mantis.ws"; - MANTIS_VM = "Mantis Testnet"; - }); - makeFaucet = name: (final.callPackage ./pkgs/nginx.nix { - package = final.mantis-faucet-web.overrideAttrs (old: - { - MANTIS_VM = prev.lib.toUpper name; - FAUCET_NODE_URL = "https://faucet-${prev.lib.toLower name}.portal.dev.cardano.org"; - } - ); + package = + inputs.mantis-faucet-web.defaultPackage.${final.system}.overrideAttrs + (old: { + MANTIS_VM = prev.lib.toUpper name; + FAUCET_NODE_URL = + "https://faucet-${prev.lib.toLower name}.portal.dev.cardano.org"; + }); target = "/mantis-faucet"; }); @@ -56,11 +50,11 @@ inputs: final: prev: { target = "/mantis-explorer"; }); - mantis-explorer-evm = final.makeExplorer "EVM"; + mantis-explorer-evm = final.makeExplorer "EVM"; mantis-explorer-iele = final.makeExplorer "IELE"; mantis-explorer-kevm = final.makeExplorer "KEVM"; - mantis-faucet-web-evm = final.makeFaucet "EVM"; + mantis-faucet-web-evm = final.makeFaucet "EVM"; mantis-faucet-web-iele = final.makeFaucet "IELE"; mantis-faucet-web-kevm = final.makeFaucet "KEVM"; } From 6e0894e31d9b313e4ef68a66f9a6a19541641d84 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Wed, 24 Mar 2021 19:21:27 +1000 Subject: [PATCH 07/22] Added mantis-faucet --- flake.nix | 1 + nix/overlay.nix | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/flake.nix b/flake.nix index 892046e995..da4456434c 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,7 @@ "iele" "mantis-entrypoint" + "mantis-faucet-entrypoint" "mantis-explorer-evm" "mantis-explorer-iele" diff --git a/nix/overlay.nix b/nix/overlay.nix index 9652ec0dd6..af183a6dc2 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -9,6 +9,13 @@ inputs: final: prev: { }; writeBashBinChecked = name: final.writeBashChecked "/bin/${name}"; + mantis-faucet-source = builtins.fetchGit { + url = "https://github.com/input-output-hk/mantis"; + rev = "07e617cdd1bfc76ad1a8472305f0e5e60e2801e1"; + ref = "develop"; + submodules = true; + }; + mantisPkgs = final.callPackage ./pkgs/mantis { src = builtins.fetchGit { url = "https://github.com/input-output-hk/mantis"; @@ -18,6 +25,10 @@ inputs: final: prev: { }; }; + mantis-faucet = import final.mantis-faucet-source { inherit (final) system; }; + mantis-faucet-entrypoint = + final.callPackage ./entrypoint.nix { mantis = final.mantis-faucet; }; + inherit (final.mantisPkgs) mantis; inherit (import inputs.nixpkgs-sbt { inherit (final) system; }) sbt; From 6d50a941b13ad17bac9abd2ec9f2f2be265fc3b7 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Wed, 24 Mar 2021 19:45:54 +1000 Subject: [PATCH 08/22] Added gnused --- nix/entrypoint.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/entrypoint.nix b/nix/entrypoint.nix index b846ec6d18..ca17fdf4de 100644 --- a/nix/entrypoint.nix +++ b/nix/entrypoint.nix @@ -1,8 +1,8 @@ -{ lib, writeBashBinChecked, awscli, mantis, coreutils, gnugrep }: +{ lib, writeBashBinChecked, awscli, mantis, coreutils, gnugrep, gnused }: writeBashBinChecked "mantis-entrypoint" '' set -exuo pipefail - export PATH="${lib.makeBinPath [ coreutils mantis awscli gnugrep ]}" + export PATH="${lib.makeBinPath [ coreutils mantis awscli gnugrep gnused ]}" ${builtins.readFile ./entrypoint.sh} '' From 9701978dd38ac65fa32c19d0fcb4181829307eb6 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Wed, 24 Mar 2021 20:20:02 +1000 Subject: [PATCH 09/22] Set file descriptors limit to 2048 --- nix/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/entrypoint.sh b/nix/entrypoint.sh index 73fae1308e..ca0fc88039 100644 --- a/nix/entrypoint.sh +++ b/nix/entrypoint.sh @@ -28,6 +28,7 @@ done set -x ulimit -c unlimited +ulimit -n 2048 cp mantis.conf running.conf exec mantis "-Duser.home=$NOMAD_TASK_DIR" "$@" From 9e95b1fce9f18efeea2d47191f7d2c21a18e1559 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Wed, 24 Mar 2021 20:26:12 +1000 Subject: [PATCH 10/22] Added kevm to the entrypoint --- nix/entrypoint.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nix/entrypoint.nix b/nix/entrypoint.nix index ca17fdf4de..27139cbec4 100644 --- a/nix/entrypoint.nix +++ b/nix/entrypoint.nix @@ -1,8 +1,11 @@ -{ lib, writeBashBinChecked, awscli, mantis, coreutils, gnugrep, gnused }: +{ lib, writeBashBinChecked, awscli, mantis, coreutils, gnugrep, gnused, kevm +, iele }: writeBashBinChecked "mantis-entrypoint" '' set -exuo pipefail - export PATH="${lib.makeBinPath [ coreutils mantis awscli gnugrep gnused ]}" + export PATH="${ + lib.makeBinPath [ coreutils mantis awscli gnugrep gnused kevm iele ] + }" ${builtins.readFile ./entrypoint.sh} '' From 86d1239b9e4421fe488499766013cf07cac0d385 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 24 Mar 2021 16:24:53 +0100 Subject: [PATCH 11/22] copy faucet key --- nix/entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix/entrypoint.sh b/nix/entrypoint.sh index ca0fc88039..ab86330377 100644 --- a/nix/entrypoint.sh +++ b/nix/entrypoint.sh @@ -27,6 +27,10 @@ until [ "$(grep -c enode mantis.conf)" -ge "$REQUIRED_PEER_COUNT" ]; do done set -x +if [ -n "${COINBASE:-}" ]; then + cp "$NOMAD_SECRETS_DIR/account" "$NOMAD_SECRETS_DIR/keystore/UTC--2020-10-16T14-48-29.47Z-$COINBASE" +fi + ulimit -c unlimited ulimit -n 2048 cp mantis.conf running.conf From 24febcacd63a4ba374f4ea554a269b6bc65d14cf Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 24 Mar 2021 16:42:24 +0100 Subject: [PATCH 12/22] create keystore dir --- nix/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/entrypoint.sh b/nix/entrypoint.sh index ab86330377..c31b782647 100644 --- a/nix/entrypoint.sh +++ b/nix/entrypoint.sh @@ -28,6 +28,7 @@ done set -x if [ -n "${COINBASE:-}" ]; then + mkdir -p "$NOMAD_SECRETS_DIR/keystore" cp "$NOMAD_SECRETS_DIR/account" "$NOMAD_SECRETS_DIR/keystore/UTC--2020-10-16T14-48-29.47Z-$COINBASE" fi From 7a22643e49881a68eb7c0b385dc95c13ea44ddc0 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Fri, 26 Mar 2021 11:30:03 +0100 Subject: [PATCH 13/22] use original version of secp256k1 for kevm --- flake.lock | 18 ++++++++++++++++++ flake.nix | 4 ++++ nix/overlay.nix | 4 +++- nix/pkgs/kevm.nix | 18 ++++++++++++++++-- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 86e310428d..278b77efe5 100644 --- a/flake.lock +++ b/flake.lock @@ -97,6 +97,23 @@ "type": "indirect" } }, + "nixpkgs-kevm": { + "flake": false, + "locked": { + "lastModified": 1606507280, + "narHash": "sha256-NvYGnD+gdDPVZlzB+t6GS+IC72dmN1sPwiAMrr3I8YQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "df25e214c8e662d693ef89e45ce56bbf58d6c59e", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "df25e214c8e662d693ef89e45ce56bbf58d6c59e", + "type": "github" + } + }, "nixpkgs-sbt": { "flake": false, "locked": { @@ -150,6 +167,7 @@ "mantis-explorer": "mantis-explorer", "mantis-faucet-web": "mantis-faucet-web", "nixpkgs": "nixpkgs_3", + "nixpkgs-kevm": "nixpkgs-kevm", "nixpkgs-sbt": "nixpkgs-sbt", "sbtix": "sbtix" } diff --git a/flake.nix b/flake.nix index da4456434c..f325ceeee5 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,10 @@ url = "github:nixos/nixpkgs?rev=e2bb73ce5f786b83e984b80199112f86b8a6cc9d"; flake = false; }; + nixpkgs-kevm = { + url = "github:nixos/nixpkgs?rev=df25e214c8e662d693ef89e45ce56bbf58d6c59e"; + flake = false; + }; sbtix = { url = "github:input-output-hk/Sbtix?rev=7b969a5641fce10500ca51cbe88af4ea160d7064"; diff --git a/nix/overlay.nix b/nix/overlay.nix index af183a6dc2..acddd6dfa9 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -25,6 +25,8 @@ inputs: final: prev: { }; }; + nixpkgs-kevm = import inputs.nixpkgs-kevm { inherit (final) system; }; + mantis-faucet = import final.mantis-faucet-source { inherit (final) system; }; mantis-faucet-entrypoint = final.callPackage ./entrypoint.nix { mantis = final.mantis-faucet; }; @@ -37,7 +39,7 @@ inputs: final: prev: { jdk = prev.openjdk8_headless; jre = prev.openjdk8_headless.jre; - kevm = final.callPackage ./pkgs/kevm.nix { }; + kevm = final.nixpkgs-kevm.callPackage ./pkgs/kevm.nix { }; iele = final.callPackage ./pkgs/iele.nix { }; mantis-entrypoint = final.callPackage ./entrypoint.nix { }; diff --git a/nix/pkgs/kevm.nix b/nix/pkgs/kevm.nix index a452ffbcfb..4d86050650 100644 --- a/nix/pkgs/kevm.nix +++ b/nix/pkgs/kevm.nix @@ -1,5 +1,19 @@ -{ lib, stdenv, dockerTools, secp256k1, gmp5, mpfr, zlib }: -let libPath = lib.makeLibraryPath [ secp256k1 gmp5 mpfr zlib ]; +{ lib, stdenv, fetchFromGitHub, dockerTools, autoreconfHook, gmp5, mpfr, zlib }: +let + libPath = lib.makeLibraryPath [ secp gmp5 mpfr zlib ]; + + secp = stdenv.mkDerivation { + name = "secp256k1"; + + src = fetchFromGitHub { + owner = "bitcoin-core"; + repo = "secp256k1"; + rev = "f532bdc9f77f7bbf7e93faabfbe9c483f0a9f75f"; + sha256 = "sha256-PyqNZGER9VypH35S/aU4EBeepieI3BGXrYsJ141os24="; + }; + + nativeBuildInputs = [ autoreconfHook ]; + }; in stdenv.mkDerivation { name = "kevm"; From c77562618063da45ee1d98dd7dec99c8c77a2195 Mon Sep 17 00:00:00 2001 From: Dominik Zajkowski Date: Sat, 27 Mar 2021 18:57:09 +0100 Subject: [PATCH 14/22] [FIX] Update the kevm protobuf submodule to latest --- src/main/protobuf/extvm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/protobuf/extvm b/src/main/protobuf/extvm index 53eb31f3c5..6b3039be92 160000 --- a/src/main/protobuf/extvm +++ b/src/main/protobuf/extvm @@ -1 +1 @@ -Subproject commit 53eb31f3c59f7200994915b834e626bd292df7ed +Subproject commit 6b3039be92882df6ef6c15887c8d0b5f10c86d6f From c963bc8d9d533ee5797b23040457288d1f67cf97 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 31 Mar 2021 15:36:50 +0200 Subject: [PATCH 15/22] avoid submodule fetching for mantis source --- default.nix | 5 ++--- nix/overlay.nix | 18 +++++++++--------- nix/pkgs/mantis/unwrapped.nix | 13 ++++++++++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/default.nix b/default.nix index 9fd97789a6..0846cf3dd1 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,2 @@ -{ system ? builtins.currentSystem, src ? ./. -, pkgs ? (import ./nix { inherit system src; }).pkgs }: -pkgs.mantis +let flake = builtins.getFlake (toString ./.); +in flake.pkgs.${builtins.currentSystem}.defaultPackage diff --git a/nix/overlay.nix b/nix/overlay.nix index acddd6dfa9..e1aa7b5aff 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -16,23 +16,23 @@ inputs: final: prev: { submodules = true; }; - mantisPkgs = final.callPackage ./pkgs/mantis { - src = builtins.fetchGit { - url = "https://github.com/input-output-hk/mantis"; - rev = inputs.self.rev or "482340d5e6ab635e5a5047e9b670d59b4ad366c2"; - ref = "3.1.0-flake"; - submodules = true; - }; + # Last change to this was in 2018, so to avoid submodules we just clone + # ourselves instead. + mantis-extvm-pb = builtins.fetchGit { + url = "https://github.com/input-output-hk/mantis-extvm-pb"; + rev = "6b3039be92882df6ef6c15887c8d0b5f10c86d6f"; }; + mantisPkgs = final.callPackage ./pkgs/mantis { src = ../.; }; + + inherit (final.mantisPkgs) mantis; + nixpkgs-kevm = import inputs.nixpkgs-kevm { inherit (final) system; }; mantis-faucet = import final.mantis-faucet-source { inherit (final) system; }; mantis-faucet-entrypoint = final.callPackage ./entrypoint.nix { mantis = final.mantis-faucet; }; - inherit (final.mantisPkgs) mantis; - inherit (import inputs.nixpkgs-sbt { inherit (final) system; }) sbt; sbtix = final.callPackage ../sbtix.nix { }; diff --git a/nix/pkgs/mantis/unwrapped.nix b/nix/pkgs/mantis/unwrapped.nix index 1c054f5eb7..09ce4edf75 100644 --- a/nix/pkgs/mantis/unwrapped.nix +++ b/nix/pkgs/mantis/unwrapped.nix @@ -1,6 +1,6 @@ # this file originates from SBTix { src, stdenv, writeShellScriptBin, bash, protobuf, sbtix -, jdk, impure ? false }: +, jdk, mantis-extvm-pb, runCommand, impure ? false }: let inherit (stdenv.lib) optionalString makeLibraryPath; @@ -19,14 +19,21 @@ let set -e for f in "$@"; do - echo ''${f##*=} + echo "''${f##*=}" done | grep protocbridge | xargs sed -i "1s|.*|#!${bash}/bin/bash|" exec ${protobuf}/bin/protoc "$@" ''; + extSrc = runCommand "mantis-src-ext" {} '' + cp -r ${src} $out + chmod -R u+w $out + mkdir -p $out/src/main/protobuf/extvm + cp ${mantis-extvm-pb}/msg.proto $out/src/main/protobuf/extvm/msg.proto + ''; + in sbtix.buildSbtProject { - inherit src; + src = extSrc; name = "mantis"; sbtOptions = "-Dnix=true"; From cf748e0bc56710e6ef66a5c461c592383e13fc0a Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Wed, 31 Mar 2021 18:01:34 +0200 Subject: [PATCH 16/22] add mantis:2021 image build --- flake.lock | 17 +++++++++++++++++ flake.nix | 1 + nix/overlay.nix | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/flake.lock b/flake.lock index 278b77efe5..f5f04a2a0a 100644 --- a/flake.lock +++ b/flake.lock @@ -131,6 +131,22 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1616670887, + "narHash": "sha256-wn+l9qJfR5sj5Gq4DheJHAcBDfOs9K2p9seW2f35xzs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c0e881852006b132236cbf0301bd1939bb50867e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1606940130, @@ -169,6 +185,7 @@ "nixpkgs": "nixpkgs_3", "nixpkgs-kevm": "nixpkgs-kevm", "nixpkgs-sbt": "nixpkgs-sbt", + "nixpkgs-unstable": "nixpkgs-unstable", "sbtix": "sbtix" } }, diff --git a/flake.nix b/flake.nix index f325ceeee5..beb6ea6f1a 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,7 @@ "github:input-output-hk/Sbtix?rev=7b969a5641fce10500ca51cbe88af4ea160d7064"; flake = false; }; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; mantis-faucet-web.url = "github:input-output-hk/mantis-faucet-web"; mantis-explorer.url = "github:input-output-hk/mantis-explorer"; }; diff --git a/nix/overlay.nix b/nix/overlay.nix index e1aa7b5aff..2aa1e608fe 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -70,4 +70,38 @@ inputs: final: prev: { mantis-faucet-web-evm = final.makeFaucet "EVM"; mantis-faucet-web-iele = final.makeFaucet "IELE"; mantis-faucet-web-kevm = final.makeFaucet "KEVM"; + + mantis-image = + inputs.nixpkgs-unstable.legacyPackages.${final.system}.dockerTools.buildLayeredImage { + name = "inputoutput/mantis"; + tag = "2021"; + + contents = with final; [ + iele + kevm + mantis + + bashInteractive + coreutils + curl + diffutils + dnsutils + fd + gawk + gnugrep + gnused + iproute + jq + less + lsof + netcat + nettools + procps + ripgrep + tree + vim + ]; + + config.Entrypoint = [ "${final.bashInteractive}/bin/bash" ]; + }; } From b6a26f8624cd6bbf0467a97bbd42c99d3db021a0 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Mon, 29 Mar 2021 13:54:42 -0700 Subject: [PATCH 17/22] Fix default.nix, refering to mantis flake --- default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 0846cf3dd1..636bb420ab 100644 --- a/default.nix +++ b/default.nix @@ -1,2 +1,4 @@ -let flake = builtins.getFlake (toString ./.); -in flake.pkgs.${builtins.currentSystem}.defaultPackage +let + flake = builtins.getFlake (toString ./.); +in + flake.pkgs.${builtins.currentSystem}.mantis From 7849a81b84fd7e27403bfcadc97b089758070621 Mon Sep 17 00:00:00 2001 From: Dominik Zajkowski Date: Thu, 8 Apr 2021 22:36:18 +0200 Subject: [PATCH 18/22] 'calculateGasLimit' set to parent value --- .../blocks/BlockGeneratorSkeleton.scala | 12 +-- .../consensus/BlockGeneratorSpec.scala | 74 ++++++++++++++++--- 2 files changed, 70 insertions(+), 16 deletions(-) diff --git a/src/main/scala/io/iohk/ethereum/consensus/blocks/BlockGeneratorSkeleton.scala b/src/main/scala/io/iohk/ethereum/consensus/blocks/BlockGeneratorSkeleton.scala index 894dc58924..281589cf94 100644 --- a/src/main/scala/io/iohk/ethereum/consensus/blocks/BlockGeneratorSkeleton.scala +++ b/src/main/scala/io/iohk/ethereum/consensus/blocks/BlockGeneratorSkeleton.scala @@ -163,13 +163,13 @@ abstract class BlockGeneratorSkeleton( transactionsForBlock } - //returns maximal limit to be able to include as many transactions as possible - protected def calculateGasLimit(parentGas: BigInt): BigInt = { - val GasLimitBoundDivisor: Int = 1024 + /* + Returns the same gas limit as the parent block - val gasLimitDifference = parentGas / GasLimitBoundDivisor - parentGas + gasLimitDifference - 1 - } + In Mantis only testnets (and without this changed), this means that all blocks will have the same gasLimit as + the genesis block + */ + protected def calculateGasLimit(parentGas: BigInt): BigInt = parentGas protected def buildMpt[K](entities: Seq[K], vSerializable: ByteArraySerializable[K]): ByteString = { val stateStorage = StateStorage.getReadOnlyStorage(EphemDataSource()) diff --git a/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala b/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala index 273dadfe10..1d4cc69827 100644 --- a/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala +++ b/src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala @@ -39,7 +39,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1508751768 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate( fullBlock.header, @@ -61,7 +66,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1508752265 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate( fullBlock.header, @@ -83,7 +93,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1508752265 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) // Import Block, to create some existing state @@ -132,7 +147,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1508752389 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate( fullBlock.header, @@ -165,7 +185,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1508752492 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate( @@ -233,7 +258,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate( fullBlock.header, @@ -323,7 +353,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate(fullBlock.header, blockchain.getBlockHeaderByHash) shouldBe Right( BlockHeaderValid @@ -355,7 +390,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate(fullBlock.header, blockchain.getBlockHeaderByHash) shouldBe Right( BlockHeaderValid @@ -400,7 +440,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1499721182 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate(fullBlock.header, blockchain.getBlockHeaderByHash) shouldBe Right( BlockHeaderValid @@ -432,7 +477,12 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper val miningTimestamp = 1508752698 val fullBlock = pendingBlock.block.copy(header = - pendingBlock.block.header.copy(nonce = minedNonce, mixHash = minedMixHash, unixTimestamp = miningTimestamp) + pendingBlock.block.header.copy( + nonce = minedNonce, + mixHash = minedMixHash, + unixTimestamp = miningTimestamp, + gasLimit = generatedBlockGasLimit + ) ) validators.blockHeaderValidator.validate(fullBlock.header, blockchain.getBlockHeaderByHash) shouldBe Right( BlockHeaderValid @@ -562,6 +612,10 @@ class BlockGeneratorSpec extends AnyFlatSpec with Matchers with ScalaCheckProper lazy val blockExecution = new BlockExecution(blockchain, blockchainConfig, consensus.blockPreparator, blockValidation) + // FIXME: the change in gas limit voting strategy caused the hardcoded nonce and mixHash in this file to be invalid + // The gas limit of all the generated blocks has to be set to the old strategy of increasing as much as possible + // the gas limit, if not PoW validations will fail + val generatedBlockGasLimit = 16733003 } } From e8d8911aca95dbc7d69c22c2ff864bedaa61fc10 Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Fri, 9 Apr 2021 19:48:53 +1000 Subject: [PATCH 19/22] Revert "use original version of secp256k1 for kevm" This reverts commit 7a22643e49881a68eb7c0b385dc95c13ea44ddc0. --- nix/overlay.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nix/overlay.nix b/nix/overlay.nix index 2aa1e608fe..4dcd26c238 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -27,8 +27,6 @@ inputs: final: prev: { inherit (final.mantisPkgs) mantis; - nixpkgs-kevm = import inputs.nixpkgs-kevm { inherit (final) system; }; - mantis-faucet = import final.mantis-faucet-source { inherit (final) system; }; mantis-faucet-entrypoint = final.callPackage ./entrypoint.nix { mantis = final.mantis-faucet; }; @@ -39,7 +37,7 @@ inputs: final: prev: { jdk = prev.openjdk8_headless; jre = prev.openjdk8_headless.jre; - kevm = final.nixpkgs-kevm.callPackage ./pkgs/kevm.nix { }; + kevm = final.callPackage ./pkgs/kevm.nix { }; iele = final.callPackage ./pkgs/iele.nix { }; mantis-entrypoint = final.callPackage ./entrypoint.nix { }; From 24b075a81bfb76daf76fee70abb01448eca621f8 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Fri, 9 Apr 2021 12:18:35 +0200 Subject: [PATCH 20/22] actually revert "use original version of secp256k1 for kevm" --- nix/pkgs/kevm.nix | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/nix/pkgs/kevm.nix b/nix/pkgs/kevm.nix index 4d86050650..546ea2e957 100644 --- a/nix/pkgs/kevm.nix +++ b/nix/pkgs/kevm.nix @@ -1,19 +1,6 @@ -{ lib, stdenv, fetchFromGitHub, dockerTools, autoreconfHook, gmp5, mpfr, zlib }: +{ lib, stdenv, fetchFromGitHub, dockerTools, autoreconfHook, gmp5, mpfr, zlib, secp256k1 }: let - libPath = lib.makeLibraryPath [ secp gmp5 mpfr zlib ]; - - secp = stdenv.mkDerivation { - name = "secp256k1"; - - src = fetchFromGitHub { - owner = "bitcoin-core"; - repo = "secp256k1"; - rev = "f532bdc9f77f7bbf7e93faabfbe9c483f0a9f75f"; - sha256 = "sha256-PyqNZGER9VypH35S/aU4EBeepieI3BGXrYsJ141os24="; - }; - - nativeBuildInputs = [ autoreconfHook ]; - }; + libPath = lib.makeLibraryPath [ secp256k1 gmp5 mpfr zlib ]; in stdenv.mkDerivation { name = "kevm"; From 24f34e15090ac624285c3f2719feef2809abe17f Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Fri, 9 Apr 2021 12:30:27 +0200 Subject: [PATCH 21/22] build kevm with older nixpkgs --- nix/overlay.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nix/overlay.nix b/nix/overlay.nix index 4dcd26c238..2aa1e608fe 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -27,6 +27,8 @@ inputs: final: prev: { inherit (final.mantisPkgs) mantis; + nixpkgs-kevm = import inputs.nixpkgs-kevm { inherit (final) system; }; + mantis-faucet = import final.mantis-faucet-source { inherit (final) system; }; mantis-faucet-entrypoint = final.callPackage ./entrypoint.nix { mantis = final.mantis-faucet; }; @@ -37,7 +39,7 @@ inputs: final: prev: { jdk = prev.openjdk8_headless; jre = prev.openjdk8_headless.jre; - kevm = final.callPackage ./pkgs/kevm.nix { }; + kevm = final.nixpkgs-kevm.callPackage ./pkgs/kevm.nix { }; iele = final.callPackage ./pkgs/iele.nix { }; mantis-entrypoint = final.callPackage ./entrypoint.nix { }; From a2ddacb63b2ace46c1800bdae95ae10e54921ab0 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Fri, 9 Apr 2021 13:01:45 +0200 Subject: [PATCH 22/22] fix mantis referencing the pb version --- nix/pkgs/mantis/unwrapped.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/pkgs/mantis/unwrapped.nix b/nix/pkgs/mantis/unwrapped.nix index 09ce4edf75..edbb6a59a5 100644 --- a/nix/pkgs/mantis/unwrapped.nix +++ b/nix/pkgs/mantis/unwrapped.nix @@ -30,6 +30,7 @@ let chmod -R u+w $out mkdir -p $out/src/main/protobuf/extvm cp ${mantis-extvm-pb}/msg.proto $out/src/main/protobuf/extvm/msg.proto + cp ${mantis-extvm-pb}/VERSION $out/src/main/protobuf/extvm/VERSION ''; in sbtix.buildSbtProject {