Skip to content

Conversation

zilm13
Copy link
Contributor

@zilm13 zilm13 commented Aug 14, 2025

PR Description

Include attnets, sync committees, das subnets

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

}

@Override
public List<Peer> selectPeersToDisconnect(
Copy link
Contributor

@StefanBratanov StefanBratanov Aug 18, 2025

Choose a reason for hiding this comment

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

So I have been looking at the code and this is called here:

    peerSelectionStrategy
        .selectPeersToDisconnect(network, peerPools)
        .forEach(
            peerToDrop ->
                peerToDrop.disconnectCleanly(DisconnectReason.TOO_MANY_PEERS).finishTrace(LOG));

So it disconnects for the reason TOO_MANY_PEERS. I wonder if it is better to have a different method which checks the false advertising peers and then fails with a new DisconnectReason. Probably something like FALSE_ADVERTISEMENT or something like that. Otherwise TOO_MANY_PEERS sounds wrong.

Copy link
Member

@lucassaldanha lucassaldanha Aug 18, 2025

Choose a reason for hiding this comment

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

Maybe we can change this method to return an object with the list of peers to disconnect and the reason for that group. This way, we can always report on the exact reason for disconnecting.

Copy link
Contributor

@StefanBratanov StefanBratanov Aug 19, 2025

Choose a reason for hiding this comment

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

Maybe we can change this method to return an object with the list of peers to disconnect and the reason for that group. This way, we can always report on the exact reason for disconnecting.

I like that actually, I guess more like a map DisconnectReason,List<Peer>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about this? d92d991
I cannot introduce a reason, they are specced (actually goodbye messages are specced, not the reasons, but this doesn't change much, we could use existing I think)

final SszBitvector syncCommitteeSubnets =
peerSubnetSubscriptions.getAttestationSubnetSubscriptions(peer.getId());
if (!syncCommitteeSubnets.isSuperSetOf(advertisedSyncCommitteeSubnets)) {
reputationManager.adjustReputation(peer.getAddress(), ReputationAdjustment.LARGE_PENALTY);
Copy link
Member

@lucassaldanha lucassaldanha Aug 19, 2025

Choose a reason for hiding this comment

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

Maybe we could add a debug entry here saying we are downscoring peer X (not sure if we log this somewhere else). This will make it a bit easier to see this mechanism in action. The same applies to the other checks below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added daf1b10

subnetPeerCountGauge),
reputationManager,
new AtomicReference<>(),
NodeIdToDataColumnSidecarSubnetsCalculator.NOOP,
Copy link
Member

Choose a reason for hiding this comment

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

Is this NOOP correct here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's test fixtures, don't need it at this point there, I think

@zilm13
Copy link
Contributor Author

zilm13 commented Aug 27, 2025

Version before adding cache:

23160 calls for 3 hours (~128 calls/minute)

50th percentile: 9 ms
90th percentile: 810 ms
95th percentile: 1487 ms
99th percentile: 3078 ms

Calls are made on different nio event threads
highest 10-20% looks very bad, looking for ways to improve

@zilm13
Copy link
Contributor Author

zilm13 commented Aug 28, 2025

Version with cache:

23408 calls during 3 hours (130 calls per minute)

50th percentile: 9 ms
90th percentile: 921 ms
95th percentile: 1696 ms
99th percentile: 3410 ms

Cache is not helping at all, trying another approach

@zilm13
Copy link
Contributor Author

zilm13 commented Aug 29, 2025

It's a final version.
No cache. Run every 5 seconds. Runtime is even worse, but is it important? It runs on separate thread and rarely (but it's nio thread)

50th percentile: 97 ms
90th percentile: 2365 ms
95th percentile: 3068 ms
99th percentile: 4386 ms

~6000 calls during 10 hours

@zilm13
Copy link
Contributor Author

zilm13 commented Aug 29, 2025

if we decide no merge, don't forget to make a pr for renaming subnet to group where it's applicable, it should be merged anyway

@zilm13 zilm13 marked this pull request as ready for review August 29, 2025 15:46
@zilm13 zilm13 changed the title Drop peers with false ENR subnet advertising [WIP] Drop peers with false ENR subnet advertising Aug 29, 2025
@tbenr
Copy link
Contributor

tbenr commented Sep 18, 2025

I tested this on fusaka-devnet-5 and seems like we consider peer lying on column subnets

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.

4 participants