-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(store): enforce unique table names across types (#2736)
Co-authored-by: Kevin Ingersoll <[email protected]>
- Loading branch information
Showing
15 changed files
with
238 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/store": patch | ||
--- | ||
|
||
Added a check to `registerTable` that prevents registering both an offchain and onchain table with the same name, making it easier to use human-readable names in indexers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[ | ||
"error EncodedLengths_InvalidLength(uint256 length)", | ||
"error FieldLayout_Empty()", | ||
"error FieldLayout_InvalidStaticDataLength(uint256 staticDataLength, uint256 computedStaticDataLength)", | ||
"error FieldLayout_StaticLengthDoesNotFitInAWord(uint256 index)", | ||
"error FieldLayout_StaticLengthIsNotZero(uint256 index)", | ||
"error FieldLayout_StaticLengthIsZero(uint256 index)", | ||
"error FieldLayout_TooManyDynamicFields(uint256 numFields, uint256 maxFields)", | ||
"error FieldLayout_TooManyFields(uint256 numFields, uint256 maxFields)", | ||
"error Schema_InvalidLength(uint256 length)", | ||
"error Schema_StaticTypeAfterDynamicType()", | ||
"error Slice_OutOfBounds(bytes data, uint256 start, uint256 end)", | ||
"error Store_IndexOutOfBounds(uint256 length, uint256 accessedIndex)", | ||
"error Store_InvalidBounds(uint256 start, uint256 end)", | ||
"error Store_InvalidFieldNamesLength(uint256 expected, uint256 received)", | ||
"error Store_InvalidKeyNamesLength(uint256 expected, uint256 received)", | ||
"error Store_InvalidResourceType(bytes2 expected, bytes32 resourceId, string resourceIdString)", | ||
"error Store_InvalidSplice(uint40 startWithinField, uint40 deleteCount, uint40 fieldLength)", | ||
"error Store_InvalidStaticDataLength(uint256 expected, uint256 received)", | ||
"error Store_InvalidValueSchemaDynamicLength(uint256 expected, uint256 received)", | ||
"error Store_InvalidValueSchemaLength(uint256 expected, uint256 received)", | ||
"error Store_InvalidValueSchemaStaticLength(uint256 expected, uint256 received)", | ||
"error Store_TableAlreadyExists(bytes32 tableId, string tableIdString)", | ||
"error Store_TableNotFound(bytes32 tableId, string tableIdString)", | ||
"event HelloStore(bytes32 indexed storeVersion)", | ||
"event Store_DeleteRecord(bytes32 indexed tableId, bytes32[] keyTuple)", | ||
"event Store_SetRecord(bytes32 indexed tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData)", | ||
"event Store_SpliceDynamicData(bytes32 indexed tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, uint48 start, uint40 deleteCount, bytes32 encodedLengths, bytes data)", | ||
"event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, bytes data)", | ||
"function deleteRecord(bytes32 tableId, bytes32[] keyTuple)", | ||
"function getDynamicField(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex) view returns (bytes)", | ||
"function getDynamicFieldLength(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex) view returns (uint256)", | ||
"function getDynamicFieldSlice(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, uint256 start, uint256 end) view returns (bytes data)", | ||
"function getField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes32 fieldLayout) view returns (bytes data)", | ||
"function getField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex) view returns (bytes data)", | ||
"function getFieldLayout(bytes32 tableId) view returns (bytes32 fieldLayout)", | ||
"function getFieldLength(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes32 fieldLayout) view returns (uint256)", | ||
"function getFieldLength(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex) view returns (uint256)", | ||
"function getKeySchema(bytes32 tableId) view returns (bytes32 keySchema)", | ||
"function getRecord(bytes32 tableId, bytes32[] keyTuple, bytes32 fieldLayout) view returns (bytes staticData, bytes32 encodedLengths, bytes dynamicData)", | ||
"function getRecord(bytes32 tableId, bytes32[] keyTuple) view returns (bytes staticData, bytes32 encodedLengths, bytes dynamicData)", | ||
"function getStaticField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes32 fieldLayout) view returns (bytes32)", | ||
"function getValueSchema(bytes32 tableId) view returns (bytes32 valueSchema)", | ||
"function popFromDynamicField(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, uint256 byteLengthToPop)", | ||
"function pushToDynamicField(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, bytes dataToPush)", | ||
"function registerStoreHook(bytes32 tableId, address hookAddress, uint8 enabledHooksBitmap)", | ||
"function registerTable(bytes32 tableId, bytes32 fieldLayout, bytes32 keySchema, bytes32 valueSchema, string[] keyNames, string[] fieldNames)", | ||
"function setDynamicField(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, bytes data)", | ||
"function setField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes data, bytes32 fieldLayout)", | ||
"function setField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes data)", | ||
"function setRecord(bytes32 tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData)", | ||
"function setStaticField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes data, bytes32 fieldLayout)", | ||
"function spliceDynamicData(bytes32 tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, uint40 startWithinField, uint40 deleteCount, bytes data)", | ||
"function spliceStaticData(bytes32 tableId, bytes32[] keyTuple, uint48 start, bytes data)", | ||
"function storeVersion() view returns (bytes32 version)", | ||
"function unregisterStoreHook(bytes32 tableId, address hookAddress)", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
// History of protocol versions and a short description of what changed in each. | ||
export const protocolVersions = { | ||
"2.0.2": | ||
"Patched `StoreCore.registerTable` to prevent registering both an offchain and onchain table with the same name.", | ||
"2.0.1": "Patched `StoreRead.getDynamicFieldLength` to use the correct method to read the dynamic field length.", | ||
"2.0.0": "Initial v2 release. See mud.dev/changelog for the full list of changes from v1.", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.