Skip to content

Conversation

@kauri-hero
Copy link
Contributor

Updated regex to capture maximum block count from error messages more accurately - namely update to Nodies provider. Added a new test case for extracting this specific error response.

Closes #734

Updated regex to capture maximum block count from error messages more accurately - namely update to Nodies provider. Added a new test case for extracting this specific error response.
@kauri-hero kauri-hero requested review from czarte and dnwiebe October 27, 2025 00:08
@kauri-hero kauri-hero moved this to 👀 Review + QA in Progress in MASQ Node v2 Oct 27, 2025
let regex_result =
Regex::new(r".* (max: |allowed for your plan: |is limited to |block range limit \(|exceeds max block range )(?P<max_block_count>\d+).*")
.expect("Invalid regex");
Regex::new(r".* (max: |allowed for your plan: |is limited to |block range limit \(|exceeds max block range |maximum allowed is )(?P<max_block_count>\d+).*")
Copy link
Collaborator

Choose a reason for hiding this comment

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

So now this is a six-fold regular expression. I think that's probably confusing enough: if there turns out to be a seventh option here, we should redesign this to be a list of single-option regexes. We might even want to put the list in the database so that we can distribute little scripts that customers can run to update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats a very good idea.
I added the sixth, so our original approach was getting stacked many-fold.

Ill write a card and we can see if the adding to db is a lot of extra work

@kauri-hero kauri-hero moved this from 👀 Review + QA in Progress to 📃 Quality Assurance Unfinished in MASQ Node v2 Nov 2, 2025
@kauri-hero
Copy link
Contributor Author

I have QA'd this myself (CC: @Syther007 ) running on this build.

Node is handling the parsing and max-block-range change successfully in a test run (using base-mainnet)

However, it seems the Nodies endpoint still returns the error when max-block-range is set to 20,000 as indicated in their error:

(\"RPC error: Error { code: ServerError(-32001), message: \\\"Block range too large: maximum allowed is 20000 blocks\\\", data: None }\")

I have passed to Nodies team to diagnose to see if there is any further aspects we have to consider.

Also, I managed to nail a test scan of 19,999 blocks and that worked successfully with Nodies without error.

So Node side testing is a pass, but before we push to production I want to check with Nodies provider with our results

@kauri-hero
Copy link
Contributor Author

I have discovered something interesting which maybe has been interfering with the max-block-range logic and handling with the block scans.

After testing and meeting with our RPC blockchain service provider, we realized that when a max block range is parsed out and added to our config, the next scan is performed across the limited range but the starting block number counts as "1 block" and the end range block number is simply start block number + the max range.

that actually makes the scan range max-block-range +1 and the error will repeat because its over the max range by 1 block, since it is including the starting block number of the scan.

In the test example:

BlockchainInterface: Retrieving transactions from start block: Number(37564645) to end block: Number(37584645) for: 0x27d9…788d chain_id: 8453 contract: 0x45d9c101a3870ca5024582fd788f4e1e8f7971c3
2025-11-02 21:25:24.436 Thd23: DEBUG: web3::transports::http: [5] Sending: {"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address":"0x45d9c101a3870ca5024582fd788f4e1e8f7971c3","fromBlock":"0x23d30e5","toBlock":"0x23d7f05","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",null,"0x00000000000000000000000027d9a2ac83b493f88ce9b4532edcf74e95b9788d"]}],"id":5} to https://lb.nodies.app/v1/c903375d5db44fe89de5736d47840f34
2025-11-02 21:25:24.768 Thd23: TRACE: web3::transports::shared: [5] Extracting result.
2025-11-02 21:25:24.769 Thd23: TRACE: BlockchainInterface: Transaction logs retrieval completed: Err(QueryFailed("RPC error: Error { code: ServerError(-32001), message: \"Block range too large: maximum allowed is 20000 blocks\", data: None }"))

The block range of (37564645) to end block: Number(37584645) is actually 20,001 blocks as it includes the first block number in the range!

…faceWeb3

Adjusted the end block marker calculation to correctly account for inclusive ranges by subtracting 1 from the scan range. T
@kauri-hero kauri-hero requested a review from dnwiebe November 4, 2025 21:54
…rface. Adjusted expected new start block values to ensure accurate transaction retrieval and logging.
@kauri-hero
Copy link
Contributor Author

QA Pass on Windows build:
✅ block range scan produces error when max range error received from RPC (in case of Nodies provider used for testing range is 20000)
manually changed start-block to 20005 blocks in past using set-configuration and triggered another scan to ensure it proceeds
✅ Next scan proceeds with correct block range, capped by the correct range and start block inclusive bounds
✅ Changed start block again the 50000 blocks in past
✅ Next scans proceed as expected, in scans of 20000. Each scan starting and ended with correct block numbers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📃 Quality Assurance Unfinished

Development

Successfully merging this pull request may close these issues.

Update Error parsing for Nodies v2 max-block range on get_ethLogs

3 participants