Skip to content

Comments

jsutils: add tool GetLargeTxs#3074

Merged
zzzckck merged 4 commits intodevelopfrom
jsutils_GetLargeTxs
May 12, 2025
Merged

jsutils: add tool GetLargeTxs#3074
zzzckck merged 4 commits intodevelopfrom
jsutils_GetLargeTxs

Conversation

@zzzckck
Copy link
Collaborator

@zzzckck zzzckck commented May 8, 2025

Description

add a description of your changes here...

Rationale

tell us why we need these changes...

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

@zzzckck zzzckck force-pushed the jsutils_GetLargeTxs branch from 93abe20 to b1bcc93 Compare May 8, 2025 09:37
@zzzckck zzzckck requested a review from Copilot May 12, 2025 03:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new tool ("GetLargeTxs") to the jsutils command, which allows users to retrieve large transactions within a specified block range. Key changes include updating the default value of the "turnLength" option, introducing a new "gasUsedThreshold" option, and implementing the new getLargeTxs function along with its integration in the main command handler.

Comments suppressed due to low confidence (1)

cmd/jsutils/getchainstatus.js:832

  • [nitpick] The CLI option '--num' is used in multiple commands with potentially different meanings. Consider using a more descriptive name (e.g., '--blockCount') for commands that process block ranges to avoid confusion.
const size = parseInt(program.num) || 100;

Comment on lines +871 to +876
for (let txIndex = 0; txIndex < blockData.transactions.length; txIndex++) {
const txData = await blockData.getTransaction(txIndex);
if (txData && txData.gasLimit >= gasUsedThreshold) {
potentialTxs.push(txData);
}
}
Copy link

Copilot AI May 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider retrieving transaction data in parallel (e.g., by collecting promises and using Promise.all) instead of awaiting each transaction sequentially to improve performance.

Suggested change
for (let txIndex = 0; txIndex < blockData.transactions.length; txIndex++) {
const txData = await blockData.getTransaction(txIndex);
if (txData && txData.gasLimit >= gasUsedThreshold) {
potentialTxs.push(txData);
}
}
const transactionPromises = [];
for (let txIndex = 0; txIndex < blockData.transactions.length; txIndex++) {
transactionPromises.push(blockData.getTransaction(txIndex));
}
const transactions = await Promise.all(transactionPromises);
transactions.forEach(txData => {
if (txData && txData.gasLimit >= gasUsedThreshold) {
potentialTxs.push(txData);
}
});

Copilot uses AI. Check for mistakes.
@zzzckck zzzckck merged commit eaebb81 into develop May 12, 2025
7 checks passed
@zzzckck zzzckck deleted the jsutils_GetLargeTxs branch May 14, 2025 06:22
galaio pushed a commit to galaio/bsc that referenced this pull request May 29, 2025
galaio pushed a commit to galaio/bsc that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants