Skip to content

Commit e52e9fb

Browse files
committed
refactor: Add public constructor of ND-data size-indicator ingrity check snippet
The struct may have been `pub` but when its field isn't and there's no public constructor, that's no good!
1 parent 52a3366 commit e52e9fb

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tasm-lib/src/structure/verify_nd_si_integrity.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@ use crate::library::Library;
88
use crate::prelude::BasicSnippet;
99
use crate::prelude::TasmObject;
1010

11-
#[derive(Clone, Debug, Default)]
12-
pub struct VerifyNdSiIntegrity<T: TasmObject + BFieldCodec + Clone + Debug> {
13-
_phantom_data: PhantomData<T>,
11+
/// Verify size-indicator integrity of preloaded data, return size.
12+
///
13+
/// Crashes the VM if the structure in question is not entirely contained within
14+
/// the non-deterministic section of memory as defined in the memory layout.
15+
#[derive(Clone, Debug)]
16+
pub struct VerifyNdSiIntegrity<PreloadedData: TasmObject + BFieldCodec + Clone + Debug> {
17+
_phantom_data: PhantomData<PreloadedData>,
18+
}
19+
20+
impl<T: TasmObject + BFieldCodec + Clone + Debug> Default for VerifyNdSiIntegrity<T> {
21+
fn default() -> Self {
22+
Self {
23+
_phantom_data: Default::default(),
24+
}
25+
}
1426
}
1527

1628
impl<T: TasmObject + BFieldCodec + Clone + Debug> BasicSnippet for VerifyNdSiIntegrity<T> {

0 commit comments

Comments
 (0)