From d49882fbc03353004ad538a45cbffc5db6575a90 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sun, 27 Jun 2021 01:24:04 +0200 Subject: [PATCH] fixed minor bugs, proofs working now --- src/currency_core/currency_format_utils.cpp | 4 ++-- tests/core_tests/chaingen_main.cpp | 3 +++ tests/core_tests/chaingen_tests_list.h | 1 + tests/core_tests/isolate_auditable_and_proof.cpp | 2 +- tests/core_tests/isolate_auditable_and_proof.h | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index 27ecdc9d..73bf0200 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -764,7 +764,7 @@ namespace currency const crypto::key_derivation& m_key; encrypt_attach_visitor(bool& was_crypted_entries, const crypto::key_derivation& key, const keypair& onetime_keypair = null_keypair, const account_public_address& destination_addr = null_pub_addr) : - m_was_crypted_entries(was_crypted_entries), m_key(key), m_onetime_keypair(onetime_keypair), m_destination_addr(m_destination_addr) + m_was_crypted_entries(was_crypted_entries), m_key(key), m_onetime_keypair(onetime_keypair), m_destination_addr(destination_addr) {} void operator()(tx_comment& comment) { @@ -870,7 +870,7 @@ namespace currency CHECK_AND_ASSERT_THROW_MES(m_acc_keys.spend_secret_key != currency::null_skey && m_tx_onetime_pubkey != currency::null_pkey, "tx_service_attachment with TX_SERVICE_ATTACHMENT_ENCRYPT_BODY_ISOLATE_AUDITABLE: keys uninitialized"); bool r = crypto::generate_key_derivation(m_tx_onetime_pubkey, m_acc_keys.spend_secret_key, derivation_local); CHECK_AND_ASSERT_THROW_MES(r, "Failed to generate_key_derivation at TX_SERVICE_ATTACHMENT_ENCRYPT_BODY_ISOLATE_AUDITABLE"); - crypto::chacha_crypt(sa.body, derivation_local); + crypto::chacha_crypt(local_sa.body, derivation_local); } else diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp index 1f21fce7..6cd4425d 100644 --- a/tests/core_tests/chaingen_main.cpp +++ b/tests/core_tests/chaingen_main.cpp @@ -1029,6 +1029,9 @@ int main(int argc, char* argv[]) GENERATE_AND_PLAY(atomic_test_wrong_redeem_wrong_refund); GENERATE_AND_PLAY(atomic_test_altchain_simple); GENERATE_AND_PLAY(atomic_test_check_hardfork_rules); + + GENERATE_AND_PLAY(isolate_auditable_and_proof); + // GENERATE_AND_PLAY(gen_block_reward); diff --git a/tests/core_tests/chaingen_tests_list.h b/tests/core_tests/chaingen_tests_list.h index 2a419569..9d2e4c54 100644 --- a/tests/core_tests/chaingen_tests_list.h +++ b/tests/core_tests/chaingen_tests_list.h @@ -39,3 +39,4 @@ #include "hard_fork_1.h" #include "hard_fork_2.h" #include "atomic_tests.h" +#include "isolate_auditable_and_proof.h" diff --git a/tests/core_tests/isolate_auditable_and_proof.cpp b/tests/core_tests/isolate_auditable_and_proof.cpp index b2907824..9b602f09 100644 --- a/tests/core_tests/isolate_auditable_and_proof.cpp +++ b/tests/core_tests/isolate_auditable_and_proof.cpp @@ -87,7 +87,7 @@ bool isolate_auditable_and_proof::c1(currency::core& c, size_t ev_index, const s tx_service_attachment sa = AUTO_VAL_INIT(sa); sa.service_id = BC_WRAP_SERVICE_ID; sa.instruction = BC_WRAP_SERVICE_INSTRUCTION_ERC20; - sa.flags = TX_SERVICE_ATTACHMENT_ENCRYPT_BODY | TX_SERVICE_ATTACHMENT_ENCRYPT_BODY_ISOLATE_AUDITABLE; + sa.flags = TX_SERVICE_ATTACHMENT_ENCRYPT_BODY | TX_SERVICE_ATTACHMENT_ENCRYPT_BODY_ISOLATE_AUDITABLE| TX_SERVICE_ATTACHMENT_ENCRYPT_ADD_PROOF; sa.body = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B"; extra.push_back(sa); diff --git a/tests/core_tests/isolate_auditable_and_proof.h b/tests/core_tests/isolate_auditable_and_proof.h index b0df5b8d..361abc27 100644 --- a/tests/core_tests/isolate_auditable_and_proof.h +++ b/tests/core_tests/isolate_auditable_and_proof.h @@ -11,7 +11,7 @@ struct isolate_auditable_and_proof : public wallet_test { isolate_auditable_and_proof(); bool generate(std::vector& events) const; - virtual bool c1(currency::core& c, size_t ev_index, const std::vector& events)=0; + virtual bool c1(currency::core& c, size_t ev_index, const std::vector& events); virtual bool configure_core(currency::core& c, size_t ev_index, const std::vector& events); protected: mutable uint64_t m_genesis_timestamp;