Skip to content

Commit

Permalink
review: fix last review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
onyb committed Aug 5, 2022
1 parent b9f8e33 commit 99580b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,7 @@ TEST_F(SolanaTransactionUnitTest, FromSignedTransactionBytes) {
67, 136, 209, 219, 42, 6, 169, 240, 137, 142, 185, 169, 6, 17,
87, 123, 6, 42, 55, 162, 64, 120, 91, 1, 2, 2, 0, 1,
12, 2, 0, 0, 0, 128, 150, 152, 0, 0, 0, 0, 0});
const std::vector<uint8_t> empty_signatures(
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
const std::vector<uint8_t> empty_signatures(128, 0);

for (size_t i = 1; i < valid_signed_tx_with_two_signer.size(); ++i) {
EXPECT_FALSE(SolanaTransaction::FromSignedTransactionBytes(
Expand Down
7 changes: 7 additions & 0 deletions components/brave_wallet/browser/solana_tx_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,13 @@ void SolanaTxManager::MakeTxDataFromBase64EncodedTransaction(

auto transaction =
SolanaTransaction::FromSignedTransactionBytes(*transaction_bytes);
if (!transaction) {
std::move(callback).Run(
nullptr, mojom::SolanaProviderError::kInternalError,
l10n_util::GetStringUTF8(IDS_WALLET_INTERNAL_ERROR));
return;
}

transaction->set_tx_type(std::move(tx_type));

if (send_options) {
Expand Down
6 changes: 6 additions & 0 deletions components/brave_wallet/browser/solana_tx_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,12 @@ TEST_F(SolanaTxManagerUnitTest, MakeTxDataFromBase64EncodedTransaction) {
"not a base64 message", mojom::TransactionType::SolanaSwap, nullptr,
nullptr, mojom::SolanaProviderError::kInternalError,
l10n_util::GetStringUTF8(IDS_WALLET_INTERNAL_ERROR));

// KO: valid base64 message, but invalid transaction bytes
TestMakeTxDataFromBase64EncodedTransaction(
"YW5p", mojom::TransactionType::SolanaSwap, nullptr, nullptr,
mojom::SolanaProviderError::kInternalError,
l10n_util::GetStringUTF8(IDS_WALLET_INTERNAL_ERROR));
}

TEST_F(SolanaTxManagerUnitTest, GetEstimatedTxFee) {
Expand Down

0 comments on commit 99580b9

Please sign in to comment.