Skip to content

added factory dependencies for Resolc Compiler #39

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

Merged
merged 2 commits into from
Jul 22, 2025

Conversation

soul022
Copy link

@soul022 soul022 commented Jul 11, 2025

Added an optional factory_dependencies field (a BTreeMap<String, String>) to Contract and ConfigurableContractArtifact in the resolc, solc, and vyper crates, with serde defaults to avoid breaking existing artifacts.

Propagated this new field through all From<…> conversions so parsed contracts now carry factory‐dependency metadata.

Updated the ArtifactOutput logic in the compilers crate to include factory_dependencies in emitted artifacts.

@soul022 soul022 marked this pull request as ready for review July 13, 2025 18:12
@@ -83,6 +83,7 @@ impl From<ResolcContract> for foundry_compilers_artifacts_solc::Contract {
ewasm: None,
ir_optimized: contract.ir_optimized,
ir_optimized_ast: None,
factory_dependencies: contract.factory_dependencies,
Copy link

Choose a reason for hiding this comment

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

maybe extensions ?
namely:

enum Extensions {
  None, 
  Resolc(ResolcExtras)
}

and corresponding methods like
contract.resolc_extras : () -> Option<ResolcExtras>
simillar to what is already was implemented for Bytecode in this repo

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link

Choose a reason for hiding this comment

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

why extensions went to resolcContract when the solc contract is the one to be extended?

It doesnt make any sense semantically, we need to extend the solc contract, resolc contract is already a superset of solc contract (for a subset of values, e.g. factory_dependencies and others).

Copy link
Author

Choose a reason for hiding this comment

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

moved to solc

@@ -59,6 +59,9 @@ pub struct ConfigurableContractArtifact {
/// The identifier of the source file
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<u32>,
/// Factory dependencies for the contract.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub factory_dependencies: Option<BTreeMap<String, String>>,
Copy link

Choose a reason for hiding this comment

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

why Option is needed?
BtreeMap::empty should pretty much be equivalent to Option::None

Copy link
Author

Choose a reason for hiding this comment

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

removed

@soul022 soul022 force-pushed the soul22/factoryDependencies branch from a37ad61 to d00695b Compare July 17, 2025 17:58
@soul022 soul022 merged commit 55ea5e0 into main Jul 22, 2025
16 checks passed
@soul022 soul022 deleted the soul22/factoryDependencies branch July 22, 2025 02:39
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.

2 participants