Add Native Asset Support and Enhance Unit Testing#11
Merged
Crypto2099 merged 5 commits intomainfrom Jan 7, 2025
Merged
Conversation
Signed-off-by: Adam Dean <adam@crypto2099.io>
- Adds the Test Vectors specified in CIP-0014 for Native Assets - Adds helper functions for encoding and hashing Native Assets per CIP-0014 Signed-off-by: Adam Dean <adam@crypto2099.io>
- Add some constants to the top of the file to allow for easier re-use and future flexibility. - Add a couple of checks to the encode function to validate HRP. - Change a couple of hard-coded values to use new constants. - Slightly change the language of some exceptions - Remove some unused comments and variables Signed-off-by: Adam Dean <adam@crypto2099.io>
- Add test vectors to bring new functions to 100% code coverage - Add good and bad test vectors to test both expected behavior and unexpected data entry - Add sanity checking and exception responses if data is malformed. Signed-off-by: Adam Dean <adam@crypto2099.io>
- More unit tests specifically to complete code coverage around new checks placed on generic encode/decode functionality to bring alignment with original Bech32 specification in BIP-0173 Signed-off-by: Adam Dean <adam@crypto2099.io>
latheesan-k
reviewed
Jan 7, 2025
| use PHPUnit\Framework\TestCase; | ||
|
|
||
| #[CoversClass(Bech32::class)] | ||
| class Bech32AssetTest extends TestCase |
There was a problem hiding this comment.
Minor recommendations:
- Expand test coverage with unhappy path also
- Add test that provide invalid input and edge cases (min/max input, zero lonth and other boundary conditions)
- Use php unit's
assertExceptionhelper to check expected exceptions are thrown for invalid inputs / edge cases
There was a problem hiding this comment.
Ignore above recommendations, appears to be covered in the next test.
This file contains hidden or 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
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.
Add support and helper functions and unit tests for encoding and decoding Cardano Native Assets into an "Asset Fingerprint" which is a more human-friendly identifier defined in CIP-0014.
decodedoes not validate HRP conformance to Bech32 character constraints #2