-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(store): separate SchemaLib into specialized libraries #1216
Conversation
|
SchemaType[] memory _valueSchema = new SchemaType[](2); | ||
_valueSchema[0] = SchemaType.BYTES32; | ||
_valueSchema[1] = SchemaType.BYTES32; | ||
SchemaType[] memory _keySchema = new SchemaType[](1); | ||
_keySchema[0] = SchemaType.BYTES32; | ||
registerSchema( | ||
StoreCoreInternal.SCHEMA_TABLE, | ||
SchemaLib.encode(SchemaType.BYTES32, SchemaType.BYTES32), // The Schema table's valueSchema is { valueSchema: BYTES32, keySchema: BYTES32 } | ||
SchemaLib.encode(SchemaType.BYTES32) // The Schema table's keySchema is { tableId: BYTES32 } | ||
SchemaLib.encode(_valueSchema), // The Schema table's valueSchema is { valueSchema: BYTES32, keySchema: BYTES32 } | ||
SchemaLib.encode(_keySchema) // The Schema table's keySchema is { tableId: BYTES32 } | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after #1174 this will be replaced with a table's schema method, which will remove the hardcode and the slight gas increase
/** | ||
* Overrides for encode function to simplify tests | ||
*/ | ||
library SchemaEncodeHelper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these hardcoded methods should only be used in tests; in systems/modules you'd use a table's autogenerated schema.
so to avoid confusion it seems better to explicitly put them in a test
dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.