For example, if code in AssertionFailed(code) happens to be 0xfc it is converted to 0xfc, same as FrameEnd. There seems to be no restriction on the values that code can take.
|
pub fn as_u32(self) -> u32 { |
|
match self { |
|
Self::FrameStart => TRACE_FRAME_START, |
|
Self::FrameEnd => TRACE_FRAME_END, |
|
Self::AssertionFailed(None) => 0, |
|
Self::AssertionFailed(Some(code)) => code.get(), |
|
Self::Unknown(event) => event, |
|
} |
|
} |
Not all TraceEvent variants can be constructed from u32:
|
impl From<u32> for TraceEvent { |
|
fn from(raw: u32) -> Self { |
|
match raw { |
|
TRACE_FRAME_START => Self::FrameStart, |
|
TRACE_FRAME_END => Self::FrameEnd, |
|
_ => Self::Unknown(raw), |
|
} |
|
} |
|
} |
Impact
Might not cause any issues as assertion failures are handled separately. However TraceEvent and the conversion methods are public and hitting that issue would cause confusion.
For example, if
codeinAssertionFailed(code)happens to be0xfcit is converted to0xfc, same asFrameEnd. There seems to be no restriction on the values thatcodecan take.miden-debug/crates/engine/src/exec/trace_event.rs
Lines 34 to 42 in e1cfe13
Not all
TraceEventvariants can be constructed fromu32:miden-debug/crates/engine/src/exec/trace_event.rs
Lines 44 to 52 in e1cfe13
Impact
Might not cause any issues as assertion failures are handled separately. However
TraceEventand the conversion methods are public and hitting that issue would cause confusion.