-
Notifications
You must be signed in to change notification settings - Fork 771
Add test to re-execute specified range of mainnet C-Chain blocks #4019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aaronbuchwald
wants to merge
108
commits into
master
Choose a base branch
from
aaronbuchwald/cchain-reexecute-range-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+870
−6
Open
Changes from all commits
Commits
Show all changes
108 commits
Select commit
Hold shift + click to select a range
a9f395f
feat(scripts): add copy_dir.sh script to copy from local filesystem o…
aaronbuchwald 197214e
feat(scripts): add script and task def to import cchain data for reex…
aaronbuchwald ba1a234
test(cchain): add vm reexecution test and task to import required dat…
aaronbuchwald d1cdb8e
improve comment on cchain bench test
aaronbuchwald 3ca35a8
Move required data to avalanchego-bootstrap-testing s3 bucket
aaronbuchwald 0dee263
add TestPrometheusIntegration
aaronbuchwald 962a250
remove no files found err condition
aaronbuchwald ef940be
remove bash -x prefix from run monitored tmpnet cmd
aaronbuchwald 8dfee2b
Add grafana preview dashboard name as input to run monitored tmpnet cmd
aaronbuchwald 1aa89e5
Add helper to write prometheus sd config file
aaronbuchwald 65e64c7
Get vm test working
aaronbuchwald 0240e3a
move bash -x in cmd of run monitored tmpnet cmd to call sites
aaronbuchwald 7e3ef87
use runtime input to disable artifact collection and avoid err
aaronbuchwald ef9ed07
fix up monitor processes
aaronbuchwald c010bf8
move prometheus server into separate test file
aaronbuchwald 8d2c061
Add aws read only role usage
aaronbuchwald b625ee8
cleanup
aaronbuchwald ee19b2d
Merge branch 'master' into aaronbuchwald/cchain-reexecute-range-test
aaronbuchwald 8027234
ensure s5cmd exists in copy dir script
aaronbuchwald 0335061
fix s5cmd install
aaronbuchwald 111bb53
add combo task
aaronbuchwald dbd3f34
remove s5cmd from flake.nix
aaronbuchwald bc28c6b
add s5cmd
aaronbuchwald 9f84199
remove debugging tests
aaronbuchwald 96d1af4
cleanup
aaronbuchwald 3c01f26
cleanup
aaronbuchwald ef909b1
re-arrange for block export
aaronbuchwald 871cc02
Fix atomic memory db mismatch
aaronbuchwald 7fb4bb4
Add task to export c-chain current state data
aaronbuchwald 3f8d706
Fix import/export
aaronbuchwald ecceb9e
update ci
aaronbuchwald ca7a903
avoid relative path
aaronbuchwald 2e27b7b
revert underscore to dash
aaronbuchwald 4abb96f
Add README for c-chain benchmarks
aaronbuchwald 06b2345
add section on setting up credentials
aaronbuchwald ebc6917
update readme
aaronbuchwald 29342f3
fix s3 expressions following readme instructions
aaronbuchwald c4c4906
Ensure final metrics scrape
aaronbuchwald 543459b
Improve readme
aaronbuchwald dc8f9f5
Add export-cchain-block-range
aaronbuchwald 4a545b7
export blocks to leveldb
aaronbuchwald d515598
Remove helpers for old db format
aaronbuchwald 97c5a66
change to use 10k blocks
aaronbuchwald ac1bd21
nit label and disable test timeout in tasks
aaronbuchwald a6b8967
change to periodic logs
aaronbuchwald 9117022
fix lint
aaronbuchwald 4dace59
Apply suggestions from code review
aaronbuchwald 960c63f
Merge branch 'master' into aaronbuchwald/cchain-reexecute-range-test
aaronbuchwald 3d8008c
fix merge
aaronbuchwald 1e80318
fix merge
aaronbuchwald 28b3417
Fix lint
aaronbuchwald 9b419da
fix copy dir and vm constructor
aaronbuchwald 410aee7
Remove debug logs on every block
aaronbuchwald 371d5d0
debug
aaronbuchwald 69a46af
debug ordering of collectRegistry
aaronbuchwald dbb3a03
Add chain=C label to vm metrics
aaronbuchwald 9f7030c
Add consensus metrics registry and last accepted height gauge to benc…
aaronbuchwald b7ba60b
migrate c chain benchmark to separate workflow file
aaronbuchwald b1f029a
Add execution timeout without error
aaronbuchwald 098c180
fix actionslint
aaronbuchwald e19b7bf
cleanup
aaronbuchwald a34047b
Move env var back to end of line
aaronbuchwald 2ac1876
cleanup
aaronbuchwald 5190026
Shorten default block range to [100, 250k] to cut PR CI runtime
aaronbuchwald 45e5b12
improve readme
aaronbuchwald 20e4c20
Merge branch 'master' into aaronbuchwald/cchain-reexecute-range-test
aaronbuchwald 89d9ffa
fix grafana preview link
aaronbuchwald 5c62527
fix grafana dashboard input
aaronbuchwald 88a59db
Simplify C-Chain label and add is_ephemeral_node=false
aaronbuchwald 4b327c9
update s3 zip name used in readme to follow convention
aaronbuchwald 5579435
Use benchmark syntax to generate top-level metrics
aaronbuchwald ec4eecb
Add github action benchmark step
aaronbuchwald 73812dc
Update exec dir param in cchain benchmark yml
aaronbuchwald 8bb9ccf
Merge branch 'master' into aaronbuchwald/cchain-reexecute-range-test
aaronbuchwald e0967ed
fix output file name
aaronbuchwald 86c7ec5
update taskfile to use separate block dir
aaronbuchwald 0f40d3d
Add support for attaching custom labels
aaronbuchwald d948c35
fix formatting
aaronbuchwald 2ee1ee7
fix formatting
aaronbuchwald 2e1d408
Fix cache usage for bench comparison
aaronbuchwald 7bf39d8
check comparison
aaronbuchwald 59f33b4
Add chainID to subnetID lookup to snow ctx
aaronbuchwald f39d9ce
fix lint
aaronbuchwald 96e3d47
update to use ARC
aaronbuchwald 2ac8765
add xz before nix
aaronbuchwald e4aca3c
update to use GITHUB_ACTION_PATH
aaronbuchwald 4dcf897
Fix github workspace var usage
aaronbuchwald 69240ea
cleanup var names
aaronbuchwald 35481c0
Merge branch 'master' into aaronbuchwald/cchain-reexecute-range-test
aaronbuchwald 4fcbf0c
fix lint
aaronbuchwald b064fb5
revert back to gh runner
aaronbuchwald 70e3db2
remove bash -x prefix
aaronbuchwald 030cc87
revert bash -x from ci.yml
aaronbuchwald 7a69cea
cleanup
aaronbuchwald dba9a84
Update taskfile var names
aaronbuchwald de17f16
move benchmark output file to arg
aaronbuchwald 9c71b7b
switch back to using gh context
aaronbuchwald a39a1e4
Add cronjob for C-Chain benchmark to run weekly on Sunday
aaronbuchwald df1d074
Use default config
aaronbuchwald 1402892
Address comments
aaronbuchwald 815929e
revert use of env context where it's not available
aaronbuchwald 9ee02d2
Merge branch 'master' into aaronbuchwald/cchain-reexecute-range-test
aaronbuchwald dc5e63c
Update test filter
aaronbuchwald 857624d
upate benchmark path in readme
aaronbuchwald baa4452
rename
aaronbuchwald 701bfa9
remove unused env vars
aaronbuchwald 67e1741
fix default start param in workflow
aaronbuchwald 3ce4d26
Change default back to 250k
aaronbuchwald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: C-Chain Re-Execution Benchmark | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
start-block: | ||
description: 'The start block for the benchmark.' | ||
required: false | ||
default: 101 | ||
end-block: | ||
description: 'The end block for the benchmark.' | ||
required: false | ||
default: 250000 | ||
source-block-dir: | ||
description: 'The source block directory. Supports S3 directory/zip and local directories.' | ||
required: false | ||
default: s3://avalanchego-bootstrap-testing/cchain-mainnet-blocks-1m-ldb.zip | ||
current-state-dir: | ||
description: 'The current state directory. Supports S3 directory/zip and local directories.' | ||
required: false | ||
default: s3://avalanchego-bootstrap-testing/cchain-current-state-hashdb-full-100.zip | ||
schedule: | ||
- cron: '0 6 * * 0' # Runs every Sunday at 06:00 UTC | ||
|
||
jobs: | ||
c-chain-reexecution: | ||
permissions: | ||
id-token: write | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_S3_READ_ONLY_ROLE }} | ||
aws-region: us-east-2 | ||
- name: Set task env via GITHUB_ENV | ||
id: set-params | ||
run: | | ||
{ | ||
echo "START_BLOCK=${{ github.event.inputs.start-block || 101 }}" | ||
echo "END_BLOCK=${{ github.event.inputs.end-block || 250000 }}" | ||
echo "SOURCE_BLOCK_DIR=${{ github.event.inputs.source-block-dir || 's3://avalanchego-bootstrap-testing/cchain-mainnet-blocks-1m-ldb.zip' }}" | ||
echo "CURRENT_STATE_DIR=${{ github.event.inputs.current-state-dir || 's3://avalanchego-bootstrap-testing/cchain-current-state-hashdb-full-100.zip' }}" | ||
} >> "$GITHUB_ENV" | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-go-for-project | ||
- name: Run C-Chain Re-Execution | ||
uses: ./.github/actions/run-monitored-tmpnet-cmd | ||
with: | ||
run: ./scripts/run_task.sh reexecute-cchain-range-with-copied-data EXECUTION_DATA_DIR=${{ github.workspace }}/reexecution-data BENCHMARK_OUTPUT_FILE=${{ github.workspace }}/reexecute-cchain-range-benchmark-res.txt | ||
prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }} | ||
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} | ||
grafana_dashboard_id: 'Gl1I20mnk/c-chain' | ||
loki_username: ${{ secrets.LOKI_ID || '' }} | ||
loki_password: ${{ secrets.LOKI_PASSWORD || '' }} | ||
runtime: "" # Set runtime input to empty string to disable log collection | ||
- name: Download Previous Benchmark Result | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-reexecute-cchain-range-benchmark.json | ||
- name: Compare Benchmark Results | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
tool: 'go' | ||
output-file-path: ${{ github.workspace }}/reexecute-cchain-range-benchmark-res.txt | ||
external-data-json-path: ./cache/${{ runner.os }}-reexecute-cchain-range-benchmark.json | ||
fail-on-alert: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
summary-always: true | ||
comment-on-alert: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# This script runs the C-Chain re-execution benchmark with a single iteration. | ||
# It expects the following environment variables to be set: | ||
# SOURCE_BLOCK_DIR: Path or S3 URL to the source block directory or zip. | ||
# CURRENT_STATE_DIR: Path or S3 URL to the current state directory or zip. | ||
# START_BLOCK: The starting block height (exclusive). | ||
# END_BLOCK: The ending block height (inclusive). | ||
# LABELS (optional): Comma-separated key=value pairs for metric labels. | ||
# BENCHMARK_OUTPUT_FILE (optional): If set, benchmark output is also written to this file. | ||
|
||
: "${SOURCE_BLOCK_DIR:?SOURCE_BLOCK_DIR must be set}" | ||
: "${CURRENT_STATE_DIR:?CURRENT_STATE_DIR must be set}" | ||
: "${START_BLOCK:?START_BLOCK must be set}" | ||
: "${END_BLOCK:?END_BLOCK must be set}" | ||
|
||
cmd="go test -timeout=0 -v -benchtime=1x -bench=BenchmarkReexecuteRange -run=^$ github.com/ava-labs/avalanchego/tests/reexecute/c --source-block-dir=\"${SOURCE_BLOCK_DIR}\" --target-dir=\"${CURRENT_STATE_DIR}\" --start-block=\"${START_BLOCK}\" --end-block=\"${END_BLOCK}\" ${LABELS:+--labels=\"${LABELS}\"}" | ||
|
||
if [ -n "${BENCHMARK_OUTPUT_FILE:-}" ]; then | ||
eval "$cmd" | tee "${BENCHMARK_OUTPUT_FILE}" | ||
else | ||
eval "$cmd" | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Usage: ./scripts/copy_dir.sh source_directory destination_directory | ||
# Sources can be S3 URLs (s3://bucket/path) or a local file path | ||
# Assumes s5cmd has been installed and is available in the PATH. | ||
# s5cmd is included in the nix dev shell. | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "Usage: $0 <source_directory> <destination_directory>" | ||
echo "S3 Example: $0 's3://bucket1/path1' /dest/dir" | ||
echo "Local Example: $0 '/local/path1' /dest/dir" | ||
exit 1 | ||
fi | ||
|
||
SRC="$1" | ||
DST="$2" | ||
|
||
# Ensure destination directory exists | ||
mkdir -p "$DST" | ||
|
||
# Function to copy from a single source to destination | ||
copy_source() { | ||
local source="$1" | ||
local dest="$2" | ||
|
||
# Check if source starts with s3:// | ||
if [[ "$source" == s3://* ]]; then | ||
echo "Copying from S3: $source -> $dest" | ||
# Use s5cmd to copy from S3 | ||
time s5cmd cp "$source" "$dest" | ||
|
||
# If we copied a zip, extract it in place | ||
if [[ "$source" == *.zip ]]; then | ||
echo "Extracting zip file in place" | ||
time unzip "$dest"/*.zip -d "$dest" | ||
rm "$dest"/*.zip | ||
fi | ||
else | ||
echo "Copying from local filesystem: $source -> $dest" | ||
# Use cp for local filesystem with recursive support | ||
if [ -d "$source" ]; then | ||
time cp -r "$source"/* "$dest/" | ||
elif [ -f "$source" ]; then | ||
time cp "$source" "$dest/" | ||
else | ||
echo "Warning: Source not found: $source" | ||
return 1 | ||
fi | ||
fi | ||
} | ||
|
||
copy_source "$SRC" "$DST" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future improvement: consider replacing with rclone