From 57f14f8e89e262818bfb06ddda1a0b23d323136b Mon Sep 17 00:00:00 2001 From: Roman Melnikov Date: Mon, 31 May 2021 18:37:31 +0300 Subject: [PATCH 1/4] Bump Tezos sources and opam dependencies Problem: The new Tezos version was released. Solution: Bump used tezos sources and their opam dependencies. --- nix/nix/sources.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nix/nix/sources.json b/nix/nix/sources.json index 05a5594d6..309968248 100644 --- a/nix/nix/sources.json +++ b/nix/nix/sources.json @@ -41,10 +41,10 @@ "homepage": "https://opam.ocaml.org", "owner": "ocaml", "repo": "opam-repository", - "rev": "d90747963ba246b00526d08d26241e5654f418bf", - "sha256": "0yd9y0wxzhm91j6wja190saqlbz8mvjgv5078b5ipyfg61sap44h", + "rev": "514e2415e1dcbf911a76f9655bac39dd28c2572e", + "sha256": "0zfyix0pphzsfasnh6ym8mplfjis7h7gnxsw483ls4mbi9d7p9ld", "type": "tarball", - "url": "https://github.com/ocaml/opam-repository/archive/d90747963ba246b00526d08d26241e5654f418bf.tar.gz", + "url": "https://github.com/ocaml/opam-repository/archive/514e2415e1dcbf911a76f9655bac39dd28c2572e.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "serokell-nix": { @@ -60,9 +60,9 @@ "url_template": "https://github.com///archive/.tar.gz" }, "tezos": { - "ref": "refs/tags/v9.1", + "ref": "refs/tags/v9.2", "repo": "https://gitlab.com/tezos/tezos", - "rev": "31e6641db444bdb5d3fb9f232282b429b8c3ea7a", + "rev": "bc2cc86f9769798df9f80da0df145597cff7401b", "type": "git" } } From 0c109bf9a71c4ffdaba532872245a2bc099fef3e Mon Sep 17 00:00:00 2001 From: Roman Melnikov Date: Tue, 1 Jun 2021 09:55:49 +0300 Subject: [PATCH 2/4] Update brew formulas version and remove old hashes Problem: The new Tezos version arrived. Solution: Bump versions in brew formulas and remove v9.1-1 bottles hashes since they're outdated now. --- Formula/tezos-accuser-009-PsFLoren.rb | 6 ++---- Formula/tezos-admin-client.rb | 6 ++---- Formula/tezos-baker-009-PsFLoren.rb | 6 ++---- Formula/tezos-client.rb | 6 ++---- Formula/tezos-codec.rb | 6 ++---- Formula/tezos-endorser-009-PsFLoren.rb | 6 ++---- Formula/tezos-node-florencenet.rb | 2 +- Formula/tezos-node-mainnet.rb | 2 +- Formula/tezos-node.rb | 6 ++---- Formula/tezos-sandbox.rb | 6 ++---- Formula/tezos-signer-http.rb | 2 +- Formula/tezos-signer-https.rb | 2 +- Formula/tezos-signer-tcp.rb | 2 +- Formula/tezos-signer-unix.rb | 2 +- Formula/tezos-signer.rb | 6 ++---- 15 files changed, 24 insertions(+), 42 deletions(-) diff --git a/Formula/tezos-accuser-009-PsFLoren.rb b/Formula/tezos-accuser-009-PsFLoren.rb index 2ee672686..497abca9c 100644 --- a/Formula/tezos-accuser-009-PsFLoren.rb +++ b/Formula/tezos-accuser-009-PsFLoren.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosAccuser009Psfloren.version}/" - sha256 cellar: :any, mojave: "b9906f66690c90af6dd716e8981cfed7c1da72904c44f2720bb4d28ec23f2de8" - sha256 cellar: :any, catalina: "6c506d633967c3c5ad39deb483871e03f5218fad4508aab821546a5395f9a5b8" end def make_deps diff --git a/Formula/tezos-admin-client.rb b/Formula/tezos-admin-client.rb index c7bc61e75..68190c5d3 100644 --- a/Formula/tezos-admin-client.rb +++ b/Formula/tezos-admin-client.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosAdminClient.version}/" - sha256 cellar: :any, mojave: "373c146b8989d8937154da0cca4c3cab51088ac5c3becf7a045e062a9aaaa370" - sha256 cellar: :any, catalina: "28a92df0b2b152eb60b488dd3cc912dd96215eaa696eceb7b269041d63c93c1a" end def make_deps diff --git a/Formula/tezos-baker-009-PsFLoren.rb b/Formula/tezos-baker-009-PsFLoren.rb index b0b96bd9f..cc0d40ee8 100644 --- a/Formula/tezos-baker-009-PsFLoren.rb +++ b/Formula/tezos-baker-009-PsFLoren.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosBaker009Psfloren.version}/" - sha256 cellar: :any, mojave: "8f317703aff2a8612c40dc1c224598486d964dbf57003b70c1c535dfc195325c" - sha256 cellar: :any, catalina: "8825c66454aa26641e101dde3a505195182afd87b0d72831ed10dd5c7124ad5e" end def make_deps diff --git a/Formula/tezos-client.rb b/Formula/tezos-client.rb index 30a1d2c19..aba747eea 100644 --- a/Formula/tezos-client.rb +++ b/Formula/tezos-client.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosClient.version}/" - sha256 cellar: :any, mojave: "efcfb8e3215d35734fc6a58b19d2cf072487db6376d45c4eba3e07a1bed37039" - sha256 cellar: :any, catalina: "a70f34680c071b48e6d308cb69324b4a88bfddc131324f405a8f508b5765af4b" end def make_deps diff --git a/Formula/tezos-codec.rb b/Formula/tezos-codec.rb index dd54faf43..6e8333295 100644 --- a/Formula/tezos-codec.rb +++ b/Formula/tezos-codec.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosCodec.version}/" - sha256 cellar: :any, mojave: "7fcb15085a501af648391e1c798be78da54c66e5a2296ded80ff607fedca9987" - sha256 cellar: :any, catalina: "4fb1cba11bc2adc04661dbc730ec1da4d774d4b5ff46473a77ca13cd0b752074" end def make_deps diff --git a/Formula/tezos-endorser-009-PsFLoren.rb b/Formula/tezos-endorser-009-PsFLoren.rb index 9e17779ee..e0c993b3b 100644 --- a/Formula/tezos-endorser-009-PsFLoren.rb +++ b/Formula/tezos-endorser-009-PsFLoren.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -28,8 +28,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosEndorser009Psfloren.version}/" - sha256 cellar: :any, mojave: "7ff3835a461aa9e59f5ca6f8b95cc5d62381d9186c38d7ddacc8c1c56d355899" - sha256 cellar: :any, catalina: "05c1116010981dea5627e2418b03f1744d35ed896ce224b01aa23722b3a6662a" end def make_deps diff --git a/Formula/tezos-node-florencenet.rb b/Formula/tezos-node-florencenet.rb index 8c4cc0a36..ca7a30c7b 100644 --- a/Formula/tezos-node-florencenet.rb +++ b/Formula/tezos-node-florencenet.rb @@ -4,7 +4,7 @@ class TezosNodeFlorencenet < Formula url "file:///dev/null" - version "v9.1-1" + version "v9.2-1" bottle :unneeded depends_on "tezos-node" diff --git a/Formula/tezos-node-mainnet.rb b/Formula/tezos-node-mainnet.rb index 543cb0280..c163ccdaf 100644 --- a/Formula/tezos-node-mainnet.rb +++ b/Formula/tezos-node-mainnet.rb @@ -4,7 +4,7 @@ class TezosNodeMainnet < Formula url "file:///dev/null" - version "v9.1-1" + version "v9.2-1" bottle :unneeded depends_on "tezos-node" diff --git a/Formula/tezos-node.rb b/Formula/tezos-node.rb index 18a111a1a..84822ec4d 100644 --- a/Formula/tezos-node.rb +++ b/Formula/tezos-node.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosNode.version}/" - sha256 cellar: :any, mojave: "87086776cd387cddef59c641a3cfb8083536c66d8e4c1bae663cd42372a038d4" - sha256 cellar: :any, catalina: "57cd589c9fce9583146926941c503c439d0303186f65f84ef9b8d09e16b24244" end def make_deps diff --git a/Formula/tezos-sandbox.rb b/Formula/tezos-sandbox.rb index edd6efb51..27ce0f7f5 100644 --- a/Formula/tezos-sandbox.rb +++ b/Formula/tezos-sandbox.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosSandbox.version}/" - sha256 cellar: :any, mojave: "1fbfa0a0157a18ba70ee04929d09ca99011afa47e0c518078fdc94cdc232f3bb" - sha256 cellar: :any, catalina: "ddd3c83f729bce04cc151a7b8a1335cbf34189bb653ec535d70dc8d716ddb60b" end def make_deps diff --git a/Formula/tezos-signer-http.rb b/Formula/tezos-signer-http.rb index fc5c96712..a5100bc60 100644 --- a/Formula/tezos-signer-http.rb +++ b/Formula/tezos-signer-http.rb @@ -4,7 +4,7 @@ class TezosSignerHttp < Formula url "file:///dev/null" - version "v9.1-1" + version "v9.2-1" bottle :unneeded depends_on "tezos-signer" diff --git a/Formula/tezos-signer-https.rb b/Formula/tezos-signer-https.rb index fe4c24a55..75e4a9198 100644 --- a/Formula/tezos-signer-https.rb +++ b/Formula/tezos-signer-https.rb @@ -4,7 +4,7 @@ class TezosSignerHttps < Formula url "file:///dev/null" - version "v9.1-1" + version "v9.2-1" bottle :unneeded depends_on "tezos-signer" diff --git a/Formula/tezos-signer-tcp.rb b/Formula/tezos-signer-tcp.rb index 873983225..e2478af2a 100644 --- a/Formula/tezos-signer-tcp.rb +++ b/Formula/tezos-signer-tcp.rb @@ -4,7 +4,7 @@ class TezosSignerTcp < Formula url "file:///dev/null" - version "v9.1-1" + version "v9.2-1" bottle :unneeded depends_on "tezos-signer" diff --git a/Formula/tezos-signer-unix.rb b/Formula/tezos-signer-unix.rb index dfee23bb1..02980bd07 100644 --- a/Formula/tezos-signer-unix.rb +++ b/Formula/tezos-signer-unix.rb @@ -4,7 +4,7 @@ class TezosSignerUnix < Formula url "file:///dev/null" - version "v9.1-1" + version "v9.2-1" bottle :unneeded depends_on "tezos-signer" diff --git a/Formula/tezos-signer.rb b/Formula/tezos-signer.rb index de4f32a37..0e13dfda4 100644 --- a/Formula/tezos-signer.rb +++ b/Formula/tezos-signer.rb @@ -10,9 +10,9 @@ class << self end homepage "https://gitlab.com/tezos/tezos" - url "https://gitlab.com/tezos/tezos.git", :tag => "v9.1", :shallow => false + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false - version "v9.1-1" + version "v9.2-1" build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] build_dependencies.each do |dependency| @@ -27,8 +27,6 @@ class << self bottle do root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosSigner.version}/" - sha256 cellar: :any, mojave: "00d7071d2fdc7054d33820c80321f06dc5700bebc4943582da9299d201f30c1a" - sha256 cellar: :any, catalina: "f96b524272ff42621323e6fe02e29cb1b53bf8bdfe4e62998936951b2c0df17d" end def make_deps From f27a70b6e45eed5021e182b42e1834b7a1ab39a9 Mon Sep 17 00:00:00 2001 From: Roman Melnikov Date: Tue, 1 Jun 2021 10:05:49 +0300 Subject: [PATCH 3/4] Support new protocol and testnet Problem: In v9.2 new protocol with the new testnet were added. We should support them. Solution: Provide 010 support along with the new granadanet. --- Formula/tezos-accuser-010-PtGRANAD.rb | 114 ++++++++++++++++++++++ Formula/tezos-baker-010-PtGRANAD.rb | 125 ++++++++++++++++++++++++ Formula/tezos-endorser-010-PtGRANAD.rb | 126 +++++++++++++++++++++++++ Formula/tezos-node-granadanet.rb | 89 +++++++++++++++++ docker/build/static_libs.patch | 45 +++++++++ docker/package/packages.py | 8 +- meta.json | 2 +- nix/build/hacks.nix | 20 ++++ nix/modules/common.nix | 4 +- nix/modules/tezos-accuser.nix | 6 +- nix/modules/tezos-baker.nix | 8 +- nix/modules/tezos-endorser.nix | 10 +- protocols.json | 3 +- scripts/build-bottles.sh | 3 + tests/test_script.py | 3 + 15 files changed, 551 insertions(+), 15 deletions(-) create mode 100644 Formula/tezos-accuser-010-PtGRANAD.rb create mode 100644 Formula/tezos-baker-010-PtGRANAD.rb create mode 100644 Formula/tezos-endorser-010-PtGRANAD.rb create mode 100644 Formula/tezos-node-granadanet.rb diff --git a/Formula/tezos-accuser-010-PtGRANAD.rb b/Formula/tezos-accuser-010-PtGRANAD.rb new file mode 100644 index 000000000..3922fd223 --- /dev/null +++ b/Formula/tezos-accuser-010-PtGRANAD.rb @@ -0,0 +1,114 @@ +# SPDX-FileCopyrightText: 2021 TQ Tezos +# +# SPDX-License-Identifier: LicenseRef-MIT-TQ + +class TezosAccuser010Ptgranad < Formula + @all_bins = [] + + class << self + attr_accessor :all_bins + end + homepage "https://gitlab.com/tezos/tezos" + + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false + + version "v9.2-1" + + build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] + build_dependencies.each do |dependency| + depends_on dependency => :build + end + + dependencies = %w[gmp hidapi libev libffi] + dependencies.each do |dependency| + depends_on dependency + end + desc "Daemon for accusing" + + bottle do + root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosAccuser010Ptgranad.version}/" + end + + def make_deps + ENV.deparallelize + ENV["CARGO_HOME"]="./.cargo" + system "rustup-init", "--default-toolchain", "1.44.0", "-y" + system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing" + system ["source .cargo/env", "make build-deps"].join(" && ") + end + + def install_template(dune_path, exec_path, name) + bin.mkpath + self.class.all_bins << name + system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ") + bin.install name + end + + def install + startup_contents = + <<~EOS + #!/usr/bin/env bash + + set -euo pipefail + + accuser="#{bin}/tezos-accuser-010-PtGRANAD" + + accuser_dir="$DATA_DIR" + + accuser_config="$accuser_dir/config" + mkdir -p "$accuser_dir" + + if [ ! -f "$accuser_config" ]; then + "$accuser" --base-dir "$accuser_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + config init --output "$accuser_config" >/dev/null 2>&1 + else + "$accuser" --base-dir "$accuser_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + config update >/dev/null 2>&1 + fi + + exec "$accuser" --base-dir "$accuser_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + run + EOS + File.write("tezos-accuser-010-PtGRANAD-start", startup_contents) + bin.install "tezos-accuser-010-PtGRANAD-start" + make_deps + install_template "src/proto_010_PtGRANAD/bin_accuser/main_accuser_010_PtGRANAD.exe", + "_build/default/src/proto_010_PtGRANAD/bin_accuser/main_accuser_010_PtGRANAD.exe", + "tezos-accuser-010-PtGRANAD" + end + + plist_options manual: "tezos-accuser-010-PtGRANAD run" + def plist + <<~EOS + + + + + Label + #{plist_name} + Program + #{opt_bin}/tezos-accuser-010-PtGRANAD-start + EnvironmentVariables + + DATA_DIR + #{var}/lib/tezos/client + NODE_RPC_ENDPOINT + http://localhost:8732 + + RunAtLoad + StandardOutPath + #{var}/log/#{name}.log + StandardErrorPath + #{var}/log/#{name}.log + + + EOS + end + def post_install + mkdir "#{var}/lib/tezos/client" + end +end diff --git a/Formula/tezos-baker-010-PtGRANAD.rb b/Formula/tezos-baker-010-PtGRANAD.rb new file mode 100644 index 000000000..a9fb7c682 --- /dev/null +++ b/Formula/tezos-baker-010-PtGRANAD.rb @@ -0,0 +1,125 @@ +# SPDX-FileCopyrightText: 2021 TQ Tezos +# +# SPDX-License-Identifier: LicenseRef-MIT-TQ + +class TezosBaker010Ptgranad < Formula + @all_bins = [] + + class << self + attr_accessor :all_bins + end + homepage "https://gitlab.com/tezos/tezos" + + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false + + version "v9.2-1" + + build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] + build_dependencies.each do |dependency| + depends_on dependency => :build + end + + dependencies = %w[gmp hidapi libev libffi tezos-sapling-params] + dependencies.each do |dependency| + depends_on dependency + end + desc "Daemon for baking" + + bottle do + root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosBaker010Ptgranad.version}/" + end + + def make_deps + ENV.deparallelize + ENV["CARGO_HOME"]="./.cargo" + system "rustup-init", "--default-toolchain", "1.44.0", "-y" + system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing" + system ["source .cargo/env", "make build-deps"].join(" && ") + end + + def install_template(dune_path, exec_path, name) + bin.mkpath + self.class.all_bins << name + system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ") + bin.install name + end + + def install + startup_contents = + <<~EOS + #!/usr/bin/env bash + + set -euo pipefail + + baker="#{bin}/tezos-baker-010-PtGRANAD" + + baker_dir="$DATA_DIR" + + baker_config="$baker_dir/config" + mkdir -p "$baker_dir" + + if [ ! -f "$baker_config" ]; then + "$baker" --base-dir "$baker_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + config init --output "$baker_config" >/dev/null 2>&1 + else + "$baker" --base-dir "$baker_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + config update >/dev/null 2>&1 + fi + + launch_baker() { + exec "$baker" \ + --base-dir "$baker_dir" --endpoint "$NODE_RPC_ENDPOINT" \ + run with local node "$NODE_DATA_DIR" "$@" + } + + if [[ -z "$BAKER_ACCOUNT" ]]; then + launch_baker + else + launch_baker "$BAKER_ACCOUNT" + fi + EOS + File.write("tezos-baker-010-PtGRANAD-start", startup_contents) + bin.install "tezos-baker-010-PtGRANAD-start" + make_deps + install_template "src/proto_010_PtGRANAD/bin_baker/main_baker_010_PtGRANAD.exe", + "_build/default/src/proto_010_PtGRANAD/bin_baker/main_baker_010_PtGRANAD.exe", + "tezos-baker-010-PtGRANAD" + end + plist_options manual: "tezos-baker-010-PtGRANAD run with local node" + def plist + <<~EOS + + + + + Label + #{plist_name} + Program + #{opt_bin}/tezos-baker-010-PtGRANAD-start + EnvironmentVariables + + DATA_DIR + #{var}/lib/tezos/client + NODE_DATA_DIR + + NODE_RPC_ENDPOINT + http://localhost:8732 + BAKER_ACCOUNT + + + RunAtLoad + StandardOutPath + #{var}/log/#{name}.log + StandardErrorPath + #{var}/log/#{name}.log + + + EOS + end + def post_install + mkdir "#{var}/lib/tezos/client" + end +end diff --git a/Formula/tezos-endorser-010-PtGRANAD.rb b/Formula/tezos-endorser-010-PtGRANAD.rb new file mode 100644 index 000000000..0b58abfd1 --- /dev/null +++ b/Formula/tezos-endorser-010-PtGRANAD.rb @@ -0,0 +1,126 @@ +# SPDX-FileCopyrightText: 2021 TQ Tezos +# +# SPDX-License-Identifier: LicenseRef-MIT-TQ + +class TezosEndorser010Ptgranad < Formula + @all_bins = [] + + class << self + attr_accessor :all_bins + end + homepage "https://gitlab.com/tezos/tezos" + + url "https://gitlab.com/tezos/tezos.git", :tag => "v9.2", :shallow => false + + version "v9.2-1" + + build_dependencies = %w[pkg-config autoconf rsync wget opam rustup-init] + build_dependencies.each do |dependency| + depends_on dependency => :build + end + + dependencies = %w[gmp hidapi libev libffi] + dependencies.each do |dependency| + depends_on dependency + end + + desc "Daemon for endorsing" + + bottle do + root_url "https://github.com/serokell/tezos-packaging/releases/download/#{TezosEndorser010Ptgranad.version}/" + end + + def make_deps + ENV.deparallelize + ENV["CARGO_HOME"]="./.cargo" + system "rustup-init", "--default-toolchain", "1.44.0", "-y" + system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing" + system ["source .cargo/env", "make build-deps"].join(" && ") + end + + def install_template(dune_path, exec_path, name) + bin.mkpath + self.class.all_bins << name + system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ") + bin.install name + end + + + def install + startup_contents = + <<~EOS + #!/usr/bin/env bash + + set -euo pipefail + + endorser="#{bin}/tezos-endorser-010-PtGRANAD" + + endorser_dir="$DATA_DIR" + + endorser_config="$endorser_dir/config" + mkdir -p "$endorser_dir" + + if [ ! -f "$endorser_config" ]; then + "$endorser" --base-dir "$endorser_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + config init --output "$endorser_config" >/dev/null 2>&1 + else + "$endorser" --base-dir "$endorser_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + config update >/dev/null 2>&1 + fi + + launch_endorser() { + exec "$endorser" --base-dir "$endorser_dir" \ + --endpoint "$NODE_RPC_ENDPOINT" \ + run "$@" + } + + if [[ -z "$ENDORSER_ACCOUNT" ]]; then + launch_endorser + else + launch_endorser "$ENDORSER_ACCOUNT" + fi + EOS + File.write("tezos-endorser-010-PtGRANAD-start", startup_contents) + bin.install "tezos-endorser-010-PtGRANAD-start" + make_deps + install_template "src/proto_010_PtGRANAD/bin_endorser/main_endorser_010_PtGRANAD.exe", + "_build/default/src/proto_010_PtGRANAD/bin_endorser/main_endorser_010_PtGRANAD.exe", + "tezos-endorser-010-PtGRANAD" + end + + plist_options manual: "tezos-endorser-010-PtGRANAD run" + def plist + <<~EOS + + + + + Label + #{plist_name} + Program + #{opt_bin}/tezos-endorser-010-PtGRANAD-start + EnvironmentVariables + + DATA_DIR + #{var}/lib/tezos/client + NODE_RPC_ENDPOINT + http://localhost:8732 + ENDORSER_ACCOUNT + + + RunAtLoad + StandardOutPath + #{var}/log/#{name}.log + StandardErrorPath + #{var}/log/#{name}.log + + + EOS + end + def post_install + mkdir "#{var}/lib/tezos/client" + end +end diff --git a/Formula/tezos-node-granadanet.rb b/Formula/tezos-node-granadanet.rb new file mode 100644 index 000000000..11a734a0c --- /dev/null +++ b/Formula/tezos-node-granadanet.rb @@ -0,0 +1,89 @@ +# SPDX-FileCopyrightText: 2021 TQ Tezos +# +# SPDX-License-Identifier: LicenseRef-MIT-TQ + +class TezosNodeGranadanet < Formula + url "file:///dev/null" + version "v9.2-1" + + bottle :unneeded + depends_on "tezos-node" + + desc "Meta formula that provides background tezos-node service that runs on granadanet" + + def install + startup_contents = + <<~EOS + #!/usr/bin/env bash + + set -euo pipefail + + node="/usr/local/bin/tezos-node" + # default location of the config file + config_file="$DATA_DIR/config.json" + + mkdir -p "$DATA_DIR" + if [[ ! -f "$config_file" ]]; then + echo "Configuring the node..." + "$node" config init \ + --data-dir "$DATA_DIR" \ + --rpc-addr "$NODE_RPC_ADDR" \ + --network=granadanet \ + "$@" + else + echo "Updating the node configuration..." + "$node" config update \ + --data-dir "$DATA_DIR" \ + --rpc-addr "$NODE_RPC_ADDR" \ + --network=granadanet \ + "$@" + fi + + # Launching the node + if [[ -z "$CERT_PATH" || -z "$KEY_PATH" ]]; then + exec "$node" run --data-dir "$DATA_DIR" --config-file="$config_file" + else + exec "$node" run --data-dir "$DATA_DIR" --config-file="$config_file" \ + --rpc-tls="$CERT_PATH","$KEY_PATH" + fi + EOS + File.write("tezos-node-granadanet-start", startup_contents) + bin.install "tezos-node-granadanet-start" + print "Installing tezos-node-granadanet service" + end + def plist + <<~EOS + + + + + Label + #{plist_name} + Program + #{opt_bin}/tezos-node-granadanet-start + EnvironmentVariables + + DATA_DIR + #{var}/lib/tezos/node-granadanet + NODE_RPC_ADDR + 127.0.0.1:8732 + CERT_PATH + + KEY_PATH + + + RunAtLoad + StandardOutPath + #{var}/log/#{name}.log + StandardErrorPath + #{var}/log/#{name}.log + + + EOS + end + def post_install + mkdir_p "#{var}/lib/tezos/node-granadanet" + system "tezos-node", "config", "init", "--data-dir" "#{var}/lib/tezos/node-granadanet", "--network", "granadanet" + end +end diff --git a/docker/build/static_libs.patch b/docker/build/static_libs.patch index 9154db55c..632a0d36d 100644 --- a/docker/build/static_libs.patch +++ b/docker/build/static_libs.patch @@ -231,3 +231,48 @@ index c19a310a8f..6c38226293 100644 (rule (alias runtest_lint) +diff --git a/src/proto_010_PtGRANAD/bin_accuser/dune b/src/proto_010_PtGRANAD/bin_accuser/dune +index 8cf78a6cb..1e169e66a 100644 +--- a/src/proto_010_PtGRANAD/bin_accuser/dune ++++ b/src/proto_010_PtGRANAD/bin_accuser/dune +@@ -10,7 +10,9 @@ + -open Tezos_client_commands + -open Tezos_baking_010_PtGRANAD_commands + -open Tezos_stdlib_unix +- -open Tezos_client_base_unix))) ++ -open Tezos_client_base_unix ++ -ccopt -static ++ -cclib "-lusb-1.0 -lhidapi-libusb -ludev"))) + + (rule + (alias runtest_lint) +diff --git a/src/proto_010_PtGRANAD/bin_baker/dune b/src/proto_010_PtGRANAD/bin_baker/dune +index a8f2ec209..0a94aaecc 100644 +--- a/src/proto_010_PtGRANAD/bin_baker/dune ++++ b/src/proto_010_PtGRANAD/bin_baker/dune +@@ -10,7 +10,9 @@ + -open Tezos_client_commands + -open Tezos_baking_010_PtGRANAD_commands + -open Tezos_stdlib_unix +- -open Tezos_client_base_unix))) ++ -open Tezos_client_base_unix ++ -ccopt -static ++ -cclib "-lusb-1.0 -lhidapi-libusb -ludev"))) + + (rule + (alias runtest_lint) +diff --git a/src/proto_010_PtGRANAD/bin_endorser/dune b/src/proto_010_PtGRANAD/bin_endorser/dune +index da13938ba..99b3cb746 100644 +--- a/src/proto_010_PtGRANAD/bin_endorser/dune ++++ b/src/proto_010_PtGRANAD/bin_endorser/dune +@@ -10,7 +10,9 @@ + -open Tezos_client_commands + -open Tezos_baking_010_PtGRANAD_commands + -open Tezos_stdlib_unix +- -open Tezos_client_base_unix))) ++ -open Tezos_client_base_unix ++ -ccopt -static ++ -cclib "-lusb-1.0 -lhidapi-libusb -ludev"))) + + (rule + (alias runtest_lint) diff --git a/docker/package/packages.py b/docker/package/packages.py index 2fd075d48..56b06f8c0 100644 --- a/docker/package/packages.py +++ b/docker/package/packages.py @@ -13,8 +13,12 @@ from .systemd import Service, ServiceFile, SystemdUnit, Unit, Install -networks = ["mainnet", "florencenet"] -networks_protos = {"mainnet": ["009-PsFLoren"], "florencenet": ["009-PsFLoren"]} +networks = ["mainnet", "florencenet", "granadanet"] +networks_protos = { + "mainnet": ["009-PsFLoren"], + "florencenet": ["009-PsFLoren"], + "granadanet": ["010-PtGRANAD"], +} signer_units = [ SystemdUnit( diff --git a/meta.json b/meta.json index 743e49a07..2773b2261 100644 --- a/meta.json +++ b/meta.json @@ -1,4 +1,4 @@ { - "release": "4", + "release": "1", "maintainer": "Serokell " } diff --git a/nix/build/hacks.nix b/nix/build/hacks.nix index a623e8af5..2959598dc 100644 --- a/nix/build/hacks.nix +++ b/nix/build/hacks.nix @@ -185,6 +185,11 @@ rec { buildInputs = o.buildInputs ++ [ librustzcash ]; XDG_DATA_DIRS = "${zcash-params}:$XDG_DATA_DIRS"; }); + tezos-protocol-010-PtGRANAD-parameters = osuper.tezos-protocol-010-PtGRANAD-parameters.overrideAttrs + (o: rec { + buildInputs = o.buildInputs ++ [ librustzcash ]; + XDG_DATA_DIRS = "${zcash-params}:$XDG_DATA_DIRS"; + }); # FIXME apply this patch upstream tezos-stdlib-unix = osuper.tezos-stdlib-unix.overrideAttrs @@ -212,6 +217,21 @@ rec { buildInputs = o.buildInputs ++ [ librustzcash self.makeWrapper ]; postFixup = zcash-post-fixup o; }); + tezos-accuser-010-PtGRANAD = osuper.tezos-accuser-010-PtGRANAD.overrideAttrs + (o: { + buildInputs = o.buildInputs ++ [ librustzcash self.makeWrapper ]; + postFixup = zcash-post-fixup o; + }); + tezos-baker-010-PtGRANAD = osuper.tezos-baker-010-PtGRANAD.overrideAttrs + (o: { + buildInputs = o.buildInputs ++ [ librustzcash self.makeWrapper ]; + postFixup = zcash-post-fixup o; + }); + tezos-endorser-010-PtGRANAD = osuper.tezos-endorser-010-PtGRANAD.overrideAttrs + (o: { + buildInputs = o.buildInputs ++ [ librustzcash self.makeWrapper ]; + postFixup = zcash-post-fixup o; + }); tezos-codec = osuper.tezos-codec.overrideAttrs (o: { buildInputs = o.buildInputs ++ [ rustc-bls12-381 librustzcash self.makeWrapper ]; diff --git a/nix/modules/common.nix b/nix/modules/common.nix index 02a097bcc..22ac769d3 100644 --- a/nix/modules/common.nix +++ b/nix/modules/common.nix @@ -22,10 +22,10 @@ rec { daemonOptions = sharedOptions // { baseProtocol = mkOption { - type = types.enum [ "009-PsFLoren"]; + type = types.enum [ "009-PsFLoren" "010-PtGRANAD"]; description = '' Base protocol version, - only '009-PsFLoren' is supported. + '009-PsFLoren' and '010-PtGRANAD' are supported. ''; example = "009-PsFLoren"; }; diff --git a/nix/modules/tezos-accuser.nix b/nix/modules/tezos-accuser.nix index 523e4245f..fca6933e3 100644 --- a/nix/modules/tezos-accuser.nix +++ b/nix/modules/tezos-accuser.nix @@ -9,7 +9,9 @@ with lib; let tezos-accuser-pkgs = { "009-PsFLoren" = - "${pkgs.ocamlPackages.tezos-baker-009-PsFLoren}/bin/tezos-baker-009-PsFLoren"; + "${pkgs.ocamlPackages.tezos-accuser-009-PsFLoren}/bin/tezos-accuser-009-PsFLoren"; + "010-PtGRANAD" = + "${pkgs.ocamlPackages.tezos-accuser-010-PtGRANAD}/bin/tezos-accuser-010-PtGRANAD"; }; cfg = config.services.tezos-accuser; common = import ./common.nix { inherit lib; inherit pkgs; }; @@ -33,7 +35,7 @@ in { let accuser-script = node-cfg: '' ${tezos-accuser-pkgs.${node-cfg.baseProtocol}} -d "$STATE_DIRECTORY/client/data" \ -E "http://localhost:${toString node-cfg.rpcPort}" \ - run with local node "$STATE_DIRECTORY/node/data" "$@" + run "$@" ''; in common.genDaemonConfig cfg.instances "accuser" tezos-accuser-pkgs accuser-script; } diff --git a/nix/modules/tezos-baker.nix b/nix/modules/tezos-baker.nix index 171feb975..c5d508393 100644 --- a/nix/modules/tezos-baker.nix +++ b/nix/modules/tezos-baker.nix @@ -10,6 +10,8 @@ let tezos-baker-pkgs = { "009-PsFLoren" = "${pkgs.ocamlPackages.tezos-baker-009-PsFLoren}/bin/tezos-baker-009-PsFLoren"; + "010-PtGRANAD" = + "${pkgs.ocamlPackages.tezos-baker-010-PtGRANAD}/bin/tezos-baker-010-PtGRANAD"; }; cfg = config.services.tezos-baker; common = import ./common.nix { inherit lib; inherit pkgs; }; @@ -18,11 +20,11 @@ let enable = mkEnableOption "Tezos baker service"; - endorserAccountAlias = mkOption { + bakerAccountAlias = mkOption { type = types.str; default = ""; description = '' - Alias for the tezos-endorser account. + Alias for the tezos-baker account. ''; }; @@ -41,7 +43,7 @@ in { let baker-script = node-cfg: '' ${tezos-baker-pkgs.${node-cfg.baseProtocol}} -d "$STATE_DIRECTORY/client/data" \ -E "http://localhost:${toString node-cfg.rpcPort}" \ - run with local node "$STATE_DIRECTORY/node/data" ${node-cfg.endorserAccountAlias} + run with local node "$STATE_DIRECTORY/node/data" ${node-cfg.bakerAccountAlias} ''; in common.genDaemonConfig cfg.instances "baker" tezos-baker-pkgs baker-script; } diff --git a/nix/modules/tezos-endorser.nix b/nix/modules/tezos-endorser.nix index c31962617..e92332ea3 100644 --- a/nix/modules/tezos-endorser.nix +++ b/nix/modules/tezos-endorser.nix @@ -9,7 +9,9 @@ with lib; let tezos-endorser-pkgs = { "009-PsFLoren" = - "${pkgs.ocamlPackages.tezos-baker-009-PsFLoren}/bin/tezos-baker-009-PsFLoren"; + "${pkgs.ocamlPackages.tezos-endorser-009-PsFLoren}/bin/tezos-endorser-009-PsFLoren"; + "010-PtGRANAD" = + "${pkgs.ocamlPackages.tezos-endorser-010-PtGRANAD}/bin/tezos-endorser-010-PtGRANAD"; }; common = import ./common.nix { inherit lib; inherit pkgs; }; cfg = config.services.tezos-endorser; @@ -18,11 +20,11 @@ let enable = mkEnableOption "Tezos endorser service"; - bakerAccountAlias = mkOption { + endorserAccountAlias = mkOption { type = types.str; default = ""; description = '' - Alias for the tezos-baker account. + Alias for the tezos-endorser account. ''; }; @@ -41,7 +43,7 @@ in { let endorser-script = node-cfg: '' ${tezos-endorser-pkgs.${node-cfg.baseProtocol}} -d "$STATE_DIRECTORY/client/data" \ -E "http://localhost:${toString node-cfg.rpcPort}" \ - run with local node "$STATE_DIRECTORY/node/data" ${node-cfg.bakerAccountAlias} + run ${node-cfg.endorserAccountAlias} ''; in common.genDaemonConfig cfg.instances "endorser" tezos-endorser-pkgs endorser-script; } diff --git a/protocols.json b/protocols.json index ef1db766b..d4e31dd89 100644 --- a/protocols.json +++ b/protocols.json @@ -19,6 +19,7 @@ "008-PtEdo2Zk" ], "active": [ - "009-PsFLoren" + "009-PsFLoren", + "010-PtGRANAD" ] } diff --git a/scripts/build-bottles.sh b/scripts/build-bottles.sh index 5260113df..091cb7a1a 100755 --- a/scripts/build-bottles.sh +++ b/scripts/build-bottles.sh @@ -18,11 +18,14 @@ brew bottle --force-core-tap --no-rebuild ./Formula/tezos-sapling-params.rb # we don't bottle meta-formulas that contains only services build_bottle ./Formula/tezos-accuser-009-PsFLoren.rb +build_bottle ./Formula/tezos-accuser-010-PtGRANAD.rb build_bottle ./Formula/tezos-admin-client.rb build_bottle ./Formula/tezos-baker-009-PsFLoren.rb +build_bottle ./Formula/tezos-baker-010-PtGRANAD.rb build_bottle ./Formula/tezos-client.rb build_bottle ./Formula/tezos-codec.rb build_bottle ./Formula/tezos-endorser-009-PsFLoren.rb +build_bottle ./Formula/tezos-endorser-010-PtGRANAD.rb build_bottle ./Formula/tezos-node.rb build_bottle ./Formula/tezos-sandbox.rb build_bottle ./Formula/tezos-signer.rb diff --git a/tests/test_script.py b/tests/test_script.py index e82cdd0b1..1cccb1a6b 100644 --- a/tests/test_script.py +++ b/tests/test_script.py @@ -86,6 +86,9 @@ def test_node_with_daemons_scenario(network, use_tls=False): with subtest("run node with daemons on florencenet"): test_node_with_daemons_scenario("florencenet") +with subtest("run node with daemons on granadanet"): + test_node_with_daemons_scenario("granadanet") + with subtest("run node with daemons on mainnet"): test_node_with_daemons_scenario("mainnet") From a95e968a96897d9924130dc70c5b3a388f68539d Mon Sep 17 00:00:00 2001 From: Roman Melnikov Date: Thu, 3 Jun 2021 14:43:25 +0300 Subject: [PATCH 4/4] Suspend native packaging again Problem: Some other projects depend on our static binaries and brew bottles so we don't want to wait for opam-repository update anymore. Solution: Make v9.2 release without native packages. --- .buildkite/pipeline-raw.yml | 106 ++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.buildkite/pipeline-raw.yml b/.buildkite/pipeline-raw.yml index 34eb29258..5da243eeb 100644 --- a/.buildkite/pipeline-raw.yml +++ b/.buildkite/pipeline-raw.yml @@ -98,59 +98,59 @@ steps: # files from nix/ are massively used in tests ifrastructure - nix/.* - - label: test deb source packages via docker - commands: - - eval "$SET_VERSION" - - ./docker/docker-tezos-packages.sh --os ubuntu --type source - artifact_paths: - - ./out/* - branches: "!master" - timeout_in_minutes: 60 - agents: - queue: "docker" - only_changes: &native_packaging_changes_regexes - - docker/package/.* - - docker/docker-tezos-packages.sh - - meta.json - - protocols.json - - nix/nix/sources.json - - label: test deb binary packages via docker - commands: - - eval "$SET_VERSION" - # Building all binary packages will take significant amount of time, so we build only one - # in order to ensure package generation sanity - - ./docker/docker-tezos-packages.sh --os ubuntu --type binary --package tezos-baker-009-PsFLoren - - rm -rf out - # It takes much time to build binary package, so we do it only on master - branches: "master" - timeout_in_minutes: 90 - agents: - queue: "docker" - only_changes: *native_packaging_changes_regexes - - label: test rpm source packages via docker - commands: - - eval "$SET_VERSION" - - ./docker/docker-tezos-packages.sh --os fedora --type source - artifact_paths: - - ./out/* - branches: "!master" - timeout_in_minutes: 60 - agents: - queue: "docker" - only_changes: *native_packaging_changes_regexes - - label: test rpm binary packages via docker - commands: - - eval "$SET_VERSION" - # Building all binary packages will take significant amount of time, so we build only one - # in order to ensure package generation sanity - - ./docker/docker-tezos-packages.sh --os fedora --type binary --package tezos-baker-009-PsFLoren - - rm -rf out - # It takes much time to build binary package, so we do it only on master - branches: "master" - timeout_in_minutes: 90 - agents: - queue: "docker" - only_changes: *native_packaging_changes_regexes +# - label: test deb source packages via docker +# commands: +# - eval "$SET_VERSION" +# - ./docker/docker-tezos-packages.sh --os ubuntu --type source +# artifact_paths: +# - ./out/* +# branches: "!master" +# timeout_in_minutes: 60 +# agents: +# queue: "docker" +# only_changes: &native_packaging_changes_regexes +# - docker/package/.* +# - docker/docker-tezos-packages.sh +# - meta.json +# - protocols.json +# - nix/nix/sources.json +# - label: test deb binary packages via docker +# commands: +# - eval "$SET_VERSION" +# # Building all binary packages will take significant amount of time, so we build only one +# # in order to ensure package generation sanity +# - ./docker/docker-tezos-packages.sh --os ubuntu --type binary --package tezos-baker-009-PsFLoren +# - rm -rf out +# # It takes much time to build binary package, so we do it only on master +# branches: "master" +# timeout_in_minutes: 90 +# agents: +# queue: "docker" +# only_changes: *native_packaging_changes_regexes +# - label: test rpm source packages via docker +# commands: +# - eval "$SET_VERSION" +# - ./docker/docker-tezos-packages.sh --os fedora --type source +# artifact_paths: +# - ./out/* +# branches: "!master" +# timeout_in_minutes: 60 +# agents: +# queue: "docker" +# only_changes: *native_packaging_changes_regexes +# - label: test rpm binary packages via docker +# commands: +# - eval "$SET_VERSION" +# # Building all binary packages will take significant amount of time, so we build only one +# # in order to ensure package generation sanity +# - ./docker/docker-tezos-packages.sh --os fedora --type binary --package tezos-baker-009-PsFLoren +# - rm -rf out +# # It takes much time to build binary package, so we do it only on master +# branches: "master" +# timeout_in_minutes: 90 +# agents: +# queue: "docker" +# only_changes: *native_packaging_changes_regexes - label: create auto pre-release commands: