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

chore: Debug log oracle calls return nothing #6209

Merged
merged 2 commits into from
May 7, 2024

Conversation

spalladino
Copy link
Collaborator

After noir-lang/noir#4959 lands in aztec-packages, we should be able to keep debug_log calls in protocol-circuits without breaking nargo test there. A prerequisite for that is ensuring that debug log calls do not return anything. I understand they were returning zero because of legacy issues, but according to @TomFrench that should not be needed.

This PR updates debug calls so they return no values.

return [result];
return Array.isArray(result) && result.length === 0 ? [] : [result];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without this change, ACVM complained with Assertion failed: 1 output values were provided as a foreign call result for 0 destination slots

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm seems like this breaks other calls:

          +e2e-tests *failed* |     Simulation error: Assertion failed: 0 output values were provided as a foreign call result for 1 destination slots 'call_public_function_oracle(
          +e2e-tests *failed* |             contract_address,
          +e2e-tests *failed* |             function_selector,
          +e2e-tests *failed* |             args_hash,
          +e2e-tests *failed* |             side_effect_counter,
          +e2e-tests *failed* |             is_static_call,
          +e2e-tests *failed* |             is_delegate_call
          +e2e-tests *failed* |         )'

Any tips on how to fix? I don't have a firm grasp on (ie I have no idea) how ACVM expects the callback return values.

Copy link
Contributor

@sirasistant sirasistant May 7, 2024

Choose a reason for hiding this comment

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

I think that our oracle resolver doesn't handle very well returning more/less than 1 result (that result being a value or an array).
ACVM oracles expect returns to be an array of ValueOrArray. So for example if you are returning an array of fields, the ACVM expects [array]. If you are returning a struct with a field and an array, it'd be [field, array]. I think our typed oracle stuff assumes always returning one item, it being a field or an array.
It needs some updating!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think our typed oracle stuff assumes always returning one item, it being a field or an array.

Got it, so the issue is exclusively on the side of aztec-packages then, right? I can give it a shot.

After noir-lang/noir#4959 lands in
aztec-packages, we should be able to keep debug_log calls in
protocol-circuits without breaking nargo test there. A prerequisite for
that is ensuring that debug log calls do not return anything. I
understand they were returning zero because of legacy issues, but
according to @TomFrench that should not be needed.

This PR updates debug calls so they return no values.
@spalladino spalladino force-pushed the chore/no-output-for-debug-logs branch from 7edeaf2 to cf815ad Compare May 7, 2024 12:19
@spalladino
Copy link
Collaborator Author

@sirasistant the issue is now fixed and CI is green. Could I ask for a review..?

@spalladino spalladino enabled auto-merge (squash) May 7, 2024 14:48
Copy link
Contributor

@sirasistant sirasistant left a comment

Choose a reason for hiding this comment

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

Perfect, thanks! 🥳

@spalladino spalladino merged commit 151d3a3 into master May 7, 2024
68 checks passed
@spalladino spalladino deleted the chore/no-output-for-debug-logs branch May 7, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants