Skip to content

[Feat]: allow external TxBuilder injection on FixtureExecutor via WithExtraTxBuilders (PLA-125) #64

[Feat]: allow external TxBuilder injection on FixtureExecutor via WithExtraTxBuilders (PLA-125)

[Feat]: allow external TxBuilder injection on FixtureExecutor via WithExtraTxBuilders (PLA-125) #64

Workflow file for this run

name: Internal SDK Tests
on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- "run/**"
- "compare/**"
- "simharness/**"
- "instrument/**"
- "corpus/**"
- "x/**"
- "go.mod"
- "go.sum"
permissions:
contents: read
pull-requests: write
jobs:
simulate:
runs-on: ubuntu-latest
env:
PRIVATE_SDK_REPOSITORY: ${{ vars.PRIVATE_SDK_REPOSITORY }}
PRIVATE_SDK_REF: ${{ vars.PRIVATE_SDK_REF }}
PRIVATE_SDK_TOKEN: ${{ secrets.PRIVATE_SDK_TOKEN }}
PRIVATE_SDK_DIR: /tmp/private-sdk
PRIVATE_COMET_REPOSITORY: ${{ vars.PRIVATE_COMET_REPOSITORY }}
PRIVATE_COMET_REF: ${{ vars.PRIVATE_COMET_REF }}
PRIVATE_COMET_TOKEN: ${{ secrets.PRIVATE_COMET_TOKEN }}
PRIVATE_COMET_DIR: /tmp/private-comet
GOPRIVATE: ${{ vars.GOPRIVATE }}
steps:
- name: Checkout blockstm-sim
uses: actions/checkout@v4
with:
path: blockstm-sim
- name: Checkout SDK source
run: |
set -euo pipefail
if [ -z "${PRIVATE_SDK_REPOSITORY}" ] || [ -z "${PRIVATE_SDK_REF}" ] || [ -z "${PRIVATE_SDK_TOKEN}" ]; then
echo "::error::PRIVATE_SDK_REPOSITORY, PRIVATE_SDK_REF, and PRIVATE_SDK_TOKEN must be configured."
exit 1
fi
rm -rf "${PRIVATE_SDK_DIR}"
git clone --quiet --depth=1 \
"https://x-access-token:${PRIVATE_SDK_TOKEN}@github.com/${PRIVATE_SDK_REPOSITORY}.git" \
"${PRIVATE_SDK_DIR}"
git -C "${PRIVATE_SDK_DIR}" fetch --quiet --depth=1 origin "${PRIVATE_SDK_REF}"
git -C "${PRIVATE_SDK_DIR}" checkout --quiet FETCH_HEAD
- name: Checkout consensus source
if: ${{ vars.PRIVATE_COMET_REPOSITORY != '' && vars.PRIVATE_COMET_REF != '' }}
run: |
set -euo pipefail
token="${PRIVATE_COMET_TOKEN:-${PRIVATE_SDK_TOKEN}}"
if [ -z "${token}" ]; then
echo "::error::A token is required to checkout the configured consensus source."
exit 1
fi
rm -rf "${PRIVATE_COMET_DIR}"
git clone --quiet --depth=1 \
"https://x-access-token:${token}@github.com/${PRIVATE_COMET_REPOSITORY}.git" \
"${PRIVATE_COMET_DIR}"
git -C "${PRIVATE_COMET_DIR}" fetch --quiet --depth=1 origin "${PRIVATE_COMET_REF}"
git -C "${PRIVATE_COMET_DIR}" checkout --quiet FETCH_HEAD
- name: Verify SDK layout
run: |
set -euo pipefail
if [ ! -f "${PRIVATE_SDK_DIR}/go.mod" ]; then
echo "::error::SDK go.mod not found."
exit 1
fi
if [ ! -f "${PRIVATE_SDK_DIR}/store/go.mod" ]; then
echo "::error::SDK store module not found."
exit 1
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache: true
cache-dependency-path: blockstm-sim/go.sum
- name: Prepare internal modfile
working-directory: blockstm-sim
run: |
set -euo pipefail
cp go.mod go.internal.mod
cp go.sum go.internal.sum
go mod edit -modfile=go.internal.mod -replace github.com/cosmos/cosmos-sdk="${PRIVATE_SDK_DIR}"
go mod edit -modfile=go.internal.mod -replace cosmossdk.io/store="${PRIVATE_SDK_DIR}/store"
if [ -n "${PRIVATE_COMET_REPOSITORY}" ]; then
if [ ! -d "${PRIVATE_COMET_DIR}" ]; then
echo "::error::PRIVATE_COMET_REPOSITORY is set but ${PRIVATE_COMET_DIR} does not exist. Consensus source checkout may have been skipped."
exit 1
fi
go mod edit -modfile=go.internal.mod -replace github.com/cometbft/cometbft="${PRIVATE_COMET_DIR}"
fi
go mod tidy -modfile=go.internal.mod
- name: Build simharness+canary binary
working-directory: blockstm-sim
run: go build -modfile=go.internal.mod -tags "sdk_hooks simharness simharness_canary" -o build/blockstm-sim ./cmd/blockstm-sim
- name: Run keeper lint against SDK source
working-directory: blockstm-sim
run: |
./build/blockstm-sim lint \
--sdk-path "${PRIVATE_SDK_DIR}" \
--format json \
> keeper-lint-report.json 2>&1 || true
echo "keeper-lint complete (report-only, findings do not block CI until audited)"
- name: Upload keeper lint report
if: always()
uses: actions/upload-artifact@v4
with:
name: keeper-lint-report
path: blockstm-sim/keeper-lint-report.json
if-no-files-found: warn
- name: Run internal tests
working-directory: blockstm-sim
run: go test -modfile=go.internal.mod -tags "sdk_hooks simharness simharness_canary" ./...
- name: Run simulation corpus
id: sim
working-directory: blockstm-sim
run: |
set +e
./build/blockstm-sim --record-off run \
--corpus corpus/fixtures \
--format markdown \
> simulation-report.md 2>&1
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
- name: Upload simulation report
if: always()
uses: actions/upload-artifact@v4
with:
name: simulation-report
path: blockstm-sim/simulation-report.md
if-no-files-found: warn
- name: Post PR comment
if: always() && github.event_name == 'pull_request'
env:
SIM_EXIT: ${{ steps.sim.outputs.exit_code }}
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const reportPath = 'blockstm-sim/simulation-report.md';
let body;
if (fs.existsSync(reportPath)) {
body = fs.readFileSync(reportPath, 'utf8');
} else {
body = '**Simulation report not found.** The build may have failed before the simulation ran.';
}
const exitCode = process.env.SIM_EXIT;
const header = exitCode === '0'
? '## Simulation Passed\n\n'
: '## Simulation FAILED (exit ' + exitCode + ')\n\n';
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: header + body,
});
- name: Fail if simulation failed
if: always() && steps.sim.outputs.exit_code != '0'
env:
SIM_EXIT: ${{ steps.sim.outputs.exit_code }}
run: |
echo "Simulation exited with code ${SIM_EXIT}"
exit 1