Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In GraphQL endpoints, Account’s transactionCount doesn’t take the pending status into account #24436

Closed
amyodov opened this issue Feb 20, 2022 · 1 comment · Fixed by #24443
Labels

Comments

@amyodov
Copy link

amyodov commented Feb 20, 2022

I tried to use GraphQL exclusively to get the nonces for some address, taking the “pending” status into account (i.e. do the GraphQL analog of eth.getTransactionCount(ADDRESS, 'pending')), but seems like currently it is impossible.

System information

Geth version: 1.10.16
OS & Version: Linux
Commit hash : release

Expected behaviour

Using regular CLI, I found some addresses with pending transactions:

> eth.getTransactionCount('0xffeBaF265d6653C40e635F5C7891089dC4C8E9bE')
14
> eth.getTransactionCount('0xffeBaF265d6653C40e635F5C7891089dC4C8E9bE', 'pending')
15
> eth.getTransactionCount('0x017213b1fc02caEc42369C954AAdD4106007B522')
0
> eth.getTransactionCount('0x017213b1fc02caEc42369C954AAdD4106007B522', 'pending')
1
> eth.getTransactionCount('0x80e757a835644465ab4fb62b00969c771ee026c3')
46
> eth.getTransactionCount('0x80e757a835644465ab4fb62b00969c771ee026c3', 'pending')
47

I queried them as

{
    block {
        account(address: "0x80e757a835644465ab4fb62b00969c771ee026c3") { address transactionCount }
    }
    pending {
        account(address: "0x80e757a835644465ab4fb62b00969c771ee026c3") { address transactionCount }
    }
}

(... and other addresses)

I expected to have the results like:

{
  "data": {
    "block": {
      "account": {
        "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
        "transactionCount": "0x2e"
      }
    },
    "pending": {
      "account": {
        "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
        "transactionCount": "0x2f"
      }
    }
  }
}

Actual behaviour

{
  "data": {
    "block": {
      "account": {
        "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
        "transactionCount": "0x2e"
      }
    },
    "pending": {
      "account": {
        "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
        "transactionCount": "0x2e"
      }
    }
  }
}

Similar behavior was observed not with just this address, but with any other addresses found in pending pool as transaction originators (e.g. 0xffeBaF265d6653C40e635F5C7891089dC4C8E9bE, 0x017213b1fc02caEc42369C954AAdD4106007B522 mentioned above).

Steps to reproduce the behaviour

Using txpool.content.pending, find some address with pending transactions (preferrably being pending for quite a long already – can be seen in Etherscan).

Insert them in GraphQL query like

{
    block {
        account(address: "ADDRESS") { address transactionCount }
    }
    pending {
        account(address: "ADDRESS") { address transactionCount }
    }
}

, execute query.

...

Also, I had some other interesting observation. Deeper in pending endpoint, we have transactions; which, in their turn, have the Account fields as well. And these account-in-transactions-in-pending should be referring to “pending” status of account, right? No they don’t.

Ran the following query:

{
    block {
        account(address: "0x80e757a835644465ab4fb62b00969c771ee026c3") {
            address
            transactionCount
        }
    }
    pending {
        account(address: "0x80e757a835644465ab4fb62b00969c771ee026c3") {
            address
            transactionCount
        }
        transactions {
            hash
            from { address transactionCount }
            to { address }
            nonce
        }
    }
}

And here is what I’ve got (cutting out the irrelevant transactions):

{
  "data": {
    "block": {
      "account": {
        "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
        "transactionCount": "0x2e"
      }
    },
    "pending": {
      "account": {
        "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
        "transactionCount": "0x2e"
      },
      "transactions": [
// ...
        {
          "hash": "0x9df001be03e3ccfc0049efeaa1109b17bec58f5b6d011157217e9e7e62e94261",
          "from": {
            "address": "0x80e757a835644465ab4fb62b00969c771ee026c3",
            "transactionCount": "0x2e"
          },
          "to": {
            "address": "0x639d20f70bcc01a25355720ef6590beab6e4a0e7"
          },
          "nonce": "0x2e"
        },
// ...
      ]
    }
  }
}

It finds a transaction in pending pool; and shows the transactionCount 0x2e no matter that the nonce in the same transaction is 0x2e too.

amyodov added a commit to UniversaBlockchain/UniCherryGarden that referenced this issue Feb 21, 2022
…ing the nonces in pending pool may need to be fixed

in geth upstream, see ethereum/go-ethereum#24436).
@s1na
Copy link
Contributor

s1na commented Feb 21, 2022

Hey @amyodov, thanks for reporting all these graphql issues. Keep them coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants