Skip to content

Commit

Permalink
Merge branch 'rampup' into fix/keep-helper-stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
deepthiskumar authored Dec 19, 2023
2 parents 2d386c0 + 0694f50 commit 06cfe98
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 4 deletions.
2 changes: 2 additions & 0 deletions buildkite/scripts/build-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ dune build "--profile=${DUNE_PROFILE}" \
src/app/replayer/replayer.exe \
src/app/extract_blocks/extract_blocks.exe \
src/app/archive_blocks/archive_blocks.exe \
src/app/last_vrf_output_to_b64/last_vrf_output_to_b64.exe \
src/app/receipt_chain_hash_to_b58/receipt_chain_hash_to_b58.exe \
src/app/batch_txn_tool/batch_txn_tool.exe \
src/app/missing_blocks_auditor/missing_blocks_auditor.exe \
src/app/swap_bad_balances/swap_bad_balances.exe \
Expand Down
42 changes: 42 additions & 0 deletions buildkite/src/Jobs/Release/ReceiptChainHashFixArtifact.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
let Prelude = ../../External/Prelude.dhall

let Cmd = ../../Lib/Cmds.dhall
let S = ../../Lib/SelectFiles.dhall
let D = S.PathPattern

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 spec = DockerImage.ReleaseSpec::{
service="mina-receipt-chain-hash-fix",
step_key="receipt-chain-hash-fix-docker-image",
network="berkeley",
deps = [ { name = "MinaArtifactBullseye", key = "daemon-berkeley-bullseye-docker-image" } ]
}

in

Pipeline.build
Pipeline.Config::{
spec =
JobSpec::{
dirtyWhen = [
S.strictlyStart (S.contains "buildkite/src/Jobs/Release/ReceiptChainHashFixArtifact"),
S.strictlyStart (S.contains "src/app/receipt_chain_hash_to_b58"),
S.strictlyStart (S.contains "src/app/last_vrf_output_to_b64")
],
path = "Release",
name = "ReceiptChainHashFixArtifact"
},
steps = [
DockerImage.generateStep spec
]
}




44 changes: 44 additions & 0 deletions dockerfiles/Dockerfile-mina-receipt-chain-hash-fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ARG image=debian:bullseye
FROM ${image}

# Run with `docker build --build-arg deb_version=<version>`
ARG deb_version
ARG deb_codename=bullseye
ARG deb_release=unstable

ENV DEBIAN_FRONTEND noninteractive
RUN echo "Building image with version $deb_codename $deb_release $deb_version"

COPY scripts/archive-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Dependencies
RUN apt-get update --quiet --yes \
&& apt-get upgrade --quiet --yes \
&& apt-get install --quiet --yes --no-install-recommends \
procps \
curl \
jq \
dumb-init \
libssl1.1 \
libgomp1 \
libpq-dev \
apt-transport-https \
ca-certificates \
dnsutils \
tzdata \
postgresql \
postgresql-contrib \
apt-utils \
man \
&& rm -rf /var/lib/apt/lists/*

# archive-node package
RUN echo "deb [trusted=yes] http://packages.o1test.net $deb_codename $deb_release" > /etc/apt/sources.list.d/o1.list \
&& apt-get update --quiet --yes \
&& apt-get install --quiet --yes "mina-receipt-chain-hash-fix=$deb_version" \
&& rm -rf /var/lib/apt/lists/*

ENV RECEIPT_CHAIN_HASH_TO_B58_APP /usr/local/bin/mina-receipt-chain-hash-to-b58
ENV LAST_VRF_OUTPUT_TO_B64_APP /usr/local/bin/mina-last-vrf-output-to-b64
ENTRYPOINT ["/etc/mina/receipt-chain-hash-fix-script/migrate-itn-data.sh"]
10 changes: 7 additions & 3 deletions scripts/migrate-itn-data.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/bash

if [ $# -lt 1 ] || [ $# -gt 3 ]; then
if [ $# -lt 1 ] || [ $# -gt 5 ]; then
echo "Usage" $0 archive-db [data_file] [update_script]
echo "'data_file' and 'update_script' are created when running this script"
echo "[env] RECEIPT_CHAIN_HASH_TO_B58_APP overrides receipt_chain_hash_to_b58 location"
echo "[env] LAST_VRF_OUTPUT_TO_B64_APP overrides last_vrf_output_to_b64 location"
exit 0
fi

ARCHIVE_DB=$1
DATA_FILE=${2:-data_file.tmp}
UPDATE_SCRIPT=${3:-data_update.sql}
RECEIPT_CHAIN_HASH_TO_B58_APP=${RECEIPT_CHAIN_HASH_TO_B58_APP:-_build/default/src/app/receipt_chain_hash_to_b58/receipt_chain_hash_to_b58.exe}
LAST_VRF_OUTPUT_TO_B64_APP=${LAST_VRF_OUTPUT_TO_B64_APP:-_build/default/src/app/last_vrf_output_to_b64/last_vrf_output_to_b64.exe}

echo "Migrating receipt chain hashes in account preconditions in archive db '"$ARCHIVE_DB"'"

Expand All @@ -24,7 +28,7 @@ for line in `cat $DATA_FILE`
do (
ID=$(echo $line | awk -F , '{print $1}');
FP=$(echo $line | awk -F , '{print $2}');
B58=$(echo $FP | _build/default/src/app/receipt_chain_hash_to_b58/receipt_chain_hash_to_b58.exe);
B58=$(echo $FP | $RECEIPT_CHAIN_HASH_TO_B58_APP );
echo -n .
echo $ID "'"$B58"'" | awk '{print "UPDATE zkapp_account_precondition SET receipt_chain_hash=" $2 " WHERE id=" $1 ";"}' >> $UPDATE_SCRIPT)
done
Expand All @@ -43,7 +47,7 @@ for line in `cat $DATA_FILE`
do (
ID=$(echo $line | awk -F , '{print $1}');
FP=$(echo $line | awk -F , '{print $2}');
B64=$(echo $FP | _build/default/src/app/last_vrf_output_to_b64/last_vrf_output_to_b64.exe);
B64=$(echo $FP | $LAST_VRF_OUTPUT_TO_B64_APP);
echo -n .
echo $ID "'"$B64"'" | awk '{print "UPDATE blocks SET last_vrf_output=" $2 " WHERE id=" $1 ";"}' >> $UPDATE_SCRIPT)
done
Expand Down
14 changes: 14 additions & 0 deletions scripts/rebuild-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,20 @@ build_deb mina-logproc

##################################### END LOGPROC PACKAGE #######################################

##################################### GENERATE RECEIPT CHAIN HASH FIX PACKAGE #######################################

create_control_file mina-receipt-chain-hash-fix "${SHARED_DEPS}${DAEMON_DEPS}" 'Tool to run automated fix against a archive database for receipt chain hash.'

mkdir -p "${BUILDDIR}/etc/mina/receipt-chain-hash-fix-script"

# Binaries
cp ../scripts/migrate-itn-data.sh "${BUILDDIR}/etc/mina/receipt-chain-hash-fix-script/migrate-itn-data.sh"
cp ./default/src/app/last_vrf_output_to_b64/last_vrf_output_to_b64.exe "${BUILDDIR}/usr/local/bin/mina-last-vrf-output-to-b64"
cp ./default/src/app/receipt_chain_hash_to_b58/receipt_chain_hash_to_b58.exe "${BUILDDIR}/usr/local/bin/mina-receipt-chain-hash-to-b58"

build_deb mina-receipt-chain-hash-fix

##################################### END RECEIPT CHAIN HASH FIX PACKAGE #######################################

##################################### GENERATE TEST_EXECUTIVE PACKAGE #######################################

Expand Down
6 changes: 5 additions & 1 deletion scripts/release-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-test-executive' 'mina-batch-txn' 'mina-zkapp-test-transaction' 'mina-toolchain' 'bot' 'leaderboard' 'delegation-backend' 'delegation-backend-toolchain' 'itn-orchestrator')
VALID_SERVICES=('mina-archive', 'mina-daemon' 'mina-rosetta' 'mina-test-executive' 'mina-receipt-chain-hash-fix' 'mina-batch-txn' 'mina-zkapp-test-transaction' 'mina-toolchain' 'bot' 'leaderboard' 'delegation-backend' 'delegation-backend-toolchain' 'itn-orchestrator')

function usage() {
if [[ -n "$1" ]]; then
Expand Down Expand Up @@ -99,6 +99,10 @@ mina-batch-txn)
mina-rosetta)
DOCKERFILE_PATH="dockerfiles/stages/1-build-deps dockerfiles/stages/2-opam-deps dockerfiles/stages/3-builder dockerfiles/stages/4-production"
;;
mina-receipt-chain-hash-fix)
DOCKERFILE_PATH="dockerfiles/Dockerfile-mina-receipt-chain-hash-fix"
DOCKER_CONTEXT="dockerfiles/"
;;
mina-zkapp-test-transaction)
DOCKERFILE_PATH="dockerfiles/Dockerfile-zkapp-test-transaction"
;;
Expand Down

0 comments on commit 06cfe98

Please sign in to comment.