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

The API eth_getTransactionCount(..., "pending") is not synchronous with the API eth_sendRawTransaction. #1544

Open
yangby-cryptape opened this issue Nov 12, 2023 · 4 comments
Labels
d:solution Discussion required for the solution. enhancement New feature or request github_actions Pull requests that update GitHub Actions code P-Medium

Comments

@yangby-cryptape
Copy link
Collaborator

Description

  • Write a script with your favorite language.

    • Get the nonce M with pending transactions for a sender through the JSON-RPC.
    • Construct a transaction.
    • Send the transaction.
    • Get the nonce N with pending transactions for a sender through the JSON-RPC immediately, do NOT wait for the transaction to be mined.
    • Check if M is equal to N.
  • Start a Ethereum dev chain with Geth and parameters --dev --dev.period 3.

    • Run the script.
  • Start a Axon dev chain with default configuration [params.consensus_config] interval = 3000.

    • Run the script.
  • Compare the results of above tests:

    • No failed tests on Ethereum.
    • More than 50% tests on Axon are failed.
  • Base on the previous fact, on Axon, transactions could NOT be sent one by one immediately, because the API eth_getTransactionNonce(..., "pending") is not synchronous with the API eth_sendRawTransaction.

@yangby-cryptape yangby-cryptape changed the title [Bug] The API eth_getTransactionNonce(..., "pending") is not synchronous with the API eth_sendRawTransaction. [Bug] The API eth_getTransactionNonce(..., "pending") is not synchronous with the API eth_sendRawTransaction. Nov 12, 2023
@yangby-cryptape yangby-cryptape changed the title [Bug] The API eth_getTransactionNonce(..., "pending") is not synchronous with the API eth_sendRawTransaction. [Bug] The API eth_getTransactionCount(..., "pending") is not synchronous with the API eth_sendRawTransaction. Nov 13, 2023
@Flouse Flouse added the enhancement New feature or request label Nov 13, 2023
@yangby-cryptape
Copy link
Collaborator Author

Even we try to fix it with a tricky way as following:

// TODO `eth_getTransactionCount(..., "pending")` should be synchronous with
// `eth_sendRawTransaction`. Temporary solution for axonweb3/axon#1544.
sleep(Duration::from_millis(MEMPOOL_REFRESH_TIMEOUT)).await;

But it isn't fixed completely, just increased the chance for success.

I do the test as the issue described again, the result is:

  • For Axon: Total: 100, passed: 65, failed: 35.
  • For Geth: Total: 100, passed: 100, failed: 0.

That's why some CI checks failed randomly.

@Flouse
Copy link
Contributor

Flouse commented Nov 21, 2023

That's why some CI checks failed randomly.

@yangby-cryptape
Copy link
Collaborator Author

That's why some CI checks failed randomly.

* Do you mean [Sometimes the test `eth_getCode › eth_getCode_9` failed by accident #1579](https://github.com/axonweb3/axon/issues/1579) ?

No, I just guess it is related to "v3_core_test" timeout or some other timeouts.

I didn't check #1579.

@Flouse
Copy link
Contributor

Flouse commented Nov 22, 2023

No, I just guess it is related to "v3_core_test" timeout or some other timeouts.

The v3-core-test (ubuntu-22.04) action has timed out.
cc @sunchengzhu

@yangby-cryptape yangby-cryptape changed the title [Bug] The API eth_getTransactionCount(..., "pending") is not synchronous with the API eth_sendRawTransaction. The API eth_getTransactionCount(..., "pending") is not synchronous with the API eth_sendRawTransaction. Nov 24, 2023
@yangby-cryptape yangby-cryptape added the d:solution Discussion required for the solution. label Nov 24, 2023
@Flouse Flouse added the github_actions Pull requests that update GitHub Actions code label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d:solution Discussion required for the solution. enhancement New feature or request github_actions Pull requests that update GitHub Actions code P-Medium
Projects
None yet
Development

No branches or pull requests

2 participants