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

Pull information on opcode support and the language used by the backend at runtime #2564

Closed
Tracked by #2164
TomAFrench opened this issue Sep 5, 2023 · 0 comments · Fixed by #2563
Closed
Tracked by #2164
Assignees
Labels
enhancement New feature or request

Comments

@TomAFrench
Copy link
Member

Problem

acvm-backend-barretenberg currently bakes in knowledge about barretenberg in so far as it reports that all opcodes are supported and that we're producing a plonkish proof with width 3.

This isn't general across all potential backends as we also support compiling down to a R1CS, etc.

Happy Case

We should make a call to the backend and construct a (Language, Box<impl Fn(&Opcode) -> bool>) which can then be passed back and down into ACVM during circuit transformation.

This will replace the usage of these methods:

pub fn np_language(&self) -> Language {
Language::PLONKCSat { width: 3 }
}

pub fn supports_opcode(&self, opcode: &Opcode) -> bool {
match opcode {
Opcode::Arithmetic(_) => true,
Opcode::Directive(_) => true,
Opcode::Brillig(_) => true,
Opcode::MemoryInit { .. } => true,
Opcode::MemoryOp { .. } => true,
Opcode::BlackBoxFuncCall(func) => match func.get_black_box_func() {
BlackBoxFunc::AND
| BlackBoxFunc::XOR
| BlackBoxFunc::RANGE
| BlackBoxFunc::SHA256
| BlackBoxFunc::Blake2s
| BlackBoxFunc::Keccak256
| BlackBoxFunc::SchnorrVerify
| BlackBoxFunc::Pedersen
| BlackBoxFunc::HashToField128Security
| BlackBoxFunc::EcdsaSecp256k1
| BlackBoxFunc::EcdsaSecp256r1
| BlackBoxFunc::FixedBaseScalarMul
| BlackBoxFunc::RecursiveAggregation => true,
},
}
}

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

Yes

Support Needs

No response

@TomAFrench TomAFrench added the enhancement New feature or request label Sep 5, 2023
@TomAFrench TomAFrench self-assigned this Sep 5, 2023
@TomAFrench TomAFrench added this to Noir Sep 5, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 5, 2023
@TomAFrench TomAFrench changed the title [Retroactive] Pull information on opcode support and the language used by the backend at runtime Pull information on opcode support and the language used by the backend at runtime Sep 5, 2023
@TomAFrench TomAFrench moved this from 📋 Backlog to 🏗 In progress in Noir Sep 5, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Sep 7, 2023
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
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant