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

Merge seiv2 into main #234

Merged
merged 27 commits into from
Apr 19, 2024
Merged

Merge seiv2 into main #234

merged 27 commits into from
Apr 19, 2024

Commits on Apr 16, 2024

  1. Make ReadMaxTxs atomic (#166)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    adecae0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c090194 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ae3db8f View commit details
    Browse the repository at this point in the history
  4. fix pending pop (#173)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    b455dda View commit details
    Browse the repository at this point in the history
  5. add TTL for pending txs (#174)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    2d8a37e View commit details
    Browse the repository at this point in the history
  6. [EVM] Fix evm pending nonce (#179)

    * Perf: Increase buffer size for pubsub server to boost performance (#167)
    
    * Increase buffer size for pubsub server
    
    * Add more timeout for test failure
    
    * Add more timeout
    
    * Fix test split scripts
    
    * Fix test split
    
    * Fix unit test
    
    * Unit test
    
    * Unit test
    
    * [P2P] Optimize block pool requester retry and peer pick up logic (#170)
    
    * P2P Improvements: Fix block sync reactor and block pool retry logic
    
    * Revert "Add event data to result event (#165)" (#176)
    
    This reverts commit 72bb29c.
    
    * Fix block sync auto restart not working as expected (#175)
    
    * Fix edge case for blocksync (#178)
    
    * fix evm pending nonce
    
    * fix test
    
    * deflake a test
    
    * de-flake test
    
    * Revert "merge main"
    
    This reverts commit 58b9424, reversing
    changes made to 02d1478.
    
    * consider keep-in-cache logic when removing from cache
    
    * undo test tweaks
    
    ---------
    
    Co-authored-by: Yiming Zang <[email protected]>
    Co-authored-by: Jeremy Wei <[email protected]>
    3 people authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    3c40e35 View commit details
    Browse the repository at this point in the history
  7. Fix bug when popping pending TXs (#188)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    cb994c7 View commit details
    Browse the repository at this point in the history
  8. Add mempool metrics for number of pending tx and expired txs (#189)

    * Add metrics for mempool pending transaction size
    
    * Add expired tx count metrics
    yzang2019 authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    00a542a View commit details
    Browse the repository at this point in the history
  9. [EVM] Allow multiple txs from same account in a block (#190)

    * add mempool prioritization with evm nonce
    
    * fix priority stability
    
    * index fixes
    
    * replace with binary search insert
    
    * impl binary search
    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    208bf0d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    36ad021 View commit details
    Browse the repository at this point in the history
  11. fix expire metric (#193)

    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    f0e859d View commit details
    Browse the repository at this point in the history
  12. [EVM] Fix duplicate evm txs from priority queue (#195)

    * debug duplicate evm tx
    
    * add more logs
    
    * add some \ns
    
    * more logs
    
    * fix swap check
    
    * add-lockable-reap-by-gas
    
    * add invariant checks
    
    * fix invariant parenthesis
    
    * fix log
    
    * remove invalid invariant
    
    * fix nonce ordering pain
    
    * handle ordering of insert
    
    * fix remove
    
    * cleanup
    
    * fix imports
    
    * cleanup
    
    * avoid getTransactionByHash(hash) panic due to index
    
    * use Key() to compare instead of pointer
    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    c73b9d9 View commit details
    Browse the repository at this point in the history
  13. [EVM] prevent duplicate txs from getting inserted (#196)

    * prevent duplicates in mempool
    
    * use timestamp in priority queue
    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    e302cb1 View commit details
    Browse the repository at this point in the history
  14. [EVM] Add logging for expiration (#198)

    * add logging for expired txs
    
    * cleanup
    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    f8eb80d View commit details
    Browse the repository at this point in the history
  15. [EVM] Avoid returning nil transactions on ForEach (#197)

    * remove heapIndex to avoid nil scenario
    
    * avoid returning nil in loop (mimic Peek)
    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    a5ac3ff View commit details
    Browse the repository at this point in the history
  16. call callback from mempool (#200)

    stevenlanders authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    0552641 View commit details
    Browse the repository at this point in the history
  17. separate limit for pending tx (#202)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    0d789d1 View commit details
    Browse the repository at this point in the history
  18. Add EVM txs eviction logic (#204)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    e89d46c View commit details
    Browse the repository at this point in the history
  19. Fix debug log (#205)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    52dcce1 View commit details
    Browse the repository at this point in the history
  20. EVM transaction replacement (#206) (#208)

    codchen authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    d90626d View commit details
    Browse the repository at this point in the history
  21. Add heapIndex with safety check (#213)

    * add heapIndex with safety check
    
    * cleanup
    
    * comment out for perf test
    
    * add back perf improvement
    
    * fix nil test
    
    * Use write-lock in (*TxPriorityQueue).ReapMax funcs (#209)
    
    ReapMaxBytesMaxGas and ReapMaxTxs funcs in TxPriorityQueue claim
    > Transactions returned are not removed from the mempool transaction
    > store or indexes.
    
    However, they use a priority queue to accomplish the claim
    > Transaction are retrieved in priority order.
    
    This is accomplished by popping all items out of the whole heap, and
    then pushing then back in sequentially. A copy of the heap cannot be
    obtained otherwise. Both of the mentioned functions use a read-lock
    (RLock) when doing this. This results in a potential scenario where
    multiple executions of the ReapMax can be started in parallel, and
    both would be popping items out of the priority queue.
    
    In practice, this can be abused by executing the `unconfirmed_txs` RPC
    call repeatedly. Based on our observations, running it multiple times
    per millisecond results in multiple threads picking it up at the same
    time. Such a scenario can be obtained via the WebSocket interface, and
    spamming `unconfirmed_txs` calls there. The behavior that happens is a
    `Panic in WSJSONRPC handler` when a queue item unexpectedly disappears
    for `mempool.(*TxPriorityQueue).Swap`.
    (`runtime error: index out of range [0] with length 0`)
    
    This can additionally lead to a `CONSENSUS FAILURE!!!` if the race
    condition occurs for `internal/consensus.(*State).finalizeCommit`
    when it tries to do `mempool.(*TxPriorityQueue).RemoveTx`, but
    the ReapMax has already removed all elements from the underlying
    heap. (`runtime error: index out of range [-1]`)
    
    This commit switches the lock type to a write-lock (Lock) to ensure
    no parallel modifications take place. This commit additionally updates
    the tests to allow parallel execution of the func calls in testing,
    as to prevent regressions (in case someone wants to downgrade the locks
    without considering the implications from the underlying heap usage).
    
    ---------
    
    Co-authored-by: Valters Jansons <[email protected]>
    2 people authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    58e8e55 View commit details
    Browse the repository at this point in the history
  22. Pending Txs Update Condition (#214)

    Kbhat1 authored and udpatil committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    c60575b View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    12db400 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    a214d48 View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2024

  1. Configuration menu
    Copy the full SHA
    2c9ac73 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2024

  1. Configuration menu
    Copy the full SHA
    59da3e7 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2024

  1. Configuration menu
    Copy the full SHA
    8c8db19 View commit details
    Browse the repository at this point in the history