-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate all zcash_client_sqlite
pool tests to zcash_client_backend
and make them generic over backend implementation
#1533
Open
willemolding
wants to merge
10
commits into
zcash:main
Choose a base branch
from
ChainSafe:willem/migrate-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0daca1f
migrate 3 more tests across
willemolding 526be27
adds new trait method to implement change_note_spends_succeed
willemolding ad30ad6
remove the raw field on get_tx_history as it broke tests
willemolding bb4dd30
fix issue querying notes
willemolding 6297428
add error handling
willemolding 3689aec
migrate send_multi_step_proposed_transfer
willemolding 9d5e305
add data_api methods to allow fetching historical checkpoints
willemolding bf29e8b
global fmt
willemolding a648a52
fix clippy lints
willemolding 7f96b13
feature gate orchard import
willemolding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,7 @@ pub struct TransactionSummary<AccountId> { | |
memo_count: usize, | ||
expired_unmined: bool, | ||
is_shielding: bool, | ||
raw: Vec<u8>, | ||
} | ||
|
||
impl<AccountId> TransactionSummary<AccountId> { | ||
|
@@ -118,6 +119,7 @@ impl<AccountId> TransactionSummary<AccountId> { | |
memo_count: usize, | ||
expired_unmined: bool, | ||
is_shielding: bool, | ||
raw: &[u8], | ||
) -> Self { | ||
Self { | ||
account_id, | ||
|
@@ -133,6 +135,7 @@ impl<AccountId> TransactionSummary<AccountId> { | |
memo_count, | ||
expired_unmined, | ||
is_shielding, | ||
raw: raw.to_vec(), | ||
} | ||
} | ||
|
||
|
@@ -701,7 +704,7 @@ where | |
Cache: TestCache, | ||
<Cache::BlockSource as BlockSource>::Error: fmt::Debug, | ||
ParamsT: consensus::Parameters + Send + 'static, | ||
DbT: InputSource + WalletWrite + WalletCommitmentTrees, | ||
DbT: InputSource<AccountId = <DbT as WalletRead>::AccountId, Error = <DbT as WalletRead>::Error> + WalletWrite + WalletCommitmentTrees, | ||
<DbT as WalletRead>::AccountId: ConditionallySelectable + Default + Send + 'static, | ||
{ | ||
/// Invokes [`scan_cached_blocks`] with the given arguments, expecting success. | ||
|
@@ -756,6 +759,23 @@ where | |
|
||
Ok(()) | ||
} | ||
|
||
pub fn add_funds<Fvk: TestFvk>(&mut self, account: &TestAccount<<DbT as WalletRead>::Account>, fvk: &Fvk, value: NonNegativeAmount) { | ||
let account_id = account.id(); | ||
|
||
let (h, _, _) = self.generate_next_block(&fvk, AddressType::DefaultExternal, value); | ||
self.scan_cached_blocks(h, 1); | ||
|
||
assert_eq!( | ||
self.wallet() | ||
.block_max_scanned() | ||
.unwrap() | ||
.unwrap() | ||
.block_height(), | ||
h | ||
); | ||
assert_eq!(self.get_spendable_balance(account_id, 1), value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assertion being embedded here is a bit surprising, because a caller could reasonably expect to be able to call this in locations other than just at the start of a test. |
||
} | ||
} | ||
|
||
impl<Cache, DbT, ParamsT, AccountIdT, ErrT> TestState<Cache, DbT, ParamsT> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #1539 I'm moving these to a dedicated
WalletTest
trait so we can freely expose whatever internals are needed for testing purposes. (I'll handle any conflicts.)