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

Put error in last call for STOP opcode #8413

Merged
merged 5 commits into from
Sep 15, 2023
Merged

Put error in last call for STOP opcode #8413

merged 5 commits into from
Sep 15, 2023

Conversation

Qwerty5Uiop
Copy link
Collaborator

@Qwerty5Uiop Qwerty5Uiop commented Sep 8, 2023

Changelog

Put error in last call on STOP operations + fixed REVERT in call tracer calls parser

@sl1depengwyn
Copy link
Collaborator

sl1depengwyn commented Sep 9, 2023

** (FunctionClauseError) no function clause matching in EthereumJSONRPC.Geth.Call.elixir_to_internal_transaction_params/1

    The following arguments were given to EthereumJSONRPC.Geth.Call.elixir_to_internal_transaction_params/1:

        # 1
        %{
          "blockNumber" => 2836634,
          "callType" => "stop",
          "createdContractAddressHash" => "0x",
          "createdContractCode" => "0x",
          "from" => "0x0000000000000000000000000000000000000000",
          "gas" => 0,
          "gasUsed" => 21000,
          "index" => 0,
          "init" => "0x",
          "input" => "0x",
          "output" => "0x",
          "to" => "0x",
          "traceAddress" => [],
          "transactionHash" => "0xcbbf23c54bcacf25f22f6aa2635283fcc9fdb30c3145db2301ff911dfb9924eb",
          "transactionIndex" => 8,
          "type" => "stop",
          "value" => 0
        }

    Attempted function clauses (showing 6 out of 6):

        defp elixir_to_internal_transaction_params(%{
      "blockNumber" => block_number,
      "transactionIndex" => transaction_index,
      "transactionHash" => transaction_hash,
      "index" => index,
      "traceAddress" => trace_address,
      "type" => "call" = type,
      "callType" => call_type,
      "from" => from_address_hash,
      "to" => to_address_hash,
      "gas" => gas,
      "input" => input,
      "error" => error,
      "value" => value
    }) when call_type === "call" or call_type === "callcode" or call_type === "delegatecall"
        defp elixir_to_internal_transaction_params(%{
      "blockNumber" => block_number,
      "transactionIndex" => transaction_index,
      "transactionHash" => transaction_hash,
      "index" => index,
      "traceAddress" => trace_address,
      "type" => "call" = type,
      "callType" => call_type,
      "from" => from_address_hash,
      "to" => to_address_hash,
      "gas" => gas,
      "gasUsed" => gas_used,
      "input" => input,
      "output" => output,
      "value" => value
    }) when call_type === "call" or call_type === "callcode" or call_type === "delegatecall"
        defp elixir_to_internal_transaction_params(%{
      "blockNumber" => block_number,
      "transactionIndex" => transaction_index,
      "transactionHash" => transaction_hash,
      "index" => index,
      "traceAddress" => trace_address,
      "type" => "call" = type,
      "callType" => "staticcall" = call_type,
      "from" => from_address_hash,
      "to" => to_address_hash,
      "input" => input,
      "gas" => gas,
      "gasUsed" => gas_used,
      "value" => 0 = value
    } = params)
        defp elixir_to_internal_transaction_params(%{
      "blockNumber" => block_number,
      "transactionIndex" => transaction_index,
      "transactionHash" => transaction_hash,
      "index" => index,
      "traceAddress" => trace_address,
      "type" => type,
      "from" => from_address_hash,
      "error" => error,
      "gas" => gas,
      "init" => init,
      "value" => value
    }) when type === "create" or type === "create2"
        defp elixir_to_internal_transaction_params(%{
      "blockNumber" => block_number,
      "transactionIndex" => transaction_index,
      "transactionHash" => transaction_hash,
      "index" => index,
      "traceAddress" => trace_address,
      "type" => type,
      "from" => from_address_hash,
      "createdContractAddressHash" => created_contract_address_hash,
      "gas" => gas,
      "gasUsed" => gas_used,
      "init" => init,
      "createdContractCode" => created_contract_code,
      "value" => value
    }) when type === "create" or type === "create2"
        defp elixir_to_internal_transaction_params(%{
      "blockNumber" => block_number,
      "transactionIndex" => transaction_index,
      "transactionHash" => transaction_hash,
      "index" => index,
      "traceAddress" => trace_address,
      "type" => "selfdestruct" = type,
      "from" => from_address_hash,
      "to" => to_address_hash,
      "gas" => gas,
      "gasUsed" => gas_used,
      "value" => value
    })

    (ethereum_jsonrpc 5.2.2) lib/ethereum_jsonrpc/geth/call.ex:321: EthereumJSONRPC.Geth.Call.elixir_to_internal_transaction_params/1
    (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (ethereum_jsonrpc 5.2.2) lib/ethereum_jsonrpc/geth.ex:224: EthereumJSONRPC.Geth.debug_trace_transaction_response_to_internal_transactions_params/2
    (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (ethereum_jsonrpc 5.2.2) lib/ethereum_jsonrpc/geth.ex:165: EthereumJSONRPC.Geth.debug_trace_transaction_responses_to_internal_transactions_params/3
    iex:6: (file)

Also, it seems that we need to handle revert there as well, this error did not appear before because of typo

@Qwerty5Uiop Qwerty5Uiop changed the title Add STOP opcode to call tracer parser Put error in last call for STOP opcode Sep 12, 2023
Copy link
Collaborator

@sl1depengwyn sl1depengwyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

** (FunctionClauseError) no function clause matching in Explorer.Chain.InternalTransaction.type_changeset/3

    The following arguments were given to Explorer.Chain.InternalTransaction.type_changeset/3:

        # 1
        #Ecto.Changeset<
          action: nil,
          changes: %{block_number: 2836634, type: :stop},
          errors: [],
          data: #Explorer.Chain.InternalTransaction<>,
          valid?: true
        >

        # 2
        %{
          block_number: 2836634,
          error: "execution stopped",
          from_address_hash: "0x0000000000000000000000000000000000000000",
          gas: 0,
          index: 0,
          input: "0x",
          trace_address: [],
          transaction_hash: "0xcbbf23c54bcacf25f22f6aa2635283fcc9fdb30c3145db2301ff911dfb9924eb",
          transaction_index: 8,
          type: "stop"
        }

        # 3
        :stop

    Attempted function clauses (showing 4 out of 4):

        defp type_changeset(changeset, attrs, :call)
        defp type_changeset(changeset, attrs, type) when type === :create or type === :create2
        defp type_changeset(changeset, attrs, :selfdestruct)
        defp type_changeset(changeset, _, nil)

    (explorer 5.2.2) lib/explorer/chain/internal_transaction.ex:440: Explorer.Chain.InternalTransaction.type_changeset/3
    (elixir 1.14.5) lib/stream.ex:612: anonymous fn/4 in Stream.map/2
    (elixir 1.14.5) lib/enum.ex:4751: Enumerable.List.reduce/3
    (elixir 1.14.5) lib/stream.ex:1813: Enumerable.Stream.do_each/4
    (elixir 1.14.5) lib/enum.ex:4307: Enum.reduce/3
    (explorer 5.2.2) lib/explorer/chain/import.ex:163: Explorer.Chain.Import.runner_changes_list/2
    (elixir 1.14.5) lib/stream.ex:612: anonymous fn/4 in Stream.map/2
    (elixir 1.14.5) lib/enum.ex:4751: Enumerable.List.reduce/3
    (elixir 1.14.5) lib/stream.ex:1813: Enumerable.Stream.do_each/4
    (elixir 1.14.5) lib/enum.ex:4307: Enum.reduce/3
    (explorer 5.2.2) lib/explorer/chain/import.ex:130: Explorer.Chain.Import.all/1
    (indexer 5.2.2) lib/indexer/fetcher/internal_transaction.ex:253: Indexer.Fetcher.InternalTransaction.import_internal_transaction/2
    (indexer 5.2.2) lib/indexer/fetcher/internal_transaction.ex:223: Indexer.Fetcher.InternalTransaction.safe_import_internal_transaction/2
    iex:4: (file)
iex(4)> 2023-09-14T16:26:12.834 application=explorer [warning] Failed to fetch genesis data. Chain spec path is not set.```

@vbaranov vbaranov merged commit 4294588 into master Sep 15, 2023
15 checks passed
@vbaranov vbaranov deleted the geth-add-call-type branch September 15, 2023 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants