feat(ci): add check to ensure artifacts are in sync with contract sources #3991
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
On my other PR #3937 , I was having difficulty generating the solidity JSONs, and when I did generate them, the format was not correct. I realized that part of the problem is that the CI should be natively checking for this, but it currently does not, so I added a job.
Additionally, my computer is ARM64, but the ethereum solidity image is only compatible with
x86_64, so I had to add a flag to fix this.Finally, the format followed by the other files in the artifacts JSON directory uses a pretty-printed JSON format, but the existing Makefile uses compact format with
jq -c. So I removed the-cflag to ensure this consistent format.It turns out taht, likely due to a newer solidity version, many of the artifacts have changed slightly since they were originally built. So that is included as part of this PR.
One other issue that can occur is if the artifact file already exists on your computer, it may fail to write the new version since
makeonly builds files that don't exist (or something like that). To resolve this, the-Boption is used to force rebuilding of all targets.Changes
cd crates/contracts/solidity && make -B artifactsHow to test
Check the new CI job
solidity-artifactsRun
make -B artifactsfromcrates/contracts/solidityto see how it behaves on your own machine.