solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Better support ENS (namehash)

Open chriseth opened this issue 6 years ago • 8 comments

This is currently a brainstorming issue. ENS should be better integrated into Solidity, but we probably do not want the compiler to make any name lookups at compilation time. Something like named constants supplied by the compilation driver / framework might be a good middle ground that could also be used for many other purposes.

chriseth avatar Jun 18 '19 08:06 chriseth

@arachnid suggested supporting namehash in the form bytes32 nh = namehash("my.name.eth");.

chriseth avatar Jun 18 '19 08:06 chriseth

The latter might either be specifically implemented in the compiler or it could be generalized to "parameterized constants" of the form $namespace(arg1, arg2, arg3). For each such occurrence, the compiler enquires the compiler driver for the value of that constant and inserts it into the source code.

To ensure deterministic compilation and reproducible builds, a list of all the values for these constants need to be provided as part of the compilation options.

chriseth avatar Jun 18 '19 09:06 chriseth

Why should this get special treatment and not just implement #3878 ?

axic avatar Jun 18 '19 12:06 axic

Because the values of these parameterised constants might be not be pure expressions or might not be implementable in solidity. Namehash is, but it could also be something like resolveAddressAtCompileTime("my.name.eth")

chriseth avatar Jun 18 '19 13:06 chriseth

Why would this be needed? Could #1650 be considered as an option for this?

axic avatar Jun 18 '19 15:06 axic

Namehash isn't really practical to implement in solidity - it requires doing UTS46 normalisation, which requires enormous (for a smart contract) character lookup tables.

Arachnid avatar Jun 18 '19 21:06 Arachnid

At the moment, I do not see an easy way to do this. We either need to support a specific set of macro functions inside the compiler or move this responsibility to the driver. Since the latter would either need a callback mechanism or a multi-pass compilation, both do not seem particularly nice.

chriseth avatar Jun 20 '19 08:06 chriseth

Actually now with having different callback kinds, this could be moved to the callback layer.

axic avatar Dec 12 '19 23:12 axic

This issue has been marked as stale due to inactivity for the last 90 days. It will be automatically closed in 7 days.

github-actions[bot] avatar Feb 23 '23 12:02 github-actions[bot]

I'd still love to see this implemented.

Arachnid avatar Feb 23 '23 23:02 Arachnid

@ekpyron @chriseth @axic Since this is a brainstorming issue and has been open for quite a while, I guess, if there were any more concrete ideas beyond #11436 and #11972, they would have been reported by now.

We should at least decide if we intend to put this somewhere on our future roadmap and actually spend some dedicated research time on this eventually. If not, we should be honest here and close this.

cameel avatar Feb 24 '23 14:02 cameel

This issue has been marked as stale due to inactivity for the last 90 days. It will be automatically closed in 7 days.

github-actions[bot] avatar May 26 '23 12:05 github-actions[bot]

Hi everyone! This issue has been automatically closed due to inactivity. If you think this issue is still relevant in the latest Solidity version and you have something to contribute, feel free to reopen. However, unless the issue is a concrete proposal that can be implemented, we recommend starting a language discussion on the forum instead.

github-actions[bot] avatar Jun 03 '23 12:06 github-actions[bot]