mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
add back clawback hash (#6175)
This commit is contained in:
@@ -27,11 +27,12 @@ addCommonZKPFields(
|
||||
std::uint64_t amount);
|
||||
|
||||
uint256
|
||||
getContextHash(
|
||||
getClawbackContextHash(
|
||||
AccountID const& account,
|
||||
std::uint32_t sequence,
|
||||
uint192 const& issuanceID,
|
||||
std::uint64_t amount,
|
||||
AccountID const& holder,
|
||||
TxType const& txType);
|
||||
AccountID const& holder);
|
||||
|
||||
/**
|
||||
* @brief Generates a new secp256k1 key pair.
|
||||
|
||||
@@ -10,23 +10,29 @@ void
|
||||
addCommonZKPFields(
|
||||
Serializer& s,
|
||||
std::uint16_t txType,
|
||||
AccountID const& account,
|
||||
std::uint32_t sequence,
|
||||
uint192 const& issuanceID,
|
||||
std::uint64_t amount)
|
||||
{
|
||||
s.add16(txType);
|
||||
s.addBitString(account);
|
||||
s.add32(sequence);
|
||||
s.addBitString(issuanceID);
|
||||
s.add64(amount);
|
||||
}
|
||||
|
||||
uint256
|
||||
getContextHash(
|
||||
getClawbackContextHash(
|
||||
AccountID const& account,
|
||||
std::uint32_t sequence,
|
||||
uint192 const& issuanceID,
|
||||
std::uint64_t amount,
|
||||
AccountID const& holder,
|
||||
TxType const& txType)
|
||||
AccountID const& holder)
|
||||
{
|
||||
Serializer s;
|
||||
addCommonZKPFields(s, txType, issuanceID, amount);
|
||||
addCommonZKPFields(
|
||||
s, ttCONFIDENTIAL_CLAWBACK, account, sequence, issuanceID, amount);
|
||||
|
||||
s.addBitString(holder);
|
||||
|
||||
|
||||
@@ -1097,8 +1097,9 @@ MPTTester::confidentialClaw(MPTConfidentialClawback const& arg)
|
||||
jv[sfZKProof] = *arg.proof;
|
||||
else
|
||||
{
|
||||
uint256 const ctxHash = getContextHash(
|
||||
*id_, *arg.amt, arg.holder->id(), ttCONFIDENTIAL_CLAWBACK);
|
||||
std::uint32_t const seq = env_.seq(account);
|
||||
uint256 const ctxHash = getClawbackContextHash(
|
||||
account.id(), seq, *id_, *arg.amt, arg.holder->id());
|
||||
Buffer proof = getClawbackProof(
|
||||
*arg.holder, *arg.amt, getPrivKey(account), ctxHash);
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ ConfidentialClawback::preclaim(PreclaimContext const& ctx)
|
||||
auto const ciphertext = (*sleHolderMPToken)[sfIssuerEncryptedBalance];
|
||||
auto const pubKeySlice = (*sleIssuance)[sfIssuerElGamalPublicKey];
|
||||
|
||||
auto const contextHash =
|
||||
getContextHash(mptIssuanceID, amount, holder, ctx.tx.getTxnType());
|
||||
auto const contextHash = getClawbackContextHash(
|
||||
account, ctx.tx[sfSequence], mptIssuanceID, amount, holder);
|
||||
return verifyEqualityProof(
|
||||
amount, ctx.tx[sfZKProof], pubKeySlice, ciphertext, contextHash);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user