Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ jobs:
source test_suite_env/bin/activate
./fetch_and_generate.sh

- name: Verify generated code is up to date
run: |
git diff --exit-code src/test_suite/protos/ src/test_suite/flatbuffers/

- name: Check dependencies
run: |
source test_suite_env/bin/activate
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[submodule "shlr/flatbuffers"]
path = shlr/flatbuffers
url = https://github.com/firedancer-io/flatbuffers.git
branch = v25.9.23-patches
branch = v25.12.19-patches
[submodule "shlr/protosol"]
path = shlr/protosol
url = https://github.com/firedancer-io/protosol.git
branch = v5.1.0
branch = v5.3.0
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ repos:
entry: test -d src/test_suite/flatbuffers/org
files: \.fbs$
pass_filenames: false
- id: check-protobuf-version
name: Check protobuf generated code matches pinned runtime
language: system
entry: bash scripts/check_protobuf_version.sh
files: (_pb2\.py$|pyproject\.toml$|buf\.gen\.yaml$)
pass_filenames: false
- id: check-quick-import
name: Quick Python import check
language: system
entry: bash scripts/check_quick_import.sh
files: (_pb2\.py$|flatbuffers_utils\.py$|/flatbuffers/)
pass_filenames: false
2 changes: 1 addition & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: v1
plugins:
- plugin: buf.build/protocolbuffers/python:v34.0
- plugin: buf.build/protocolbuffers/python:v34.1
out: src/test_suite/protos
25 changes: 25 additions & 0 deletions scripts/check_protobuf_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"

PINNED=$(grep "protobuf==" "$REPO_ROOT/pyproject.toml" | grep -oP "\d+\.\d+\.\d+")
if [ -z "$PINNED" ]; then
echo "WARNING: Could not find protobuf version pin in pyproject.toml"
exit 0
fi

FAILED=0
for f in "$REPO_ROOT"/src/test_suite/protos/*_pb2.py; do
GENVER=$(grep "Protobuf Python Version:" "$f" 2>/dev/null | grep -oP "\d+\.\d+\.\d+" || true)
if [ -n "$GENVER" ] && [ "$GENVER" != "$PINNED" ]; then
echo "ERROR: $f was generated for protobuf $GENVER but pyproject.toml pins $PINNED"
FAILED=1
fi
done

if [ "$FAILED" -eq 1 ]; then
echo ""
echo "Fix: update buf.gen.yaml plugin version, then run ./fetch_and_generate.sh"
exit 1
fi
20 changes: 20 additions & 0 deletions scripts/check_quick_import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"

if [ ! -f "$REPO_ROOT/test_suite_env/bin/activate" ]; then
# No venv -- skip (CI will catch issues)
exit 0
fi

source "$REPO_ROOT/test_suite_env/bin/activate"
PYTHONPATH="$REPO_ROOT/src" python -c "
from test_suite.protos import invoke_pb2
from test_suite.flatbuffers_utils import FLATBUFFERS_AVAILABLE
print('imports OK')
" || {
echo ""
echo "ERROR: Python imports failed. Regenerate with: ./fetch_and_generate.sh"
exit 1
}
2 changes: 1 addition & 1 deletion shlr/flatbuffers
Submodule flatbuffers updated 536 files
22 changes: 0 additions & 22 deletions src/test_suite/block/codec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ def _encode_prev_vote_account(pva):
pva.node_pubkey = fd58.enc32(pva.node_pubkey)


def _decode_stake_delegation(sd):
if sd.stake_account:
sd.stake_account = fd58.dec32(sd.stake_account)
if sd.vote_account:
sd.vote_account = fd58.dec32(sd.vote_account)


def _encode_stake_delegation(sd):
if sd.stake_account:
sd.stake_account = fd58.enc32(sd.stake_account)
if sd.vote_account:
sd.vote_account = fd58.enc32(sd.vote_account)


def decode_input(context: block_pb.BlockContext):
"""
Decode BlockContext fields in-place into human-readable format.
Expand Down Expand Up @@ -60,10 +46,6 @@ def decode_input(context: block_pb.BlockContext):
for i in range(len(context.bank.vote_accounts_t_2)):
_decode_prev_vote_account(context.bank.vote_accounts_t_2[i])

# T-1 Stake delegations
for i in range(len(context.bank.stake_delegations_t_1)):
_decode_stake_delegation(context.bank.stake_delegations_t_1[i])

# Blockhash queue
for i in range(len(context.bank.blockhash_queue)):
context.bank.blockhash_queue[i].blockhash = fd58.dec32(
Expand Down Expand Up @@ -99,10 +81,6 @@ def encode_input(context: block_pb.BlockContext):
for i in range(len(context.bank.vote_accounts_t_2)):
_encode_prev_vote_account(context.bank.vote_accounts_t_2[i])

# T-1 Stake delegations
for i in range(len(context.bank.stake_delegations_t_1)):
_encode_stake_delegation(context.bank.stake_delegations_t_1[i])

# Blockhash queue
for i in range(len(context.bank.blockhash_queue)):
context.bank.blockhash_queue[i].blockhash = fd58.enc32(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def HashIsNone(self):
return False


def CreateXXHash(builder, hash):
def CreateXxhash(builder, hash):
builder.Prep(1, 8)
for _idx0 in range(8 , 0, -1):
builder.PrependUint8(hash[_idx0-1])
Expand Down
6 changes: 3 additions & 3 deletions src/test_suite/flatbuffers_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def build_fb_elf_fixture(
input_offset = FB_ELFLoaderCtx_mod.End(builder)

# Build output (ELFLoaderEffects)
# XXHash is an inline struct -- CreateXXHash must be called immediately
# XXHash is an inline struct -- CreateXxhash must be called immediately
# before the corresponding Add call (between Start and End).
output_offset = None
if effects is not None:
Expand All @@ -848,15 +848,15 @@ def build_fb_elf_fixture(
FB_ELFLoaderEffects_mod.Start(builder)
FB_ELFLoaderEffects_mod.AddErrCode(builder, effects.get("err_code", 0))
if rodata_hash_bytes and len(rodata_hash_bytes) >= 8:
rodata_hash_offset = FB_XXHash_mod.CreateXXHash(
rodata_hash_offset = FB_XXHash_mod.CreateXxhash(
builder, list(rodata_hash_bytes[:8])
)
FB_ELFLoaderEffects_mod.AddRodataHash(builder, rodata_hash_offset)
FB_ELFLoaderEffects_mod.AddTextCnt(builder, effects.get("text_cnt", 0))
FB_ELFLoaderEffects_mod.AddTextOff(builder, effects.get("text_off", 0))
FB_ELFLoaderEffects_mod.AddEntryPc(builder, effects.get("entry_pc", 0))
if calldests_hash_bytes and len(calldests_hash_bytes) >= 8:
calldests_hash_offset = FB_XXHash_mod.CreateXXHash(
calldests_hash_offset = FB_XXHash_mod.CreateXxhash(
builder, list(calldests_hash_bytes[:8])
)
FB_ELFLoaderEffects_mod.AddCalldestsHash(builder, calldests_hash_offset)
Expand Down
32 changes: 15 additions & 17 deletions src/test_suite/protos/block_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading