Skip to content

Conversation

@simzzz
Copy link
Contributor

@simzzz simzzz commented Oct 27, 2025

Description

Currently, we're saving only the transaction hash in the transaction pool storage but for txpool_* related methods, we need the entire transaction object. This PR adds storage of the entire txn as an RLP hex in both LRU and Redis.

Related issue(s)

Fixes #4500

@simzzz simzzz self-assigned this Oct 27, 2025
@simzzz simzzz marked this pull request as ready for review October 27, 2025 11:21
@simzzz simzzz requested review from a team as code owners October 27, 2025 11:21
@simzzz simzzz requested a review from acuarica October 27, 2025 11:21
@quiet-node
Copy link
Contributor

Haven’t gone through this in depth yet, but it looks like we’re changing the design of the txPool implementation. To avoid adding new changes on top of moving parts, I suggest holding off on merging this into the feature branch until the feature branch is finalized and merged into main first.

@simzzz simzzz marked this pull request as draft October 28, 2025 12:52
@simzzz simzzz marked this pull request as ready for review October 28, 2025 12:52
@quiet-node quiet-node force-pushed the feat/transaction-pool branch from aab2f1e to f908c27 Compare October 29, 2025 03:54
Base automatically changed from feat/transaction-pool to main October 29, 2025 09:11
@simzzz simzzz force-pushed the 4500-save-rlp-decoded-txn branch from e57963a to d2f61af Compare October 29, 2025 11:45
@github-actions
Copy link

github-actions bot commented Oct 29, 2025

Test Results

 20 files  ±0  269 suites  ±0   30m 27s ⏱️ + 8m 52s
779 tests +1  772 ✅ ±0  4 💤 ±0  3 ❌ +1 
794 runs  ±0  787 ✅  - 1  4 💤 ±0  3 ❌ +1 

For more details on these failures, see this check.

Results for commit 5928e28. ± Comparison against base commit 8a7783c.

♻️ This comment has been updated with latest results.

@simzzz simzzz added this to the 0.74.0 milestone Oct 29, 2025
@simzzz simzzz added the enhancement New feature or request label Oct 29, 2025
Copy link
Contributor

@konstantinabl konstantinabl left a comment

Choose a reason for hiding this comment

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

A comment and a few questions

@simzzz simzzz requested review from a team and konstantinabl October 30, 2025 13:41
Copy link
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

I think we should have a sync session to discuss this as a team

Copy link
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

Left some comments and questions

/**
* Key for the global pending transactions index.
*/
private readonly globalIndexKey = 'txpool:pending:txns';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make this a dependant of keyPrefix?

Suggested change
private readonly globalIndexKey = 'txpool:pending:txns';
private readonly globalIndexKey = `${keyPrefix}txns`;

Also should we make it more clear? globalIndexKey is quite confusing. Could it be globalPendingTxsKey or something? and the value could be ${keyPrefix}global?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Simeon Nakov <[email protected]>
@simzzz simzzz requested a review from quiet-node November 5, 2025 15:36
const key = this.keyFor(address);

await this.redisClient.sRem(key, txHash);
await this.redisClient.multi().sRem(key, rlpHex).sRem(this.globalIndexKey, rlpHex).execAsPipeline();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have .execAsPipeline() here but can't be .exec() like in addToList()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

Two last things and I believe I'm ready to approve

Signed-off-by: Simeon Nakov <[email protected]>
@simzzz simzzz requested a review from quiet-node November 6, 2025 15:52
quiet-node
quiet-node previously approved these changes Nov 6, 2025
Copy link
Contributor

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

Coolio LGTM!

natanasow
natanasow previously approved these changes Nov 7, 2025
@simzzz simzzz requested a review from konstantinabl November 7, 2025 10:07
throw new Error('Transaction hash is required for storage');
}
const rlpHex = tx.serialized;
await this.storage.addToList(addressLowerCased, rlpHex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we have sufficient error handling? On the lower level we have error logging when an error is detected on redis level, but we do not throw any errors. Just wondering if we might need error handling or at least logging on error, currently we use logger.debug im just not sure it will log correctly

@simzzz simzzz dismissed stale reviews from natanasow and quiet-node via 5928e28 November 7, 2025 17:54
@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

❌ Patch coverage is 79.67914% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/relay/src/lib/types/transactionPool.ts 0.00% 38 Missing ⚠️
@@            Coverage Diff             @@
##             main    #4521      +/-   ##
==========================================
- Coverage   95.52%   95.40%   -0.12%     
==========================================
  Files         127      127              
  Lines       20493    20624     +131     
  Branches     1760     1763       +3     
==========================================
+ Hits        19576    19677     +101     
- Misses        898      928      +30     
  Partials       19       19              
Flag Coverage Δ
config-service 98.81% <100.00%> (ø)
relay 90.83% <79.12%> (-0.12%) ⬇️
server 88.85% <ø> (ø)
ws-server 98.04% <ø> (+1.36%) ⬆️

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

Files with missing lines Coverage Δ
...ckages/config-service/src/services/globalConfig.ts 100.00% <100.00%> (ø)
...thService/transactionService/TransactionService.ts 98.86% <100.00%> (ø)
...ctionPoolService/LocalPendingTransactionStorage.ts 100.00% <100.00%> (ø)
...ctionPoolService/RedisPendingTransactionStorage.ts 100.00% <100.00%> (ø)
...s/transactionPoolService/transactionPoolService.ts 100.00% <100.00%> (ø)
packages/relay/src/lib/types/transactionPool.ts 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 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.

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.

Save the RLP decoded transaction in the storage of transaction pool instead of just transaction hash

5 participants