Skip to content

Commit 49b9afc

Browse files
authored
Update Compilers fork (#137)
* update compilers
1 parent cb11d37 commit 49b9afc

File tree

2 files changed

+45
-14
lines changed

2 files changed

+45
-14
lines changed

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/verify/src/etherscan/flatten.rs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,19 @@ impl EtherscanFlattenedSource {
8686
SolcLanguage::Solidity,
8787
version.clone(),
8888
);
89+
let compiler = SolcCompiler::Specific(solc);
8990

90-
let out = SolcCompiler::Specific(solc).compile(&input)?;
91+
let out = compiler.compile(&input)?;
92+
let compiler_version = compiler.compiler_version(&input);
93+
let compund_version = compound_version(compiler_version, &input.version);
9194
if out.errors.iter().any(|e| e.is_error()) {
9295
let mut o = AggregatedCompilerOutput::<SolcCompiler>::default();
93-
o.extend(version, RawBuildInfo::new(&input, &out, false)?, "default", out);
96+
o.extend(
97+
version,
98+
RawBuildInfo::new(&input, &out, &compund_version, false)?,
99+
"default",
100+
out,
101+
);
94102
let diags = o.diagnostics(&[], &[], Default::default());
95103

96104
eyre::bail!(
@@ -119,3 +127,26 @@ fn strip_build_meta(version: Version) -> Version {
119127
version
120128
}
121129
}
130+
131+
fn compound_version(mut compiler_version: Version, input_version: &Version) -> Version {
132+
if compiler_version != *input_version {
133+
let build = if compiler_version.build.is_empty() {
134+
semver::BuildMetadata::new(&format!(
135+
"{}.{}.{}",
136+
input_version.major, input_version.minor, input_version.patch,
137+
))
138+
.expect("can't fail due to parsing")
139+
} else {
140+
semver::BuildMetadata::new(&format!(
141+
"{}-{}.{}.{}",
142+
compiler_version.build.as_str(),
143+
input_version.major,
144+
input_version.minor,
145+
input_version.patch,
146+
))
147+
.expect("can't fail due to parsing")
148+
};
149+
compiler_version.build = build;
150+
};
151+
compiler_version
152+
}

0 commit comments

Comments
 (0)