Skip to content
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 to latest darkside.proto to help fix Darkside tests #1191

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

str4d
Copy link
Collaborator

@str4d str4d commented Aug 8, 2023

Depends on zcash/lightwalletd#448.

This code review checklist is intended to serve as a starting point for the author and reviewer, although it may not be appropriate for all types of changes (e.g. fixing a spelling typo in documentation). For more in-depth discussion of how we think about code review, please see Code Review Guidelines.

Author

  • Self-review: Did you review your own code in GitHub's web interface? Code often looks different when reviewing the diff in a browser, making it easier to spot potential bugs.
  • Automated tests: Did you add appropriate automated tests for any code changes?
  • Code coverage: Did you check the code coverage report for the automated tests? While we are not looking for perfect coverage, the tool can point out potential cases that have been missed.
  • Documentation: Did you update Docs as appropiate? (E.g README.md, etc.)
  • Run the app: Did you run the app and try the changes?
  • Did you provide Screenshots of what the App looks like before and after your changes as part of the description of this PR? (only applicable to UI Changes)
  • Rebase and squash: Did you pull in the latest changes from the main branch and squash your commits before assigning a reviewer? Having your code up to date and squashed will make it easier for others to review. Use best judgement when squashing commits, as some changes (such as refactoring) might be easier to review as a separate commit.

Reviewer

  • Checklist review: Did you go through the code with the Code Review Guidelines checklist?
  • Ad hoc review: Did you perform an ad hoc review? In addition to a first pass using the code review guidelines, do a second pass using your best judgement and experience which may identify additional questions or comments. Research shows that code review is most effective when done in multiple passes, where reviewers look for different things through each pass.
  • Automated tests: Did you review the automated tests?
  • Manual tests: Did you review the manual tests?You will find manual testing guidelines under our manual testing section
  • How is Code Coverage affected by this PR? We encourage you to compare coverage befor and after your changes and when possible, leave it in a better place. Learn More...
  • Documentation: Did you review Docs, README.md, LICENSE.md, and Architecture.md as appropriate?
  • Run the app: Did you run the app and try the changes? While the CI server runs the app to look for build failures or crashes, humans running the app are more likely to notice unexpected log messages, UI inconsistencies, or bad output data.

@@ -33,7 +33,7 @@ class AdvancedReOrgTests: ZcashTestCase {
walletBirthday: birthday + 50,
network: network
)
try await coordinator.reset(saplingActivation: 663150, branchID: self.branchID, chainName: self.chainName)
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of the tests reference block height 663150, which corresponds to a persisted mainnet block elsewhere in the codebase. So everywhere I see that reference, I applied the Sapling tree size corresponding to it. There's likely a nicer way to do this, but that's refactoring I don't know how to do in Swift.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is coupled to the datasets for these tests here https://github.com/zcash-hackworks/darksidewalletd-test-data

These tests start from 663150 onwards. that's why they have that height. If you were to use another height then you need to reference a new dataset.

I think that this change makes sense.

Does Sbs require the wallet to get TreeStates to make node spendable? If so you should get those into dlwd as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@str4d how do you obtain this tree size?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obtaining the tree states is what enables fast spendability; I believe that @str4d has already made the required change to lightwalletd here: zcash/lightwalletd#448

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, the wallets should still function when connected to a LWD that doesn't support retrieval of tree states, but they'll be limited to linear scanning.

Copy link
Collaborator Author

@str4d str4d Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pacu I fetched the tree size for that block height from my mainnet zcashd node. One of the RPCs exposes it.

@str4d str4d force-pushed the darkside-bugfix-tree-sizes branch from b09e0a0 to 585082c Compare August 9, 2023 13:07
@str4d str4d force-pushed the darkside-bugfix-tree-sizes branch from 585082c to 4c74e4d Compare August 18, 2023 13:37
@str4d
Copy link
Collaborator Author

str4d commented Aug 18, 2023

Rebased on current main. I think this PR can be reviewed and merged (as the corresponding lightwalletd PR has been), and then we can continue fixing the Darkside tests in subsequent PRs.

@str4d str4d changed the title Migrate to latest darkside.proto to fix Darkside tests Migrate to latest darkside.proto to help fix Darkside tests Aug 18, 2023
@str4d str4d marked this pull request as ready for review August 18, 2023 13:38
@LukasKorba
Copy link
Collaborator

I pulled lightwalletd, used make to build the latest server and ran all dark side test with this result:

Screenshot 2023-08-24 at 14 09 15

I don't know if this is expected or not, I remember str4d to talk about fixes of fundamental issues but still, after thiese fixes the tests need to be iterated to pass...

Copy link
Contributor

@pacu pacu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass of review.

Will attempt to run the test and check their state

@@ -33,7 +33,7 @@ class AdvancedReOrgTests: ZcashTestCase {
walletBirthday: birthday + 50,
network: network
)
try await coordinator.reset(saplingActivation: 663150, branchID: self.branchID, chainName: self.chainName)
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is coupled to the datasets for these tests here https://github.com/zcash-hackworks/darksidewalletd-test-data

These tests start from 663150 onwards. that's why they have that height. If you were to use another height then you need to reference a new dataset.

I think that this change makes sense.

Does Sbs require the wallet to get TreeStates to make node spendable? If so you should get those into dlwd as well

@@ -33,7 +33,7 @@ class AdvancedReOrgTests: ZcashTestCase {
walletBirthday: birthday + 50,
network: network
)
try await coordinator.reset(saplingActivation: 663150, branchID: self.branchID, chainName: self.chainName)
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@str4d how do you obtain this tree size?

Copy link
Contributor

@pacu pacu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the tests using SDK 4c74e4d2041d5432bb25696b6bbf658b321fbf55 and LWD current master branch commit 8269810eeefac56ce326b0f6878c1ea3821b8ad5.

The dLWD tests are able to start and reset the chain.
image

The Tests fail for other reasons that appear not to be related to darkside.proto failures.

Sync failed with error: rustScanBlocks("Error while scanning blocks: The underlying block store produced the following error: Requested height 663199 does not exist in the block cache")

If this is the sole purpose of the PR as it appears to be, then I consider it approved.

but I can't approve per the Repo's policy
image

@LukasKorba
Copy link
Collaborator

Approving as I also think the purpose of this PR is fulfilled.

@str4d str4d merged commit 42214bd into main Aug 28, 2023
1 check passed
@str4d str4d deleted the darkside-bugfix-tree-sizes branch August 28, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants