Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions buildkite/scripts/tests/rosetta-block-race-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Main purpose of this is script is to wrap around rosetta-block-race.sh
# So env vars from docker buildkite step are passed down to the script

LEDGER_URL="https://storage.googleapis.com/o1labs-ci-test-data/ledgers/single-bp-ledger.tar"
LEDGER_ARCHIVE="ledger.tar"
LEDGER_DIR="ledger"

echo "Downloading ledger archive from $LEDGER_URL ..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest fusing this so we're not wasting I/O to store the tar itself.

echo "Downloading and extracting ledger archive from $LEDGER_URL ..."
mkdir -p "$LEDGER_DIR"
curl -L "$LEDGER_URL" | tar -x -C "$LEDGER_DIR"

curl -L -o "$LEDGER_ARCHIVE" "$LEDGER_URL"

mkdir -p "$LEDGER_DIR"

echo " Extracting ledger archive to $LEDGER_DIR ..."
tar -xf "$LEDGER_ARCHIVE" -C "$LEDGER_DIR"

chmod 700 "$LEDGER_DIR"

sudo apt-get update
sudo apt-get install -y python3

./scripts/rosetta/test-block-race.sh \
--mina-exe /usr/local/bin/mina \
--archive-exe /usr/local/bin/mina-archive \
--rosetta-exe /usr/local/bin/mina-rosetta \
--postgres-uri ${PG_CONN} \
--ledger ${LEDGER_DIR}
40 changes: 40 additions & 0 deletions buildkite/src/Command/RosettaBlockRaceTest.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
let Artifacts = ../Constants/Artifacts.dhall

let BuildFlags = ../Constants/BuildFlags.dhall

let Command = ./Base.dhall

let Size = ./Size.dhall

let RunWithPostgres = ./RunWithPostgres.dhall

let key = "rosetta-block-race-test"

in { step =
\(dependsOn : List Command.TaggedKey.Type)
-> Command.build
Command.Config::{
, commands =
[ RunWithPostgres.runInDockerWithPostgresConn
([] : List Text)
( Some
( RunWithPostgres.ScriptOrArchive.OnlineTarGzDump
"https://storage.googleapis.com/mina-archive-dumps/mainnet-archive-dump-2025-11-11_0000.sql.tar.gz"
)
)
( Artifacts.fullDockerTag
Artifacts.Tag::{
, artifact = Artifacts.Type.FunctionalTestSuite
, buildFlags = BuildFlags.Type.Instrumented
}
)
( "./buildkite/scripts/tests/rosetta-block-race-test.sh "
++ "&& ./buildkite/scripts/upload-partial-coverage-data.sh ${key}"
)
]
, label = "Rosetta: Rosetta Block Race test"
, key = key
, target = Size.Large
, depends_on = dependsOn
}
}
10 changes: 9 additions & 1 deletion buildkite/src/Command/RunWithPostgres.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ let ContainerImages = ../Constants/ContainerImages.dhall

let ScriptOrArchive
: Type
= < Script : Text | Archive : { Script : Text, Archive : Text } >
= < Script : Text
| Archive : { Script : Text, Archive : Text }
| OnlineTarGzDump : Text
>

let runInDockerWithPostgresConn
: List Text -> Optional ScriptOrArchive -> Text -> Text -> Cmd.Type
Expand Down Expand Up @@ -116,6 +119,11 @@ let runInDockerWithPostgresConn
-> [ "tar -xzf ${archive.Archive}"
, "docker exec ${postgresDockerName} find /workdir -name \"${archive.Script}\" -exec psql ${pg_conn} -f {} \\;"
]
, OnlineTarGzDump =
\(url : Text)
-> [ "curl -sSL ${url} | tar -xz"
, "docker exec ${postgresDockerName} find /workdir -name \"*.sql\" -exec psql ${pg_conn} -f {} \\;"
]
}
script
, None = [] : List Text
Expand Down
44 changes: 44 additions & 0 deletions buildkite/src/Jobs/Test/RosettaBlockRaceTest.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
let S = ../../Lib/SelectFiles.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineTag = ../../Pipeline/Tag.dhall

let JobSpec = ../../Pipeline/JobSpec.dhall

let Artifacts = ../../Constants/Artifacts.dhall

let Dockers = ../../Constants/DockerVersions.dhall

let BuildFlags = ../../Constants/BuildFlags.dhall

let RosettaBlockRaceTest = ../../Command/RosettaBlockRaceTest.dhall

let dependsOn =
Dockers.dependsOn
Dockers.DepsSpec::{
, artifact = Artifacts.Type.FunctionalTestSuite
, buildFlags = BuildFlags.Type.Instrumented
}

in Pipeline.build
Pipeline.Config::{
, spec = JobSpec::{
, dirtyWhen =
[ S.strictlyStart (S.contains "src")
, S.exactly "scripts/rosetta/test-block-race-with-data" "sh"
, S.exactly "scripts/rosetta/test-block-race" "sh"
, S.exactly "buildkite/scripts/tests/rosetta-block-race-test" "sh"
, S.exactly "buildkite/src/Jobs/Test/RosettaBlockRaceTest" "dhall"
, S.exactly "buildkite/src/Command/RosettaBlockRaceTest" "dhall"
]
, path = "Test"
, name = "RosettaBlockRaceTest"
, tags =
[ PipelineTag.Type.Long
, PipelineTag.Type.Test
, PipelineTag.Type.Stable
]
}
, steps = [ RosettaBlockRaceTest.step dependsOn ]
}
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile-mina-test-suite
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN locale-gen en_US.UTF-8
RUN echo "Building image with version $deb_version from repo $deb_release $deb_codename " \
&& echo "deb [trusted=yes] ${deb_repo} $deb_codename $deb_release" > /etc/apt/sources.list.d/o1.list \
&& apt-get update --quiet --yes \
&& apt-get install --no-install-recommends --quiet --yes --allow-downgrades -o Dpkg::Options::="--force-overwrite" "mina-test-suite=$deb_version" "mina-$network-instrumented=$deb_version" "mina-archive-$network-instrumented=$deb_version" \
&& apt-get install --no-install-recommends --quiet --yes --allow-downgrades -o Dpkg::Options::="--force-overwrite" "mina-test-suite=$deb_version" "mina-$network-instrumented=$deb_version" "mina-archive-$network-instrumented=$deb_version" "mina-rosetta-$network=$deb_version" \
&& rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["sleep","infinity"]
29 changes: 27 additions & 2 deletions scripts/rosetta/test-block-race-with-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ LEDGER_ARCHIVE="ledger.tar"
DB_DIR="db"
LEDGER_DIR="ledger"

CURRENT_USER=$(whoami)
POSTGRES_USER="$CURRENT_USER"
POSTGRES_PASSWORD=""
POSTGRES_DB="archive"
POSTGRES_HOST="localhost"

# Function to display usage
usage() {
cat << EOF
Expand All @@ -48,6 +54,10 @@ Required parameters:

Optional parameters:
--postgres-port PORT PostgreSQL server port (default: $POSTGRES_PORT)
--postgres-user USER PostgreSQL user (default: $POSTGRES_USER)
--postgres-password PASS PostgreSQL password (default: empty)
--postgres-db DB PostgreSQL database name (default: $POSTGRES_DB)
--postgres-host HOST PostgreSQL host (default: $POSTGRES_HOST)
--port-base PORT Base port number for services (default: $PORT_BASE)
--num-blocks N Number of blocks to generate (default: $NUM_BLOCKS)
--num-zkapp-txs N Number of zkApp transactions (default: $NUM_ZKAPP_TXS)
Expand All @@ -71,6 +81,22 @@ while [[ $# -gt 0 ]]; do
POSTGRES_PORT="$2"
shift 2
;;
--postgres-user)
POSTGRES_USER="$2"
shift 2
;;
--postgres-password)
POSTGRES_PASSWORD="$2"
shift 2
;;
--postgres-db)
POSTGRES_DB="$2"
shift 2
;;
--postgres-host)
POSTGRES_HOST="$2"
shift 2
;;
--port-base)
PORT_BASE="$2"
shift 2
Expand Down Expand Up @@ -182,8 +208,7 @@ if [[ ! -x "$ROSETTA_EXE" ]]; then
fi

# Get current username for postgres URI
CURRENT_USER=$(whoami)
POSTGRES_URI="postgres://$CURRENT_USER@localhost:$POSTGRES_PORT/archive"
POSTGRES_URI="postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"

# PID for postgres cleanup
POSTGRES_PID=""
Expand Down
4 changes: 2 additions & 2 deletions scripts/rosetta/test-block-race.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ cp -R "$LEDGER_DIR/ledgers/" genesis
mkdir -p tmp

echo "Running warmup mina advanced test submit-to-archive (1 block, 1 payment, 0 zkapp)..."
TMP=tmp MINA_PRIVKEY_PASS="$MINA_EXE" advanced test submit-to-archive \
TMP=tmp MINA_PRIVKEY_PASS="" "$MINA_EXE" advanced test submit-to-archive \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is TMP? Is this AI hallucination?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was in the original script, done by George. I think this is passing TMP down to inner script as we are not running export TMP

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was in the original script, done by George. I think this is passing TMP down to inner script as we are not running export TMP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you point to me where it's used? Can't find it at all

--archive-node-port "$ARCHIVE_PORT" \
--config-file "$LEDGER_DIR/runtime_config.json" \
--privkey-path "$LEDGER_DIR/plain1" \
Expand Down Expand Up @@ -320,7 +320,7 @@ echo ""
# Run main submit-to-archive test
echo "[Main Test] Submitting blocks to archive..."
echo "Running mina advanced test submit-to-archive..."
TMP=tmp MINA_PRIVKEY_PASS="$MINA_EXE" advanced test submit-to-archive \
TMP=tmp MINA_PRIVKEY_PASS="" "$MINA_EXE" advanced test submit-to-archive \
--archive-node-port "$ARCHIVE_PORT" \
--config-file "$LEDGER_DIR/runtime_config.json" \
--privkey-path "$LEDGER_DIR/plain1" \
Expand Down