vechain-sdk-js
vechain-sdk-js copied to clipboard
🐛 [BUG] - `eth_getTransactionCount` returns random numbers
Description
When accessing eth_getTransactionCount
on the RPC Mapper, there is a random number returned at all times.
https://github.com/vechain/vechain-sdk-js/blob/630d4028096de84d82ea2176985c086cfd9acb03/packages/network/src/provider/utils/rpc-mapper/methods-map/methods/eth_getTransactionCount/eth_getTransactionCount.ts#L46
This might be sufficient for applications using only the number or for test cases, but not for applications relying on the counter, like hardhat-ignition
does.
For example hardhat-ignition fails to interact with vechain networks, because it detects pending transactions that do not exist.
I suggest to:
- Either return
0
at all times or return the current block number - and add Transaction Pool and filter for the request address, to return a meaningful number in the pending request
As reference, here are requests within ignition that result in invalid conditions:
https://github.com/NomicFoundation/hardhat-ignition/blob/development/packages/core/src/internal/execution/nonce-management/get-nonce-sync-messages.ts#L89-L112
Reproduction URL
No response
Reproduction steps
curl -s https://rpc-testnet.vechain.energy/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_getTransactionCount","params":["0x202bB937Af984F83184B726cDc099A76d8bcDE8b", "pending"],"id":1,"jsonrpc":"2.0"}' | jq
Returns a value, even if there is nothing pending:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x53aebba70699"
}
Screenshots

Logs
No response
OS
No response