6.2 Data Structure and Storage
The Public Registry uses two primary data structures for efficient storage and querying:
-
Scope & Record Hash based Categories Storage:
-
Implemented as:
mapping(uint256 scope => EnumerableMap.Bytes32ToBytes32Map RecordToCategory) scopeRecordCategories
- enables quick lookup of category bitmaps for a given record hash within a specific scope
uint256 scope
is the scope identifierEnumerableMap.Bytes32ToBytes32Map RecordToCategory
is a mapping of record hashes to category bitmapsEnumerableMap.Bytes32ToBytes32Map
is imported from the EnumerableMap openzeppelin libraryEnumerableMap.Bytes32ToBytes32Map
is utilised for easy iteration over the set of record hashes.
-
-
Scope based Record Merkle Trees:
-
Implemented as
mapping(uint256 scope => LeanIMTData recordTree) scopeRecordTrees
- Supports inclusion proof verification for a given record hash within a specific scope
uint256 scope
is the scope identifierLeanIMTData recordTree
is the merkle-tree representation of the set of record hashes within the scopeLeanIMTData
is imported from the InternalLeanIMT zk-kit libraryInternalLeanIMT, LeanIMTData
provides a gas-optimized merkle-tree implementation.
-