reth_optimism_txpool/supervisor/
message.rs

1//! Interop message primitives.
2// Source: https://github.com/op-rs/kona
3// Copyright © 2023 kona contributors Copyright © 2024 Optimism
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6// associated documentation files (the “Software”), to deal in the Software without restriction,
7// including without limitation the rights to use, copy, modify, merge, publish, distribute,
8// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9// furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in all copies or
12// substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19/// An [`ExecutingDescriptor`] is a part of the payload to `supervisor_checkAccessList`
20/// Spec: <https://github.com/ethereum-optimism/specs/blob/main/specs/interop/supervisor.md#executingdescriptor>
21#[derive(Default, Debug, PartialEq, Eq, Clone, serde::Serialize, serde::Deserialize)]
22pub struct ExecutingDescriptor {
23    /// The timestamp used to enforce timestamp [invariant](https://github.com/ethereum-optimism/specs/blob/main/specs/interop/derivation.md#invariants)
24    #[serde(with = "alloy_serde::quantity")]
25    timestamp: u64,
26    /// The timeout that requests verification to still hold at `timestamp+timeout`
27    /// (message expiry may drop previously valid messages).
28    #[serde(skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")]
29    timeout: Option<u64>,
30}
31
32impl ExecutingDescriptor {
33    /// Create a new [`ExecutingDescriptor`] from the timestamp and timeout
34    pub const fn new(timestamp: u64, timeout: Option<u64>) -> Self {
35        Self { timestamp, timeout }
36    }
37}