Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test to verify MAX_SUBSCRIBED_TOPICS constant #9163

Merged

Conversation

StefanBratanov
Copy link
Contributor

PR Description

Instead of hardcoding, we can compute MAX_SUBSCRIBED_TOPICS based on the highest supported milestone.

Fixed Issue(s)

N/A

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.

@zilm13
Copy link
Contributor

zilm13 commented Feb 24, 2025

I'd oppose this:

  1. You should keep subscribed to the topics on previous fork for 2 epochs. So the actual number is sum and it hits cap when you have forks one by one. It could be the sum of the 3.
  2. Less code is better code
  3. We don't pay for big hardcoded number, it has 0 memory or whatever consequences

@zilm13
Copy link
Contributor

zilm13 commented Feb 24, 2025

Ahh I see, you multiply by 3, but we have no guarantee that fork-1 has less topics. So it's just another place for a new bug

@zilm13
Copy link
Contributor

zilm13 commented Feb 24, 2025

What I think we could keep - test that highest fork + (fork-1) + (fork-2) topics is less than hardcoded number. So it will fail in future if we hardcode something not enough today.

@StefanBratanov
Copy link
Contributor Author

What I think we could keep - test that highest fork + (fork-1) + (fork-2) topics is less than hardcoded number. So it will fail in future if we hardcode something not enough today.

I like the idea of a test actually more!

@StefanBratanov StefanBratanov changed the title Make MAX_SUBSCRIBED_TOPICS dynamic Add a test to verify MAX_SUBSCRIBED_TOPICS constant Feb 24, 2025
@tbenr
Copy link
Contributor

tbenr commented Feb 24, 2025

I like the test-only approach :)

Copy link
Contributor

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

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

LGTM
but if I turn on super-paranoid mode, I'd find max of all forks first and then multiply by 3.

@StefanBratanov StefanBratanov force-pushed the max_subscribed_topics_dynamic branch from 842eb34 to 05c6ced Compare March 4, 2025 13:47
@StefanBratanov StefanBratanov enabled auto-merge (squash) March 4, 2025 13:48
@StefanBratanov StefanBratanov merged commit 8479214 into Consensys:master Mar 4, 2025
16 checks passed
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