post carrot stake tx support (#32)

* add support for stake txs and payouts post-carrot

* fixes on the stake return payments

* complete post-carrot stake txs

* rename protocol_tx_data to protocol_tx_data_t
This commit is contained in:
akildemir
2025-07-23 16:58:11 +03:00
committed by GitHub
parent 3e0649a8d2
commit 9ba621b3ae
40 changed files with 827 additions and 140 deletions

View File

@@ -323,10 +323,13 @@ TEST(carrot_core, main_address_special_scan_completeness)
const crypto::key_image tx_first_key_image = rct::rct2ki(rct::pkGen());
RCTOutputEnoteProposal enote_proposal;
RCTOutputEnoteProposal return_enote;
get_output_proposal_special_v1(proposal,
keys.k_view_incoming_dev,
tx_first_key_image,
cryptonote::transaction_type::TRANSFER, // tx_type
std::nullopt,
return_enote,
enote_proposal);
ASSERT_EQ(proposal.amount, enote_proposal.amount);
@@ -400,10 +403,13 @@ TEST(carrot_core, subaddress_special_scan_completeness)
const crypto::key_image tx_first_key_image = rct::rct2ki(rct::pkGen());
RCTOutputEnoteProposal enote_proposal;
RCTOutputEnoteProposal return_enote;
get_output_proposal_special_v1(proposal,
keys.k_view_incoming_dev,
tx_first_key_image,
cryptonote::transaction_type::TRANSFER, // tx_type
std::nullopt,
return_enote,
enote_proposal);
ASSERT_EQ(proposal.amount, enote_proposal.amount);
@@ -714,6 +720,7 @@ static void subtest_2out_transfer_get_output_enote_proposals_completeness(const
std::vector<RCTOutputEnoteProposal> enote_proposals;
encrypted_payment_id_t encrypted_payment_id;
size_t change_index;
RCTOutputEnoteProposal return_enote;
std::unordered_map<crypto::public_key, size_t> normal_payments_indices;
get_output_enote_proposals({bob_payment_proposal},
{alice_payment_proposal},
@@ -722,6 +729,7 @@ static void subtest_2out_transfer_get_output_enote_proposals_completeness(const
&alice.k_view_incoming_dev,
tx_first_key_image,
enote_proposals,
return_enote,
encrypted_payment_id,
cryptonote::transaction_type::TRANSFER,
change_index,

View File

@@ -417,7 +417,10 @@ TEST(carrot_fcmp, receive_scan_spend_and_verify_serialized_carrot_tx)
tx_proposal.key_images_sorted,
tx_proposal.sources,
tx_proposal.fee,
tx_proposal.tx_type,
tx_proposal.amount_burnt,
{}, // change_masks
{}, // return_enote
encrypted_payment_id);
ASSERT_EQ(2, tx.version);

View File

@@ -206,6 +206,7 @@ static void subtest_multi_account_transfer_over_transaction(const unittest_trans
std::vector<RCTOutputEnoteProposal> rederived_output_enote_proposals;
encrypted_payment_id_t rederived_encrypted_payment_id;
size_t change_index;
RCTOutputEnoteProposal return_enote;
std::unordered_map<crypto::public_key, size_t> normal_payments_indices;
get_output_enote_proposals(tx_proposal.normal_payment_proposals,
modified_selfsend_payment_proposals,
@@ -214,6 +215,7 @@ static void subtest_multi_account_transfer_over_transaction(const unittest_trans
&ss_keys.k_view_incoming_dev,
parsed_key_images.at(0),
rederived_output_enote_proposals,
return_enote,
rederived_encrypted_payment_id,
cryptonote::transaction_type::TRANSFER,
change_index,

View File

@@ -188,6 +188,7 @@ static void subtest_legacy_2out_transfer_get_output_enote_proposals_completeness
std::vector<RCTOutputEnoteProposal> enote_proposals;
encrypted_payment_id_t encrypted_payment_id;
size_t change_index;
RCTOutputEnoteProposal return_enote;
std::unordered_map<crypto::public_key, size_t> normal_payments_indices;
get_output_enote_proposals({bob_payment_proposal},
{alice_payment_proposal},
@@ -196,6 +197,7 @@ static void subtest_legacy_2out_transfer_get_output_enote_proposals_completeness
&alive_k_v_dev,
tx_first_key_image,
enote_proposals,
return_enote,
encrypted_payment_id,
cryptonote::transaction_type::TRANSFER,
change_index,

View File

@@ -226,7 +226,7 @@ std::tuple<std::vector<RCTOutputEnoteProposal>, crypto::public_key> make_return_
get_output_proposal_return_v1(
proposal_return,
tx_return_first_key_image,
&bob.s_view_balance_dev,
nullptr, // s_view_balance_dev
enote_proposal_return,
encrypted_payment_id_return
);