FIP: Address race conditions between username proof and username add #240
aditiharini
announced in
FIP Stage 3: Review
Replies: 1 comment 2 replies
-
Is there a reason why we don't just instruct clients to check that That's additional lines of code we will carry forever, and my conflict with something else we may want to implement in the future, or one more flow that can't be broken in the future. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Title: Address race conditions between username proof and username add
Type: Implementation FIP
Authors: @aditi, @sanjay
Abstract
Introducing a way to solve cases where a username update is rejected because the associated username proof has not been processed by Snapchain.
Problem
We often encounter cases where a
UserDataAdd
message withUserDataType.USERNAME
is submitted to Snapchain shortly after the associatedUserNameProof
message. In some of these cases, theUserDataAdd
message is rejected by Snapchain because theUserNameProof
has not been merged yet because it’s in the mempool waiting to get processed or it’s in a proposed block that hasn’t been confirmed.There are 2 problems to solve
UserDataAdd
message as a part of its validation because it will not be able to find theUserNameProof
until it’s merged.UserDataAdd
message if it’s in the same transaction as the associatedUserNameProof
message.Specification
Implement the SubmitBulkMessages endpoint
This endpoint was supported on hubs and this implementation is fully backwards compatible with the hubs implementation.
Clients who are registering an ENS name or a Basename should submit the
UserNameProof
then theUserDataAdd
in that order in a single call to theSubmitBulkMessages
endpoint. If a new verification is needed for theUserNameProof
that should also be submitted in the same call toSubmitBulkMessages
, before theUserNameProof
. This way, theSubmitBulkMessages
endpoint can validate each message with all the dependencies in context.If only some of the messages are valid, the valid messages will pass through and the invalid ones will be rejected. The
SubmitBulkMessagesResponse
contains an indication of which messages are accepted and which are rejected.Allow for a
UserDataAdd
message to be processed in the same transaction as aUserNameProof
it depends onThis requires a change in the Snapchain consensus logic to introspect the currently active and uncommitted RocksDB transaction for relevant data in addition to the already committed data. There’s no client facing impact.
Rationale
Does this solve for the case where the user is registering an fname?
No, the race condition will still exist for the fname case because fnames are not submitted to Snapchain by clients and are ingested directly from the fname server. There is some delay between a username being received by the fname server which the client cannot control. The long term solution to this problem is to have fnames be managed by Snapchain directly but this is not in scope right now. In the short term, we will have Snapchain poll the fname server more frequently so there’s less delay between when a fname is registered via the fname server and when Snapchain knows about it. Snapchain is already capable of processing a username in the same transaction as the associated fname.
Release
The consensus-level Snapchain changes will be under a protocol release. We will release Snapchain version x.y.z on or before yyyy-mm-dd with changes taking effect one week following the release. The new
SubmitBulkMessages
endpoint can be released independently in a patch release.Beta Was this translation helpful? Give feedback.
All reactions