Adapt to CAP-0071 xdr#5233
Conversation
| V_25, | ||
| V_26, | ||
| V_27, | ||
| V_UINT32_MAX = UINT32_MAX, |
There was a problem hiding this comment.
We could clean this up, along with the interface of the protocol checking functions to add general support for enabling/disabling protocol features at runtime.
There was a problem hiding this comment.
Pull request overview
This PR adapts Stellar Core’s build + Rust/C++ bridge to work with CAP-0071-style feature-gated XDR (via #ifdef in .x files) on a single stellar-xdr branch, and introduces protocol-27 Soroban plumbing for “next protocol” builds.
Changes:
- Add CAP-0071 build plumbing: propagate
CAP_0071to xdrc/C++ andcap_0071/nextCargo features, plus add protocol-27 Soroban host/module-cache support. - Rework XDR identity verification: canonicalize
.xfile hashes (strip#ifdef/#else/#endif+ whitespace) and add a C++↔Rust “enabled XDR features” comparison. - Update Rust bridge/version reporting to include XDR feature list and add a new p27 dep-tree expectation.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/ProtocolVersion.h | Adds protocol 27 and defines FIRST_PROTOCOL_CAP71 gated by CAP_0071. |
| src/rust/src/soroban_proto_any.rs | Refactors Soroban version info generation; now reports XDR pkg/git/base rev + features via per-proto helpers. |
| src/rust/src/soroban_proto_all.rs | Introduces p27 module (cfg next), switches soroban_curr to p27 in next builds, and wires p27 into dispatch. |
| src/rust/src/soroban_module_cache.rs | Adds a protocol-27 module cache and routes protocol 27 operations to it when enabled. |
| src/rust/src/dep-trees/p27-expect.txt | Adds expected dependency tree snapshot for the new p27 submodule. |
| src/rust/src/common.rs | Adjusts Rust-side XDR identity check to new stellar_quorum_analyzer XDR layout. |
| src/rust/src/bridge.rs | Extends SorobanVersionInfo with xdr_features for C++ consumption. |
| src/rust/Cargo.toml | Adds optional unified dependency for soroban-env-host-p27 and updates stellar-quorum-analyzer rev. |
| src/main/main.cpp | Updates/extends XDR identity checking with feature comparison and changes when the check runs. |
| src/Makefile.am | Removes protocol-next hashing path; adds CAP_0071 defines for xdrc, passes cap_0071 Cargo feature, and includes p27 in next builds. |
| hash-xdrs.sh | Changes hash generation to canonicalize by stripping ifdef blocks + whitespace. |
| docs/versioning-soroban.md | Updates documentation describing “next” build behavior with CAP feature-gated XDR. |
| configure.ac | Adds ENABLE_CAP_0071 automake conditional (currently tied to next-protocol builds). |
| common.mk | Removes protocol-next include path; adds -DCAP_0071 when enabled. |
| Cargo.lock | Updates lockfile for new/updated Rust dependencies. |
| .gitmodules | Removes protocol-next submodule, points protocol-curr/xdr at main, adds p27 Soroban submodule. |
Comments suppressed due to low confidence (1)
src/rust/src/soroban_proto_all.rs:1372
- This comment refers to a
soroban-vnextfeature, but this crate’s feature flag is namednext(and that’s what the build system passes). Updating the comment would prevent confusion when diagnosing protocol/version mismatches.
// This check should be safe to keep. The feature soroban-vnext is passed
// through to soroban-env-host-p{NN}/next and so should enable protocol
// support for the next version simultaneously in core and soroban; and we
| if (Config::CURRENT_LEDGER_PROTOCOL_VERSION != 26) | ||
| { | ||
| checkXDRFileIdentity(); | ||
| } |
There was a problem hiding this comment.
The XDR identity check is currently skipped when Config::CURRENT_LEDGER_PROTOCOL_VERSION == 26 (which is the repo’s current protocol version). This effectively disables the C++↔Rust XDR mismatch safeguard for default/production builds. Please avoid shipping with this check disabled; instead, consider keeping the p26-compatible hash comparison (eg conditional hashing mode when CAP_0071 is not enabled), or updating the Rust-side p26 XDR hash generation to the same canonicalization so the check can run for protocol 26 as well.
| path = src/protocol-next/xdr | ||
| url = https://github.com/stellar/stellar-xdr | ||
| branch = next | ||
| #TODO: change name |
There was a problem hiding this comment.
The added #TODO: change name is ambiguous in .gitmodules (it’s not clear what name should change or why). Consider either removing it or replacing it with a more specific note (eg. what should be renamed and when), ideally with an issue/PR reference.
| #TODO: change name |
dmkozh
left a comment
There was a problem hiding this comment.
Let's keep this as is for the time being, we can iterate on it further.
| path = src/protocol-next/xdr | ||
| url = https://github.com/stellar/stellar-xdr | ||
| branch = next | ||
| #TODO: change name |
Description
This is an alternative to #5214.
The differences -
CAP-0071is set if vnext is enabled. That can be added as a follow up if needed. A core build that has CAP-0071 support shouldn't break downstream systems that don't have support for CAP-0071 transactions, so the flags may not be as helpful. We can add it for the purpose of seeing how it'll flow through, but we may not learn much.FIRST_PROTOCOL_CAP71is introduced and the value is gated on if the CAP-0071 compile time flag is enabled. This is just an implementation detail and something we've discussed before. This lets us only guard the XDR changes with ifdefs, and not the protocol changes.Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)