-
Notifications
You must be signed in to change notification settings - Fork 954
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
Improve speculative shielded ctx #4019
base: main
Are you sure you want to change the base?
Conversation
match namada.submit(tx, &args.tx).await? { | ||
ProcessTxResponse::Applied(resp) => { | ||
if let Some(InnerTxResult::Success(_)) = | ||
resp.batch_result().first().map(|(_, res)| res) | ||
{ | ||
pre_cache_masp_data(namada, &masp_section).await; | ||
} | ||
} | ||
ProcessTxResponse::Broadcast(_) => { | ||
pre_cache_masp_data(namada, &masp_section).await; | ||
} | ||
// Do not pre-cache when dry-running | ||
ProcessTxResponse::DryRun(_) => {} | ||
} |
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 pattern is repeated a couple of times. could be abstracted into a method
// The speculative context invalidates the entire note spent so we expect to | ||
// see the balance coming only from the second unspent note | ||
assert!(captured.contains("nam: 100")); |
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 think we should emit a warning in this case, or prefix the token alias (ex: speculative {token}: {amount}
). another reason to emit a warning is that by using an older anchor, as @batconjurer pointed out, we could be revealing when a note was first created. in an ideal scenario the user will always call shielded-sync
, or we call it automatically again. IMO the only blocker for the latter would be improving the UX of canceling the shielded sync process, which takes a while to return control to the shell after hitting Ctrl+C
.
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.
Apart from sug0's requested changes, this looks fine
Describe your changes
Closes #3457.
Closes #2593.
Moved the transition to the
SpeculativeContext
from the SDK to the client to have access to the (possible) tx result. The transition is now performed when:The transition is not performed when:
Added an integration test to verify the behavior of the client when in a speculative context.
Checklist before merging
breaking::
labelsnamada-docs
reponamada-indexer
ornamada-masp-indexer
, a corresponding PR is opened in that repo