onflow / atree

Atree provides scalable arrays and scalable ordered maps.
https://onflow.org
Apache License 2.0
39 stars 16 forks source link

Add `Array.ID()` and `OrderedMap.ID()` #320

Closed fxamacker closed 1 year ago

fxamacker commented 1 year ago

Issue To Be Solved

Currently Array.StorageID() and OrderedMap.StorageID() are used as identifier in client because storage IDs are guaranteed to unique. However, storage ID should be only used to retrieve slabs (registers) from storage.

Also, when Atree register inlining is implemented in the future, some resources may not be stored in separate slabs, so they will not have storage IDs anymore.

Suggested Solution

Add ID() to uniquly identify Array and OrderedMap. For now, implement ID to be identical to StorageID in raw bytes ([16]bytes). In the future, this can be changed to be decoupled from storage ID completely.

Once ID() is available, clients should use it instead of StorageID() to identify Atree composite values.