Enhance artifact generation and validation in generate-artifact.sh #175
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.
Description
This pull request introduces several improvements to the artifact generation and deployment scripts, focusing on better error handling, output clarity, and minor usability enhancements. The most significant changes are the addition of JSON field sanitization to prevent invalid artifacts, improved logging, and the removal of unnecessary tracing pauses in Solidity libraries.
Artifact generation robustness and output improvements:
sanitize_json_fieldandsanitize_string_fieldhelper functions ingenerate-artifact.shto ensure that generated JSON fields are valid and to default tonullor empty strings when fields are missing or invalid, preventing malformed artifacts.source_namevariable ingenerate-artifact.shfor easier debugging and traceability.Script usability enhancements:
--color alwaysflag to theforge scriptcommand inrun.shto ensure colored output, improving readability.forge build) fromrun.sh, assuming contracts are already compiled or compilation is handled elsewhere.Solidity library simplification:
vm.pauseTracing()andvm.resumeTracing()calls fromLibArtifact.solandLibDeploy.sol, simplifying the code and avoiding potential side effects from tracing state changes. [1] [2] [3]Checklist