-
Notifications
You must be signed in to change notification settings - Fork 6
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
Integrate with lightwalletd and librustzcash #16
Conversation
Update the scanBlocks request and integrate with the data that it generates inside dataDb
App is functional and displays transactions
…nit5 setup streaming is working and tests are functional
On the rust side, we now have access to the init DB commands. On the Go side we have time available for blocks
@@ -1,5 +1,6 @@ | |||
def protoSrcDir = "src/main/proto" |
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.
NOTE: I've put zero energy into cleaning this file because it will be deleted once #15 is merged.
228b39e
to
b020276
Compare
} | ||
|
||
@Test | ||
fun testDaoInsert() { |
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.
This test suggests that inserts into the data db from the Android side are okay. Add a comment that this is only for testing purposes.
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 81141d9
fun findById(id: Int): Note? | ||
|
||
@Query("DELETE FROM received_notes WHERE id_note = :id") | ||
fun deleteById(id: Int) |
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.
This allows modifications to the data DB from the Android side. Do we want this as part of the public API? What is it used for?
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 81141d9
fun getAll(): List<Note> | ||
|
||
@Delete | ||
fun delete(block: 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.
I don't know how @Delete
works, but I assume it does some kind of matching. This allows modifications to the data DB from the Android side.
Also, s/block/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.
Addressed in 81141d9
fun findById(height: Int): Block? | ||
|
||
@Query("DELETE FROM blocks WHERE height = :height") | ||
fun deleteById(height: Int) |
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.
Ditto re: modifications to data DB from Android side.
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 81141d9
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; | ||
|
||
#[derive(PartialEq,Clone,Default)] | ||
pub struct ValueReceived { |
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.
This file was removed in an earlier commit in master, and has been included here by accident. Remove from this commit.
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 c7d85f2
@@ -56,35 +70,107 @@ android { | |||
sourceSets { | |||
main { | |||
java { | |||
srcDirs "build/generated/source/wire" | |||
srcDirs "build/generated/source/grpc" |
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.
Shouldn't this be src/generated/source/grpc
?
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.
as far as I can tell, it is.
} | ||
|
||
override fun getValue(thisRef: Any?, property: KProperty<*>): String { | ||
// dynamically generating keyes, based on seed is out of scope for this sample |
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.
s/keyes/keys
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 c7d85f2
fun findById(id: Long): Transaction? | ||
|
||
@Query("DELETE FROM transactions WHERE id_tx = :id") | ||
fun deleteById(id: Long) |
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.
Ditto re: modifications to data DB from Android side.
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.
This is the only one we allow, maybe. When a user cancels a pending transaction (before it has been sent to the network) we clean it up. Sounds like we should push that behavior down into the rust layer instead of letting apps do cancelled transaction cleanup.
fun getAll(): List<WalletTransaction> | ||
|
||
@Delete | ||
fun delete(transaction: Transaction) |
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.
Ditto re: modifications to data DB from Android side.
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.
Ditto re: cancellation. We may want to discuss and then maybe bubble this up to mary/linda as a near-future feature to add to librustzcash (cancellation support by way of dataDB cleanup)
…tors The synchronizer now primarily collaborates with a downloader, processor and repository; each with a more focused set of responsibilities. The downloader streams blocks into a channel, the processor saves blocks from that channel and scans for transactions, the repository exposes transaction change events.
When a transaction is sent it transitions through a lifecycle, beginning with creating the raw transaction and ending with it being mined and added to the blockchain
Send is now functional and shows up in active transactions. This involved: - reducing the exposure of the seed - consistently using Ints for blockheight everywhere to match zcash - adding the use of spending keys - adding account initialization on startup - using accounts but defaulting to account 0 - internalizing birthday so we no longer need a reference outside of the library - enabling cancellation during send - cleanup active transaction manager
After experiencing several issues that make it more difficult to test send behavior, including the amount of time required to wait for blocks to get mined when testnet is slow, it became obvious that it was time to investigate mocking. Most of the behavior in the SDK is driven by channels so the mock only has to focus on putting useful data in the expected channels at the right time. One tradeoff here was the need to make all the synchronizer properties private, that way any implementation can achieve compatability without necessasily leveraging the same combinations of building blocks. This tradeoff felt acceptable given that these dependencies can be injected and available as singletons, if needed. This also had a side effect of elevating several channels into the Synchronizer interface, rather than reaching into the synchronizer to directly access those dependencies. Another benefit is that it's now easier to see what matters most to the app, particularly which channels are essential.
Working with bigdecimals anytime we need to multiply or divide values because it was causing issues when repeatedly toggling currency on the send screen. Coupled this with lots of improvements on the app side to do less processing while changing currencies
It is not really practical to try and use JUnit 5 for Android Instrumentation tests at this time. See documentation in build.gradle for details.
Never start downloading blocks prior to sapling activation height, only allow firstrun when dataDb is empty and also add birthday support. Also added corrections to isFirstRun logic.
This allows the app to show an error dialog rather than crashing silently
This commit will get iteratively polished until the PR is ready - Addresses PR feedback #16 (comment)
Remove unused functionality and disable modification to tables that should only be written by librustzcash
All comments here have been addressed but the work is still in an unpolished state. Closing this PR and renaming the branch to |
This commit will get iteratively polished until the PR is ready - Addresses PR feedback #16 (comment)
Working branch for integration with the lightwalletd server and librustzcash core library