-
Notifications
You must be signed in to change notification settings - Fork 28
Chainindex passthrough when behind backing validator #796
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
base: dev
Are you sure you want to change the base?
Conversation
…aw_transaction passthrough
|
Hey I've been mulling over the problem with testing this functionality and came up with a possible solution (you may have already fixed this but thought I would add this in case it has not been possible to implement in the "MockChainSource". I think one way we could implement the test only "Stop finalised state syncing at block X" is to add a "test" feature flagged field ("pause_sync_at_height?) to the "BlockCacheConfig" struct (or we could define a "TestVariables" struct to be added as this new field?): zaino/zaino-state/src/config.rs Line 136 in 31d0d85
Then under the same "test" feature flag stop writing to the finalised state at the given block height in "start_sync_loop": zaino/zaino-state/src/chain_index.rs Line 520 in 31d0d85
It may still be cleaner to implement this in the "MockChainSource" if possible but that could be more intrusive than just adding here. |
I just thought of something, which I'm gonna try out...if we add a customizable delay to MockchainSource methods, we could do some experimentation with simulated network latency...and if we make the delay long enough, it could slow sync down to a crawl, and still allow passthroughs to go through (as a passthrough requires one or maybe two calls to the source, a one-second delay would mean that the passthrough takes a couple seconds, and syncing a block would also take seconds, so if we make the chain a few hundred blocks we won't catch up to the finalized boundary before the request comes in.) |
ea266dd to
62a42d3
Compare
|
An open question: When a passthrough request is made, and the needed information is in the nonfinalized state, is this:
If 2, do we just return this error whenever it's convenient (i.e., when we don't need to additional work to distinguish between the requested information being nonfinalized or nonexistent), or do we make the guarantee of correctly identifying this error in all cases? |
|
Still to be done:
|
9f49584 to
02959d4
Compare
| } | ||
|
|
||
| // if the tranasction isn't finalized on the best chain | ||
| // check our indexes |
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.
should we check the index first?
| SyncError::ReorgFailure(String::from("could not determine best chain")) | ||
| } | ||
| UpdateError::ValidatorConnectionError => SyncError::ZebradConnectionError(todo!( | ||
| "don't have a request error. \ |
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.
To any reviewers: I would appreciate help figuring out what to do with this error case.
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 will look into it.
| .await | ||
| .map_err(|e| InitError::InvalidNodeData(Box::new(e)))? | ||
| .ok_or_else(|| { | ||
| InitError::InvalidNodeData(todo!("we need something that implements error")) |
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 well as this error case
Move sapling-crypto dependency to near other zcash dependencies. Add chain_index_passthrough.mmd. Add this diagram to ChainIndex doc comments.
Add flow comments. Remove unwraps.
… for NodeBackedChainIndexSubscriber<Source> for consistency.
…gh and find_fork_point.
|
Why do self.get_fullblock_bytes_from_node and self.blockchain_source.get_block look so different? shouldnt they be sister functions? |
| .source | ||
| .get_best_block_height() | ||
| .await | ||
| .map_err(|_| UpdateError::ValidatorConnectionError)? |
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 sort of mapping i think is a bit troublesome, as it essentially hides any trace of the original error. I think the correct way of mapping it would be some way in the higher error can be traced back to the original through .source().
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.
Ah, I think this was meant to be a todo!
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.
Added a source error to the enum variant!
Ciptbz by diagram 3
How do you mean 'so different'? They're not sisters, one calls the other. (Originally, I somehow edited your message with my answer. I've turned it into a reply now) |
Fixes: #769
This PR adds a
validator_finalized_heightfield to a snapshot. If this height is higher than the snapshot's tip, most APIs will pass requests through to the backing validator.