-
Notifications
You must be signed in to change notification settings - Fork 19
Integrate compact dev tools #218
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
Integrate compact dev tools #218
Conversation
…e testable, more maintainable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure the corresponding doc file in the OpenZeppelin docs repo is updated.
Co-authored-by: ⟣ €₥ℵ∪ℓ ⟢ <34749913+emnul@users.noreply.github.com> Signed-off-by: Andrew Fleming <fleming.andrew@protonmail.com>
| * @class CompactCliNotFoundError | ||
| * @extends Error | ||
| */ | ||
| export class CompactCliNotFoundError extends Error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to add a VersionNotFound error type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, it's getting caught like this:
✖ [COMPILE] Environment validation failed: Command failed: compact compile +0.25.0 --version
Error: Failed to run compactc
Caused by:
0: Couldn't find compiler for aarch64-darwin (0.25.0)
1: Directory does not exist: `"Users/totallyNotAFed/.compact/versions/0.25.0/aarch64-darwin"'
Troubleshooting:
• Check that Compact CLI is installed and in PATH
• Verify the specified Compact version exists
• Ensure you have proper permissions
I think that's enough for users (just us), no?
Co-authored-by: ⟣ €₥ℵ∪ℓ ⟢ <34749913+emnul@users.noreply.github.com> Signed-off-by: Andrew Fleming <fleming.andrew@protonmail.com>
| }); | ||
| }); | ||
|
|
||
| describe('validateEnvironment', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a test that validates an Error is thrown when an invalid Compact version is passed
Co-authored-by: ⟣ €₥ℵ∪ℓ ⟢ <34749913+emnul@users.noreply.github.com> Signed-off-by: Andrew Fleming <fleming.andrew@protonmail.com>
| describe('displayEnvInfo', () => { | ||
| it('should display all environment information', () => { | ||
| UIService.displayEnvInfo( | ||
| 'compact 0.1.0', | ||
| 'Compactc 0.24.0', | ||
| 'security', | ||
| '0.24.0', | ||
| ); | ||
|
|
||
| // Test passes if no errors are thrown | ||
| expect(true).toBe(true); | ||
| }); | ||
| }); | ||
|
|
||
| describe('showCompilationStart', () => { | ||
| it('should show file count without target directory', () => { | ||
| UIService.showCompilationStart(5); | ||
|
|
||
| expect(true).toBe(true); | ||
| }); | ||
|
|
||
| it('should show file count with target directory', () => { | ||
| UIService.showCompilationStart(3, 'security'); | ||
|
|
||
| expect(true).toBe(true); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we refactor these to match the not.toThrow pattern below?
|
Amazing work as always! Thank you for your contributions sir 🫡 |
|
@emnul Small refactor. I moved all the error handling to This also made testing easier, more organized, and improved. No more |
emnul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets even better 😲
Types of changes
What types of changes does your code introduce to OpenZeppelin Midnight Contracts?
Put an
xin the boxes that applyFixes #200.
PR Checklist
Overview
This PR proposes to:
This PR includes a breaking change: To develop on the repo, devs must install the Compact develop tool. The CI also installs the Compact CLI like this which simplifies installation
Due to the additional features of the dev tool, this PR proposes to refactor this repo's
compactpackage. While writing tests for the current CLI, its fragility became evident and this refactor is long overdue. The proposed refactor aims to make the package much more maintainable by separating concerns. This PR also includes tests which is also long overdue