Skip to content

Antiflood supernova config#7651

Merged
ssd04 merged 22 commits into
feat/supernova-async-execfrom
antiflood-supernova-config
Feb 6, 2026
Merged

Antiflood supernova config#7651
ssd04 merged 22 commits into
feat/supernova-async-execfrom
antiflood-supernova-config

Conversation

@ssd04

@ssd04 ssd04 commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

  • Add separate Antiflood config for supernova with round activation
  • Integrate in antiflood components

Testing procedure

  • Standard system test

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@ssd04 ssd04 self-assigned this Jan 29, 2026
}

func (qfp *quotaFloodPreventer) getBbaseMaxNumMessagesPerPeer() uint32 {
if qfp.name == antiflood.OutputIdentifier {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there is custom handling here for this case, because some of the variables are not available in this config struct and they are set 0 by default

initialAntifloodConf := antifloodConfigsHandler.GetCurrentConfig()

// TODO: this config section have to be loaded with new configration from the start
cacheConfig := storageFactory.GetCacherFromConfig(initialAntifloodConf.Cache)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we might need to update Cacher component to set limit dynamically by round if we want to change it dynamically

Comment on lines +700 to +701
[[Antiflood.ConfigsByRound]]
Round = 440

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will have to update config variables for supernova

}

mainThrottler, err := throttler.NewNumGoRoutinesThrottler(args.NumConcurrentResolvingJobs)
currentConfig := args.AntifloodConfigsHandler.GetCurrentConfig()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this config part is not dynamic, it will load only based on the config at boot time
in order to make it dynamic we have to change GoRountinesThrottler from core

"github.com/multiversx/mx-chain-go/config"
)

func floodPreventerConfigFetcher(confHandler common.AntifloodConfigsHandler, identifier string) config.FloodPreventerConfig {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is a bit hacky, but it's due to the fact that we have 4 flood preventer components and 3 of them use config.FloodPreventerConfig and one is based on another config. Before it was handled statically in factory, but now we have to set the configuration dynamically, and there was need for some custom handling

@@ -627,71 +621,151 @@

[Antiflood]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO: move antiflood config to a separate file

@ssd04 ssd04 marked this pull request as ready for review January 30, 2026 13:51
@codecov

codecov Bot commented Feb 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.66013% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.57%. Comparing base (c635e8b) to head (7915425).

Files with missing lines Patch % Lines
...e/antiflood/floodPreventers/quotaFloodPreventer.go 67.34% 10 Missing and 6 partials ⚠️
common/configs/antifloodConfigs.go 92.30% 4 Missing and 3 partials ⚠️
factory/core/coreComponentsHandler.go 0.00% 6 Missing ⚠️
node/chainSimulator/components/coreComponents.go 50.00% 3 Missing and 1 partial ⚠️
...ottle/antiflood/blackList/p2pBlackListProcessor.go 85.18% 2 Missing and 2 partials ⚠️
...s/throttle/antiflood/factory/p2pOutputAntiflood.go 76.92% 2 Missing and 1 partial ⚠️
...esolverscontainer/metaResolversContainerFactory.go 60.00% 1 Missing and 1 partial ⚠️
...solverscontainer/shardResolversContainerFactory.go 60.00% 1 Missing and 1 partial ⚠️
factory/core/coreComponents.go 71.42% 1 Missing and 1 partial ⚠️
process/throttle/antiflood/factory/common.go 81.81% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@                      Coverage Diff                      @@
##           feat/supernova-async-exec    #7651      +/-   ##
=============================================================
- Coverage                      77.59%   77.57%   -0.03%     
=============================================================
  Files                            877      879       +2     
  Lines                         121752   121849      +97     
=============================================================
+ Hits                           94476    94526      +50     
- Misses                         21008    21032      +24     
- Partials                        6268     6291      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +38 to +39
antifloodConfigs common.AntifloodConfigsHandler,
configFetcher antiflood.FloodPreventerConfigFetcher,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why not extend AntifloodConfigsHandler, to have new method GetCurrentConfigByType?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

or, instead of [[Antiflood.ConfigsByRound]] -> [Antiflood.ConfigsByRound.FastReacting] have something like [Antiflood] -> [[Antiflood.FastReactingByRound]]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i wanted to keep the flow as similar as before, not expose those type consts and keep them in that package (at least that's what a thought when i started the refactoring there).
Yes, it might be better to change the config, will analyse more now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed config and refactored this part

}
if config.Antiflood.Enabled {
return initP2PAntiFloodComponents(ctx, config, statusHandler, currentPid, processConfigsHandler)
if antifloodConfigsHandler.IsEnabled() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missing nil check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

ctx context.Context,
antifloodConfigsHandler common.AntifloodConfigsHandler,
) (process.P2PAntifloodHandler, error) {
if antifloodConfigsHandler.IsEnabled() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here, missing nil check

[Antiflood.ConfigsByRound.PeerMaxOutput]
BaseMessagesPerInterval = 150
TotalSizePerInterval = 2097152 #2MB/s
[Antiflood.ConfigsByRound.PeerMaxOutput.PeerMaxInput]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this needed? 🤔

@ssd04 ssd04 Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, in order to make it work with GetConfigByType i had to change it to use the same base config struct (until now 3 flood preventers were using FloodPreventerConfig and one was using directly AntifloodLimitsConfig - which is part of FloodPreventerConfig - with the other variables set to 0 in factory)

Comment thread process/throttle/antiflood/common.go Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove the entire file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

sstanculeanu
sstanculeanu previously approved these changes Feb 5, 2026
Comment thread config/config.go
ConfigsByRound []AntifloodConfigByRound
}

type AntifloodConfigByRound struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

missing comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

miiu96
miiu96 previously approved these changes Feb 5, 2026
sstanculeanu
sstanculeanu previously approved these changes Feb 5, 2026
@ssd04 ssd04 dismissed stale reviews from sstanculeanu and miiu96 via fcefb4e February 5, 2026 13:29
@ssd04 ssd04 merged commit 354c04e into feat/supernova-async-exec Feb 6, 2026
8 of 9 checks passed
@ssd04 ssd04 deleted the antiflood-supernova-config branch February 6, 2026 12:21
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