From c6929c58853908389192c9b63b9d0c680c48f0c5 Mon Sep 17 00:00:00 2001 From: radvd Date: Mon, 4 Mar 2019 08:11:52 -0800 Subject: [PATCH 1/7] cryptonote_core/blockchain: reject V1 miner transactions Temporary fix for vulnerability disclosed by MVR team. Signed-off-by: radvd --- src/cryptonote_core/blockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 22abc529..071fdc65 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1054,6 +1054,7 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height) LOG_PRINT_L3("Blockchain::" << __func__); CHECK_AND_ASSERT_MES(b.miner_tx.vin.size() == 1, false, "coinbase transaction in the block has no inputs"); CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type"); + CHECK_AND_ASSERT_MES(b.miner_tx.rct_signatures.type == rct::RCTTypeNull, false, "V1 miner transactions are not allowed."); if(boost::get(b.miner_tx.vin[0]).height != height) { MWARNING("The miner transaction in block has invalid height: " << boost::get(b.miner_tx.vin[0]).height << ", expected: " << height); From 8f0d268e9544624cb9e768b7909d8a39ab40b1fe Mon Sep 17 00:00:00 2001 From: Gregory Lemercier Date: Fri, 11 Jan 2019 11:47:29 +0100 Subject: [PATCH 2/7] Windows: fix checks for openssl 1.1.1 in MSYS2 Retrieved from upstream patch: https://github.com/monero-project/unbound/commit/c0094c70e8f7d95e8f27009d4ab214e8b042fece --- external/unbound/configure_checks.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/external/unbound/configure_checks.cmake b/external/unbound/configure_checks.cmake index 2acf556d..bdff8bfe 100644 --- a/external/unbound/configure_checks.cmake +++ b/external/unbound/configure_checks.cmake @@ -191,16 +191,17 @@ check_include_file(openssl/err.h HAVE_OPENSSL_ERR_H) check_include_file(openssl/rand.h HAVE_OPENSSL_RAND_H) check_include_file(openssl/ssl.h HAVE_OPENSSL_SSL_H) -set(CMAKE_REQUIRED_INCLUDES) +set(CMAKE_REQUIRED_LIBRARIES + ${OPENSSL_LIBRARIES}) +if (WIN32 AND OPENSSL_VERSION STRGREATER "1.1.0") + set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};ws2_32") +endif() check_symbol_exists(NID_secp384r1 "openssl/evp.h" HAVE_DECL_NID_SECP384R1) check_symbol_exists(NID_X9_62_prime256v1 "openssl/evp.h" HAVE_DECL_NID_X9_62_PRIME256V1) check_symbol_exists(sk_SSL_COMP_pop_free "openssl/ssl.h" HAVE_DECL_SK_SSL_COMP_POP_FREE) check_symbol_exists(SSL_COMP_get_compression_methods "openssl/ssl.h" HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS) -set(CMAKE_REQUIRED_LIBRARIES - ${OPENSSL_LIBRARIES}) - check_function_exists(EVP_MD_CTX_new HAVE_EVP_MD_CTX_NEW) check_function_exists(EVP_sha1 HAVE_EVP_SHA1) check_function_exists(EVP_sha256 HAVE_EVP_SHA256) @@ -210,6 +211,7 @@ check_function_exists(HMAC_Update HAVE_HMAC_UPDATE) check_function_exists(OPENSSL_config HAVE_OPENSSL_CONFIG) check_function_exists(SHA512_Update HAVE_SHA512_UPDATE) +set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) set(UNBOUND_CONFIGFILE "${CMAKE_INSTALL_PREFIX}/etc/unbound/unbound.conf" From b8c90fc93801808ceb109b2da666cf7fcf669f8b Mon Sep 17 00:00:00 2001 From: Gregory Lemercier Date: Fri, 11 Jan 2019 13:36:26 +0100 Subject: [PATCH 3/7] miner: fix build with boost 1.69 Retrieved from upstream patch: https://github.com/monero-project/monero/commit/3bb4b0d41f76483c4ae4d8d62faa4531049badeb --- src/cryptonote_basic/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index 75b51464..89b17fbb 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -632,7 +632,7 @@ namespace cryptonote } else { - on_ac_power = !battery_powered; + on_ac_power = !(bool)battery_powered; } if( m_is_background_mining_started ) From daab1cd4c90d82385a977f91a2f6d9fcf1e948c8 Mon Sep 17 00:00:00 2001 From: radvd Date: Mon, 4 Mar 2019 08:26:45 -0800 Subject: [PATCH 4/7] cryptonote_config: add v4 hardfork for governance update Update the governance address to the new teams multi sig wallet when v4 activates. Signed-off-by: radvd --- src/cryptonote_config.h | 4 +++- src/cryptonote_core/blockchain.cpp | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 1b2c3fa5..2a65e940 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -164,6 +164,7 @@ namespace config uint32_t const GENESIS_NONCE = 10000; std::string const GOVERNANCE_WALLET_ADDRESS = "hvxy7YfeE8SdTrCmSqLB59WoQn3ZQun1aLX36X3eb1R7Fb26VuNpc235q4fguGUxfGKerywFPnweu15S8RB8DzTJ8Q4hGJCgvv"; + std::string const GOVERNANCE_WALLET_ADDRESS_MULTI = "hvxy3f2PhAhimkeLf617BsbVn6UTbofVcMzofXGsSNLoMFr2SrSxRJ9f52Am1QLVddKetXPKHoTLbBaLNT1kMU6Q3kYRc3t6pF"; namespace testnet { @@ -179,6 +180,7 @@ namespace config std::string const GENESIS_TX = "013c01ff0001ffffffffffff0f029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd0880712101168d0c4ca86fb55a4cf6a36d31431be1c53a3bd7411bb24e8832410289fa6f3b"; uint32_t const GENESIS_NONCE = 10001; - std::string const GOVERNANCE_WALLET_ADDRESS = "hvtaNJ3NX37g5H1cNS77CoRWgLTSkPciY8t2VDYcKkXkAsdjMtmKBJiLA4cfwn4t2tNUv74p7C6fb7Ti2Yu3azRNAD4BK7BMpt"; + std::string const GOVERNANCE_WALLET_ADDRESS = "hvxy7YfeE8SdTrCmSqLB59WoQn3ZQun1aLX36X3eb1R7Fb26VuNpc235q4fguGUxfGKerywFPnweu15S8RB8DzTJ8Q4hGJCgvv"; + std::string const GOVERNANCE_WALLET_ADDRESS_MULTI = "hvxy3f2PhAhimkeLf617BsbVn6UTbofVcMzofXGsSNLoMFr2SrSxRJ9f52Am1QLVddKetXPKHoTLbBaLNT1kMU6Q3kYRc3t6pF"; } } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 071fdc65..cb4871c3 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -93,7 +93,8 @@ static const struct { // version 1 from the start of the blockchain { 1, 1, 0, 1517398427 }, { 2, 38500, 0, 1522818000 }, // 4th April 2018 - { 3, 89200, 0, 1528942500 } // 14th June 2018 + { 3, 89200, 0, 1528942500 }, // 14th June 2018 + { 4, 290080, 0, 1552960800 } // 19th March 2019 }; static const struct { @@ -1107,10 +1108,19 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl } std::string governance_wallet_address_str; - if (m_testnet) { - governance_wallet_address_str = ::config::testnet::GOVERNANCE_WALLET_ADDRESS; + + if (version >= 4) { + if (m_testnet) { + governance_wallet_address_str = ::config::testnet::GOVERNANCE_WALLET_ADDRESS_MULTI; + } else { + governance_wallet_address_str = ::config::GOVERNANCE_WALLET_ADDRESS_MULTI; + } } else { - governance_wallet_address_str = ::config::GOVERNANCE_WALLET_ADDRESS; + if (m_testnet) { + governance_wallet_address_str = ::config::testnet::GOVERNANCE_WALLET_ADDRESS; + } else { + governance_wallet_address_str = ::config::GOVERNANCE_WALLET_ADDRESS; + } } if (!validate_governance_reward_key(m_db->height(), governance_wallet_address_str, b.miner_tx.vout.size() - 1, boost::get(b.miner_tx.vout.back().target).key, m_testnet)) From 0e4f97762f319169b03ad799bf24e27dd307fa00 Mon Sep 17 00:00:00 2001 From: radvd Date: Mon, 4 Mar 2019 20:15:19 -0800 Subject: [PATCH 5/7] cryptonote_core/blockchain: push bulletproofs out to v5 Push bulletproofs out to v5 so we can hardfork governance address in v4. Signed-off-by: radvd --- src/cryptonote_core/blockchain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index cb4871c3..5b6ed356 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2471,11 +2471,11 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context } - // from v4, allow bulletproofs - if (hf_version < 4) { + // from v5, allow bulletproofs + if (hf_version < 5) { if (!tx.rct_signatures.p.bulletproofs.empty()) { - MERROR("Bulletproofs are not allowed before v4"); + MERROR("Bulletproofs are not allowed before v5"); tvc.m_invalid_output = true; return false; } From de5e70262f85f65d5490e48291206bc439ca9bce Mon Sep 17 00:00:00 2001 From: radvd Date: Mon, 4 Mar 2019 09:38:05 -0800 Subject: [PATCH 6/7] bump version 3.2.0 Signed-off-by: radvd --- src/version.cpp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.cpp.in b/src/version.cpp.in index 44448052..282e5d38 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_HAVEN_VERSION_TAG "@VERSIONTAG@" -#define DEF_HAVEN_VERSION "3.1.0" +#define DEF_HAVEN_VERSION "3.2.0" #define DEF_HAVEN_RELEASE_NAME "Caffeine" #define DEF_HAVEN_VERSION_FULL DEF_HAVEN_VERSION "-" DEF_HAVEN_VERSION_TAG From cfeae51a4be046b88e86b831dd9efb70f70171c4 Mon Sep 17 00:00:00 2001 From: nbourbaki909 Date: Tue, 5 Mar 2019 20:06:09 -0500 Subject: [PATCH 7/7] Changed blockheight for fork --- src/cryptonote_core/blockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 5b6ed356..00ee5b18 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -94,7 +94,7 @@ static const struct { { 1, 1, 0, 1517398427 }, { 2, 38500, 0, 1522818000 }, // 4th April 2018 { 3, 89200, 0, 1528942500 }, // 14th June 2018 - { 4, 290080, 0, 1552960800 } // 19th March 2019 + { 4, 283000, 0, 1552960800 } // 19th March 2019 }; static const struct {