Skip to content

Commit ab68e4a

Browse files
authored
Merge pull request #6603 from jferrant/bugfix/make-sure-invalid-pox-call-invalid-block
Remove unreachable error type and use existing Expect error to ensure invalid block
2 parents 67e6805 + 7ee1aad commit ab68e4a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

clarity-types/src/errors/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ pub enum RuntimeErrorType {
101101
PoxAlreadyLocked,
102102

103103
BlockTimeNotAvailable,
104-
Unreachable,
105104
}
106105

107106
#[derive(Debug, PartialEq)]

pox-locking/src/pox_4.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use clarity::vm::contexts::GlobalContext;
1919
use clarity::vm::costs::cost_functions::ClarityCostFunction;
2020
use clarity::vm::costs::runtime_cost;
2121
use clarity::vm::database::{ClarityDatabase, STXBalance};
22-
use clarity::vm::errors::{Error as ClarityError, RuntimeErrorType};
22+
use clarity::vm::errors::{Error as ClarityError, InterpreterError, RuntimeErrorType};
2323
use clarity::vm::events::{STXEventType, STXLockEventData, StacksTransactionEvent};
2424
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier};
2525
use clarity::vm::{Environment, Value};
@@ -401,13 +401,16 @@ pub fn handle_contract_call(
401401
global_context.log_stacking(sender, *amount)?;
402402
}
403403
_ => {
404+
let msg = "Unreachable: failed to log STX delegation in PoX-4 delegate-stx call";
404405
// This should be unreachable!
405406
error!(
406-
"Unreachable: failed to log STX delegation in PoX-4 delegate-stx call";
407+
"{msg}";
407408
"sender" => ?sender_opt,
408409
"arg0" => ?args.first(),
409410
);
410-
return Err(ClarityError::Runtime(RuntimeErrorType::Unreachable, None));
411+
return Err(ClarityError::Interpreter(InterpreterError::Expect(
412+
msg.into(),
413+
)));
411414
}
412415
}
413416
}

0 commit comments

Comments
 (0)