Skip to content

Conversation

natanasow
Copy link
Contributor

Description

New interfaces for the new classes part of the TransactionPool feature will have to be created in order to ensure modularity and not relying on concrete implementations

Motivation

  • Decouple transaction-pool logic from any specific cache implementation

  • Allow operators to plug in Redis, in-memory LRU, SQL, or other stores

export interface TransactionPoolService {
  saveTransaction(address: string, tx: Transaction): Promise<void>;

  onConsensusResult(): Promise<void>;

  getPendingCount(address: string): Promise<number>;
  
  resetState(): Promise<void>;
}

export interface PendingTransactionStorage {
  getList(addr: string): Promise<number>;

  addToList(addr: string, expectedPending: number): Promise<{ ok: true; newValue: number } | { ok: false; current: number }>;

  removeFromList(address:string, transaction: string): Promise<number>;
  
  removeAll(): Promise<void>;
}

Related issue(s)

Fixes #4388

Testing Guide

Changes from original design (optional)

N/A

Additional work needed (optional)

N/A

Checklist

  • I've assigned an assignee to this PR and related issue(s) (if applicable)
  • I've assigned a label to this PR and related issue(s) (if applicable)
  • I've assigned a milestone to this PR and related issue(s) (if applicable)
  • I've updated documentation (code comments, README, etc. if applicable)
  • I've done sufficient testing (unit, integration, etc.)

Signed-off-by: nikolay <[email protected]>
@natanasow natanasow self-assigned this Sep 23, 2025
@natanasow natanasow added the enhancement New feature or request label Sep 23, 2025
@natanasow natanasow modified the milestones: 0.72.0, 0.73.0 Sep 23, 2025
Copy link

github-actions bot commented Sep 23, 2025

Test Results

 20 files  ±0  265 suites  ±0   18m 49s ⏱️ -12s
726 tests ±0  721 ✅ ±0  5 💤 ±0  0 ❌ ±0 
742 runs  ±0  737 ✅ ±0  5 💤 ±0  0 ❌ ±0 

Results for commit a274b50. ± Comparison against base commit c5c5433.

♻️ This comment has been updated with latest results.

@natanasow natanasow changed the base branch from main to feat/transaction-pool September 23, 2025 10:12
@natanasow natanasow marked this pull request as ready for review September 23, 2025 10:13
@natanasow natanasow requested review from a team as code owners September 23, 2025 10:13
@natanasow natanasow merged commit ba268d5 into feat/transaction-pool Sep 23, 2025
87 of 91 checks passed
@natanasow natanasow deleted the 4388-defined-pendingtransactionstorage-and-transactionpoolservice-interfaces branch September 23, 2025 13:41
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 0% with 86 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/relay/src/lib/types/transactionPool.ts 0.00% 86 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

@@                    Coverage Diff                    @@
##           feat/transaction-pool    #4405      +/-   ##
=========================================================
- Coverage                  96.10%   95.69%   -0.42%     
=========================================================
  Files                        121      122       +1     
  Lines                      19940    20026      +86     
  Branches                    1755     1755              
=========================================================
  Hits                       19164    19164              
- Misses                       751      837      +86     
  Partials                      25       25              
Flag Coverage Δ
config-service 98.80% <ø> (ø)
relay 90.28% <0.00%> (-0.49%) ⬇️
server 88.82% <ø> (ø)
ws-server 98.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/relay/src/lib/types/transactionPool.ts 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

konstantinabl pushed a commit that referenced this pull request Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define PendingTransactionStorage interface and TransactionPoolService interface
3 participants