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

Update the loom rpc client to discard blockTime from logs #72

Open
enlight opened this issue Oct 31, 2019 · 0 comments
Open

Update the loom rpc client to discard blockTime from logs #72

enlight opened this issue Oct 31, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@enlight
Copy link
Contributor

enlight commented Oct 31, 2019

Loom chains have a non-standard blockTime field on the logs returned by eth_getLogs (and in receipts), this seems to trip up the indexer:

2019-10-31T05:37:01.552 application=indexer fetcher=block_catchup [error] Catchup index stream exited with reason ({:function_clause, [{EthereumJSONRPC.Log, :entry_to_elixir, [{"blockTime", "0x5dba72d6"}], [file: 'lib/ethereum_jsonrpc/log.ex', line: 170]}, {Map, :new_transform, 3, [file: 'lib/map.ex', line: 216]}, {Enum, :"-map/2-lists^map/1-0-", 2, [file: 'lib/enum.ex', line: 1336]}, {EthereumJSONRPC.Receipt, :entry_to_elixir, 1, [file: 'lib/ethereum_jsonrpc/receipt.ex', line: 272]}, {EthereumJSONRPC.Receipt, :entry_reducer, 2, [file: 'lib/ethereum_jsonrpc/receipt.ex', line: 218]}, {:maps, :fold_1, 3, [file: 'maps.erl', line: 232]}, {EthereumJSONRPC.Receipt, :to_elixir, 1, [file: 'lib/ethereum_jsonrpc/receipt.ex', line: 212]}, {Enum, :"-map/2-lists^map/1-0-", 2, [file: 'lib/enum.ex', line: 1336]}]}). Restarting

2019-10-31T05:37:01.554 [error] GenServer :block_catchup_sequencer terminating

 ** (FunctionClauseError) no function clause matching in EthereumJSONRPC.Log.entry_to_elixir/1

 (ethereum_jsonrpc) lib/ethereum_jsonrpc/log.ex:170: EthereumJSONRPC.Log.entry_to_elixir({"blockTime", "0x5dba72d6"})

 (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2

 (ethereum_jsonrpc) lib/ethereum_jsonrpc/receipt.ex:212: EthereumJSONRPC.Receipt.to_elixir/1

I think the easiest way to fix this is to tweak the EthereumJSONRPC.Log.entry_to_elixir function to ignore the blockTime field. This should be a loom specific tweak, so maybe need to put this override in apps\ethereum_jsonrpc\lib\ethereum_jsonrpc\loom\logs.ex and then figure out how to get use it instead of the default implementation.

@enlight enlight added the bug Something isn't working label Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants