Skip to content

[XLS-73] Incorrect error in AMMClawback: temINVALID_FLAG returned instead of temMALFORMED #6333

@HugoDowsers

Description

@HugoDowsers

Issue Description

While validating an AMMClawback transaction, if a transaction contains both an incorrect asset issuer (Asset.issuer) and an invalid usage of the tfClawTwoAssets flag, the system returns temINVALID_FLAG instead of temMALFORMED.

XLS-73 specifies that failing the tfClawTwoAssets validation (when the second asset is not issued by the sender) should return tecNO_PERMISSION rather than temINVALID_FLAG.

return temINVALID_FLAG;

https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0073-amm-clawback

Steps to Reproduce

  • Submit an AMMClawback transaction where the Account field (the sender) does not match the issuer defined in the Asset field (Violation of Rule S2).
  • Simultaneously enable the tfClawTwoAssets flag while the second asset (Asset2) is issued by a third party or is XRP (Violation of Rule S3).

Expected Result

The transaction should return temMALFORMED. The failure to validate the primary asset's issuer (Asset.issuer == Account) is an error that must be detected before any secondary flag analysis is performed.

Actual Result

The transaction returns temINVALID_FLAG. The current code in AMMClawback::preflight evaluates the condition (flags & tfClawTwoAssets && asset.account != asset2.account) before the mandatory check (asset.account != issuer).

Environment

OS: Ubuntu 22.04 LTS
Compiler: GCC 11 / Clang 14
Boost: 1.77+
Version: xrpld develop branch (post XLS-73 integration)

Supporting Files

None.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions