-
Notifications
You must be signed in to change notification settings - Fork 434
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
Verification flow refactoring #1845
Draft
marcocastignoli
wants to merge
9
commits into
staging
Choose a base branch
from
verification-flow-refactoring-main
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
* Init class * Init SolidityMetadataContracts, split zipUtils and processFiles * SolidityMetadataContract: create dummy Compilation, add fetchMissing methods * Add tests for zipUtils, Fix directories being in `files` array * Add fetchUtils tests * Run tests both under test/*.spec.ts and in subfolders test/**/*.spec.ts * Remove `outputSelection` to be handled by the Compilation class * Fetch missing before creating the Compilation * Rename everything `check..` to `create...` in validation ie. SolidityMetadataContract * Try first assembling the contract without variations, only try after if it doesn't work * Rename metadata2Provided to metadataPathToProvidedFilePath
* Add Compilation classes and types * Add tests * Refactor compilation classes to unify compile methods and remove deprecated properties - Renamed `recompile` methods to `compile` across `AbstractCompilation`, `SolidityCompilation`, and `VyperCompilation` classes for consistency. - Removed unused properties such as `metadataRaw`, `creationBytecode`, and `runtimeBytecode` from `AbstractCompilation`. - Updated related methods to utilize new `getCreationBytecode` and `getRuntimeBytecode` methods. - Cleaned up `CompilationTypes` by removing `RecompilationResult` interface. - Adjusted tests to reflect changes in method names and ensure functionality remains intact. * Refactor AbstractCompilation to improve error handling and logging * always add 0x to get...Bytecode( functions * fix PR suggestions * Update packages/lib-sourcify/src/Compilation/AbstractCompilation.ts Co-authored-by: Kaan Uzdoğan <kaanuzdogan@hotmail.com> * fix tests * enable all tests --------- Co-authored-by: Kaan Uzdoğan <kaanuzdogan@hotmail.com>
* push vyper tests (still need refactoring) * Implement solidity test to get 100% coverage * Refactor Vyper tests * refactor solidity tests * Update packages/lib-sourcify/src/Compilation/VyperCompilation.ts Co-authored-by: Manuel Wedler <34456797+manuelwedler@users.noreply.github.com> * Update packages/lib-sourcify/test/Compilation/VyperCompilation.spec.ts Co-authored-by: Manuel Wedler <34456797+manuelwedler@users.noreply.github.com> * fix duplicate check --------- Co-authored-by: Manuel Wedler <34456797+manuelwedler@users.noreply.github.com>
* Add tests for SolidityMetadataContract * use real SolidityCompilation class in SolidityMetadataContract * fixes from PR review
* implement Verifcation.ts * Refactor Verification.ts * Add tests * Add more tests * Add comment to tests * Add Vyper tests in Verification * refactor Verification class * handle ContructorTransformation * add comment * Refactor runtime bytecode matching and add call protection transformation * Refactor Verification class to use getter methods and improve encapsulation * Refactor AbstractCompilation to use protected properties and getter methods * Move check transformation functions into Verification class Refactor project structure and import paths in lib-sourcify * restore old `verification.ts` tests * fix constructor arguments trasformantion tests * restore old `types.ts` * add VerificationError class * Implement Vyper constructor argument transformation test * Pass forceEmscripten option to compilation call * Split library map into runtime and creation maps * replace expectMatch with expectVerification * fix "should verify a contract with viaIR:true, optimizer disabled, and compiler <0.8.21" test * Add test for library verification with call protection transformation * fix call protection test * increase coverage * add missing tests from verification.spec.ts increasing coverage * Refactor bytecode transformations and verification logic - Extracted transformation functions from the Verification class to a separate module - Added a new SolidityBugType enum to handle specific compilation scenarios - Improved error handling for RPC unavailability * fix linting * Refactor error handling and type definitions in Sourcify library * Update error handling for bytecode fetching in Sourcify verification * Remove unnecessary compilationTarget deletion in SolidityCompilation * Refactor bytecode matching method signature and remove unused context interface * Improve bytecode matching readability with descriptive variable names * Remove unused getter abiEncodedConstructorArguments in Verification class * Refactor Solidity settings type and improve bug handling in verification * Update SolidityBugType and improve error handling in verification tests * Renamed functions in Transformations.ts to use 'extract' prefix instead of 'checkAndCreate' * Simplify extra file input bug detection and remove redundant error handling * Refactor Solidity metadata and compiler settings types * fixes for PR comments * Validate the bytecode length for Solidity and Vyper compilations before proceeding with bytecode matching * do not use existing transformations/values in `matchBytecode`. * Fix extra-file-input-bug at bytecode mismatch error * fix `should return null match when there is no perfect match and no auxdata` * fix "maliciously verify with creation bytecode that startsWith the creatorTx input" test * fixes after PR review * Improve source file reading and verification error handling - Update source file reading to support nested directory structures - Clarify error message for bytecode matching with no auxdata - Improve test description for bytecode matching scenario --------- Co-authored-by: Manuel Wedler <manuel@wedler.dev>
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.
This is the main pull request for the verification flow refactoring. Smaller feature-specific pull requests will be merged into this branch before it is finalized and merged into the staging environment.
See #1665 for more details