-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ENS Integration #342
Comments
When creating a contract, should we save the resolved address or save the name and resolve it on demand? (either way, we should resolve it once to validate that the name points to an address) For example, if I have a long-running process that sets up a link to some token contract on init:
Some days or weeks later, say 'unicorn.tokens.eth' points to a new address for an updated token contract. Should the following line make calls to the new token contract address or the old one?
Reasons to store the name:
Reasons to store the address:
I'm leaning toward storing the name. Did I miss any reasons to store the address, instead? We can mitigate the performance issues with a caching layer. |
Dump from my Gitter chat on the subject with you: I generally agree with the approach of storing the name, however....
1 and 2 are just good documentation practices. 3 may be a made-up use case, but I can imagine an app which you would want it to fail if one of the names it was resolving suddenly changed (but where you still wanted to use ENS names). By configuring a dead period shortly after a name changes, it would allow you a buffer window to respond in the event of a security breach. Your app would start throwing errors because of the sudden change and you'd have time to get into the app and turn it off, or respond in whatever way necessary. |
Plus follow-up that it doesn't need to be implemented right away:
|
What was wrong?
We should enable sending transactions from/to an ENS address, and create a contract by referencing an ENS name.
How can it be fixed?
Integrate ens.py inside
web3
as a side-loaded module, then add default web3 middleware that converts from values ending in '.eth' to their address as resolved in ENS. ie~ens.address('to-addr-name.eth')
For security, the name lookup should be relatively fresh, so stalecheck will become a default middleware.
Additionally, an optional middleware
reverse_ens
could do reverse name lookups when an address would be returned. You might see something likeminer = getBlock('latest')
return block with:block.miner == 'f2pool.eth'
add stalecheck middleware as default (maybe 72 hours?)(This logic can stay inside ENS)ens
module Import ENS #343These are in limbo, waiting to be rebased and reopened after #343 is merged:
name_to_address_middleware
as a default middleware (auto-populates from/to insendTransaction
)(wait for Remove all positional eth.contract args, except address #317 ).eth
namesTokenContract('totally-legit-ico.eth')
TokenContract.deploy(args=['withdrawal-wallet.eth'])
token = TokenContract(resolve('name.eth'))
for when a user only wants to resolve up-front and only use the addressReminder to open these issues:
address_to_name_middleware
as an optional middleware which would replace returned addresses with ENS namesENS.fromWeb3()
Punt until user demand builds:
optionally trigger contract failures if name resolution changes (see part # 3 of Documentation above)solicit feedback for dynamic contract name lookup, but with strictness around address changes (maybe changes in a recent period, or any changes)The text was updated successfully, but these errors were encountered: