Skip to content

Commit

Permalink
feat(octez): add kernel file to rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
ryutamago committed Nov 11, 2024
1 parent f2d3113 commit c65a505
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/jstzd/src/task/octez_rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Task for OctezRollup {
&config.address,
&config.operator,
Some(&config.boot_sector_file),
None,
config.kernel_debug_file.as_deref(),
)?);
Ok(Self {
inner,
Expand Down
15 changes: 15 additions & 0 deletions crates/octez/src/async/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct OctezRollupConfigBuilder {
/// HTTP endpoint of the rollup node RPC interface,
/// if None, use localhost with random port
pub rpc_endpoint: Option<Endpoint>,
/// The path to the kernel debug file
kernel_debug_file: Option<PathBuf>,
}

impl OctezRollupConfigBuilder {
Expand All @@ -70,6 +72,7 @@ impl OctezRollupConfigBuilder {
operator,
boot_sector_file,
rpc_endpoint: None,
kernel_debug_file: None,
}
}

Expand All @@ -88,6 +91,11 @@ impl OctezRollupConfigBuilder {
self
}

pub fn set_kernel_debug_file(mut self, kernel_debug_file: &Path) -> Self {
self.kernel_debug_file = Some(kernel_debug_file.to_path_buf());
self
}

pub fn build(self) -> Result<OctezRollupConfig> {
Ok(OctezRollupConfig {
binary_path: self
Expand All @@ -104,6 +112,7 @@ impl OctezRollupConfigBuilder {
let uri = Uri::from_str(&format!("127.0.0.1:{}", unused_port())).unwrap();
Endpoint::try_from(uri).unwrap()
}),
kernel_debug_file: self.kernel_debug_file,
})
}
}
Expand All @@ -119,6 +128,7 @@ pub struct OctezRollupConfig {
pub boot_sector_file: PathBuf,
pub rpc_endpoint: Endpoint,
pub pvm_kind: SmartRollupPvmKind,
pub kernel_debug_file: Option<PathBuf>,
}

pub struct OctezRollup {
Expand Down Expand Up @@ -211,6 +221,7 @@ mod test {
"operator".to_owned(),
PathBuf::from("/tmp/boot_sector.hex"),
)
.set_kernel_debug_file(Path::new("/tmp/kernel_debug.log"))
.build()
.unwrap();
assert_eq!(rollup_config.pvm_kind, SmartRollupPvmKind::Wasm);
Expand Down Expand Up @@ -239,5 +250,9 @@ mod test {
rollup_config.rpc_endpoint.to_string(),
format!("http://127.0.0.1:{}", port)
);
assert_eq!(
rollup_config.kernel_debug_file,
Some(PathBuf::from("/tmp/kernel_debug.log"))
);
}
}

0 comments on commit c65a505

Please sign in to comment.