@@ -22,6 +22,9 @@ pub trait InteropTxValidator {
22
22
type SupervisorClient : CheckAccessList +Send +Sync ;
23
23
24
24
/// Default duration that message validation is not allowed to exceed.
25
+ ///
26
+ /// Note: this has no effect unless shorter than timeout configured for
27
+ /// [`Self::SupervisorClient`] type.
25
28
const DEFAULT_TIMEOUT : Duration ;
26
29
27
30
/// Returns reference to supervisor client. Used in default trait method implementations.
@@ -33,16 +36,16 @@ pub trait InteropTxValidator {
33
36
}
34
37
35
38
/// Validates a list of inbox entries against a Supervisor.
36
- async fn validate_messages (
39
+ ///
40
+ /// Times out RPC requests after given timeout, as long as this timeout is shorter
41
+ /// than the underlying request timeout configured for [`Self::SupervisorClient`] type.
42
+ async fn validate_messages_with_timeout (
37
43
& self ,
38
44
inbox_entries : & [ B256 ] ,
39
45
safety : SafetyLevel ,
40
46
executing_descriptor : ExecutingDescriptor ,
41
- timeout : Option < Duration > ,
47
+ timeout : Duration ,
42
48
) ->Result < ( ) , InteropTxValidatorError > {
43
- // Set timeout duration based on input if provided.
44
- let timeout = timeout. unwrap_or ( Self :: DEFAULT_TIMEOUT ) ;
45
-
46
49
// Validate messages against supervisor with timeout.
47
50
tokio:: time:: timeout (
48
51
timeout,
@@ -51,4 +54,23 @@ pub trait InteropTxValidator {
51
54
. await
52
55
. map_err ( |_|InteropTxValidatorError :: ValidationTimeout ( timeout. as_secs ( ) ) ) ?
53
56
}
57
+
58
+ /// Validates a list of inbox entries against a Supervisor.
59
+ ///
60
+ /// Times out RPC requests after [`Self::DEFAULT_TIMEOUT`], as long as this timeout is shorter
61
+ /// than the underlying request timeout configured for [`Self::SupervisorClient`] type.
62
+ async fn validate_messages (
63
+ & self ,
64
+ inbox_entries : & [ B256 ] ,
65
+ safety : SafetyLevel ,
66
+ executing_descriptor : ExecutingDescriptor ,
67
+ ) ->Result < ( ) , InteropTxValidatorError > {
68
+ self . validate_messages_with_timeout (
69
+ inbox_entries,
70
+ safety,
71
+ executing_descriptor,
72
+ Self :: DEFAULT_TIMEOUT ,
73
+ )
74
+ . await
75
+ }
54
76
}