Trust-Machines / BNS-V2

MIT License
17 stars 5 forks source link

name-claim-fast doesn’t appear to respect preorders #65

Closed larrysalibra closed 3 months ago

larrysalibra commented 3 months ago

It looks like that if user A preorders a name using name-preorder, the preorder confirms and then in the next block, user B uses name-claim-fast to register the same name, that user B will get the name.

I would expect that name-claim-fast will only succeed if there are no valid preorders within the PREORDER-CLAIMABILITY-TTL time to live window.

Please correct me if I'm wrong on this!

Patotking12 commented 3 months ago

The issue here is that when name-claim-fast is executed there is no way of knowing if a preorder was ever made for that name.

But if you look closely into the name-register function this "problem" is resolved giving the name to the correct owner, in this case the user that preordered the name first

larrysalibra commented 3 months ago

Ahh that makes sense.

I see where that happens in the handle-existing-name function.

Is it right to say that someone can’t be sure that they’ve actually successfully registered a name until the preorder TTL period of time has passed? It could be reassigned to someone who preordered earlier?

Patotking12 commented 3 months ago

Exactly. Scenarios:

  1. Alice preorders a name - A block later Bob preorders a name - Bob registers the name and gets the name - Alice before the TTL has passed on her preorder, registers the name, the name gets transferred from Bob to Alice (the rightful owner)
  2. Alice preorders a name - A block later Bob fast-claims a name - Alice before the TTL has passed on her preorder, registers the name, the name gets transferred from Bob to Alice (the rightful owner)
Patotking12 commented 3 months ago

Closing this issue since everything has been clarified