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 padding for single txn blocks #17

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

Nashtare
Copy link
Contributor

We were still prepending to the actual txn the dummy payload for blocks containing only 1 txn, but we were then updating that payload if the block contained withdrawals.

We now do a case disjunction for single_txn blocks based on the presence of withdrawals:

  • no withdrawals: dummy payload prepended, for efficiency
  • withdrawals: dummy payload appended, to be then properly updated with withdrawals and modified state trie root

@Nashtare Nashtare added the bug Something isn't working label Jan 30, 2024
@Nashtare Nashtare requested a review from BGluth January 30, 2024 17:56
@Nashtare Nashtare self-assigned this Jan 30, 2024
Copy link
Member

@BGluth BGluth left a comment

Choose a reason for hiding this comment

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

Yeah looks good! This is something that I would not have caught on my own, so thanks for the PR.

// after the only txn of this block.
// If there are no withdrawals, then the dummy proof will be prepended to the
// actual txn.
match has_withdrawals {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use if { … } else { … }?

Copy link
Member

Choose a reason for hiding this comment

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

I actually find that using a match on a bool is usually more readable (there might be something wrong with me, idk 🙃) than an if / else. I think using a match is a bit less common though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah not sure why I went for match, maybe an implicit preference as Brendan said, happy to change though

Copy link
Member

Choose a reason for hiding this comment

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

I'd vote for keeping match

@Nashtare Nashtare merged commit 15ff85a into 0xPolygonZero:main Jan 31, 2024
2 checks passed
@Nashtare Nashtare deleted the fix_1_txn branch January 31, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants