Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Apr 23, 2024
1 parent b7d8632 commit f0eac25
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/seraphis_main/tx_builders_legacy_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void make_tx_legacy_ring_signature_message_v1(const rct::key &tx_proposal_messag
sp_hash_to_32(transcript.data(), transcript.size(), message_out.bytes);
}
//-------------------------------------------------------------------------------------------------------------------
void make_v3_legacy_ring_signature(const rct::key &message,
void make_v4_legacy_ring_signature(const rct::key &message,
std::vector<std::uint64_t> reference_set,
const rct::ctkeyV &referenced_enotes,
const std::uint64_t real_reference_index,
Expand All @@ -186,25 +186,25 @@ void make_v3_legacy_ring_signature(const rct::key &message,

// 1. reference sets
CHECK_AND_ASSERT_THROW_MES(tools::is_sorted_and_unique(reference_set),
"make v3 legacy ring signature: reference set indices are not sorted and unique.");
"make v4 legacy ring signature: reference set indices are not sorted and unique.");
CHECK_AND_ASSERT_THROW_MES(reference_set.size() == referenced_enotes.size(),
"make v3 legacy ring signature: reference set indices don't match referenced enotes.");
"make v4 legacy ring signature: reference set indices don't match referenced enotes.");
CHECK_AND_ASSERT_THROW_MES(real_reference_index < referenced_enotes.size(),
"make v3 legacy ring signature: real reference index is outside range of referenced enotes.");
"make v4 legacy ring signature: real reference index is outside range of referenced enotes.");

// 2. reference onetime address is reproducible
rct::key onetime_address_reproduced{rct::scalarmultBase(rct::sk2rct(legacy_spend_privkey))};
mask_key(reference_view_privkey, onetime_address_reproduced, onetime_address_reproduced);

CHECK_AND_ASSERT_THROW_MES(onetime_address_reproduced == referenced_enotes[real_reference_index].dest,
"make v3 legacy ring signature: could not reproduce onetime address.");
"make v4 legacy ring signature: could not reproduce onetime address.");

// 3. masked commitment is reproducible
rct::key masked_commitment_reproduced{referenced_enotes[real_reference_index].mask};
mask_key(reference_commitment_mask, masked_commitment_reproduced, masked_commitment_reproduced);

CHECK_AND_ASSERT_THROW_MES(masked_commitment_reproduced == masked_commitment,
"make v3 legacy ring signature: could not reproduce masked commitment (pseudo-output commitment).");
"make v4 legacy ring signature: could not reproduce masked commitment (pseudo-output commitment).");


/// prepare to make proof
Expand Down Expand Up @@ -245,7 +245,7 @@ void make_v3_legacy_ring_signature(const rct::key &message,
ring_signature_out.reference_set = std::move(reference_set);
}
//-------------------------------------------------------------------------------------------------------------------
void make_v3_legacy_ring_signature_v1(LegacyRingSignaturePrepV1 ring_signature_prep,
void make_v4_legacy_ring_signature_v1(LegacyRingSignaturePrepV1 ring_signature_prep,
const crypto::secret_key &legacy_spend_privkey,
hw::device &hwdev,
LegacyRingSignatureV4 &ring_signature_out)
Expand All @@ -257,7 +257,7 @@ void make_v3_legacy_ring_signature_v1(LegacyRingSignaturePrepV1 ring_signature_p
message);

// complete signature
make_v3_legacy_ring_signature(message,
make_v4_legacy_ring_signature(message,
std::move(ring_signature_prep.reference_set),
ring_signature_prep.referenced_enotes,
ring_signature_prep.real_reference_index,
Expand All @@ -269,7 +269,7 @@ void make_v3_legacy_ring_signature_v1(LegacyRingSignaturePrepV1 ring_signature_p
ring_signature_out);
}
//-------------------------------------------------------------------------------------------------------------------
void make_v3_legacy_ring_signatures_v1(std::vector<LegacyRingSignaturePrepV1> ring_signature_preps,
void make_v4_legacy_ring_signatures_v1(std::vector<LegacyRingSignaturePrepV1> ring_signature_preps,
const crypto::secret_key &legacy_spend_privkey,
hw::device &hwdev,
std::vector<LegacyRingSignatureV4> &ring_signatures_out)
Expand All @@ -278,7 +278,7 @@ void make_v3_legacy_ring_signatures_v1(std::vector<LegacyRingSignaturePrepV1> ri
for (const LegacyRingSignaturePrepV1 &signature_prep : ring_signature_preps)
{
CHECK_AND_ASSERT_THROW_MES(signature_prep.tx_proposal_prefix == ring_signature_preps[0].tx_proposal_prefix,
"make v3 legacy ring signatures: inconsistent proposal prefixes.");
"make v4 legacy ring signatures: inconsistent proposal prefixes.");
}

// sort ring signature preps
Expand All @@ -292,7 +292,7 @@ void make_v3_legacy_ring_signatures_v1(std::vector<LegacyRingSignaturePrepV1> ri

for (LegacyRingSignaturePrepV1 &signature_prep : ring_signature_preps)
{
make_v3_legacy_ring_signature_v1(std::move(signature_prep),
make_v4_legacy_ring_signature_v1(std::move(signature_prep),
legacy_spend_privkey,
hwdev,
tools::add_element(ring_signatures_out));
Expand Down Expand Up @@ -369,7 +369,7 @@ void make_v1_legacy_input_v1(const rct::key &tx_proposal_prefix,

// 3. construct ring signature
LegacyRingSignatureV4 ring_signature;
make_v3_legacy_ring_signature_v1(std::move(ring_signature_prep), legacy_spend_privkey, hwdev, ring_signature);
make_v4_legacy_ring_signature_v1(std::move(ring_signature_prep), legacy_spend_privkey, hwdev, ring_signature);

// 4. finish making the input
make_v1_legacy_input_v1(tx_proposal_prefix,
Expand Down
8 changes: 4 additions & 4 deletions src/seraphis_main/tx_builders_legacy_inputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void make_tx_legacy_ring_signature_message_v1(const rct::key &tx_proposal_messag
const std::vector<std::uint64_t> &reference_set_indices,
rct::key &message_out);
/**
* brief: make_v3_legacy_ring_signature - make a legacy v3 ring signature
* brief: make_v4_legacy_ring_signature - make a legacy v3 ring signature
* param: message -
* param: reference_set -
* param: referenced_enotes -
Expand All @@ -102,7 +102,7 @@ void make_tx_legacy_ring_signature_message_v1(const rct::key &tx_proposal_messag
* inoutparam: hwdev -
* outparam: ring_signature_out -
*/
void make_v3_legacy_ring_signature(const rct::key &message,
void make_v4_legacy_ring_signature(const rct::key &message,
std::vector<std::uint64_t> reference_set,
const rct::ctkeyV &referenced_enotes,
const std::uint64_t real_reference_index,
Expand All @@ -112,11 +112,11 @@ void make_v3_legacy_ring_signature(const rct::key &message,
const crypto::secret_key &legacy_spend_privkey,
hw::device &hwdev,
LegacyRingSignatureV4 &ring_signature_out);
void make_v3_legacy_ring_signature_v1(LegacyRingSignaturePrepV1 ring_signature_prep,
void make_v4_legacy_ring_signature_v1(LegacyRingSignaturePrepV1 ring_signature_prep,
const crypto::secret_key &legacy_spend_privkey,
hw::device &hwdev,
LegacyRingSignatureV4 &ring_signature_out);
void make_v3_legacy_ring_signatures_v1(std::vector<LegacyRingSignaturePrepV1> ring_signature_preps,
void make_v4_legacy_ring_signatures_v1(std::vector<LegacyRingSignaturePrepV1> ring_signature_preps,
const crypto::secret_key &legacy_spend_privkey,
hw::device &hwdev,
std::vector<LegacyRingSignatureV4> &ring_signatures_out);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/seraphis_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static void make_sp_txtype_squashed_v1(const std::size_t legacy_ring_size,
legacy_ring_size,
ledger_context_inout)
};
make_v3_legacy_ring_signatures_v1(std::move(legacy_ring_signature_preps),
make_v4_legacy_ring_signatures_v1(std::move(legacy_ring_signature_preps),
legacy_spend_privkey,
hw::get_device("default"),
tx_legacy_ring_signatures);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/seraphis_enote_scanning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,7 @@ TEST(seraphis_enote_scanning, reorgs_while_scanning_5)
.bin_radius = 1,
.num_bin_members = 2
};

const SemanticConfigSpRefSetV1 sp_ref_set_config{
.decomp_n = ref_set_decomp_n,
.decomp_m = ref_set_decomp_m,
Expand Down

0 comments on commit f0eac25

Please sign in to comment.