fix: honour already provided source files when compiling - #2193
Conversation
Signed-off-by: Ivo Kubjas <ivo.kubjas@consensys.net>
Signed-off-by: Ivo Kubjas <ivo.kubjas@consensys.net>
There was a problem hiding this comment.
Pull request overview
This PR updates the ZkC compiler’s include-scanning logic to avoid re-reading source files from the host filesystem when those files were already supplied directly to compiler.Compile(...). This aligns compilation behavior with use cases where callers preload sources (e.g., from an archive or other non-filesystem source) and want includes to resolve without additional filesystem access.
Changes:
- During include scanning, skip filesystem globbing/loading when the included path is already present in
knownSourceFiles. - Canonicalize the include pattern path before checking/deduping against
knownSourceFiles, matching how top-level inputs are keyed.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
@ivokub This is not actually correct. There is a binary "compiled form" for any set of constraints which provides what you want. Specifically, you can run That said, I think this PR is fine and I am happy to merge it. I just wanted to make sure you knew that this was the original intent. |
When we do:
we can already provide all the source files. However, in the pre-PR implementation we still searched the file system for the file when looking for files to link even if it was already provided. This prevents for example embedding the arithmetization into a binary (through an archive or
fs.FSimplementation for example).This PR fixes the case and makes the source file searcher to skip loading files from file system if it is already provided in a call to
compiler.Compile.