Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/konaPublic

Commit6ef94cb

Browse files
emhanerefcell
andauthored
feat(interop): Add utility trait method toInteropTxValidator (#1291)
Co-authored-by: refcell <abigger87@gmail.com>
1 parentb671e4e commit6ef94cb

File tree

1 file changed

+27
-5
lines changed
  • crates/node/rpc/src/interop

1 file changed

+27
-5
lines changed

‎crates/node/rpc/src/interop/mod.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ pub trait InteropTxValidator {
2222
typeSupervisorClient:CheckAccessList +Send +Sync;
2323

2424
/// 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.
2528
constDEFAULT_TIMEOUT:Duration;
2629

2730
/// Returns reference to supervisor client. Used in default trait method implementations.
@@ -33,16 +36,16 @@ pub trait InteropTxValidator {
3336
}
3437

3538
/// Validates a list of inbox entries against a Supervisor.
36-
asyncfnvalidate_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+
asyncfnvalidate_messages_with_timeout(
3743
&self,
3844
inbox_entries:&[B256],
3945
safety:SafetyLevel,
4046
executing_descriptor:ExecutingDescriptor,
41-
timeout:Option<Duration>,
47+
timeout:Duration,
4248
) ->Result<(),InteropTxValidatorError>{
43-
// Set timeout duration based on input if provided.
44-
let timeout = timeout.unwrap_or(Self::DEFAULT_TIMEOUT);
45-
4649
// Validate messages against supervisor with timeout.
4750
tokio::time::timeout(
4851
timeout,
@@ -51,4 +54,23 @@ pub trait InteropTxValidator {
5154
.await
5255
.map_err(|_|InteropTxValidatorError::ValidationTimeout(timeout.as_secs()))?
5356
}
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+
asyncfnvalidate_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+
}
5476
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp