You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// DOES NOT COMPILE
global MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX:u32 = 32 - 1;// COMPILES// global MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX: u32 = 31;
Expected Behavior
global Foo: u32 = 32 - 1; should evaluate to a constant and behave equivalently to global Foo: u32 = 31;
Bug
Currently, it appears that multiple errors are being thrown and only some of them are making it to the user:
When running on master, it fails with two groups of errors:
Global failed to resolve:
error: Cannot find a global or generic type parameter named `plain::MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX`
┌─ /Users/michaelklein/Coding/rust/aztec-packages/noir-projects/noir-protocol-circuits/crates/types/src/abis/accumulated_data/combined_accumulated_data.nr:23:67
│
23 │ sorted_public_data_update_requests: [PublicDataUpdateRequest; MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX],
│ -------------------------------------- Only globals or generic type parameters are allowed to be used as an array type's length │
Array length failed to resolve (and defaulted to 0):
When using --use-elaborator, it fails with other errors (known to occur in the elaborator):
error: duplicate definitions of to_field found
┌─ /Users/michaelklein/Coding/rust/aztec-packages/noir-projects/noir-protocol-circuits/crates/types/src/address/public_keys_hash.nr:9:8
│
9 │ fn to_field(self) -> Field {
│ -------- first definition found here
·
37 │ pub fn to_field(self) -> Field {
│ -------- second definition found here
..
error: No method named 'serialize' found fortype'PublicCircuitPublicInputs'
┌─ /Users/michaelklein/Coding/rust/aztec-packages/noir-projects/noir-protocol-circuits/crates/types/src/abis/public_circuit_public_inputs.nr:156:23
│
156 │ pedersen_hash(self.serialize(), GENERATOR_INDEX__PUBLIC_CIRCUIT_PUBLIC_INPUTS)
│ ----------------
│
error: No method named 'serialize' found fortype'GlobalVariables'
┌─ /Users/michaelklein/Coding/rust/aztec-packages/noir-projects/noir-protocol-circuits/crates/types/src/header.nr:38:34
│
38 │ fields.extend_from_array(self.global_variables.serialize());
│ ---------------------------------
To Reproduce
checkout fun-with-constants-2
modify this line in bootstrap.sh to point to nargo on master
Worth noting the elaborator errors have since been fixed. #5246 has just merged as well, so the elaborator is now the default. I've verified the code in question tests successfully on current master
Going to close this issue due to the comment above. I don't think we need to spend time debugging code that only fails while using the legacy compiler passes.
Aim
Attempting to compile
noir-protocol-circuits
'types
package with Jan's modifications:https://github.com/AztecProtocol/aztec-packages/blob/fun-with-constants-2/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr#L50
Expected Behavior
global Foo: u32 = 32 - 1;
should evaluate to a constant and behave equivalently toglobal Foo: u32 = 31;
Bug
Currently, it appears that multiple errors are being thrown and only some of them are making it to the user:
When running on
master
, it fails with two groups of errors:0
):When using
--use-elaborator
, it fails with other errors (known to occur in the elaborator):To Reproduce
fun-with-constants-2
bootstrap.sh
to point tonargo
on masteraztec-packages/noir-projects/noir-protocol-circuits/bootstrap.sh
Project Impact
Blocker
Impact Context
Currently blocking AztecProtocol/aztec-packages#6817
Workaround
Yes
Workaround Description
Manually calculate and replace the
32 - 1
with31
Additional Context
No response
Installation Method
None
Nargo Version
No response
NoirJS Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: