Skip to content

Conversation

@Snezhkko
Copy link
Contributor

This change corrects the remainder handling in Compact::from_compact implementations for AlloyWithdrawal, AlloyHeader, and AlloyGenesisAccount by returning the advanced buffer slice produced by the inner helper’s from_compact rather than the original input slice. The Compact trait contract in storage/codecs/src/lib.rs explicitly requires from_compact to return the object and the buffer advanced past the consumed bytes; the previous code violated this by discarding the advanced slice. While vector decoding masks this behavior in some contexts by ignoring the inner remainder and manually advancing, these wrappers still broke the contract and could lead to subtle parsing errors in composed decoders that rely on the returned remainder. The fix is minimal and consistent with other alloy implementations (e.g., authorization_list and all transaction wrappers) that already propagate the advanced buffer correctly, ensuring correctness and future-proofing without changing encoding layouts or introducing allocations.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 21, 2025

CodSpeed Performance Report

Merging #19899 will improve performances by 10.77%

Comparing Snezhkko:fix/compact-advance-buf-alloy-wrappers (a1f4619) with main (0ba1229)

Summary

⚡ 1 improvement
✅ 76 untouched
⏩ 4 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Change
size 100000 | updated 0.1% | depth 4 1.4 ms 1.3 ms +10.77%

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

@joshieDo does this matter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants