Remove curr and next and build off xdr main with features#519
Remove curr and next and build off xdr main with features#519leighmcculloch merged 31 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the curr/next XDR channels and updates the Rust generator / library to consume a single stellar-xdr main with feature-based conditional compilation, including parsing XDR #ifdef/#else/#endif and emitting Rust #[cfg(...)] gates.
Changes:
- Removed
curr/nextmodules, features, CLI channel selection, and updated docs/build/tests to use a single root API. - Added lexer/parser/AST support for
#ifdef/#else/#endifand propagated cfg info into generated Rust via templates. - Updated generator output types and added generator tests asserting emitted
#[cfg(...)]attributes.
Reviewed changes
Copilot reviewed 56 out of 1007 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| xdr-generator-rust/xdr-parser/src/tests/parser.rs | Updates parser expectations (semicolon in source, new cfg fields) and adds extensive #ifdef parsing tests. |
| xdr-generator-rust/xdr-parser/src/tests/lexer.rs | Adds lexer tests for #ifdef/#else/#endif tokenization. |
| xdr-generator-rust/xdr-parser/src/parser.rs | Implements conditional directive parsing, cfg stacks, and attaches cfg to definitions / inline enum & union elements. |
| xdr-generator-rust/xdr-parser/src/lexer.rs | Adds preprocessor directive tokens and directive identifier parsing helper. |
| xdr-generator-rust/xdr-parser/src/ast.rs | Introduces CfgExpr, adds cfg fields to AST nodes, and nests namespaces. |
| xdr-generator-rust/generator/templates/union.rs.jinja | Emits #[cfg(...)] for unions/arms and reworks VARIANTS* to accommodate cfg-gated arms. |
| xdr-generator-rust/generator/templates/typedef_newtype.rs.jinja | Emits #[cfg(...)] for typedef newtypes and associated impls. |
| xdr-generator-rust/generator/templates/typedef_alias.rs.jinja | Emits #[cfg(...)] on typedef aliases. |
| xdr-generator-rust/generator/templates/type_enum.rs.jinja | Emits cfg-gated TypeVariant/Type variants and reworks VARIANTS* to accommodate cfg-gated types. |
| xdr-generator-rust/generator/templates/struct.rs.jinja | Emits #[cfg(...)] for structs and their impl blocks. |
| xdr-generator-rust/generator/templates/enum.rs.jinja | Emits #[cfg(...)] for enums/members and reworks VARIANTS* to accommodate cfg-gated members. |
| xdr-generator-rust/generator/templates/const.rs.jinja | Emits #[cfg(...)] for consts. |
| xdr-generator-rust/generator/src/tests/mod.rs | Registers new generator-focused test module. |
| xdr-generator-rust/generator/src/tests/generator.rs | Adds tests asserting generated Rust contains expected #[cfg(...)] output for #ifdef constructs. |
| xdr-generator-rust/generator/src/output.rs | Adds cfg fields to output structs and introduces TypeEnumEntry for cfg-aware type enums. |
| xdr-generator-rust/generator/src/generator.rs | Propagates parsed cfg into output structs, and computes cfg-aware TypeEnumEntry list. |
| xdr | Switches to a single stellar-xdr submodule (main branch). |
| tests/vecm.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_small.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_read_edge_cases.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_prot18.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_hash.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_debug_display.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_base64_skip_whitespace.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/tx_auths.rs | Simplifies cfg gating after channel removal. |
| tests/stringm.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/str.rs | Removes curr-only gating and uses root stellar_xdr exports. |
| tests/serde_tx_schema.rs | Removes curr-only gating and uses root stellar_xdr exports. |
| tests/serde_tx.rs | Removes curr-only gating and uses root stellar_xdr exports. |
| tests/serde_ints.rs | Removes curr-only gating and uses root stellar_xdr exports. |
| tests/serde.rs | Removes channel gating and references root types consistently. |
| tests/ledgerkey_to_key.rs | Removes curr/next feature gating and uses root stellar_xdr exports. |
| tests/default.rs | Simplifies cfg gating after channel removal. |
| tests/arbitrary.rs | Updates arbitrary test to target root API rather than next. |
| tests/account_conversions.rs | Removes curr/next feature gating and uses root exports. |
| src/str.rs | Switches internal imports to crate::num128/num256 after module flattening. |
| src/scval_validations.rs | Updates tests to use root ScSymbol rather than next::ScSymbol. |
| src/next/tx_hash.rs | Removes next-channel implementation file. |
| src/next/tx_auths.rs | Removes next-channel implementation file. |
| src/next/transaction_conversions.rs | Removes next-channel implementation file. |
| src/next/str.rs | Removes next-channel string impls file. |
| src/next/scval_conversions.rs | Removes next-channel conversions file. |
| src/next/scmap.rs | Removes next-channel scmap helpers file. |
| src/next/mod.rs | Removes next module root. |
| src/next/ledgerkey.rs | Removes next-channel ledgerkey helpers file. |
| src/next/jsonschema.rs | Removes next-channel jsonschema helpers file. |
| src/next/default.rs | Removes next-channel defaults file. |
| src/next/account_conversions.rs | Removes next-channel conversions file. |
| src/lib.rs | Removes channels from public API and docs; flattens generated + helper modules into root. |
| src/curr/scval_validations.rs | Removes curr-channel implementation file. |
| src/curr/mod.rs | Removes curr module root. |
| src/cli/xfile/mod.rs | Drops channel argument plumbing for xfile subcommands. |
| src/cli/version.rs | Updates version output to single XDR revision. |
| src/cli/types/schema_files.rs | Removes per-channel schema_file generation; iterates root TypeVariant. |
| src/cli/types/schema.rs | Removes per-channel schema subcommand; uses root TypeVariant. |
| src/cli/types/list.rs | Removes channel selection; lists root TypeVariant. |
| src/cli/types.rs | Drops channel arg plumbing for types subcommands. |
| src/cli/mod.rs | Removes Channel enum and CLI +curr/+next selection. |
| src/cli/guess.rs | Collapses per-channel decoding errors and iterates root type variants. |
| src/cli/generate/default.rs | Collapses per-channel XDR writing errors and uses root API. |
| src/cli/generate/arbitrary.rs | Collapses per-channel errors and uses root API. |
| src/cli/generate.rs | Drops channel argument plumbing for generate subcommands. |
| src/cli/encode.rs | Collapses per-channel JSON/XDR errors and uses root TypeVariant/Type. |
| src/cli/decode.rs | Collapses per-channel XDR errors and uses root TypeVariant/Type. |
| src/cli/compare.rs | Collapses per-channel compare logic and uses root TypeVariant/Type. |
| README.md | Removes channel documentation and updates CLI examples. |
| Makefile | Switches generation/build targets to single xdr tree and single xdr-version. |
| Cargo.toml | Removes curr/next features, updates defaults and CLI feature composition, adds placeholder XDR feature. |
| CONTRIBUTING.md | Updates regeneration instructions for single xdr submodule and output file. |
| .gitmodules | Replaces two submodules with a single xdr submodule on main. |
| .github/workflows/rust.yml | Updates wasm clippy step to no longer require curr,next features. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| run_x!(run_curr, curr); | ||
| run_x!(run_next, next); | ||
| run_x!(run_inner); |
Check failure
Code scanning / CodeQL
Cleartext logging of sensitive information High
Copilot Autofix
AI about 1 month ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
|
|
||
| run_x!(run_curr, curr); | ||
| run_x!(run_next, next); | ||
| run_x!(run_inner); |
Check failure
Code scanning / CodeQL
Cleartext logging of sensitive information High
Copilot Autofix
AI about 1 month ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
|
|
||
| run_x!(run_curr, curr); | ||
| run_x!(run_next, next); | ||
| run_x!(run_inner); |
Check failure
Code scanning / CodeQL
Cleartext logging of sensitive information High
Copilot Autofix
AI about 1 month ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
What
Remove curr and next and build off xdr main with features.
Why
Stellar XDR now has a single main branch with features. While the curr and next branches still exist as preprocessed views of the XDR, this Rust library as of #515 has gotten support for consuming the main XDR with its features, and so the fixed curr and next features inside this library are no longer needed.
Close #497