Skip to content

Minor test fix#5197

Merged
marta-lokhova merged 1 commit into
stellar:masterfrom
marta-lokhova:bannedAccTestFix
Mar 30, 2026
Merged

Minor test fix#5197
marta-lokhova merged 1 commit into
stellar:masterfrom
marta-lokhova:bannedAccTestFix

Conversation

@marta-lokhova
Copy link
Copy Markdown
Contributor

ubsan flagged a minor sorting bug in tests

Copilot AI review requested due to automatic review settings March 30, 2026 16:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates BannedAccountsPersistor tests to address a UBSan-reported ordering/sorting assumption.

Changes:

  • Switches the “Keys are sorted” check in BannedAccountsPersistorTests to use getBannedAccounts() instead of getBannedAccountStrKeys().
Comments suppressed due to low confidence (1)

src/main/test/BannedAccountsPersistorTests.cpp:52

  • persistor.getBannedAccounts() returns std::set<AccountID>, but this section still treats keys as a string container: std::find(..., addr1/addr2) (std::string) won’t compile against AccountID. Either keep using getBannedAccountStrKeys() here, or convert addr1/addr2 to AccountID and use keys.find(...) (and consider dropping/adjusting the std::is_sorted assertion since a std::set is 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());

@marta-lokhova marta-lokhova enabled auto-merge March 30, 2026 18:04
@marta-lokhova marta-lokhova added this pull request to the merge queue Mar 30, 2026
Merged via the queue into stellar:master with commit 57ee5ed Mar 30, 2026
53 checks passed
@marta-lokhova marta-lokhova deleted the bannedAccTestFix branch March 30, 2026 18:55
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