Skip to content

feat(utils): reduce recursion in the Arrays sort to support larger arrays - #171

Merged
luiz-lvj merged 4 commits into
masterfrom
feat/arrays-larger-sort
Sep 17, 2026
Merged

luiz-lvj merged 4 commits into
masterfrom
feat/arrays-larger-sort

Conversation

@luiz-lvj

Copy link
Copy Markdown
Collaborator

Summary

Ports OpenZeppelin/openzeppelin-contracts#6324 from openzeppelin-contracts 5.7.0.

_quickSort now iterates on the larger partition and only recurses into the smaller one, bounding recursion depth so sorting large arrays no longer risks stack overflow. Changed in the scripts/generate/templates/Arrays.js template and regenerated into Arrays.sol.

@pepebndc pepebndc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@pepebndc

Copy link
Copy Markdown
Collaborator

Add a large-array sort test (random and pre-sorted input) so the bounded recursion depth is covered by CI.

…arrays

## Summary

Ports [OpenZeppelin/openzeppelin-contracts#6324](OpenZeppelin/openzeppelin-contracts#6324) from openzeppelin-contracts 5.7.0.

`_quickSort` now iterates on the larger partition and only recurses into the smaller one, bounding recursion depth so sorting large arrays no longer risks stack overflow. Changed in the `scripts/generate/templates/Arrays.js` template and regenerated into `Arrays.sol`.
@luiz-lvj
luiz-lvj force-pushed the feat/arrays-larger-sort branch from fc11482 to d367f56 Compare September 16, 2026 14:22
@luiz-lvj
luiz-lvj merged commit ef3cd72 into master Sep 17, 2026
16 of 18 checks passed
@luiz-lvj
luiz-lvj deleted the feat/arrays-larger-sort branch September 17, 2026 03:02
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