Skip to content

network: preserve reqresp error codes - #1054

Merged
ch4r10t33r merged 3 commits into
mainfrom
fix/hive-reqresp-1784546141
Jul 21, 2026
Merged

network: preserve reqresp error codes#1054
ch4r10t33r merged 3 commits into
mainfrom
fix/hive-reqresp-1784546141

Conversation

@zclawz

@zclawz zclawz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • bump zig-libp2p to blockblaz/zig-libp2p@a46f4e1
  • use the new coded reqresp error API from zeam's inbound server stream
  • preserve INVALID_REQUEST response-code bytes for malformed/invalid reqresp requests instead of just closing the stream

Supporting dependency PR: blockblaz/zig-libp2p#300

Hive context

Suite: https://hive.leanroadmap.org/suite.html?suiteid=1784546141-eb3090c7f9b766cd983e0fb631c26ad7.json&suitename=reqresp&client=zeam_devnet5

The zeam-owned reqresp failures include two explicit protocol assertions:

  • reqresp/blocks_by_range/zero_count: expected INVALID_REQUEST
  • reqresp/blocks_by_range/too_many_blocks: expected INVALID_REQUEST

Zeam's node handler already calls responder.sendError(constants.RPC_ERR_INVALID_REQUEST, ...), but the zig-libp2p QUIC responder path discarded that numeric code and only closed the response stream. Hive's mock reqresp peer expects an actual response chunk whose first byte is 1, so it observed the wrong wire behavior.

This PR wires the error code through zeam -> zig-libp2p -> QUIC response framing, producing a non-success reqresp response-code chunk before stream close.

Notes

The same Hive report also contains zeam failures where the client does not produce/catch up to non-genesis blocks within the harness timeout. I traced those separately through status-driven sync and block serving; they are not fixed by this narrow wire-protocol patch and likely need a follow-up focused on checkpoint-sync/status catch-up behavior.

The report also includes many non-zeam failures caused by other clients failing startup; this PR only changes zeam-owned behavior.

Validation

  • zig fmt --check pkgs/network/src/ethlibp2p.zig
  • git diff --check
  • zig build --fetch --summary none
  • zig-libp2p dependency branch: zig build test --summary all (508 passed, 2 skipped)
  • zeam zig build test --summary all was started with Zig 0.16.0, but this local container still cannot complete the repo target because rustup is absent (failed to spawn ... rustup: FileNotFound); lightweight Zig package groups reached before the slow proof/STF phase passed.

@zclawz

zclawz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Status: ready for review, with scoped coverage.

This PR addresses the reqresp wire-protocol failures where Hive expected INVALID_REQUEST response code 1 for invalid BlocksByRange requests. The zeam handler already selected code 1; zig-libp2p was dropping it and only closing the stream. Supporting dependency PR: blockblaz/zig-libp2p#300

Validation:

  • zeam: zig fmt --check pkgs/network/src/ethlibp2p.zig, git diff --check, zig build --fetch --summary none
  • zig-libp2p dependency: zig build test --summary all passed (508 passed, 2 skipped)
  • zeam full test target still cannot complete in this local image because rustup is missing; lightweight Zig package groups reached before the slow proof/STF phase passed.

Remaining from the Hive report: the zeam did not produce blocks / catch up from status failures appear to be a separate sync/catch-up root cause, not fixed by this PR.

@zclawz

zclawz commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Done.

Updated PR #1054 to consume zig-libp2p v0.2.90:

  • build.zig.zon now uses https://github.com/blockblaz/zig-libp2p/archive/refs/tags/v0.2.90.tar.gz
  • package hash updated to zig_libp2p-0.2.90-lil2hHdyKgAfzB0t9KNYv1G-esu4FB0q1R8Wjp2mJVKI
  • pushed commit: 2776c09b5163099c858536411f9086fd393cc5e2

Validation run locally:

  • zig fetch https://github.com/blockblaz/zig-libp2p/archive/refs/tags/v0.2.90.tar.gz passed and produced the committed hash
  • zig build --fetch --summary none passed
  • git diff --check passed

I could not run the full build/test suite in this image because PATH has Zig 0.15.2, while the branch/dependencies require Zig 0.16.0. I attempted to fetch the 0.16.0 toolchain side-by-side under /tmp, but the download was too slow for this Telegram turn, so I stopped it after the dependency update was pushed.

@ch4r10t33r ch4r10t33r left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ch4r10t33r
ch4r10t33r merged commit 00620bf into main Jul 21, 2026
10 checks passed
@ch4r10t33r
ch4r10t33r deleted the fix/hive-reqresp-1784546141 branch July 21, 2026 09:30
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.

2 participants