Skip to content

Imports Support#95

Open
LesterEvSe wants to merge 10 commits into
devfrom
feature/imports-v2
Open

Imports Support#95
LesterEvSe wants to merge 10 commits into
devfrom
feature/imports-v2

Conversation

@LesterEvSe

Copy link
Copy Markdown
Collaborator
  • This PR suggests a bug fix and I've added the necessary tests.
  • This PR introduces a new feature and I've discussed the update in an Issue or with the team.
  • This PR is just a minor change like a typo fix.

Replaces #69. Now that SimplicityHL natively supports flattening (PR #337) functionality, it made more sense to rewrite this implementation from scratch in a clean PR rather than trying to salvage and rebase the old one

@LesterEvSe LesterEvSe self-assigned this Jun 11, 2026
@LesterEvSe LesterEvSe requested a review from Arvolear as a code owner June 11, 2026 13:06
@LesterEvSe LesterEvSe added the enhancement New feature or request label Jun 11, 2026
@LesterEvSe LesterEvSe linked an issue Jun 11, 2026 that may be closed by this pull request
@LesterEvSe LesterEvSe marked this pull request as draft June 11, 2026 14:23
@LesterEvSe LesterEvSe mentioned this pull request Jun 11, 2026
3 tasks
@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 667340e to 4084ed0 Compare June 11, 2026 15:37
@LesterEvSe LesterEvSe changed the base branch from master to dev June 11, 2026 16:24
@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 4084ed0 to 3cab2bd Compare June 12, 2026 10:44
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/resolver.rs
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/generator.rs Outdated
@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 3cab2bd to e509d10 Compare June 12, 2026 14:41
@LesterEvSe LesterEvSe marked this pull request as ready for review June 15, 2026 10:42
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/config.rs Outdated
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/resolver.rs
Comment thread crates/build/Cargo.toml Outdated
Comment thread fixtures/simf/deps/math/simf/simple_op.simf
Comment thread fixtures/simf/deps/merkle/simf/build_root.simf Outdated
Comment thread crates/build/src/config.rs
Comment thread crates/build/src/config.rs
Comment thread crates/build/src/error.rs
Comment thread crates/build/src/config.rs Outdated
Comment thread crates/build/src/generator.rs Outdated
Comment thread crates/cli/src/commands/install.rs Outdated
Comment thread crates/cli/src/commands/install.rs
Comment thread crates/build/src/resolver.rs
Comment thread crates/build/src/config.rs
#[command(flatten)]
flags: TestFlags,
},
/// Install the simplicity dependency

@Arvolear Arvolear Jun 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/// Install the simplicity dependency
/// Installs a SimplicityHL dependency (requires the dep to be a Simplex project)

Comment on lines +86 to +87
}
installed_repos.push(target_dir.clone());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
}
installed_repos.push(target_dir.clone());
}
installed_repos.push(target_dir.clone());

/// - `Some(PathBuf)` when a repository name can be extracted from the URL.
/// - `None` when the URL is empty or malformed such that no repository name
/// can be determined.
pub fn generate_hashed_repo_path(url: &str) -> Option<PathBuf> {

@Arvolear Arvolear Jun 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's move this function to resolver and rename it to resolve_hashed_repo_path.

/// A temporary context struct to hold global state during recursion.
/// This eliminates the need to pass `builder`, `visited`, and `config_filename`
/// into every single recursive call.
struct DepCollector {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's move this to a separate file and change the interface a bit. Add a pub collect function that calls rec_collect and handles visiting logic internally.

Comment on lines +191 to +192
let nested_deps = DependencyConfig::from_source(&config_source)?;
self.rec_collect(&nested_deps, &loaded_simf_dir, &loaded_context)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
let nested_deps = DependencyConfig::from_source(&config_source)?;
self.rec_collect(&nested_deps, &loaded_simf_dir, &loaded_context)?;
let nested_deps = DependencyConfig::from_source(&config_source)?;
self.rec_collect(&nested_deps, &loaded_simf_dir, &loaded_context)?;

Comment on lines +80 to +81
config.dependencies.validate()?;
Ok(())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
config.dependencies.validate()?;
Ok(())
config.dependencies.validate()?;
Ok(())

@@ -0,0 +1,3 @@
pub fn hash(x: u32, y: u32) -> u32 {
jet::xor_32(x, y)
} No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
}
}

@@ -0,0 +1 @@
pub use hl_compiler::simple_op::hash; No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
pub use hl_compiler::simple_op::hash;
pub use hl_compiler::simple_op::hash;

Comment thread fixtures/simf/p2pk.simf
fn main() {
jet::bip_0340_verify((param::PUBLIC_KEY, jet::sig_all_hash()), witness::SIGNATURE)
}
} No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
}
}

Comment thread fixtures/.gitignore
@@ -1 +1 @@
src/artifacts
src/artifacts No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
src/artifacts
src/artifacts

Comment thread fixtures/Simplex.toml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

let output_dir = ArtifactsResolver::resolve_local_dir(&config.out_dir)?;
let src_dir = ArtifactsResolver::resolve_local_dir(&config.src_dir)?;

// NOTE: Assume that remappings already install

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// NOTE: Assume that remappings already install
// NOTE: Assumes that remappings are already installed

// NOTE: Assume that remappings already install
let dependency_builder = ArtifactsResolver::resolve_remappings(deps, CONFIG_FILENAME)?;

// TODO: For all remappings need to check `files_to_build` and concatenate it to `Vec<Path>`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// TODO: For all remappings need to check `files_to_build` and concatenate it to `Vec<Path>`

Comment thread Cargo.toml

electrsd = { version = "0.29.0", features = ["legacy"] }
simplicityhl = { version = "0.5.0" }
# simplicityhl = { version = "0.5.0" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TODO?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependencies management

2 participants