Skip to content

Conversation

@hominlee-wemade
Copy link
Contributor

@hominlee-wemade hominlee-wemade commented Nov 12, 2025

Description

This PR implements transaction prioritization and fee policy updates to support Authorized Accounts in StableNet, addressing the requirements outlined in #5 and #22.

Overview

This update introduces two major improvements:

  1. Transaction Ordering Enhancement
    Transactions from Authorized Accounts (accounts that have completed KYC or similar authentication processes) are now prioritized over normal accounts in the mempool. This ensures that authenticated institutional transactions receive preferential treatment even during network congestion.
  2. Fee Policy Update
    Authorized Accounts: Gas fees are calculated based on the actual priority fee (GasTipCap) specified in the transaction
    Normal Accounts: Gas fees are capped at a pre-agreed HeaderGasTip value, regardless of the priority fee they submit

Summary of Changes

  1. Transaction Prioritization Rules
  • Between Authorized Accounts:
    • Higher fee transactions have priority
    • If fees are equal, earlier received transactions have priority
  • Between Normal Accounts:
    • Prioritized by reception order only (no fee comparison)
  • Authorized vs Normal Accounts:
    • Authorized Account transactions are always prioritized
  1. Fee Policy
  • Authorized Accounts: Use the transaction’s GasTipCap() (priority fee).
  • Normal Accounts: Use the fixed HeaderGasTip defined in the block header.
  1. Transaction Eviction Rule (When the transaction pool is full)
  • Original Eviction Rules
    • When baseFee exists:
      → lower EffectiveGasTip(baseFee) → lower GasFeeCap → lower GasTipCap → higher nonce
    • When baseFee does not exist:
      → lower GasFeeCap → higher nonce
  • Updated Eviction Rules (with Anzeon)
    • Anzeon Disabled:
      → Use the original logic unchanged.
    • Anzeon Enabled:
      → Authorized Accounts: Apply original eviction logic using transaction's actual GasTipCap
      → Normal Accounts: Apply original eviction logic but use HeaderGasTip instead of transaction's GasTipCap

Related Issues

@hominlee-wemade hominlee-wemade self-assigned this Nov 12, 2025
@hominlee-wemade hominlee-wemade added the enhancement New feature or request label Nov 12, 2025
@egonspace egonspace added the stablenet feature feature for stable chain label Nov 13, 2025
@egonspace egonspace added this to the Launch StableNet Testnet milestone Nov 13, 2025
@hominlee-wemade hominlee-wemade force-pushed the feat/minter-priority-mempool branch from 2d7b2df to 1909c2c Compare November 13, 2025 07:14
Copy link
Contributor

@0xmhha 0xmhha left a comment

Choose a reason for hiding this comment

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

I've added some code suggestions that need review

@hominlee-wemade hominlee-wemade force-pushed the feat/minter-priority-mempool branch 2 times, most recently from 41e4af7 to 2ced82b Compare November 14, 2025 08:36
@hominlee-wemade hominlee-wemade changed the title feat: implement transaction prioritization and fee policy for authorized accounts feat: implement transaction prioritization and fee policy Nov 18, 2025
…ering (enabled when Anzeon is active)

- Authorized accounts are always prioritized over normal accounts.
- Among authorized accounts: higher fee first, then FIFO if equal.
- Among normal accounts: FIFO only (no fee-based comparison).
- When Anzeon is disabled, fallback to existing ordering logic.
- Temporarily define AuthorizedAccounts map in params/protocol_params.go
  for development use.
  (TODO: remove once StateAccount.Extra field is implemented)
…rized accounts

- If Anzeon is enabled and the sender is an authorized account,
  use tx.GasTipCap() directly.
- Otherwise, use the header's gas tip value.
…pplyTransaction

- DeriveFields() cannot access stateDB, making it impossible to check
  if the sender is an authorized account.
- For authorized accounts, calculate effectiveGasPrice in applyTransaction().
- For normal accounts, keep the existing DeriveFields() logic unchanged.
- Add StateReader interface to check authorized accounts
- Pass StateReader to ReadReceipts and DeriveFields
- Use IsAuthorized to determine gasTip in receipt derivation
- Update all call sites to pass StateReader
@hominlee-wemade hominlee-wemade force-pushed the feat/minter-priority-mempool branch from f314662 to ea4d3aa Compare November 18, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request stablenet feature feature for stable chain

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mechanism for prioritizing Minter's transaction requests

4 participants