Skip to content
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

feat: coverage for constructors #7661

Merged
merged 2 commits into from
Apr 16, 2024
Merged

feat: coverage for constructors #7661

merged 2 commits into from
Apr 16, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Apr 14, 2024

Motivation

Closes #3453
Closes #1963

Solution

This PR includes general refactor of code using ContractsByArtifacts extending it to contain both creation and runtime code. Currently it can only fit one bytecode type thus resulting in script code generating different ContractsByArtifacts object for different purposes making code a bit harder to navigate. This allowed to add more context to MultiContractRunner::known_contracts and simplify scripting code a bit by storing ContractsByArtifacts directly instead of generating each time.

Added creation code to ContractsByArtifacts allowed us to map collected hitmaps for creation codes to artifacts via find_by_creation_code fn, thus extending coverage to also process creation code just required duplicating anchors discovery and processing logic

@klkvr klkvr force-pushed the klkvr/constructor-coverage branch from 0da3b4a to 1efaae2 Compare April 14, 2024 21:53
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@@ -85,7 +84,7 @@ pub struct LinkedBuildData {
/// Original build data, might be used to relink this object with different libraries.
pub build_data: BuildData,
/// Known fully linked contracts.
pub highlevel_known_contracts: ArtifactContracts<ContractBytecodeSome>,
pub known_contracts: ContractsByArtifact,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so much better, ty

@klkvr klkvr merged commit 958a850 into master Apr 16, 2024
18 of 19 checks passed
@klkvr klkvr deleted the klkvr/constructor-coverage branch April 16, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no coverage data from constructor Coverage: Select anchors for constructors using creation source maps
2 participants