diff --git a/.gitignore b/.gitignore index 97a71678e4b..d0d1031a9b2 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,8 @@ src/libp2p_ipc/libp2p_ipc_capnp.mli maintenance/*.dot maintenance/*.png +scripts/genesis_ledger.json + automation/*config.json automation/!bsconfig.json automation/*/venv/* diff --git a/.mergify.yml b/.mergify.yml deleted file mode 100644 index abe93db54dc..00000000000 --- a/.mergify.yml +++ /dev/null @@ -1,48 +0,0 @@ -pull_request_rules: - - name: automatically merge approved PRs with the ready-to-merge label - conditions: - - "status-success=buildkite/mina-pr-gating" - - "status-success=buildkite/mina/pr" - - "#approved-reviews-by>=1" - - label=ready-to-merge - actions: - merge: - method: merge - strict: false - delete_head_branch: {} - - name: automatically merge approved PRs into develop with the ready-to-merge-into-develop label - conditions: - - "status-success=buildkite/mina-pr-gating" - - "status-success=buildkite/mina/pr" - - "#approved-reviews-by>=1" - - label=ready-to-merge-into-develop - - base=develop - actions: - merge: - method: merge - strict: false - delete_head_branch: {} - - name: automatically merge approved PRs into develop-until-4.1-hardfork with the ready-to-merge-into-develop label - conditions: - - "status-success=buildkite/mina-pr-gating" - - "status-success=buildkite/mina/pr" - - "#approved-reviews-by>=1" - - label=ready-to-merge-into-develop - - base=develop-until-4.1-hardfork - actions: - merge: - method: merge - strict: false - delete_head_branch: {} - - name: automatically merge approved PRs into develop-until-adversarial with the ready-to-merge-into-develop label - conditions: - - "status-success=buildkite/mina-pr-gating" - - "status-success=buildkite/mina/pr" - - "#approved-reviews-by>=1" - - label=ready-to-merge-into-develop - - base=develop-until-adversarial - actions: - merge: - method: merge - strict: false - delete_head_branch: {} diff --git a/.mergify.yml.jinja b/.mergify.yml.jinja deleted file mode 100644 index e32b044167a..00000000000 --- a/.mergify.yml.jinja +++ /dev/null @@ -1,52 +0,0 @@ -pull_request_rules: - - name: automatically merge approved PRs with the ready-to-merge label - conditions: - {%- for status in required_status | sort %} - - "status-success={{status}}" - {%- endfor %} - - "#approved-reviews-by>=1" - - label=ready-to-merge - actions: - merge: - method: merge - strict: false - delete_head_branch: {} - - name: automatically merge approved PRs into develop with the ready-to-merge-into-develop label - conditions: - {%- for status in required_status | sort %} - - "status-success={{status}}" - {%- endfor %} - - "#approved-reviews-by>=1" - - label=ready-to-merge-into-develop - - base=develop - actions: - merge: - method: merge - strict: false - delete_head_branch: {} - - name: automatically merge approved PRs into develop-until-4.1-hardfork with the ready-to-merge-into-develop label - conditions: - {%- for status in required_status | sort %} - - "status-success={{status}}" - {%- endfor %} - - "#approved-reviews-by>=1" - - label=ready-to-merge-into-develop - - base=develop-until-4.1-hardfork - actions: - merge: - method: merge - strict: false - delete_head_branch: {} - - name: automatically merge approved PRs into develop-until-adversarial with the ready-to-merge-into-develop label - conditions: - {%- for status in required_status | sort %} - - "status-success={{status}}" - {%- endfor %} - - "#approved-reviews-by>=1" - - label=ready-to-merge-into-develop - - base=develop-until-adversarial - actions: - merge: - method: merge - strict: false - delete_head_branch: {} diff --git a/buildkite/scripts/merges-cleanly-to-develop.sh b/buildkite/scripts/merges-cleanly-to-develop.sh deleted file mode 100755 index 29e8217a027..00000000000 --- a/buildkite/scripts/merges-cleanly-to-develop.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -if [ "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" != "compatible" ]; then exit 0; fi - -# Adapted from this stackoverflow answer: https://stackoverflow.com/a/10856937 -# The git merge-tree command shows the content of a 3-way merge without -# touching the index, which we can then search for conflict markers. -git merge-tree `git merge-base origin/develop HEAD` origin/develop HEAD | grep "^<<<<<<<" - -RET=$? - -if [ $RET -eq 0 ]; then - # Found a conflict - exit 1 -else - # No conflicts were found - exit 0 -fi diff --git a/buildkite/scripts/merges-cleanly.sh b/buildkite/scripts/merges-cleanly.sh new file mode 100755 index 00000000000..b698fd5763d --- /dev/null +++ b/buildkite/scripts/merges-cleanly.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +BRANCH=$1 +CURRENT=$(git branch --show-current) +echo 'Testing for conflicts between the current branch `'"${CURRENT}"'` and `'"${BRANCH}"'`...' + +# Adapted from this stackoverflow answer: https://stackoverflow.com/a/10856937 +# The git merge-tree command shows the content of a 3-way merge without +# touching the index, which we can then search for conflict markers. + +git merge-tree `git merge-base origin/$BRANCH HEAD` HEAD origin/$BRANCH | grep -A 25 "^+<<<<<<<" + +RET=$? + +if [ $RET -eq 0 ]; then + # Found a conflict + echo "[ERROR] This pull request conflicts with $BRANCH, please open a new pull request against $BRANCH at this link:" + echo "https://github.com/MinaProtocol/mina/compare/${BRANCH}...${BUILDKITE_BRANCH}" + exit 1 +else + echo "No conflicts found against upstream branch ${BRANCH}" + exit 0 +fi diff --git a/buildkite/src/Command/DockerImage.dhall b/buildkite/src/Command/DockerImage.dhall index 61a40e1bc0b..f2fa804d211 100644 --- a/buildkite/src/Command/DockerImage.dhall +++ b/buildkite/src/Command/DockerImage.dhall @@ -58,7 +58,7 @@ let generateStep = \(spec : ReleaseSpec.Type) -> Command.build Command.Config::{ commands = commands, - label = "Release Docker Image: ${spec.step_key}", + label = "Docker: ${spec.step_key}", key = spec.step_key, target = Size.XLarge, docker_login = Some DockerLogin::{=}, diff --git a/buildkite/src/Command/MinaArtifact.dhall b/buildkite/src/Command/MinaArtifact.dhall index c5e6f411356..bb8272519b4 100644 --- a/buildkite/src/Command/MinaArtifact.dhall +++ b/buildkite/src/Command/MinaArtifact.dhall @@ -20,6 +20,8 @@ let dirtyWhen = [ S.strictlyStart (S.contains "buildkite/src/Command/MinaArtifact"), S.exactly "buildkite/scripts/build-artifact" "sh", S.exactly "buildkite/scripts/connect-to-mainnet-on-compatible" "sh", + S.strictlyStart (S.contains "buildkite/src/Jobs/Test"), + S.strictlyStart (S.contains "buildkite/src/Command"), S.strictlyStart (S.contains "dockerfiles"), S.strictlyStart (S.contains "scripts") ] @@ -49,7 +51,7 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion -- add zexe standardization preprocessing step (see: https://github.com/MinaProtocol/mina/pull/5777) "PREPROCESSOR=./scripts/zexe-standardize.sh" ] "./buildkite/scripts/build-artifact.sh", - label = "Build Mina packages for Debian ${DebianVersions.capitalName debVersion}", + label = "Build Mina for ${DebianVersions.capitalName debVersion}", key = "build-deb-pkg", target = Size.XLarge, retries = [ Command.Retry::{ exit_status = +2, limit = Some 2 } ] -- libp2p error @@ -97,9 +99,9 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion let rosettaSpec = DockerImage.ReleaseSpec::{ deps=DebianVersions.dependsOnGitEnv, service="mina-rosetta", - extra_args="--build-arg MINA_BRANCH=\\\${BUILDKITE_BRANCH}", + extra_args="--build-arg MINA_BRANCH=\\\${BUILDKITE_BRANCH} --no-cache", deb_codename="${DebianVersions.lowerName debVersion}", - step_key="rosetta-mainnet-${DebianVersions.lowerName debVersion}-docker-image" + step_key="rosetta-${DebianVersions.lowerName debVersion}-docker-image" } in @@ -111,7 +113,10 @@ let pipeline : DebianVersions.DebVersion -> Pipeline.Config.Type = \(debVersion in { - buster = pipeline DebianVersions.DebVersion.Buster, - stretch = pipeline DebianVersions.DebVersion.Stretch, - dirtyWhen = dirtyWhen + bullseye = pipeline DebianVersions.DebVersion.Bullseye + , buster = pipeline DebianVersions.DebVersion.Buster + , stretch = pipeline DebianVersions.DebVersion.Stretch + , bionic = pipeline DebianVersions.DebVersion.Bionic + , focal = pipeline DebianVersions.DebVersion.Focal + , dirtyWhen = dirtyWhen } diff --git a/buildkite/src/Command/RunInToolchain.dhall b/buildkite/src/Command/RunInToolchain.dhall index 02903d4c58e..8fdd90ad254 100644 --- a/buildkite/src/Command/RunInToolchain.dhall +++ b/buildkite/src/Command/RunInToolchain.dhall @@ -5,6 +5,17 @@ let S = ../Lib/SelectFiles.dhall let r = Cmd.run +let runInToolchainBullseye : List Text -> Text -> List Cmd.Type = + \(environment : List Text) -> + \(innerScript : Text) -> + [ Mina.fixPermissionsCommand ] # [ + Cmd.runInDocker + (Cmd.Docker::{ image = (../Constants/ContainerImages.dhall).minaToolchainBullseye, extraEnv = environment }) + (innerScript) + ] + +in + let runInToolchainBuster : List Text -> Text -> List Cmd.Type = \(environment : List Text) -> \(innerScript : Text) -> @@ -25,6 +36,20 @@ let runInToolchainStretch : List Text -> Text -> List Cmd.Type = in -{ runInToolchainBuster = runInToolchainBuster -, runInToolchainStretch = runInToolchainStretch +let runInToolchainFocal : List Text -> Text -> List Cmd.Type = + \(environment : List Text) -> + \(innerScript : Text) -> + [ Mina.fixPermissionsCommand ] # [ + Cmd.runInDocker + (Cmd.Docker::{ image = (../Constants/ContainerImages.dhall).minaToolchainFocal, extraEnv = environment }) + (innerScript) + ] + +in + +{ + runInToolchainBullseye = runInToolchainBullseye + , runInToolchainBuster = runInToolchainBuster + , runInToolchainStretch = runInToolchainStretch + , runInToolchainFocal = runInToolchainFocal } diff --git a/buildkite/src/Constants/ContainerImages.dhall b/buildkite/src/Constants/ContainerImages.dhall index fe1cb4dbfb9..be32894e407 100644 --- a/buildkite/src/Constants/ContainerImages.dhall +++ b/buildkite/src/Constants/ContainerImages.dhall @@ -1,9 +1,11 @@ -- TODO: Automatically push, tag, and update images #4862 - +-- NOTE: minaToolchainStretch is also used for building Ubuntu Bionic packages in CI { toolchainBase = "codaprotocol/ci-toolchain-base:v3", - minaToolchainStretch = "gcr.io/o1labs-192920/mina-toolchain@sha256:7ef5827fa0854a0bcfdee69dcc0c2c7aef86e1662c630e71f07c1f9162e757fa", - minaToolchainBuster = "gcr.io/o1labs-192920/mina-toolchain@sha256:71477097441872b96cce1ec6468c6aa3250bbc7159ecbcc9a716f5b54e16ec05", + minaToolchainStretch = "gcr.io/o1labs-192920/mina-toolchain@sha256:c4873c52041996a4eacdd96d0310b909a099689552c8b4fec7d464872abd1e1f", + minaToolchainBuster = "gcr.io/o1labs-192920/mina-toolchain@sha256:b53c4948599ec40ec1ce9178d84ce48e88db472da0005b9a6b4260e0d4aaa95c", + minaToolchainBullseye = "gcr.io/o1labs-192920/mina-toolchain@sha256:00dbcb936954f10b4995ad28535d08e32d6d2dbc31531e846307d156e610af04", + minaToolchainFocal = "gcr.io/o1labs-192920/mina-toolchain@sha256:ad94c2373f45a8a5af354ed12d5eb34ad64b1140c0811a9935212ea0a5d3c4b0", delegationBackendToolchain = "gcr.io/o1labs-192920/delegation-backend-production@sha256:8ca5880845514ef56a36bf766a0f9de96e6200d61b51f80d9f684a0ec9c031f4", elixirToolchain = "elixir:1.10-alpine", rustToolchain = "codaprotocol/coda:toolchain-rust-e855336d087a679f76f2dd2bbdc3fdfea9303be3", diff --git a/buildkite/src/Constants/DebianVersions.dhall b/buildkite/src/Constants/DebianVersions.dhall index 3def48391a2..210eb0b9830 100644 --- a/buildkite/src/Constants/DebianVersions.dhall +++ b/buildkite/src/Constants/DebianVersions.dhall @@ -4,34 +4,63 @@ let ContainerImages = ./ContainerImages.dhall let dependsOnGitEnv = [ { name = "GitEnvUpload", key = "upload-git-env" } ] -let DebVersion = < Buster | Stretch > +let DebVersion = < Bullseye | Buster | Stretch | Focal | Bionic > let capitalName = \(debVersion : DebVersion) -> - merge { Buster = "Buster", Stretch = "Stretch" } debVersion + merge { + Bullseye = "Bullseye" + , Buster = "Buster" + , Stretch = "Stretch" + , Focal = "Focal" + , Bionic = "Bionic" + } debVersion let lowerName = \(debVersion : DebVersion) -> - merge { Buster = "buster", Stretch = "stretch" } debVersion + merge { + Bullseye = "bullseye" + , Buster = "buster" + , Stretch = "stretch" + , Focal = "focal" + , Bionic = "bionic" + } debVersion +--- Bionic and Stretch are so similar that they share a toolchain image let toolchainRunner = \(debVersion : DebVersion) -> - merge { Buster = RunInToolchain.runInToolchainBuster, Stretch = RunInToolchain.runInToolchainStretch } debVersion + merge { + Bullseye = RunInToolchain.runInToolchainBullseye + , Buster = RunInToolchain.runInToolchainBuster + , Stretch = RunInToolchain.runInToolchainStretch + , Focal = RunInToolchain.runInToolchainFocal + , Bionic = RunInToolchain.runInToolchainStretch + } debVersion +--- Bionic and Stretch are so similar that they share a toolchain image let toolchainImage = \(debVersion : DebVersion) -> - merge { Buster = ContainerImages.minaToolchainBuster, Stretch = ContainerImages.minaToolchainStretch } debVersion + merge { + Bullseye = ContainerImages.minaToolchainBullseye + , Buster = ContainerImages.minaToolchainBuster + , Stretch = ContainerImages.minaToolchainStretch + , Focal = ContainerImages.minaToolchainFocal + , Bionic = ContainerImages.minaToolchainStretch + } debVersion let dependsOn = \(debVersion : DebVersion) -> merge { - Buster = dependsOnGitEnv # [{ name = "MinaArtifactBuster", key = "build-deb-pkg" }], - Stretch = dependsOnGitEnv # [{ name = "MinaArtifactStretch", key = "build-deb-pkg" }] + Bullseye = dependsOnGitEnv # [{ name = "MinaArtifactBullseye", key = "build-deb-pkg" }] + , Buster = dependsOnGitEnv # [{ name = "MinaArtifactBuster", key = "build-deb-pkg" }] + , Stretch = dependsOnGitEnv # [{ name = "MinaArtifactStretch", key = "build-deb-pkg" }] + , Bionic = dependsOnGitEnv # [{ name = "MinaArtifactBionic", key = "build-deb-pkg" }] + , Focal = dependsOnGitEnv # [{ name = "MinaArtifactFocal", key = "build-deb-pkg" }] } debVersion in { - DebVersion = DebVersion, - capitalName = capitalName, - lowerName = lowerName, - toolchainRunner = toolchainRunner, - toolchainImage = toolchainImage, - dependsOn = dependsOn, - dependsOnGitEnv = dependsOnGitEnv + DebVersion = DebVersion + , capitalName = capitalName + , lowerName = lowerName + , toolchainRunner = toolchainRunner + , toolchainImage = toolchainImage + , dependsOn = dependsOn + , dependsOnGitEnv = dependsOnGitEnv } diff --git a/buildkite/src/Jobs/Lint/Merge.dhall b/buildkite/src/Jobs/Lint/Merge.dhall index 1a049ff3380..31d6e6dc5d1 100644 --- a/buildkite/src/Jobs/Lint/Merge.dhall +++ b/buildkite/src/Jobs/Lint/Merge.dhall @@ -22,7 +22,17 @@ Pipeline.build steps = [ Command.build Command.Config::{ - commands = [ Cmd.run "buildkite/scripts/merges-cleanly-to-develop.sh" ] + commands = [ Cmd.run "buildkite/scripts/merges-cleanly.sh compatible"] + , label = "Check merges cleanly into compatible" + , key = "clean-merge-compatible" + , target = Size.Small + , docker = Some Docker::{ + image = (../../Constants/ContainerImages.dhall).toolchainBase + } + }, + Command.build + Command.Config::{ + commands = [ Cmd.run "buildkite/scripts/merges-cleanly.sh develop"] , label = "Check merges cleanly into develop" , key = "clean-merge-develop" , target = Size.Small diff --git a/buildkite/src/Jobs/Release/MinaArtifactBionic.dhall b/buildkite/src/Jobs/Release/MinaArtifactBionic.dhall new file mode 100644 index 00000000000..37092bd0bf7 --- /dev/null +++ b/buildkite/src/Jobs/Release/MinaArtifactBionic.dhall @@ -0,0 +1,6 @@ +let ArtifactPipelines = ../../Command/MinaArtifact.dhall +let Pipeline = ../../Pipeline/Dsl.dhall + +in + +Pipeline.build ArtifactPipelines.bionic diff --git a/buildkite/src/Jobs/Release/MinaArtifactBullseye.dhall b/buildkite/src/Jobs/Release/MinaArtifactBullseye.dhall new file mode 100644 index 00000000000..aa83b1b2e47 --- /dev/null +++ b/buildkite/src/Jobs/Release/MinaArtifactBullseye.dhall @@ -0,0 +1,6 @@ +let ArtifactPipelines = ../../Command/MinaArtifact.dhall +let Pipeline = ../../Pipeline/Dsl.dhall + +in + +Pipeline.build ArtifactPipelines.bullseye diff --git a/buildkite/src/Jobs/Release/MinaArtifactFocal.dhall b/buildkite/src/Jobs/Release/MinaArtifactFocal.dhall new file mode 100644 index 00000000000..5bceb16f892 --- /dev/null +++ b/buildkite/src/Jobs/Release/MinaArtifactFocal.dhall @@ -0,0 +1,6 @@ +let ArtifactPipelines = ../../Command/MinaArtifact.dhall +let Pipeline = ../../Pipeline/Dsl.dhall + +in + +Pipeline.build ArtifactPipelines.focal diff --git a/buildkite/src/Jobs/Release/MinaRosettaUbuntu.dhall b/buildkite/src/Jobs/Release/MinaRosettaUbuntu.dhall deleted file mode 100644 index 366de430b6c..00000000000 --- a/buildkite/src/Jobs/Release/MinaRosettaUbuntu.dhall +++ /dev/null @@ -1,51 +0,0 @@ -let Prelude = ../../External/Prelude.dhall - -let Cmd = ../../Lib/Cmds.dhall -let S = ../../Lib/SelectFiles.dhall - -let Pipeline = ../../Pipeline/Dsl.dhall -let JobSpec = ../../Pipeline/JobSpec.dhall - -let Command = ../../Command/Base.dhall -let Size = ../../Command/Size.dhall -let DockerImage = ../../Command/DockerImage.dhall -let DockerLogin = ../../Command/DockerLogin/Type.dhall - - -let dependsOn = [ { name = "GitEnvUpload", key = "upload-git-env" } ] -let deployEnv = "export-git-env-vars.sh" - -in - -Pipeline.build - Pipeline.Config::{ - spec = - JobSpec::{ - dirtyWhen = [ - S.strictlyStart (S.contains "dockerfiles/stages/1-"), - S.strictlyStart (S.contains "dockerfiles/stages/2-"), - S.strictlyStart (S.contains "dockerfiles/stages/3-"), - S.strictlyStart (S.contains "dockerfiles/stages/4-"), - S.strictlyStart (S.contains "dockerfiles/stages/5-"), - S.strictlyStart (S.contains "src/app/rosetta") - ], - path = "Release", - name = "MinaRosettaUbuntu" - }, - steps = [ - - -- mina-rosetta-ubuntu Ubuntu Rosetta image - let rosettaUbuntuSpec = DockerImage.ReleaseSpec::{ - deps=dependsOn, - service="mina-rosetta-ubuntu", - deb_codename="stretch", - extra_args="--no-cache", - step_key="mina-rosetta-ubuntu-docker-image" - } - - in - - DockerImage.generateStep rosettaUbuntuSpec - - ] - } diff --git a/buildkite/src/Jobs/Release/MinaToolchainArtifact.dhall b/buildkite/src/Jobs/Release/MinaToolchainArtifact.dhall index 10d9e910325..ab33e375f3c 100644 --- a/buildkite/src/Jobs/Release/MinaToolchainArtifact.dhall +++ b/buildkite/src/Jobs/Release/MinaToolchainArtifact.dhall @@ -33,31 +33,57 @@ Pipeline.build }, steps = [ - -- mina-toolchain Debian Buster image + -- mina-toolchain Debian 11 "Bullseye" Toolchain + let toolchainBullseyeSpec = DockerImage.ReleaseSpec::{ + deps=dependsOn, + service="mina-toolchain", + deb_codename="bullseye", + extra_args="--no-cache", + step_key="toolchain-bullseye-docker-image" + } + + in + + DockerImage.generateStep toolchainBullseyeSpec, + + -- mina-toolchain Debian 10 "Buster" Toolchain let toolchainBusterSpec = DockerImage.ReleaseSpec::{ deps=dependsOn, service="mina-toolchain", deb_codename="buster", extra_args="--no-cache", - step_key="mina-toolchain-buster-docker-image" + step_key="toolchain-buster-docker-image" } in DockerImage.generateStep toolchainBusterSpec, - -- mina-toolchain Debian Stretch image + -- mina-toolchain Debian 9 "Stretch" Toolchain let toolchainStretchSpec = DockerImage.ReleaseSpec::{ deps=dependsOn, service="mina-toolchain", deb_codename="stretch", extra_args="--no-cache", - step_key="mina-toolchain-stretch-docker-image" + step_key="toolchain-stretch-docker-image" + } + + in + + DockerImage.generateStep toolchainStretchSpec, + + -- mina-toolchain Ubuntu 20.04 "Focal Fossa" Toolchain + let toolchainFocalSpec = DockerImage.ReleaseSpec::{ + deps=dependsOn, + service="mina-toolchain", + deb_codename="focal", + extra_args="--no-cache", + step_key="toolchain-focal-docker-image" } in - DockerImage.generateStep toolchainStretchSpec + DockerImage.generateStep toolchainFocalSpec ] } diff --git a/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall b/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall index f7db3e0f849..e0931a37937 100644 --- a/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall +++ b/buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall @@ -24,7 +24,7 @@ in Pipeline.build Pipeline.Config::{ }, steps = [ TestExecutive.build "integration_tests", - TestExecutive.execute "peers-reliability" dependsOn, + -- TestExecutive.execute "peers-reliability" dependsOn, TestExecutive.execute "chain-reliability" dependsOn, TestExecutive.execute "payment" dependsOn, TestExecutive.execute "gossip-consis" dependsOn, diff --git a/dockerfiles/Dockerfile-mina-archive b/dockerfiles/Dockerfile-mina-archive index 2e2d40c36f9..f77533cfdda 100644 --- a/dockerfiles/Dockerfile-mina-archive +++ b/dockerfiles/Dockerfile-mina-archive @@ -1,5 +1,5 @@ -ARG deb_codename=stretch -FROM debian:${deb_codename}-slim +ARG image=debian:stretch-slim +FROM ${image} # Run with `docker build --build-arg deb_version=` ARG deb_version diff --git a/dockerfiles/Dockerfile-mina-daemon b/dockerfiles/Dockerfile-mina-daemon index 8f5e6875214..45e8b5f433c 100644 --- a/dockerfiles/Dockerfile-mina-daemon +++ b/dockerfiles/Dockerfile-mina-daemon @@ -1,5 +1,5 @@ -ARG deb_codename=stretch -FROM debian:${deb_codename}-slim +ARG image=debian:stretch-slim +FROM ${image} # Run with `docker build --build-arg deb_version=` ARG deb_version ARG deb_release=unstable @@ -11,14 +11,19 @@ ENV DEBIAN_FRONTEND noninteractive # We do not install the below platform-specific dependencies, # and instead assume that apt will install the proper deps based on the package definition. # The packages are noted here just for clarity/documentation. -# Buster-only Deps: -# libffi7 \ -# libprocps7 \ -# libjemalloc2 \ # Stretch-only Deps: -# libffi6 \ -# libprocps6 \ -# libjemalloc1 \ +# libffi6 +# libprocps6 +# libjemalloc1 +# Buster-only Deps: +# libffi7 +# libprocps7 +# libjemalloc2 +# Focal-only Deps: +# libffi7 +# libprocps8 +# libjemalloc2 + # Dependencies RUN apt-get -y update && \ diff --git a/dockerfiles/stages/1-build-deps b/dockerfiles/stages/1-build-deps index b30c55c7dd0..a2307bd5421 100644 --- a/dockerfiles/stages/1-build-deps +++ b/dockerfiles/stages/1-build-deps @@ -1,9 +1,10 @@ ################################################################################################# # The "build-deps" stage -# - Installs all compilers/interpreters, tools, and OS packages on debian ${deb_codename}-slim +# - Installs all compilers/interpreters, tools, and OS packages on the given debian or ubuntu image ################################################################################################# -ARG deb_codename=stretch -FROM debian:${deb_codename}-slim AS build-deps +# Supports debian:stretch-slim, debian:buster-slim, and ubuntu:focal +ARG image=ubuntu:focal +FROM ${image} AS build-deps # Ocaml Version ARG OCAML_VERSION=4.11 @@ -24,16 +25,17 @@ ARG RUST_VERSION=1.52.1 # Rocksdb commit tag/branch to clone ARG ROCKSDB_VERSION=v5.18.4 -# OS package dependencies -# First add support for https and pkg-config for apt, then install everything else -# TODO: make sure this is the minimum compile-time deps +# --- OS package dependencies +# Organized as two alphabetized lists, first libraries and then tools/other packages ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install --yes \ - build-essential \ libboost-dev \ libboost-program-options-dev \ + libbz2-dev \ + libcap-dev \ libffi-dev \ + libgflags-dev \ libgmp-dev \ libgmp3-dev \ libjemalloc-dev \ @@ -41,21 +43,20 @@ RUN apt-get update \ libprocps-dev \ libsodium-dev \ libssl-dev \ - zlib1g-dev \ - libbz2-dev \ - libcap-dev \ - pkg-config \ + build-essential \ + capnproto \ cmake \ - m4 \ - git \ curl \ - sudo \ + file \ + git \ + m4 \ + pkg-config \ rsync \ + sudo \ unzip \ - file \ - capnproto + zlib1g-dev -# Create opam user (for later) and give sudo to make opam happy +# --- Create opam user (for later) and give sudo to make opam happy RUN adduser --uid 65533 --disabled-password --gecos '' opam \ && passwd -l opam \ && chown -R opam:opam /home/opam \ @@ -64,16 +65,16 @@ RUN adduser --uid 65533 --disabled-password --gecos '' opam \ && chown root:root /etc/sudoers.d/opam \ && chmod 777 /tmp -# Opam install of a given OPAM_VERSION from github release +# --- Opam install of a given OPAM_VERSION from github release RUN curl -sL \ "https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/opam-${OPAM_VERSION}-x86_64-linux" \ -o /usr/bin/opam \ && chmod +x /usr/bin/opam -# Golang install of a given GO_VERSION (add -v for spam output of each file from the go dist) +# --- Golang install of a given GO_VERSION (add -v for spam output of each file from the go dist) RUN curl -s "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xz -C /usr/lib/ -# Rust install via rustup-init to a given RUST_VERSION +# --- Rust install via rustup-init to a given RUST_VERSION USER opam RUN curl --proto '=https' --tlsv1.2 -sSf -o /tmp/rustup-init \ https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \ @@ -84,15 +85,23 @@ RUN curl --proto '=https' --tlsv1.2 -sSf -o /tmp/rustup-init \ # As opposed to introducing another shell script here (that mostly just determines the platform) # we just download the binary for the only platform we care about in this docker environment +# --- RocksDB Installation of a given ROCKSDB_VERSION USER root +# These flags turn some errors into warnings for running with G++ 9 or higher +# The build command below checks for the g++ major version and removes CXXFLAGS if its less than 9 +ENV CXXFLAGS '-Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=class-memaccess' # This builds and installs just the rocksdb static lib for us, and cleans up after itself RUN git clone https://github.com/facebook/rocksdb \ --depth 1 --shallow-submodules \ -b "${ROCKSDB_VERSION}" /rocksdb \ - && make -C /rocksdb static_lib PORTABLE=1 -j$(nproc) \ + && test $(g++ -dumpversion | cut -c 1 -) -lt 9 \ + && CXXFLAGS='' make -C /rocksdb static_lib PORTABLE=1 -j$(nproc) \ + || make -C /rocksdb static_lib PORTABLE=1 -j$(nproc) \ && cp /rocksdb/librocksdb.a /usr/local/lib/librocksdb_coda.a \ && rm -rf /rocksdb \ && strip -S /usr/local/lib/librocksdb_coda.a +# Clear CXXFLAGS afterwards to avoid affecting other code +ENV CXXFLAGS "" ########################################################################################### # Initialize opam in a minimal fashion @@ -103,7 +112,7 @@ WORKDIR /home/opam USER opam ENV HOME /home/opam -# Create the following user directory configs as the Opam user: +# --- Create the following user directory configs as the Opam user: ## Add go + rust to the path, unlimit the opam user, ## unlimit stack for future shells that might use spacetime, ## disable ipv6 @@ -113,7 +122,7 @@ RUN mkdir --mode=700 ~/.gnupg \ && echo 'ulimit -s unlimited' >> ~/.bashrc \ && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf -# Ocaml install of a given OCAML_VERSION via opam switch +# --- Ocaml install of a given OCAML_VERSION via opam switch # additionally initializes opam with sandboxing disabled, as we did not install bubblewrap above. RUN git clone \ https://github.com/ocaml/opam-repository.git \ diff --git a/dockerfiles/stages/1-build-deps-ubuntu b/dockerfiles/stages/1-build-deps-ubuntu deleted file mode 100644 index e64aa854b05..00000000000 --- a/dockerfiles/stages/1-build-deps-ubuntu +++ /dev/null @@ -1,140 +0,0 @@ -################################################################################################# -# The "build-deps" stage -# - Installs all compilers/interpreters, tools, and OS packages on Ubuntu 20.04 -################################################################################################# -FROM ubuntu:20.04 AS build-deps - -# Ocaml Version -ARG OCAML_VERSION=4.11 -ARG OCAML_REVISION=.2 -ARG OCAML_VARIANT= -ARG OCAML_PACKAGE= -ARG OPAM_VERSION=2.0.7 - -# Golang version number used to detemine tarball name -ARG GO_VERSION=1.16.5 - -# Go Capnp Version (for capnpc dependency) -ARG GO_CAPNP_VERSION=v3.0.0-alpha.1 - -# Rust Version passed into rustup-init, can also be "stable", "nightly" or similar -ARG RUST_VERSION=1.52.1 - -# Rocksdb commit tag/branch to clone -ARG ROCKSDB_VERSION=v5.18.4 - -# OS package dependencies -# First add support for https and pkg-config for apt, then install everything else -# TODO: make sure this is the minimum compile-time deps -# Organized as two alphabetized lists, first libraries and then tools/other packages -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get install --yes \ - libboost-dev \ - libboost-program-options-dev \ - libbz2-dev \ - libcap-dev \ - libffi-dev \ - libgflags-dev \ - libgmp-dev \ - libgmp3-dev \ - libjemalloc-dev \ - libpq-dev \ - libprocps-dev \ - libsodium-dev \ - libssl-dev \ - zlib1g-dev \ - build-essential \ - capnproto \ - cmake \ - curl \ - file \ - git \ - m4 \ - pkg-config \ - rsync \ - sudo \ - unzip - -# Create opam user (for later) and give sudo to make opam happy -RUN adduser --uid 65533 --disabled-password --gecos '' opam \ - && passwd -l opam \ - && chown -R opam:opam /home/opam \ - && echo 'opam ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/opam \ - && chmod 440 /etc/sudoers.d/opam \ - && chown root:root /etc/sudoers.d/opam \ - && chmod 777 /tmp - -# Opam install of a given OPAM_VERSION from github release -RUN curl -sL \ - "https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/opam-${OPAM_VERSION}-x86_64-linux" \ - -o /usr/bin/opam \ - && chmod +x /usr/bin/opam - -# Golang install of a given GO_VERSION (add -v for spam output of each file from the go dist) -RUN curl -s "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xz -C /usr/lib/ - -# Rust install via rustup-init to a given RUST_VERSION -USER opam -RUN curl --proto '=https' --tlsv1.2 -sSf -o /tmp/rustup-init \ - https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \ - && chmod +x /tmp/rustup-init \ - && /tmp/rustup-init -y --default-toolchain "${RUST_VERSION}" --profile minimal \ - && rm /tmp/rustup-init -# For more about rustup-init see: https://github.com/rust-lang/rustup/blob/master/README.md -# As opposed to introducing another shell script here (that mostly just determines the platform) -# we just download the binary for the only platform we care about in this docker environment - -USER root -ENV CXXFLAGS '-Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=class-memaccess' -# This builds and installs just the rocksdb static lib for us, and cleans up after itself -RUN git clone https://github.com/facebook/rocksdb \ - --depth 1 --shallow-submodules \ - -b "${ROCKSDB_VERSION}" /rocksdb \ - && make -C /rocksdb static_lib PORTABLE=1 -j$(nproc) \ - && cp /rocksdb/librocksdb.a /usr/local/lib/librocksdb_coda.a \ - && rm -rf /rocksdb \ - && strip -S /usr/local/lib/librocksdb_coda.a -ENV CXXFLAGS "" - -########################################################################################### -# Initialize opam in a minimal fashion -########################################################################################### - -# Set up environment for running as opam user -WORKDIR /home/opam -USER opam -ENV HOME /home/opam - -# Create the following user directory configs as the Opam user: -## Add go + rust to the path, unlimit the opam user, -## unlimit stack for future shells that might use spacetime, -## disable ipv6 -## disable sandboxing to allow unprivledged builds -RUN mkdir --mode=700 ~/.gnupg \ - && echo 'export PATH="$PATH:/usr/lib/go/bin:$HOME/.cargo/bin"' >> ~/.bashrc \ - && echo 'ulimit -s unlimited' >> ~/.bashrc \ - && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf - -# Ocaml install of a given OCAML_VERSION via opam switch -# additionally initializes opam with sandboxing disabled, as we did not install bubblewrap above. -RUN git clone \ - https://github.com/ocaml/opam-repository.git \ - --depth 1 \ - /home/opam/opam-repository \ - && opam init --disable-sandboxing -k git -a ~/opam-repository --bare \ - && opam repository add --yes --all --set-default o1-labs https://github.com/o1-labs/opam-repository.git \ - && opam switch create "${OCAML_VERSION}${OCAML_REVISION}" "${OCAML_PACKAGE}${OCAML_VERSION}${OCAML_REVISION}${OCAML_VARIANT}" \ - && opam switch "${OCAML_VERSION}${OCAML_REVISION}" - -# --- Build and install capnproto go compiler -# This package was particularly tricky to get to install correctly because of how the package's source code is structured. -# To work around this, we install it as a dependency for a local go module and build the binary from the GOPATH. -RUN mkdir go-tmp \ - && cd go-tmp \ - && /usr/lib/go/bin/go mod init local/build \ - && /usr/lib/go/bin/go get capnproto.org/go/capnp/v3@$GO_CAPNP_VERSION \ - && /usr/lib/go/bin/go build -o capnpc-go capnproto.org/go/capnp/v3/capnpc-go \ - && sudo mv capnpc-go /usr/local/bin \ - && cd - \ - && sudo rm -rf go-tmp diff --git a/dockerfiles/stages/2-opam-deps b/dockerfiles/stages/2-opam-deps index a0e6be8448b..21dd6733143 100644 --- a/dockerfiles/stages/2-opam-deps +++ b/dockerfiles/stages/2-opam-deps @@ -20,6 +20,7 @@ ARG EXTERNAL_PKG_DIR=$MINA_DIR/src/external ENV OPAMKEEPBUILDDIR false ENV OPAMREUSEBUILDDIR false +# --- Shallow clone the Mina repo, only focused on the given MINA_BRANCH # git will clone into an empty dir, but this also helps us set the workdir in advance RUN git clone \ -b "${MINA_BRANCH}" \ @@ -32,9 +33,11 @@ WORKDIR $HOME/$MINA_DIR ENV OPAMYES 1 +# --- Import Opam Switch # TODO: handle this opam work without cloning the full repository (directly pull src/opam.export) RUN opam switch import src/opam.export +# --- Pin external packages / submodules # TODO: Would be really nice to pull this script, the git submodules, and src/opam.export exclusively in this stage RUN eval $(opam config env) \ && scripts/pin-external-packages.sh \ diff --git a/dockerfiles/stages/3-builder b/dockerfiles/stages/3-builder index cd7cff22f6c..dde68740702 100644 --- a/dockerfiles/stages/3-builder +++ b/dockerfiles/stages/3-builder @@ -20,7 +20,8 @@ ARG MINA_DIR=mina ENV PATH "$PATH:/usr/lib/go/bin:$HOME/.cargo/bin" -# git will clone into an empty dir, but this also helps us set the workdir in advance +# --- Shallow Clone the Mina repo +# Delete any previous clones of the mina repo and then clone into an empty directory RUN cd $HOME && rm -rf $HOME/${MINA_DIR} \ && git clone \ -b "${MINA_BRANCH}" \ @@ -28,19 +29,19 @@ RUN cd $HOME && rm -rf $HOME/${MINA_DIR} \ --shallow-submodules \ --recurse-submodules \ ${MINA_REPO} ${HOME}/${MINA_DIR} - +# Set the working directory to the cloned mina repo WORKDIR $HOME/${MINA_DIR} - +# Create a directory for compiled outputs RUN mkdir ${HOME}/app -# Build libp2p_helper +# --- Build libp2p_helper RUN make libp2p_helper \ && mv src/app/libp2p_helper/result/bin/libp2p_helper ${HOME}/app/libp2p_helper # HACK: build without special cpu features to allow more people to run mina-rosetta RUN ./scripts/zexe-standardize.sh -# Make rosetta-crucial components and the generate_keypair tool +# --- Make rosetta-crucial components and the generate_keypair tool RUN eval $(opam config env) \ && dune build --profile=${DUNE_PROFILE} \ src/app/cli/src/mina_testnet_signatures.exe \ @@ -69,6 +70,6 @@ RUN eval $(opam config env) \ && mv _build/default/src/app/rosetta/ocaml-signer/signer.exe $HOME/app/mina-ocaml-signer \ && rm -rf _build -# Clear go module caches +# --- Clear go module caches to make the container smaller RUN cd src/app/libp2p_helper/src/libp2p_helper \ && go clean --cache --modcache --testcache -r diff --git a/dockerfiles/stages/3-toolchain b/dockerfiles/stages/3-toolchain index 7e676dac368..994f4ce8d08 100644 --- a/dockerfiles/stages/3-toolchain +++ b/dockerfiles/stages/3-toolchain @@ -4,6 +4,8 @@ ################################################################################################# FROM opam-deps AS toolchain +ARG deb_codename=focal + ARG DOCKER_VERSION=19.03.4 ARG TERRAFORM_VERSION=0.14.11 @@ -49,23 +51,22 @@ RUN sudo apt-get update -y \ postgresql-contrib \ perl \ pkg-config \ - python \ - python-flake8 \ - python-jinja2 \ - python-pip \ - python3-flake8 \ - python3-jinja2 \ - python3-pip \ rubygems \ zlib1g-dev -# -- python dependencies (largely installed above from apt) +# -- Debian Buster python dependencies (largely installed above from apt) +# Buster images are used in our migrated integration tests which reqiure python2 jinja2 +# Ocaml lints scripts/require-ppxs.py is already python3 and requires sexpdata RUN test "$deb_codename" = "buster" \ && sudo apt-get install -y \ - python3-sexpdata \ - python-sexpdata \ - || sudo pip install readchar sexpdata \ - && sudo pip3 install readchar sexpdata + python \ + python-pip \ + python-jinja2 \ + python-flake8 \ + python-sexpdata \ + python3-sexpdata \ + && sudo pip install readchar \ + || exit 0 # --- deb-s3 tool RUN curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.3/deb-s3-0.11.3.gem \ @@ -84,8 +85,7 @@ RUN curl -sL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terra && sudo ln -s /usr/bin/terraform /usr/local/bin/terraform # --- Google Cloud tools -RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" \ - && echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ +RUN echo "deb http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - \ && sudo apt-get update -y \ && sudo apt-get install -y google-cloud-sdk kubectl diff --git a/dockerfiles/stages/4-prod-ubuntu b/dockerfiles/stages/4-prod-ubuntu deleted file mode 100644 index 298adfd6776..00000000000 --- a/dockerfiles/stages/4-prod-ubuntu +++ /dev/null @@ -1,71 +0,0 @@ -################################################################################################# -# The "production" Stage -# - sets up the final container with built binaries and a running postgresql archive node setup -################################################################################################# -FROM ubuntu:20.04 AS production - -ARG MINA_DAEMON_PORT=10101 -ARG MINA_CONFIG_DIR=/data/.mina-config -# Sample public key for use in dev profile / demo mode genesis block -ARG PK=B62qiZfzW27eavtPrnF6DeDSAKEjXuGFdkouC3T5STRa6rrYLiDUP2p - -ENV DEBIAN_FRONTEND noninteractive - -# Dependencies -# TODO: make sure this is the minimum runtime deps -RUN apt-get -y update \ - && apt -y install \ - apt-utils \ - curl \ - ca-certificates \ - dnsutils \ - dumb-init \ - gettext \ - libgmp10 \ - libgomp1 \ - libssl1.1 \ - postgresql \ - postgresql-contrib \ - tzdata \ - libjemalloc2 \ - libprocps8 \ - libffi7 \ - jq \ - sudo - -# Install rosetta-cli -RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s - -# Generate en_US.UTF-8 to allow use of O(1) Labs DB dumps -RUN locale-gen en_US.UTF-8 - -RUN mkdir -p --mode=700 ${MINA_CONFIG_DIR}/wallets/store/ \ - && echo "$PK" > ${MINA_CONFIG_DIR}/wallets/store/$PK.pub \ - && echo '{"box_primitive":"xsalsa20poly1305","pw_primitive":"argon2i","nonce":"6pcvpWSLkMi393dT5VSLR6ft56AWKkCYRqJoYia","pwsalt":"ASoBkV3NsY7ZRuxztyPJdmJCiz3R","pwdiff":[134217728,6],"ciphertext":"Dmq1Qd8uNbZRT1NT7zVbn3eubpn9Myx9Je9ZQGTKDxUv4BoPNmZAGox18qVfbbEUSuhT4ZGDt"}' \ - > ${MINA_CONFIG_DIR}/wallets/store/${PK} \ - && chmod go-rwx ${MINA_CONFIG_DIR}/wallets/store/${PK} - -COPY --from=builder /home/opam/app/* /usr/local/bin/ -COPY --from=builder /home/opam/mina/src/app/rosetta/*.sh /rosetta/ -COPY --from=builder /home/opam/mina/src/app/rosetta/*.conf /rosetta/ -COPY --from=builder /home/opam/mina/src/app/rosetta/README.md /rosetta/ -COPY --from=builder /home/opam/mina/genesis_ledgers /genesis_ledgers/ - -USER postgres -RUN POSTGRES_VERSION=$(psql -V | cut -d " " -f 3 | sed 's/.[[:digit:]]*$//g') \ - && echo "$POSTGRES_VERSION" "$(psql -V)" \ - && echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/${POSTGRES_VERSION}/main/pg_hba.conf \ - && pg_dropcluster --stop ${POSTGRES_VERSION} main - -USER root - -# Run as root so it can create /data/postgresql -RUN POSTGRES_VERSION=$(psql -V | cut -d " " -f 3 | sed 's/.[[:digit:]]*$//g') \ - && pg_createcluster --start -d /data/postgresql --createclusterconf /rosetta/postgresql.conf ${POSTGRES_VERSION} main - -WORKDIR /rosetta - -EXPOSE 3087 -EXPOSE $MINA_DAEMON_PORT - -ENTRYPOINT ["bash", "./docker-start.sh"] diff --git a/dockerfiles/stages/4-production b/dockerfiles/stages/4-production index eed005b4c20..38463a3c0a5 100644 --- a/dockerfiles/stages/4-production +++ b/dockerfiles/stages/4-production @@ -2,28 +2,27 @@ # The "production" Stage # - sets up the final container with built binaries and a running postgresql archive node setup ################################################################################################# -ARG deb_codename=stretch -FROM debian:${deb_codename}-slim AS production -ARG deb_codename=stretch +# Supports debian:stretch-slim, debian:buster-slim, and ubuntu:focal +ARG image=ubuntu:focal +FROM ${image} AS production +ARG deb_codename=focal ARG MINA_DAEMON_PORT=10101 -ARG MINA_CONFIG_DIR=/root/.mina-config +ARG MINA_CONFIG_DIR=/data/.mina-config # Sample public key for use in dev profile / demo mode genesis block ARG PK=B62qiZfzW27eavtPrnF6DeDSAKEjXuGFdkouC3T5STRa6rrYLiDUP2p ENV DEBIAN_FRONTEND noninteractive -# Dependencies -# TODO: make sure this is the minimum runtime deps +# --- Dependencies across many platforms RUN apt-get update -y \ - && apt install -y \ + && apt-get install -y \ apt-utils \ curl \ ca-certificates \ dnsutils \ dumb-init \ gettext \ - libffi6 \ libgmp10 \ libgomp1 \ libssl1.1 \ @@ -33,45 +32,65 @@ RUN apt-get update -y \ jq \ sudo +# --- Debian 10 "Buster" Dependencies RUN test "$deb_codename" = "buster" \ && apt-get update -y \ && apt-get install -y \ libjemalloc2 \ libprocps7 \ + libffi6 \ || exit 0 +# --- Debian 9 "Stretch" Dependencies RUN test "$deb_codename" = "stretch" \ && apt-get update -y \ && apt-get install -y \ libjemalloc1 \ libprocps6 \ + libffi6 \ || exit 0 -# Install rosetta-cli +# --- Ubuntu 20.04 "Focal Fossa" Dependencies +RUN test "$deb_codename" = "focal" \ + && apt-get update -y \ + && apt-get install -y \ + libjemalloc2 \ + libprocps8 \ + libffi7 \ + || exit 0 + +# --- Install the latest version of rosetta-cli RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s -# Generate en_US.UTF-8 to allow use of O(1) Labs DB dumps +# --- Generate en_US.UTF-8 locale to allow use of O(1) Labs DB dumps RUN locale-gen en_US.UTF-8 +# --- Set up sample/demo wallets and configuration RUN mkdir -p --mode=700 ${MINA_CONFIG_DIR}/wallets/store/ \ && echo "$PK" > ${MINA_CONFIG_DIR}/wallets/store/$PK.pub \ && echo '{"box_primitive":"xsalsa20poly1305","pw_primitive":"argon2i","nonce":"6pcvpWSLkMi393dT5VSLR6ft56AWKkCYRqJoYia","pwsalt":"ASoBkV3NsY7ZRuxztyPJdmJCiz3R","pwdiff":[134217728,6],"ciphertext":"Dmq1Qd8uNbZRT1NT7zVbn3eubpn9Myx9Je9ZQGTKDxUv4BoPNmZAGox18qVfbbEUSuhT4ZGDt"}' \ > ${MINA_CONFIG_DIR}/wallets/store/${PK} \ && chmod go-rwx ${MINA_CONFIG_DIR}/wallets/store/${PK} +# --- Copy artifacts from the 3-builder stage COPY --from=builder /home/opam/app/* /usr/local/bin/ COPY --from=builder /home/opam/mina/src/app/rosetta/*.sh /rosetta/ COPY --from=builder /home/opam/mina/src/app/rosetta/*.conf /rosetta/ COPY --from=builder /home/opam/mina/src/app/rosetta/README.md /rosetta/ COPY --from=builder /home/opam/mina/genesis_ledgers /genesis_ledgers/ +# --- Set up postgres USER postgres RUN POSTGRES_VERSION=$(psql -V | cut -d " " -f 3 | sed 's/.[[:digit:]]*$//g') \ && echo "$POSTGRES_VERSION" "$(psql -V)" \ - && echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/${POSTGRES_VERSION}/main/pg_hba.conf - + && echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/${POSTGRES_VERSION}/main/pg_hba.conf \ + && pg_dropcluster --stop ${POSTGRES_VERSION} main +# Run as root so it can create /data/postgresql USER root +RUN POSTGRES_VERSION=$(psql -V | cut -d " " -f 3 | sed 's/.[[:digit:]]*$//g') \ + && pg_createcluster --start -d /data/postgresql --createclusterconf /rosetta/postgresql.conf ${POSTGRES_VERSION} main +# --- Container workdir, ports, entrypoint, etc. WORKDIR /rosetta EXPOSE 3087 diff --git a/scripts/archive/build-release-archives.sh b/scripts/archive/build-release-archives.sh index 815a596ab9d..26be7fc2a8e 100755 --- a/scripts/archive/build-release-archives.sh +++ b/scripts/archive/build-release-archives.sh @@ -16,10 +16,10 @@ cd _build # Set dependencies based on debian release SHARED_DEPS="libssl1.1, libgomp1, libpq-dev, " case "${MINA_DEB_CODENAME}" in - buster) + buster|focal|bullseye) ARCHIVE_DEPS="libjemalloc2" ;; - stretch) + stretch|bionic) ARCHIVE_DEPS="libjemalloc1" ;; *) diff --git a/scripts/generate-local-network-ledger.py b/scripts/generate-local-network-ledger.py new file mode 100644 index 00000000000..af980a11a7a --- /dev/null +++ b/scripts/generate-local-network-ledger.py @@ -0,0 +1,411 @@ +# nix-shell -p python3 python3Packages.requests python3Packages.pip python3Packages.readchar python3Packages.jinja2 python3Packages.click python3Packages.natsort python3Packages.docker python3Packages.inflect +# +import docker +import inflect +import os +import subprocess +from pathlib import Path +import click +import glob +import json +import csv +import natsort +client = docker.from_env() +p = inflect.engine() + +MINA_DAEMON_IMAGE = "minaprotocol/mina-daemon:1.3.0alpha1-fix-token-length-rm-staking-set-ffe7fcd-buster-mainnet" +SCRIPT_DIR = Path(__file__).parent.absolute() + +# Default output folders for various kinds of keys +DEFAULT_ONLINE_WHALE_KEYS_DIR = SCRIPT_DIR / "online_whale_keys" +DEFAULT_OFFLINE_WHALE_KEYS_DIR = SCRIPT_DIR / "offline_whale_keys" +DEFAULT_OFFLINE_FISH_KEYS_DIR = SCRIPT_DIR / "offline_fish_keys" +DEFAULT_ONLINE_FISH_KEYS_DIR = SCRIPT_DIR / "online_fish_keys" +DEFAULT_SERVICE_KEY_DIR = SCRIPT_DIR / "service_keys" + +DEFAULT_SEED_KEY_DIR = SCRIPT_DIR / "seed_libp2p_keys" +DEFAULT_STAKER_CSV_FILE = SCRIPT_DIR / "staker_public_keys.csv" + +# A list of services to add and the percentage of total stake they should be allocated +DEFAULT_SERVICES = {"faucet": 100000 * (10**9), "echo": 100 * (10**9)} + +def encode_nanocodas(nanocodas): + s = str(nanocodas) + if len(s) > 9: + return s[:-9] + '.' + s[-9:] + else: + return '0.' + ('0' * (9 - len(s))) + s + +##### +# Commands related to Genesis Ledger Creation +##### + + +@click.command() +# Global Params +@click.option( + '--generate-remainder', + default=False, + help= + 'Indicates that keys should be generated if there are not a sufficient number of keys present.' +) +# Service Account Params +@click.option('--service-accounts-directory', + default=DEFAULT_SERVICE_KEY_DIR.absolute(), + help='Directory where Service Account Keys will be stored.') +# Whale Account Params +@click.option('--num-whale-accounts', + default=5, + help='Number of Whale accounts to be generated.') +@click.option('--online-whale-accounts-directory', + default=DEFAULT_ONLINE_WHALE_KEYS_DIR.absolute(), + help='Directory where Offline Whale Account Keys will be stored.' + ) +@click.option('--offline-whale-accounts-directory', + default=DEFAULT_OFFLINE_WHALE_KEYS_DIR.absolute(), + help='Directory where Offline Whale Account Keys will be stored.' + ) +# Fish Account Params +@click.option('--num-fish-accounts', + default=10, + help='Number of Fish accounts to be generated.') +@click.option('--online-fish-accounts-directory', + default=DEFAULT_ONLINE_FISH_KEYS_DIR.absolute(), + help='Directory where Online Fish Account Keys will be stored.') +@click.option('--offline-fish-accounts-directory', + default=DEFAULT_OFFLINE_FISH_KEYS_DIR.absolute(), + help='Directory where Offline Fish Account Keys will be stored.') +# Community Staker Account Params +@click.option( + '--staker-csv-file', + help= + 'Location of a CSV file detailing Discord Username and Public Key for Stakers.' +) +def generate_ledger(generate_remainder, service_accounts_directory, + num_whale_accounts, online_whale_accounts_directory, + offline_whale_accounts_directory, num_fish_accounts, + online_fish_accounts_directory, + offline_fish_accounts_directory, staker_csv_file): + """ + Generates a Genesis Ledger based on previously generated Whale, Fish, and Block Producer keys. + If keys are not present on the filesystem at the specified location, they are not generated. + """ + + ledger_public_keys = { + "service_keys": [], + "online_whale_keys": [], + "offline_whale_keys": [], + "online_fish_keys": [], + "offline_fish_keys": [], + "online_staker_keys": [], + "stakers": [] + } + + # Try loading Service keys + service_accounts_directory = Path(service_accounts_directory) + service_key_files = glob.glob( + str(service_accounts_directory.absolute()) + "/*.pub") + print("Processing Service Keys -- loaded {} service keys".format( + len(service_key_files))) + # load Service Key Contents + for service_key_file in service_key_files: + service_name = os.path.basename(service_key_file).split("_")[0] + service_balance = DEFAULT_SERVICES[service_name] + fd = open(service_key_file, "r") + service_public_key = fd.readline().strip() + ledger_public_keys["service_keys"].append({ + "public_key": service_public_key, + "service": service_name, + "balance": service_balance + }) + + fd.close() + + # Try loading offline whale keys + offline_whale_accounts_directory = Path(offline_whale_accounts_directory) + offline_whale_key_files = glob.glob( + str(offline_whale_accounts_directory.absolute()) + "/*.pub") + if len(offline_whale_key_files) >= num_whale_accounts: + print( + "Processing Offline Whale Keys -- {} keys required, loaded {} whale keys" + .format(num_whale_accounts, len(offline_whale_key_files))) + # load Whale Key Contents + for whale_key_file in offline_whale_key_files: + fd = open(whale_key_file, "r") + whale_public_key = fd.readline().strip() + ledger_public_keys["offline_whale_keys"].append(whale_public_key) + fd.close() + else: + raise Exception( + "There aren't enough Offline Whale Keys to populate the genesis ledger! Required {}, Present {}" + .format(num_whale_accounts, len(offline_whale_key_files))) + + # Try loading online whale keys + online_whale_accounts_directory = Path(online_whale_accounts_directory) + online_whale_key_files = glob.glob( + str(online_whale_accounts_directory.absolute()) + "/*.pub") + if len(online_whale_key_files) >= num_whale_accounts: + print( + "Processing Online Whale Keys -- {} keys required, loaded {} whale keys" + .format(num_whale_accounts, len(online_whale_key_files))) + # load Whale Key Contents + for whale_key_file in online_whale_key_files: + fd = open(whale_key_file, "r") + whale_public_key = fd.readline().strip() + ledger_public_keys["online_whale_keys"].append(whale_public_key) + fd.close() + else: + raise Exception( + "There aren't enough Online Whale Keys to populate the genesis ledger! Required {}, Present {}" + .format(num_whale_accounts, len(online_whale_key_files))) + + # Try Loading Offline Fish Keys + offline_fish_accounts_directory = Path(offline_fish_accounts_directory) + offline_fish_key_files = glob.glob( + str(offline_fish_accounts_directory.absolute()) + "/*.pub") + if len(offline_fish_key_files) >= num_fish_accounts: + print( + "Processing Offline Fish Keys -- {} keys required, loaded {} fish keys" + .format(num_fish_accounts, len(offline_fish_key_files))) + for fish_key_file in offline_fish_key_files: + fd = open(fish_key_file, "r") + fish_public_key = fd.readline().strip() + ledger_public_keys["offline_fish_keys"].append(fish_public_key) + + fd.close() + else: + raise Exception( + "There aren't enough Offline Fish Keys to populate the genesis ledger! Required {}, Present {}" + .format(num_fish_accounts, len(offline_fish_key_files))) + import itertools + + # If a CSV is passed as input, use the staker public keys + if staker_csv_file is not None: + # Load contents of Online Staker Keys CSV + with open(Path(staker_csv_file).absolute(), newline='') as csvfile: + reader = csv.reader(csvfile, delimiter=',', quotechar='|') + for row in itertools.islice(reader, num_fish_accounts): + discord_username = row[1] + public_key = row[2] + ## TODO: Check the key format better here + if public_key.startswith("4vsRC"): + ledger_public_keys["online_staker_keys"].append(public_key) + ledger_public_keys["stakers"].append({ + "nickname": + discord_username, + "public_key": + public_key + }) + # If no CSV passed as input, use the online_fish_keys + else: + online_fish_accounts_directory = Path(online_fish_accounts_directory) + online_fish_key_files = glob.glob( + str(online_fish_accounts_directory.absolute()) + "/*.pub") + if len(offline_fish_key_files) >= num_fish_accounts: + print( + "Processing Online Fish Keys -- {} keys required, loaded {} fish keys" + .format(num_fish_accounts, len(online_fish_key_files))) + for fish_key_file in online_fish_key_files[0:num_fish_accounts]: + fd = open(fish_key_file, "r") + fish_public_key = fd.readline().strip() + ledger_public_keys["online_staker_keys"].append( + fish_public_key) + ledger_public_keys["stakers"].append({ + "nickname": + Path(fish_key_file).name, + "public_key": + fish_public_key + }) + + fd.close() + else: + raise Exception( + "There aren't enough Online Fish Keys to populate the genesis ledger! Required {}, Present {}" + .format(num_fish_accounts, len(online_fish_key_files))) + + ##################### + # GENERATE THE LEDGER + ##################### + print("\n===Generating Genesis Ledger===") + # { + # "name": "release", + # "num_accounts": 250, + # "accounts": [ + # { + # "pk":public-key-string, + # "sk":optional-secret-key-string, + # "balance":int, + # "delegate": optional-public-key-string + # } + # ] + # } + ledger = [] + annotated_ledger = [] + + # Service Accounts + for service in ledger_public_keys["service_keys"]: + ledger.append({ + "pk": service["public_key"], + "sk": None, + "balance": encode_nanocodas(service["balance"]), + "delegate": None + }) + + annotated_ledger.append({ + "pk": service["public_key"], + "sk": None, + "balance": encode_nanocodas(service["balance"]), + "delegate": None, + "nickname": service["service"] + }) + + # Check that there are enough fish keys for all stakers + if len(ledger_public_keys["offline_fish_keys"]) >= len( + ledger_public_keys["online_staker_keys"]): + print( + "There is a sufficient number of Fish Keys -- {} fish keys, {} stakers" + .format(num_fish_accounts, + len(ledger_public_keys["online_staker_keys"]))) + + fish_offline_balance = encode_nanocodas(65500 * (10**9)) + fish_online_balance = encode_nanocodas(500 * (10**9)) + + # Fish Accounts + for index, fish in enumerate(ledger_public_keys["offline_fish_keys"]): + try: + ledger.append({ + "pk": + fish, + "sk": + None, + "balance": + fish_offline_balance, + "delegate": + ledger_public_keys["stakers"][index]["public_key"] + }) + ledger.append({ + "pk": + ledger_public_keys["stakers"][index]["public_key"], + "sk": + None, + "delegate": + None, + "balance": + fish_online_balance + }) + annotated_ledger.append({ + "pk": + fish, + "sk": + None, + "balance": + fish_offline_balance, + "delegate": + ledger_public_keys["stakers"][index]["public_key"], + "nickname": + ledger_public_keys["stakers"][index]["nickname"] + }) + annotated_ledger.append({ + "pk": + ledger_public_keys["stakers"][index]["public_key"], + "sk": + None, + "balance": + fish_online_balance, + "delegate": + None, + "nickname": + ledger_public_keys["stakers"][index]["nickname"] + }) + # This will occur if there are less staker keys than there are fish keys + except IndexError: + # Delegate remainder keys to block producer one + remainder_index = len( + ledger_public_keys["offline_fish_keys"]) - len( + ledger_public_keys["stakers"]) - 1 + break + + # Check that there are enough whale keys for all block producers + if len(ledger_public_keys["offline_whale_keys"]) >= len( + ledger_public_keys["online_whale_keys"]): + print( + "There is a sufficient number of Whale Keys -- {} offline whale keys, {} online whale keys" + .format(num_whale_accounts, + len(ledger_public_keys["online_whale_keys"]))) + + whale_offline_balance = 66000 * 175 * (10**9) + + # Whale Accounts + for index, offline_whale in enumerate( + ledger_public_keys["offline_whale_keys"]): + try: + ledger.append({ + "pk": + offline_whale, + "sk": + None, + "balance": + encode_nanocodas(whale_offline_balance), + "delegate": + ledger_public_keys["online_whale_keys"][index] + }) + ledger.append({ + "pk": ledger_public_keys["online_whale_keys"][index], + "sk": None, + "balance": encode_nanocodas(0), + "delegate": None + }) + + annotated_ledger.append({ + "pk": + offline_whale, + "sk": + None, + "balance": + encode_nanocodas(whale_offline_balance), + "delegate": + ledger_public_keys["online_whale_keys"][index], + "delegate_discord_username": + "CodaBP{}".format(index) + }) + annotated_ledger.append({ + "pk": + ledger_public_keys["online_whale_keys"][index], + "sk": + None, + "balance": + encode_nanocodas(0), + "delegate": + None, + "discord_username": + "CodaBP{}".format(index) + }) + # This will occur if there are less block producer keys than there are whale keys + except IndexError: + print( + "There are less online whale keys than there are offline whale keys, are you sure you meant to do that?" + ) + break + print() + # TODO: dynamic num_accounts + # Write ledger and annotated ledger to disk + with open(str(SCRIPT_DIR / 'genesis_ledger.json'), 'w') as outfile: + ledger_wrapper = { + "name": "release", + "num_accounts": 250, + "accounts": ledger + } + json.dump(ledger_wrapper, outfile, indent=1) + print("Ledger Path: " + str(SCRIPT_DIR / 'genesis_ledger.json')) + + with open(str(SCRIPT_DIR / 'annotated_ledger.json'), 'w') as outfile: + annotated_ledger_wrapper = { + "name": "annotated_release", + "num_accounts": 250, + "accounts": ledger + } + json.dump(annotated_ledger_wrapper, outfile, indent=1) + print("Annotated Ledger Path: " + str(SCRIPT_DIR / 'annotated_ledger.json')) + +if __name__ == '__main__': + generate_ledger() diff --git a/scripts/rebuild-deb.sh b/scripts/rebuild-deb.sh index e204377a894..750dd20daf3 100755 --- a/scripts/rebuild-deb.sh +++ b/scripts/rebuild-deb.sh @@ -21,16 +21,19 @@ source "${SCRIPTPATH}/../buildkite/scripts/export-git-env-vars.sh" cd "${SCRIPTPATH}/../_build" # Set dependencies based on debian release -SHARED_DEPS="libssl1.1, libgmp10, libgomp1, libffi6, tzdata" +SHARED_DEPS="libssl1.1, libgmp10, libgomp1, tzdata" case "${MINA_DEB_CODENAME}" in + bullseye) + DAEMON_DEPS=", libffi7, libjemalloc2, libpq-dev, libprocps8" + ;; buster) - DAEMON_DEPS=", libjemalloc2, libpq-dev, libprocps7" - # buster deps that should only affect the toolchain container: - # python3-sexpdata \ - # python-sexpdata \ + DAEMON_DEPS=", libffi6, libjemalloc2, libpq-dev, libprocps7" + ;; + stretch|bionic) + DAEMON_DEPS=", libffi6, libjemalloc1, libpq-dev, libprocps6" ;; - stretch) - DAEMON_DEPS=", libjemalloc1, libpq-dev, libprocps6" + focal) + DAEMON_DEPS=", libffi7, libjemalloc2, libpq-dev, libprocps8" ;; *) echo "Unknown Debian codename provided: ${MINA_DEB_CODENAME}"; exit 1 diff --git a/scripts/release-docker.sh b/scripts/release-docker.sh index 2eb06126a6a..65f1ce1c390 100755 --- a/scripts/release-docker.sh +++ b/scripts/release-docker.sh @@ -10,7 +10,7 @@ set +x CLEAR='\033[0m' RED='\033[0;31m' # Array of valid service names -VALID_SERVICES=('mina-archive', 'mina-daemon' 'mina-rosetta' 'mina-rosetta-ubuntu' 'mina-toolchain' 'bot' 'leaderboard' 'delegation-backend' 'delegation-backend-toolchain') +VALID_SERVICES=('mina-archive', 'mina-daemon' 'mina-rosetta' 'mina-toolchain' 'bot' 'leaderboard' 'delegation-backend' 'delegation-backend-toolchain') function usage() { if [[ -n "$1" ]]; then @@ -44,10 +44,22 @@ while [[ "$#" -gt 0 ]]; do case $1 in *) echo "Unknown parameter passed: $1"; exit 1;; esac; shift; done +# Determine the proper image for ubuntu or debian +case "${DEB_CODENAME##*=}" in + bionic|focal|impish|jammy) + IMAGE="ubuntu:${DEB_CODENAME##*=}" + ;; + stretch|buster|bullseye|sid) + IMAGE="debian:${DEB_CODENAME##*=}-slim" + ;; +esac +IMAGE="--build-arg image=${IMAGE}" + # Debug prints for visability # Substring removal to cut the --build-arg arguments on the = so that the output is exactly the input flags https://wiki.bash-hackers.org/syntax/pe#substring_removal echo "--service ${SERVICE} --version ${VERSION} --branch ${BRANCH##*=} --deb-version ${DEB_VERSION##*=} --deb-release ${DEB_RELEASE##*=} --deb-codename ${DEB_CODENAME##*=}" echo ${EXTRA} +echo "docker image: ${IMAGE}" # Verify Required Parameters are Present if [[ -z "$SERVICE" ]]; then usage "Service is not set!"; fi; @@ -75,9 +87,6 @@ mina-toolchain) mina-rosetta) DOCKERFILE_PATH="dockerfiles/stages/1-build-deps dockerfiles/stages/2-opam-deps dockerfiles/stages/3-builder dockerfiles/stages/4-production" ;; -mina-rosetta-ubuntu) - DOCKERFILE_PATH="dockerfiles/stages/1-build-deps-ubuntu dockerfiles/stages/2-opam-deps dockerfiles/stages/3-builder dockerfiles/stages/4-prod-ubuntu" - ;; leaderboard) DOCKERFILE_PATH="frontend/leaderboard/Dockerfile" DOCKER_CONTEXT="frontend/leaderboard" @@ -103,9 +112,9 @@ TAG="minaprotocol/$SERVICE:$VERSION" # If DOCKER_CONTEXT is not specified, assume none and just pipe the dockerfile into docker build extra_build_args=$(echo ${EXTRA} | tr -d '"') if [[ -z "${DOCKER_CONTEXT}" ]]; then - cat $DOCKERFILE_PATH | docker build $CACHE $NETWORK $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $BRANCH $REPO $extra_build_args -t "$TAG" - + cat $DOCKERFILE_PATH | docker build $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $BRANCH $REPO $extra_build_args -t "$TAG" - else - docker build $CACHE $NETWORK $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $BRANCH $REPO $extra_build_args $DOCKER_CONTEXT -t "$TAG" -f $DOCKERFILE_PATH + docker build $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $BRANCH $REPO $extra_build_args $DOCKER_CONTEXT -t "$TAG" -f $DOCKERFILE_PATH fi tag-and-push() { diff --git a/scripts/run_local_network.sh b/scripts/run_local_network.sh index 76f5107cda0..20ed5d06d91 100755 --- a/scripts/run_local_network.sh +++ b/scripts/run_local_network.sh @@ -1,12 +1,115 @@ #!/bin/bash +# exit script when commands fail +set -e +# kill background process when script closes +trap "killall background" EXIT + +# ================================================ +# Constants + +MINA=_build/default/src/app/cli/src/mina.exe +LOGPROC=_build/default/src/app/logproc/logproc.exe + +export MINA_PRIVKEY_PASS='naughty blue worm' +SEED_PEER_KEY="CAESQNf7ldToowe604aFXdZ76GqW/XVlDmnXmBT+otorvIekBmBaDWu/6ZwYkZzqfr+3IrEh6FLbHQ3VSmubV9I9Kpc=,CAESIAZgWg1rv+mcGJGc6n6/tyKxIehS2x0N1Uprm1fSPSqX,12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr" +SEED_PEER_ID="/ip4/127.0.0.1/tcp/3002/p2p/12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr" + +SNARK_WORKER_FEE=0.01 + +TRANSACTION_FREQUENCY=5 + +WHALE_START_PORT=4000 +FISH_START_PORT=5000 +NODE_START_PORT=6000 + +# ================================================ +# Inputs (set to default values) + whales=1 fish=1 nodes=1 transactions=false reset=false -help=false +# ================================================ +# Globals (assigned during execution of script) + +ledgerfolder="" +snark_worker_pubkey="" +nodesfolder="" +config="" +seed_pid="" +whale_pids=() +fish_pids=() +node_pids=() + +# ================================================ +# Helper functions + +help() { + echo "-w|--whales #" + echo "-f|--fish #" + echo "-n|--nodes #" + echo "-t|--transactions" + echo "-r|--reset" + echo "-h|--help" + exit +} + +clean-dir() { + rm -rf $1 + mkdir -p $1 +} + +generate-keypair() { + $MINA advanced generate-keypair -privkey-path $1 +} + +# Execute a daemon, exposing all 5 ports in +# sequence starting with provided bas port. +exec-daemon() { + base_port=$1 + shift + client_port=$base_port + rest_port=$(($base_port+1)) + external_port=$(($base_port+2)) + daemon_metrics_port=$(($base_port+3)) + libp2p_metrics_port=$(($base_port+4)) + echo $MINA daemon \ + -client-port $client_port \ + -rest-port $rest_port \ + -external-port $external_port \ + -metrics-port $daemon_metrics_port \ + -libp2p-metrics-port $libp2p_metrics_port \ + -config-file $config \ + -generate-genesis-proof true \ + -log-json \ + -log-level Trace \ + $@ + exec $MINA daemon \ + -client-port $client_port \ + -rest-port $rest_port \ + -external-port $external_port \ + -metrics-port $daemon_metrics_port \ + -libp2p-metrics-port $libp2p_metrics_port \ + -config-file $config \ + -generate-genesis-proof true \ + -log-json \ + -log-level Trace \ + $@ +} + +# Spawn a node in the background. +# Configures node directory and logs. +spawn-node() { + folder=$1 + shift + exec-daemon $@ -config-directory $folder &> $folder/log.txt & +} + +# ================================================ +# PARSE INPUTS FROM ARGUMENTS while [[ "$#" -gt 0 ]]; do case $1 in @@ -15,23 +118,12 @@ while [[ "$#" -gt 0 ]]; do -n|--nodes) nodes="$2"; shift ;; -t|--transactions) transactions=true ;; -r|--reset) reset=true ;; - -h|--help) help=true; shift ;; + -h|--help) help ;; *) echo "Unknown parameter passed: $1"; exit 1 ;; esac shift done -if $help; then - echo "-w|--whales #" - echo "-f|--fish #" - echo "-n|--nodes #" - echo "-t|--transactions" - echo "-r|--reset" - echo "-h|--help" - exit -fi - - if $transactions; then if [ "$fish" -eq "0" ]; then echo "sending transactions require at least one fish" @@ -39,11 +131,6 @@ if $transactions; then fi fi -# kill background process when script closes -trap "killall background" EXIT - -# ================================================ - echo "Starting network with:" echo -e "\t1 seed" echo -e "\t$whales whales" @@ -65,20 +152,23 @@ if [ ! -d "$ledgerfolder" ]; then mkdir $ledgerfolder - S=./automation/scripts + clean-dir $ledgerfolder/offline_whale_keys + clean-dir $ledgerfolder/offline_fish_keys + clean-dir $ledgerfolder/online_whale_keys + clean-dir $ledgerfolder/online_fish_keys + clean-dir $ledgerfolder/service-keys - rm -rf $ledgerfolder/offline_whale_keys - rm -rf $ledgerfolder/offline_fish_keys - rm -rf $ledgerfolder/online_whale_keys - rm -rf $ledgerfolder/online_fish_keys - rm -rf $ledgerfolder/service-keys - - python3 $S/testnet-keys.py keys generate-offline-fish-keys --count $fish --output-dir $ledgerfolder/offline_fish_keys - python3 $S/testnet-keys.py keys generate-online-fish-keys --count $fish --output-dir $ledgerfolder/online_fish_keys - python3 $S/testnet-keys.py keys generate-offline-whale-keys --count $whales --output-dir $ledgerfolder/offline_whale_keys - python3 $S/testnet-keys.py keys generate-online-whale-keys --count $whales --output-dir $ledgerfolder/online_whale_keys + generate-keypair $ledgerfolder/snark_worker_keys/snark_worker_account + for i in $(seq 1 $fish); do + generate-keypair $ledgerfolder/offline_fish_keys/offline_fish_account_$i + generate-keypair $ledgerfolder/online_fish_keys/online_fish_account_$i + done + for i in $(seq 1 $whales); do + generate-keypair $ledgerfolder/offline_whale_keys/offline_whale_account_$i + generate-keypair $ledgerfolder/online_whale_keys/online_whale_account_$i + done - if [ "$(uname)" != "Darwin" ]; then + if [ "$(uname)" != "Darwin" ] && [ $fish -gt 0 ]; then file=$(ls $ledgerfolder/offline_fish_keys/ | head -n 1) owner=$(stat -c "%U" $ledgerfolder/offline_fish_keys/$file) @@ -95,58 +185,38 @@ if [ ! -d "$ledgerfolder" ]; then chmod -R 0700 $ledgerfolder/offline_whale_keys chmod -R 0700 $ledgerfolder/online_whale_keys - python3 $S/testnet-keys.py ledger generate-ledger --num-whale-accounts $whales --num-fish-accounts $fish \ - --offline-whale-accounts-directory $ledgerfolder/offline_whale_keys \ - --offline-fish-accounts-directory $ledgerfolder/offline_fish_keys \ - --online-whale-accounts-directory $ledgerfolder/online_whale_keys \ - --online-fish-accounts-directory $ledgerfolder/online_fish_keys + python3 scripts/generate-local-network-ledger.py \ + --num-whale-accounts $whales \ + --num-fish-accounts $fish \ + --offline-whale-accounts-directory $ledgerfolder/offline_whale_keys \ + --offline-fish-accounts-directory $ledgerfolder/offline_fish_keys \ + --online-whale-accounts-directory $ledgerfolder/online_whale_keys \ + --online-fish-accounts-directory $ledgerfolder/online_fish_keys - cp $S/genesis_ledger.json $ledgerfolder/genesis_ledger.json + cp scripts/genesis_ledger.json $ledgerfolder/genesis_ledger.json fi +snark_worker_pubkey=$(cat $ledgerfolder/snark_worker_keys/snark_worker_account.pub) + # ================================================ # Update Timestamp -python3 - < $config # ================================================ # Launch nodes -MINA=_build/default/src/app/cli/src/mina.exe -LOGPROC=_build/default/src/app/logproc/logproc.exe - - nodesfolder=$ledgerfolder/nodes - -rm -rf $nodesfolder -mkdir -p $nodesfolder +clean-dir $nodesfolder # ---------- mkdir $nodesfolder/seed -$MINA daemon -seed -client-port 3000 -rest-port 3001 -external-port 3002 -metrics-port 3003 -libp2p-metrics-port 3004 -config-directory $nodesfolder/seed -config-file $daemon -generate-genesis-proof true -discovery-keypair CAESQNf7ldToowe604aFXdZ76GqW/XVlDmnXmBT+otorvIekBmBaDWu/6ZwYkZzqfr+3IrEh6FLbHQ3VSmubV9I9Kpc=,CAESIAZgWg1rv+mcGJGc6n6/tyKxIehS2x0N1Uprm1fSPSqX,12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr -log-json -log-level Trace &> $nodesfolder/seed/log.txt & +spawn-node $nodesfolder/seed 3000 -seed -discovery-keypair $SEED_PEER_KEY seed_pid=$! echo 'waiting for seed to go up...' @@ -158,62 +228,33 @@ done # ---------- -whale_start_port=4000 +snark_worker_flags="-snark-worker-fee $SNARK_WORKER_FEE -run-snark-worker $snark_worker_pubkey -work-selection seq" + for i in $(seq 1 $whales); do folder=$nodesfolder/whale_$i keyfile=$ledgerfolder/online_whale_keys/online_whale_account_$i - logfile=$folder/log.txt mkdir $folder - client_port=$(echo $whale_start_port + 0 + $i*5 | bc) - rest_port=$(echo $whale_start_port + 1 + $i*5 | bc) - ext_port=$(echo $whale_start_port + 2 + $i*5 | bc) - metrics_port=$(echo $whale_start_port + 3 + $i*5 | bc) - libp2p_metrics_port=$(echo $whale_start_port + 4 + $i*5 | bc) - - MINA_PRIVKEY_PASS="naughty blue worm" $MINA daemon -peer "/ip4/127.0.0.1/tcp/3002/p2p/12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr" -client-port $client_port -rest-port $rest_port -external-port $ext_port -metrics-port $metrics_port -libp2p-metrics-port $libp2p_metrics_port -config-directory $folder -config-file $daemon -generate-genesis-proof true -block-producer-key $keyfile -log-json -snark-worker-fee "0.01" -run-snark-worker B62qp4UturELw4MmhAZhor8rwzaH1BBAivRnvdp1Yhkq6odhhFiT8uC -work-selection seq -log-level Trace &> $logfile & + spawn-node $folder $(($WHALE_START_PORT+($i-1)*5)) -peer $SEED_PEER_ID -block-producer-key $keyfile $snark_worker_flags whale_pids[${i}]=$! - whale_logfiles[${i}]=$logfile - whale_clientport[${i}]=$client_port done # ---------- -fish_start_port=5000 for i in $(seq 1 $fish); do folder=$nodesfolder/fish_$i keyfile=$ledgerfolder/online_fish_keys/online_fish_account_$i - logfile=$folder/log.txt mkdir $folder - client_port=$(echo $fish_start_port + 0 + $i*5 | bc) - rest_port=$(echo $fish_start_port + 1 + $i*5 | bc) - ext_port=$(echo $fish_start_port + 2 + $i*5 | bc) - metrics_port=$(echo $fish_start_port + 3 + $i*5 | bc) - libp2p_metrics_port=$(echo $fish_start_port + 4 + $i*5 | bc) - - MINA_PRIVKEY_PASS="naughty blue worm" $MINA daemon -peer "/ip4/127.0.0.1/tcp/3002/p2p/12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr" -client-port $client_port -rest-port $rest_port -external-port $ext_port -metrics-port $metrics_port -libp2p-metrics-port $libp2p_metrics_port -config-directory $folder -config-file $daemon -generate-genesis-proof true -block-producer-key $keyfile -log-json -snark-worker-fee "0.01" -run-snark-worker B62qp4UturELw4MmhAZhor8rwzaH1BBAivRnvdp1Yhkq6odhhFiT8uC -work-selection seq -log-level Trace &> $logfile & + spawn-node $folder $(($FISH_START_PORT+($i-1)*5)) -peer $SEED_PEER_ID -block-producer-key $keyfile $snark_worker_flags fish_pids[${i}]=$! - fish_logfiles[${i}]=$logfile - fish_clientport[${i}]=$client_port done # ---------- -node_start_port=6000 for i in $(seq 1 $nodes); do folder=$nodesfolder/node_$i - keyfile=$ledgerfolder/online_node_keys/online_node_account_$i - logfile=$folder/log.txt mkdir $folder - client_port=$(echo $node_start_port + 0 + $i*5 | bc) - rest_port=$(echo $node_start_port + 1 + $i*5 | bc) - ext_port=$(echo $node_start_port + 2 + $i*5 | bc) - metrics_port=$(echo $node_start_port + 3 + $i*5 | bc) - libp2p_metrics_port=$(echo $node_start_port + 4 + $i*5 | bc) - - MINA_PRIVKEY_PASS="naughty blue worm" $MINA daemon -peer "/ip4/127.0.0.1/tcp/3002/p2p/12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr" -client-port $client_port -rest-port $rest_port -external-port $ext_port -metrics-port $metrics_port -libp2p-metrics-port $libp2p_metrics_port -config-directory $folder -config-file $daemon -generate-genesis-proof true -log-json -log-level Trace &> $logfile & + spawn-node $folder $(($NODE_START_PORT+($i-1)*5)) -peer $SEED_PEER_ID node_pids[${i}]=$! - node_logfiles[${i}]=$logfile - node_clientport[${i}]=$client_port done # ================================================ @@ -230,24 +271,24 @@ echo -e "\twhales" for i in $(seq 1 $whales); do echo -e "\t\t$i" echo -e "\t\t pid ${whale_pids[${i}]}" - echo -e "\t\t status: $MINA client status -daemon-port ${whale_clientport[${i}]}" - echo -e "\t\t logs: cat ${whale_logfiles[${i}]} | $LOGPROC" + echo -e "\t\t status: $MINA client status -daemon-port $(($WHALE_START_PORT+($i-1)*5))" + echo -e "\t\t logs: cat $nodesfolder/whale_$i/log.txt | $LOGPROC" done echo -e "\tfish" for i in $(seq 1 $fish); do echo -e "\t\t$i" echo -e "\t\t pid ${fish_pids[${i}]}" - echo -e "\t\t status: $MINA client status -daemon-port ${fish_clientport[${i}]}" - echo -e "\t\t logs: cat ${fish_logfiles[${i}]} | $LOGPROC" + echo -e "\t\t status: $MINA client status -daemon-port $(($FISH_START_PORT+($i-1)*5))" + echo -e "\t\t logs: cat $nodesfolder/fish_$i/log.txt | $LOGPROC" done echo -e "\tnodes" for i in $(seq 1 $nodes); do echo -e "\t\t$i" echo -e "\t\t pid ${node_pids[${i}]}" - echo -e "\t\t status: $MINA client status -daemon-port ${node_clientport[${i}]}" - echo -e "\t\t logs: cat ${node_logfiles[${i}]} | $LOGPROC" + echo -e "\t\t status: $MINA client status -daemon-port $(($NODE_START_PORT+($i-1)*5))" + echo -e "\t\t logs: cat $nodesfolder/node_$i/log.txt | $LOGPROC" done # ================================================ @@ -257,27 +298,31 @@ if $transactions; then folder=$nodesfolder/fish_1 keyfile=$ledgerfolder/online_fish_keys/online_fish_account_1 pubkey=$(cat $ledgerfolder/online_fish_keys/online_fish_account_1.pub) - port=5006 - transaction_frequency=5 + rest_server="http://127.0.0.1:5001/graphql" echo "waiting for node to be up to start sending transactions..." - until $MINA client status -daemon-port 5005 &> /dev/null + until $MINA client status -daemon-port 5000 &> /dev/null do sleep 1 done echo "starting to send transactions every $transaction_frequency seconds" - MINA_PRIVKEY_PASS="naughty blue worm" $MINA account import -config-directory $folder -rest-server "http://127.0.0.1:$port/graphql" -privkey-path $keyfile &> /dev/null + set +e + + $MINA account import -rest-server $rest_server -privkey-path $keyfile + $MINA account unlock -rest-server $rest_server -public-key $pubkey - MINA_PRIVKEY_PASS="naughty blue worm" $MINA account unlock -rest-server "http://127.0.0.1:$port/graphql" -public-key $pubkey &> /dev/null + sleep $TRANSACTION_FREQUENCY + $MINA client send-payment -rest-server $rest_server -amount 1 -nonce 0 -receiver $pubkey -sender $pubkey while true; do - sleep $transaction_frequency - MINA_PRIVKEY_PASS="naughty blue worm" $MINA client send-payment -rest-server "http://127.0.0.1:$port/graphql" -amount 1 -receiver $pubkey -sender $pubkey &> /dev/null + sleep $TRANSACTION_FREQUENCY + $MINA client send-payment -rest-server $rest_server -amount 1 -receiver $pubkey -sender $pubkey done + set -e fi # ================================================ diff --git a/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml b/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml index 81b377e9d16..1606fa145e3 100644 --- a/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml +++ b/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml @@ -397,6 +397,14 @@ let setup_daemon logger = and node_status_url = flag "--node-status-url" ~aliases:[ "node-status-url" ] (optional string) ~doc:"URL of the node status collection service" + and node_error_url = + flag "--node-error-url" ~aliases:[ "node-error-url" ] (optional string) + ~doc:"URL of the node error collection service" + and contact_info = + flag "--contact-info" ~aliases:[ "contact-info" ] (optional string) + ~doc: + "contact info used in node error report service (it could be either \ + email address or discord username)" and uptime_url_string = flag "--uptime-url" ~aliases:[ "uptime-url" ] (optional string) ~doc:"URL URL of the uptime service of the Mina delegation program" @@ -745,7 +753,6 @@ let setup_daemon logger = maybe_from_config YJ.Util.to_string_option "node-status-url" node_status_url in - (* FIXME #4095: pass this through to Gossip_net.Libp2p *) let _max_concurrent_connections = (*if @@ -1221,7 +1228,7 @@ Pass one of -peer, -peer-list-file, -seed, -peer-list-url.|} ; (* Breaks a dependency cycle with monitor initilization and coda *) let coda_ref : Mina_lib.t option ref = ref None in Coda_run.handle_shutdown ~monitor ~time_controller ~conf_dir - ~child_pids:pids ~top_logger:logger coda_ref ; + ~child_pids:pids ~top_logger:logger ~node_error_url ~contact_info coda_ref ; Async.Scheduler.within' ~monitor @@ fun () -> let%bind { Coda_initialization.coda diff --git a/src/app/cli/src/init/coda_run.ml b/src/app/cli/src/init/coda_run.ml index f6336b10582..043265b1365 100644 --- a/src/app/cli/src/init/coda_run.ml +++ b/src/app/cli/src/init/coda_run.ml @@ -649,7 +649,7 @@ let handle_crash e ~time_controller ~conf_dir ~child_pids ~top_logger coda_ref = Core.print_string message let handle_shutdown ~monitor ~time_controller ~conf_dir ~child_pids ~top_logger - coda_ref = + ~node_error_url ~contact_info coda_ref = Monitor.detach_and_iter_errors monitor ~f:(fun exn -> don't_wait_for (let%bind () = @@ -697,6 +697,14 @@ let handle_shutdown ~monitor ~time_controller ~conf_dir ~child_pids ~top_logger handle_crash Mina_lib.Offline_shutdown ~time_controller ~conf_dir ~child_pids ~top_logger coda_ref | _exn -> + let%bind () = + match node_error_url with + | Some node_error_url -> + Node_error_service.send_report ~logger:top_logger + ~node_error_url ~mina_ref:coda_ref ~exn ~contact_info + | None -> + Deferred.unit + in handle_crash exn ~time_controller ~conf_dir ~child_pids ~top_logger coda_ref in diff --git a/src/app/cli/src/init/dune b/src/app/cli/src/init/dune index 928e2b38169..6225ea07a8e 100644 --- a/src/app/cli/src/init/dune +++ b/src/app/cli/src/init/dune @@ -15,7 +15,7 @@ mina_base mina_graphql mina_lib mina_state consensus mina_transition mina_version mina_user_error - o1trace o1trace_webkit_event protocol_version node_status + o1trace o1trace_webkit_event protocol_version node_status node_error_service transition_frontier web_client_pipe web_request graphql_lib genesis_ledger_helper bash_colors) (instrumentation (backend bisect_ppx)) diff --git a/src/app/cli/src/tests/coda_worker.ml b/src/app/cli/src/tests/coda_worker.ml index d819426a8ae..f270ed6f4c3 100644 --- a/src/app/cli/src/tests/coda_worker.ml +++ b/src/app/cli/src/tests/coda_worker.ml @@ -493,7 +493,8 @@ module T = struct in let coda_ref : Mina_lib.t option ref = ref None in Coda_run.handle_shutdown ~monitor ~time_controller ~conf_dir - ~child_pids:pids ~top_logger:logger coda_ref ; + ~child_pids:pids ~top_logger:logger ~node_error_url:None + ~contact_info:None coda_ref ; let%map coda = with_monitor (fun () -> diff --git a/src/app/client_sdk/client_sdk.ml b/src/app/client_sdk/client_sdk.ml index 7585aae4e5d..8911a0ebc3c 100644 --- a/src/app/client_sdk/client_sdk.ml +++ b/src/app/client_sdk/client_sdk.ml @@ -9,12 +9,11 @@ [%%endif] open Js_of_ocaml -open Signature_lib_nonconsensus -open Mina_base_nonconsensus -open Rosetta_lib_nonconsensus -open Rosetta_coding_nonconsensus +open Signature_lib +open Mina_base +open Rosetta_lib +open Rosetta_coding open Js_util -module String_sign = String_sign_nonconsensus.String_sign let _ = Js.export "minaSDK" @@ -77,18 +76,14 @@ let _ = Public_key.Compressed.of_base58_check_exn pk_base58_check |> Public_key.decompress_exn in - let dummy_payload = - Mina_base_nonconsensus.Signed_command_payload.dummy - in + let dummy_payload = Mina_base.Signed_command_payload.dummy in let signature = - Mina_base_nonconsensus.Signed_command.sign_payload sk dummy_payload - in - let message = - Mina_base_nonconsensus.Signed_command.to_input dummy_payload + Mina_base.Signed_command.sign_payload sk dummy_payload in + let message = Mina_base.Signed_command.to_input dummy_payload in let verified = Schnorr.verify signature - (Snark_params_nonconsensus.Inner_curve.of_affine pk) + (Snark_params.Tick.Inner_curve.of_affine pk) message in if verified then Js._true @@ -266,8 +261,8 @@ let _ = let make_signed_transaction command nonce = let payload_or_err = command - |> Rosetta_lib_nonconsensus.User_command_info.Partial - .to_user_command_payload ~nonce + |> Rosetta_lib.User_command_info.Partial.to_user_command_payload + ~nonce in match payload_or_err with | Ok payload -> ( @@ -281,9 +276,9 @@ let _ = let json' = `Assoc [ ("data", json) ] in Js.string (Yojson.Safe.to_string json') | Error errs -> - make_error (Rosetta_lib_nonconsensus.Errors.show errs) ) + make_error (Rosetta_lib.Errors.show errs) ) | Error errs -> - make_error (Rosetta_lib_nonconsensus.Errors.show errs) + make_error (Rosetta_lib.Errors.show errs) in match Transaction.Unsigned.Rendered.of_yojson unsigned_txn_json with | Ok diff --git a/src/app/client_sdk/js_util.ml b/src/app/client_sdk/js_util.ml index dbe98b37202..8a6de4626f9 100644 --- a/src/app/client_sdk/js_util.ml +++ b/src/app/client_sdk/js_util.ml @@ -1,13 +1,10 @@ (* js_util.ml -- types and transformers for Javascript *) open Js_of_ocaml -open Snark_params_nonconsensus -open Mina_base_nonconsensus -module Currency = Currency_nonconsensus.Currency -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Global_slot = Mina_numbers_nonconsensus.Global_slot +open Snark_params.Tick +open Mina_base +module Global_slot = Mina_numbers.Global_slot module Memo = Signed_command_memo -module Signature_lib = Signature_lib_nonconsensus let raise_js_error s = Js.raise_js_error (new%js Js.error_constr (Js.string s)) diff --git a/src/app/client_sdk/tests/test_signatures.ml b/src/app/client_sdk/tests/test_signatures.ml index 5f0ca5179fc..36b5f8bed7f 100644 --- a/src/app/client_sdk/tests/test_signatures.ml +++ b/src/app/client_sdk/tests/test_signatures.ml @@ -2,24 +2,8 @@ for comparison against signatures generated in client SDK *) -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick - -[%%else] - -open Snark_params_nonconsensus -module Mina_base = Mina_base_nonconsensus -module Signature_lib = Signature_lib_nonconsensus -module Currency = Currency_nonconsensus.Currency -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers - -[%%endif] - open Mina_base open Signature_lib diff --git a/src/app/rosetta/README.md b/src/app/rosetta/README.md index 86593d7724e..82ae57f5802 100644 --- a/src/app/rosetta/README.md +++ b/src/app/rosetta/README.md @@ -4,12 +4,17 @@ Implementation of the [Rosetta API](https://www.rosetta-api.org/) for Mina. ## Changelog +2022/02/09: + +- Refactor docker build instructions to use a generic dockerfile that works across debian/ubuntu + 2022/02/03: - Removed the current test-agent, in part because it relies on the ability to enable and disable staking via GrapQL. That feature of the daemon had been deprecated, and has been removed. A new test-agent may appear in the future. +- Update for release/1.3.0 as opposed to purpose-built rosetta branches 2022/01/18: @@ -167,11 +172,13 @@ Implementation of the [Rosetta API](https://www.rosetta-api.org/) for Mina. ## How to build your own docker image -Checkout the "rosetta-v16" branch of the mina repository, ensure your Docker configuration has a large amount of RAM (at least 12GB, recommended 16GB) and then run the following: +Checkout the "release/1.3.0" branch of the mina repository, ensure your Docker configuration has a large amount of RAM (at least 12GB, recommended 16GB) and then run the following: -`cat dockerfiles/stages/1-build-deps-ubuntu dockerfiles/stages/2-opam-deps dockerfiles/stages/3-builder dockerfiles/stages/4-prod-ubuntu | docker build -t mina-rosetta:v16 --build-arg "MINA_BRANCH=rosetta-v16" -` +`cat dockerfiles/stages/1-build-deps dockerfiles/stages/2-opam-deps dockerfiles/stages/3-builder dockerfiles/stages/4-production | docker build -t mina-rosetta-ubuntu:v1.3.0 --build-arg "MINA_BRANCH=release/1.3.0" -` -This creates an image (mina-rosetta:vX) based on the most up-to-date changes that support rosetta. +This creates an image (mina-rosetta-ubuntu:v1.3.0) based on Ubuntu 20.04 and includes the most recent release of the mina daemon along with mina-archive and mina-rosetta. + +Alternatively, you could use the official image `minaprotocol/mina-rosetta-ubuntu:1.3.0beta1-087f715-stretch` which is built in exactly this way by buildkite CI/CD. ## How to Run @@ -184,7 +191,7 @@ The container includes 4 scripts in /rosetta which run a different set of servic For example, to run the `docker-devnet-start.sh` and connect to the live devnet: ``` -docker run -it --rm --name rosetta --entrypoint=./docker-devnet-start.sh -p 10101:10101 -p 3085:3085 -p 3086:3086 -p 3087:3087 minaprotocol/mina-rosetta:v16 +docker run -it --rm --name rosetta --entrypoint=./docker-devnet-start.sh -p 10101:10101 -p 3085:3085 -p 3086:3086 -p 3087:3087 minaprotocol/mina-rosetta-ubuntu:v1.3.0 ``` Note: It will take 20min-1hr for your node to sync @@ -282,13 +289,13 @@ The Construction API is _not_ validated using `rosetta-cli` as this would requir ### Reproduce agent and rosetta-cli validation -`minaprotocol/mina-rosetta:v16` and `rosetta-cli @ v0.5.12` +`minaprotocol/mina-rosetta-ubuntu:v1.3.0` and `rosetta-cli @ v0.5.12` using this [`rosetta.conf`](https://github.com/MinaProtocol/mina/blob/2b43c8cccfb9eb480122d207c5a3e6e58c4bbba3/src/app/rosetta/rosetta.conf) and the [`bootstrap_balances.json`](https://github.com/MinaProtocol/mina/blob/2b43c8cccfb9eb480122d207c5a3e6e58c4bbba3/src/app/rosetta/bootstrap_balances.json) next to it. **Run a fast sandbox network forever and test with rosetta-cli** ``` -$ docker run --rm --publish 3087:3087 --publish 3086:3086 --publish 3085:3085 --name mina-rosetta-demo --entrypoint ./docker-demo-start.sh -d minaprotocol/mina-rosetta:v16 +$ docker run --rm --publish 3087:3087 --publish 3086:3086 --publish 3085:3085 --name mina-rosetta-demo --entrypoint ./docker-demo-start.sh -d minaprotocol/mina-rosetta-ubuntu:v1.3.0 $ docker logs --follow mina-rosetta-demo @@ -333,3 +340,4 @@ In the generated files, the type `deriving` clauses will need to have `eq` added Any record types with a field named `_type` will need annotate that field with `[@key "type"]`. In `lib/network.ml`, update the two instances of the version number. Check the diff after regeneration and be sure to add `[@default None]` and `[@default []]` to all relevant fields of the models + diff --git a/src/lib/currency/currency.ml b/src/lib/currency/currency.ml index 54eda93b1da..0e9085aac84 100644 --- a/src/lib/currency/currency.ml +++ b/src/lib/currency/currency.ml @@ -1,20 +1,15 @@ [%%import "/src/config.mlh"] open Core_kernel +open Snark_bits [%%ifdef consensus_mechanism] -open Snark_bits open Bitstring_lib open Snark_params open Tick open Let_syntax -[%%else] - -open Snark_bits_nonconsensus -module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended - [%%endif] open Intf diff --git a/src/lib/currency/intf.ml b/src/lib/currency/intf.ml index 0bad8b26a74..02463ba1e2a 100644 --- a/src/lib/currency/intf.ml +++ b/src/lib/currency/intf.ml @@ -1,18 +1,12 @@ [%%import "/src/config.mlh"] open Core_kernel +open Snark_bits [%%ifdef consensus_mechanism] -open Snark_bits open Snark_params.Tick -[%%else] - -open Snark_bits_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -module Sgn = Sgn_nonconsensus.Sgn - [%%endif] type uint64 = Unsigned.uint64 diff --git a/src/lib/data_hash_lib/data_hash.ml b/src/lib/data_hash_lib/data_hash.ml index 71c53a82872..eeb8d22b457 100644 --- a/src/lib/data_hash_lib/data_hash.ml +++ b/src/lib/data_hash_lib/data_hash.ml @@ -3,17 +3,12 @@ [%%import "/src/config.mlh"] open Core_kernel +open Snark_params.Tick [%%ifdef consensus_mechanism] -open Snark_params.Tick open Bitstring_lib -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - [%%endif] module type Full_size = Data_hash_intf.Full_size diff --git a/src/lib/data_hash_lib/data_hash_intf.ml b/src/lib/data_hash_lib/data_hash_intf.ml index e9e4de398b6..38e0c7a4722 100644 --- a/src/lib/data_hash_lib/data_hash_intf.ml +++ b/src/lib/data_hash_lib/data_hash_intf.ml @@ -1,17 +1,12 @@ [%%import "/src/config.mlh"] open Core_kernel +open Snark_params.Tick [%%ifdef consensus_mechanism] -open Snark_params.Tick open Snark_bits -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - [%%endif] module type Data_hash_descriptor = sig diff --git a/src/lib/data_hash_lib/state_hash.ml b/src/lib/data_hash_lib/state_hash.ml index d495e5efce1..814870a523a 100644 --- a/src/lib/data_hash_lib/state_hash.ml +++ b/src/lib/data_hash_lib/state_hash.ml @@ -3,19 +3,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifndef consensus_mechanism] - -module Outside_hash_image = Outside_hash_image_nonconsensus.Outside_hash_image -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -open Snark_params_nonconsensus - -[%%else] - open Snark_params.Tick -[%%endif] - include Data_hash.Make_full_size (struct let version_byte = Base58_check.Version_bytes.state_hash @@ -33,7 +22,7 @@ let zero = dummy (* in the nonconsensus world, we don't have the Pedersen machinery available, so just inline the value for zero *) -let zero = Snark_params_nonconsensus.Field.of_string "0" +let zero = Field.of_string "0" [%%endif] diff --git a/src/lib/data_hash_lib/state_hash.mli b/src/lib/data_hash_lib/state_hash.mli index 56f3547263b..7f35a09d250 100644 --- a/src/lib/data_hash_lib/state_hash.mli +++ b/src/lib/data_hash_lib/state_hash.mli @@ -1,19 +1,8 @@ (* state_hash.mli *) -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - include Data_hash.Full_size include Codable.Base58_check_intf with type t := t diff --git a/src/lib/hash_prefix_states/dune b/src/lib/hash_prefix_states/dune index a922fea62e7..9d3b9382017 100644 --- a/src/lib/hash_prefix_states/dune +++ b/src/lib/hash_prefix_states/dune @@ -6,6 +6,6 @@ (libraries snark_params mina_compile_config random_oracle mina_signature_kind) (preprocessor_deps ../../config.mlh) (preprocess - (pps ppx_custom_printf ppx_snarky ppx_version ppx_optcomp ppx_inline_test ppx_compare ppx_deriving_yojson)) + (pps ppx_custom_printf ppx_snarky ppx_version ppx_inline_test ppx_compare ppx_deriving_yojson)) (instrumentation (backend bisect_ppx)) (synopsis "Values corresponding to the internal state of the Pedersen hash function on the prefixes used in Coda")) diff --git a/src/lib/hash_prefix_states/hash_prefix_states.ml b/src/lib/hash_prefix_states/hash_prefix_states.ml index 16dc4642c89..a921276e69f 100644 --- a/src/lib/hash_prefix_states/hash_prefix_states.ml +++ b/src/lib/hash_prefix_states/hash_prefix_states.ml @@ -1,15 +1,3 @@ -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - -[%%else] - -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -module Mina_compile_config = - Mina_compile_config_nonconsensus.Mina_compile_config - -[%%endif] - open Core_kernel open Hash_prefixes diff --git a/src/lib/hash_prefix_states/hash_prefix_states.mli b/src/lib/hash_prefix_states/hash_prefix_states.mli index 654598e2824..ed213f2863d 100644 --- a/src/lib/hash_prefix_states/hash_prefix_states.mli +++ b/src/lib/hash_prefix_states/hash_prefix_states.mli @@ -1,17 +1,5 @@ -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - open Snark_params open Tick - -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - open Random_oracle val signature : Field.t State.t diff --git a/src/lib/mina_base/account.ml b/src/lib/mina_base/account.ml index e6ce04349b5..8f882e140c2 100644 --- a/src/lib/mina_base/account.ml +++ b/src/lib/mina_base/account.ml @@ -9,14 +9,6 @@ open Core_kernel open Snark_params open Tick -[%%else] - -module Currency = Currency_nonconsensus.Currency -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -module Mina_compile_config = - Mina_compile_config_nonconsensus.Mina_compile_config - [%%endif] open Currency diff --git a/src/lib/mina_base/account_id.mli b/src/lib/mina_base/account_id.mli index 8f02ffc4ac8..0d51f233b43 100644 --- a/src/lib/mina_base/account_id.mli +++ b/src/lib/mina_base/account_id.mli @@ -2,17 +2,8 @@ open Core_kernel open Import - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - [%%versioned: module Stable : sig module V1 : sig diff --git a/src/lib/mina_base/account_timing.ml b/src/lib/mina_base/account_timing.ml index 13322af5242..8507728ac31 100644 --- a/src/lib/mina_base/account_timing.ml +++ b/src/lib/mina_base/account_timing.ml @@ -7,14 +7,6 @@ open Core_kernel open Snark_params open Tick -[%%else] - -module Currency = Currency_nonconsensus.Currency -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -module Mina_compile_config = - Mina_compile_config_nonconsensus.Mina_compile_config - [%%endif] open Currency diff --git a/src/lib/mina_base/data_hash.ml b/src/lib/mina_base/data_hash.ml index cbea18b6fb6..bbe83b00141 100644 --- a/src/lib/mina_base/data_hash.ml +++ b/src/lib/mina_base/data_hash.ml @@ -1,13 +1,3 @@ (* data_hash.ml *) -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - include Data_hash_lib.Data_hash - -[%%else] - -include Data_hash_lib_nonconsensus.Data_hash - -[%%endif] diff --git a/src/lib/mina_base/hash_prefix.ml b/src/lib/mina_base/hash_prefix.ml index f8776658466..9b727d09146 100644 --- a/src/lib/mina_base/hash_prefix.ml +++ b/src/lib/mina_base/hash_prefix.ml @@ -1,13 +1,3 @@ (* hash_prefix.ml *) -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - include Hash_prefix_states - -[%%else] - -include Hash_prefix_states_nonconsensus.Hash_prefix_states - -[%%endif] diff --git a/src/lib/mina_base/import.ml b/src/lib/mina_base/import.ml index b41cffa8fe4..19e3264d7d7 100644 --- a/src/lib/mina_base/import.ml +++ b/src/lib/mina_base/import.ml @@ -2,20 +2,6 @@ [%%import "/src/config.mlh"] -[%%ifndef consensus_mechanism] - -module Signature_lib = Signature_lib_nonconsensus -module Mina_compile_config = - Mina_compile_config_nonconsensus.Mina_compile_config -module Sgn = Sgn_nonconsensus.Sgn -module Currency = Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -module Mina_numbers = Mina_numbers_nonconsensus -module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended -module Hash_prefix_states = Hash_prefix_states_nonconsensus.Hash_prefix_states - -[%%endif] - module Public_key = Signature_lib.Public_key module Private_key = Signature_lib.Private_key module Signature_keypair = Signature_lib.Keypair diff --git a/src/lib/mina_base/ledger_hash0.ml b/src/lib/mina_base/ledger_hash0.ml index 2e92220da52..3f2b8cff3cd 100644 --- a/src/lib/mina_base/ledger_hash0.ml +++ b/src/lib/mina_base/ledger_hash0.ml @@ -1,17 +1,6 @@ -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - include Data_hash.Make_full_size (struct let description = "Ledger hash" diff --git a/src/lib/mina_base/other_fee_payer.ml b/src/lib/mina_base/other_fee_payer.ml index fec2cea71bc..ad822ab2a97 100644 --- a/src/lib/mina_base/other_fee_payer.ml +++ b/src/lib/mina_base/other_fee_payer.ml @@ -1,17 +1,5 @@ -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - open Signature_lib - -[%%else] - -open Signature_lib_nonconsensus - -[%%endif] - module Impl = Pickles.Impls.Step module Payload = struct diff --git a/src/lib/mina_base/payment_payload.ml b/src/lib/mina_base/payment_payload.ml index 55cba502bd8..6afc760e991 100644 --- a/src/lib/mina_base/payment_payload.ml +++ b/src/lib/mina_base/payment_payload.ml @@ -7,15 +7,10 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -open Signature_lib - -[%%else] - -module Currency = Currency_nonconsensus.Currency -open Signature_lib_nonconsensus [%%endif] +open Signature_lib module Amount = Currency.Amount module Fee = Currency.Fee diff --git a/src/lib/mina_base/permissions.ml b/src/lib/mina_base/permissions.ml index 72d342f0059..862c516bab0 100644 --- a/src/lib/mina_base/permissions.ml +++ b/src/lib/mina_base/permissions.ml @@ -5,13 +5,6 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -module Mina_numbers = Mina_numbers - -[%%else] - -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Currency = Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle [%%endif] diff --git a/src/lib/mina_base/protocol_constants_checked.ml b/src/lib/mina_base/protocol_constants_checked.ml index ebf909b7112..e9762effcaf 100644 --- a/src/lib/mina_base/protocol_constants_checked.ml +++ b/src/lib/mina_base/protocol_constants_checked.ml @@ -1,18 +1,7 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick - -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - module T = Mina_numbers.Length (*constants actually required for blockchain snark*) diff --git a/src/lib/mina_base/receipt.ml b/src/lib/mina_base/receipt.ml index 7db04f7f388..2f9a80fc086 100644 --- a/src/lib/mina_base/receipt.ml +++ b/src/lib/mina_base/receipt.ml @@ -4,18 +4,8 @@ open Core_kernel module B58_lib = Base58_check - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - module Elt = struct type t = | Signed_command of Signed_command.Payload.t diff --git a/src/lib/mina_base/receipt.mli b/src/lib/mina_base/receipt.mli index 0091766edb9..4233095fe44 100644 --- a/src/lib/mina_base/receipt.mli +++ b/src/lib/mina_base/receipt.mli @@ -3,18 +3,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - module Elt : sig type t = | Signed_command of Signed_command.Payload.t diff --git a/src/lib/mina_base/side_loaded_verification_key.ml b/src/lib/mina_base/side_loaded_verification_key.ml index f601a277286..ef8194deed5 100644 --- a/src/lib/mina_base/side_loaded_verification_key.ml +++ b/src/lib/mina_base/side_loaded_verification_key.ml @@ -9,7 +9,7 @@ include Pickles.Side_loaded.Verification_key open Core_kernel module G = struct - open Snark_params_nonconsensus + open Snark_params.Tick [%%versioned module Stable = struct diff --git a/src/lib/mina_base/signature.ml b/src/lib/mina_base/signature.ml index 061a9d89ac0..3c1a31cf909 100644 --- a/src/lib/mina_base/signature.ml +++ b/src/lib/mina_base/signature.ml @@ -1,19 +1,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus -module Hex = Hex_nonconsensus.Hex -module Rosetta_coding = Rosetta_coding_nonconsensus - -[%%endif] - module Arg = struct type t = (Field.t, Inner_curve.Scalar.t) Signature_poly.Stable.Latest.t [@@deriving bin_io_unversioned] diff --git a/src/lib/mina_base/signature.mli b/src/lib/mina_base/signature.mli index b7c466b39ff..f55321584d3 100644 --- a/src/lib/mina_base/signature.mli +++ b/src/lib/mina_base/signature.mli @@ -1,17 +1,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - [%%versioned: module Stable : sig module V1 : sig diff --git a/src/lib/mina_base/signed_command.ml b/src/lib/mina_base/signed_command.ml index ea066821ae6..a0a0382c561 100644 --- a/src/lib/mina_base/signed_command.ml +++ b/src/lib/mina_base/signed_command.ml @@ -2,15 +2,6 @@ open Core_kernel open Import - -[%%ifndef consensus_mechanism] - -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Currency = Currency_nonconsensus.Currency -module Quickcheck_lib = Quickcheck_lib_nonconsensus.Quickcheck_lib - -[%%endif] - open Mina_numbers module Fee = Currency.Fee module Payload = Signed_command_payload @@ -370,22 +361,11 @@ module Base58_check = Codable.Make_base58_check (Stable.Latest) [%%define_locally Base58_check.(to_base58_check, of_base58_check, of_base58_check_exn)] -[%%ifdef consensus_mechanism] - let check_signature ?signature_kind ({ payload; signer; signature } : t) = Signature_lib.Schnorr.verify ?signature_kind signature (Snark_params.Tick.Inner_curve.of_affine signer) (to_input payload) -[%%else] - -let check_signature ?signature_kind ({ payload; signer; signature } : t) = - Signature_lib_nonconsensus.Schnorr.verify ?signature_kind signature - (Snark_params_nonconsensus.Inner_curve.of_affine signer) - (to_input payload) - -[%%endif] - let check_valid_keys t = let fee_payer = fee_payer_pk t in let source = source_pk t in diff --git a/src/lib/mina_base/signed_command_intf.ml b/src/lib/mina_base/signed_command_intf.ml index 5f0ef1716e9..169936ab5f7 100644 --- a/src/lib/mina_base/signed_command_intf.ml +++ b/src/lib/mina_base/signed_command_intf.ml @@ -4,19 +4,8 @@ open Import open Core_kernel - -[%%ifdef consensus_mechanism] - -open Mina_numbers open Snark_params.Tick - -[%%else] - -open Mina_numbers_nonconsensus.Mina_numbers -open Snark_params_nonconsensus -module Currency = Currency_nonconsensus.Currency - -[%%endif] +open Mina_numbers module type Gen_intf = sig type t diff --git a/src/lib/mina_base/signed_command_payload.ml b/src/lib/mina_base/signed_command_payload.ml index 44e476df03e..eca1688696a 100644 --- a/src/lib/mina_base/signed_command_payload.ml +++ b/src/lib/mina_base/signed_command_payload.ml @@ -7,18 +7,10 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -open Signature_lib -module Mina_numbers = Mina_numbers - -[%%else] - -open Signature_lib_nonconsensus -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Currency = Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle [%%endif] +open Signature_lib module Memo = Signed_command_memo module Account_nonce = Mina_numbers.Account_nonce module Global_slot = Mina_numbers.Global_slot diff --git a/src/lib/mina_base/signed_command_payload.mli b/src/lib/mina_base/signed_command_payload.mli index c499d9c26df..5ab452b26f8 100644 --- a/src/lib/mina_base/signed_command_payload.mli +++ b/src/lib/mina_base/signed_command_payload.mli @@ -2,20 +2,8 @@ open Core_kernel open Import - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus -module Currency = Currency_nonconsensus.Currency -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - module Body : sig type t = | Payment of Payment_payload.t diff --git a/src/lib/mina_base/snapp_account.ml b/src/lib/mina_base/snapp_account.ml index 5ad665f7cd6..8c3370fec8b 100644 --- a/src/lib/mina_base/snapp_account.ml +++ b/src/lib/mina_base/snapp_account.ml @@ -5,15 +5,6 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -module Mina_numbers = Mina_numbers -module Hash_prefix_states = Hash_prefix_states - -[%%else] - -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Currency = Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -module Hash_prefix_states = Hash_prefix_states_nonconsensus.Hash_prefix_states [%%endif] diff --git a/src/lib/mina_base/snapp_basic.ml b/src/lib/mina_base/snapp_basic.ml index 1f84b477ea1..71cf9903e58 100644 --- a/src/lib/mina_base/snapp_basic.ml +++ b/src/lib/mina_base/snapp_basic.ml @@ -311,6 +311,6 @@ let invalid_public_key : Public_key.Compressed.t Lazy.t = [%%else] -module F = Snark_params_nonconsensus.Field +module F = Snark_params.Tick.Field [%%endif] diff --git a/src/lib/mina_base/snapp_command.ml b/src/lib/mina_base/snapp_command.ml index 11e5f83b441..c58e5582feb 100644 --- a/src/lib/mina_base/snapp_command.ml +++ b/src/lib/mina_base/snapp_command.ml @@ -5,18 +5,10 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -open Signature_lib -module Mina_numbers = Mina_numbers - -[%%else] - -open Signature_lib_nonconsensus -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Currency = Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle [%%endif] +open Signature_lib module Impl = Pickles.Impls.Step open Mina_numbers open Currency diff --git a/src/lib/mina_base/snapp_predicate.ml b/src/lib/mina_base/snapp_predicate.ml index abef7903dd5..9e3bb7bc523 100644 --- a/src/lib/mina_base/snapp_predicate.ml +++ b/src/lib/mina_base/snapp_predicate.ml @@ -5,18 +5,10 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -open Signature_lib -module Mina_numbers = Mina_numbers - -[%%else] - -open Signature_lib_nonconsensus -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Currency = Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle [%%endif] +open Signature_lib module A = Account open Mina_numbers open Currency diff --git a/src/lib/mina_base/snapp_statement.ml b/src/lib/mina_base/snapp_statement.ml index f6bf2e28995..cc837b20b89 100644 --- a/src/lib/mina_base/snapp_statement.ml +++ b/src/lib/mina_base/snapp_statement.ml @@ -5,12 +5,6 @@ open Core_kernel [%%ifdef consensus_mechanism] open Snark_params.Tick -module Mina_numbers = Mina_numbers - -[%%else] - -module Mina_numbers = Mina_numbers_nonconsensus.Mina_numbers -module Random_oracle = Random_oracle_nonconsensus.Random_oracle [%%endif] diff --git a/src/lib/mina_base/stake_delegation.ml b/src/lib/mina_base/stake_delegation.ml index c12fc4729bb..4db303e3562 100644 --- a/src/lib/mina_base/stake_delegation.ml +++ b/src/lib/mina_base/stake_delegation.ml @@ -1,20 +1,8 @@ (* stake_delegation.ml *) -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - open Signature_lib -[%%else] - -open Signature_lib_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - [%%versioned module Stable = struct module V1 = struct diff --git a/src/lib/mina_base/state_body_hash.ml b/src/lib/mina_base/state_body_hash.ml index 2d213ec99f4..dcd6594b7be 100644 --- a/src/lib/mina_base/state_body_hash.ml +++ b/src/lib/mina_base/state_body_hash.ml @@ -1,18 +1,6 @@ -[%%import "/src/config.mlh"] - open Core - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - include Data_hash.Make_full_size (struct let description = "State body hash" diff --git a/src/lib/mina_base/state_body_hash.mli b/src/lib/mina_base/state_body_hash.mli index b71c4fcbd95..e70b3a6b160 100644 --- a/src/lib/mina_base/state_body_hash.mli +++ b/src/lib/mina_base/state_body_hash.mli @@ -1,17 +1,6 @@ -[%%import "/src/config.mlh"] - open Core - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - include Data_hash.Full_size [%%versioned: diff --git a/src/lib/mina_base/state_hash.ml b/src/lib/mina_base/state_hash.ml index 04ce93839d4..57955aade89 100644 --- a/src/lib/mina_base/state_hash.ml +++ b/src/lib/mina_base/state_hash.ml @@ -1,13 +1,3 @@ (* state_hash.ml *) -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - include Data_hash_lib.State_hash - -[%%else] - -include Data_hash_lib_nonconsensus.State_hash - -[%%endif] diff --git a/src/lib/mina_base/token_id.mli b/src/lib/mina_base/token_id.mli index a9655f25e29..2b0ee0258a6 100644 --- a/src/lib/mina_base/token_id.mli +++ b/src/lib/mina_base/token_id.mli @@ -1,15 +1,11 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params open Tick -[%%else] +[%%ifndef consensus_mechanism] -open Snark_params_nonconsensus open Import [%%endif] diff --git a/src/lib/mina_base/transaction_union_payload.ml b/src/lib/mina_base/transaction_union_payload.ml index 574935e6862..28d45d27271 100644 --- a/src/lib/mina_base/transaction_union_payload.ml +++ b/src/lib/mina_base/transaction_union_payload.ml @@ -3,22 +3,15 @@ [%%import "/src/config.mlh"] open Core_kernel +open Currency [%%ifdef consensus_mechanism] open Snark_params.Tick -open Signature_lib -open Currency - -[%%else] - -open Signature_lib_nonconsensus -module Currency = Currency_nonconsensus.Currency -open Currency_nonconsensus.Currency -module Random_oracle = Random_oracle_nonconsensus.Random_oracle [%%endif] +open Signature_lib module Tag = Transaction_union_tag module Body = struct diff --git a/src/lib/mina_compile_config/mina_compile_config.ml b/src/lib/mina_compile_config/mina_compile_config.ml index 4244c1d7690..0fd03ab90ad 100644 --- a/src/lib/mina_compile_config/mina_compile_config.ml +++ b/src/lib/mina_compile_config/mina_compile_config.ml @@ -1,11 +1,5 @@ [%%import "/src/config.mlh"] -[%%ifndef consensus_mechanism] - -module Currency = Currency_nonconsensus.Currency - -[%%endif] - (** This file consists of compile-time constants that are not in Genesis_constants. This file includes all of the constants defined at compile-time for both diff --git a/src/lib/mina_graphql/mina_graphql.ml b/src/lib/mina_graphql/mina_graphql.ml index c24cea5bfa6..aa73f84de6a 100644 --- a/src/lib/mina_graphql/mina_graphql.ml +++ b/src/lib/mina_graphql/mina_graphql.ml @@ -2709,6 +2709,10 @@ module Mutations = struct ] ~resolve:(fun { ctx = coda; _ } () privkey_path password -> let open Deferred.Result.Let_syntax in + (* the Keypair.read zeroes the password, so copy for use in import step below *) + let saved_password = + Lazy.return (Deferred.return (Bytes.of_string password)) + in let password = Lazy.return (Deferred.return (Bytes.of_string password)) in @@ -2723,7 +2727,8 @@ module Mutations = struct return (pk, true) | None -> let%map.Async.Deferred pk = - Secrets.Wallets.import_keypair wallets keypair ~password + Secrets.Wallets.import_keypair wallets keypair + ~password:saved_password in Ok (pk, false)) diff --git a/src/lib/mina_numbers/intf.ml b/src/lib/mina_numbers/intf.ml index 2b3555a9078..a4024a9400c 100644 --- a/src/lib/mina_numbers/intf.ml +++ b/src/lib/mina_numbers/intf.ml @@ -4,19 +4,8 @@ open Core_kernel open Fold_lib open Tuple_lib open Unsigned - -[%%ifdef consensus_mechanism] - open Snark_bits -[%%else] - -open Snark_bits_nonconsensus -module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - module type S_unchecked = sig type t [@@deriving sexp, compare, hash, yojson] diff --git a/src/lib/mina_numbers/nat.ml b/src/lib/mina_numbers/nat.ml index 4d86f8ad652..b3fda75cca5 100644 --- a/src/lib/mina_numbers/nat.ml +++ b/src/lib/mina_numbers/nat.ml @@ -4,11 +4,10 @@ open Core_kernel open Fold_lib include Intf module Intf = Intf +open Snark_bits [%%ifdef consensus_mechanism] -open Snark_bits - let zero_checked = Snarky_integer.Integer.constant ~m:Snark_params.Tick.m Bigint.zero @@ -113,10 +112,6 @@ struct let zero = zero_checked end -[%%else] - -open Snark_bits_nonconsensus - [%%endif] module Make (N : sig diff --git a/src/lib/mina_transition/external_transition.ml b/src/lib/mina_transition/external_transition.ml index 0d5297ce842..47b30f57f91 100644 --- a/src/lib/mina_transition/external_transition.ml +++ b/src/lib/mina_transition/external_transition.ml @@ -539,8 +539,6 @@ module Validation = struct , frontier_dependencies , staged_ledger_diff , protocol_versions ) - | _ -> - failwith "why can't this be refuted?" let set_valid_proof : ( 'time_received @@ -573,8 +571,6 @@ module Validation = struct , frontier_dependencies , staged_ledger_diff , protocol_versions ) - | _ -> - failwith "why can't this be refuted?" let set_valid_genesis_state : ( 'time_received @@ -607,8 +603,6 @@ module Validation = struct , frontier_dependencies , staged_ledger_diff , protocol_versions ) - | _ -> - failwith "why can't this be refuted?" let set_valid_delta_transition_chain : ( 'time_received @@ -646,8 +640,6 @@ module Validation = struct , frontier_dependencies , staged_ledger_diff , protocol_versions ) - | _ -> - failwith "why can't this be refuted?" let set_valid_frontier_dependencies : ( 'time_received @@ -680,8 +672,6 @@ module Validation = struct , (`Frontier_dependencies, Truth.True ()) , staged_ledger_diff , protocol_versions ) - | _ -> - failwith "why can't this be refuted?" let set_valid_staged_ledger_diff : ( 'time_received @@ -714,8 +704,6 @@ module Validation = struct , frontier_dependencies , (`Staged_ledger_diff, Truth.True ()) , protocol_versions ) - | _ -> - failwith "why can't this be refuted?" let set_valid_protocol_versions : ( 'time_received @@ -748,8 +736,6 @@ module Validation = struct , frontier_dependencies , staged_ledger_diff , (`Protocol_versions, Truth.True ()) ) - | _ -> - failwith "why can't this be refuted?" end end diff --git a/src/lib/node_error_service/dune b/src/lib/node_error_service/dune new file mode 100644 index 00000000000..28bd0cf6654 --- /dev/null +++ b/src/lib/node_error_service/dune @@ -0,0 +1,8 @@ +(library + (name node_error_service) + (public_name node_error_service) + (inline_tests) + (libraries core mina_lib core_kernel async cohttp-async logger transition_frontier pipe_lib sync_status mina_incremental mina_networking mina_base network_peer) + (preprocess (pps ppx_jane ppx_deriving.std ppx_coda ppx_version)) + (instrumentation (backend bisect_ppx)) + (synopsis "Node error service library for collection error report from nodes")) \ No newline at end of file diff --git a/src/lib/node_error_service/node_error_service.ml b/src/lib/node_error_service/node_error_service.ml new file mode 100644 index 00000000000..918d427b508 --- /dev/null +++ b/src/lib/node_error_service/node_error_service.ml @@ -0,0 +1,144 @@ +open Async +open Core +open Pipe_lib +open Signature_lib + +type node_error_data = + { peer_id : string + ; ip_address : string + ; public_key : Public_key.Compressed.t option + ; git_branch : string + ; commit_hash : string + ; chain_id : string + ; contact_info : string option + ; timestamp : string + ; id : string + ; error : string + ; catchup_job_states : Transition_frontier.Full_catchup_tree.job_states option + ; sync_status : Sync_status.t + ; block_height_at_best_tip : int option + ; max_observed_block_height : int + ; max_observed_unvalidated_block_height : int + ; uptime_of_node : string + } +[@@deriving to_yojson] + +let send_node_error_data ~logger ~url node_error_data = + let node_error_json = node_error_data_to_yojson node_error_data in + let json = `Assoc [ ("data", node_error_json) ] in + let headers = + Cohttp.Header.of_list [ ("Content-Type", "application/json") ] + in + match%map + Async.try_with (fun () -> + Cohttp_async.Client.post ~headers + ~body:(Yojson.Safe.to_string json |> Cohttp_async.Body.of_string) + url) + with + | Ok ({ status; _ }, body) -> + let metadata = + [ ("data", node_error_json); ("url", `String (Uri.to_string url)) ] + in + if Cohttp.Code.code_of_status status = 200 then + [%log info] "Sent node error data to URL $url" ~metadata + else + let extra_metadata = + match body with + | `String s -> + [ ("error", `String s) ] + | `Strings ss -> + [ ("error", `List (List.map ss ~f:(fun s -> `String s))) ] + | `Empty | `Pipe _ -> + [] + in + [%log error] "Failed to send node error data to URL $url" + ~metadata:(metadata @ extra_metadata) + | Error e -> + [%log error] "Failed to send node error data to URL $url" + ~metadata: + [ ("error", `String (Exn.to_string e)) + ; ("url", `String (Uri.to_string url)) + ] + +let send_report ~logger ~node_error_url ~mina_ref ~exn ~contact_info = + match !mina_ref with + | None -> + [%log info] "Crashed before mina instance was created." ; + Deferred.unit + | Some mina -> + let config = Mina_lib.config mina in + let addrs_and_ports = config.gossip_net_params.addrs_and_ports in + let peer_id = + (Node_addrs_and_ports.to_peer_exn addrs_and_ports).peer_id + in + let ip_address = + Node_addrs_and_ports.external_ip addrs_and_ports + |> Core.Unix.Inet_addr.to_string + in + let commit_hash = Mina_version.commit_id in + let git_branch = Mina_version.branch in + let chain_id = config.chain_id in + let public_key = + let key_list = + Mina_lib.block_production_pubkeys mina + |> Public_key.Compressed.Set.to_list + in + if List.is_empty key_list then None else Some (List.hd_exn key_list) + in + let timestamp = Rfc3339_time.get_rfc3339_time () in + let id = Uuid_unix.create () |> Uuid.to_string in + let error = Exn.to_string exn in + + let catchup_job_states = + match + Broadcast_pipe.Reader.peek @@ Mina_lib.transition_frontier mina + with + | None -> + None + | Some tf -> ( + match Transition_frontier.catchup_tree tf with + | Full catchup_tree -> + Some + (Transition_frontier.Full_catchup_tree.to_node_status_report + catchup_tree) + | _ -> + None ) + in + let block_height_at_best_tip = + Mina_lib.best_tip mina + |> Participating_state.map + ~f:Transition_frontier.Breadcrumb.blockchain_length + |> Participating_state.map ~f:Unsigned.UInt32.to_int + |> Participating_state.active + in + + let sync_status = + Mina_lib.sync_status mina |> Mina_incremental.Status.Observer.value_exn + in + send_node_error_data ~logger + ~url:(Uri.of_string node_error_url) + { peer_id + ; ip_address + ; public_key + ; git_branch + ; commit_hash + ; chain_id + ; contact_info + ; timestamp + ; id + ; error + ; catchup_job_states + ; sync_status + ; block_height_at_best_tip + ; max_observed_block_height = + !Mina_metrics.Transition_frontier.max_blocklength_observed + ; max_observed_unvalidated_block_height = + !Mina_metrics.Transition_frontier + .max_unvalidated_blocklength_observed + ; uptime_of_node = + Time.( + Span.to_string_hum + @@ Time.diff (now ()) + (Time_ns.to_time_float_round_nearest_microsecond + Mina_lib.daemon_start_time)) + } diff --git a/src/lib/node_status_service/node_status_service.ml b/src/lib/node_status_service/node_status_service.ml index d02c1a49894..c941c785246 100644 --- a/src/lib/node_status_service/node_status_service.ml +++ b/src/lib/node_status_service/node_status_service.ml @@ -2,17 +2,6 @@ open Async open Core open Pipe_lib -type catchup_job_states = - { finished : int - ; failed : int - ; to_download : int - ; to_initial_validate : int - ; wait_for_parent : int - ; to_verify : int - ; to_build_breadcrumb : int - } -[@@deriving to_yojson] - type rpc_count = { get_some_initial_peers : int ; get_staged_ledger_aux_and_pending_coinbases_at_hash : int @@ -53,7 +42,7 @@ type node_status_data = { block_height_at_best_tip : int ; max_observed_block_height : int ; max_observed_unvalidated_block_height : int - ; catchup_job_states : catchup_job_states option + ; catchup_job_states : Transition_frontier.Full_catchup_tree.job_states option ; sync_status : Sync_status.t ; libp2p_input_bandwidth : float ; libp2p_output_bandwidth : float @@ -167,40 +156,9 @@ let start ~logger ~node_status_url ~transition_frontier ~sync_status ~network let catchup_job_states = match Transition_frontier.catchup_tree tf with | Full catchup_tree -> - let catchup_states = - Transition_frontier.Full_catchup_tree.to_node_status_report - catchup_tree - in - let init = - { finished = 0 - ; failed = 0 - ; to_download = 0 - ; to_initial_validate = 0 - ; to_verify = 0 - ; wait_for_parent = 0 - ; to_build_breadcrumb = 0 - } - in Some - (List.fold catchup_states ~init ~f:(fun acc (state, n) -> - match state with - | Transition_frontier.Full_catchup_tree.Node.State.Enum - .Finished -> - { acc with finished = n } - | Failed -> - { acc with failed = n } - | To_download -> - { acc with to_download = n } - | To_initial_validate -> - { acc with to_initial_validate = n } - | To_verify -> - { acc with to_verify = n } - | Wait_for_parent -> - { acc with wait_for_parent = n } - | To_build_breadcrumb -> - { acc with to_build_breadcrumb = n } - | Root -> - acc)) + (Transition_frontier.Full_catchup_tree.to_node_status_report + catchup_tree) | _ -> None in diff --git a/src/lib/non_zero_curve_point/non_zero_curve_point.ml b/src/lib/non_zero_curve_point/non_zero_curve_point.ml index 9f07c10c7de..e145c466f8d 100644 --- a/src/lib/non_zero_curve_point/non_zero_curve_point.ml +++ b/src/lib/non_zero_curve_point/non_zero_curve_point.ml @@ -1,21 +1,16 @@ [%%import "/src/config.mlh"] open Core_kernel +open Snark_params.Tick [%%ifdef consensus_mechanism] -open Snark_params.Tick - let parity y = Bigint.(test_bit (of_field y) 0) [%%else] -open Snark_params_nonconsensus - let parity y = Field.parity y -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - [%%endif] let gen_uncompressed = diff --git a/src/lib/outside_hash_image/dune b/src/lib/outside_hash_image/dune index d8aa20cec42..108229a7e99 100644 --- a/src/lib/outside_hash_image/dune +++ b/src/lib/outside_hash_image/dune @@ -3,6 +3,5 @@ (public_name outside_hash_image) (libraries snark_params) (preprocessor_deps ../../config.mlh) - (preprocess - (pps ppx_version ppx_optcomp)) + (preprocess (pps ppx_version)) (instrumentation (backend bisect_ppx))) diff --git a/src/lib/outside_hash_image/outside_hash_image.ml b/src/lib/outside_hash_image/outside_hash_image.ml index 271f62af22c..ed9aceb4f0d 100644 --- a/src/lib/outside_hash_image/outside_hash_image.ml +++ b/src/lib/outside_hash_image/outside_hash_image.ml @@ -1,13 +1,3 @@ (* outside_hash_image.ml *) -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - let t = Snark_params.Tick.Field.zero - -[%%else] - -let t = Snark_params_nonconsensus.Field.zero - -[%%endif] diff --git a/src/lib/quickcheck_lib/dune b/src/lib/quickcheck_lib/dune index 4fdb34dbfde..123b3f92473 100644 --- a/src/lib/quickcheck_lib/dune +++ b/src/lib/quickcheck_lib/dune @@ -5,4 +5,4 @@ (inline_tests) (preprocessor_deps ../../config.mlh) (instrumentation (backend bisect_ppx)) - (preprocess (pps ppx_version ppx_optcomp ppx_let ppx_inline_test ppx_custom_printf))) + (preprocess (pps ppx_version ppx_let ppx_inline_test ppx_custom_printf))) diff --git a/src/lib/quickcheck_lib/quickcheck_lib.ml b/src/lib/quickcheck_lib/quickcheck_lib.ml index 8674cea008f..5e1761802aa 100644 --- a/src/lib/quickcheck_lib/quickcheck_lib.ml +++ b/src/lib/quickcheck_lib/quickcheck_lib.ml @@ -1,17 +1,9 @@ (* quickcheck_lib.ml *) -[%%import "/src/config.mlh"] - open Core_kernel open Quickcheck.Generator open Quickcheck.Let_syntax -[%%ifndef consensus_mechanism] - -module Currency = Currency_nonconsensus.Currency - -[%%endif] - let of_array array = Quickcheck.Generator.of_list @@ Array.to_list array let rec map_gens ls ~f = diff --git a/src/lib/quickcheck_lib/quickcheck_lib.mli b/src/lib/quickcheck_lib/quickcheck_lib.mli index eea029f3362..01e6463a0e6 100644 --- a/src/lib/quickcheck_lib/quickcheck_lib.mli +++ b/src/lib/quickcheck_lib/quickcheck_lib.mli @@ -1,16 +1,8 @@ (* quickcheck_lib.mli *) -[%%import "/src/config.mlh"] - open Core_kernel open Quickcheck -[%%ifndef consensus_mechanism] - -module Currency = Currency_nonconsensus.Currency - -[%%endif] - (** [of_array array] selects a random element from [array] to select an element *) val of_array : 'a array -> 'a Generator.t diff --git a/src/lib/random_oracle/random_oracle.ml b/src/lib/random_oracle/random_oracle.ml index 2aafe942861..3343c7f3685 100644 --- a/src/lib/random_oracle/random_oracle.ml +++ b/src/lib/random_oracle/random_oracle.ml @@ -8,7 +8,7 @@ open Pickles.Impls.Step.Internal_Basic [%%else] -open Snark_params_nonconsensus +open Snark_params.Tick [%%endif] diff --git a/src/lib/random_oracle/random_oracle.mli b/src/lib/random_oracle/random_oracle.mli index a7d9dd0597b..d2bb3996b63 100644 --- a/src/lib/random_oracle/random_oracle.mli +++ b/src/lib/random_oracle/random_oracle.mli @@ -6,7 +6,7 @@ open Pickles.Impls.Step.Internal_Basic [%%else] -open Snark_params_nonconsensus +open Snark_params.Tick [%%endif] diff --git a/src/lib/rosetta_coding/coding.ml b/src/lib/rosetta_coding/coding.ml index e4a94953ea7..d69a54e0737 100644 --- a/src/lib/rosetta_coding/coding.ml +++ b/src/lib/rosetta_coding/coding.ml @@ -3,21 +3,10 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - module Field = Snark_params.Tick.Field module Scalar = Snark_params.Tick.Inner_curve.Scalar open Signature_lib -[%%else] - -module Field = Snark_params_nonconsensus.Field -module Scalar = Snark_params_nonconsensus.Inner_curve.Scalar -open Signature_lib_nonconsensus - -[%%endif] - (* see RFC 0038, section "marshal-keys" for a specification *) let hex_char_to_bits4 = function diff --git a/src/lib/rosetta_lib/dune b/src/lib/rosetta_lib/dune index 08b8bc7a482..cb904501747 100644 --- a/src/lib/rosetta_lib/dune +++ b/src/lib/rosetta_lib/dune @@ -7,7 +7,7 @@ currency) (preprocessor_deps ../../config.mlh) (instrumentation (backend bisect_ppx)) - (preprocess (pps ppx_coda ppx_version ppx_optcomp ppx_assert ppx_let ppx_sexp_conv + (preprocess (pps ppx_coda ppx_version ppx_assert ppx_let ppx_sexp_conv ppx_compare ppx_deriving.std ppx_custom_printf ppx_deriving_yojson ppx_inline_test)) (synopsis "Rosetta-related support code")) diff --git a/src/lib/rosetta_lib/errors.ml b/src/lib/rosetta_lib/errors.ml index c6f3cf01c6a..7c3c7eacdb1 100644 --- a/src/lib/rosetta_lib/errors.ml +++ b/src/lib/rosetta_lib/errors.ml @@ -1,16 +1,6 @@ -[%%import "/src/config.mlh"] - open Core_kernel open Async_kernel -[%%ifndef consensus_mechanism] - -module Currency = Currency_nonconsensus.Currency -module Mina_compile_config = - Mina_compile_config_nonconsensus.Mina_compile_config - -[%%endif] - module Partial_reason = struct type t = | Length_mismatch diff --git a/src/lib/rosetta_lib/test/test_encodings.ml b/src/lib/rosetta_lib/test/test_encodings.ml index 5e18864d42e..11e959153b2 100644 --- a/src/lib/rosetta_lib/test/test_encodings.ml +++ b/src/lib/rosetta_lib/test/test_encodings.ml @@ -1,21 +1,9 @@ (* test_encodings.ml -- print out Rosetta encodings *) -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - open Signature_lib open Rosetta_coding -[%%else] - -open Signature_lib_nonconsensus -open Rosetta_coding_nonconsensus - -[%%endif] - let pk1 = Public_key.Compressed.of_base58_check_exn "B62qrcFstkpqXww1EkSGrqMCwCNho86kuqBd4FrAAUsPxNKdiPzAUsy" diff --git a/src/lib/rosetta_lib/transaction.ml b/src/lib/rosetta_lib/transaction.ml index de76473c37f..cf07692969d 100644 --- a/src/lib/rosetta_lib/transaction.ml +++ b/src/lib/rosetta_lib/transaction.ml @@ -1,21 +1,5 @@ -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifdef consensus_mechanism] - module Field = Snark_params.Tick.Field - -[%%else] - -module Field = Snark_params_nonconsensus.Field -module Mina_base = Mina_base_nonconsensus -module Hex = Hex_nonconsensus.Hex -module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended -module Signature_lib = Signature_lib_nonconsensus - -[%%endif] - module Token_id = Mina_base.Token_id module Unsigned = struct diff --git a/src/lib/rosetta_lib/user_command_info.ml b/src/lib/rosetta_lib/user_command_info.ml index 91ebc80af79..bbc58094e48 100644 --- a/src/lib/rosetta_lib/user_command_info.ml +++ b/src/lib/rosetta_lib/user_command_info.ml @@ -1,17 +1,4 @@ -[%%import "/src/config.mlh"] - open Core_kernel - -[%%ifndef consensus_mechanism] - -module Mina_base = Mina_base_nonconsensus -module Currency = Currency_nonconsensus.Currency -module Signature_lib = Signature_lib_nonconsensus -module Unsigned_extended = Unsigned_extended_nonconsensus.Unsigned_extended -module Mina_numbers = Mina_numbers_nonconsensus - -[%%endif] - module Fee_currency = Currency.Fee module Amount_currency = Currency.Amount open Rosetta_models diff --git a/src/lib/sgn/sgn.ml b/src/lib/sgn/sgn.ml index 87843562f95..d20d4661b47 100644 --- a/src/lib/sgn/sgn.ml +++ b/src/lib/sgn/sgn.ml @@ -1,17 +1,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - [%%versioned module Stable = struct module V1 = struct diff --git a/src/lib/sgn/sgn.mli b/src/lib/sgn/sgn.mli index 22192463230..a8ebf72af14 100644 --- a/src/lib/sgn/sgn.mli +++ b/src/lib/sgn/sgn.mli @@ -1,17 +1,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - [%%versioned: module Stable : sig module V1 : sig diff --git a/src/lib/signature_lib/private_key.ml b/src/lib/signature_lib/private_key.ml index a89f3fd1016..4bd67f05b9f 100644 --- a/src/lib/signature_lib/private_key.ml +++ b/src/lib/signature_lib/private_key.ml @@ -1,17 +1,8 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params.Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - [%%versioned_asserted module Stable = struct module V1 = struct diff --git a/src/lib/signature_lib/public_key.ml b/src/lib/signature_lib/public_key.ml index ad41a2ee171..d128c4adb08 100644 --- a/src/lib/signature_lib/public_key.ml +++ b/src/lib/signature_lib/public_key.ml @@ -1,20 +1,6 @@ (* public_key.ml *) -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - include Non_zero_curve_point module Inner_curve = Snark_params.Tick.Inner_curve let of_private_key_exn p = of_inner_curve_exn Inner_curve.(scale one p) - -[%%else] - -include Non_zero_curve_point_nonconsensus.Non_zero_curve_point - -module Inner_curve = Snark_params_nonconsensus.Inner_curve - -let of_private_key_exn p = of_inner_curve_exn Inner_curve.(scale one p) - -[%%endif] diff --git a/src/lib/signature_lib/public_key.mli b/src/lib/signature_lib/public_key.mli index d1a0df35b8e..b438a76bab0 100644 --- a/src/lib/signature_lib/public_key.mli +++ b/src/lib/signature_lib/public_key.mli @@ -1,19 +1,9 @@ [%%import "/src/config.mlh"] open Core_kernel - -[%%ifdef consensus_mechanism] - open Snark_params open Tick -[%%else] - -open Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle - -[%%endif] - type t = Field.t * Field.t [@@deriving sexp, hash] include Codable.S with type t := t diff --git a/src/lib/signature_lib/schnorr.ml b/src/lib/signature_lib/schnorr.ml index 677b3792814..1ff6f568f5f 100644 --- a/src/lib/signature_lib/schnorr.ml +++ b/src/lib/signature_lib/schnorr.ml @@ -331,8 +331,6 @@ module Make end end -open Snark_params - [%%else] (* nonconsensus version of the functor; yes, there's some repeated code, @@ -340,7 +338,7 @@ open Snark_params *) module type S = sig - open Snark_params_nonconsensus + open Snark_params.Tick type curve @@ -379,7 +377,7 @@ module type S = sig end module Make - (Impl : module type of Snark_params_nonconsensus) (Curve : sig + (Impl : module type of Snark_params.Tick) (Curve : sig open Impl module Scalar : sig @@ -487,12 +485,10 @@ module Make false end -module Tick = Snark_params_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -open Hash_prefix_states_nonconsensus - [%%endif] +open Snark_params + module Message = struct open Tick diff --git a/src/lib/string_sign/string_sign.ml b/src/lib/string_sign/string_sign.ml index 205d2e6d455..d98aae67b2e 100644 --- a/src/lib/string_sign/string_sign.ml +++ b/src/lib/string_sign/string_sign.ml @@ -1,21 +1,8 @@ (* string_sign.ml -- signatures for strings *) -[%%import "/src/config.mlh"] - -[%%ifdef consensus_mechanism] - module Inner_curve = Snark_params.Tick.Inner_curve open Signature_lib -[%%else] - -module Inner_curve = Snark_params_nonconsensus.Inner_curve -module Signature_lib = Signature_lib_nonconsensus -module Random_oracle = Random_oracle_nonconsensus.Random_oracle -open Signature_lib - -[%%endif] - let nybble_bits = function | 0x0 -> [ false; false; false; false ] diff --git a/src/lib/transition_frontier/full_catchup_tree.ml b/src/lib/transition_frontier/full_catchup_tree.ml index 5b958a6acd8..e4833c26bee 100644 --- a/src/lib/transition_frontier/full_catchup_tree.ml +++ b/src/lib/transition_frontier/full_catchup_tree.ml @@ -174,10 +174,49 @@ let to_yojson = ( state , (State_hash.Set.length hashes, State_hash.Set.to_list hashes) ) ) +type job_states = + { finished : int + ; failed : int + ; to_download : int + ; to_initial_validate : int + ; wait_for_parent : int + ; to_verify : int + ; to_build_breadcrumb : int + } +[@@deriving to_yojson] + let to_node_status_report = fun (t : t) -> - List.map (Hashtbl.to_alist t.states) ~f:(fun (state, hashes) -> - ( state, State_hash.Set.length hashes)) + let init = + { finished = 0 + ; failed = 0 + ; to_download = 0 + ; to_initial_validate = 0 + ; to_verify = 0 + ; wait_for_parent = 0 + ; to_build_breadcrumb = 0 + } + in + List.fold (Hashtbl.to_alist t.states) ~init ~f:(fun acc (state, hashes) -> + let n = Set.length hashes in + match state with + | Finished -> + { acc with finished = n } + | Failed -> + { acc with failed = n } + | To_download -> + { acc with to_download = n } + | To_initial_validate -> + { acc with to_initial_validate = n } + | To_verify -> + { acc with to_verify = n } + | Wait_for_parent -> + { acc with wait_for_parent = n } + | To_build_breadcrumb -> + { acc with to_build_breadcrumb = n } + | Root -> + acc ) + let max_catchup_chain_length (t : t) = (* Find the longest directed path *) diff --git a/src/lib/transition_handler/processor.ml b/src/lib/transition_handler/processor.ml index bf91535c4f8..cb08126ef9d 100644 --- a/src/lib/transition_handler/processor.ml +++ b/src/lib/transition_handler/processor.ml @@ -157,12 +157,7 @@ let process_transition ~logger ~trust_system ~verifier ~frontier in Catchup_scheduler.watch catchup_scheduler ~timeout_duration ~cached_transition:cached_initially_validated_transition ; - return (Error ()) - | _ -> - failwith - "This is impossible since the transition just passed \ - initial_validation so delta_transition_chain_proof must be \ - true" ) + return (Error ()) ) in (* TODO: only access parent in transition frontier once (already done in call to validate dependencies) #2485 *) let parent_hash = diff --git a/src/lib/truth/truth.ml b/src/lib/truth/truth.ml index feaf595c54d..46f72851f3c 100644 --- a/src/lib/truth/truth.ml +++ b/src/lib/truth/truth.ml @@ -1,11 +1,11 @@ include Core_kernel module True = struct - type t = unit + type t = True end module False = struct - type t = unit + type t = False end type true_ = True.t diff --git a/src/lib/truth/truth.mli b/src/lib/truth/truth.mli index f11fd1fc74e..abbf2abd816 100644 --- a/src/lib/truth/truth.mli +++ b/src/lib/truth/truth.mli @@ -1,9 +1,9 @@ module True : sig - type t + type t = True end module False : sig - type t + type t = False end type true_ = True.t diff --git a/src/lib/unsigned_extended/dune b/src/lib/unsigned_extended/dune index 8311a498521..5768e6f6ca3 100644 --- a/src/lib/unsigned_extended/dune +++ b/src/lib/unsigned_extended/dune @@ -6,6 +6,6 @@ (libraries core_kernel integers snark_params ppx_dhall_type ppx_version.runtime) (preprocessor_deps ../../config.mlh) (preprocess - (pps ppx_coda ppx_version ppx_optcomp ppx_bin_prot ppx_sexp_conv ppx_compare ppx_hash ppx_inline_test ppx_deriving.std ppx_deriving_yojson)) + (pps ppx_coda ppx_version ppx_bin_prot ppx_sexp_conv ppx_compare ppx_hash ppx_inline_test ppx_deriving.std ppx_deriving_yojson)) (instrumentation (backend bisect_ppx)) (synopsis "Unsigned integer functions")) diff --git a/src/lib/unsigned_extended/unsigned_extended.ml b/src/lib/unsigned_extended/unsigned_extended.ml index e8a69527610..814bc7bdce3 100644 --- a/src/lib/unsigned_extended/unsigned_extended.ml +++ b/src/lib/unsigned_extended/unsigned_extended.ml @@ -1,21 +1,10 @@ (* unsigned_extended.ml *) -[%%import "/src/config.mlh"] - open Core_kernel include Intf - -[%%ifdef consensus_mechanism] - open Snark_params open Tick -[%%else] - -open Snark_params_nonconsensus - -[%%endif] - module type Unsigned_intf = Unsigned.S module Extend diff --git a/src/outside_hash_image_nonconsensus.opam b/src/node_error_service.opam similarity index 100% rename from src/outside_hash_image_nonconsensus.opam rename to src/node_error_service.opam diff --git a/src/nonconsensus/currency/dune b/src/nonconsensus/currency/dune index 5c74005be3d..19f4304ac4e 100644 --- a/src/nonconsensus/currency/dune +++ b/src/nonconsensus/currency/dune @@ -1,5 +1,5 @@ (library - (name currency_nonconsensus) + (name currency) (public_name currency_nonconsensus) (library_flags -linkall) (inline_tests) diff --git a/src/currency_nonconsensus.opam b/src/nonconsensus/currency_nonconsensus.opam similarity index 100% rename from src/currency_nonconsensus.opam rename to src/nonconsensus/currency_nonconsensus.opam diff --git a/src/nonconsensus/data_hash_lib/dune b/src/nonconsensus/data_hash_lib/dune index ae15a92150f..4c2dd86dcfd 100644 --- a/src/nonconsensus/data_hash_lib/dune +++ b/src/nonconsensus/data_hash_lib/dune @@ -1,5 +1,5 @@ (library - (name data_hash_lib_nonconsensus) + (name data_hash_lib) (public_name data_hash_lib_nonconsensus) (inline_tests) (library_flags -linkall) diff --git a/src/data_hash_lib_nonconsensus.opam b/src/nonconsensus/data_hash_lib_nonconsensus.opam similarity index 100% rename from src/data_hash_lib_nonconsensus.opam rename to src/nonconsensus/data_hash_lib_nonconsensus.opam diff --git a/src/nonconsensus/dune-project b/src/nonconsensus/dune-project new file mode 100644 index 00000000000..45acd3f0884 --- /dev/null +++ b/src/nonconsensus/dune-project @@ -0,0 +1 @@ +(lang dune 2.7) diff --git a/src/nonconsensus/hash_prefix_states/dune b/src/nonconsensus/hash_prefix_states/dune index bc9d9484bdf..2b0dd8e7b01 100644 --- a/src/nonconsensus/hash_prefix_states/dune +++ b/src/nonconsensus/hash_prefix_states/dune @@ -1,5 +1,5 @@ (library - (name hash_prefix_states_nonconsensus) + (name hash_prefix_states) (public_name hash_prefix_states_nonconsensus) (library_flags -linkall) (inline_tests) diff --git a/src/hash_prefix_states_nonconsensus.opam b/src/nonconsensus/hash_prefix_states_nonconsensus.opam similarity index 100% rename from src/hash_prefix_states_nonconsensus.opam rename to src/nonconsensus/hash_prefix_states_nonconsensus.opam diff --git a/src/nonconsensus/hex/dune b/src/nonconsensus/hex/dune index edad9740d0a..44cbf134f12 100644 --- a/src/nonconsensus/hex/dune +++ b/src/nonconsensus/hex/dune @@ -1,5 +1,5 @@ (library - (name hex_nonconsensus) + (name hex) (public_name hex_nonconsensus) (inline_tests) (instrumentation (backend bisect_ppx)) diff --git a/src/hex_nonconsensus.opam b/src/nonconsensus/hex_nonconsensus.opam similarity index 100% rename from src/hex_nonconsensus.opam rename to src/nonconsensus/hex_nonconsensus.opam diff --git a/src/nonconsensus/mina_base/dune b/src/nonconsensus/mina_base/dune index c6901905e22..313d37c2e33 100644 --- a/src/nonconsensus/mina_base/dune +++ b/src/nonconsensus/mina_base/dune @@ -1,5 +1,5 @@ (library - (name mina_base_nonconsensus) + (name mina_base) (public_name mina_base_nonconsensus) (inline_tests) (library_flags -linkall) diff --git a/src/mina_base_nonconsensus.opam b/src/nonconsensus/mina_base_nonconsensus.opam similarity index 100% rename from src/mina_base_nonconsensus.opam rename to src/nonconsensus/mina_base_nonconsensus.opam diff --git a/src/nonconsensus/mina_compile_config/dune b/src/nonconsensus/mina_compile_config/dune index ba53117b6fb..a0e44f4c48a 100644 --- a/src/nonconsensus/mina_compile_config/dune +++ b/src/nonconsensus/mina_compile_config/dune @@ -1,5 +1,5 @@ (library - (name mina_compile_config_nonconsensus) + (name mina_compile_config) (public_name mina_compile_config_nonconsensus) (libraries currency_nonconsensus) (preprocessor_deps ../../config.mlh) diff --git a/src/mina_compile_config_nonconsensus.opam b/src/nonconsensus/mina_compile_config_nonconsensus.opam similarity index 100% rename from src/mina_compile_config_nonconsensus.opam rename to src/nonconsensus/mina_compile_config_nonconsensus.opam diff --git a/src/nonconsensus/mina_numbers/dune b/src/nonconsensus/mina_numbers/dune index b290cc2a3f5..39fe9ae036b 100644 --- a/src/nonconsensus/mina_numbers/dune +++ b/src/nonconsensus/mina_numbers/dune @@ -1,5 +1,5 @@ (library - (name mina_numbers_nonconsensus) + (name mina_numbers) (public_name mina_numbers_nonconsensus) (inline_tests) (library_flags -linkall) diff --git a/src/mina_numbers_nonconsensus.opam b/src/nonconsensus/mina_numbers_nonconsensus.opam similarity index 100% rename from src/mina_numbers_nonconsensus.opam rename to src/nonconsensus/mina_numbers_nonconsensus.opam diff --git a/src/nonconsensus/non_zero_curve_point/dune b/src/nonconsensus/non_zero_curve_point/dune index 18ff00adb75..a56b44fec25 100644 --- a/src/nonconsensus/non_zero_curve_point/dune +++ b/src/nonconsensus/non_zero_curve_point/dune @@ -1,5 +1,5 @@ (library - (name non_zero_curve_point_nonconsensus) + (name non_zero_curve_point) (public_name non_zero_curve_point_nonconsensus) (flags :standard -short-paths) (inline_tests) diff --git a/src/non_zero_curve_point_nonconsensus.opam b/src/nonconsensus/non_zero_curve_point_nonconsensus.opam similarity index 100% rename from src/non_zero_curve_point_nonconsensus.opam rename to src/nonconsensus/non_zero_curve_point_nonconsensus.opam diff --git a/src/nonconsensus/outside_hash_image/dune b/src/nonconsensus/outside_hash_image/dune index be8dc6084d1..dd048f077db 100644 --- a/src/nonconsensus/outside_hash_image/dune +++ b/src/nonconsensus/outside_hash_image/dune @@ -1,5 +1,5 @@ (library - (name outside_hash_image_nonconsensus) + (name outside_hash_image) (public_name outside_hash_image_nonconsensus) (libraries snark_params_nonconsensus) (preprocessor_deps ../../config.mlh) diff --git a/src/random_oracle_nonconsensus.opam b/src/nonconsensus/outside_hash_image_nonconsensus.opam similarity index 100% rename from src/random_oracle_nonconsensus.opam rename to src/nonconsensus/outside_hash_image_nonconsensus.opam diff --git a/src/nonconsensus/quickcheck_lib/dune b/src/nonconsensus/quickcheck_lib/dune index 23e71f6f40e..4b9015801e9 100644 --- a/src/nonconsensus/quickcheck_lib/dune +++ b/src/nonconsensus/quickcheck_lib/dune @@ -1,5 +1,5 @@ (library - (name quickcheck_lib_nonconsensus) + (name quickcheck_lib) (public_name quickcheck_lib_nonconsensus) (libraries core_kernel currency_nonconsensus rose_tree) (inline_tests) diff --git a/src/quickcheck_lib_nonconsensus.opam b/src/nonconsensus/quickcheck_lib_nonconsensus.opam similarity index 100% rename from src/quickcheck_lib_nonconsensus.opam rename to src/nonconsensus/quickcheck_lib_nonconsensus.opam diff --git a/src/nonconsensus/random_oracle/dune b/src/nonconsensus/random_oracle/dune index 870de7ad2da..2a9b80456c5 100644 --- a/src/nonconsensus/random_oracle/dune +++ b/src/nonconsensus/random_oracle/dune @@ -1,5 +1,5 @@ (library - (name random_oracle_nonconsensus) + (name random_oracle) (public_name random_oracle_nonconsensus) (preprocessor_deps ../../config.mlh) (instrumentation (backend bisect_ppx)) diff --git a/src/rosetta_coding_nonconsensus.opam b/src/nonconsensus/random_oracle_nonconsensus.opam similarity index 100% rename from src/rosetta_coding_nonconsensus.opam rename to src/nonconsensus/random_oracle_nonconsensus.opam diff --git a/src/nonconsensus/rosetta_coding/dune b/src/nonconsensus/rosetta_coding/dune index 3b2c80a4dfe..951472ac456 100644 --- a/src/nonconsensus/rosetta_coding/dune +++ b/src/nonconsensus/rosetta_coding/dune @@ -1,5 +1,5 @@ (library - (name rosetta_coding_nonconsensus) + (name rosetta_coding) (public_name rosetta_coding_nonconsensus) (library_flags -linkall) (inline_tests) diff --git a/src/rosetta_lib_nonconsensus.opam b/src/nonconsensus/rosetta_coding_nonconsensus.opam similarity index 100% rename from src/rosetta_lib_nonconsensus.opam rename to src/nonconsensus/rosetta_coding_nonconsensus.opam diff --git a/src/nonconsensus/rosetta_lib/dune b/src/nonconsensus/rosetta_lib/dune index 6116205389c..0a93b2553af 100644 --- a/src/nonconsensus/rosetta_lib/dune +++ b/src/nonconsensus/rosetta_lib/dune @@ -1,5 +1,5 @@ (library - (name rosetta_lib_nonconsensus) + (name rosetta_lib) (public_name rosetta_lib_nonconsensus) (library_flags -linkall) (inline_tests) diff --git a/src/nonconsensus/rosetta_lib/test/dune b/src/nonconsensus/rosetta_lib/test/dune index ecfc94184ee..2570053f643 100644 --- a/src/nonconsensus/rosetta_lib/test/dune +++ b/src/nonconsensus/rosetta_lib/test/dune @@ -1,7 +1,5 @@ (executable - (package rosetta_lib) (name test_encodings) - (public_name test_encodings) (modes native) (modules test_encodings) (libraries core_kernel signature_lib_nonconsensus rosetta_lib_nonconsensus) diff --git a/src/nonconsensus/rosetta_lib_nonconsensus.opam b/src/nonconsensus/rosetta_lib_nonconsensus.opam new file mode 100644 index 00000000000..a1b56499734 --- /dev/null +++ b/src/nonconsensus/rosetta_lib_nonconsensus.opam @@ -0,0 +1,5 @@ +opam-version: "1.2" +version: "0.1" +build: [ + ["dune" "build" "--only" "src" "--root" "." "-j" jobs "@install"] +] diff --git a/src/nonconsensus/sgn/dune b/src/nonconsensus/sgn/dune index b2291dd1969..f4241b85fc4 100644 --- a/src/nonconsensus/sgn/dune +++ b/src/nonconsensus/sgn/dune @@ -1,5 +1,5 @@ (library - (name sgn_nonconsensus) + (name sgn) (public_name sgn_nonconsensus) (library_flags -linkall) (libraries sgn_type snark_params_nonconsensus core_kernel ppx_deriving_yojson.runtime diff --git a/src/sgn_nonconsensus.opam b/src/nonconsensus/sgn_nonconsensus.opam similarity index 100% rename from src/sgn_nonconsensus.opam rename to src/nonconsensus/sgn_nonconsensus.opam diff --git a/src/nonconsensus/signature_lib/dune b/src/nonconsensus/signature_lib/dune index 223e8de8567..548117c7a4c 100644 --- a/src/nonconsensus/signature_lib/dune +++ b/src/nonconsensus/signature_lib/dune @@ -1,5 +1,5 @@ (library - (name signature_lib_nonconsensus) + (name signature_lib) (public_name signature_lib_nonconsensus) (library_flags -linkall) (inline_tests) diff --git a/src/signature_lib_nonconsensus.opam b/src/nonconsensus/signature_lib_nonconsensus.opam similarity index 100% rename from src/signature_lib_nonconsensus.opam rename to src/nonconsensus/signature_lib_nonconsensus.opam diff --git a/src/nonconsensus/snark_bits/dune b/src/nonconsensus/snark_bits/dune index abd3f899e45..b4079260e67 100644 --- a/src/nonconsensus/snark_bits/dune +++ b/src/nonconsensus/snark_bits/dune @@ -1,5 +1,5 @@ (library - (name snark_bits_nonconsensus) + (name snark_bits) (public_name snark_bits_nonconsensus) (library_flags -linkall) (libraries fold_lib bitstring_lib core_kernel integers) diff --git a/src/snark_bits_nonconsensus.opam b/src/nonconsensus/snark_bits_nonconsensus.opam similarity index 100% rename from src/snark_bits_nonconsensus.opam rename to src/nonconsensus/snark_bits_nonconsensus.opam diff --git a/src/nonconsensus/snark_params/dune b/src/nonconsensus/snark_params/dune index df15e4134bc..3ce8415d1b1 100644 --- a/src/nonconsensus/snark_params/dune +++ b/src/nonconsensus/snark_params/dune @@ -1,5 +1,5 @@ (library - (name snark_params_nonconsensus) + (name snark_params) (public_name snark_params_nonconsensus) (library_flags -linkall) (libraries core_kernel bignum_bigint snarkette) diff --git a/src/nonconsensus/snark_params/snark_params_nonconsensus.ml b/src/nonconsensus/snark_params/tick.ml similarity index 100% rename from src/nonconsensus/snark_params/snark_params_nonconsensus.ml rename to src/nonconsensus/snark_params/tick.ml diff --git a/src/snark_params_nonconsensus.opam b/src/nonconsensus/snark_params_nonconsensus.opam similarity index 100% rename from src/snark_params_nonconsensus.opam rename to src/nonconsensus/snark_params_nonconsensus.opam diff --git a/src/nonconsensus/string_sign/dune b/src/nonconsensus/string_sign/dune index e653fdf9425..c5ef18ecc53 100644 --- a/src/nonconsensus/string_sign/dune +++ b/src/nonconsensus/string_sign/dune @@ -1,5 +1,5 @@ (library - (name string_sign_nonconsensus) + (name string_sign) (public_name string_sign_nonconsensus) (inline_tests) (library_flags -linkall) diff --git a/src/string_sign_nonconsensus.opam b/src/nonconsensus/string_sign_nonconsensus.opam similarity index 100% rename from src/string_sign_nonconsensus.opam rename to src/nonconsensus/string_sign_nonconsensus.opam diff --git a/src/nonconsensus/unsigned_extended/dune b/src/nonconsensus/unsigned_extended/dune index c01c38d1aaa..63820474d93 100644 --- a/src/nonconsensus/unsigned_extended/dune +++ b/src/nonconsensus/unsigned_extended/dune @@ -1,5 +1,5 @@ (library - (name unsigned_extended_nonconsensus) + (name unsigned_extended) (public_name unsigned_extended_nonconsensus) (library_flags -linkall) (inline_tests) diff --git a/src/unsigned_extended_nonconsensus.opam b/src/nonconsensus/unsigned_extended_nonconsensus.opam similarity index 100% rename from src/unsigned_extended_nonconsensus.opam rename to src/nonconsensus/unsigned_extended_nonconsensus.opam