Minor test fix#5197
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates BannedAccountsPersistor tests to address a UBSan-reported ordering/sorting assumption.
Changes:
- Switches the “Keys are sorted” check in
BannedAccountsPersistorTeststo usegetBannedAccounts()instead ofgetBannedAccountStrKeys().
Comments suppressed due to low confidence (1)
src/main/test/BannedAccountsPersistorTests.cpp:52
persistor.getBannedAccounts()returnsstd::set<AccountID>, but this section still treatskeysas a string container:std::find(..., addr1/addr2)(std::string) won’t compile againstAccountID. Either keep usinggetBannedAccountStrKeys()here, or convertaddr1/addr2toAccountIDand usekeys.find(...)(and consider dropping/adjusting thestd::is_sortedassertion since astd::setis already ordered).
auto keys = persistor.getBannedAccounts();
REQUIRE(keys.size() == 2);
// Keys are sorted
REQUIRE(std::is_sorted(keys.begin(), keys.end()));
REQUIRE(std::find(keys.begin(), keys.end(), addr1) != keys.end());
bac319d to
3911270
Compare
sisuresh
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ubsan flagged a minor sorting bug in tests