Try   HackMD

Mempool^2

Mempool with 'sublists' 'sublets', partioned non-gossiping pools for transactions privately sent, of transaction envelope type, etc

Motivation

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

fig, 1

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

fig, 2

Semantics

Nonce Values are Arbitrarily Chosen

Symbol Description Semantics
N Normal Transaction Standard transaction with base gas price (e.g. 3 Gwei)
P Parent Transaction Transaction with gas price < 12000, nonce = 0
C Child Transaction Transaction with value ≤ 10000, dependent on parent, with parent gas price < 12000
O Other Transaction Transaction with value > 10000 or dependent on a parent with gas price ≥ 12000
F Future Transaction Transaction with nonce = 10000, placed in the queued area
E Empty Slot Unused capacity in the transaction pool
R Replacement Transaction Transaction with gas price ≥ 12000, nonce = 0, replacing another transaction

Grammar Definition

G=(V,Σ,R,S)

V=S,PoolState,QueuedState,PendingState,ParentSeq,ChildSeq

Σ=N,P,C,O,F,E,R

S=PoolState

Sublet State Transition Rules

PoolState → QueuedState PendingState
QueuedState → F* | ε
PendingState → N* ParentSeq* E*
ParentSeq → P ChildSeq | R ChildSeq
ChildSeq → C* | O* | C* O* | ε

Where:

  • * indicates zero or more occurrences
  • ε represents an empty string (no symbols)

Transaction System Integrity Rules

These rules govern the admission and eviction of transactions within the sublet (and greater mempool) to maintain consistency and integrity.

Note

This formalization intends to ensure that once valid transactions are accepted, the system maintains a consistent state regardless of subsequent invalid transaction attempts.

Admission Rules

Rule Description Logical Form
1 No admission of future transaction
tx[Future(tx)¬Admit(tx)]
2 No admission of invalid transaction
tx[¬Valid(tx)¬Admit(tx)]
3 No admission of tx of the same sender
tx1,tx2[Sender(tx1)=Sender(tx2)InSystem(tx1)¬Admit(tx2)]

Eviction Rules

Rule Description Logical Form
4 No eviction of valid tx by future/invalid tx
tx1,tx2[Valid(tx1)(Future(tx2)¬Valid(tx2))¬CanEvict(tx2,tx1)]
5 No eviction of valid tx that transforms existing valid tx into future or invalid
tx1,tx2[(InSystem(tx1)InSystem(tx2)Valid(tx1)Valid(tx2)Depends(tx2,tx1))¬(action[Evict(tx1)(Transforms(tx1,tx2,Future)Transforms(tx1,tx2,¬Valid))])]

Note

Rule 5 is the most complex and ensures that the transaction dependency graph remains consistent.

Transaction Predicate Definitions

  • Valid(tx)
    : Transaction
    tx
    is valid
  • Future(tx)
    : Transaction
    tx
    is future-dated
  • InSystem(tx)
    : Transaction
    tx
    is currently in the system
    • accepted
    • pending
  • Depends(tx1,tx2)
    : Transaction
    tx2
    depends on transaction
    tx1
  • Evict(tx)
    : The action of evicting transaction
    tx
  • Transforms(tx1,tx2,property)
    : Removing
    tx1
    changes
    tx2
    's property

The complete formalization:

tx1,tx2[(InSystem(tx1)InSystem(tx2)Valid(tx1)Valid(tx2)Depends(tx2,tx1))¬(action[Evict(tx1)(Transforms(tx1,tx2,Future)Transforms(tx1,tx2,¬Valid))])]

Formal Transaction Constraint Rules

The design of these rules is to realize the following set of requirements:

  1. Maintains temporal consistency
  2. Preserves system validity
  3. Prevents double-submission
  4. Protects valid transactions
  5. Maintains transaction dependencies

v No admission of future transaction.
v No admission of invalid transaction.
v No admission of tx of the same sender
Ø No eviction of valid tx by future/invalid tx.
Ø No eviction of valid tx that transforms existing valid tx into future or invalid.

  • "v" represents admission rules (what transactions can enter the system)
  • "Ø" represents eviction rules (what transactions can't be removed from the system)

No admission of future transaction

"No admission of future transaction": This rule means that transactions with timestamps in the 'far' future cannot be admitted into the system. Think of it like a bank refusing to process a check dated next month. The system maintains temporal consistency by only accepting transactions that could logically occur at the current time.

No admission of invalid transaction

"No admission of invalid transaction": The system must reject any transaction that violates its validity rules. For example, if someone tries to spend money they don't have or execute a smart contract with incorrect parameters, that transaction would be rejected immediately. This maintains the system's integrity by preventing corrupt or malformed transactions from entering.

No admission of tx of the same sender

"No admission of tx of the same sender": This rule prevents double-submission from the same sender. It's similar to how a bank wouldn't process two identical checks from the same person. The system ensures that a sender can't have multiple pending transactions, which helps prevent double-spending and maintains transaction ordering.

This assumes a normal nonce scheme, e.g. no consideration for a 'bitmap' style nonce mechanism

No eviction of valid tx by future/invalid tx

"No eviction of valid tx by future/invalid tx": This rule protects valid transactions that are already in the system. Even if future-dated or invalid transactions somehow enter the system, they cannot cause the removal of legitimate transactions. This is like ensuring that a valid bank transfer can't be cancelled by an invalid one that comes later.

No eviction of valid tx that transforms existing valid tx into future or invalid

"No eviction of valid tx that transforms existing valid tx into future or invalid": This is the most complex rule. It prevents the removal of valid transactions that, if removed, would make other valid transactions become future-dated or invalid. For example, if Transaction A creates an account and Transaction B spends from it, you can't remove Transaction A because that would make Transaction B invalid. This maintains the consistency of transaction chains and prevents cascade failures.


Work in Progress

Sublets: Transaction pool partitions

This EIP proposes how miners can partition transactions into disjoint sets that can be safely executed in parallel, and how full nodes should process and validate these transactions.

Specification

Basic Definitions

Let us define the following:

  • T=t1,t2,...,tn
    is the set of all transactions in a block
  • K
    is the set of all possible state keys in the Ethereum state trie
  • For any transaction
    tT
    :
    • R(t)K
      is the set of keys that
      t
      reads
    • W(t)K
      is the set of keys that
      t
      writes
    • S(t)
      is the sender address of transaction
      t
    • G(t)
      is the gas consumed by transaction
      t

Transaction Connectivity Relation

We define a binary relation

CT×T where
(ti,tj)C
if and only if
ti
and
tj
are related. This relation is defined as:

(ti,tj)C(W(ti)W(tj))(W(ti)R(tj))(R(ti)W(tj))(S(ti)=S(tj))

Two transactions are related if any of the following conditions are true:

  • They both write to at least one common key
  • One transaction writes to a key that the other transaction reads
  • They have the same sender address (as they modify the same nonce)

Connectivity Relation

The connectivity relation

C has the following qualities:

  • Symmetricity:
    ti,tjT:(ti,tj)C(tj,ti)C
  • Reflexivity:
    tT:(t,t)C

We define the connectivity closure of a transaction

t as:
CL(t)=tT|(t,t)C

Similarly, for any set of transactions

ST, we define:
CL(S)=tT|tS:(t,t)C

Sublist

Definitions and Constraints

A valid partitioning of the transaction set

T consists of sublists
P1,P2,...,PN,S
such that:

  1. P1P2...PNS=T
    (all transactions are included)
  2. PiPj=
    for all
    ij
    (sublists are disjoint)
  3. PiS=
    for all
    i
    (parallel and sequential sublists are disjoint)
  4. For all
    ij
    and for all
    taPi
    and
    tbPj
    ,
    (ta,tb)C
    (transactions in different parallel sublists are not connected)
  5. For all
    i
    ,
    tPiG(t)parallelSublistGasLimit
    (gas limit constraint for parallel sublists)
  6. tSG(t)sequentialSublistGasLimit
    (gas limit constraint for sequential sublist)

Sublist Execution

  1. Let
    σ0
    be the initial state before any transaction executes
  2. Let
    σseq
    be the final state after all transactions execute sequentially
  3. Let
    σpar
    be the final state after parallel execution of the partition

For a parallel sublist

Pi, let
σ0Piσi
denote the state transition from the initial state
σ0
to state
σi
after executing all transactions in
Pi
.

Then, due to the connectivity constraints, we can prove:

  • For any two parallel sublists
    Pi
    and
    Pj
    where
    ij
    ,
    σ0Piσi
    and
    σ0Pjσj
    modify disjoint portions of the state
  • Therefore, there exists a state
    σP
    such that
    σ0P1P2...PNσP
  • Finally,
    σPSσpar=σseq

🚧 Transaction Partitioning

Transactions in a block are divided into N+1 sublists:

  • The first N sublists (called "parallel sublists") are executed in parallel
  • The last sublist (called the "sequential sublist") is executed after all parallel sublists have completed

🚧 'Partioned' Block Gas Limit and Blob Limit

Caution

Under Consideration

Each sublist has its own gas limit value and blob transaction limit. The current block gasLimit constant is replaced with three new constants:

  • parallelSublistGasLimit: the gas limit for a parallel sublist
  • sequentialSublistGasLimit: the gas limit for a sequential sublist
  • blobSublistLimit: the limit for blob submissions to a sublist

Both values are initially set to (block gas limit / (N+1)).

Sublist Field

Can we add a 'SideCar' field (like the BlobSideCar data attached) that contains an array of unsigned integers that indicates where each sublist ends in the transaction list.


Appendix

PreStateAccount

Represents an account's state before execution.

  • Properties:

    • balance (ConfusedHexType): The account's balance.
    • code (HexMaybePrefixOrEmpty): The account's deployed smart contract code.
    • nonce (ConfusedHexType): The transaction nonce.
    • storage (object):
      • Keys match the regex pattern ^0x[0-9a-f]+.
      • Values are of type HexData, representing storage values.
  • Constraints:

    • balance, code, and nonce are required.
    • storage does not allow additional properties outside the defined pattern.

Ethereum State Transition Object

Each key in the object represents an Ethereum transaction's state.

  • Properties:

    • _metadata (Metadata): Metadata about the transaction.

    • env (object): Describes the current execution environment.

      • Properties:

        • currentCoinbase (HexData): Miner address, Alias ETHERBASE.
        • currentDifficulty (ConfusedHexType): Block difficulty.
        • currentGasLimit (ConfusedHexType): Maximum gas allowed per block.
        • currentNumber (ConfusedHexType): Current block number.
        • currentTimestamp (ConfusedHexType): Block timestamp.
      • Constraints:

        • All properties are required.
    • exec (object): Defines current transaction execution details.

      • Properties:

        • address (AddressMaybePrefixOrEmpty): Contract address.
        • caller (AddressMaybePrefixOrEmpty): Transaction sender.
        • code (HexMaybePrefixOrEmpty): Smart contract bytecode.
        • data (HexDataOrEmpty): Input data payload.
        • gas (IntegerOrEmptyOrConfusedHex): Gas limit.
        • gasPrice (IntegerOrEmptyOrConfusedHex): Gas price per unit.
        • origin (AddressMaybePrefixOrEmpty): Original transaction sender.
        • value (IntegerOrEmptyOrConfusedHex): ETH value transferred.
      • Constraints:

        • All properties are required.
    • gas (IntegerOrEmptyOrConfusedHex): Total gas used.

    • logs (HexDataOrEmpty): Transaction logs.

    • out (HexDataOrEmpty): Transaction output.

    • pre (object): Pre-execution account state.

      • Pattern Properties:
        • Keys match ^0x[0-9a-f]* (Ethereum addresses).
        • Values are of type PreStateAccount.
    • post (object): Post-execution account state.

      • Pattern Properties:
        • Keys match ^0x[0-9a-f]* (Ethereum addresses).
        • Values are of type PreStateAccount.
  • Constraints:

    • _info, env, and exec are required.
    • pre and post states must conform to PreStateAccount.