Skip to content

Conversation

@gabrielbosio
Copy link

@gabrielbosio gabrielbosio commented May 19, 2022

Related to this issue: #11

Based on https://eips.ethereum.org/EIPS/eip-1459#client-protocol
It returns the node records for a specific network, without verifying them.

Known issue: Sometimes, when calling EthClient.NodesList.update_using_dns <testnet> it throws

** (exit) exited in: GenServer.call(EthClient.NodesList, {:update_using_dns, :rinkeby}, 20000)
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function Socket.Error.exception/1 is undefined or private
            (socket 0.3.13) Socket.Error.exception([reason: :emfile])
            (socket 0.3.13) lib/socket/udp.ex:72: Socket.UDP.open!/1
            (dns 2.3.0) lib/dns.ex:72: DNS.query/4
            (dns 2.3.0) lib/dns.ex:23: DNS.resolve/4
            (eth_client 0.1.0) lib/eth_client/nodes_list/dns.ex:70: EthClient.NodesList.DNS.wait_to_resolve/2
            (eth_client 0.1.0) lib/eth_client/nodes_list/dns.ex:37: EthClient.NodesList.DNS.get_children/3
            (elixir 1.13.2) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
            (elixir 1.13.2) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (elixir 1.13.2) lib/gen_server.ex:1030: GenServer.call/3

To check if all the connections are used, the DNS library should throw an exception and NodesList.DNS should catch it. But, in this case, it seems that an external library Socket is breaking.

Usage

# Get Goerli nodes using DNS
EthClient.NodesList.update_using_dns(:goerli)

Add elixir-dns dependency.
The function returns the data as it is, we still need to make the function
return the URL that geth will use. I suppose that we can make that URL using the
data that the DNS returns.
@gabrielbosio gabrielbosio linked an issue May 19, 2022 that may be closed by this pull request
Add search so that it returns all the nodes from a network.
Mainnet is taking too long. I will try to refactor the module to make it a
bit faster. For example, by removing the list concatenation at line 64.
Refactor ETS lookup.
@gabrielbosio gabrielbosio marked this pull request as ready for review May 24, 2022 20:16
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.

Retrieve list of nodes via DNS

2 participants