solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Support namehash at compile-time

Open chriseth opened this issue 4 years ago • 4 comments
trafficstars

In order to at least somewhat support ENS (we cannot fully support it because that creates issues with source verification), we could have compile-time evaluation of the namehash function on string literals.

bytse32 node = namehash("abc.def.eth");

Some pointers:

  • https://twitter.com/nicksdjohnson/status/1397012527511334913
  • https://github.com/danfinlay/eth-ens-namehash/blob/master/index.js
  • https://github.com/ethers-io/ethers.js/blob/master/packages/strings/src.ts/idna.ts

chriseth avatar May 25 '21 11:05 chriseth

Duplicate of #6956 ?

axic avatar May 25 '21 11:05 axic

Maybe duplicate, but could also be sub-issue.

chriseth avatar May 25 '21 14:05 chriseth

Suggestion: implement UTF normalization as a compiler builtin and implement namehash in the standard library.

Pro: This would allow us to gain experience with the standard library. Con: Unless we actually have compile-time evaluation of pure functions, this would still generate some runtime code (which hopefully would be optimised, i.e. the recent keccak256 optimiser steps).

axic avatar Jun 02 '21 12:06 axic

The alternative to this is #1650 and have namehash supplied via JSON.

axic avatar Jun 02 '21 12:06 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 Mar 20 '23 12:03 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 Mar 28 '23 12:03 github-actions[bot]