chore: Mark unreachable branches in Confidential Transfer with UNREACHABLE (#7903)

This commit is contained in:
Peter Chen
2026-08-10 21:37:38 +00:00
committed by GitHub
parent 60291c3ed6
commit 6f5de9067a
6 changed files with 298 additions and 41 deletions

View File

@@ -4,6 +4,7 @@
#include <xrpl/basics/Slice.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/basics/contract.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/SField.h>
@@ -124,7 +125,12 @@ std::optional<EcPair>
makeEcPair(Slice const& buffer)
{
if (buffer.length() != 2 * kEcCiphertextComponentLength)
return std::nullopt; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE("xrpl::makeEcPair : callers must pre-validate ciphertext length");
return std::nullopt;
// LCOV_EXCL_STOP
}
auto parsePubKey = [](Slice const& slice, secp256k1_pubkey& out) {
return secp256k1_ec_pubkey_parse(secp256k1Context(), &out, slice.data(), slice.length());
@@ -266,7 +272,13 @@ std::optional<Buffer>
encryptCanonicalZeroAmount(Slice const& pubKeySlice, AccountID const& account, MPTID const& mptId)
{
if (pubKeySlice.size() != kEcPubKeyLength)
return std::nullopt; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::encryptCanonicalZeroAmount : callers must pre-validate public key length");
return std::nullopt;
// LCOV_EXCL_STOP
}
EcPair pair{};
secp256k1_pubkey pubKey;
@@ -274,14 +286,24 @@ encryptCanonicalZeroAmount(Slice const& pubKeySlice, AccountID const& account, M
secp256k1Context(), &pubKey, pubKeySlice.data(), kEcPubKeyLength);
res != 1)
{
return std::nullopt; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::encryptCanonicalZeroAmount : public key read from the ledger must already be "
"valid");
return std::nullopt;
// LCOV_EXCL_STOP
}
if (auto res = generate_canonical_encrypted_zero(
secp256k1Context(), &pair.c1, &pair.c2, &pubKey, account.data(), mptId.data());
res != 1)
{
return std::nullopt; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::encryptCanonicalZeroAmount : canonical zero generation cannot fail for a "
"valid public key");
return std::nullopt;
// LCOV_EXCL_STOP
}
return serializeEcPair(pair);
@@ -301,7 +323,11 @@ verifyRevealedAmount(
issuer.publicKey.size() != kEcPubKeyLength ||
issuer.encryptedAmount.size() != kEcGamalEncryptedTotalLength)
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifyRevealedAmount : callers must pre-validate holder/issuer field lengths");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const holderP = toParticipant(holder);
@@ -313,7 +339,11 @@ verifyRevealedAmount(
if (auditor->publicKey.size() != kEcPubKeyLength ||
auditor->encryptedAmount.size() != kEcGamalEncryptedTotalLength)
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifyRevealedAmount : callers must pre-validate auditor field lengths");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auditorP = toParticipant(*auditor);
auditorPtr = &auditorP;
@@ -337,7 +367,12 @@ checkEncryptedAmountFormat(STObject const& object)
if (!object.isFieldPresent(sfHolderEncryptedAmount) ||
!object.isFieldPresent(sfIssuerEncryptedAmount))
{
return temMALFORMED; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::checkEncryptedAmountFormat : callers already enforce that these fields are "
"present");
return temMALFORMED;
// LCOV_EXCL_STOP
}
if (object[sfHolderEncryptedAmount].length() != kEcGamalEncryptedTotalLength ||
@@ -366,7 +401,12 @@ TER
verifySchnorrProof(Slice const& pubKeySlice, Slice const& proofSlice, uint256 const& contextHash)
{
if (proofSlice.size() != kEcSchnorrProofLength || pubKeySlice.size() != kEcPubKeyLength)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE("xrpl::verifySchnorrProof : callers must pre-validate proof/public key length");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
if (mpt_verify_convert_proof(proofSlice.data(), pubKeySlice.data(), contextHash.data()) != 0)
return tecBAD_PROOF;
@@ -385,7 +425,12 @@ verifyClawbackProof(
if (ciphertext.size() != kEcGamalEncryptedTotalLength ||
pubKeySlice.size() != kEcPubKeyLength || proof.size() != kEcClawbackProofLength)
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifyClawbackProof : callers must pre-validate ciphertext/public "
"key/proof length");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
if (mpt_verify_clawback_proof(
@@ -420,7 +465,12 @@ verifySendProof(
amountCommitment.size() != kEcPedersenCommitmentLength ||
balanceCommitment.size() != kEcPedersenCommitmentLength)
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifySendProof : callers must pre-validate proof/participant/commitment "
"lengths");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
std::vector<mpt_confidential_participant> participants;
@@ -433,12 +483,22 @@ verifySendProof(
if (auditor->publicKey.size() != kEcPubKeyLength ||
auditor->encryptedAmount.size() != kEcGamalEncryptedTotalLength)
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE("xrpl::verifySendProof : callers must pre-validate auditor field lengths");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
participants.push_back(toParticipant(*auditor));
}
if (participants.size() != recipientCount)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifySendProof : participant count must match the requested recipient "
"count");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
if (mpt_verify_send_proof(
proof.data(),
@@ -468,7 +528,12 @@ verifyConvertBackProof(
spendingBalance.size() != kEcGamalEncryptedTotalLength ||
balanceCommitment.size() != kEcPedersenCommitmentLength)
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifyConvertBackProof : callers must pre-validate proof/public "
"key/balance/commitment lengths");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
if (mpt_verify_convert_back_proof(

View File

@@ -1,6 +1,7 @@
#include <xrpl/tx/transactors/token/ConfidentialMPTClawback.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/ConfidentialTransfer.h>
@@ -70,7 +71,14 @@ ConfidentialMPTClawback::preclaim(PreclaimContext const& ctx)
// Sanity check: account must be the same as issuer
if (sleIssuance->getAccountID(sfIssuer) != account)
return tefINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTClawback::preclaim : preflight already validated the "
"submitter is the issuer");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
// Check if issuance has issuer ElGamal public key
if (!sleIssuance->isFieldPresent(sfIssuerEncryptionKey))
@@ -127,7 +135,14 @@ ConfidentialMPTClawback::doApply()
auto sleHolderMPToken = view().peek(keylet::mptoken(mptIssuanceID, holder));
if (!sleIssuance || !sleHolderMPToken)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTClawback::doApply : preclaim already validated these "
"objects exist");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const clawAmount = ctx_.tx[sfMPTAmount];
@@ -137,11 +152,25 @@ ConfidentialMPTClawback::doApply()
// After clawback, the balance should be encrypted zero.
auto const encZeroForHolder = encryptCanonicalZeroAmount(holderPubKey, holder, mptIssuanceID);
if (!encZeroForHolder)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTClawback::doApply : canonical zero encryption cannot fail "
"for an already-valid holder public key");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto encZeroForIssuer = encryptCanonicalZeroAmount(issuerPubKey, holder, mptIssuanceID);
if (!encZeroForIssuer)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTClawback::doApply : canonical zero encryption cannot fail "
"for an already-valid issuer public key");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
// Set holder's confidential balances to encrypted zero
(*sleHolderMPToken)[sfConfidentialBalanceInbox] = *encZeroForHolder;
@@ -154,14 +183,28 @@ ConfidentialMPTClawback::doApply()
// Sanity check: the issuance must have an auditor public key if
// auditing is enabled.
if (!sleIssuance->isFieldPresent(sfAuditorEncryptionKey))
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTClawback::doApply : the holder's auditor balance implies "
"the issuance has an auditor public key");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const auditorPubKey = (*sleIssuance)[sfAuditorEncryptionKey];
auto encZeroForAuditor = encryptCanonicalZeroAmount(auditorPubKey, holder, mptIssuanceID);
if (!encZeroForAuditor)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTClawback::doApply : canonical zero encryption cannot "
"fail for an already-valid auditor public key");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
(*sleHolderMPToken)[sfAuditorEncryptedBalance] = std::move(*encZeroForAuditor);
}

View File

@@ -3,6 +3,7 @@
#include <xrpl/basics/Log.h>
#include <xrpl/basics/Slice.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/TokenHelpers.h>
@@ -89,7 +90,14 @@ ConfidentialMPTConvert::preclaim(PreclaimContext const& ctx)
// already checked in preflight, but should also check that issuer on the
// issuance isn't the account either
if (sleIssuance->getAccountID(sfIssuer) == account)
return tefINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvert::preclaim : issuer derived from the MPT ID must "
"match the ledger's stored issuer");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
bool const hasAuditor = ctx.tx.isFieldPresent(sfAuditorEncryptedAmount);
bool const requiresAuditor = sleIssuance->isFieldPresent(sfAuditorEncryptionKey);
@@ -207,11 +215,25 @@ ConfidentialMPTConvert::doApply()
auto sleMptoken = view().peek(keylet::mptoken(mptIssuanceID, accountID_));
if (!sleMptoken)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvert::doApply : preclaim already validated the MPToken "
"exists");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto sleIssuance = view().peek(keylet::mptokenIssuance(mptIssuanceID));
if (!sleIssuance)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvert::doApply : preclaim already validated the issuance "
"exists");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const amtToConvert = ctx_.tx[sfMPTAmount];
auto const amt = (*sleMptoken)[~sfMPTAmount].valueOr(0);
@@ -273,7 +295,14 @@ ConfidentialMPTConvert::doApply()
if (auditorEc)
{
if (!sleMptoken->isFieldPresent(sfAuditorEncryptedBalance))
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvert::doApply : issuance-level auditing implies "
"the MPToken already carries an auditor balance");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto sum = homomorphicAdd(*auditorEc, (*sleMptoken)[sfAuditorEncryptedBalance]);
if (!sum)
@@ -308,7 +337,14 @@ ConfidentialMPTConvert::doApply()
(*sleMptoken)[sfHolderEncryptionKey], accountID_, mptIssuanceID);
if (!zeroBalance)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvert::doApply : canonical zero encryption cannot fail "
"for an already-valid holder public key");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
(*sleMptoken)[sfConfidentialBalanceSpending] = std::move(*zeroBalance);
}
@@ -316,7 +352,12 @@ ConfidentialMPTConvert::doApply()
{
// both sfIssuerEncryptedBalance and sfConfidentialBalanceInbox should
// exist together
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvert::doApply : confidential balance fields must be all "
"present or all absent");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
view().update(sleIssuance);

View File

@@ -2,6 +2,7 @@
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/TokenHelpers.h>
@@ -72,7 +73,14 @@ verifyProofs(
std::shared_ptr<SLE const> const& mptoken)
{
if (!mptoken->isFieldPresent(sfHolderEncryptionKey))
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::verifyProofs : preclaim already validated the holder encryption key is "
"present");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const mptIssuanceID = tx[sfMPTokenIssuanceID];
auto const account = tx[sfAccount];
@@ -169,7 +177,14 @@ ConfidentialMPTConvertBack::preclaim(PreclaimContext const& ctx)
// already checked in preflight, but should also check that issuer on
// the issuance isn't the account either
if (sleIssuance->getAccountID(sfIssuer) == account)
return tefINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvertBack::preclaim : issuer derived from the MPT ID must "
"match the ledger's stored issuer");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
auto const sleMptoken = ctx.view.read(keylet::mptoken(mptIssuanceID, account));
if (!sleMptoken)
@@ -185,7 +200,14 @@ ConfidentialMPTConvertBack::preclaim(PreclaimContext const& ctx)
// Sanity check: holder's MPToken must have auditor balance field if auditing
// is enabled
if (requiresAuditor && !sleMptoken->isFieldPresent(sfAuditorEncryptedBalance))
return tefINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvertBack::preclaim : issuance-level auditing implies the "
"MPToken already carries an auditor balance");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
// if the total circulating confidential balance is smaller than what the
// holder is trying to convert back, we know for sure this txn should
@@ -215,11 +237,25 @@ ConfidentialMPTConvertBack::doApply()
auto sleMptoken = view().peek(keylet::mptoken(mptIssuanceID, accountID_));
if (!sleMptoken)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvertBack::doApply : preclaim already validated the "
"MPToken exists");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto sleIssuance = view().peek(keylet::mptokenIssuance(mptIssuanceID));
if (!sleIssuance)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTConvertBack::doApply : preclaim already validated the "
"issuance exists");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const amtToConvertBack = ctx_.tx[sfMPTAmount];
auto const amt = (*sleMptoken)[~sfMPTAmount].valueOr(0);

View File

@@ -2,6 +2,7 @@
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/TokenHelpers.h>
@@ -49,7 +50,14 @@ ConfidentialMPTMergeInbox::preclaim(PreclaimContext const& ctx)
// already checked in preflight, but should also check that issuer on the
// issuance isn't the account either
if (sleIssuance->getAccountID(sfIssuer) == ctx.tx[sfAccount])
return tefINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTMergeInbox::preclaim : issuer derived from the MPT ID must "
"match the ledger's stored issuer");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
auto const sleMptoken =
ctx.view.read(keylet::mptoken(ctx.tx[sfMPTokenIssuanceID], ctx.tx[sfAccount]));
@@ -82,14 +90,26 @@ ConfidentialMPTMergeInbox::doApply()
auto const mptIssuanceID = ctx_.tx[sfMPTokenIssuanceID];
auto sleMptoken = view().peek(keylet::mptoken(mptIssuanceID, accountID_));
if (!sleMptoken)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTMergeInbox::doApply : preclaim already validated the "
"MPToken exists");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
// sanity check
if (!sleMptoken->isFieldPresent(sfConfidentialBalanceSpending) ||
!sleMptoken->isFieldPresent(sfConfidentialBalanceInbox) ||
!sleMptoken->isFieldPresent(sfHolderEncryptionKey))
{
return tecINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTMergeInbox::doApply : preclaim already validated these "
"fields are present");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
// Merge inbox into spending: spending = spending + inbox
@@ -114,7 +134,14 @@ ConfidentialMPTMergeInbox::doApply()
encryptCanonicalZeroAmount((*sleMptoken)[sfHolderEncryptionKey], accountID_, mptIssuanceID);
if (!zeroEncryption)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTMergeInbox::doApply : canonical zero encryption cannot fail "
"for an already-valid holder public key");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
(*sleMptoken)[sfConfidentialBalanceInbox] = std::move(*zeroEncryption);

View File

@@ -2,6 +2,7 @@
#include <xrpl/basics/Log.h>
#include <xrpl/basics/Slice.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/helpers/CredentialHelpers.h>
@@ -105,7 +106,14 @@ verifySendProofs(
{
// Sanity check
if (!sleSenderMPToken || !sleDestinationMPToken || !sleIssuance)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::detail::verifySendProofs : caller must pre-validate sender/destination/"
"issuance existence");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const hasAuditor = ctx.tx.isFieldPresent(sfAuditorEncryptedAmount);
@@ -204,7 +212,14 @@ ConfidentialMPTSend::preclaim(PreclaimContext const& ctx)
// Sanity check: issuer isn't the sender
if (sleIssuance->getAccountID(sfIssuer) == ctx.tx[sfAccount])
return tefINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTSend::preclaim : issuer derived from the MPT ID must match "
"the ledger's stored issuer");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
// Check sender's MPToken existence
auto const sleSenderMPToken = ctx.view.read(keylet::mptoken(mptIssuanceID, account));
@@ -238,7 +253,12 @@ ConfidentialMPTSend::preclaim(PreclaimContext const& ctx)
(!sleSenderMPToken->isFieldPresent(sfAuditorEncryptedBalance) ||
!sleDestinationMPToken->isFieldPresent(sfAuditorEncryptedBalance)))
{
return tefINTERNAL; // LCOV_EXCL_LINE
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTSend::preclaim : issuance-level auditing implies both "
"MPTokens already carry an auditor balance");
return tefINTERNAL;
// LCOV_EXCL_STOP
}
// Check lock
@@ -283,7 +303,14 @@ ConfidentialMPTSend::doApply()
auto const sleDestAcct = view().read(keylet::account(destination));
if (!sleSenderMPToken || !sleDestinationMPToken || !sleIssuance || !sleDestAcct)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
UNREACHABLE(
"xrpl::ConfidentialMPTSend::doApply : preclaim already validated these objects "
"exist");
return tecINTERNAL;
// LCOV_EXCL_STOP
}
// Deposit preauth authorization was already verified in preclaim.
// Remove any expired credentials.
@@ -353,7 +380,13 @@ ConfidentialMPTSend::doApply()
auto rerandomizedDestEc = rerandomizeCiphertext(
destEc, (*sleDestinationMPToken)[sfHolderEncryptionKey], sendChallenge);
if (!rerandomizedDestEc)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
JLOG(ctx_.journal.error())
<< "ConfidentialMPTSend failed to rerandomize destination inbox ciphertext.";
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const curInbox = (*sleDestinationMPToken)[sfConfidentialBalanceInbox];
auto newInbox = homomorphicAdd(curInbox, *rerandomizedDestEc);
@@ -374,7 +407,13 @@ ConfidentialMPTSend::doApply()
auto rerandomizedIssuerEc =
rerandomizeCiphertext(issuerEc, (*sleIssuance)[sfIssuerEncryptionKey], sendChallenge);
if (!rerandomizedIssuerEc)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
JLOG(ctx_.journal.error())
<< "ConfidentialMPTSend failed to rerandomize destination issuer ciphertext.";
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const curIssuerEnc = (*sleDestinationMPToken)[sfIssuerEncryptedBalance];
auto newIssuerEnc = homomorphicAdd(curIssuerEnc, *rerandomizedIssuerEc);
@@ -396,7 +435,13 @@ ConfidentialMPTSend::doApply()
auto rerandomizedAuditorEc = rerandomizeCiphertext(
*auditorEc, (*sleIssuance)[sfAuditorEncryptionKey], sendChallenge);
if (!rerandomizedAuditorEc)
return tecINTERNAL; // LCOV_EXCL_LINE
{
// LCOV_EXCL_START
JLOG(ctx_.journal.error())
<< "ConfidentialMPTSend failed to rerandomize destination auditor ciphertext.";
return tecINTERNAL;
// LCOV_EXCL_STOP
}
auto const curAuditorEnc = (*sleDestinationMPToken)[sfAuditorEncryptedBalance];
auto newAuditorEnc = homomorphicAdd(curAuditorEnc, *rerandomizedAuditorEc);