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

Reuse existing activity state data #3783

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

hyphenized
Copy link
Collaborator

@hyphenized hyphenized commented Feb 17, 2025

This adds a check into the account activity initialization process so we re-use already-enriched activity data if it corresponds to a finalized transaction.

Improves worker startup and prevents requests bursts by optimizing activity initialization for tracked accounts.

To Test

  • Load an account e.g. testertesting.eth
  • On initial extension load, check that there are some RPC requests made for transaction enrichment
  • Reload extension, check that there aren't as many requests as before

Latest build: extension-builds-3783 (as of Mon, 17 Feb 2025 19:35:53 GMT).

This adds a check into the account activity initialization process
so we re-use already-enriched activity data if it corresponds to a
finalized transaction.

Improves worker startup and prevents requests bursts by optimizing
activity initialization for tracked accounts.
@hyphenized hyphenized self-assigned this Feb 17, 2025
transactions.forEach((transaction) => {
const { to, from, network } = transaction

const trackedAccounts = normalizedAccounts.filter(
Copy link
Contributor

Choose a reason for hiding this comment

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

For a self-send (where the same address is from and to), could this create a duplicate?

Copy link
Collaborator Author

@hyphenized hyphenized Feb 19, 2025

Choose a reason for hiding this comment

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

Nope, because activities in this state tree are keyed by account address and the transaction's hash, so in cases where the from and to match the same tracked address the transaction is only added once as an activity.

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.

2 participants