Skip to content

Commit ff99942

Browse files
committed
simplify error conversion
1 parent 8ab3398 commit ff99942

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

programs/system/src/processor/create_inputs_cpi_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn create_inputs_cpi_data<'a, 'info, T: InstructionData<'a>>(
112112
hash_chain = cpi_ix_data.nullifiers[j].account_hash;
113113
} else {
114114
hash_chain = Poseidon::hashv(&[&hash_chain, &cpi_ix_data.nullifiers[j].account_hash])
115-
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?;
115+
.map_err(|e| SystemProgramError::from(e).into())?;
116116
}
117117
}
118118
// TODO: benchmark the chaining.

programs/system/src/processor/create_outputs_cpi_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ pub fn create_outputs_cpi_data<'a, 'info, T: InstructionData<'a>>(
169169
&cpi_ix_data.output_leaf_indices[j].into(),
170170
is_batched,
171171
)
172-
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?;
172+
.map_err(|e| SystemProgramError::from(e).into())?;
173173
cpi_ix_data.leaves[j].account_index = index_merkle_tree_account_account - 1;
174174

175175
if !cpi_ix_data.nullifiers.is_empty() {
176176
if j == 0 {
177177
hash_chain = cpi_ix_data.leaves[j].leaf;
178178
} else {
179179
hash_chain = Poseidon::hashv(&[&hash_chain, &cpi_ix_data.leaves[j].leaf])
180-
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?;
180+
.map_err(|e| SystemProgramError::from(e).into())?;
181181
}
182182
}
183183
context.set_rollover_fee(current_index as u8, rollover_fee);

programs/system/src/processor/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub fn process<
209209
&output_compressed_account_hashes,
210210
current_slot,
211211
)
212-
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?;
212+
.map_err(|e| SystemProgramError::from(e).into())?;
213213
}
214214
}
215215
// 11. Sum check ---------------------------------------------------

programs/system/src/processor/verify_proof.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ pub fn verify_proof(
169169
let public_input_hash = if !leaves.is_empty() && !addresses.is_empty() {
170170
// combined inclusion & non-inclusion proof
171171
let inclusion_hash = create_two_inputs_hash_chain(roots, leaves)
172-
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?;
172+
.map_err(|e| SystemProgramError::from(e).into())?;
173173
let non_inclusion_hash = create_two_inputs_hash_chain(address_roots, addresses)
174-
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?;
174+
.map_err(|e| SystemProgramError::from(e).into())?;
175175
create_hash_chain_from_slice(&[inclusion_hash, non_inclusion_hash])
176176
.map_err(|e| ProgramError::from(SystemProgramError::from(e)))?
177177
} else if !leaves.is_empty() {

0 commit comments

Comments
 (0)