Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that Driver always runs against a consistent language #880

Closed
TomAFrench opened this issue Feb 20, 2023 · 0 comments · Fixed by #881
Closed

Ensure that Driver always runs against a consistent language #880

TomAFrench opened this issue Feb 20, 2023 · 0 comments · Fixed by #881
Labels
enhancement New feature or request

Comments

@TomAFrench
Copy link
Member

Problem

When creating a Driver struct we must pass in an acvm::Language for the NodeInterner to use.

pub fn new(np_language: &acvm::Language) -> Self {
let mut driver = Driver { context: Context::default() };
driver.context.def_interner.set_language(np_language);
driver
}

When we call driver.into_compiled_program we pass in a acvm::Language again.

pub fn into_compiled_program(
mut self,
np_language: acvm::Language,
show_ssa: bool,
allow_warnings: bool,
) -> Result<CompiledProgram, ReportedError> {
self.check_crate(allow_warnings)?;
self.compile_no_check(np_language, show_ssa, allow_warnings, None, true)
}

This seems like it's opening up potential for inconsistent languages to be used which would cause unknown weirdness.

Solution

We should add a private field to Driver to track this language from construction time and stop allowing the language to be passed in to the methods.

Alternatives considered

Additional context

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 a pull request may close this issue.

1 participant