Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
78e1d71
add borrowed Ref variants of generated types
leighmcculloch Jul 27, 2026
3c2c077
fix VecMRef Copy bound and cfg-branch Ref lifetime
leighmcculloch Jul 27, 2026
1fd5d24
impl WriteXdr for Ref types
leighmcculloch Jul 28, 2026
552d5d0
format ref_types test with rustfmt
leighmcculloch Jul 28, 2026
d6774bc
regenerate Ref types without ungated CAP cfgs
leighmcculloch Aug 5, 2026
b6bf245
alias Ref types that do not borrow
leighmcculloch Aug 5, 2026
61db46c
rename borrowing Ref types to View
leighmcculloch Aug 6, 2026
6580c72
emit View only for unconditional borrowers
leighmcculloch Aug 6, 2026
69ec52c
give View const try_from_slice/try_from_str
leighmcculloch Aug 25, 2026
19442e2
rename View panic ctors to try_from_*_or_panic
leighmcculloch Sep 2, 2026
bc91d27
use xdr size consts in View types
leighmcculloch Sep 5, 2026
d4f6049
rewrite View tests around mirror invariants
leighmcculloch Sep 7, 2026
7da9d61
convert Views to owned through an IntoOwned trait
leighmcculloch Sep 7, 2026
1fb121d
make IntoOwned crate-private
leighmcculloch Sep 7, 2026
152bc05
convert Views to owned from a reference
leighmcculloch Sep 7, 2026
b95b6b4
box cyclic View fields at the call site
leighmcculloch Sep 7, 2026
9c3fd4c
convert Views to owned by value
leighmcculloch Sep 7, 2026
e4090fc
spell out the identity IntoOwned impls
leighmcculloch Sep 7, 2026
75ffca2
trim redundancy from the View tests
leighmcculloch Sep 7, 2026
01a42aa
remove doc
leighmcculloch Sep 7, 2026
dd3daa9
rewrite View tests around owned mirrors
leighmcculloch Sep 7, 2026
d1722e1
gate the View tests by feature
leighmcculloch Sep 7, 2026
71095d8
rename the View suffix to Ref
leighmcculloch Sep 7, 2026
35fc497
share the envelope fixture between tests
leighmcculloch Sep 7, 2026
629d891
rename ref and owned fixture helpers
leighmcculloch Sep 8, 2026
e3144c7
format transactionenvelope in doc comment
leighmcculloch Sep 8, 2026
6b51bfd
put const XDR encoding on ConstWriter
leighmcculloch Sep 2, 2026
4db69f5
render const writer methods from the template
leighmcculloch Sep 7, 2026
c0e860d
carry the Ref rename into the const writer
leighmcculloch Sep 7, 2026
552499c
check const bytes against a hand-built owned
leighmcculloch Sep 7, 2026
d2318f0
shrink const xdr test suite to single envelope test that covers all b…
leighmcculloch Sep 8, 2026
b2bc25d
hand-write the scalar option and vec writers
leighmcculloch Sep 8, 2026
2c50bb3
drop the const writer's residual module path
leighmcculloch Sep 8, 2026
0c498db
simplify the const writer template
leighmcculloch Sep 8, 2026
e384b9b
turn Ref types into const-only Const types
leighmcculloch Sep 8, 2026
c7f453b
emit a Const form for cfg-gated heap types
leighmcculloch Sep 8, 2026
3b92d6d
Merge branch 'main' into const-only-xdr-types
leighmcculloch Sep 9, 2026
ee1136e
gate generated Const types behind const feature
leighmcculloch Sep 10, 2026
fc8753d
move const types into a const module, drop suffix
leighmcculloch Sep 11, 2026
881a386
document the const feature
leighmcculloch Sep 11, 2026
c8935d0
derive Arbitrary for the const types
leighmcculloch Sep 11, 2026
ec72926
assert const unit tests on the const module
leighmcculloch Sep 11, 2026
2541a29
add differential fuzz targets for const encoding
leighmcculloch Sep 12, 2026
9caab08
merge main, porting const output onto generate_files
leighmcculloch Sep 14, 2026
87ef0ff
derive const_type at use sites, drop the field
leighmcculloch Sep 14, 2026
5711c0e
run the fuzz corpus in ci
leighmcculloch Sep 14, 2026
dd44273
shorten asan leak detection comment
leighmcculloch Sep 14, 2026
4bdc302
move fuzzing config from github actions to makefile
leighmcculloch Sep 15, 2026
1273121
replace assertion with panic for mismatched construction
leighmcculloch Sep 15, 2026
5c4f04d
add leak justification comments to arbitrary impls
leighmcculloch Sep 15, 2026
d1c9e83
switch xdr types to const only
leighmcculloch Sep 15, 2026
c4b4ddb
fuzz
leighmcculloch Sep 15, 2026
f885036
reduce corpus using claude and json repr
leighmcculloch Sep 15, 2026
6c49dc9
implement arbitrary for const generic xdr types and fix arb for owned…
leighmcculloch Sep 15, 2026
6971048
remove generator source prerequisites from generated.rs rule
leighmcculloch Sep 15, 2026
7bb95e2
remove mut from konst_xdr_len
leighmcculloch Sep 15, 2026
7d54aaa
remove ledger-close-meta and transaction-envelope fuzz targets
leighmcculloch Sep 15, 2026
13366c9
match owned and const xdr errors
leighmcculloch Sep 15, 2026
194cf20
add fuzz-corpus-json target
leighmcculloch Sep 15, 2026
ee204d4
remove extra blank line in Makefile
leighmcculloch Sep 15, 2026
633ccc7
fix malformed backslash in makefile loop
leighmcculloch Sep 15, 2026
e1594b6
remove fuzz-corpus-json make target
leighmcculloch Sep 15, 2026
2d8f34f
remove transaction-envelope and ledger-close-meta fuzz targets
leighmcculloch Sep 15, 2026
17093ad
delete const_arbitrary.rs test
leighmcculloch Sep 15, 2026
a6d6788
add const and owned spec entry test values
leighmcculloch Sep 15, 2026
cc186fb
pass loop depth to const encode
leighmcculloch Sep 15, 2026
89e7cd9
Fix error message for missing generated file
leighmcculloch Sep 15, 2026
fd816e9
remove fuzz-coverage make target
leighmcculloch Sep 15, 2026
ad3f39b
replace transaction-envelope with spec-entry in fuzz readme
leighmcculloch Sep 15, 2026
d456264
remove write_xdr impl for &T
leighmcculloch Sep 15, 2026
24d67b0
Merge remote-tracking branch 'origin/const-only-xdr-types' into const…
leighmcculloch Sep 15, 2026
ac5f13b
add const to xdr type imports
leighmcculloch Sep 15, 2026
6eded8f
add const to xdr types
leighmcculloch Sep 15, 2026
40a63ed
use rand for test data generation
leighmcculloch Sep 15, 2026
ca6ca37
remove fuzz-corpus-json target
leighmcculloch Sep 15, 2026
e6b65f5
Merge remote-tracking branch 'origin/main' into const-only-xdr-types
leighmcculloch Sep 15, 2026
c0e9639
regenerate const module after merging main
leighmcculloch Sep 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 17 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

complete:
if: always()
needs: [generate, fmt, readme, prepare, build, test, publish-dry-run]
needs: [generate, fmt, readme, prepare, build, test, fuzz-corpus, publish-dry-run]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
Expand Down Expand Up @@ -140,7 +140,23 @@
- run: cargo version
- run: cargo test ${{ matrix.feature-args }}

fuzz-corpus:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- uses: stellar/binaries@v55
with:
name: cargo-fuzz
version: 0.13.1
- run: rustup install nightly
- run: rustup default nightly
- name: Run fuzz corpus
run: make fuzz
- name: Check no diffs exist
run: git add -N . && git diff HEAD --exit-code

publish-dry-run:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
if: github.event_name == 'push' || startsWith(github.head_ref, 'release/')
strategy:
matrix:
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ sha2 = { version = "0.10.9", optional = true }
[dev-dependencies]
serde_json = "1.0.89"
bytes-lit = "0.0.5"
rand = "0.9.0"

[features]
default = ["std"]
Expand All @@ -52,6 +53,7 @@ ms_close_time = []

# Features available without any new dependencies.
type_enum = []
const = []

# Features dependent on optional dependencies.
base64 = ["std", "dep:base64"]
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: all test build doc install readme fuzz fuzz-reduce watch generate generate-files clean fmt publish

export RUSTFLAGS=-Dwarnings -Dclippy::all -Dclippy::pedantic

CARGO_HACK_ARGS=--feature-powerset --exclude-features default --group-features base64,serde,arbitrary,hex,rand
Expand Down Expand Up @@ -27,6 +29,16 @@ readme:
| jq -r '"# stellar-xdr\n\n" + .index[.root|tostring].docs' \
> README.md

# Run the fuzz corpus.
# Leak detection is disabled because the fuzzer tests the const impls that
# contain &'static data and so their Arbitrary impls explicitly leak.
fuzz:
ASAN_OPTIONS=detect_leaks=0 cargo +nightly fuzz run spec-entry -- -rss_limit_mb=0 -max_len=10240 -runs=0
Comment thread
leighmcculloch marked this conversation as resolved.

# Shrinks each corpus to the smallest set of inputs with the same coverage.
fuzz-reduce:
ASAN_OPTIONS=detect_leaks=0 cargo +nightly fuzz cmin spec-entry -- -rss_limit_mb=0

watch:
cargo watch --clear --watch-when-idle --shell '$(MAKE)'

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ only necessary to use utility functions that depend on serde_json.
6. `hex` – Enables support for hex in string representations of some types.
Automatically enabled when serde is enabled.
7. `schemars` – Enables support for JSON Schema generation. (Experimental)
8. `const` – Enables the `const` module, containing a form of every type
that can be constructed and encoded to XDR in a const context. Types that
own heap data have a borrowing counterpart in the module that wraps
`&'static` slices instead; the rest are re-exports of the owned types.
Every type in the module has `const_xdr_len` and `const_to_xdr` methods,
so XDR can be encoded at compile time into a fixed-size array. Requires no
additional dependencies and works without std or alloc. (Experimental)

Features marked experimental may disappear at anytime, see breaking changes
at anytime, or and may be minimal implementations instead of complete.
Expand Down
3 changes: 3 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
artifacts
coverage
Loading
Loading