Skip to content

Conversation

gballet
Copy link
Member

@gballet gballet commented Aug 7, 2025

Implement the binary tree as specified in eip-7864. This will gradually replace verkle trees in the codebase. This is only running the tests and will not be executed in production, but will help me rebase some of my work, so that it doesn't bitrot as much.

@gballet gballet requested a review from rjl493456442 as a code owner August 7, 2025 14:40
@gballet gballet added the verkle label Aug 7, 2025
trie/binary.go Outdated
NodeResolverFn func([]byte, common.Hash) ([]byte, error)
)

type BinaryNode interface {
Copy link
Contributor

@omerfirmak omerfirmak Aug 8, 2025

Choose a reason for hiding this comment

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

It would've been nice if we didn't have a node interface. It makes reasoning about and optimizing for
allocations much harder imo.

@gballet gballet changed the title trie{,/utils}: add tests for eip7864 binary trees trie{,/utils}: add eip7864 binary trees and run its tests Aug 12, 2025
@gballet gballet changed the title trie{,/utils}: add eip7864 binary trees and run its tests trie{,/utils,/bintrie}: add eip7864 binary trees and run its tests Aug 13, 2025
@fjl fjl removed the status:triage label Aug 14, 2025
// This will cover HashedNode but that should be fine since the
// root node should always be resolved.
return nil, errInvalidRootType
}
Copy link
Member Author

Choose a reason for hiding this comment

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

could be simpler without the switch, just call the interface method

Copy link
Member Author

Choose a reason for hiding this comment

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

actually I just double-checked and GetValueAtStem isn't an interface method.

@gballet gballet force-pushed the add-binary-tree-tests branch from 295fd38 to 1fe759c Compare August 25, 2025 13:49
gballet and others added 3 commits August 25, 2025 15:24
Signed-off-by: Guillaume Ballet
<3272758+gballet@users.noreply.github.com>
- Add binary trie implementation in trie/bintrie package
- Implement InternalNode, StemNode, Empty, and HashedNode types
- Add comprehensive test coverage for binary trie operations
- Switch from blake3 to sha256 hashing for compatibility
- Add iterator functionality for binary trie traversal
- Update PrevalueTracer interface to support binary operations
- Include proper error handling and edge case coverage

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
@gballet gballet force-pushed the add-binary-tree-tests branch from 1fe759c to c5db47c Compare August 25, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants