Skip to content

Remove limits on sub-items from spec definitions#285

Merged
leighmcculloch merged 2 commits intocurrfrom
remove-element-limits
Oct 9, 2025
Merged

Remove limits on sub-items from spec definitions#285
leighmcculloch merged 2 commits intocurrfrom
remove-element-limits

Conversation

@leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Sep 26, 2025

What

Remove fixed element limits from UDT struct fields, union cases, enum cases error enum cases, function inputs, and event params, essentially changing the max from the specified maxes to u32::MAX.

Why

Early on during Soroban's development we set limits on a lot of the new types to make decoding safer. However we quickly discovered that type of limiting was insufficient and we removed the limits and for XDR limits we now instead use some other strategies by measuring bytes and depth. However when we removed the limits from the new contract types we didn't remove the limits from the spec types and they remained. A couple times the limits have caused problems and with the limits being largely arbitrary they should be removed.

Related conversation: https://stellarfoundation.slack.com/archives/C08NEGD4PPG/p1758877637503109

Merging

This is a non-breaking change with regards to the XDR binary, but it is a breaking change with regards to the Rust library that is generated from the XDR. It's a breaking change because the max limits are encoded into the types via generic parameters. So the safest time to make this change is during the next major version, v24.

@leighmcculloch leighmcculloch marked this pull request as ready for review September 26, 2025 10:28
@leighmcculloch leighmcculloch changed the title Remove limits on sub-item limits from spec definitions Remove limits on sub-items from spec definitions Sep 26, 2025
@leighmcculloch leighmcculloch merged commit 0a621ec into curr Oct 9, 2025
3 checks passed
@leighmcculloch leighmcculloch deleted the remove-element-limits branch October 9, 2025 23:08
sisuresh pushed a commit to sisuresh/stellar-xdr-next that referenced this pull request Nov 26, 2025
sisuresh added a commit that referenced this pull request Nov 26, 2025
Co-authored-by: Leigh <351529+leighmcculloch@users.noreply.github.com>
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

Comments