Skip to content

Commit bc25090

Browse files
Add_all_cairo_stwo_layout
1 parent 153d3a8 commit bc25090

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

vm/src/types/instance_definitions/builtins_instance_def.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,28 @@ impl BuiltinsInstanceDef {
179179
}
180180
}
181181

182+
pub(crate) fn all_cairo_stwo() -> BuiltinsInstanceDef {
183+
BuiltinsInstanceDef {
184+
output: true,
185+
pedersen: Some(PedersenInstanceDef::new(Some(256))),
186+
range_check: Some(RangeCheckInstanceDef::default()),
187+
ecdsa: None,
188+
bitwise: Some(BitwiseInstanceDef::new(Some(16))),
189+
ec_op: None,
190+
keccak: None,
191+
poseidon: Some(PoseidonInstanceDef::new(Some(256))),
192+
range_check96: Some(RangeCheckInstanceDef::new(Some(8))),
193+
#[cfg(feature = "mod_builtin")]
194+
add_mod: Some(ModInstanceDef::new(Some(128), 1, 96)),
195+
#[cfg(feature = "mod_builtin")]
196+
mul_mod: Some(ModInstanceDef::new(Some(256), 1, 96)),
197+
#[cfg(not(feature = "mod_builtin"))]
198+
add_mod: None,
199+
#[cfg(not(feature = "mod_builtin"))]
200+
mul_mod: None,
201+
}
202+
}
203+
182204
pub(crate) fn all_solidity() -> BuiltinsInstanceDef {
183205
BuiltinsInstanceDef {
184206
output: true,

vm/src/types/layout.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ impl CairoLayout {
132132
}
133133
}
134134

135+
pub(crate) fn all_cairo_stwo_instance() -> CairoLayout {
136+
CairoLayout {
137+
name: LayoutName::all_cairo_stwo,
138+
rc_units: 4,
139+
cpu_component_step: DEFAULT_CPU_COMPONENT_STEP,
140+
memory_units_per_step: DEFAULT_MEMORY_UNITS_PER_STEP,
141+
builtins: BuiltinsInstanceDef::all_cairo_stwo(),
142+
public_memory_fraction: 8,
143+
diluted_pool_instance_def: Some(DilutedPoolInstanceDef::default()),
144+
}
145+
}
146+
135147
pub(crate) fn all_solidity_instance() -> CairoLayout {
136148
CairoLayout {
137149
name: LayoutName::all_solidity,

vm/src/types/layout_name.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub enum LayoutName {
2121
all_solidity,
2222
all_cairo,
2323
dynamic,
24+
all_cairo_stwo,
2425
}
2526

2627
impl LayoutName {
@@ -37,6 +38,7 @@ impl LayoutName {
3738
LayoutName::all_solidity => "all_solidity",
3839
LayoutName::all_cairo => "all_cairo",
3940
LayoutName::dynamic => "dynamic",
41+
LayoutName::all_cairo_stwo => "all_cairo_stwo",
4042
}
4143
}
4244
}
@@ -62,6 +64,7 @@ impl ValueEnum for LayoutName {
6264
Self::all_solidity,
6365
Self::all_cairo,
6466
Self::dynamic,
67+
Self::all_cairo_stwo,
6568
]
6669
}
6770

vm/src/vm/runners/cairo_runner.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ impl CairoRunner {
188188
LayoutName::recursive_large_output => CairoLayout::recursive_large_output_instance(),
189189
LayoutName::recursive_with_poseidon => CairoLayout::recursive_with_poseidon(),
190190
LayoutName::all_cairo => CairoLayout::all_cairo_instance(),
191+
LayoutName::all_cairo_stwo => CairoLayout::all_cairo_stwo_instance(),
191192
LayoutName::all_solidity => CairoLayout::all_solidity_instance(),
192193
LayoutName::dynamic => {
193194
let params =

0 commit comments

Comments
 (0)