Skip to content

zkasm_runner::ExecutionResult fileds redesign proposal. #242

@MCJOHN974

Description

@MCJOHN974

Currently zkasm_runner::ExecutionResult looks the following way:

pub struct ExecutionResult {
    /// Path to the main zkAsm file that was executed.
    path: String,
    /// Status of the execution.
    pub status: ExecutionStatus,
    /// Error message in case the execution failed.
    pub error: Option<String>,
    /// Profiling information about this execution.
    /// Only populated for the successful executions.
    counters: Option<Counters>,
}

And I have a few questions about it:

  • is it true that if and only if status is ExecutionStatus::Success, than error contains None and counters contains Some?
  • is it true that if and only if status is ExecutionStatus::RuntimeError, than error contains Some and counters contains None?

If answer for both questions above is "yes" does we really need status field? It sounds like we already have info about status in error and counters fields. And, keeping one more such field will need to add extra attention to keep this fields consistent (be sure answer for both questions above is always "yes"). Maybe it will be better to remove this field and add method:

impl ExecutionResult {
    pub fn status(&self) -> ExecutionStatus {
        match self.error {
            Some(_) => ExecutionStatus::Success,
            None => ExecutionStatus::RuntimeError,
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions