mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-03 12:11:03 +00:00
refactor: Assorted small DID fixes (#6552)
This change: * Makes `addSLE` in `DIDSet` a static function, instead of a free function. * Renames `Attestation` to `Data` everywhere (an artifact of a previous name for the field). * Actually runs a set of tests that were not included in the `run` function of `DID_test`.
This commit is contained in:
@@ -209,7 +209,7 @@ std::size_t constexpr maxDIDDocumentLength = 256;
|
||||
std::size_t constexpr maxDIDURILength = 256;
|
||||
|
||||
/** The maximum length of an Attestation inside a DID */
|
||||
std::size_t constexpr maxDIDAttestationLength = 256;
|
||||
std::size_t constexpr maxDIDDataLength = 256;
|
||||
|
||||
/** The maximum length of a domain */
|
||||
std::size_t constexpr maxDomainLength = 256;
|
||||
|
||||
@@ -33,7 +33,7 @@ DIDDelete::deleteSLE(
|
||||
if (!view.dirRemove(keylet::ownerDir(owner), (*sle)[sfOwnerNode], sle->key(), true))
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
JLOG(j.fatal()) << "Unable to delete DID Token from owner.";
|
||||
JLOG(j.fatal()) << "Unable to delete DID from owner.";
|
||||
return tefBAD_LEDGER;
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
@@ -41,13 +41,13 @@ DIDSet::preflight(PreflightContext const& ctx)
|
||||
};
|
||||
|
||||
if (isTooLong(sfURI, maxDIDURILength) || isTooLong(sfDIDDocument, maxDIDDocumentLength) ||
|
||||
isTooLong(sfData, maxDIDAttestationLength))
|
||||
isTooLong(sfData, maxDIDDataLength))
|
||||
return temMALFORMED;
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER
|
||||
static TER
|
||||
addSLE(ApplyContext& ctx, std::shared_ptr<SLE> const& sle, AccountID const& owner)
|
||||
{
|
||||
auto const sleAccount = ctx.view().peek(keylet::account(owner));
|
||||
|
||||
@@ -189,7 +189,7 @@ struct DID_test : public beast::unit_test::suite
|
||||
Account const edna{"edna"};
|
||||
Account const francis{"francis"};
|
||||
Account const george{"george"};
|
||||
env.fund(XRP(5000), alice, bob, charlie, dave, edna, francis);
|
||||
env.fund(XRP(5000), alice, bob, charlie, dave, edna, francis, george);
|
||||
env.close();
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 0);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 0);
|
||||
@@ -355,12 +355,14 @@ struct DID_test : public beast::unit_test::suite
|
||||
testAccountReserve(all);
|
||||
testSetInvalid(all);
|
||||
testDeleteInvalid(all);
|
||||
testSetValidInitial(all);
|
||||
testSetModify(all);
|
||||
|
||||
testEnabled(all - emptyDID);
|
||||
testAccountReserve(all - emptyDID);
|
||||
testSetInvalid(all - emptyDID);
|
||||
testDeleteInvalid(all - emptyDID);
|
||||
testSetValidInitial(all - emptyDID);
|
||||
testSetModify(all - emptyDID);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Sets the optional Attestation on a DIDSet. */
|
||||
/** Sets the optional Data on a DIDSet. */
|
||||
class data
|
||||
{
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user