Skip to content
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

Make .eth token ID change when fuses are burned #2

Merged
merged 11 commits into from
Aug 15, 2024
Merged

Conversation

Arachnid
Copy link
Member

In order to eliminate the risk of a frontrunning attack that burns fuses on a name just prior to transfer, this design changes the token ID when a fuse is burned - burning the old token and issuing a new one representing the name with the fuse burned.

Doing this breaks the assumption that token IDs are the keccak256 hashes of names, so we have to make a few changes:

  • The RegistryDatastore masks out the lower 32 bits of all IDs on storage and retrieval; two keys that differ only in these bits are treated as the same key.
  • Registries are now free to use these bits to store values that should form part of the identity of the name (eg, fuses/flags or a sequence ID).
  • The .eth registry stores the subregistryLocked and resolverLocked fuses in the lower 2 bits of the ID.
  • We change a bunch of functions, events and errors to take token IDs instead of unhashed labels: AccessDenied, InvalidSubregistryFlags, InvalidResolverFlags, renew, lock, setSubregistry.
  • For ETHRegistry.register, we separate out the flags and expiration date into separate fields.
  • Added the missing setResolver method.

@Arachnid Arachnid requested review from jefflau and TateB August 12, 2024 14:02
@Arachnid Arachnid merged commit e4858f3 into main Aug 15, 2024
1 check passed
@Arachnid Arachnid deleted the immutable-tokens branch August 15, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants