|
1 |
| -use foundry_config::Config; |
2 | 1 | use foundry_test_utils::util::OutputExt;
|
3 | 2 | use std::path::Path;
|
4 | 3 |
|
5 |
| -// <https://github.com/foundry-rs/foundry/issues/11125> |
6 | 4 | casttest!(error_decode_with_openchain, |prj, cmd| {
|
7 | 5 | prj.clear_cache();
|
8 |
| - |
9 | 6 | cmd.args(["decode-error", "0x7a0e198500000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000064"]).assert_success().stdout_eq(str![[r#"
|
10 | 7 | ValueTooHigh(uint256,uint256)
|
11 | 8 | 101
|
12 | 9 | 100
|
13 | 10 |
|
14 | 11 | "#]]);
|
15 |
| - |
16 |
| - // Read cache to ensure the error is cached |
17 |
| - assert_eq!( |
18 |
| - read_error_cache().get("0x7a0e1985"), |
19 |
| - Some(&serde_json::Value::String("ValueTooHigh(uint256,uint256)".to_string())), |
20 |
| - "Selector should be cached" |
21 |
| - ); |
22 |
| -}); |
23 |
| - |
24 |
| -// <https://github.com/foundry-rs/foundry/issues/11125> |
25 |
| -// NOTE: if a user does happen to mine and submit 0x37d01491 this is expected to fail. |
26 |
| -casttest!(error_decode_with_openchain_nonexistent, |prj, cmd| { |
27 |
| - prj.clear_cache(); |
28 |
| - |
29 |
| - cmd.args(["decode-error", "0x37d0149100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002"]).assert_failure().stderr_eq(str![[r#" |
30 |
| -Error: No matching error signature found for selector `37d01491` |
31 |
| -
|
32 |
| -"#]]); |
33 |
| - |
34 |
| - // Read cache to ensure the error is not cached |
35 |
| - assert_eq!(read_error_cache().get("0x37d01491"), None, "Selector should not be cached"); |
36 | 12 | });
|
37 | 13 |
|
38 |
| -/// Read the errors section from the signatures cache in the global foundry cache directory. |
39 |
| -fn read_error_cache() -> serde_json::Value { |
40 |
| - let cache = Config::foundry_cache_dir().unwrap().join("signatures"); |
41 |
| - let contents = std::fs::read_to_string(cache).unwrap(); |
42 |
| - let cache_json: serde_json::Value = serde_json::from_str(&contents).unwrap(); |
43 |
| - cache_json.get("errors").cloned().unwrap_or_default() |
44 |
| -} |
45 |
| - |
46 | 14 | casttest!(fourbyte, |_prj, cmd| {
|
47 | 15 | cmd.args(["4byte", "0xa9059cbb"]).assert_success().stdout_eq(str![[r#"
|
48 | 16 | transfer(address,uint256)
|
|
0 commit comments