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

Connection lifecycle work #2063

Open
wants to merge 20 commits into
base: mock-chrome
Choose a base branch
from
Open

Conversation

turbocrime
Copy link
Collaborator

@turbocrime turbocrime commented Feb 19, 2025

Description of Changes

Staging branch for improving reliability of connection lifecycle.

Related Issue

TalDerei and others added 12 commits February 6, 2025 13:21
* bump registry to v12.4.0

* use correct version

* changeset
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Make tabs extensible

* Add changeset

* Remove console log
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix tabProps type

* Add changset
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* feat(ui): #2044: `SegmentedControl` UI component

* chore: changeset

* docs(ui): #2044: add JSDoc to SegmentedControl

* fix: pnpm-lock
I ran `shellcheck` on the script used to export a bundled minifront,
suitable for inclusion in `pd`. These are small changes intended to make
the script more resilient, e.g. failing fast and handling directories
with spaces in the name.

Prepared while working on
penumbra-zone/penumbra#5089.
* fix(ui): #2053: add `smallTechnical` variant to Typography component

* feat(ui): #2053: Add base for the ActionView component

* feat(ui): #2053: Implement Spend and Output action views

* feat(ui): #2053: implement SwapAction view

* feat(ui): #2053: implement opaque views for existing actions

* feat(ui): #2053: create skeleton files for unimplemented actions

* chore: changeset

* fix(ui): #2053: after review
@turbocrime turbocrime added testing Related to writing tests refactor Improving existing system with new design labels Feb 19, 2025
@turbocrime turbocrime self-assigned this Feb 19, 2025
Copy link

changeset-bot bot commented Feb 19, 2025

🦋 Changeset detected

Latest commit: 9770232

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@penumbra-zone/transport-chrome Minor

Not sure what this means? Click here to learn what changesets are.

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

- manager is prepared for validation callback parameter
- typed senders make it harder to emit a malformed message
- incoming message checking is more thorough
- poisons transport in fewer cases
- matches errors up with relevant requests in more cases
- fewer data clone failures
session-client will now automatically request to reconnect when disconnected.

to support this, session-manager now uses a callback parameter to validate connection requests, instead of depending on external management of port injection.
turbocrime and others added 4 commits February 19, 2025 11:25
* view service: LQT scaffolding  (#2035)

* view service: lqt voting notes scaffolding

* view service: tournament votes rpc wip

* wasm: extending planner with lqt voting action (#2037)

* indexedDB: LQT historical votes table (#2038)

* indexedDB: lqt historical votes table

* workaround to normalize action cases

* temporary measure for compilation purposes

* linting

* continue flushing out LQT integration

* wasm: direct all available voting power to a single asset

* wasm: informative expect messages

* changeset

* wasm: wasm bindgen tests

* view server: expand vitest suite for new view service methods

* wasm: clippy

* protobuf: revert temporary workaround and consume fixed protos

* action view: liquidity tournament visible and opaque views and translators

* address feedback

* linting

* nit naming

* refactor: account for LQT votes per delegation token

* action views: fix opaque action view

* more feedback

* attempt to pass ci

* satisfy linter

* changeset

* delete outdated changeset

* stale ref; satisfy linter
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@turbocrime turbocrime requested a review from TalDerei February 20, 2025 10:49
@turbocrime turbocrime marked this pull request as ready for review February 20, 2025 10:50
Copy link
Contributor

@TalDerei TalDerei left a comment

Choose a reason for hiding this comment

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

reviewed and left feedback on individual PRs that comprise this changeset

merged main into this PR and prax-wallet/prax#297 (which now includes prax-wallet/prax#296). I was still able to exploit the stream unreliability we discussed offline (albeit less often and it's improved after #2066) by cutting the connection during sync and waiting for the transport timeout before reloading the page – take note of the infinitely growing error logs (until page breaks). This feels more brittle compared to the previous behavior where streams could stay open indefinitely as long as the underlying chrome port wasn’t disconnected.

additionally, some stream-related tests were removed in #2066, so we should expand our stream test coverage.


Untitled-2.mov

and if you leave it running in that state, it eventually breaks the dapp with the following logs

Screenshot 2025-02-20 at 7 37 25 AM

and at that point, no amount of page reloads will resume syncing in the extension, and it remains in a zombie state.

Screenshot 2025-02-20 at 7 54 28 AM

after refreshing the extension in chrome://extensions/ while in that state after a while, it also randomly started resyncing the chain without me explicitly clearing the cache

Screenshot 2025-02-20 at 7 54 43 AM

constructor(private incoming: chrome.runtime.Port) {}
constructor(
private incoming: chrome.runtime.Port,
private timeoutMs = 20_000,
Copy link
Contributor

@TalDerei TalDerei Feb 20, 2025

Choose a reason for hiding this comment

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

question: this 20s idle stream timeout seems arbitrary, what about long-lived connections where the timeout may unintentionally break those connections? does increasing this lead to more frequent unreliability effects?

if (this.timeoutMs) {
clearTimeout(this.timeout);
this.timeout = setTimeout(
() => cont.error(ConnectError.from('Source timeout', Code.DeadlineExceeded)),
Copy link
Contributor

Choose a reason for hiding this comment

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

question: what will the dev logs display when emitting DeadlineExceeded after stream timeout?

@turbocrime turbocrime changed the base branch from main to mock-chrome February 20, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improving existing system with new design testing Related to writing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants