|
3 | 3 | use crate::compilers::{
|
4 | 4 | CompilationError, CompilerContract, CompilerInput, CompilerOutput, Language,
|
5 | 5 | };
|
6 |
| -use alloy_primitives::hex; |
7 | 6 | use foundry_compilers_core::{error::Result, utils};
|
8 |
| -use md5::Digest; |
9 | 7 | use semver::Version;
|
10 | 8 | use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
11 | 9 | use std::{
|
@@ -97,22 +95,13 @@ impl<L: Language> RawBuildInfo<L> {
|
97 | 95 | let version = input.version().clone();
|
98 | 96 | let build_context = BuildContext::new(input, output)?;
|
99 | 97 |
|
100 |
| - let mut hasher = md5::Md5::new(); |
101 |
| - |
102 |
| - hasher.update(ETHERS_FORMAT_VERSION); |
103 |
| - |
104 | 98 | let solc_short = format!("{}.{}.{}", version.major, version.minor, version.patch);
|
105 |
| - hasher.update(&solc_short); |
106 |
| - hasher.update(version.to_string()); |
107 |
| - |
108 | 99 | let input = serde_json::to_value(input)?;
|
109 |
| - hasher.update(&serde_json::to_string(&input)?); |
110 |
| - |
111 |
| - // create the hash for `{_format,solcVersion,solcLongVersion,input}` |
112 |
| - // N.B. this is not exactly the same as hashing the json representation of these values but |
113 |
| - // the must efficient one |
114 |
| - let result = hasher.finalize(); |
115 |
| - let id = hex::encode(result); |
| 100 | + let id = utils::unique_hash_many([ |
| 101 | + ETHERS_FORMAT_VERSION, |
| 102 | + &version.to_string(), |
| 103 | + &serde_json::to_string(&input)?, |
| 104 | + ]); |
116 | 105 |
|
117 | 106 | let mut build_info = BTreeMap::new();
|
118 | 107 |
|
|
0 commit comments