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: Check L1DataFee in txpool promoteExecutables and demoteUnexecutables #627

Merged
merged 11 commits into from
Mar 27, 2024

Conversation

vyzo
Copy link

@vyzo vyzo commented Jan 31, 2024

1. Purpose or design rationale of this PR

When a user submits a transaction, we check that the user's balance is enough to cover gas fee + L1 data fee in the txpool.

However, if L1GasPriceOracle is updated, it's possible that the user's balance is not sufficient anymore. Txpool does not repeat this check. As a result, such transactions are treated as pending (executable), and are forwarded to the worker for inclusion in the next block. Then we discard them in the worker with an insufficient balance error.

Tracing and processing these transactions is wasted effort. Instead, we should drop such transactions in promoteExecutables.

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

@vyzo vyzo requested a review from Thegaram January 31, 2024 14:35
@vyzo
Copy link
Author

vyzo commented Jan 31, 2024

Needs a test.

@vyzo
Copy link
Author

vyzo commented Jan 31, 2024

I don't know what's up with this "CI/goimports-lint" check failing, it is acting up; imports have not changed.

@vyzo vyzo requested a review from colinlyguo January 31, 2024 16:16
@colinlyguo
Copy link
Member

I don't know what's up with this "CI/goimports-lint" check failing, it is acting up; imports have not changed.

it's a pending CI issue to be solved, can ignore it for now.

colinlyguo
colinlyguo previously approved these changes Feb 1, 2024
Copy link
Member

@colinlyguo colinlyguo left a comment

Choose a reason for hiding this comment

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

LGTM. why not adding L1DataFee check in pool.demoteUnexecutables(), too?

@vyzo
Copy link
Author

vyzo commented Feb 1, 2024

probably a good idea, @Thegaram thoughts?

@vyzo
Copy link
Author

vyzo commented Feb 9, 2024

Implemented in demoteUnexecutables

@vyzo vyzo requested a review from colinlyguo February 9, 2024 18:00
@colinlyguo colinlyguo changed the title fix: Check L1DataFee in txpool promoteExecutables fix: Check L1DataFee in txpool promoteExecutables and demoteUnexecutables Feb 29, 2024
colinlyguo
colinlyguo previously approved these changes Feb 29, 2024
Copy link
Member

@colinlyguo colinlyguo left a comment

Choose a reason for hiding this comment

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

LGTM.

core/tx_list.go Outdated Show resolved Hide resolved
Thegaram and others added 2 commits March 4, 2024 14:41
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
colinlyguo
colinlyguo previously approved these changes Mar 4, 2024
HAOYUatHZ
HAOYUatHZ previously approved these changes Mar 11, 2024
Copy link
Member

@HAOYUatHZ HAOYUatHZ left a comment

Choose a reason for hiding this comment

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

LGTM just a nitpick

Thegaram
Thegaram previously approved these changes Mar 25, 2024
core/tx_pool.go Outdated Show resolved Hide resolved
core/tx_list.go Outdated Show resolved Hide resolved
@vyzo vyzo dismissed stale reviews from Thegaram, HAOYUatHZ, and colinlyguo via f8aff6a March 25, 2024 18:08
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
core/tx_pool.go Outdated Show resolved Hide resolved
* feat(txpool): consider l1 data fee in costcap

* fix CI

* simplify logic

* remove one db read op
@colinlyguo
Copy link
Member

CI failed in another unit test, can temporarily ignore it.

colinlyguo
colinlyguo previously approved these changes Mar 26, 2024
georgehao
georgehao previously approved these changes Mar 26, 2024
@colinlyguo
Copy link
Member

colinlyguo commented Mar 27, 2024

Would we deploy this PR in one of the nodes to see if the executable transactions in tx pool can be pruned? cc @georgehao @Thegaram

Thegaram
Thegaram previously approved these changes Mar 27, 2024
@Thegaram Thegaram dismissed stale reviews from colinlyguo, georgehao, and themself via 02644ee March 27, 2024 15:23
@Thegaram Thegaram merged commit d1e4b59 into develop Mar 27, 2024
6 checks passed
@Thegaram Thegaram deleted the feat/l1-data-fee-toctou branch March 27, 2024 15:31
HAOYUatHZ pushed a commit that referenced this pull request Jul 31, 2024
…bles (#627)

* Check L1DataFee in txpool promoteExecutables

* bump version

* implement L1 data fee in demoteUnexecutables as well

* Update core/tx_list.go

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>

* Update core/tx_pool.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* feat: consider l1 data fee in txpool costcap (#681)

* feat(txpool): consider l1 data fee in costcap

* fix CI

* simplify logic

* remove one db read op

* bump version

---------

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: georgehao <haohongfan@gmail.com>
HAOYUatHZ pushed a commit that referenced this pull request Aug 1, 2024
…bles (#627)

* Check L1DataFee in txpool promoteExecutables

* bump version

* implement L1 data fee in demoteUnexecutables as well

* Update core/tx_list.go

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>

* Update core/tx_pool.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* feat: consider l1 data fee in txpool costcap (#681)

* feat(txpool): consider l1 data fee in costcap

* fix CI

* simplify logic

* remove one db read op

* bump version

---------

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: georgehao <haohongfan@gmail.com>
HAOYUatHZ pushed a commit that referenced this pull request Aug 1, 2024
…bles (#627)

* Check L1DataFee in txpool promoteExecutables

* bump version

* implement L1 data fee in demoteUnexecutables as well

* Update core/tx_list.go

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>

* Update core/tx_pool.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* feat: consider l1 data fee in txpool costcap (#681)

* feat(txpool): consider l1 data fee in costcap

* fix CI

* simplify logic

* remove one db read op

* bump version

---------

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: georgehao <haohongfan@gmail.com>
HAOYUatHZ pushed a commit that referenced this pull request Aug 2, 2024
…bles (#627)

* Check L1DataFee in txpool promoteExecutables

* bump version

* implement L1 data fee in demoteUnexecutables as well

* Update core/tx_list.go

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>

* Update core/tx_pool.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* feat: consider l1 data fee in txpool costcap (#681)

* feat(txpool): consider l1 data fee in costcap

* fix CI

* simplify logic

* remove one db read op

* bump version

---------

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: georgehao <haohongfan@gmail.com>
HAOYUatHZ added a commit that referenced this pull request Aug 2, 2024
…bles (#948)

fix: Check L1DataFee in txpool promoteExecutables and demoteUnexecutables (#627)

* Check L1DataFee in txpool promoteExecutables

* bump version

* implement L1 data fee in demoteUnexecutables as well

* Update core/tx_list.go



* Update core/tx_pool.go



* feat: consider l1 data fee in txpool costcap (#681)

* feat(txpool): consider l1 data fee in costcap

* fix CI

* simplify logic

* remove one db read op

* bump version

---------

Co-authored-by: vyzo <vyzo@hackzen.org>
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: georgehao <haohongfan@gmail.com>
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.

5 participants