Skip to content

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

@jochem-brouwer

Description

@jochem-brouwer

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!)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions