Skip to content

Commit

Permalink
refactor: small error refactoring (using 'static str instead of `St…
Browse files Browse the repository at this point in the history
…ring`)
  • Loading branch information
polydez committed Mar 20, 2024
1 parent ce6effc commit ae198fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions block-producer/src/block_builder/prover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,22 @@ impl BlockProver {
let new_account_root = execution_output
.stack_outputs()
.get_stack_word(ACCOUNT_ROOT_WORD_IDX)
.ok_or(BlockProverError::InvalidRootOutput("account".to_string()))?;
.ok_or(BlockProverError::InvalidRootOutput("account"))?;

let new_note_root = execution_output
.stack_outputs()
.get_stack_word(NOTE_ROOT_WORD_IDX)
.ok_or(BlockProverError::InvalidRootOutput("note".to_string()))?;
.ok_or(BlockProverError::InvalidRootOutput("note"))?;

let new_nullifier_root = execution_output
.stack_outputs()
.get_stack_word(NULLIFIER_ROOT_WORD_IDX)
.ok_or(BlockProverError::InvalidRootOutput("nullifier".to_string()))?;
.ok_or(BlockProverError::InvalidRootOutput("nullifier"))?;

let new_chain_mmr_root = execution_output
.stack_outputs()
.get_stack_word(CHAIN_MMR_ROOT_WORD_IDX)
.ok_or(BlockProverError::InvalidRootOutput("chain mmr".to_string()))?;
.ok_or(BlockProverError::InvalidRootOutput("chain mmr"))?;

Ok((
new_account_root.into(),
Expand Down
2 changes: 1 addition & 1 deletion block-producer/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub enum BlockProverError {
#[error("program execution failed")]
ProgramExecutionFailed(ExecutionError),
#[error("failed to retrieve {0} root from stack outputs")]
InvalidRootOutput(String),
InvalidRootOutput(&'static str),
}

// Block inputs errors
Expand Down

0 comments on commit ae198fb

Please sign in to comment.