Repository navigation
fix(scripts): normalize contract name in formatError and add test coverage (Fixes #856, #855) - #886
Closed
kleitonbernardino-lab wants to merge 1 commit into
Conversation
…erage (Fixes MergeFi#856, MergeFi#855) Signed-off-by: Kleiton Bernardino <kleiton.bernardino@gmail.com>
|
@kleitonbernardino-lab is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes #856, Fixes #855
Summary
Normalize contract names in
formatErrorto match canonical keys inerrorMappings, reject unrecognized contract names with a descriptive error, and add dedicated unit test coverage forerror-codes.mjs.Root Cause
formatErrorfilters decoded meanings by matching againstcontractName + ":". Whileescrowandmilestonesmatch their keys directly, the maintenance pool contract is keyed in camelCase asmaintenancePool. Invoking withCONTRACT_NAME=maintenance-pool(the naming used across directory names, packages, and Make targets) filtered all entries out, causingformatErrorto printNo known mapping for error code Neven when a valid error mapping existed (#856). Furthermore,error-codes.mjslacked a dedicated test file to verify error extraction and decoding branches (#855).Changes
normalizeContractName(name)inscripts/error-codes.mjs:maintenance-pool,maintenance_pool, andmaintenancePooltomaintenancePool.escrowandmilestones.formatErrorto usenormalizeContractName(contractName)when filtering decoded error entries.scripts/error-codes.test.mjswith comprehensive test coverage:formatErrorwith various contract name formats.Verification
Ran test suite:
Result: 17 passed, 0 failed, 4 suites (100% pass).