Skip to content

Commit

Permalink
Review fix and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cypt4 committed Dec 30, 2024
1 parent 1b7254c commit ac5e911
Show file tree
Hide file tree
Showing 40 changed files with 2,130 additions and 424 deletions.
10 changes: 4 additions & 6 deletions components/brave_wallet/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,14 @@ static_library("browser") {
sources += [
"zcash/zcash_blocks_batch_scan_task.cc",
"zcash/zcash_blocks_batch_scan_task.h",
"zcash/zcash_create_shield_transaction_task.cc",
"zcash/zcash_create_shield_transaction_task.h",
"zcash/zcash_create_shielded_transaction_task.cc",
"zcash/zcash_create_shielded_transaction_task.h",
"zcash/zcash_create_orchard_to_orchard_transaction_task.cc",
"zcash/zcash_create_orchard_to_orchard_transaction_task.h",
"zcash/zcash_create_transparent_to_orchard_transaction_task.cc",
"zcash/zcash_create_transparent_to_orchard_transaction_task.h",
"zcash/zcash_scan_blocks_task.cc",
"zcash/zcash_scan_blocks_task.h",
"zcash/zcash_shield_sync_service.cc",
"zcash/zcash_shield_sync_service.h",
"zcash/zcash_update_subtree_roots_task.cc",
"zcash/zcash_update_subtree_roots_task.h",
"zcash/zcash_verify_chain_state_task.cc",
"zcash/zcash_verify_chain_state_task.h",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ OrchardSyncState::UpdateSubtreeRoots(
const mojom::AccountIdPtr& account_id,
uint32_t start_index,
const std::vector<zcash::mojom::SubtreeRootPtr>& roots) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return storage_.UpdateSubtreeRoots(account_id, start_index, roots);
// DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// return storage_.UpdateSubtreeRoots(account_id, start_index, roots);
return OrchardStorage::Result::kSuccess;
}

void OrchardSyncState::ResetDatabase() {
Expand Down
8 changes: 4 additions & 4 deletions components/brave_wallet/browser/internal/orchard_sync_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace brave_wallet {
class OrchardSyncState {
public:
explicit OrchardSyncState(const base::FilePath& path_to_database);
~OrchardSyncState();
virtual ~OrchardSyncState();

base::expected<OrchardStorage::AccountMeta, OrchardStorage::Error>
RegisterAccount(const mojom::AccountIdPtr& account_id,
Expand All @@ -42,7 +42,7 @@ class OrchardSyncState {
uint32_t reorg_block_id,
const std::string& reorg_block_hash);

base::expected<std::vector<OrchardNote>, OrchardStorage::Error>
virtual base::expected<std::vector<OrchardNote>, OrchardStorage::Error>
GetSpendableNotes(const mojom::AccountIdPtr& account_id);

base::expected<std::vector<OrchardNoteSpend>, OrchardStorage::Error>
Expand All @@ -59,7 +59,7 @@ class OrchardSyncState {
base::expected<std::optional<uint32_t>, OrchardStorage::Error>
GetLatestShardIndex(const mojom::AccountIdPtr& account_id);

base::expected<std::optional<uint32_t>, OrchardStorage::Error>
virtual base::expected<std::optional<uint32_t>, OrchardStorage::Error>
GetMaxCheckpointedHeight(const mojom::AccountIdPtr& account_id,
uint32_t chain_tip_height,
uint32_t min_confirmations);
Expand All @@ -76,7 +76,7 @@ class OrchardSyncState {
// Drops underlying database.
void ResetDatabase();

base::expected<std::vector<OrchardInput>, OrchardStorage::Error>
virtual base::expected<std::vector<OrchardInput>, OrchardStorage::Error>
CalculateWitnessForCheckpoint(const mojom::AccountIdPtr& account_id,
const std::vector<OrchardInput>& notes,
uint32_t checkpoint_position);
Expand Down
3 changes: 3 additions & 0 deletions components/brave_wallet/browser/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ source_set("brave_wallet_unit_tests") {
"//brave/components/brave_wallet/browser/internal/orchard_bundle_manager_unittest.cc",
"//brave/components/brave_wallet/browser/internal/orchard_storage/orchard_storage_unittest.cc",
"//brave/components/brave_wallet/browser/internal/orchard_sync_state_unittest.cc",
"//brave/components/brave_wallet/browser/zcash/zcash_blocks_batch_scan_task_unittest.cc",
"//brave/components/brave_wallet/browser/zcash/zcash_scan_blocks_task_unittest.cc",
"//brave/components/brave_wallet/browser/zcash/zcash_shield_sync_service_unittest.cc",
"//brave/components/brave_wallet/browser/zcash/zcash_verify_chain_state_task_unittest.cc",
]
deps += [
"//brave/components/brave_wallet/browser/internal:orchard_bundle",
Expand Down

This file was deleted.

4 changes: 3 additions & 1 deletion components/brave_wallet/browser/zcash/zcash_action_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef BRAVE_COMPONENTS_BRAVE_WALLET_BROWSER_ZCASH_ZCASH_ACTION_CONTEXT_H_
#define BRAVE_COMPONENTS_BRAVE_WALLET_BROWSER_ZCASH_ZCASH_ACTION_CONTEXT_H_

#include <string>

#include "base/memory/raw_ref.h"
#include "base/threading/sequence_bound.h"
#include "brave/components/brave_wallet/common/brave_wallet.mojom.h"
Expand Down Expand Up @@ -39,4 +41,4 @@ struct ZCashActionContext {

} // namespace brave_wallet

#endif // BRAVE_COMPONENTS_BRAVE_WALLET_BROWSER_ZCASH_ZCASH_SHIELDED_ACTION_CONTEXT_H_
#endif // BRAVE_COMPONENTS_BRAVE_WALLET_BROWSER_ZCASH_ZCASH_ACTION_CONTEXT_H_
Loading

0 comments on commit ac5e911

Please sign in to comment.