Commit cba81a6
refactor(anvil)!: simplify PrecompileFactory API to use DynPrecompile (#12411)
* refactor(anvil)!: simplify PrecompileFactory API to use DynPrecompile
Changed PrecompileFactory::precompiles() return type from Vec<(Precompile, u64)> to Vec<(Address, DynPrecompile)> for a cleaner and more flexible API.
The previous API required wrapping precompile functions in the Precompile type with gas limits. The new API directly uses DynPrecompile, which is more straightforward and allows users to create custom precompiles with arbitrary logic without needing to understand the legacy Precompile wrapper.
Updated inject_custom_precompiles to accept the new type and simplified the injection logic to directly apply DynPrecompiles without additional wrapping.
Updated all tests and implementations to use the new API with proper type annotations for closure parameters.
BREAKING CHANGE: PrecompileFactory::precompiles() now returns Vec<(Address, DynPrecompile)> instead of Vec<(Precompile, u64)>
Co-Authored-By: Claude <noreply@anthropic.com>
* touchup
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cb34166 commit cba81a6
3 files changed
+37
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
816 | | - | |
817 | | - | |
| 816 | + | |
| 817 | + | |
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 27 | + | |
| 28 | + | |
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
38 | | - | |
| 34 | + | |
39 | 35 | | |
40 | 36 | | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 55 | + | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
76 | | - | |
| 73 | + | |
| 74 | + | |
77 | 75 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 88 | | |
95 | 89 | | |
96 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
1868 | 1866 | | |
1869 | 1867 | | |
1870 | 1868 | | |
1871 | | - | |
1872 | | - | |
1873 | | - | |
1874 | | - | |
1875 | 1869 | | |
1876 | 1870 | | |
1877 | 1871 | | |
1878 | 1872 | | |
1879 | | - | |
| 1873 | + | |
1880 | 1874 | | |
1881 | | - | |
1882 | | - | |
1883 | | - | |
1884 | | - | |
1885 | | - | |
1886 | | - | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
1887 | 1885 | | |
1888 | 1886 | | |
1889 | 1887 | | |
| |||
0 commit comments