Commit 701b757
apollo_mempool: track and prune delayed declares so they can't bypass eviction
Declare transactions buffered in delayed_declares could pollute the mempool
immune to eviction (H-18):
1. add_ready_declares inserted popped declares into tx_pool without calling
update_accounts_with_gap, so a popped declare with a nonce gap was never
added to accounts_with_gap and thus never evictable.
2. commit_block never pruned delayed_declares, so a declare whose nonce was
committed on-chain while waiting was later inserted stale, also immune.
Fix:
- add_ready_declares now collects the popped accounts and calls
update_accounts_with_gap, and drops declares that are already stale (tx nonce
below the committed nonce). Staleness uses the committed nonce only -- staged
nonces are provisional and could otherwise discard a still-valid declare.
- commit_block prunes stale delayed declares (after state.commit, before
update_accounts_with_gap so any masked gap is re-detected).
- AddTransactionQueue gains a size-maintaining retain for the prune.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c8bf43b commit 701b757
2 files changed
Lines changed: 125 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1752 | 1752 | | |
1753 | 1753 | | |
1754 | 1754 | | |
1755 | | - | |
1756 | | - | |
1757 | | - | |
1758 | | - | |
| 1755 | + | |
| 1756 | + | |
1759 | 1757 | | |
1760 | 1758 | | |
1761 | 1759 | | |
1762 | 1760 | | |
1763 | 1761 | | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
1764 | 1827 | | |
1765 | 1828 | | |
1766 | 1829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| |||
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
238 | 263 | | |
239 | 264 | | |
240 | 265 | | |
| |||
599 | 624 | | |
600 | 625 | | |
601 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
602 | 631 | | |
603 | 632 | | |
604 | 633 | | |
605 | 634 | | |
606 | 635 | | |
607 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
608 | 652 | | |
609 | 653 | | |
| 654 | + | |
610 | 655 | | |
611 | 656 | | |
612 | 657 | | |
| |||
671 | 716 | | |
672 | 717 | | |
673 | 718 | | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
674 | 732 | | |
675 | 733 | | |
676 | 734 | | |
| |||
0 commit comments