@nomicfoundation/edr 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/src/trace/error_inferrer.rs +41 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomicfoundation/edr",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@napi-rs/cli": "^2.18.4",
|
|
6
6
|
"@types/chai": "^4.2.0",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
"repository": "NomicFoundation/edr.git",
|
|
53
53
|
"types": "index.d.ts",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@nomicfoundation/edr-darwin-arm64": "0.6.
|
|
56
|
-
"@nomicfoundation/edr-darwin-x64": "0.6.
|
|
57
|
-
"@nomicfoundation/edr-linux-arm64-gnu": "0.6.
|
|
58
|
-
"@nomicfoundation/edr-linux-arm64-musl": "0.6.
|
|
59
|
-
"@nomicfoundation/edr-linux-x64-gnu": "0.6.
|
|
60
|
-
"@nomicfoundation/edr-linux-x64-musl": "0.6.
|
|
61
|
-
"@nomicfoundation/edr-win32-x64-msvc": "0.6.
|
|
55
|
+
"@nomicfoundation/edr-darwin-arm64": "0.6.3",
|
|
56
|
+
"@nomicfoundation/edr-darwin-x64": "0.6.3",
|
|
57
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.6.3",
|
|
58
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.6.3",
|
|
59
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.6.3",
|
|
60
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.6.3",
|
|
61
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.6.3"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"artifacts": "napi artifacts",
|
|
@@ -1302,7 +1302,9 @@ impl ErrorInferrer {
|
|
|
1302
1302
|
.expect("The TS code type-checks this to always have bytecode");
|
|
1303
1303
|
let contract = bytecode.contract.borrow();
|
|
1304
1304
|
|
|
1305
|
-
let version =
|
|
1305
|
+
let version =
|
|
1306
|
+
Version::parse(&bytecode.compiler_version).expect("Failed to parse SemVer version");
|
|
1307
|
+
|
|
1306
1308
|
// this only makes sense when receive functions are available
|
|
1307
1309
|
if version < FIRST_SOLC_VERSION_RECEIVE_FUNCTION {
|
|
1308
1310
|
return Ok(false);
|
|
@@ -1586,7 +1588,11 @@ impl ErrorInferrer {
|
|
|
1586
1588
|
trace: &CallMessageTrace,
|
|
1587
1589
|
func: &ContractFunction,
|
|
1588
1590
|
) -> napi::Result<bool> {
|
|
1589
|
-
let last_step = trace
|
|
1591
|
+
let last_step = trace
|
|
1592
|
+
.steps
|
|
1593
|
+
.last()
|
|
1594
|
+
.expect("There should at least be one step");
|
|
1595
|
+
|
|
1590
1596
|
let last_step = match last_step {
|
|
1591
1597
|
Either4::A(step) => step,
|
|
1592
1598
|
_ => panic!("JS code asserted this is always an EvmStep"),
|
|
@@ -2206,10 +2212,10 @@ fn format_dyn_sol_value(val: &DynSolValue) -> String {
|
|
|
2206
2212
|
// surround string values with quotes
|
|
2207
2213
|
DynSolValue::String(s) => format!("\"{s}\""),
|
|
2208
2214
|
|
|
2209
|
-
DynSolValue::Address(address) => format!("\"
|
|
2210
|
-
DynSolValue::Bytes(bytes) => format!("\"
|
|
2215
|
+
DynSolValue::Address(address) => format!("\"{address}\""),
|
|
2216
|
+
DynSolValue::Bytes(bytes) => format!("\"{}\"", hex::encode_prefixed(bytes)),
|
|
2211
2217
|
DynSolValue::FixedBytes(word, size) => {
|
|
2212
|
-
format!("\"
|
|
2218
|
+
format!("\"{}\"", hex::encode_prefixed(&word.0.as_slice()[..*size]))
|
|
2213
2219
|
}
|
|
2214
2220
|
DynSolValue::Bool(b) => b.to_string(),
|
|
2215
2221
|
DynSolValue::Function(_) => "<function>".to_string(),
|
|
@@ -2217,3 +2223,33 @@ fn format_dyn_sol_value(val: &DynSolValue) -> String {
|
|
|
2217
2223
|
DynSolValue::Uint(uint, _bits) => uint.to_string(),
|
|
2218
2224
|
}
|
|
2219
2225
|
}
|
|
2226
|
+
|
|
2227
|
+
#[cfg(test)]
|
|
2228
|
+
mod tests {
|
|
2229
|
+
use super::*;
|
|
2230
|
+
|
|
2231
|
+
#[test]
|
|
2232
|
+
fn test_sol_value_to_string() {
|
|
2233
|
+
assert_eq!(
|
|
2234
|
+
format_dyn_sol_value(&DynSolValue::String("hello".to_string())),
|
|
2235
|
+
"\"hello\""
|
|
2236
|
+
);
|
|
2237
|
+
// Uniform, 0-prefixed hex strings
|
|
2238
|
+
assert_eq!(
|
|
2239
|
+
format_dyn_sol_value(&DynSolValue::Address([0u8; 20].into())),
|
|
2240
|
+
format!(r#""0x{}""#, "0".repeat(2 * 20))
|
|
2241
|
+
);
|
|
2242
|
+
assert_eq!(
|
|
2243
|
+
format_dyn_sol_value(&DynSolValue::Bytes(vec![0u8; 32])),
|
|
2244
|
+
format!(r#""0x{}""#, "0".repeat(2 * 32))
|
|
2245
|
+
);
|
|
2246
|
+
assert_eq!(
|
|
2247
|
+
format_dyn_sol_value(&DynSolValue::FixedBytes([0u8; 32].into(), 10)),
|
|
2248
|
+
format!(r#""0x{}""#, "0".repeat(2 * 10))
|
|
2249
|
+
);
|
|
2250
|
+
assert_eq!(
|
|
2251
|
+
format_dyn_sol_value(&DynSolValue::FixedBytes([0u8; 32].into(), 32)),
|
|
2252
|
+
format!(r#""0x{}""#, "0".repeat(2 * 32))
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2255
|
+
}
|