Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7046-unreachable-error-alerting.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `error!`-level logging with `UNREACHABLE_ERROR_TRIGGERED` marker and `stacks_unreachable_errors_total` Prometheus counter when unreachable errors are hit during transaction processing ([#7046](https://github.com/stacks-network/stacks-core/pull/7046))
14 changes: 14 additions & 0 deletions clarity/src/vm/analysis/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,17 @@ pub struct StaticCheckError {

impl RuntimeCheckErrorKind {
/// This check indicates that the transaction should be rejected.
/// Currently identical to `is_unreachable()` since `Unreachable` is the only
/// rejectable variant, but they answer different questions and may diverge.
pub fn rejectable(&self) -> bool {
matches!(self, RuntimeCheckErrorKind::Unreachable(_))
}

/// Returns true if this error is an unreachable error, indicating a potential bug.
/// Used only for monitoring (logging + prometheus counter), not for business logic.
pub fn is_unreachable(&self) -> bool {
matches!(self, RuntimeCheckErrorKind::Unreachable(_))
}
}

impl StaticCheckErrorKind {
Expand All @@ -676,6 +684,12 @@ impl StaticCheckErrorKind {
_ => false,
}
}

/// Returns true if this error is an unreachable error, indicating a potential bug.
/// Used only for monitoring (logging + prometheus counter), not for business logic.
pub fn is_unreachable(&self) -> bool {
matches!(self, StaticCheckErrorKind::Unreachable(_))
}
}

impl StaticCheckError {
Expand Down
9 changes: 9 additions & 0 deletions clarity/src/vm/ast/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ impl ParseError {
}
}

/// Returns true if this error is an unreachable error, indicating a potential bug.
/// Used only for monitoring (logging + prometheus counter), not for business logic.
pub fn is_unreachable(&self) -> bool {
matches!(
*self.err,
ParseErrorKind::InterpreterFailure | ParseErrorKind::UnexpectedParserFailure
)
}

pub fn has_pre_expression(&self) -> bool {
self.pre_expressions.is_some()
}
Expand Down
Loading
Loading