-
Notifications
You must be signed in to change notification settings - Fork 17
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
Quick sync for freshly generated wallets #1278
Comments
this is a great idea and would be a big ux boost. we'd need to figure out what data is necessary to store -- one thing that comes to mind is the SCT state, which would ideally be initialized with a bare root (as if the user had synced and then forgotten all internal nodes). maybe @plaidfinch would know if there's a way to initialize an SCT with just the root like that. |
Theoretically, it is even possible not to scan with skip trial decryption, but to use a snapshot of view service data for the last epoch (if there will be a service that will provide these snapshots) |
some relevant helper functions: querying the latest block height fetching merkle root associated with the latest height fetching epoch index from compact block associated with latest height |
The TCT cannot be initialized just as a bare root, or else no updates could be performed to it. It always needs to have a frontier. The smallest TCT is the one when an epoch has just ended, which contains only a path down from the root to an epoch root. |
would we need to implement penumbra-zone/penumbra#1082 and penumbra-zone/penumbra#1131? |
… On Sun, Jun 30, 2024 at 2:26 PM, Tal Derei ***@***.***(mailto:On Sun, Jun 30, 2024 at 2:26 PM, Tal Derei <<a href=)> wrote:
> The TCT cannot be initialized just as a bare root, or else no updates could be performed to it. It always needs to have a frontier. The smallest TCT is the one when an epoch has just ended, which contains only a path down from the root to an epoch root.
would we need to implement [penumbra-zone/penumbra#1082](penumbra-zone/penumbra#1082) and [penumbra-zone/penumbra#1131](penumbra-zone/penumbra#1131)?
—
Reply to this email directly, [view it on GitHub](#1278 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAERYYPVP376DDBTO5L4AGTZKBEVJAVCNFSM6AAAAABJFB7FRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJYGY2DGNBYGI).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
more specifically diff --git a/packages/wasm/crate/src/view_server.rs b/packages/wasm/crate/src/view_server.rs
index af5240690..ac1b83be3 100644
--- a/packages/wasm/crate/src/view_server.rs
+++ b/packages/wasm/crate/src/view_server.rs
@@ -111,7 +111,11 @@ impl ViewServer {
/// Use `flush_updates()` to get the scan results
/// Returns: `bool`
#[wasm_bindgen]
- pub async fn scan_block(&mut self, compact_block: &[u8]) -> WasmResult<bool> {
+ pub async fn scan_block(
+ &mut self,
+ compact_block: &[u8],
+ skip_trial_decrypt: bool,
+ ) -> WasmResult<bool> {
utils::set_panic_hook();
let block = CompactBlock::decode(compact_block)?;
@@ -123,7 +127,9 @@ impl ViewServer {
match state_payload {
StatePayload::Note { note: payload, .. } => {
- match payload.trial_decrypt(&self.fvk) {
+ match bool::then_some(!skip_trial_decrypt, payload.trial_decrypt(&self.fvk))
+ .flatten()
+ {
Some(note) => {
let note_position = self.sct.insert(Keep, payload.note_commitment)?;
@@ -159,7 +165,9 @@ impl ViewServer {
}
}
StatePayload::Swap { swap: payload, .. } => {
- match payload.trial_decrypt(&self.fvk) {
+ match bool::then_some(!skip_trial_decrypt, payload.trial_decrypt(&self.fvk))
+ .flatten()
+ {
Some(swap) => {
let swap_position = self.sct.insert(Keep, payload.commitment)?;
let batch_data = plus
should be enough to achieve some benefit |
If a user onboards prax with a passphrase, they may have existing activity on chain.
But if a user generates a new wallet in onboarding, there will be no activity on the chain, so the block processor can skip trial decryption until the present height.
This would greatly accelerate initial sync for many new users.
The text was updated successfully, but these errors were encountered: