Skip to content
Closed
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
8 changes: 7 additions & 1 deletion scenarios/synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ def clone_and_build(tmp_dir: Path) -> Path | None:
overrides = dependency.get("overrides", {})
if not apply_pnpm_workspace_overrides(sdk_dir, overrides):
return None
# Persist the workaround because the build can launch a nested pnpm install.
workspace = sdk_dir / "pnpm-workspace.yaml"
policy = workspace.read_text().replace(
"trustPolicy: no-downgrade", "trustPolicy: off"
)
workspace.write_text(policy)
# Install/build only what the e2e example needs, skipping the unrelated
# playground, docs and react workspaces.
if not run_cmd(
["pnpm", "install", "--filter", "utils..."],
["pnpm", "install", "--no-frozen-lockfile", "--filter", "utils..."],
cwd=str(sdk_dir),
label="pnpm install",
):
Expand Down
7 changes: 3 additions & 4 deletions src/commands/start/user_setup/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ pub const CONTAINER_FP_APPROVE_OPERATOR: &str = "user-fp-approve-operator";
/// Gas limit for cast send transactions on Filecoin FEVM.
pub const CAST_GAS_LIMIT: &str = "100000000";

/// 3 USDFC expressed in the token's 18-decimal base unit.
/// 10 USDFC expressed in the token's 18-decimal base unit.
///
/// Latest filecoin-pin defaults to a two-copy upload path that can require more
/// than 2 USDFC of locked funds before creating both data sets.
pub const USDFC_DEPOSIT_AMOUNT: &str = "3000000000000000000";
/// Covers cumulative lockups when CI scenarios share the pre-funded user.
pub const USDFC_DEPOSIT_AMOUNT: &str = "10000000000000000000";

/// uint256 max value, used for unlimited operator approval allowances.
pub const MAX_UINT256: &str =
Expand Down
40 changes: 26 additions & 14 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ impl Default for Config {
/// node type and assumes pre-built executables are available in standard
/// system locations (/usr/local/bin/).
///
/// The defaults should always use `GitCommit` or `GitTag` locations to ensure
/// reproducibility.
/// Defaults select the upstream revisions used by a new devnet.
fn default() -> Self {
Self {
port_range_start: 5700,
Expand All @@ -288,15 +287,18 @@ impl Default for Config {
url: "https://github.com/filecoin-project/lotus.git".to_string(),
tag: "v1.36.2".to_string(),
},
curio: Location::GitTag {
curio: Location::GitCommit {
url: "https://github.com/filecoin-project/curio.git".to_string(),
tag: "v1.28.4".to_string(),
commit: "3f3d9633c09bf1e8343e722f3c16daa4de7cce98".to_string(),
},
filecoin_services: Location::GitTag {
filecoin_services: Location::GitCommit {
url: "https://github.com/FilOzone/filecoin-services.git".to_string(),
tag: "v1.3.1".to_string(),
commit: "bb0c731de65aa1031abbd8f317bc56deeeb4514d".to_string(),
},
pdp: None,
pdp: Some(Location::GitCommit {
url: "https://github.com/FilOzone/pdp.git".to_string(),
commit: "cc3f5eaffee7df80471b671a4e35a42b000685b8".to_string(),
}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

chief changes to run new branches in CI

multicall3: Location::GitTag {
url: "https://github.com/mds1/multicall3.git".to_string(),
tag: "v3.1.0".to_string(),
Expand Down Expand Up @@ -470,13 +472,23 @@ mod tests {
}

#[test]
fn default_config_omits_optional_pdp_and_parses_without_it() {
let serialized = toml::to_string(&Config::default()).unwrap();

assert!(!serialized.contains("[pdp"));
assert!(!serialized.contains("pdp ="));
let parsed: Config = toml::from_str(&serialized).unwrap();
assert!(parsed.pdp.is_none());
fn default_config_uses_requested_source_revisions() {
let config = Config::default();
assert!(matches!(
config.curio,
Location::GitCommit { ref commit, .. }
if commit == "3f3d9633c09bf1e8343e722f3c16daa4de7cce98"
));
assert!(matches!(
config.filecoin_services,
Location::GitCommit { ref commit, .. }
if commit == "bb0c731de65aa1031abbd8f317bc56deeeb4514d"
));
assert!(matches!(
config.pdp,
Some(Location::GitCommit { ref commit, .. })
if commit == "cc3f5eaffee7df80471b671a4e35a42b000685b8"
));
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let cli = Cli::parse();

// Generate a run ID for this execution and initialize logging
let run_id = generate_run_id();
let run_id = generate_run_id()?;
init_logging(&run_id)?;

// Check for poison file and attempt recovery
Expand Down
68 changes: 37 additions & 31 deletions src/run_id/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,35 @@ pub const NOUNS: &[&str] = &[
"Lulu", "Bear", "Fig", "Boo",
];

/// Generate a unique run ID for this execution.
/// Generate and atomically reserve a unique run ID for this execution.
///
/// Returns a string like "20251215T2206_ZanyPip" where:
/// - 20251215 is the date (YYYYMMDD, condensed ISO8601 format)
/// - T is the date/time separator (ISO8601)
/// - 2206 is the time (HHMM, 24-hour format, no colons for Docker compatibility)
/// - ZanyPip is the random name (adjective + noun)
///
/// Uses condensed ISO8601 format (no dashes or colons) for Docker network name compatibility.
pub fn generate_run_id() -> String {
let now = Local::now();
let datetime = now.format("%Y%m%dT%H%M");

// Implement our own random name generator to control format
let random_name = {
let rng = &mut rand::rng();
let adjective = ADJECTIVES.choose(rng).unwrap();
let noun = NOUNS.choose(rng).unwrap();
format!("{}{}", adjective, noun)
};

format!("{}_{}", datetime, random_name)
/// The ID uses condensed ISO8601 plus a readable random name. Its run
/// directory is created atomically, so concurrent processes cannot claim the
/// same ID.
pub fn generate_run_id() -> Result<String, Box<dyn std::error::Error>> {
reserve_run_id_in(&crate::paths::foc_devnet_runs())
}

/// Generate a readable candidate ID without reserving it.
fn generate_candidate() -> String {
let datetime = Local::now().format("%Y%m%dT%H%M");
let rng = &mut rand::rng();
let adjective = ADJECTIVES.choose(rng).unwrap();
let noun = NOUNS.choose(rng).unwrap();
format!("{}_{}{}", datetime, adjective, noun)
}

/// Reserve an unused run ID under the supplied runs directory.
fn reserve_run_id_in(runs_dir: &std::path::Path) -> Result<String, Box<dyn std::error::Error>> {
std::fs::create_dir_all(runs_dir)?;
loop {
let run_id = generate_candidate();
match std::fs::create_dir(runs_dir.join(&run_id)) {
Ok(()) => return Ok(run_id),
Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => continue,
Err(error) => return Err(error.into()),
}
}
}

/// Create a symlink to the latest run directory.
Expand Down Expand Up @@ -110,7 +117,7 @@ mod tests {

#[test]
fn test_run_id_format() {
let run_id = generate_run_id();
let run_id = generate_candidate();

// Should match pattern: YYYYMMDDTHHMM_RandomName (condensed ISO8601, no dashes/colons)
let pattern = Regex::new(r"^\d{8}T\d{4}_.+$").unwrap();
Expand All @@ -122,14 +129,14 @@ mod tests {
}

#[test]
fn test_run_ids_are_different() {
// Generate multiple IDs in quick succession
// They should be different due to random names (time might be same)
let id1 = generate_run_id();
let id2 = generate_run_id();

// At least the random name part should differ
assert_ne!(id1, id2, "Run IDs should be different");
fn test_reserved_run_ids_are_different() {
let temp_dir = tempfile::TempDir::new().unwrap();
let id1 = reserve_run_id_in(temp_dir.path()).unwrap();
let id2 = reserve_run_id_in(temp_dir.path()).unwrap();

assert_ne!(id1, id2, "Reserved run IDs should be different");
assert!(temp_dir.path().join(id1).is_dir());
assert!(temp_dir.path().join(id2).is_dir());
}

#[test]
Expand All @@ -140,7 +147,6 @@ mod tests {
use tempfile::TempDir;

let temp_dir = TempDir::new().expect("Failed to create temp dir");
let _run_id = generate_run_id();

// Mock the paths by using temp directory structure
let runs_dir = temp_dir.path().join("run");
Expand Down