Skip to content

ens_encode_name -> dns_encode_name #3700

Closed
@fselmo

Description

@fselmo

What feature should we add?

We are properly encoding a name for ENS but really it's just a few simple rules on top of DNS encoding. It is referred to as just DNS Encoding the name in the ENS docs. I think for consistency we should create a dns_encode method that returns ens_encode under the hood, then deprecate ens_encode and remove in v8. I think we should wrap the return value for the new method in HexBytes so that to_0x_hex() is accessible as an option on the return value. This is mainly to keep consistency across languages for web3 tooling, as well as consistency in naming with the ENS docs.

  1. Rename ens_encode utility method as dns_encode
  2. Wrap the return value in HexBytes so it can be more easily represented as a 0x-prefixed hex
  3. Create ens_encode (to keep backward compatibility in v7) and return bytes(dns_encode(name))
  4. Deprecate ens_encode to be removed in v8 with a message to use dns_encode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions