fix: Address AI reviewer comments for Permission Delegation (#6675)

This commit is contained in:
yinyiqian1
2026-04-08 16:22:19 -04:00
committed by GitHub
parent 7793b5f10b
commit d52dd29d20
6 changed files with 29 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
#include <test/jtx/CaptureLogs.h>
#include <test/jtx/delegate.h>
#include <xrpl/ledger/helpers/DelegateHelpers.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Permissions.h>
@@ -1856,6 +1857,21 @@ class Delegate_test : public beast::unit_test::suite
"\n Action: Verify security requirements to interact with Delegation feature");
}
void
testDelegateUtilsNullptrCheck()
{
testcase("DelegateUtils nullptr check");
// checkTxPermission nullptr check
STTx const tx{ttPAYMENT, [](STObject&) {}};
BEAST_EXPECT(checkTxPermission(nullptr, tx) == terNO_DELEGATE_PERMISSION);
// loadGranularPermission nullptr check
std::unordered_set<GranularPermissionType> granularPermissions;
loadGranularPermission(nullptr, ttPAYMENT, granularPermissions);
BEAST_EXPECT(granularPermissions.empty());
}
void
run() override
{
@@ -1881,6 +1897,7 @@ class Delegate_test : public beast::unit_test::suite
testPermissionValue(all);
testTxRequireFeatures(all);
testTxDelegableCount();
testDelegateUtilsNullptrCheck();
}
};
BEAST_DEFINE_TESTSUITE(Delegate, app, xrpl);