Skip to content

Commit

Permalink
remove mpt_dir and change error code
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnxie999 committed Apr 4, 2024
1 parent b00eab6 commit 60174e7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/ripple/app/tx/impl/MPTokenAuthorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ MPTokenAuthorize::preclaim(PreclaimContext const& ctx)
return tecOBJECT_NOT_FOUND;

if (accountID == (*sleMptIssuance)[sfIssuer])
return temMALFORMED;
return tecNO_PERMISSION;

// if holder wants to use and create a mpt
if (sleMpt)
Expand All @@ -111,7 +111,7 @@ MPTokenAuthorize::preclaim(PreclaimContext const& ctx)
// Note: `accountID` is issuer's account
// `holderID` is holder's account
if (accountID != (*sleMptIssuance)[sfIssuer])
return temMALFORMED;
return tecNO_PERMISSION;

// If tx is submitted by issuer, it only applies for MPT with
// lsfMPTRequireAuth set
Expand Down
6 changes: 0 additions & 6 deletions src/ripple/protocol/Indexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,6 @@ mptoken(uint256 const& mptokenKey)

Keylet
mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;

Keylet
mpt_dir(uint192 const& id) noexcept;

Keylet
mpt_dir(uint256 const& id) noexcept;
} // namespace keylet

// Everything below is deprecated and should be removed in favor of keylets:
Expand Down
14 changes: 0 additions & 14 deletions src/ripple/protocol/impl/Indexes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ enum class LedgerNameSpace : std::uint16_t {
DID = 'I',
MPTOKEN_ISSUANCE = '~',
MPTOKEN = 't',
MPT_DIR = 'k',

// No longer used or supported. Left here to reserve the space
// to avoid accidental reuse.
Expand Down Expand Up @@ -495,19 +494,6 @@ mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept
return {
ltMPTOKEN, indexHash(LedgerNameSpace::MPTOKEN, issuanceKey, holder)};
}

Keylet
mpt_dir(uint192 const& id) noexcept
{
return {
ltDIR_NODE, indexHash(LedgerNameSpace::MPT_DIR, mptIssuance(id).key)};
}

Keylet
mpt_dir(uint256 const& id) noexcept
{
return {ltDIR_NODE, indexHash(LedgerNameSpace::MPT_DIR, id)};
}
} // namespace keylet

} // namespace ripple
12 changes: 3 additions & 9 deletions src/test/app/MPToken_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,10 @@ class MPToken_test : public beast::unit_test::suite

// bob submits a tx with a holder field
mptAlice.authorize(
{.account = &bob, .holder = &alice, .err = temMALFORMED});

mptAlice.authorize(
{.account = &bob, .holder = &bob, .err = temMALFORMED});
{.account = &bob, .holder = &alice, .err = tecNO_PERMISSION});

// alice tries to hold onto her own token
mptAlice.authorize({.account = &alice, .err = temMALFORMED});

// alice tries to authorize herself
mptAlice.authorize({.holder = &alice, .err = temMALFORMED});
mptAlice.authorize({.account = &alice, .err = tecNO_PERMISSION});

// the mpt does not enable allowlisting
mptAlice.authorize({.holder = &bob, .err = tecNO_AUTH});
Expand Down Expand Up @@ -302,7 +296,7 @@ class MPToken_test : public beast::unit_test::suite
mptAlice.create({.ownerCount = 1, .flags = tfMPTRequireAuth});

// alice submits a tx without specifying a holder's account
mptAlice.authorize({.err = temMALFORMED});
mptAlice.authorize({.err = tecNO_PERMISSION});

// alice submits a tx to authorize a holder that hasn't created
// a mptoken yet
Expand Down

0 comments on commit 60174e7

Please sign in to comment.