Skip to content

Commit

Permalink
Fix verification in dry runs: alternative take
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeee committed Apr 30, 2024
1 parent c1c9de7 commit 29abe07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions buildkite/src/Command/MinaArtifact.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ let hardforkPipeline : DebianVersions.DebVersion -> Pipeline.Config.Type =
commands = [
Cmd.runInDocker Cmd.Docker::{
image = "gcr.io/o1labs-192920/mina-daemon:\${BUILDKITE_COMMIT:0:7}-${DebianVersions.lowerName debVersion}-${network}"
, extraEnv = [ "CONFIG_JSON_GZ_URL=\$CONFIG_JSON_GZ_URL", "NETWORK_NAME=\$NETWORK_NAME" ]
, extraEnv = [ "CONFIG_JSON_GZ_URL=\$CONFIG_JSON_GZ_URL", "NETWORK_NAME=\$NETWORK_NAME", "PRECOMPUTED_BLOCK_GS_PREFIX=\$PRECOMPUTED_BLOCK_GS_PREFIX" ]
-- an account with this balance seems present in many ledgers?
} "curl \$CONFIG_JSON_GZ_URL > config.json.gz && gunzip config.json.gz && sed -e '0,/20.000001/{s/20.000001/20.01/}' -i config.json && ! (mina-verify-packaged-fork-config \$NETWORK_NAME config.json /workdir/verification)"
} "curl \$CONFIG_JSON_GZ_URL > config.json.gz && gunzip config.json.gz && sed -e '0,/20.000001/{s/20.000001/20.01/}' -i config.json && ! (mina-verify-packaged-fork-config \$NETWORK_NAME config.json /workdir/verification {PRECOMPUTED_BLOCK_GS_PREFIX:-})"
]
, label = "Assert corrupted packaged artifacts are unverifiable"
, key = "assert-unverify-corrupted-packaged-artifacts"
Expand All @@ -149,8 +149,8 @@ let hardforkPipeline : DebianVersions.DebVersion -> Pipeline.Config.Type =
commands = [
Cmd.runInDocker Cmd.Docker::{
image = "gcr.io/o1labs-192920/mina-daemon:\${BUILDKITE_COMMIT:0:7}-${DebianVersions.lowerName debVersion}-${network}"
, extraEnv = [ "CONFIG_JSON_GZ_URL=\$CONFIG_JSON_GZ_URL", "NETWORK_NAME=\$NETWORK_NAME" ]
} "curl \$CONFIG_JSON_GZ_URL > config.json.gz && gunzip config.json.gz && mina-verify-packaged-fork-config \$NETWORK_NAME config.json /workdir/verification"
, extraEnv = [ "CONFIG_JSON_GZ_URL=\$CONFIG_JSON_GZ_URL", "NETWORK_NAME=\$NETWORK_NAME", "PRECOMPUTED_BLOCK_GS_PREFIX=\$PRECOMPUTED_BLOCK_GS_PREFIX" ]
} "curl \$CONFIG_JSON_GZ_URL > config.json.gz && gunzip config.json.gz && mina-verify-packaged-fork-config \$NETWORK_NAME config.json /workdir/verification \${PRECOMPUTED_BLOCK_GS_PREFIX:-}"
]
, label = "Verify packaged artifacts"
, key = "verify-packaged-artifacts"
Expand Down
10 changes: 7 additions & 3 deletions scripts/mina-verify-packaged-fork-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -eo pipefail

if [ $# -lt 2 ]; then
echo "Usage: $0 <network-name> <fork-config.json> <working-dir>"
if [ $# -lt 3 ]; then
echo "Usage: $0 <network-name> <fork-config.json> <working-dir> <optional: precomputed block prefix>"
cat <<EOF
This script is used to validate that an installed package is correct
according to an exported fork_config.json file.
Expand Down Expand Up @@ -89,7 +89,11 @@ fork_block_length=$(jq -r '.proof.fork.blockchain_length' "$2")
# Put the fork block where we want it, fetch it from gcloud if necessary
if [ ! -e "$PRECOMPUTED_FORK_BLOCK" ]; then
if [ "$PRECOMPUTED_FORK_BLOCK" = "" ]; then
PRECOMPUTED_FORK_BLOCK="gs://mina_network_block_data/$1-$fork_block_length-$fork_block_state_hash.json"
prefix=$4
if [ "$prefix" = "" ]; then
prefix="gs://mina_network_block_data/$1"
fi
PRECOMPUTED_FORK_BLOCK="$prefix-$fork_block_length-$fork_block_state_hash.json"
fi
"$GSUTIL" cp "$PRECOMPUTED_FORK_BLOCK" "$workdir/precomputed_fork_block.json"
else
Expand Down

0 comments on commit 29abe07

Please sign in to comment.