Skip to content

feat(network): add Zakura P2P stack with legacy gossip adapter#106

Merged
ValarDragon merged 1 commit into
ironwood-mainfrom
evan/zakura-01-p2p-stack
Jun 17, 2026
Merged

feat(network): add Zakura P2P stack with legacy gossip adapter#106
ValarDragon merged 1 commit into
ironwood-mainfrom
evan/zakura-01-p2p-stack

Conversation

@evan-forbes

@evan-forbes evan-forbes commented Jun 17, 2026

Copy link
Copy Markdown

Motivation

First in a stack of 3 PRs that land the Zakura native P2P networking layer into Ironwood. This PR introduces the foundational Zakura iroh-based P2P stack and a dual-stack legacy gossip adapter, so a node speaks both the new Zakura transport and the existing Zcash gossip protocol during the transition.

Stacked PRs (merge in order): 1) P2P stack + legacy adapter (this) → 2) discovery + header sync + block sync (#111) → 3) block-sync hardening/refactor/stabilization (#112).

Solution

  • New zebra-network/src/zakura/ module: iroh transport, handshake/upgrade prelude, control-handshake wire types, and the legacy gossip adapter + native bootstrap.
  • Default config flags v2_p2p (Zakura endpoint) and legacy_p2p (legacy Zcash networking), plus a reserved persistent iroh node secret-key surface.
  • Foundations used by the whole stack: the zebra-jsonl-trace crate (non-blocking JSONL tracing), local testnet genesis generation, an Ubuntu package command, and a 1000-block reorg window.

Tests

  • cargo clippy --workspace --all-targets and cargo fmt --all -- --check clean locally (with the default-release-binaries proptest-impl lightwalletd-grpc-tests zebra-checkpoints feature set).
  • This PR also carries two small fixes to pre-existing test issues exposed when building all targets against the updated ironwood-main base: threading the upstream advertised_services argument through peer_set::init test call sites, and a field_reassign_with_default cleanup in an acceptance test.

AI Disclosure

  • AI tools were used: Claude Code (Opus) for rebasing this branch onto ironwood-main, resolving merge conflicts, organizing commits, and drafting this description. The contributor is the responsible author.

PR Checklist

  • Conventional-commit title
  • Solution is tested (clippy/fmt/unit)
  • Changelog updated

Introduce the Zakura native P2P stack (iroh-based transport) with a
dual-stack legacy gossip adapter and native bootstrap, plus the
foundations it builds on: the JSONL tracing crate, local testnet
genesis generation, an Ubuntu package command, and a 1000-block
reorg window.
@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: cargo tokio is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: Cargo.lockcargo/tokio@1.52.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/tokio@1.52.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: cargo writeable is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?cargo/reqwest@0.12.28cargo/vergen-git2@9.1.0cargo/sentry@0.47.0cargo/reqwest@0.13.3cargo/color-eyre@0.6.5cargo/elasticsearch@8.17.0-alpha.1cargo/iroh@0.92.0cargo/writeable@0.6.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/writeable@0.6.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Comment thread supply-chain/config.toml
@@ -29,40 +29,40 @@ url = "https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/
url = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am not really looking at this file rn, I assume it comes from us being a fork

Comment on lines +301 to +304
assert!(enabled_peer_seen_by_disabled
.remote
.services
.contains(PeerServices::NODE_P2P_V2));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Its annoying how the zebra rust formatter makes everything take so many LOC lol

@ValarDragon

Copy link
Copy Markdown

AI finding #1:

  • The codec only allows 1kb messages in handshake
  • Zakura allows for a 4kb prelude
    • Stems from Iroh potentially taking 1.2kb if a peer gives a lot of IP's. (I don't understand why, but w/e)
  • Such peers would fail handshake
  • Codec is only re-configured to larger message limits after the handshake is complete.

@ValarDragon ValarDragon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We went through a bunch of review on Slack. Obviously didn't read all of this without a million comments. We did discuss the AI-found concerns, and the concerning ones are solved on a subsequent PR stacked on top

@ValarDragon
ValarDragon merged commit 00a1447 into ironwood-main Jun 17, 2026
21 checks passed
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