From 3abf473c8ed6910decee6ea208da2c25152279e9 Mon Sep 17 00:00:00 2001 From: sowle Date: Sat, 8 Apr 2023 21:59:18 +0200 Subject: [PATCH] fixing gcc errors while trying not to screw up msvc compilation at the same time (wip) --- src/crypto/range_proofs.h | 16 +++++++++------- src/currency_core/currency_basic.h | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/crypto/range_proofs.h b/src/crypto/range_proofs.h index 7992d9d3..95cbbc43 100644 --- a/src/crypto/range_proofs.h +++ b/src/crypto/range_proofs.h @@ -1,5 +1,5 @@ -// Copyright (c) 2021-2022 Zano Project (https://zano.org/) -// Copyright (c) 2021-2022 sowle (val@zano.org, crypto.sowle@gmail.com) +// Copyright (c) 2021-2023 Zano Project (https://zano.org/) +// Copyright (c) 2021-2023 sowle (val@zano.org, crypto.sowle@gmail.com) // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once @@ -66,12 +66,14 @@ namespace crypto static void calc_pedersen_commitment(const scalar_t& value, const scalar_t& mask, point_t& commitment) { - commitment = value * bpp_G + mask * bpp_H; + // commitment = value * bpp_G + mask * bpp_H + commitment = operator*(value, bpp_G) + mask * bpp_H; } static void calc_pedersen_commitment_2(const scalar_t& value, const scalar_t& mask1, const scalar_t& mask2, point_t& commitment) { - commitment = value * bpp_G + mask1 * bpp_H + mask2 * bpp_H2; + // commitment = value * bpp_G + mask1 * bpp_H * mask2 * bpp_H2 + commitment = operator*(value, bpp_G) + mask1 * bpp_H + mask2 * bpp_H2; } static const scalar_t& get_initial_transcript() @@ -126,9 +128,9 @@ namespace crypto return result; } - using typename gen_trait_t::bpp_G; - using typename gen_trait_t::bpp_H; - using typename gen_trait_t::bpp_H2; + using gen_trait_t::bpp_G; + using gen_trait_t::bpp_H; + using gen_trait_t::bpp_H2; }; // struct bpp_crypto_trait_zano diff --git a/src/currency_core/currency_basic.h b/src/currency_core/currency_basic.h index 76b48224..e64155c0 100644 --- a/src/currency_core/currency_basic.h +++ b/src/currency_core/currency_basic.h @@ -59,9 +59,10 @@ namespace currency const static crypto::hash ffff_hash = epee::string_tools::hex_to_pod("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); const static crypto::public_key ffff_pkey = epee::string_tools::hex_to_pod("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // TODO @#@# consider getting rid of this + // TODO: rewtire the following to a normal aggregate initialization once we move to C++17 -- sowle + const static crypto::public_key native_coin_asset_id = reinterpret_cast(static_cast(crypto::ec_scalar{'\xd6', '\x32', '\x9b', '\x5b', '\x1f', '\x7c', '\x08', '\x05', '\xb5', '\xc3', '\x45', '\xf4', '\x95', '\x75', '\x54', '\x00', '\x2a', '\x2f', '\x55', '\x78', '\x45', '\xf6', '\x4d', '\x76', '\x45', '\xda', '\xe0', '\xe0', '\x51', '\xa6', '\x49', '\x8a'})); // == crypto::c_point_H, checked in crypto_constants + const static crypto::public_key native_coin_asset_id_1div8 = reinterpret_cast(static_cast(crypto::ec_scalar{'\x74', '\xc3', '\x2d', '\x3e', '\xaa', '\xfa', '\xfc', '\x62', '\x3b', '\xf4', '\x83', '\xe8', '\x58', '\xd4', '\x2e', '\x8b', '\xf4', '\xec', '\x7d', '\xf0', '\x64', '\xad', '\xa2', '\xe3', '\x49', '\x34', '\x46', '\x9c', '\xff', '\x6b', '\x62', '\x68'})); // == 1/8 * crypto::c_point_H, checked in crypto_constants const static crypto::point_t native_coin_asset_id_pt = crypto::c_point_H; - const static crypto::public_key native_coin_asset_id = reinterpret_cast(crypto::ec_scalar{'\xd6', '\x32', '\x9b', '\x5b', '\x1f', '\x7c', '\x08', '\x05', '\xb5', '\xc3', '\x45', '\xf4', '\x95', '\x75', '\x54', '\x00', '\x2a', '\x2f', '\x55', '\x78', '\x45', '\xf6', '\x4d', '\x76', '\x45', '\xda', '\xe0', '\xe0', '\x51', '\xa6', '\x49', '\x8a'}); // == crypto::c_point_H, checked in crypto_constants - const static crypto::public_key native_coin_asset_id_1div8 = reinterpret_cast(crypto::ec_scalar{'\x74', '\xc3', '\x2d', '\x3e', '\xaa', '\xfa', '\xfc', '\x62', '\x3b', '\xf4', '\x83', '\xe8', '\x58', '\xd4', '\x2e', '\x8b', '\xf4', '\xec', '\x7d', '\xf0', '\x64', '\xad', '\xa2', '\xe3', '\x49', '\x34', '\x46', '\x9c', '\xff', '\x6b', '\x62', '\x68'}); // == 1/8 * crypto::c_point_H, checked in crypto_constants const static wide_difficulty_type global_difficulty_pow_starter = DIFFICULTY_POW_STARTER; const static wide_difficulty_type global_difficulty_pos_starter = DIFFICULTY_POS_STARTER;