Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/devnet-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const ContractsInfo = z.object({
service_provider_registry_impl_addr: z.string().startsWith("0x"),
filecoin_pay_v1_addr: z.string().startsWith("0x"),
endorsements_addr: z.string().startsWith("0x"),
session_key_registry_addr: z.string().startsWith("0x"),
});

const UserInfo = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/start/curio/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub const CURIO_FAST_STORAGE_PATH: &str = "/home/foc-user/curio/fast-storage";
/// Curio storage path inside container (long-term)
pub const CURIO_LONG_TERM_STORAGE_PATH: &str = "/home/foc-user/curio/long-term-storage";

pub const CURIO_LAYERS: &str = "seal,post,pdp-only,gui";
pub const CURIO_LAYERS: &str = "pdp-only,gui";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, good catch
also I thought it was pdp, I didn't know pdp-only was a thing, hopefully this simplifies the running instances a little


/// PDP layer configuration template
pub const PDP_LAYER_CONFIG_TEMPLATE: &str = r#"[HTTP]
Expand Down
26 changes: 26 additions & 0 deletions src/commands/start/foc_deployer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ pub fn parse_deployment_output(output_str: &str) -> Result<DeploymentResult, Box
let mut in_network_config = false;

for line in output_str.lines() {
// Parse "SessionKeyRegistry deployed at 0x..." (appears before summary)
if line.contains("SessionKeyRegistry deployed at") {
if let Some(addr) = extract_address_from_deployed_line(line) {
info!("Found SessionKeyRegistry: {}", addr);
addresses.insert("session_key_registry".to_string(), addr);
}
continue;
Comment on lines +271 to +272
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SessionKeyRegistry deployed at special-case always continues even when extract_address_from_deployed_line returns None. If the deploy output format varies slightly (e.g. deployed at: with a colon, extra prefixes), this will skip the line entirely and the address won't be captured. Consider only continue after successfully extracting an address, or falling back to the generic parsing path when extraction fails.

Suggested change
}
continue;
continue;
}

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

}

if line.contains("DEPLOYMENT SUMMARY") {
in_summary = true;
info!("Found DEPLOYMENT SUMMARY section");
Expand Down Expand Up @@ -383,6 +392,23 @@ pub fn parse_deployment_output(output_str: &str) -> Result<DeploymentResult, Box
})
}

/// Extract an address from a "<Name> deployed at 0x..." line.
///
/// # Example
/// ```text
/// SessionKeyRegistry deployed at 0xaF69542d01111EdfB7B63Aa974E6A2c9A31EA1E9
/// ```
fn extract_address_from_deployed_line(line: &str) -> Option<String> {
let marker = "deployed at ";
let idx = line.find(marker)?;
let addr = line[idx + marker.len()..].trim();
if addr.starts_with("0x") && addr.len() >= 42 {
Some(addr.to_string())
Comment on lines +401 to +406
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract_address_from_deployed_line returns the entire substring after deployed at , so if the deploy script ever prints anything after the address (e.g. trailing commas, extra text, ANSI codes), the stored value will not be a valid 0x address and downstream consumers will break. Consider extracting only the first token, then validating it is exactly 42 chars (0x + 40) and hex before returning.

Suggested change
fn extract_address_from_deployed_line(line: &str) -> Option<String> {
let marker = "deployed at ";
let idx = line.find(marker)?;
let addr = line[idx + marker.len()..].trim();
if addr.starts_with("0x") && addr.len() >= 42 {
Some(addr.to_string())
fn is_valid_hex_address(token: &str) -> bool {
if token.len() != 42 {
return false;
}
if !token.starts_with("0x") {
return false;
}
token[2..].chars().all(|c| c.is_ascii_hexdigit())
}
fn extract_address_from_deployed_line(line: &str) -> Option<String> {
let marker = "deployed at ";
let idx = line.find(marker)?;
let rest = line[idx + marker.len()..].trim();
let first_token = rest.split_whitespace().next()?;
if is_valid_hex_address(first_token) {
Some(first_token.to_string())

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a bad point, but also maybe irrelevant since we control the code; not a bad thing to be as robust as we can though

} else {
None
}
}

/// Convert a contract name to snake_case
/// Examples:
/// - "FilecoinWarmStorageService Implementation" -> "filecoin_warm_storage_service_implementation"
Expand Down
2 changes: 2 additions & 0 deletions src/external_api/devnet_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ pub struct ContractsInfo {
pub filecoin_pay_v1_addr: String,
/// Endorsements contract address
pub endorsements_addr: String,
/// SessionKeyRegistry contract address
pub session_key_registry_addr: String,
}

/// Lotus node information.
Expand Down
3 changes: 3 additions & 0 deletions src/external_api/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ fn build_contracts(ctx: &SetupContext) -> Result<ContractsInfo, Box<dyn std::err
endorsements_addr: ctx
.get("foc_contract_endorsements")
.ok_or("Missing foc_contract_endorsements in context")?,
session_key_registry_addr: ctx
.get("foc_contract_session_key_registry")
.ok_or("Missing foc_contract_session_key_registry in context")?,
})
}

Expand Down
Loading