ethersphere / swarm

Swarm: Censorship resistant storage and communication infrastructure for a truly sovereign digital society
https://swarm.ethereum.org/
GNU Lesser General Public License v3.0
489 stars 110 forks source link

Unify resolvers into one cli flag #1991

Open santicomp2014 opened 5 years ago

santicomp2014 commented 5 years ago

Right now the way to specify the resolver and contracts for a specific TLD is --ens-api test:<contract 1>@<address 1> --ens-api test:<contract 2>@<address 1> The rns resolver uses a similar approach but for only one TLD (.rsk) --rns-api <contract 2>@<address 1> This was introduced in #1939 as a workaround.

The correct way would be to unify both under a common flag for example --resolver-api=ens:<contract 2>@<address 1> --resolver-api=rns:<contract 2>@<address 1>

Eknir commented 5 years ago

What is more, I think we should generalize what a resolver means. A resolver takes a human-readable name and returns a swarm-hash. ENS is a resolver, RSK is a resolver, but if I have locally a database from swarmHashes that I visit often, I should also be able to code my own resolver that uses my local database.

janos commented 5 years ago

It is also important that different resolvers may use different protocol or provide different functionalities. User should not be allowed to misconfigure swarm by specifying a resolver that uses uses different protocol, resulting in errors. ENS and RSK provide name resolving functionalities, but over different protocols and may provide different features. For example, we use Owner and HeaderByNumber from ENS resolver, which I am not sure that RSK provides. Before generalizing resolvers, we should define what are all requirements that a resolver must provide.

I would not say that --rns-api is just a workaround, this is a flag for specifying a specific protocol endpoint, which is different then ens, or maybe a future third one.