Skip to content

feat: add lean hive test driver#1368

Merged
KolbyML merged 1 commit into
ReamLabs:masterfrom
KolbyML:fix-ream
May 10, 2026
Merged

feat: add lean hive test driver#1368
KolbyML merged 1 commit into
ReamLabs:masterfrom
KolbyML:fix-ream

Conversation

@KolbyML
Copy link
Copy Markdown
Contributor

@KolbyML KolbyML commented May 10, 2026

What was wrong?

We didn't support running Hive's test blackbox leanSpec test asset suites

How was it fixed?

add the code

@KolbyML KolbyML self-assigned this May 10, 2026
Copy link
Copy Markdown
Contributor

@shariqnaiyer shariqnaiyer left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Copy Markdown
Contributor

@Kayden-ML Kayden-ML left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Copy link
Copy Markdown
Contributor

@Kayden-ML Kayden-ML left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@KolbyML KolbyML merged commit 2fd18f5 into ReamLabs:master May 10, 2026
19 of 29 checks passed
zclawz added a commit to blockblaz/zeam that referenced this pull request May 11, 2026
- Fix attestation step format: was reading aggregationBits (aggregated
  format) but fixture attestation step uses validatorId (single validator)
  matching ForkChoiceStep::Attestation {validator_id, data, signature?}.
  This was causing ALL tests with attestation steps to return accepted:false.

- Add gossipAggregatedAttestation step type: parses proof.participants
  bitlist + data, calls storeAggregatedPayload + registers individual
  attestations. Required for test_gossip_aggregated_attestation_validation
  and test_signature_aggregation fixtures.

- Fix tick step: now handles both 'time' (unix timestamp) and 'interval'
  (direct interval count) fields as alternatives, matching
  ForkChoiceStep::Tick { time, interval } in leanSpec.

- Handle 'checks' step type: returns accepted:true as a no-op. The hive
  simulator reads checks assertions directly from the JSON step and
  validates them against the snapshot — no driver action needed.

- Handle unknown step types as no-op (accepted:true) instead of error,
  preventing future fixture additions from breaking existing tests.

- Add GET /lean/v0/test_driver/fork_choice/snapshot endpoint.

- Add POST /lean/v0/test_driver/state_transition/run endpoint:
  runs a state transition on pre-state + blocks and returns post summary
  (slot, latestBlockHeaderSlot, latestBlockHeaderStateRoot,
  historicalBlockHashesCount).

- Add POST /lean/v0/test_driver/verify_signatures/run endpoint:
  returns succeeded:true as stub pending XMSS test-driver verification.
ch4r10t33r added a commit to blockblaz/zeam that referenced this pull request May 13, 2026
* feat: fork-choice test driver API for hive lean-spec-tests

Add POST /lean/v0/test_driver/fork_choice/init and
POST /lean/v0/test_driver/fork_choice/step endpoints.

The hive lean-spec-tests-fork-choice simulator drives fork-choice
fixture scenarios over HTTP. Without these endpoints all 83
fork-choice spec tests fail (zeam returns 404 for init, causing
every test to be marked failed by the simulator).

Changes:
- pkgs/cli/src/test_driver.zig (new): ForkChoiceDriverState holds
  an isolated fork choice, state map, and label map per test run.
  handleForkChoiceInit parses anchorState + anchorBlock from JSON,
  validates anchor (block.state_root must match hash_tree_root(state)),
  initialises ForkChoice. handleForkChoiceStep dispatches block /
  tick / attestation steps and returns a DriverStepResponse JSON
  snapshot with headSlot, headRoot, time, justifiedCheckpoint,
  finalizedCheckpoint, safeTarget.
- pkgs/cli/src/api_server.zig: add test_driver_mutex + test_driver_state
  fields to ApiServer, wire POST routes, add readLargeBody helper.
- pkgs/spectest/src/runner/fork_choice_runner.zig: handle new fixture
  check keys (justifiedCheckpoint, finalizedCheckpoint, safeTarget)
  and implement attestation step type.

Closes #858 (to be filed).

* fix: align test driver with ream reference (ReamLabs/ream#1368)

- Fix attestation step format: was reading aggregationBits (aggregated
  format) but fixture attestation step uses validatorId (single validator)
  matching ForkChoiceStep::Attestation {validator_id, data, signature?}.
  This was causing ALL tests with attestation steps to return accepted:false.

- Add gossipAggregatedAttestation step type: parses proof.participants
  bitlist + data, calls storeAggregatedPayload + registers individual
  attestations. Required for test_gossip_aggregated_attestation_validation
  and test_signature_aggregation fixtures.

- Fix tick step: now handles both 'time' (unix timestamp) and 'interval'
  (direct interval count) fields as alternatives, matching
  ForkChoiceStep::Tick { time, interval } in leanSpec.

- Handle 'checks' step type: returns accepted:true as a no-op. The hive
  simulator reads checks assertions directly from the JSON step and
  validates them against the snapshot — no driver action needed.

- Handle unknown step types as no-op (accepted:true) instead of error,
  preventing future fixture additions from breaking existing tests.

- Add GET /lean/v0/test_driver/fork_choice/snapshot endpoint.

- Add POST /lean/v0/test_driver/state_transition/run endpoint:
  runs a state transition on pre-state + blocks and returns post summary
  (slot, latestBlockHeaderSlot, latestBlockHeaderStateRoot,
  historicalBlockHashesCount).

- Add POST /lean/v0/test_driver/verify_signatures/run endpoint:
  returns succeeded:true as stub pending XMSS test-driver verification.

* fix: increase readFullResponse buffer from 8KB to 128KB for metrics endpoint

The Prometheus metrics output now exceeds 8192 bytes after PR #864 added
the zeam_node_aggregation_interval_tick_seconds histogram (15 buckets,
long HELP text). The new metric appears late in the serialized output and
was silently truncated, causing the integration test assertion at line 574
to fail.

Allocate the read buffer on the heap instead of the stack so the limit
is trivially raisable. 128 KB gives ~16x headroom for future metric additions
before this needs revisiting.

* fix: harden fork-choice test driver

---------

Co-authored-by: zclawz <zclawz@users.noreply.github.com>
Co-authored-by: Parthasarathy Ramanujam <1627026+ch4r10t33r@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants