-
Notifications
You must be signed in to change notification settings - Fork 256
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
Generalize the zcash_client_sqlite
test framework and extract it to zcash_client_backend
#1530
Conversation
6b6b310
to
33ba129
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1530 +/- ##
==========================================
+ Coverage 61.07% 61.26% +0.18%
==========================================
Files 142 146 +4
Lines 16710 16890 +180
==========================================
+ Hits 10205 10347 +142
- Misses 6505 6543 +38 ☔ View full report in Codecov by Sentry. |
647c266
to
4a3a52b
Compare
… moved to `zcash_client_backend`
baade4f
to
f2654f5
Compare
44d9fc5
to
33b8f89
Compare
…st from `zcash_client_sqlite`
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.
Reviewed d4e26d5.
@@ -346,9 +346,11 @@ pub enum AccountSource { | |||
} | |||
|
|||
/// A set of capabilities that a client account must provide. | |||
pub trait Account<AccountId: Copy> { | |||
pub trait Account { | |||
type AccountId: Copy; |
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.
Why was this made a type parameter in the first place? I can't immediately think of a reason why an implementation of the Data Access API would have two different Account
implementations with different IDs.
@@ -662,12 +662,22 @@ impl<NoteRef> SpendableNotes<NoteRef> { | |||
self.sapling.as_ref() | |||
} | |||
|
|||
/// Consumes this value and returns the Sapling notes contained within it. | |||
pub fn take_sapling(self) -> Vec<ReceivedNote<NoteRef, sapling::Note>> { |
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.
Document this addition in the changelog (it was added in the ambassador
commit and IDK why yet).
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.
It is used in conjunction with the fix to #1260 inside the implementation of ShieldedPoolTester
for Sapling (and similarly for Orchard). So it could instead be made crate-private now that SaplingPoolTester
is also in zcash_client_backend
instead of documenting it as an addition.
/// Returns the set of spendable Orchard notes. | ||
#[cfg(feature = "orchard")] | ||
pub fn orchard(&self) -> &[ReceivedNote<NoteRef, orchard::note::Note>] { | ||
self.orchard.as_ref() | ||
} | ||
|
||
/// Consumes this value and returns the Orchard notes contained within it. | ||
pub fn take_orchard(self) -> Vec<ReceivedNote<NoteRef, orchard::note::Note>> { |
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.
Document this addition in the changelog (it was added in the ambassador
commit and IDK why yet).
anchor_height, | ||
exclude, | ||
)?, | ||
if sources.contains(&ShieldedProtocol::Sapling) { |
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.
|
||
use super::{pool::ShieldedPoolTester, TestState}; | ||
|
||
pub struct SaplingPoolTester; |
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.
The struct needs documentation now that it is in the public API.
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.
Addressed in #1539.
|
||
/// Trait that exposes the pool-specific types and operations necessary to run the | ||
/// single-shielded-pool tests on a given pool. | ||
pub trait ShieldedPoolTester { |
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.
The trait's associated types and methods need documentation now that it is in the public API.
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.
Addressed in #1539.
wallet::{Note, ReceivedNote}, | ||
}; | ||
|
||
pub struct OrchardPoolTester; |
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.
The struct needs documentation now that it is in the public API.
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.
Addressed in #1539.
@@ -88,3 +98,143 @@ pub trait ShieldedPoolTester { | |||
|
|||
fn received_note_count(summary: &ScanSummary) -> usize; | |||
} | |||
|
|||
pub fn send_single_step_proposed_transfer<T: ShieldedPoolTester>( |
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.
Needs documentation now that it is in the public API.
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.
Addressed in #1539.
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.
ACK cd71c30. The remaining review comments are doc-only, and will be addressed in a subsequent PR.
Addresses review comments from #1530.
Addresses review comments from #1530.
Addresses review comments from #1530.
As a side-effect, this fixes #1260.