Skip to content

fix(AggLayer): use correct byte<>Felt conversion#2387

Merged
mmagician merged 9 commits intoagglayer-newfrom
mmagician-fix-compute-ger
Feb 6, 2026
Merged

fix(AggLayer): use correct byte<>Felt conversion#2387
mmagician merged 9 commits intoagglayer-newfrom
mmagician-fix-compute-ger

Conversation

@mmagician
Copy link
Collaborator

@mmagician mmagician commented Feb 2, 2026

Switch to using bytes_to_packed_u32_felts which reads the bytes as LE instead of BE, eliminating the mismatch:

// Compute expected GER using keccak256
let expected_ger_preimage = KeccakPreimage::new(ger_preimage.clone());
let expected_ger_felts: [Felt; 8] = expected_ger_preimage.digest().as_ref().try_into().unwrap();

let ger_bytes = felts_to_u256_bytes(expected_ger_felts);

let ger = ExitRoot::from(ger_bytes);
// sanity check
assert_eq!(ger.to_elements(), expected_ger_felts); // <----------- this would fail, bc. to_elements called into BE-conversion

while at it, I unified the underlying representation of ExitRoot and SmtNode to a single Keccak256Output (any thoughts on the naming?) and use type aliases instead.

@mmagician mmagician marked this pull request as ready for review February 2, 2026 16:25
@mmagician mmagician added the agglayer PRs or issues related to AggLayer bridging integration label Feb 2, 2026
@mmagician mmagician marked this pull request as draft February 2, 2026 19:10
@mmagician mmagician marked this pull request as ready for review February 3, 2026 19:04
@mmagician mmagician requested review from bobbinth and Copilot February 3, 2026 19:12

This comment was marked as resolved.

Copy link
Contributor

@partylikeits1983 partylikeits1983 left a comment

Choose a reason for hiding this comment

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

Looks good!

However, should we merge agglayer-fixed-2 into next, then delete agglayer and create a new agglayer branch which is up to date with next?

Then rebase this PR off of next?

Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
Base automatically changed from agglayer-fixed-2 to next February 5, 2026 09:14
@mmagician mmagician changed the base branch from next to agglayer-new February 5, 2026 09:18
@mmagician mmagician merged commit b8c256d into agglayer-new Feb 6, 2026
15 checks passed
@mmagician mmagician deleted the mmagician-fix-compute-ger branch February 6, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agglayer PRs or issues related to AggLayer bridging integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants