Skip to main content

signet_sim/
outcome.rs

1#[cfg(doc)]
2use crate::SimCache;
3use crate::SimItem;
4use alloy::primitives::U256;
5use signet_types::{AggregateFills, AggregateOrders};
6use trevm::revm::database::Cache;
7
8/// A simulation outcome that includes the score, gas used, and a cache of
9/// state changes.
10#[derive(Debug, Clone)]
11pub struct SimOutcomeWithCache {
12    /// The key for the item in the [`SimCache`].
13    pub cache_rank: u128,
14
15    /// The score of the simulation, a [`U256`] value that represents the
16    /// increase in the beneficiary's balance.
17    pub score: U256,
18
19    /// The total amount of gas used by the simulation.
20    pub gas_used: u64,
21
22    /// The total amount of host gas used by the simulation.
23    pub host_gas_used: u64,
24
25    /// The result of the simulation, a [`Cache`] containing state changes that
26    /// can be applied.
27    pub rollup_cache: Cache,
28
29    /// The result of the bundle host simulation a [`Cache`] containing state
30    /// changes that can be applied.
31    pub host_cache: Cache,
32
33    /// The aggregate fills after simulation.
34    pub bundle_fills: AggregateFills,
35
36    /// The aggregate orders after simulation.
37    pub bundle_orders: AggregateOrders,
38}
39
40/// An item after simulation, containing the score and gas used.
41#[derive(Debug, Clone)]
42pub struct SimulatedItem {
43    /// The score of the simulation, a [`U256`] value that represents the
44    /// increase in the beneficiary's balance.
45    pub score: U256,
46
47    /// The total amount of gas used by the simulation.
48    pub gas_used: u64,
49
50    /// The total amount of host gas used by the simulation.
51    pub host_gas_used: u64,
52
53    /// The transaction or bundle that was simulated.
54    pub item: SimItem,
55}