First completed round trip test of sFUL/FUSD -> FULM
After all of the trials and tribulations, we finally have a viable prototype! The code is working for conversions of all kinds. There are a number of strange and annoying bugs still present, like the rings in the CLI wallet are misbehaving at times. But we have a viable product.
This commit is contained in:
@@ -2534,9 +2534,16 @@ bool Blockchain::get_outs(const COMMAND_RPC_GET_OUTPUTS_BIN::request& req, COMMA
|
||||
return false;
|
||||
}
|
||||
const uint8_t hf_version = m_hardfork->get_current_version();
|
||||
for (const auto &t: data)
|
||||
for (const auto &t: data) {
|
||||
if (!req.asset_type.empty()) {
|
||||
if (t.asset_type not_eq cryptonote::asset_id_from_type(req.asset_type)) {
|
||||
MERROR("Invalid asset type - expected " << req.asset_type << ", but output is " << cryptonote::asset_type_from_id(t.asset_type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
res.outs.push_back({t.pubkey, t.commitment, is_tx_spendtime_unlocked(t.unlock_time, hf_version), t.height, crypto::null_hash});
|
||||
|
||||
}
|
||||
|
||||
if (req.get_txid)
|
||||
{
|
||||
for (size_t i = 0; i < req.outputs.size(); ++i)
|
||||
|
||||
@@ -554,11 +554,12 @@ namespace cryptonote
|
||||
assert(false);
|
||||
}
|
||||
|
||||
/*
|
||||
// Print out the uniqueness
|
||||
crypto::public_key pk_uniq;
|
||||
std::memcpy(pk_uniq.data, uniqueness.data, sizeof(crypto::public_key));
|
||||
LOG_ERROR("*** UNIQUENESS : " << pk_uniq);
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
@@ -580,8 +581,8 @@ namespace cryptonote
|
||||
CHECK_AND_ASSERT_MES(r, false, "at get_return_address: failed to generate_key_derivation(" << txkey_pub << ", " << sender_account_keys.m_view_secret_key << ")");
|
||||
|
||||
ec_scalar y = uniqueness;
|
||||
LOG_ERROR("Break here");
|
||||
/*
|
||||
LOG_ERROR("Break here");
|
||||
if (type == cryptonote::TRANSFER) {
|
||||
// TRANSFER relies on a shared secret (the key_derivation Z_i) between sender and recipient
|
||||
// y = Hs(uniqueness || z_i)
|
||||
@@ -619,7 +620,8 @@ namespace cryptonote
|
||||
rct::key key_verify = rct::scalarmultKey(key_test, key_y);
|
||||
CHECK_AND_ASSERT_MES(key_verify == key_aP_change, false, "at get_return_address: failed to verify invert() function with smK() approach");
|
||||
F = rct::rct2pk(key_test);
|
||||
|
||||
|
||||
/*
|
||||
LOG_ERROR("*****************************************************************************");
|
||||
LOG_ERROR("uniqueness: " << uniqueness.data);
|
||||
LOG_ERROR("txkey_pub : " << txkey_pub);
|
||||
@@ -629,6 +631,7 @@ namespace cryptonote
|
||||
LOG_ERROR("aP_change : " << pk_aP_change);
|
||||
LOG_ERROR("F : " << F);
|
||||
LOG_ERROR("*****************************************************************************");
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -809,13 +812,9 @@ namespace cryptonote
|
||||
in_contexts.push_back(input_generation_context_data());
|
||||
keypair& in_ephemeral = in_contexts.back().in_ephemeral;
|
||||
crypto::key_image img;
|
||||
/*
|
||||
// Calculate the uniqueness
|
||||
size_t output_index_wrapper = src_entr.real_output_in_tx_index;
|
||||
crypto::hash uniqueness = cn_fast_hash(reinterpret_cast<void*>(&output_index_wrapper), sizeof(size_t));
|
||||
*/
|
||||
|
||||
const auto& out_key = reinterpret_cast<const crypto::public_key&>(src_entr.outputs[src_entr.real_output].second.dest);
|
||||
if(!generate_key_image_helper(sender_account_keys, subaddresses, out_key, src_entr.real_out_tx_key, src_entr.real_out_additional_tx_keys, src_entr.real_output_in_tx_index, src_entr.uniqueness, in_ephemeral,img, hwdev))
|
||||
if(!generate_key_image_helper(sender_account_keys, subaddresses, out_key, src_entr.real_out_tx_key, src_entr.real_out_additional_tx_keys, src_entr.real_output_in_tx_index, in_ephemeral,img, hwdev, src_entr.origin_tx_data))
|
||||
{
|
||||
LOG_ERROR("Key image generation failed!");
|
||||
return false;
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace cryptonote
|
||||
crypto::public_key P_change;
|
||||
crypto::key_image input_k_image;
|
||||
};
|
||||
|
||||
bool construct_protocol_tx(const size_t height, uint64_t& protocol_fee, transaction& tx, std::vector<protocol_data_entry>& protocol_data, std::map<std::string, uint64_t> circ_supply, const oracle::pricing_record& pr, const uint8_t hf_version);
|
||||
//---------------------------------------------------------------
|
||||
bool construct_miner_tx(size_t height, size_t median_weight, uint64_t already_generated_coins, size_t current_block_weight, uint64_t fee, const account_public_address &miner_address, transaction& tx, const blobdata& extra_nonce = blobdata(), size_t max_outs = 999, uint8_t hard_fork_version = 1);
|
||||
@@ -84,7 +85,7 @@ namespace cryptonote
|
||||
rct::multisig_kLRki multisig_kLRki; //multisig info
|
||||
oracle::pricing_record pr;
|
||||
std::string asset_type;
|
||||
crypto::ec_scalar uniqueness; //the uniqueness needed to prove ownership of the consumed output
|
||||
origin_data origin_tx_data;
|
||||
|
||||
void push_output(uint64_t idx, const crypto::public_key &k, uint64_t amount) { outputs.push_back(std::make_pair(idx, rct::ctkey({rct::pk2rct(k), rct::zeroCommit(amount)}))); }
|
||||
|
||||
@@ -99,6 +100,7 @@ namespace cryptonote
|
||||
FIELD(mask)
|
||||
FIELD(multisig_kLRki)
|
||||
FIELD(asset_type)
|
||||
FIELD(origin_tx_data)
|
||||
|
||||
if (real_output >= outputs.size())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user