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

(Re-)add caching mechanism on tx and test #3932

Open
jochem-brouwer opened this issue Mar 23, 2025 · 0 comments
Open

(Re-)add caching mechanism on tx and test #3932

jochem-brouwer opened this issue Mar 23, 2025 · 0 comments

Comments

@jochem-brouwer
Copy link
Member

Within our tx package we have a TransactionCache object:

export interface TransactionCache {
  hash?: Uint8Array
  dataFee?: {
    value: bigint
    hardfork: string | Hardfork
  }
  senderPubKey?: Uint8Array
  // TODO: re-add these cache items for the JSON 
  //accessListJSON?: AccessList
  //authorityListJSON?: AuthorizationList
}

This is there, but it does not seem tested that well:

Image

In particular, this should likely be the behavior: we should only cache if the tx object itself is frozen (as in Object.frozen. If it is not frozen, the values could change, and therefore the cache should be invalidated.

The accessListJSON and authorityListJSON should also be added in to cache these items when toJSON is called on the tx (or: we could also cache the resulting JSON object. If the tx object is frozen we can also freeze the resulting cached object!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant