forked from lthn/blockchain
Zarcanum adaptation for confidential assets: balance and range proofs generation/verification has been debugged (WIP)
This commit is contained in:
parent
b5c1c5477d
commit
cce4aaaaa3
5 changed files with 11 additions and 15 deletions
|
|
@ -1322,17 +1322,10 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t
|
|||
|
||||
if (is_hardfork_active(ZANO_HARDFORK_04_ZARCANUM)) // TODO @#@# consider moving to validate_tx_for_hardfork_specific_terms
|
||||
{
|
||||
if (pos)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs.size() == 1, false, "coinbase transaction has incorrect number of proofs (" << b.miner_tx.proofs.size() << "), expected 2");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs[0].type() == typeid(zc_outs_range_proof), false, "coinbase transaction has incorrect type of proof #0 (expected: zc_outs_range_proof)");
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs.size() == 2, false, "coinbase transaction has incorrect number of proofs (" << b.miner_tx.proofs.size() << "), expected 2");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs[0].type() == typeid(zc_outs_range_proof), false, "coinbase transaction has incorrect type of proof #0 (expected: zc_outs_range_proof)");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs[1].type() == typeid(zc_balance_proof), false, "coinbase transaction has incorrect type of proof #1 (expected: zc_balance_proof)");
|
||||
}
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.attachment.empty(), false, "coinbase transaction has attachments; attachments are not allowed for coinbase transactions.");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs.size() == 2, false, "coinbase transaction has incorrect number of proofs (" << b.miner_tx.proofs.size() << "), expected 2");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs[0].type() == typeid(zc_outs_range_proof), false, "coinbase transaction has incorrect type of proof #0 (expected: zc_outs_range_proof)");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.proofs[1].type() == typeid(zc_balance_proof), false, "coinbase transaction has incorrect type of proof #1 (expected: zc_balance_proof)");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3831,7 +3831,7 @@ bool wallet2::is_in_hardfork_zone(uint64_t hardfork_index) const
|
|||
return m_core_runtime_config.is_hardfork_active_for_height(hardfork_index, get_blockchain_current_size());
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const pos_entry& pe, const currency::outputs_generation_context& miner_tx_ogc) const
|
||||
bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const pos_entry& pe, currency::outputs_generation_context& miner_tx_ogc) const
|
||||
{
|
||||
bool r = false;
|
||||
WLT_CHECK_AND_ASSERT_MES(pe.wallet_index < m_transfers.size(), false, "invalid pe.wallet_index: " << pe.wallet_index);
|
||||
|
|
@ -3987,6 +3987,9 @@ bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, currency::bl
|
|||
static_cast<crypto::zarcanum_proof&>(sig), &err);
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "zarcanum_generate_proof failed, err: " << (int)err);
|
||||
|
||||
// TODO @#@# [architecture] the same value is calculated in zarcanum_generate_proof(), consider an impovement
|
||||
miner_tx_ogc.pseudo_out_amount_commitments_sum += cxt.stake_amount * currency::native_coin_asset_id_pt + pseudo_out_amount_blinding_mask * crypto::c_point_G;
|
||||
|
||||
//
|
||||
// The miner tx prefix should be sealed by now, and the tx hash should be defined.
|
||||
// Any changes made below should only affect the signatures/proofs and should not impact the prefix hash calculation.
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ namespace tools
|
|||
//next functions in public area only becausce of test_generator
|
||||
//TODO: Need refactoring - remove it back to private zone
|
||||
void set_genesis(const crypto::hash& genesis_hash);
|
||||
bool prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const currency::pos_entry& pe, const currency::outputs_generation_context& miner_tx_ogc) const;
|
||||
bool prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const currency::pos_entry& pe, currency::outputs_generation_context& miner_tx_ogc) const;
|
||||
void process_new_blockchain_entry(const currency::block& b,
|
||||
const currency::block_direct_data_entry& bche,
|
||||
const crypto::hash& bl_id,
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ bool test_generator::construct_block(currency::block& blk,
|
|||
bool test_generator::sign_block(const tools::wallet2::mining_context& mining_context,
|
||||
const pos_entry& pe,
|
||||
const tools::wallet2& w,
|
||||
const outputs_generation_context& miner_tx_ogc,
|
||||
outputs_generation_context& miner_tx_ogc,
|
||||
currency::block& b)
|
||||
{
|
||||
bool r = w.prepare_and_sign_pos_block(mining_context, b, pe, miner_tx_ogc);
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ public:
|
|||
bool sign_block(const tools::wallet2::mining_context& mining_context,
|
||||
const currency::pos_entry& pe,
|
||||
const tools::wallet2& w,
|
||||
const currency::outputs_generation_context& miner_tx_ogc,
|
||||
currency::outputs_generation_context& miner_tx_ogc,
|
||||
currency::block& b);
|
||||
|
||||
/*bool get_output_details_by_global_index(const test_generator::blockchain_vector& blck_chain,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue