Skip to content

Commit

Permalink
(BIDS-2452) limit ens name size to 2KB
Browse files Browse the repository at this point in the history
  • Loading branch information
remoterami committed Sep 6, 2023
1 parent d7d21fd commit a16cd40
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions db/ens.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ func (bigtable *Bigtable) TransformEnsNameRegistered(blk *types.Eth1Block, cache
return bulkData, bulkMetadataUpdates, nil
}

// Ens names are only supported to a length of 40
// Source: https://github.com/wealdtech/go-ens/blob/5b323a4ef0472f06c515723b060b166843b9db08/resolver.go#L190
func verifyName(name string) error {
if (strings.HasPrefix(name, "0x") && len(name) > 42) || (!strings.HasPrefix(name, "0x") && len(name) > 40) {
// limited by max capacity of db (caused by btrees of indexes); tests showed maximum of 2684 (added buffer)
if len(name) > 2048 {
return fmt.Errorf("name too long")
}
return nil
Expand Down

0 comments on commit a16cd40

Please sign in to comment.