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

[Feature] Add encode/decode for Signed<T: Transaction> #543

Closed
kayabaNerve opened this issue Apr 15, 2024 · 5 comments
Closed

[Feature] Add encode/decode for Signed<T: Transaction> #543

kayabaNerve opened this issue Apr 15, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@kayabaNerve
Copy link
Contributor

Component

consensus, eips, genesis

Describe the feature you would like

To encode a Signed, I need to either:

A) Break it into parts and call encode_with_signature_fields
B) Make a TxEnvelope and encode that

Ideally, I could just encode the Signed directly. This would presumably be by moving encode_with_signature_fields to a trait?

Additional context

No response

@kayabaNerve kayabaNerve added the enhancement New feature or request label Apr 15, 2024
@prestwich
Copy link
Member

the problem with doing it directly is that the argument to eth_sendRawTransaction is an encoded 2718 envelope, not an encoded signed transaction. It is not recommended to encode a Signed, as there is no endpoint or other behavior that uses that encoding. Using the envelope is always recommended

what use case are you looking to satisfy by encoding the Signed?

@mattsse
Copy link
Member

mattsse commented Apr 15, 2024

I believe this is relevant here

#398

@kayabaNerve
Copy link
Contributor Author

kayabaNerve commented Apr 17, 2024

Sorry for not realizing this was a duplicate! Feel free to close as won't fix.

I'd like Signed::encode to be equivalent to TxLegacy::encode_with_signature_fields. The latter is usable with eth_sendRawTransaction.

@prestwich
Copy link
Member

also relevant now is #529 which exposed a lot of the inner encoders

Signed::encode to be equivalent to TxLegacy::encode_with_signature_fields. The latter is usable with eth_sendRawTransaction.

It is usable with eth_sendRawTransaction only for legacy transactions, not for any other transaction types. Using it with any other Signed would be a logic error and would prevent tx broadcast. So we don't have the API because it's trivially easy to misuse

@kayabaNerve
Copy link
Contributor Author

That clarifies things! Thanks for the context.

@kayabaNerve kayabaNerve closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants