Fix GXS Identity propagation and local cache invalidation#253
Fix GXS Identity propagation and local cache invalidation#253jolavillette wants to merge 2 commits intoRetroShare:masterfrom
Conversation
src/services/p3idservice.cc
Outdated
| group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC; | ||
|
|
||
| // Fixed: Explicitly update timestamp to ensure network propagation | ||
| group.mMeta.mPublishTs = time(NULL); |
There was a problem hiding this comment.
This is useless: publishGrps() will update this when signing the new group data.
There was a problem hiding this comment.
tests show that when we remove set group.mMeta.mPublishTs = time(NULL); the modified avatar stops propagating to the gxsid list in People and to the participants list in Chats
here is the reason why (Antigravity)
"While it is true that RsGenExchange::publishGrps updates the timestamp in the metadata, it does so AFTER the group data has already been serialized into the binary payload (grp->grp.setBinData).
If we rely solely on publishGrps, the serialized payload will contain the old timestamp, while the outer metadata has the new one. This mismatch causes peers to treat the data as stale or invalid, preventing the update (e.g., new avatar) from propagating correctly.
Therefore, explicitly updating mPublishTs in p3idservice.cc before the serialization starts is mandatory to ensure the payload carries the correct timestamp"
There was a problem hiding this comment.
It seems that after rsgenexchange.cc:2798 (in the original code just after service_createGroup() ) you can update the publish TS (which will happen before serialization):
grpItem->meta.mPublishTs = time(NULL);
This change will be inherited by all GXS services, not just p3identity. Some other service do not update the publish ts in their update() methods (e.g. channels doesn't do it in editChannel()).
There was a problem hiding this comment.
Fix GXS Identity propagation and local cache invalidation
- Move mPublishTs update to RsGenExchange::publishGrps to ensure the signed payload timestamp matches the metadata.
- Remove aggressive mKeyCache.erase() in p3IdService::updateGroup to prevent unnecessary cache invalidation.
- Remove redundant mPublishTs assignment in p3IdService.
36a0c61 to
3621318
Compare
3621318 to
2891221
Compare
Code and comment by Antigravity
Fix GXS Identity propagation and local cache invalidation
This PR addresses two critical issues preventing peer avatar updates (GXS Identities) from propagating to the network and updating locally.
p3IdService::updateIdentitymodified identity data (e.g., avatar) but failed to update themPublishTs(timestamp). Peers rejected these updates as duplicates.group.mMeta.mPublishTs = time(NULL);when updating an identity to ensure a new version number is broadcast.mKeyCachewas not invalidated on update. Local service calls continued to return stale data even after the database was updated.p3IdService::notifyChanges(), we now invalidate the cache entry (mKeyCache.erase()) upon receivingTYPE_UPDATEDorTYPE_PUBLISHEDevents.updateIdentityto prevent remove the Private Key before the signing process completes.