Revert Boost BigInt workaround
This commit is contained in:
@@ -16,8 +16,6 @@ patches/**/*.patchinfo
|
||||
/third_party/argon2/src
|
||||
/third_party/ethash/src
|
||||
/third_party/bitcoin-core/src
|
||||
/third_party/boost/config
|
||||
/third_party/boost/multiprecision
|
||||
/third_party/rust/cxx
|
||||
*.xcodeproj
|
||||
*.swp
|
||||
|
||||
@@ -24,8 +24,6 @@ deps = {
|
||||
"third_party/ethash/src": "https://github.com/chfast/ethash.git@e4a15c3d76dc09392c7efd3e30d84ee3b871e9ce",
|
||||
"third_party/bitcoin-core/src": "https://github.com/bitcoin/bitcoin.git@95ea54ba089610019a74c1176a2c7c0dba144b1c",
|
||||
"third_party/argon2/src": "https://github.com/P-H-C/phc-winner-argon2.git@62358ba2123abd17fccf2a108a301d4b52c01a7c",
|
||||
"third_party/boost/config": "https://github.com/boostorg/config.git@e108255ffb5d2557ed3398b3fc575a2e9fd434cc",
|
||||
"third_party/boost/multiprecision": "https://github.com/boostorg/multiprecision.git@32aefd37f055cc2abeced1cd2873b4564ea339f2",
|
||||
}
|
||||
|
||||
recursedeps = [
|
||||
|
||||
@@ -28,6 +28,10 @@ if (is_redirect_cc_build) {
|
||||
}
|
||||
|
||||
config("compiler") {
|
||||
cflags = [
|
||||
"-Xclang",
|
||||
"-fexperimental-max-bitint-width=256",
|
||||
]
|
||||
configs = [ ":brave_chromium_src_support" ]
|
||||
if (is_redirect_cc_build) {
|
||||
configs -= [ ":brave_chromium_src_support" ]
|
||||
|
||||
@@ -125,9 +125,9 @@ absl::optional<std::string> GetBoolFromData(const std::vector<uint8_t>& input,
|
||||
if (!value)
|
||||
return absl::nullopt;
|
||||
|
||||
if (value == 0)
|
||||
if (value == static_cast<uint256_t>(0))
|
||||
return "false";
|
||||
else if (value == 1)
|
||||
else if (value == static_cast<uint256_t>(1))
|
||||
return "true";
|
||||
|
||||
return absl::nullopt;
|
||||
|
||||
@@ -178,7 +178,9 @@ void FilTxManager::OnGetNextNonce(std::unique_ptr<FilTxMeta> meta,
|
||||
l10n_util::GetStringUTF8(IDS_WALLET_GET_NONCE_ERROR));
|
||||
return;
|
||||
}
|
||||
DCHECK_LE(nonce, static_cast<uint256_t>(UINT64_MAX));
|
||||
// DCHECK_LE will eventually be expanded into `CheckOpValueStr` which doesn't
|
||||
// have uint256_t overload.
|
||||
DCHECK(nonce <= static_cast<uint256_t>(UINT64_MAX));
|
||||
meta->tx()->set_nonce(static_cast<uint64_t>(nonce));
|
||||
DCHECK(!keyring_service_->IsLocked());
|
||||
meta->set_status(mojom::TransactionStatus::Approved);
|
||||
@@ -296,7 +298,9 @@ void FilTxManager::OnGetNextNonceForHardware(
|
||||
std::move(callback).Run(nullptr);
|
||||
return;
|
||||
}
|
||||
DCHECK_LE(nonce, static_cast<uint256_t>(UINT64_MAX));
|
||||
// DCHECK_LE will eventually be expanded into `CheckOpValueStr` which doesn't
|
||||
// have uint256_t overload.
|
||||
DCHECK(nonce <= static_cast<uint256_t>(UINT64_MAX));
|
||||
meta->tx()->set_nonce(static_cast<uint64_t>(nonce));
|
||||
DCHECK(!keyring_service_->IsLocked());
|
||||
meta->set_status(mojom::TransactionStatus::Approved);
|
||||
|
||||
@@ -52,8 +52,6 @@ static_library("common") {
|
||||
"//net",
|
||||
"//url",
|
||||
]
|
||||
|
||||
public_deps = [ "//brave/third_party/boost" ]
|
||||
}
|
||||
|
||||
source_set("common_constants") {
|
||||
|
||||
@@ -11,29 +11,25 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/values.h"
|
||||
#include "boost/multiprecision/cpp_int.hpp"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace brave_wallet {
|
||||
|
||||
typedef boost::multiprecision::uint256_t uint256_t;
|
||||
typedef boost::multiprecision::int256_t int256_t;
|
||||
using uint256_t = unsigned _BitInt(256);
|
||||
using int256_t = _BitInt(256);
|
||||
|
||||
typedef boost::multiprecision::uint128_t uint128_t;
|
||||
typedef boost::multiprecision::int128_t int128_t;
|
||||
|
||||
// Note that boost's int256/128_t has 256/128 precision bits and it uses an
|
||||
// extra sign bit so its max and min value differs from 2's complement types.
|
||||
using uint128_t = unsigned _BitInt(128);
|
||||
using int128_t = _BitInt(128);
|
||||
|
||||
// 2^255 - 1
|
||||
constexpr int256_t kMax256BitInt = std::numeric_limits<int256_t>::max() >> 1;
|
||||
constexpr int256_t kMax256BitInt = std::numeric_limits<int256_t>::max();
|
||||
// -(2^255 -1)
|
||||
constexpr int256_t kMin256BitInt = std::numeric_limits<int256_t>::min() >> 1;
|
||||
constexpr int256_t kMin256BitInt = std::numeric_limits<int256_t>::min();
|
||||
|
||||
// 2^128 - 1
|
||||
constexpr int128_t kMax128BitInt = std::numeric_limits<int128_t>::max() >> 1;
|
||||
// -(2^128 -1)
|
||||
constexpr int128_t kMin128BitInt = std::numeric_limits<int128_t>::min() >> 1;
|
||||
// 2^127 - 1
|
||||
constexpr int128_t kMax128BitInt = std::numeric_limits<int128_t>::max();
|
||||
// -(2^127 -1)
|
||||
constexpr int128_t kMin128BitInt = std::numeric_limits<int128_t>::min();
|
||||
|
||||
constexpr uint64_t kMaxSafeIntegerUint64 = 9007199254740991; // 2^53-1
|
||||
|
||||
|
||||
@@ -136,12 +136,7 @@ bool HexValueToInt256(const std::string& hex_input, int256_t* out) {
|
||||
// This is the same as ~val + 1
|
||||
// To convert a positive number into a negative number, using the two’s
|
||||
// complement representation, invert all of the bits of the number + 1
|
||||
if (val >> 255) {
|
||||
*out = ~val + 1;
|
||||
*out = -*out;
|
||||
} else {
|
||||
*out = static_cast<int256_t>(val);
|
||||
}
|
||||
*out = static_cast<int256_t>(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
config("boost_config") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
defines = [
|
||||
"BOOST_MP_STANDALONE=1",
|
||||
"BOOST_NO_EXCEPTIONS=1",
|
||||
"BOOST_DISABLE_THREADS=1",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"config/include",
|
||||
"multiprecision/include",
|
||||
]
|
||||
}
|
||||
|
||||
group("boost") {
|
||||
visibility = [ "//brave/components/brave_wallet/common" ]
|
||||
public_configs = [ ":boost_config" ]
|
||||
}
|
||||
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
Name: Boost Library
|
||||
URL: https://github.com/boostorg/boost
|
||||
License: Boost Software License 1.0
|
||||
License File: LICENSE
|
||||
|
||||
Reference in New Issue
Block a user