Skip to content

Conversation

@PeterChen13579
Copy link
Contributor

High Level Overview of Change

Adds more unit tests for Auditor feature in Confidential Transfer

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.0%. Comparing base (67e8e89) to head (c38a3b3).
⚠️ Report is 15 commits behind head on ripple/confidential-transfer.

Additional details and impacted files

Impacted file tree graph

@@                      Coverage Diff                       @@
##           ripple/confidential-transfer   #6255     +/-   ##
==============================================================
- Coverage                          79.1%   79.0%   -0.1%     
==============================================================
  Files                               850     850             
  Lines                             72015   72594    +579     
  Branches                           8385    8416     +31     
==============================================================
+ Hits                              56975   57340    +365     
- Misses                            15040   15254    +214     
Files with missing lines Coverage Δ
...rc/xrpld/app/tx/detail/ConfidentialConvertBack.cpp 91.5% <100.0%> (-1.7%) ⬇️

... and 9 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shawnxie999
Copy link
Collaborator

could the conflict be resolved? thanks

0xAD, 0x0B, 0xE3, 0x91, 0x50, 0xDA, 0x2F, 0x75, 0xC6, 0xBD, 0x42};

// a valid hardcoded ciphertext for testing
constexpr static unsigned char
Copy link
Collaborator

@yinyiqian1 yinyiqian1 Jan 23, 2026

Choose a reason for hiding this comment

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

I have a refactor in #6274
So we can get rid of this and call the getTrivialCiphertext() after that PR is merged

.amt = 10,
.holderPubKey = mptAlice.getPubKey(bob),
.auditorEncryptedAmt =
Buffer{badCiphertext, ecGamalEncryptedTotalLength},
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://github.com/XRPLF/rippled/pull/6274/files modified to use getBadCiphertext().
You can update it after https://github.com/XRPLF/rippled/pull/6274/files is merged


mptAlice.generateKeyPair(alice);

mptAlice.set(
Copy link
Collaborator

Choose a reason for hiding this comment

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

auditor key is invalid length, pub key is invalid have similar setup. We can just move the code of line 436 after 399.

mptAlice.generateKeyPair(alice);

// Providing only auditor key should fail
mptAlice.set(
Copy link
Collaborator

@yinyiqian1 yinyiqian1 Jan 23, 2026

Choose a reason for hiding this comment

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

same here, we can move after line 399. The setup lines can be shared

{.account = alice,
.auditorPubKey = mptAlice.getPubKey(alice),
.err = temMALFORMED});
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should also test:

    if (hasHolder && (hasIssuerElGamalKey || hasAuditorElGamalKey))
        return temMALFORMED;

and this can also be added after line 399

.auditorPubKey = mptAlice.getPubKey(auditor)});

// no auditor encrypted amt provided
mptAlice.convert(
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the test framework, even if the auditor's encrypted amt is not provided, it will fill in the auditor's encrypted amount automatically: https://github.com/XRPLF/rippled/blob/ripple/confidential-transfer/src/test/jtx/impl/mpt.cpp#L1015C5-L1015C30

Could you double check if this is failing at the expected line? I think we need some logic in test framework to force it not auto filling this field.

// We set the auditor key, but auditorEncryptedAmt is missing
// Note:we need to create a new MPTTester to reset the state
{
Env env2{*this, features};
Copy link
Collaborator

Choose a reason for hiding this comment

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

the naming should remove 2

std::optional<Buffer>& auditorCiphertext,
Buffer& blindingFactor) const
Buffer& blindingFactor,
bool fillAuditorEncryptedAmt) const
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this fillAuditorEncryptedAmt param needed? which test would fail otherwise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It fails the test where we want to test for if (requiresAuditor != hasAuditor)
Essentially, fillConversionCiphertexts makes sure if the field auditor is present, it fills the auditorEncryptedAmt, so I created a bool field to prevent this

}

// cannot convert if auditor key is set, but auditor amount is not
// provided
Copy link
Collaborator

Choose a reason for hiding this comment

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

should also test MPTokenIssuanceSet where the issuer has already set IssuerPublicKey. Then they try to set AuditorPublicKey, which should fail.

@PeterChen13579 PeterChen13579 requested a review from a team as a code owner January 27, 2026 18:32
@PeterChen13579 PeterChen13579 force-pushed the ripple/confidential-transfer branch from 13672c5 to c38a3b3 Compare January 27, 2026 18:34
@PeterChen13579 PeterChen13579 force-pushed the ripple/confidential-transfer branch from c38a3b3 to 3a86ae6 Compare January 27, 2026 18:52
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