Drop logging from wallet (#35145)
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/strings/pattern.h"
|
||||
#include "base/strings/strcat.h"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "base/check.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/string_view_util.h"
|
||||
#include "base/strings/utf_string_conversion_utils.h"
|
||||
@@ -59,7 +58,6 @@ std::string GetLegacyCryptoWalletsPassword(const std::string& password,
|
||||
const auto* argon_params =
|
||||
dict.FindDictByDottedPath("data.KeyringController.argonParams");
|
||||
if (!argon_params) {
|
||||
VLOG(0) << "data.KeyringController.argonParams is not dict";
|
||||
return std::string();
|
||||
}
|
||||
auto hash_len = argon_params->FindInt("hashLen");
|
||||
@@ -67,19 +65,16 @@ std::string GetLegacyCryptoWalletsPassword(const std::string& password,
|
||||
auto time = argon_params->FindInt("time");
|
||||
auto type = argon_params->FindInt("type");
|
||||
if (!hash_len || !mem || !time) {
|
||||
VLOG(0) << "missing hashLen, mem, time or type in argonParams";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
if (type != 2) {
|
||||
VLOG(0) << "Type should be Argon2_id";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const std::string* salt_str =
|
||||
dict.FindStringByDottedPath("data.KeyringController.salt");
|
||||
if (!salt_str) {
|
||||
VLOG(0) << "missing data.KeyringController.salt";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -104,7 +99,6 @@ std::string GetLegacyCryptoWalletsPassword(const std::string& password,
|
||||
if (argon2id_hash_raw(*time, *mem, 1, password.data(), password.size(),
|
||||
salt_str->data(), character_count, master_key.data(),
|
||||
*hash_len) != ARGON2_OK) {
|
||||
VLOG(1) << "argon2id_hash_raw failed";
|
||||
return std::string();
|
||||
}
|
||||
const std::string info = "metamask-encryptor";
|
||||
@@ -112,7 +106,6 @@ std::string GetLegacyCryptoWalletsPassword(const std::string& password,
|
||||
if (!HKDF(sub_key.data(), sub_key.size(), EVP_sha512(), master_key.data(),
|
||||
master_key.size(), nullptr, 0, (uint8_t*)info.data(),
|
||||
info.size())) {
|
||||
VLOG(1) << "HKDF failed";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -148,7 +141,6 @@ void ExternalWalletsImporter::Initialize(InitCallback callback) {
|
||||
if (type_ == mojom::ExternalWalletType::MetaMask) {
|
||||
extension = GetMetaMask();
|
||||
if (!extension) {
|
||||
VLOG(1) << "Failed to load MetaMask extension";
|
||||
std::move(callback).Run(false);
|
||||
return;
|
||||
}
|
||||
@@ -194,7 +186,6 @@ void ExternalWalletsImporter::GetImportInfo(
|
||||
}
|
||||
|
||||
if (password.empty()) {
|
||||
VLOG(1) << "password is empty";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kPasswordError));
|
||||
return;
|
||||
}
|
||||
@@ -231,7 +222,6 @@ void ExternalWalletsImporter::GetLocalStorage(
|
||||
|
||||
StorageFrontend* frontend = StorageFrontend::Get(context_);
|
||||
if (!frontend) {
|
||||
VLOG(1) << "Failed to read chrome.storage.local";
|
||||
std::move(callback).Run(false);
|
||||
return;
|
||||
}
|
||||
@@ -263,7 +253,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
DCHECK(IsInitialized());
|
||||
|
||||
if (password.empty()) {
|
||||
VLOG(0) << "Failed to get password of legacy Crypto Wallets";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kInternalError));
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +260,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
const std::string* vault_str =
|
||||
storage_data_->FindStringByDottedPath("data.KeyringController.vault");
|
||||
if (!vault_str) {
|
||||
VLOG(0) << "cannot find data.KeyringController.vault";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
@@ -279,7 +267,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
*vault_str,
|
||||
base::JSON_PARSE_CHROMIUM_EXTENSIONS | base::JSON_ALLOW_TRAILING_COMMAS);
|
||||
if (!vault) {
|
||||
VLOG(1) << "not a valid JSON: " << *vault_str;
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
@@ -287,26 +274,22 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
auto* iv_str = vault->FindString("iv");
|
||||
auto* salt_str = vault->FindString("salt");
|
||||
if (!data_str || !iv_str || !salt_str) {
|
||||
VLOG(1) << "data or iv or salt is missing";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
|
||||
auto salt_decoded = base::Base64Decode(*salt_str);
|
||||
if (!salt_decoded) {
|
||||
VLOG(1) << "base64 decode failed: " << *salt_str;
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
auto iv_decoded = base::Base64Decode(*iv_str);
|
||||
if (!iv_decoded) {
|
||||
VLOG(1) << "base64 decode failed: " << *iv_str;
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
auto data_decoded = base::Base64Decode(*data_str);
|
||||
if (!data_decoded) {
|
||||
VLOG(1) << "base64 decode failed: " << *data_str;
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
@@ -330,7 +313,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
}
|
||||
|
||||
if (!decrypted_keyrings) {
|
||||
VLOG(0) << "Importer decryption failed";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kPasswordError));
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +323,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
decrypted_keyrings_str,
|
||||
base::JSON_PARSE_CHROMIUM_EXTENSIONS | base::JSON_ALLOW_TRAILING_COMMAS);
|
||||
if (!keyrings) {
|
||||
VLOG(1) << "not a valid JSON: " << decrypted_keyrings_str;
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
@@ -353,7 +334,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
const auto& keyring = *keyring_listed.GetIfDict();
|
||||
const auto* type = keyring.FindString("type");
|
||||
if (!type) {
|
||||
VLOG(0) << "keyring.type is missing";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
@@ -375,8 +355,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
}
|
||||
}
|
||||
if (utf8_encoded_mnemonic.empty()) {
|
||||
VLOG(0) << "keyring.data.mnemonic is missing";
|
||||
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
@@ -390,7 +368,6 @@ void ExternalWalletsImporter::GetMnemonic(bool is_legacy_crypto_wallets,
|
||||
}
|
||||
|
||||
if (!mnemonic) {
|
||||
VLOG(0) << "Failed to find mnemonic in decrypted keyrings";
|
||||
std::move(callback).Run(base::unexpected(ImportError::kJsonError));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "brave/components/brave_wallet/browser/brave_wallet_service.h"
|
||||
#include "brave/components/brave_wallet/browser/tx_service.h"
|
||||
@@ -34,7 +33,6 @@ int GetStatusTitle(brave_wallet::mojom::TransactionStatus status) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
VLOG(1) << "No title for " << int(status) << " transaction status";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "brave/components/brave_wallet/browser/asset_ratio_response_parser.h"
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@@ -71,7 +70,6 @@ mojom::AssetPriceSource GetAssetPriceSource(const std::string& source) {
|
||||
std::vector<mojom::AssetPricePtr> ParseAssetPrices(
|
||||
const base::Value& json_value) {
|
||||
if (!json_value.is_list()) {
|
||||
LOG(ERROR) << "Invalid response, expected array";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -81,8 +79,6 @@ std::vector<mojom::AssetPricePtr> ParseAssetPrices(
|
||||
for (const auto& item : response_list) {
|
||||
auto payload = api::asset_ratio::AssetPricePayload::FromValue(item);
|
||||
if (!payload) {
|
||||
LOG(ERROR) << "Invalid response, could not parse AssetPricePayload:"
|
||||
<< item.DebugString();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -135,7 +131,6 @@ bool ParseAssetPriceHistory(const base::Value& json_value,
|
||||
// }
|
||||
|
||||
if (!json_value.is_dict()) {
|
||||
LOG(ERROR) << "Invalid response, could not parse JSON, JSON is not a dict";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@ std::string CreatePricingRequestPayload(
|
||||
if (auto coin_str = GetStringFromCoinType(request->coin)) {
|
||||
response_item.Set("coin", *coin_str);
|
||||
} else {
|
||||
LOG(ERROR) << "Invalid coin type: " << request->coin;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notimplemented.h"
|
||||
#include "base/notreached.h"
|
||||
#include "brave/components/brave_wallet/browser/bitcoin/bitcoin_block_tracker.h"
|
||||
@@ -172,7 +171,6 @@ void BitcoinTxManager::ApproveTransaction(const std::string& tx_meta_id,
|
||||
std::unique_ptr<BitcoinTxMeta> meta =
|
||||
GetBitcoinTxStateManager().GetBitcoinTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewBitcoinProviderError(
|
||||
@@ -206,7 +204,6 @@ void BitcoinTxManager::ContinueApproveTransaction(
|
||||
std::unique_ptr<BitcoinTxMeta> meta =
|
||||
GetBitcoinTxStateManager().GetBitcoinTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewBitcoinProviderError(
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -79,13 +78,9 @@ std::optional<uint32_t> ParseNullableStringAsUint32(const base::Value& value) {
|
||||
}
|
||||
|
||||
std::optional<base::DictValue> ParseJsonToDict(const std::string& json) {
|
||||
std::optional<base::DictValue> records_v = base::JSONReader::ReadDict(
|
||||
return base::JSONReader::ReadDict(
|
||||
json, base::JSON_PARSE_CHROMIUM_EXTENSIONS |
|
||||
base::JSONParserOptions::JSON_PARSE_RFC);
|
||||
if (!records_v) {
|
||||
VLOG(1) << "Invalid response, could not parse JSON, JSON is: " << json;
|
||||
}
|
||||
return records_v;
|
||||
}
|
||||
|
||||
std::string EmptyIfNull(const std::string* str) {
|
||||
@@ -249,7 +244,6 @@ bool ParseTokenList(const std::string& json, TokenListMap* token_list_map) {
|
||||
json, base::JSON_PARSE_CHROMIUM_EXTENSIONS |
|
||||
base::JSONParserOptions::JSON_PARSE_RFC);
|
||||
if (!records_v) {
|
||||
VLOG(1) << "Invalid response, could not parse JSON, JSON is: " << json;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -499,10 +493,6 @@ bool ParseChainList(const std::string& json, ChainList* result) {
|
||||
json, base::JSON_PARSE_CHROMIUM_EXTENSIONS |
|
||||
base::JSONParserOptions::JSON_PARSE_RFC);
|
||||
if (!records_v.has_value()) {
|
||||
LOG(ERROR) << "Invalid response, could not parse JSON. "
|
||||
<< records_v.error().message
|
||||
<< ", line: " << records_v.error().line
|
||||
<< ", col: " << records_v.error().column;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "base/containers/map_util.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "brave/components/brave_wallet/browser/network_manager.h"
|
||||
@@ -43,18 +42,15 @@ void HandleRampTokenLists(const std::optional<std::string>& result,
|
||||
}
|
||||
auto parsedRampTokensListMaps = ParseRampTokenListMaps(*result);
|
||||
if (!parsedRampTokensListMaps) {
|
||||
VLOG(1) << "Can't parse on/off ramp token lists.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (parsedRampTokensListMaps->first.empty()) {
|
||||
VLOG(1) << "On ramp supported token lists is empty.";
|
||||
} else {
|
||||
out.on_ramp_token_lists = std::move(parsedRampTokensListMaps->first);
|
||||
}
|
||||
|
||||
if (parsedRampTokensListMaps->second.empty()) {
|
||||
VLOG(1) << "Off ramp supported sell token lists is empty.";
|
||||
} else {
|
||||
out.off_ramp_token_lists = std::move(parsedRampTokensListMaps->second);
|
||||
}
|
||||
@@ -69,7 +65,6 @@ void HandleOnRampCurrenciesLists(const std::optional<std::string>& result,
|
||||
std::optional<std::vector<mojom::OnRampCurrency>> lists =
|
||||
ParseOnRampCurrencyLists(*result);
|
||||
if (!lists) {
|
||||
VLOG(1) << "Can't parse on ramp supported sell token lists.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,13 +75,7 @@ base::FilePath ResolveAbsolutePath(const base::FilePath& input_path) {
|
||||
// On some platforms (e.g. Mac) we use symlinks for paths. Convert paths to
|
||||
// absolute paths to avoid unexpected failure. base::MakeAbsoluteFilePath()
|
||||
// requires IO so it needs to be posted.
|
||||
const base::FilePath output_path = base::MakeAbsoluteFilePath(input_path);
|
||||
|
||||
if (output_path.empty()) {
|
||||
LOG(ERROR) << "Failed to get absolute install path.";
|
||||
}
|
||||
|
||||
return output_path;
|
||||
return base::MakeAbsoluteFilePath(input_path);
|
||||
}
|
||||
|
||||
std::optional<std::string> ParseJsonFile(base::FilePath path,
|
||||
@@ -98,7 +87,6 @@ std::optional<std::string> ParseJsonFile(base::FilePath path,
|
||||
std::string json_content;
|
||||
const base::FilePath json_path = path.AppendASCII(filename);
|
||||
if (!base::ReadFileToString(json_path, &json_content)) {
|
||||
LOG(ERROR) << "Can't read file: " << filename;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -114,7 +102,6 @@ void DoParseCoingeckoIdsMap(const base::FilePath& dir, ParseListsResult& out) {
|
||||
std::optional<CoingeckoIdsMap> coingecko_ids_map =
|
||||
ParseCoingeckoIdsMap(*result);
|
||||
if (!coingecko_ids_map) {
|
||||
VLOG(1) << "Can't parse coingecko-ids.json";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -129,7 +116,6 @@ void DoParseTokenList(const base::FilePath& dir, ParseListsResult& out) {
|
||||
|
||||
TokenListMap lists;
|
||||
if (!ParseTokenList(*result, &lists)) {
|
||||
VLOG(1) << "Can't parse token list.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,7 +132,6 @@ void DoParseChainList(const base::FilePath& dir, ParseListsResult& out) {
|
||||
|
||||
ChainList chains;
|
||||
if (!ParseChainList(*result, &chains)) {
|
||||
VLOG(1) << "Can't parse chain list.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,7 +151,6 @@ void DoParseDappLists(const base::FilePath& dir, ParseListsResult& out) {
|
||||
|
||||
std::optional<DappListMap> lists = ParseDappLists(converted_json);
|
||||
if (!lists) {
|
||||
VLOG(1) << "Can't parse dapp lists.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,7 +176,6 @@ void DoParseRestrictedAddressesLists(const base::FilePath& dir,
|
||||
std::optional<std::vector<std::string>> list =
|
||||
ParseRestrictedAddressesList(*result);
|
||||
if (!list) {
|
||||
VLOG(1) << "Can't parse restricted addresses list.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "base/check.h"
|
||||
#include "base/check_op.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/notreached.h"
|
||||
@@ -103,7 +102,6 @@ void BraveWalletP3A::Bind(
|
||||
}
|
||||
|
||||
void BraveWalletP3A::ReportUsage(bool unlocked) {
|
||||
VLOG(1) << "Wallet P3A: starting report";
|
||||
base::Time wallet_last_used =
|
||||
local_state_->GetTime(kBraveWalletLastUnlockTime);
|
||||
|
||||
@@ -371,7 +369,6 @@ void BraveWalletP3A::OnUpdateTimerFired() {
|
||||
}
|
||||
|
||||
void BraveWalletP3A::WriteUsageStatsToHistogram() {
|
||||
VLOG(1) << "Wallet P3A: Recording usage";
|
||||
UMA_HISTOGRAM_BOOLEAN(kBraveWalletMonthlyHistogramName, true);
|
||||
UMA_HISTOGRAM_BOOLEAN(kBraveWalletWeeklyHistogramName, true);
|
||||
UMA_HISTOGRAM_BOOLEAN(kBraveWalletDailyHistogramName, true);
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/check_op.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@@ -1266,8 +1265,6 @@ void BraveWalletService::GetPendingSignMessageErrors(
|
||||
void BraveWalletService::NotifySignMessageErrorProcessed(
|
||||
const std::string& id) {
|
||||
if (sign_message_errors_.empty() || sign_message_errors_.front()->id != id) {
|
||||
VLOG(1) << "id: " << id << " is not expected, should be "
|
||||
<< sign_message_errors_.front()->id;
|
||||
return;
|
||||
}
|
||||
sign_message_errors_.pop_front();
|
||||
@@ -1315,8 +1312,6 @@ void BraveWalletService::NotifySignSolTransactionsRequestProcessed(
|
||||
const std::optional<std::string>& error) {
|
||||
if (sign_sol_transactions_requests_.empty() ||
|
||||
sign_sol_transactions_requests_.front()->id != id) {
|
||||
VLOG(1) << "id: " << id << " is not expected, should be "
|
||||
<< sign_sol_transactions_requests_.front()->id;
|
||||
return;
|
||||
}
|
||||
auto callback = std::move(sign_sol_transactions_callbacks_.front());
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "base/containers/map_util.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "brave/components/brave_wallet/browser/json_rpc_service.h"
|
||||
|
||||
namespace brave_wallet {
|
||||
@@ -84,9 +83,6 @@ void EthBlockTracker::OnGetBlockNumber(const std::string& chain_id,
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnLatestBlock(chain_id, block_num);
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG(ERROR) << "GetBlockNumber failed";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace brave_wallet {
|
||||
|
||||
@@ -71,8 +70,6 @@ void EthLogsTracker::OnGetLogs(const std::string& subscription,
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnLogsReceived(subscription, rawlogs.Clone());
|
||||
}
|
||||
} else {
|
||||
LOG(ERROR) << "OnGetLogs failed";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "base/base64.h"
|
||||
#include "base/check.h"
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_wallet/browser/rlp_encode.h"
|
||||
#include "brave/components/brave_wallet/common/eth_address.h"
|
||||
@@ -250,7 +249,6 @@ bool EthTransaction::ProcessVRS(const std::vector<uint8_t>& v,
|
||||
}
|
||||
|
||||
if (!HexValueToUint256(ToHex(v), &v_)) {
|
||||
LOG(ERROR) << "Unable to decode v param";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/logging.h"
|
||||
#include "brave/components/brave_wallet/browser/brave_wallet_constants.h"
|
||||
#include "brave/components/brave_wallet/browser/brave_wallet_utils.h"
|
||||
#include "brave/components/brave_wallet/browser/eip1559_transaction.h"
|
||||
@@ -120,7 +119,6 @@ mojom::TransactionInfoPtr EthTxMeta::ToTransactionInfo() const {
|
||||
std::optional<std::string> final_recipient;
|
||||
auto tx_info = GetTransactionInfoFromData(data);
|
||||
if (!tx_info) {
|
||||
LOG(ERROR) << "Error parsing transaction data: " << ToHex(data);
|
||||
} else {
|
||||
mojom::SwapInfoPtr swap_info_from_data;
|
||||
std::tie(tx_type, tx_params, tx_args, swap_info_from_data) =
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_wallet/browser/brave_wallet_utils.h"
|
||||
#include "brave/components/brave_wallet/browser/eip1559_transaction.h"
|
||||
@@ -110,7 +109,6 @@ std::unique_ptr<TxMeta> EthTxStateManager::ValueToTxMeta(
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG(ERROR) << "tx type is not supported";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "brave/components/brave_wallet/browser/json_rpc_service.h"
|
||||
|
||||
namespace brave_wallet {
|
||||
@@ -56,8 +55,6 @@ void FilBlockTracker::OnGetFilBlockHeight(const std::string& chain_id,
|
||||
}
|
||||
|
||||
if (error != mojom::FilecoinProviderError::kSuccess) {
|
||||
VLOG(1) << __FUNCTION__ << ": Failed to get latest height, error: "
|
||||
<< static_cast<int>(error) << ", error_message: " << error_message;
|
||||
return;
|
||||
}
|
||||
if (GetLatestHeight(chain_id) == latest_height) {
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/check_op.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notimplemented.h"
|
||||
#include "brave/components/brave_wallet/browser/account_resolver_delegate.h"
|
||||
#include "brave/components/brave_wallet/browser/fil_block_tracker.h"
|
||||
@@ -147,7 +145,6 @@ void FilTxManager::ApproveTransaction(const std::string& tx_meta_id,
|
||||
ApproveTransactionCallback callback) {
|
||||
std::unique_ptr<FilTxMeta> meta = GetFilTxStateManager().GetFilTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewFilecoinProviderError(
|
||||
@@ -176,7 +173,6 @@ void FilTxManager::OnGetNextNonce(std::unique_ptr<FilTxMeta> meta,
|
||||
if (!success) {
|
||||
meta->set_status(mojom::TransactionStatus::Error);
|
||||
tx_state_manager().AddOrUpdateTx(*meta);
|
||||
LOG(ERROR) << "GetNextNonce failed";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewFilecoinProviderError(
|
||||
@@ -285,7 +281,6 @@ void FilTxManager::GetFilTransactionMessageToSign(
|
||||
GetFilTransactionMessageToSignCallback callback) {
|
||||
std::unique_ptr<FilTxMeta> meta = GetFilTxStateManager().GetFilTx(tx_meta_id);
|
||||
if (!meta || !meta->tx()) {
|
||||
VLOG(1) << __FUNCTION__ << "No transaction found with id:" << tx_meta_id;
|
||||
std::move(callback).Run(std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "base/containers/span_rust.h"
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -119,7 +118,6 @@ bool FilecoinKeyring::DecodeImportPayload(
|
||||
key_payload, base::JSON_PARSE_CHROMIUM_EXTENSIONS |
|
||||
base::JSONParserOptions::JSON_PARSE_RFC);
|
||||
if (!records_v) {
|
||||
VLOG(1) << "Invalid payload, could not parse JSON";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "base/containers/span_reader.h"
|
||||
#include "base/containers/span_writer.h"
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/numerics/byte_conversions.h"
|
||||
#include "brave/components/brave_wallet/browser/internal/hd_key_common.h"
|
||||
#include "brave/components/brave_wallet/common/hash_utils.h"
|
||||
@@ -97,7 +96,6 @@ std::unique_ptr<HDKey::ParsedExtendedKey> HDKey::GenerateFromExtendedKey(
|
||||
const std::string& key) {
|
||||
std::vector<unsigned char> decoded_key(kSerializationLength);
|
||||
if (!DecodeBase58Check(key, decoded_key, decoded_key.size())) {
|
||||
LOG(ERROR) << __func__ << ": DecodeBase58Check failed";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -170,7 +168,6 @@ void HDKey::SetPublicKey(
|
||||
secp256k1_pubkey pubkey;
|
||||
if (!secp256k1_ec_pubkey_parse(GetSecp256k1Ctx(), &pubkey, value.data(),
|
||||
value.size())) {
|
||||
LOG(ERROR) << __func__ << ": not a valid public key";
|
||||
return;
|
||||
}
|
||||
public_key_ = base::ToVector(value);
|
||||
@@ -187,13 +184,12 @@ std::vector<uint8_t> HDKey::GetUncompressedPublicKey() const {
|
||||
secp256k1_pubkey pubkey;
|
||||
if (!secp256k1_ec_pubkey_parse(GetSecp256k1Ctx(), &pubkey, public_key_.data(),
|
||||
public_key_.size())) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_pubkey_parse failed";
|
||||
return public_key;
|
||||
}
|
||||
if (!secp256k1_ec_pubkey_serialize(GetSecp256k1Ctx(), public_key.data(),
|
||||
&public_key_len, &pubkey,
|
||||
SECP256K1_EC_UNCOMPRESSED)) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_pubkey_serialize failed";
|
||||
return public_key;
|
||||
}
|
||||
|
||||
return public_key;
|
||||
@@ -284,7 +280,6 @@ std::unique_ptr<HDKey> HDKey::DeriveChild(const DerivationIndex& index) {
|
||||
unsigned int out_len;
|
||||
if (!HMAC(EVP_sha512(), chain_code_.data(), chain_code_.size(), data.data(),
|
||||
data.size(), hmac.data(), &out_len)) {
|
||||
LOG(ERROR) << __func__ << ": HMAC_SHA512 failed";
|
||||
return nullptr;
|
||||
}
|
||||
DCHECK(out_len == kSHA512Length);
|
||||
@@ -301,7 +296,6 @@ std::unique_ptr<HDKey> HDKey::DeriveChild(const DerivationIndex& index) {
|
||||
SecureVector private_key = private_key_;
|
||||
if (!secp256k1_ec_seckey_tweak_add(GetSecp256k1Ctx(), private_key.data(),
|
||||
hmac_span.first<32>().data())) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_seckey_tweak_add failed";
|
||||
return nullptr;
|
||||
}
|
||||
if (!hdkey->SetPrivateKey(
|
||||
@@ -315,13 +309,11 @@ std::unique_ptr<HDKey> HDKey::DeriveChild(const DerivationIndex& index) {
|
||||
secp256k1_pubkey pubkey;
|
||||
if (!secp256k1_ec_pubkey_parse(GetSecp256k1Ctx(), &pubkey,
|
||||
public_key_.data(), public_key_.size())) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_pubkey_parse failed";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!secp256k1_ec_pubkey_tweak_add(GetSecp256k1Ctx(), &pubkey,
|
||||
hmac_span.first<32>().data())) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_pubkey_tweak_add failed";
|
||||
return nullptr;
|
||||
}
|
||||
size_t public_key_len = kSecp256k1PubkeySize;
|
||||
@@ -329,7 +321,6 @@ std::unique_ptr<HDKey> HDKey::DeriveChild(const DerivationIndex& index) {
|
||||
if (!secp256k1_ec_pubkey_serialize(GetSecp256k1Ctx(), public_key.data(),
|
||||
&public_key_len, &pubkey,
|
||||
SECP256K1_EC_COMPRESSED)) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_pubkey_serialize failed";
|
||||
return nullptr;
|
||||
}
|
||||
hdkey->SetPublicKey(public_key);
|
||||
@@ -402,7 +393,6 @@ std::optional<std::vector<uint8_t>> HDKey::SignDer(Secp256k1SignMsgSpan msg) {
|
||||
if (!secp256k1_ecdsa_sign(
|
||||
GetSecp256k1Ctx(), &ecdsa_sig, msg.data(), private_key_.data(),
|
||||
secp256k1_nonce_function_rfc6979, extra_entropy)) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ecdsa_sign failed";
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
@@ -425,19 +415,15 @@ bool HDKey::VerifyForTesting(Secp256k1SignMsgSpan msg,
|
||||
secp256k1_ecdsa_signature ecdsa_sig;
|
||||
if (!secp256k1_ecdsa_signature_parse_compact(GetSecp256k1Ctx(), &ecdsa_sig,
|
||||
sig.data())) {
|
||||
LOG(ERROR) << __func__
|
||||
<< ": secp256k1_ecdsa_signature_parse_compact failed";
|
||||
return false;
|
||||
}
|
||||
secp256k1_pubkey pubkey;
|
||||
if (!secp256k1_ec_pubkey_parse(GetSecp256k1Ctx(), &pubkey, public_key_.data(),
|
||||
public_key_.size())) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ec_pubkey_parse failed";
|
||||
return false;
|
||||
}
|
||||
if (!secp256k1_ecdsa_verify(GetSecp256k1Ctx(), &ecdsa_sig, msg.data(),
|
||||
&pubkey)) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ecdsa_verify failed";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -465,23 +451,18 @@ std::optional<std::vector<uint8_t>> HDKey::RecoverCompact(
|
||||
secp256k1_ecdsa_recoverable_signature ecdsa_sig;
|
||||
if (!secp256k1_ecdsa_recoverable_signature_parse_compact(
|
||||
GetSecp256k1Ctx(), &ecdsa_sig, sig.rs_bytes().data(), sig.recid())) {
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": secp256k1_ecdsa_recoverable_signature_parse_compact failed";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
secp256k1_pubkey pubkey;
|
||||
if (!secp256k1_ecdsa_recover(GetSecp256k1Ctx(), &pubkey, &ecdsa_sig,
|
||||
msg.data())) {
|
||||
LOG(ERROR) << __func__ << ": secp256k1_ecdsa_recover failed";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!secp256k1_ec_pubkey_serialize(
|
||||
GetSecp256k1Ctx(), public_key.data(), &public_key_len, &pubkey,
|
||||
compressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED)) {
|
||||
LOG(ERROR) << "secp256k1_ec_pubkey_serialize failed";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -492,14 +473,13 @@ void HDKey::GeneratePublicKey() {
|
||||
secp256k1_pubkey public_key;
|
||||
if (!secp256k1_ec_pubkey_create(GetSecp256k1Ctx(), &public_key,
|
||||
private_key_.data())) {
|
||||
LOG(ERROR) << "secp256k1_ec_pubkey_create failed";
|
||||
return;
|
||||
}
|
||||
size_t public_key_len = 33;
|
||||
if (!secp256k1_ec_pubkey_serialize(GetSecp256k1Ctx(), public_key_.data(),
|
||||
&public_key_len, &public_key,
|
||||
SECP256K1_EC_COMPRESSED)) {
|
||||
LOG(ERROR) << "secp256k1_ec_pubkey_serialize failed";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/types/expected.h"
|
||||
#include "base/values.h"
|
||||
@@ -360,7 +359,6 @@ std::optional<std::vector<mojom::MeldCountryPtr>> ParseCountries(
|
||||
// }
|
||||
// ]
|
||||
if (!json_value.is_list()) {
|
||||
LOG(ERROR) << "Invalid response, could not parse JSON, JSON is not a list";
|
||||
return std::nullopt;
|
||||
}
|
||||
std::vector<mojom::MeldCountryPtr> countries;
|
||||
@@ -368,7 +366,6 @@ std::optional<std::vector<mojom::MeldCountryPtr>> ParseCountries(
|
||||
const auto country_value =
|
||||
meld_integration_responses::Country::FromValue(country_item);
|
||||
if (!country_value) {
|
||||
LOG(ERROR) << "Invalid response, could not parse JSON";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
#include "brave/components/brave_wallet/browser/brave_wallet_constants.h"
|
||||
#include "brave/components/brave_wallet/browser/json_rpc_service.h"
|
||||
|
||||
@@ -73,8 +72,6 @@ void SolanaBlockTracker::OnGetLatestBlockhash(
|
||||
}
|
||||
|
||||
if (error != mojom::SolanaProviderError::kSuccess) {
|
||||
VLOG(1) << __FUNCTION__ << ": Failed to get latest blockhash, error: "
|
||||
<< static_cast<int>(error) << ", error_message: " << error_message;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "base/base64.h"
|
||||
#include "base/check.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notimplemented.h"
|
||||
#include "brave/components/brave_wallet/browser/account_resolver_delegate.h"
|
||||
#include "brave/components/brave_wallet/browser/blockchain_registry.h"
|
||||
@@ -304,7 +303,6 @@ void SolanaTxManager::ApproveTransaction(const std::string& tx_meta_id,
|
||||
std::unique_ptr<SolanaTxMeta> meta =
|
||||
GetSolanaTxStateManager().GetSolanaTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewSolanaProviderError(
|
||||
@@ -432,7 +430,6 @@ void SolanaTxManager::OnSendSolanaTransaction(
|
||||
const std::string& error_message) {
|
||||
std::unique_ptr<TxMeta> meta = tx_state_manager().GetTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewSolanaProviderError(
|
||||
@@ -672,7 +669,6 @@ void SolanaTxManager::GetSolTransactionMessageToSign(
|
||||
std::unique_ptr<SolanaTxMeta> meta =
|
||||
GetSolanaTxStateManager().GetSolanaTx(tx_meta_id);
|
||||
if (!meta || !meta->tx()) {
|
||||
VLOG(1) << __FUNCTION__ << "No transaction found with id:" << tx_meta_id;
|
||||
std::move(callback).Run(std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1267,10 +1267,6 @@ mojom::Gate3SwapRoutePtr ParseRoute(
|
||||
swap_responses::Gate3SwapNetworkFee::FromValue(value.network_fee);
|
||||
if (network_fee_value) {
|
||||
result->network_fee = ParseNetworkFee(*network_fee_value);
|
||||
} else {
|
||||
// Log if parsing failed but network_fee was present
|
||||
LOG(ERROR) << "Failed to parse Gate3SwapNetworkFee from value: "
|
||||
<< value.network_fee;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/logging.h"
|
||||
#include "brave/components/brave_wallet/browser/block_tracker.h"
|
||||
#include "brave/components/brave_wallet/browser/brave_wallet_constants.h"
|
||||
#include "brave/components/brave_wallet/browser/keyring_service.h"
|
||||
@@ -60,7 +59,6 @@ void TxManager::RejectTransaction(const std::string& tx_meta_id,
|
||||
RejectTransactionCallback callback) {
|
||||
std::unique_ptr<TxMeta> meta = tx_state_manager_->GetTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "No transaction found";
|
||||
std::move(callback).Run(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "brave/components/brave_wallet/browser/keyring_service.h"
|
||||
@@ -29,10 +28,8 @@ namespace {
|
||||
std::unique_ptr<OrchardBundleManager> ApplyOrchardSignatures(
|
||||
std::unique_ptr<OrchardBundleManager> orchard_bundle_manager,
|
||||
std::array<uint8_t, kZCashDigestSize> sighash) {
|
||||
DVLOG(1) << "Apply signatures for ZCash transaction";
|
||||
// Heavy CPU operation, should be executed on background thread
|
||||
auto result = orchard_bundle_manager->ApplySignature(sighash);
|
||||
DVLOG(1) << "Signatures applied";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -9,7 +9,6 @@
|
||||
#include <variant>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "brave/components/brave_wallet/browser/zcash/zcash_transaction_utils.h"
|
||||
#include "brave/components/brave_wallet/common/brave_wallet.mojom.h"
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notimplemented.h"
|
||||
#include "base/notreached.h"
|
||||
#include "brave/components/brave_wallet/browser/zcash/zcash_block_tracker.h"
|
||||
@@ -154,7 +153,6 @@ void ZCashTxManager::ApproveTransaction(const std::string& tx_meta_id,
|
||||
std::unique_ptr<ZCashTxMeta> meta =
|
||||
GetZCashTxStateManager().GetZCashTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewZcashProviderError(
|
||||
@@ -207,7 +205,6 @@ void ZCashTxManager::ContinueApproveTransaction(
|
||||
std::unique_ptr<ZCashTxMeta> meta =
|
||||
GetZCashTxStateManager().GetZCashTx(tx_meta_id);
|
||||
if (!meta) {
|
||||
LOG(ERROR) << "Transaction should be found";
|
||||
std::move(callback).Run(
|
||||
false,
|
||||
mojom::ProviderErrorUnion::NewZcashProviderError(
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "base/check.h"
|
||||
#include "base/containers/extend.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
@@ -198,7 +197,6 @@ EthSignTypedDataHelper::EncodeField(const std::string_view type,
|
||||
|
||||
if (type.ends_with(']')) {
|
||||
if (version_ != Version::kV4) {
|
||||
VLOG(0) << "version has to be v4 to support array";
|
||||
return std::nullopt;
|
||||
}
|
||||
if (!value.is_list()) {
|
||||
|
||||
Reference in New Issue
Block a user