Skip to content

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.

3 participants