Skip to content

core/txpool/legacypool: legacypool supports SetCode tx #1

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

Open
wants to merge 6 commits into
base: base-eip-7702
Choose a base branch
from

Conversation

sonhv0212
Copy link
Owner

PRs

Description

In this PR:

  • The SetCode tx can be handled by the legacy pool.
  • The legacy pool now has its own mechanism to limit the number of txs, so UsedAndLeftSlots becomes an optional callback in ValidationOptionsWithState.
  • A map of auths is added to lookup to track pooled authorization
  • Introduce some tests to test behavior of legacy pool when handles SetCode tx

// Authorities cannot conflict with any pending or queued transactions.
if auths := tx.SetCodeAuthorities(); len(auths) > 0 {
for _, auth := range auths {
if pool.pending[auth] != nil || pool.queue[auth] != nil {
Copy link

Choose a reason for hiding this comment

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

I think we should add || pool.totalPendingPayerCost[auth] != nil to avoid conflict with pending payer in sponsored transaction

// restrictions brought by SetCode transaction type.
func (pool *LegacyPool) validateAuth(tx *types.Transaction) error {
from, _ := types.Sender(pool.signer, tx) // validated

Copy link

Choose a reason for hiding this comment

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

We should add this to reject sponsored transaction with pending authorization

payer, err := types.Payer(pool.signer, tx)
if err == nil {
        if pool.currentState.GetCodeHash(payer) != emptyCodeHash || len(pool.all.auths[payer]) != 0 {
                return ErrInflightTxLimitReached
        }
}

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.

2 participants