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

tx: implement tx containers and tx workers [WIP] [Experimental] #3791

Closed
wants to merge 12 commits into from

Conversation

jochem-brouwer
Copy link
Member

@jochem-brouwer jochem-brouwer commented Nov 10, 2024

Part of #3733

This PR:

  • Introduces the new "tx container" which (once PR is ready) should replace the current Tx classes we use
  • The tx container class holds the tx data
  • What is done with the data (e.g. extract data fee, find sender address) is leveraged to the tx worker which looks at the data itself to figure out what to do (specifically: what "features" does it support?

SUPER WIP. Only here to show the current line of thought.

Things I plan to do:

  • Move methods which extract/convert input to the desired output (so basically reading types like BigIntLike and converting those to bigint in the constructor) to a central place and make the tx container constructors consume these
  • Write more tx worker methods
  • Figure out if we want the sign method on the tx or seperately
  • Make the types a bit less chaotic

@paulmillr
Copy link
Member

As a side note, in eth-signer, the goal with Transaction class was to make it friendly and easy to debug. Viewing something like this in logs is great:

Transaction {
  type: 'eip1559',
  raw: {
    to: '0xdf90dea0e0bf5ca6d2a7f0cb86874ba6714f463e',
    value: 1100000000000000000n,
    nonce: 0n,
    maxFeePerGas: 100000000000n,
    maxPriorityFeePerGas: 1000000000n,
    gasLimit: 21000n,
    accessList: [],
    chainId: 1n,
    data: '',
    type: 'eip1559'
  },
  isSigned: false
}

Some libraries use hex in logs, which is not cool.

Base automatically changed from tx-remove-basetx to master November 11, 2024 17:10
@jochem-brouwer
Copy link
Member Author

Hi Paul, thanks, the old and this proposed "new" interface both will have the property fields either bigint, Uint8Array, Address or a nested list of Uint8Array, so I guess that's change. The toJSON() method will output these fields in a stringified format 😄

@jochem-brouwer jochem-brouwer changed the title tx: implement tx containers and tx workers [WIP] tx: implement tx containers and tx workers [WIP] [Experimental] Nov 11, 2024
@jochem-brouwer
Copy link
Member Author

Marked as blocked since this is highly experimental.

@jochem-brouwer
Copy link
Member Author

Closed in favour of #3796

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

Successfully merging this pull request may close these issues.

2 participants