It is possible situation when two different devices in the chain have the same id. Which is wrong.
Steps to reproduce with brave-core:
-
Prepare 3 clear profiles: deviceA, deviceB, deviceC
-
on deviceB and deviceC open brave://sync and click I have sync code , but don't enter any code for now
-
on deviceA enable sync chain and copy sync code
-
paste sync code on both deviceB and deviceC, but don't press Confirm sync code button
-
arrange deviceB and deviceC windows to see both Confirm sync code buttons
-
press Confirm sync code buttons as fast as possible on both deviceB and deviceC
-
Actual result:
deviceB and deviceC have two entries marked as This device , this means devices have the same deviceId equal to current device id.

-
Expected result:
deviceB and deviceC are properly marked as This device just one in the list.
This is an issue for sync library, if two devices almost in the same time are doing connect to the sync chain, they can get response with the same id:
https://github.com/brave/sync/blob/staging/client/sync.js#L71
Log from deviceC:
10:55:53.940 background.js:173 "sync-debug" message="set device ID: 1"
10:55:55.354 background.js:53 "send-sync-records" category_name="PREFERENCES" records=[{
"action":0,"device":{"name":"HAPPYUBU7"},"deviceId":{"0":1},"objectData":"device","objectId":{"0":9,"1":168,"2":24,"3":131,"4":6,"5":138,"6":248,"7":102,"8":3,"9":9,"10":66,"11":149,"12":58,"13":109,"14":96,"15":245},"syncTimestamp":0}]
10:55:55.603 background.js:193 "get-existing-objects" category_name="PREFERENCES" records=[{
"action":0,
"deviceId":{"0":0},"objectId":{"0":62,"1":163,"2":126,"3":198,"4":163,"5":95,"6":135,"7":192,"8":8,"9":146,"10":127,"11":154,"12":124,"13":208,"14":254,"15":240},
"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497331561}] lastRecordTimeStamp=1567497331561 isTruncated=false
10:55:56.487 background.js:173 "sync-debug" message="got 3 decrypted records in PREFERENCES after 0"
10:55:56.487 background.js:193 "get-existing-objects" category_name="PREFERENCES" records=
[{
"action":0,
"deviceId":{"0":0},
"objectId":{"0":62,"1":163,"2":126,"3":198,"4":163,"5":95,"6":135,"7":192,"8":8,"9":146,"10":127,"11":154,"12":124,"13":208,"14":254,"15":240},"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497331561},{
"action":0,
"deviceId":{"0":1},
"objectId":{"0":9,"1":168,"2":24,"3":131,"4":6,"5":138,"6":248,"7":102,"8":3,"9":9,"10":66,"11":149,"12":58,"13":109,"14":96,"15":245},"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497355357},{
"action":0,
"deviceId":{"0":1},
"objectId":{"0":113,"1":69,"2":195,"3":57,"4":131,"5":245,"6":21,"7":70,"8":77,"9":54,"10":221,"11":227,"12":88,"13":227,"14":68,"15":255},"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497355748
}] lastRecordTimeStamp=1567497355748 isTruncated=false
Log from deviceB:
10:55:54.568 background.js:178 "sync-debug" message="set device ID: 1"
10:55:55.746 background.js:58 "send-sync-records" category_name="PREFERENCES" records=[
{"action":0,
"device":{"name":"HAPPYUBU7"},
"deviceId":{"0":1},"objectData":"device",
"objectId":{"0":113,"1":69,"2":195,"3":57,"4":131,"5":245,"6":21,"7":70,"8":77,"9":54,"10":221,"11":227,"12":88,"13":227,"14":68,"15":255},"syncTimestamp":0}]
10:55:56.254 background.js:204 "resolved-sync-records" categoryName="PREFERENCES" records=[{
"action":0,
"deviceId":{"0":0},"objectId":{"0":62,"1":163,"2":126,"3":198,"4":163,"5":95,"6":135,"7":192,"8":8,"9":146,"10":127,"11":154,"12":124,"13":208,"14":254,"15":240},"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497331561},{
"action":0,
"deviceId":{"0":1},"objectId":{"0":9,"1":168,"2":24,"3":131,"4":6,"5":138,"6":248,"7":102,"8":3,"9":9,"10":66,"11":149,"12":58,"13":109,"14":96,"15":245},"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497355357},{
"action":0,
"deviceId":{"0":1},"objectId":{"0":113,"1":69,"2":195,"3":57,"4":131,"5":245,"6":21,"7":70,"8":77,"9":54,"10":221,"11":227,"12":88,"13":227,"14":68,"15":255},"device":{"name":"HAPPYUBU7"},"objectData":"device","syncTimestamp":1567497355748}]
So there are two devices with different object_id, but with the same deviceID.
It is possible situation when two different devices in the chain have the same id. Which is wrong.
Steps to reproduce with brave-core:
Prepare 3 clear profiles: deviceA, deviceB, deviceC
on deviceB and deviceC open brave://sync and click
I have sync code, but don't enter any code for nowon deviceA enable sync chain and copy sync code
paste sync code on both deviceB and deviceC, but don't press
Confirm sync codebuttonarrange deviceB and deviceC windows to see both
Confirm sync codebuttonspress
Confirm sync codebuttons as fast as possible on both deviceB and deviceCActual result:

deviceB and deviceC have two entries marked as
This device, this means devices have the same deviceId equal to current device id.Expected result:
deviceB and deviceC are properly marked as
This devicejust one in the list.This is an issue for sync library, if two devices almost in the same time are doing connect to the sync chain, they can get response with the same id:
https://github.com/brave/sync/blob/staging/client/sync.js#L71
Log from deviceC:
Log from deviceB:
So there are two devices with different object_id, but with the same deviceID.