From 627750338c7b7f239af0251e9ccc6f8325ee42ea Mon Sep 17 00:00:00 2001 From: MASDXI Date: Tue, 5 Mar 2024 20:44:05 +0700 Subject: [PATCH 1/4] - change txpool_besuTransactions to txpool_besuPendingTransactions - change runtime config enable pending transaction for besu client --- CHANGELOG.md | 1 + .../lib/ethereum_jsonrpc/pending_transaction.ex | 2 +- config/runtime.exs | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3e97ece568..eb9e949043a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Fixes +- [#](https://github.com/blockscout/blockscout/pull/) - Fix fetch pending transaction for hyperledger besu client - [#9514](https://github.com/blockscout/blockscout/pull/9514) - Fix missing `0x` prefix for `blockNumber`, `logIndex`, `transactionIndex` and remove `transactionLogIndex` in `eth_getLogs` response. - [#9512](https://github.com/blockscout/blockscout/pull/9512) - Docker-compose 2.24.6 compatibility - [#9262](https://github.com/blockscout/blockscout/pull/9262) - Fix withdrawal status diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex index 90de6961f18f..246787876134 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex @@ -61,7 +61,7 @@ defmodule EthereumJSONRPC.PendingTransaction do {:ok, [Transaction.params()]} | {:error, reason :: term} def fetch_pending_transactions_besu(json_rpc_named_arguments) do with {:ok, transactions} <- - %{id: 1, method: "txpool_besuTransactions", params: []} + %{id: 1, method: "txpool_besuPendingTransactions", params: [512]} |> request() |> json_rpc(json_rpc_named_arguments) do transactions_params = diff --git a/config/runtime.exs b/config/runtime.exs index 9d879a1ce79a..95c4a65bd94e 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -561,8 +561,7 @@ config :indexer, Indexer.Fetcher.TransactionAction, config :indexer, Indexer.Fetcher.PendingTransaction.Supervisor, disabled?: - System.get_env("ETHEREUM_JSONRPC_VARIANT") == "besu" || - ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER") + ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER") config :indexer, Indexer.Fetcher.Token, concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_CONCURRENCY", 10) From 754e6f26cdc07793ecc4ac3e596c8db00a24f307 Mon Sep 17 00:00:00 2001 From: MASDXI Date: Wed, 6 Mar 2024 11:31:43 +0700 Subject: [PATCH 2/4] adding comment in pending transaction besu --- .../lib/ethereum_jsonrpc/pending_transaction.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex index 246787876134..f07e53396e56 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex @@ -61,7 +61,14 @@ defmodule EthereumJSONRPC.PendingTransaction do {:ok, [Transaction.params()]} | {:error, reason :: term} def fetch_pending_transactions_besu(json_rpc_named_arguments) do with {:ok, transactions} <- - %{id: 1, method: "txpool_besuPendingTransactions", params: [512]} + # `txpool_besuPendingTransactions` required parameter `numResults` for number of maximum pending transaction to return. + # + # TODO: Remove fix value when hyperledger besu client change `numResults` from required to optional parameter. + # Current fix value set to `256000` can handle pending transaction in Ethereum mainnet. + # according to https://etherscan.io/chart/pendingtx + # + # https://besu.hyperledger.org/public-networks/reference/api#txpool_besupendingtransactions + %{id: 1, method: "txpool_besuPendingTransactions", params: [256000]} |> request() |> json_rpc(json_rpc_named_arguments) do transactions_params = From c164e52098366428d6bd14e9f2dd6413b302fe1e Mon Sep 17 00:00:00 2001 From: MASDXI Date: Wed, 6 Mar 2024 13:35:55 +0700 Subject: [PATCH 3/4] add PR tag --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb9e949043a7..e0ec3add5a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ ### Fixes -- [#](https://github.com/blockscout/blockscout/pull/) - Fix fetch pending transaction for hyperledger besu client +- [#9560](https://github.com/blockscout/blockscout/pull/9560) - Fix fetch pending transaction for hyperledger besu client - [#9514](https://github.com/blockscout/blockscout/pull/9514) - Fix missing `0x` prefix for `blockNumber`, `logIndex`, `transactionIndex` and remove `transactionLogIndex` in `eth_getLogs` response. - [#9512](https://github.com/blockscout/blockscout/pull/9512) - Docker-compose 2.24.6 compatibility - [#9262](https://github.com/blockscout/blockscout/pull/9262) - Fix withdrawal status From 07ca08cf676d47f15a82cbdefae458b9ac172923 Mon Sep 17 00:00:00 2001 From: MASDXI Date: Thu, 7 Mar 2024 10:48:11 +0700 Subject: [PATCH 4/4] Change value txpool_besuPendingTransactions to 512 --- .../lib/ethereum_jsonrpc/pending_transaction.ex | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex index f07e53396e56..14bf1d878323 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/pending_transaction.ex @@ -64,11 +64,14 @@ defmodule EthereumJSONRPC.PendingTransaction do # `txpool_besuPendingTransactions` required parameter `numResults` for number of maximum pending transaction to return. # # TODO: Remove fix value when hyperledger besu client change `numResults` from required to optional parameter. - # Current fix value set to `256000` can handle pending transaction in Ethereum mainnet. - # according to https://etherscan.io/chart/pendingtx + # Current fix value set to `512` bonsai storage default value is 512. + # to handle pending transaction in Ethereum mainnet require more than 100000. + # reference: + # https://etherscan.io/chart/pendingtx + # https://besu.hyperledger.org/public-networks/reference/cli/options#bonsai-historical-block-limit # # https://besu.hyperledger.org/public-networks/reference/api#txpool_besupendingtransactions - %{id: 1, method: "txpool_besuPendingTransactions", params: [256000]} + %{id: 1, method: "txpool_besuPendingTransactions", params: [512]} |> request() |> json_rpc(json_rpc_named_arguments) do transactions_params =