Skip to content

Commit

Permalink
some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr committed Mar 4, 2024
1 parent 77bb648 commit 7ba569c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/forge/bin/cmd/script/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,31 @@ use super::{
ScriptArgs, ScriptConfig, ScriptResult,
};

/// First state basically containing only inputs of the user.
pub struct PreprocessedState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
pub script_wallets: ScriptWallets,
}

/// State after we have determined and compiled target contract to be executed.
pub struct CompiledState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
pub script_wallets: ScriptWallets,
pub build_data: BuildData,
}

/// State after linking, contains the linked build data along with library addresses and optional
/// array of libraries that need to be predeployed.
pub struct LinkedState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
pub script_wallets: ScriptWallets,
pub build_data: LinkedBuildData,
}

/// Same as [LinkedState], but also contains [ExecutionData].
pub struct PreExecutionState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
Expand All @@ -38,6 +43,7 @@ pub struct PreExecutionState {
pub execution_data: ExecutionData,
}

/// State after the script has been executed.
pub struct ExecutedState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
Expand All @@ -47,6 +53,11 @@ pub struct ExecutedState {
pub execution_result: ScriptResult,
}

/// Same as [ExecutedState], but also contains [ExecutionArtifacts] which are obtained from
/// [ScriptResult].
///
/// Can be either converted directly to [BundledState] via [PreSimulationState::resume] or driven to
/// it through [FilledTransactionsState].
pub struct PreSimulationState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
Expand All @@ -57,6 +68,9 @@ pub struct PreSimulationState {
pub execution_artifacts: ExecutionArtifacts,
}

/// At this point we have converted transactions collected during script execution to
/// [TransactionWithMetadata] objects which contain additional metadata needed for broadcasting and
/// verification.
pub struct FilledTransactionsState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
Expand All @@ -67,6 +81,8 @@ pub struct FilledTransactionsState {
pub transactions: VecDeque<TransactionWithMetadata>,
}

/// State after we have bundled all [TransactionWithMetadata] objects into a single
/// [ScriptSequenceKind] object containing one or more script sequences.
pub struct BundledState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
Expand All @@ -77,6 +93,9 @@ pub struct BundledState {
pub sequence: ScriptSequenceKind,
}

/// State after we have broadcasted the script.
/// It is assumed that at this point [BroadcastedState::sequence] contains receipts for all
/// broadcasted transactions.
pub struct BroadcastedState {
pub args: ScriptArgs,
pub script_config: ScriptConfig,
Expand Down

0 comments on commit 7ba569c

Please sign in to comment.