File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change
1
+ from typing import (
2
+ cast ,
3
+ Optional ,
4
+ )
5
+
1
6
from cytoolz import (
2
7
curry ,
3
8
)
4
9
10
+ from eth .exceptions import (
11
+ VMError ,
12
+ )
13
+
14
+ from eth .rlp .transactions import (
15
+ BaseTransaction ,
16
+ )
5
17
6
18
from eth .utils .spoof import (
7
19
SpoofTransaction ,
8
20
)
9
21
22
+ from eth .vm .state import (
23
+ BaseState ,
24
+ )
25
+
10
26
11
- def _get_computation_error (state , transaction ) :
27
+ def _get_computation_error (state : BaseState , transaction : SpoofTransaction ) -> Optional [ VMError ] :
12
28
13
29
snapshot = state .snapshot ()
14
30
15
31
try :
16
- computation = state .execute_transaction (transaction )
32
+ computation = state .execute_transaction (cast ( BaseTransaction , transaction ) )
17
33
if computation .is_error :
18
34
return computation ._error
19
35
else :
@@ -24,7 +40,7 @@ def _get_computation_error(state, transaction):
24
40
25
41
26
42
@curry
27
- def binary_gas_search (state , transaction , tolerance = 1 ):
43
+ def binary_gas_search (state : BaseState , transaction : BaseTransaction , tolerance : int = 1 ) -> int :
28
44
"""
29
45
Run the transaction with various gas limits, progressively
30
46
approaching the minimum needed to succeed without an OutOfGas exception.
You can’t perform that action at this time.
0 commit comments