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

sync: fresh and existing wallets skip trial decryption #164

Merged
merged 14 commits into from
Sep 4, 2024

Conversation

TalDerei
Copy link
Contributor

@TalDerei TalDerei commented Aug 19, 2024

references penumbra-zone/web#1278 and penumbra-zone/web#1707

Implements the necessary scaffolding for wallet birthdays in prax

@TalDerei TalDerei self-assigned this Aug 19, 2024
Copy link

changeset-bot bot commented Aug 19, 2024

⚠️ No Changeset found

Latest commit: e914d70

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@TalDerei TalDerei marked this pull request as draft August 19, 2024 04:25
@TalDerei TalDerei changed the title sync: onboarding metadata for fresh wallets to skip trial decryption sync: fresh wallets skip trial decryption Aug 27, 2024
apps/extension/src/routes/page/onboarding/generate.tsx Outdated Show resolved Hide resolved
Comment on lines 30 to 43
try {
const walletCreationBlockHeight = await fetchBlockHeight(randomEndpoint!);
if (walletCreationBlockHeight !== undefined) {
return walletCreationBlockHeight;
} else {
// Remove the current endpoint from the list and try again
const remainingEndpoints = endpoints.filter(endpoint => endpoint !== randomEndpoint);
return fetchBlockHeightWithFallback(remainingEndpoints);
}
} catch (error) {
const remainingEndpoints = endpoints.filter(endpoint => endpoint !== randomEndpoint);
return fetchBlockHeightWithFallback(remainingEndpoints);
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this fetches the block height by randomly querying one of the rpc endpoints in the chain registry. something to consider is whether this operation is possibly blocking or if the rpc call will eventually time out?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we added timeouts to our promise clients (?). It's async, so not thread blocking, but we should have a think whether this should block the onboarding step.

Copy link
Contributor Author

@TalDerei TalDerei Aug 31, 2024

Choose a reason for hiding this comment

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

while this approach is non-blocking at the thread level, it could still delay onboarding if the rpc requests take too long. I noticed that we don't have timeouts set for our promise clients at either the transport level or at the request level (ie. getStatus). Consequently, should we implement a timeout at the transport level, request level within the async request in fetchBlockHeight, or both to prevent indefinite hanging? cc @turbocrime

Copy link
Contributor Author

@TalDerei TalDerei Sep 4, 2024

Choose a reason for hiding this comment

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

we construct a promise client with 2 second timeout, which should be sufficient for most rpc requests? However, do you think this timeout is short enough that it might lead to an increase in network request failures? Would it be better to extend the timeout to say 5 seconds?

I think this the only remaining consideration that's soft blocking @grod220

apps/extension/src/routes/page/onboarding/generate.tsx Outdated Show resolved Hide resolved
apps/extension/src/routes/page/onboarding/height.tsx Outdated Show resolved Hide resolved
@TalDerei TalDerei marked this pull request as ready for review August 29, 2024 05:43
@TalDerei TalDerei requested a review from a team August 29, 2024 05:43
Copy link
Contributor

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Great start to this!

apps/extension/src/hooks/full-sync-height.ts Outdated Show resolved Hide resolved
apps/extension/src/routes/page/onboarding/generate.tsx Outdated Show resolved Hide resolved
apps/extension/src/routes/page/onboarding/generate.tsx Outdated Show resolved Hide resolved
Comment on lines 30 to 43
try {
const walletCreationBlockHeight = await fetchBlockHeight(randomEndpoint!);
if (walletCreationBlockHeight !== undefined) {
return walletCreationBlockHeight;
} else {
// Remove the current endpoint from the list and try again
const remainingEndpoints = endpoints.filter(endpoint => endpoint !== randomEndpoint);
return fetchBlockHeightWithFallback(remainingEndpoints);
}
} catch (error) {
const remainingEndpoints = endpoints.filter(endpoint => endpoint !== randomEndpoint);
return fetchBlockHeightWithFallback(remainingEndpoints);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we added timeouts to our promise clients (?). It's async, so not thread blocking, but we should have a think whether this should block the onboarding step.

apps/extension/src/routes/page/onboarding/generate.tsx Outdated Show resolved Hide resolved
apps/extension/src/routes/page/onboarding/height.tsx Outdated Show resolved Hide resolved
apps/extension/src/routes/page/onboarding/height.tsx Outdated Show resolved Hide resolved
apps/extension/src/routes/page/onboarding/height.tsx Outdated Show resolved Hide resolved
apps/extension/src/wallet-services.ts Outdated Show resolved Hide resolved
@JasonMHasperhoven
Copy link
Contributor

suggestion: Did a quick draft, the idea is that copy to clipboard copies all (phrase + "\n blockheight: number") as most would probably do this
Frame 3

@TalDerei TalDerei changed the title sync: fresh wallets skip trial decryption sync: fresh and existing wallets skip trial decryption Sep 2, 2024
Copy link
Contributor

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Post 🍐 approval 👍

@TalDerei
Copy link
Contributor Author

TalDerei commented Sep 4, 2024

tested various workflows and error conditions and looks good 👍

@TalDerei TalDerei merged commit b14f093 into main Sep 4, 2024
3 checks passed
@TalDerei TalDerei deleted the skip-trial-decrypt branch September 4, 2024 16:49
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.

3 participants