Skip to content

Commit 6ac1025

Browse files
authored
docs(network-subgraphs): Update comment about getPermissionId() (#1021)
Updated the comment. It mentioned slicing which we removed in #993.
1 parent 4097d3d commit 6ac1025

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/network-subgraphs/src/streamRegistry.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ import { StreamCreated, StreamDeleted, StreamUpdated, PermissionUpdated, Permiss
55
import { Stream, StreamPermission } from '../generated/schema'
66
import { MAX_STREAM_ID_LENGTH } from './helpers'
77

8-
/**
9-
* Hash the streamId and the userId, in order to get constant-length permission IDs (ETH-867)
10-
* This avoids indexing problems if the userId or streamId is very long (many kilobytes).
11-
*
12-
* TODO: after ETH-876 is solved, streamId can't be over-long, remove the slice(0, 1000) below
13-
* because it could cause some streams with same 1k-prefix to mix up when sorting
14-
**/
158
function getPermissionId(streamId: string, userId: Bytes): string {
9+
// Uses the hash of userId instead of the full ID, since userId can be very long (potentially several kilobytes).
10+
// It's unclear whether there is a strict character limit for ID fields, but in practice, multi-kilobyte IDs can
11+
// cause indexing issues (see ETH-867).
1612
return streamId + "-" + crypto.keccak256(userId).toHexString()
1713
}
1814

0 commit comments

Comments
 (0)