-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add separate methods for primitives #442
Merged
Merged
Conversation
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
- Add `BasicType` interface - Add `BasicTypeV0`, `BasicTypeV1` enums - Update `encodeValue` to use new enums to handle basic types
- Add `BasicType.V0` and `BasicType.V1` sealed interfaces to allow specifying supported revisions by the given basic types - Add kotlin reflection library to allow getting types based on revision - Convert all types to data objects - Use single data class for every type that is not revision-specific - Merge `encodeBasicValueV0` and `encodeBasicValueV1` to a single `encodeBasicValue`
- Add PresetType.V1` sealed interface to allow specifying supported revisions by the given preset type - Convert all types to data objects
…icType` and `PresetTypes` subclasses
- It's useless, inheriting `data object` will override it again anyway
…and their derivates - Update `feltFromPrimitive` to allow more parameters - Update `feltFromPrimitive`: add `allowBoolean`, `allowShortString` flags - Update `encodeValue()` to use new methods
- Add `BasicType.encodeToType` variable - `= name` by default - override for `Selector`, `MerkleTree`, `Enum` - Reduce re-use of `t.name` in `encodeValue()`
- Add `BasicType.encodeToType` variable - `= name` by default - override for `Selector`, `MerkleTree`, `Enum` - Reduce re-use of `t.name` in `encodeValue()`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat/snip-12-3-reserved-types #442 +/- ##
=================================================================
+ Coverage 70.90% 71.11% +0.21%
=================================================================
Files 75 75
Lines 3313 3327 +14
Branches 357 363 +6
=================================================================
+ Hits 2349 2366 +17
+ Misses 797 796 -1
+ Partials 167 165 -2 ☔ View full report in Codecov by Sentry. |
- Fix bounds for `i128` - Fix error messages - Use `BasicType` instead of raw strings
- Rename `selector type` test -> `encode selector` and add to group - Add `bool`, `u128`, `i128` tests - Test correct and incorrect cases - Add `unexpected values` test to better test `feltFromPrimitive()` - Fix one more error message in `feltFromPrimitive()`
This was referenced Mar 18, 2024
THenry14
approved these changes
Mar 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
This PR is part of the stack:
-- Update TypedData in line with SNIP-12 (#428)
-- Use sealed classes for basic and preset types (#440)
-- Add separate methods for primitives (#442)
-- Nest TypedData-related test cases (#434)
Add separate methods to process
bool
,u128
,i128
primitivesLinked issues
Closes
Breaking changes