Skip to content

Conversation

@VolodymyrBg
Copy link
Contributor

This change removes the unconditional ENR serialization in compareForkENR and makes it lazy-only for logging/error paths with a safe fallback to peer.String(). The function is invoked in the discovery hot path via filterPeer, so doing a base64+RLP encode for every candidate—even for the common match case—wastes CPU and allocations. Other call sites serialize ENR strings only when needed (e.g., RPC responses), so this aligns with established patterns. The core compatibility checks remain unchanged; we simply avoid failing the function due to an auxiliary logging serialization failure.

prestonvanloon
prestonvanloon previously approved these changes Nov 21, 2025
Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@prestonvanloon
Copy link
Member

Does not build though.

beacon-chain/p2p/fork.go:55:16: peer.String undefined (type *enr.Record has no field or method String)

@VolodymyrBg
Copy link
Contributor Author

Does not build though.

beacon-chain/p2p/fork.go:55:16: peer.String undefined (type *enr.Record has no field or method String)

corrected, must be ok i think

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