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

Fix trimmed zeros in transaction encoding #92

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Fix trimmed zeros in transaction encoding #92

merged 2 commits into from
Mar 5, 2024

Conversation

alisinabh
Copy link
Member

@alisinabh alisinabh commented Mar 5, 2024

We don't need to trim zeros if we:

  1. Make sure the transaction data will always be hex encoded starting with '0x' AND
  2. Pass them as integers to ExRLP.encode/1

Using the existing trim_leading/1 on all transaction values is dangerous as it can alter the transaction. For example a transaction data starting with one or more zero(s) or transaction to address which start with one or more zero(s) is perfectly fine. Since ExRLP already handles integers, we need to pass these transaction parameters as integers so we get the correct RLP encoding.

Closes #91

@alisinabh alisinabh requested a review from wchenNL March 5, 2024 02:04
@alisinabh alisinabh self-assigned this Mar 5, 2024
@alisinabh alisinabh requested a review from wchenNL March 5, 2024 16:36
Copy link
Contributor

@wchenNL wchenNL left a comment

Choose a reason for hiding this comment

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

🚢 LGTM

@alisinabh alisinabh merged commit be815a7 into main Mar 5, 2024
4 checks passed
@alisinabh alisinabh deleted the fix-zero-trim branch March 5, 2024 17:09
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.

Cannot encode transactions when to address starts with zeros
2 participants