Skip to content

Conversation

@lakshya-sky
Copy link
Contributor

@lakshya-sky lakshya-sky commented Nov 27, 2025

Motivation

  • This would also allow us to filter out peers on wrong network or fork.

Description

Towards #5423

* uses similar flow as lookup
* store node records for future purposes
@lakshya-sky lakshya-sky requested a review from a team as a code owner November 27, 2025 18:17
@lakshya-sky lakshya-sky changed the title perodically fetch node records from peers. feat(l1): perodically fetch node records from peers. Nov 27, 2025
@lakshya-sky lakshya-sky changed the title feat(l1): perodically fetch node records from peers. feat(l1): periodically fetch node records from peers. Nov 27, 2025
}

/// Record a response received. Check previously saved hash and reset it if it matches
pub async fn record_enr_response_received(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this function is not used (and so, neither the RecordEnrResponseReceived message) because when we receive a ENRResponse we should record it directly (set_node_record), right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've instead removed set_node_record and record_enr_response_received would set it directly after matching the hash.

.try_into()
.expect("first 32 bytes are the message hash");

if self.udp_socket.send_to(&buf, contact.node.udp_addr())
Copy link
Contributor

@ElFantasma ElFantasma Dec 2, 2025

Choose a reason for hiding this comment

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

Now it seems we have two kind of messages that save the hash. We may want to refactor it to have a single send_and_get_hash function (or some better naming 😬) to implement this logic only once.
It can be done on a different PR, though

Copy link
Contributor

@ElFantasma ElFantasma left a comment

Choose a reason for hiding this comment

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

This looks good to me

Thanks Lakshya for your contribution!


pub n_find_node_sent: u64,
/// ENR associated with this contact, if it was provided by the peer.
pub record: Option<NodeRecord>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should set this to None if we receive a PING with a different seq-num. I opened issue #5488 for that

@ElFantasma ElFantasma added this pull request to the merge queue Dec 2, 2025
Merged via the queue into lambdaclass:main with commit 70463a1 Dec 2, 2025
42 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Dec 5, 2025
**Motivation**

Now that we are #5446 from
peers, we can filter valid contacts to initiate RLPx connections on
lookup.


Closes #5506
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.

3 participants