Skip to content

Commit dc3fb38

Browse files
feat(starknet_os): add the da_segment field to the hint processor
1 parent 03b6deb commit dc3fb38

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

crates/starknet_os/src/hint_processor/snos_hint_processor.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use starknet_types_core::felt::Felt;
1717

1818
use crate::hint_processor::execution_helper::OsExecutionHelper;
1919
use crate::hints::enum_definition::AllHints;
20+
use crate::hints::error::OsHintError;
2021
use crate::hints::types::{HintArgs, HintEnum, HintExtensionImplementation, HintImplementation};
2122
#[cfg(any(feature = "testing", test))]
2223
use crate::io::os_input::StarknetOsInput;
@@ -29,6 +30,9 @@ pub struct SnosHintProcessor<S: StateReader> {
2930
pub execution_helper: OsExecutionHelper<S>,
3031
pub syscall_hint_processor: SyscallHintProcessor,
3132
_deprecated_syscall_hint_processor: DeprecatedSyscallHintProcessor,
33+
34+
// KZG fields.
35+
da_segment: Option<Vec<Felt>>,
3236
}
3337

3438
impl<S: StateReader> SnosHintProcessor<S> {
@@ -41,8 +45,22 @@ impl<S: StateReader> SnosHintProcessor<S> {
4145
execution_helper,
4246
syscall_hint_processor,
4347
_deprecated_syscall_hint_processor: deprecated_syscall_hint_processor,
48+
da_segment: None,
4449
}
4550
}
51+
52+
/// Stores the data-availabilty segment, to be used for computing the KZG commitment in blob
53+
/// mode.
54+
#[allow(dead_code)]
55+
pub(crate) fn set_da_segment(&mut self, da_segment: Vec<Felt>) -> Result<(), OsHintError> {
56+
if self.da_segment.is_some() {
57+
return Err(OsHintError::AssertionFailed {
58+
message: "DA segment is already initialized.".to_string(),
59+
});
60+
}
61+
self.da_segment = Some(da_segment);
62+
Ok(())
63+
}
4664
}
4765

4866
impl<S: StateReader> HintProcessorLogic for SnosHintProcessor<S> {

0 commit comments

Comments
 (0)