blockscout / blockscout

Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
http://docs.blockscout.com
GNU General Public License v3.0
3.66k stars 2.45k forks source link

backend failed to fetch internal transactions for blocks (FunctionClauseError) #10409

Open EthanShang8989 opened 4 months ago

EthanShang8989 commented 4 months ago

Description

Config

I am running ploygon edge and blockscout on the same machine. On top of this machine docker-compose up --build. the configuration I changed was to modify nginx.yml . Moved the external port 80 to port 9999. Here is the exact configuration that was modified.

ploygon edge config

chain_config: ./genesis.json
data_dir: ./data-dir
block_gas_target: "0x0"
grpc_addr: 0.0.0.0:9632
jsonrpc_addr: 0.0.0.0:8545
telemetry:
    prometheus_addr: ""
network:
    no_discover: false
    libp2p_addr: 0.0.0.0:1478
    nat_addr: 143.92.34.138
    dns_addr: ""
    max_peers: -1
    max_outbound_peers: -1
    max_inbound_peers: -1
seal: true
tx_pool:
    price_limit: 0
    max_slots: 4096
    max_account_enqueued: 128
log_level: INFO
restore_file: ""
headers:
    access_control_allow_origins:
        - '*'
log_to: ""
json_rpc_batch_request_limit: 20
json_rpc_block_range_limit: 1000
json_log_format: false
cors_allowed_origins: []
relayer: false
num_block_confirmations: 64
concurrent_requests_debug: 32
web_socket_read_limit: 8192
metrics_interval: 8s

common-blockscout.env

CHAIN_TYPE = polygon_edge  
BLOCKSCOUT_PROTOCOL=http
ETHEREUM_JSONRPC_WS_URL=ws://host.docker.internal:8545/ws
ETHEREUM_JSONRPC_HTTP_INSECURE=true
INDEXER_COIN_BALANCES_BATCH_SIZE=5
INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE=50

user-ops-indexer.yml

  - USER_OPS_INDEXER__INDEXER__RPC_URL=${USER_OPS_INDEXER__INDEXER__RPC_URL:-ws://host.docker.internal:8545/ws}

Because I found that modifying the common-user-ops-indexer.env

USER_OPS_INDEXER__INDEXER__RPC_URL=ws://host.docker.internal:8545/ws

I just modified the yml file directly because it didn't work.

Description

After running for a short while the following appears

backend           | {"time":"2024-07-12T08:38:47.711Z","severity":"error","message":"failed to fetch internal transactions for blocks [130, 347, 348, 349, 350, 354, 355, 356, 429, 502]: ** (FunctionClauseError) no function clause matching in EthereumJSONRPC.Geth.internal_transactions_params_reducer/2\n    (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:463: EthereumJSONRPC.Geth.internal_transactions_params_reducer([], {:ok, []})\n    (elixir 1.16.3) lib/enum.ex:2528: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:459: EthereumJSONRPC.Geth.reduce_internal_transactions_params/1\n    (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:272: EthereumJSONRPC.Geth.debug_trace_transaction_responses_to_internal_transactions_params/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:230: anonymous fn/3 in Indexer.Fetcher.InternalTransaction.fetch_block_internal_transactions_by_transactions/2\n    (elixir 1.16.3) lib/enum.ex:2528: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:160: Indexer.Fetcher.InternalTransaction.fetch_internal_transactions/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:113: Indexer.Fetcher.InternalTransaction.run/2\n","metadata":{"count":10,"fetcher":"internal_transaction","error_count":10}}

There doesn't seem to be a problem when actually visiting the browser. It seems like status hasn't updated since except for when it first started updating. But it could be that the cycle is older. Because I've found this problem with other blockscout browsers as well.

Type of the installation

Docker-compose

Type of the JSON RPC archive node

Polygon edge

Type of the chain

L1

Link to the page

No response

Steps to reproduce

Steps to reproduce

1.start up polygon edge node。

wget https://github.com/0xPolygon/polygon-edge/releases/download/v1.3.2/polygon-edge_1.3.2_linux_amd64.tar.gz

tar -xvzf polygon-edge_1.3.2_linux_amd64.tar.gz

./polygon-edge secrets init --data-dir data-dir --insecure

./polygon-edge genesis --consensus ibft --pos --validators <address>:<BLS Public key> --bootnode /ip4/<host ip>/tcp/1478/p2p/<Node id> --block-gas-limit 1000000000 --premine=<address>:1000000000000000000 --chain-id <your chain id> --name <your chain name>

sudo ./polygon-edge server --config config.yml

2.start blockscout

Deleting containers and deleting the db multiple times because the previous configuration was not configured correctly

docker-compose rm -f
rm -rf /services/stats-db-data
rm -rf /services/blockscout-db-data
rm -rf /services/logs
rm -rf /services/redis-data

docker-compose up --build

Backend version

bd09249c175419ab49608f65252f55a79649df69

Frontend version

No response

Elixir & Erlang/OTP versions

x

Operating system

Linux

Additional information

No response

vbaranov commented 4 months ago

@EthanShang8989 for Polygon Edge you should switch to this docker image of backend blockscout/blockscout-polygon-edge:latest.

EthanShang8989 commented 4 months ago

@EthanShang8989 for Polygon Edge you should switch to this docker image of backend blockscout/blockscout-polygon-edge:latest.

@vbaranov I modified my docker-compose.yml file

  backend:
    depends_on:
      - db
      - redis-db
    extends:
      file: ./services/backend.yml
      service: backend
    # build:
    #   context: ..
    #   dockerfile: ./docker/Dockerfile
    #   args:
    #     CACHE_EXCHANGE_RATES_PERIOD: ""
    #     API_V1_READ_METHODS_DISABLED: "false"
    #     DISABLE_WEBAPP: "false"
    #     API_V1_WRITE_METHODS_DISABLED: "false"
    #     CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED: ""
    #     CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: ""
    #     ADMIN_PANEL_ENABLED: ""
    #     RELEASE_VERSION: 6.7.2
    image: blockscout/blockscout-polygon-edge:latest
    links:
      - db:database
    environment:
        ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/
        ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/
        ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ws
        CHAIN_ID: '1337'

Then I executed the following command

docker-compose -f docker-compose.yml down
docker builder prune -a

rm -rf /services/stats-db-data
rm -rf /services/blockscout-db-data
rm -rf /services/logs
rm -rf /services/redis-data

docker-compose up --build

But it still print the same error message

backend                         | {"time":"2024-07-16T06:24:18.402Z","severity":"error","message":"failed to fetch 
internal transactions for blocks [377, 399, 403, 481, 1372, 1632, 19001, 19002, 19007, 19088]: ** (FunctionClauseError) 
no function clause matching in EthereumJSONRPC.Geth.internal_transactions_params_reducer/2\n    
(ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:463: EthereumJSONRPC.Geth.internal_transactions_params_reducer([], {:ok, []})\n    (elixir 1.16.3)
 lib/enum.ex:2528: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    
(ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:459: EthereumJSONRPC.Geth.reduce_internal_transactions_params/1\n    (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:272:
EthereumJSONRPC.Geth.debug_trace_transaction_responses_to_internal_transactions_params/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:230: anonymous fn/3 in Indexer.Fetcher.InternalTransaction.fetch_block_internal_transactions_by_transactions/2\n   
 (elixir 1.16.3) lib/enum.ex:2528: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:160: Indexer.Fetcher.InternalTransaction.fetch_internal_transactions/3\n   
 (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:113: Indexer.Fetcher.InternalTransaction.run/2\n","metadata":{"count":10,"fetcher":"internal_transaction","error_count":10}}

backend                         | {"time":"2024-07-16T06:24:18.409Z","severity":"error","message":"failed to fetch
 internal transactions for blocks [485, 491, 511, 655, 796, 881, 19066, 19075, 19076, 19084]: ** (FunctionClauseError) no function clause matching in EthereumJSONRPC.Geth.internal_transactions_params_reducer/2\n  
  (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:463: EthereumJSONRPC.Geth.internal_transactions_params_reducer([], {:ok, []})\n    (elixir 1.16.3) lib/enum.ex:2528: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n  
  (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:459: 
EthereumJSONRPC.Geth.reduce_internal_transactions_params/1\n    (ethereum_jsonrpc 6.7.2) lib/ethereum_jsonrpc/geth.ex:272: EthereumJSONRPC.Geth.debug_trace_transaction_responses_to_internal_transactions_params/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:230: anonymous fn/3 in Indexer.Fetcher.InternalTransaction.fetch_block_internal_transactions_by_transactions/2\n 
   (elixir 1.16.3) lib/enum.ex:2528: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\n    (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:160: Indexer.Fetcher.InternalTransaction.fetch_internal_transactions/3\n 
   (indexer 6.7.2) lib/indexer/fetcher/internal_transaction.ex:113: Indexer.Fetcher.InternalTransaction.run/2\n",
"metadata":{"count":10,"fetcher":"internal_transaction","error_count":10}}

I don't understand if I'm doing it correctly? Could you be a little more detailed? Thank you very much!

LonzoCall commented 4 months ago

same problem

EthanShang8989 commented 4 months ago

same problem

If you've solved this problem, please let me know, I'd appreciate it. It's been printtting errors msg that make the docker container size increase very fast, about 40g in two days. The container needs to be deleted and restarted regularly.

vncoelho commented 2 months ago
backend           | {"time":"2024-09-20T13:02:00.455Z","severity":"error","message":"failed to fetch internal transactions for blocks [4364, 73091, 88246, 98286, 106966, 107056, 123902, 124064, 132228, 148099]: ** (ErlangError) Erlang error: [%{code: -32601, data: %{block_number: 73091, transaction_index: 0, transaction_hash: \"0xe9a8ca89fa7e10e7512ffe7e87410e24db5963c97156c3a5947bb5c8aeb7fbb6\"}, message: \"the method debug_traceTransaction does not exist/is not available\"}]","metadata":{"count":10,"fetcher":"internal_transaction","error_count":10}}
backend           | {"time":"2024-09-20T13:02:00.457Z","severity":"error","message":"failed to fetch internal transactions for blocks [36659, 38029, 81968, 93110, 93176, 98102, 108981, 114557, 133564, 147938]: ** (ErlangError) Erlang error: [%{code: -32601, data: %{block_number: 36659, transaction_index: 0, transaction_hash: \"0xe20282387ff0012fa8beac7deda1059d44b0c074bf6ec9fb0764d28b1722340e\"}, message: \"the method debug_traceTransaction does not exist/is not available\"}]","metadata":{"count":10,"fetcher":"internal_transaction","error_count":10}}
backend           | {"time":"2024-09-20T13:02:00.458Z","severity":"error","message":"failed to fetch internal transactions for blocks [7944, 80031, 80923, 93240, 98060, 98085, 107474, 107947, 132230, 148046]: ** (ErlangError) Erlang error: [%{code: -32601, data: %{block_number: 80031, transaction_index: 0, transaction_hash: \"0x09e8d979cdfec71f0ebae8bfb8c6df46c70dd9c9e01daf809b4353215e70d2e6\"}, message: \"the method debug_traceTransaction does not exist/is not available\"}]","metadata":{"count":10,"fetcher":"internal_transaction","error_count":10}}

Similar here

R-Santev commented 5 days ago

I am experiencing the same problem