Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sequencer #96

Merged
merged 9 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
use nix
watch_file flake.lock
watch_file flake.nix
watch_file foundry/default.nix
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,3 @@ install-geth:
go install -v github.com/ethereum/go-ethereum/cmd/geth@$(shell cat .gethrc); \
echo "Installed geth!"; true)
.PHONY: install-geth

generate-hotshot-binding:
forge build --root espresso-sequencer --out ../out --extra-output-files abi
mv ./out/HotShot.sol/HotShot.abi.json ./op-service/espresso/hotshot
rm -rf out
abigen --abi ./op-service/espresso/hotshot/HotShot.abi.json --pkg hotshot --out ./op-service/espresso/hotshot/hotshot.go
rm ./op-service/espresso/hotshot/HotShot.abi.json
2 changes: 1 addition & 1 deletion espresso-sequencer
84 changes: 51 additions & 33 deletions flake.lock

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

75 changes: 51 additions & 24 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,65 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;
inputs.solc-bin.url = "github:EspressoSystems/nix-solc-bin";

inputs.foundry.url = "github:shazow/foundry.nix/monthly";

outputs = { self, flake-utils, nixpkgs, foundry, ... }:
let
goVersion = 21; # Change this to update the whole stack
overlays = [
(final: prev: {
go = prev."go_1_${toString goVersion}";
# Overlaying nodejs here to ensure nodePackages use the desired
# version of nodejs.
nodejs = prev.nodejs-16_x;
pnpm = prev.nodePackages.pnpm;
yarn = prev.nodePackages.yarn;
})
foundry.overlay
];
in
outputs = { flake-utils, nixpkgs, solc-bin, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
goVersion = 21; # Change this to update the whole stack
overlays = [
# solc-bin.overlays.default
(final: prev: {
go = prev."go_1_${toString goVersion}";
# Overlaying nodejs here to ensure nodePackages use the desired
# version of nodejs.
nodejs = prev.nodejs_20;
pnpm = prev.nodePackages.pnpm;
yarn = prev.nodePackages.yarn;
})
];

pkgs = import nixpkgs {
inherit overlays system;
config = {
permittedInsecurePackages = [ "nodejs-16.20.2" ];
};
};
# nixWithFlakes allows pre v2.4 nix installations to use
# flake commands (like `nix flake update`)
nixWithFlakes = pkgs.writeShellScriptBin "nix" ''
exec ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
'';
foundry = pkgs.callPackage ./foundry { solc-bin-src = solc-bin; };
# Overriding version for go-packages is more complicated than it should be.
# To use a different go ethereum version the `version`, `hash` and `vendorHash` need to be updated.
#
# 1. Run the following command for `hash` :
#
# nix-shell -p nix-prefetch-github --run "nix-prefetch-github ethereum go-ethereum --nix --rev v1.13.4"
#
# 2. Replace the `vendorHash` with an empty string and run `nix develop`.
# 3. Find the `vendorHash` in the output in the line that starts with `got:` and copy it into this file.
go-ethereum =
let
version = "1.13.4";
src = pkgs.fetchFromGitHub {
owner = "ethereum";
repo = "go-ethereum";
rev = "v${version}";
hash = "sha256-RQlWWHoij3gtFwjJeEGsmd5YJNTGX0I84nOAQyWBx/M=";
};
vendorHash = "sha256-YmUgKO3JtVOE/YACqL/QBiyR1jT/jPCH+Gb0xYwkJEc=";
in
pkgs.go-ethereum.override {
buildGoModule = args: pkgs.buildGoModule (args // {
inherit version src vendorHash;
});
};
in
{
devShells.default = pkgs.mkShell {
COMPOSE_DOCKER_CLI_BUILD=1;
DOCKER_BUILDKIT=1;
COMPOSE_DOCKER_CLI_BUILD = 1;
DOCKER_BUILDKIT = 1;
packages = with pkgs; [
nixWithFlakes
go
# goimports, godoc, etc.
gotools
Expand All @@ -49,8 +76,8 @@
yarn # `pnpm build` fails without this

# Foundry, and tools like the anvil dev node
foundry-bin
solc
foundry
# solc

# Docker
docker-compose # provides the `docker-compose` command
Expand Down
69 changes: 69 additions & 0 deletions foundry/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, rustc
, libusb1
, darwin
, solc-bin-src
}:

rustPlatform.buildRustPackage rec {
pname = "foundry";
version = "0.2.0-dev";

# To update run the following command and change `rev` and `hash`
# nix-prefetch-github foundry-rs foundry --nix --rev 3e962e2efe17396886fcb1fd141ccf4204cd3a21
src = fetchFromGitHub {
owner = "foundry-rs";
repo = "foundry";
# NOTE: as of 2023-12-13 commits newer than the one below have a problem
# where they escape constructor arguments in the deployment JSON files. When
# updating, make sure to check if the problem is fixed, for example by
# running
#
# make devnet-clean
# make devnet-up-espresso
#
rev = "d85718785859dc0b5a095d2302d1a20ec06ab77a";
hash = "sha256-/yHvPUGHqek5255JkKGGK3TquCo4In9uBe0eaPkQr20=";
};

cargoLock = {
lockFile = src + "/Cargo.lock";
allowBuiltinFetchGit = true;
};

nativeBuildInputs = [
libusb1
] ++ lib.optionals stdenv.isDarwin [ darwin.DarwinTools ];

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

# Tests fail
doCheck = false;

# Enable svm-rs to build without network access by giving it a list of solc releases.
# We take the list from our solc flake repo so that it does not update unless we want to.
# Our repo: https://github.com/EspressoSystems/nix-solc-bin
# Upstream URL: https://binaries.soliditylang.org/linux-amd64/list.json
env = let platform = if stdenv.isLinux then "linux-amd64" else "macosx-amd64"; in {
SVM_RELEASES_LIST_JSON = "${solc-bin-src}/list-${platform}.json";
# Make `vergen` produce a meaningful version.
VERGEN_BUILD_TIMESTAMP = "0";
VERGEN_BUILD_SEMVER = version;
VERGEN_GIT_SHA = src.rev;
VERGEN_GIT_COMMIT_TIMESTAMP = "0";
VERGEN_GIT_BRANCH = "master";
VERGEN_RUSTC_SEMVER = rustc.version;
VERGEN_RUSTC_CHANNEL = "stable";
VERGEN_CARGO_PROFILE = "release";
};

meta = with lib; {
description = "A blazing fast, portable and modular toolkit for Ethereum application development";
homepage = "https://github.com/foundry-rs/foundry";
license = with licenses; [ mit apsl20 ];
maintainers = [ ];
};
}
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ go 1.21

require (
github.com/BurntSushi/toml v1.3.2
github.com/EspressoSystems/espresso-sequencer-go v0.0.1
github.com/btcsuite/btcd v0.23.3
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231030223232-e16eae11e492
github.com/ethereum/go-ethereum v1.13.1
github.com/ethereum/go-ethereum v1.13.5
github.com/fsnotify/fsnotify v1.7.0
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/docgen v1.2.0
Expand Down Expand Up @@ -72,7 +73,7 @@ require (
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
Expand All @@ -82,7 +83,7 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/fjl/memsize v0.0.1 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8=
github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/EspressoSystems/espresso-sequencer-go v0.0.1 h1:8Es2XVLJQoHvq9m4A7MfB3s33cZZmmiM/QhjZ9iiSxw=
github.com/EspressoSystems/espresso-sequencer-go v0.0.1/go.mod h1:T3MyQRnfbCSTBhAAG2WASmVPCwWkl0/sPKKY5Z1ewtg=
github.com/EspressoSystems/op-geth v1.2.6-espresso h1:nqdw9EvEn5K37vvSTPeOkTow2AwTqxLD68Qv055OwcY=
github.com/EspressoSystems/op-geth v1.2.6-espresso/go.mod h1:12W+vBetjYbDj5D2+V8hizke5yWuLrUDf7UmVkXTnCQ=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
Expand Down Expand Up @@ -105,8 +107,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80 h1:DuBDHVjgGMPki7bAyh91+3cF1Vh34sAEdH8JQgbc2R0=
github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI=
github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A=
github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4=
github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA=
github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down Expand Up @@ -155,8 +157,8 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231030223232-e16eae11e492 h1:FyzLzMLKMc9zcDYcSxbrLDglIRrGQJE9juFzIO35RmE=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231030223232-e16eae11e492/go.mod h1:/70H/KqrtKcvWvNGVj6S3rAcLC+kUPr3t2aDmYIS+Xk=
github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg=
github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g=
Expand Down
Loading