Skip to content

Conversation

@phrwlk
Copy link
Contributor

@phrwlk phrwlk commented Nov 27, 2025

The capacity guard in fromSnapshot used >= against 2^DepositContractDepth, rejecting snapshots whose deposit_count exactly equals the tree capacity. This contradicts both our fromSnapshotParts implementation, which explicitly handles the equality case by returning a FinalizedNode, and the EIP‑4881 reference implementation where deposits == 2**level is valid. Changing the check to a strict > makes equality acceptable, preventing false rejections of full trees and keeping behavior consistent with the spec and the rest of the code.

return nil, ErrInvalidSnapshotRoot
}
if snapshot.depositCount >= math.PowerOf2(uint64(DepositContractDepth)) {
if snapshot.depositCount > math.PowerOf2(uint64(DepositContractDepth)) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a good candidate for a regression test. Do you have a specific case already which could be added here?

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