Skip to content

Commit 8aa4a76

Browse files
starknet_os: make sure the virtual output iterator is fully consumed
1 parent d41c6e3 commit 8aa4a76

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

crates/starknet_os/src/io/os_output.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pub enum OsOutputError {
4747
InvalidOsOutputField { value_name: String, val: Felt, message: String },
4848
#[error("Failed to convert to FullOsOutput. State diff variant is of a different type")]
4949
ConvertToFullOutput,
50+
#[error("Output iterator not exhausted.")]
51+
OutputNotExhausted,
5052
}
5153

5254
pub(crate) fn wrap_missing<T>(val: Option<T>, val_name: &str) -> Result<T, OsOutputError> {

crates/starknet_os/src/io/virtual_os_output.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ impl VirtualOsOutput {
3636
let starknet_os_config_hash = wrap_missing(iter.next(), "starknet_os_config_hash")?;
3737
let messages_to_l1 = parse_messages_to_l1(&mut iter)?;
3838

39+
if iter.next().is_some() {
40+
return Err(OsOutputError::OutputNotExhausted);
41+
}
42+
3943
Ok(Self {
4044
version,
4145
base_block_number,

0 commit comments

Comments
 (0)