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

fix: Complete JS call stacks across ACVM wasm boundaries #2013

Merged
merged 9 commits into from
Sep 5, 2023

Conversation

sirasistant
Copy link
Collaborator

@sirasistant sirasistant commented Sep 5, 2023

Wasm callback errors don't contain complete javascript stack traces. This PR refactors ExecutionError so it's only used wrapping a complete simulation, and adds code to patch the stack traces across ACVM boundaries

  ● e2e_nested_contract › parent manually calls child › fails simulation if calling a public function not allowed to be called externally

    Simulation error: Assertion failed: Sender must be this contract 'assert_eq(call_context.msg_sender, call_context.storage_contract_address, "Sender must be this contract");'

      at assert_eq(call_context.msg_sender, call_context.storage_contract_address, "Sender must be this contract"); (../../noir-contracts/src/contracts/child_contract/src/main:24:9)
      at check_sender(inputs.call_context); (../../noir-contracts/src/contracts/child_contract/src/main:70:9)
      at Child.pubIncValueInternal

    Cause:
    Assertion failed: Sender must be this contract

      at Object.<anonymous>.module.exports.__wbg_constructor_bd3b1e64af832aae (../../node_modules/acvm_js/nodejs/acvm_js.js:554:17)
      at null.<anonymous> (../wasm:/wasm/00af2376:1:168516)
      at null.<anonymous> (../wasm:/wasm/00af2376:1:526459)
      at null.<anonymous> (../wasm:/wasm/00af2376:1:566265)
      at null.<anonymous> (../wasm:/wasm/00af2376:1:683042)
      at __wbg_adapter_54 (../../node_modules/acvm_js/nodejs/acvm_js.js:229:10)
      at real (../../node_modules/acvm_js/nodejs/acvm_js.js:214:20)Error:
      at ../../acir-simulator/src/acvm/acvm.ts:160:19
      at acvm (../../acir-simulator/src/acvm/acvm.ts:133:26)
      at PublicExecutor.execute (../../acir-simulator/src/public/executor.ts:80:32)
      at PublicExecutor.simulate (../../acir-simulator/src/public/executor.ts:60:14)
      at PublicProcessor.processEnqueuedPublicCalls (../../sequencer-client/src/sequencer/public_processor.ts:180:45)
      at PublicProcessor.processTx (../../sequencer-client/src/sequencer/public_processor.ts:142:83)
      at PublicProcessor.process (../../sequencer-client/src/sequencer/public_processor.ts:119:21)
      at AztecNodeService.simulatePublicCalls (../../aztec-node/src/aztec-node/server.ts:405:27)
      at AztecRPCServer._AztecRPCServer_simulatePublicCalls (../../aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts:397:7)
      at AztecRPCServer.simulateTx (../../aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts:197:25)
      at ContractFunctionInteraction.simulate (../../aztec.js/src/contract/base_contract_interaction.ts:45:15)
      at Object.<anonymous> (e2e_nested_contract.test.ts:72:7)

Checklist:

Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.

  • If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag.
  • I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code.
  • Every change is related to the PR description.
  • I have linked this pull request to relevant issues (if any exist).

@sirasistant sirasistant marked this pull request as ready for review September 5, 2023 14:34
@sirasistant sirasistant requested review from ludamad and LeilaWang and removed request for ludamad and LeilaWang September 5, 2023 14:34
@sirasistant sirasistant marked this pull request as draft September 5, 2023 14:38
@sirasistant sirasistant marked this pull request as ready for review September 5, 2023 14:54
@sirasistant sirasistant enabled auto-merge (squash) September 5, 2023 16:07
@sirasistant sirasistant merged commit 8e84e46 into master Sep 5, 2023
@sirasistant sirasistant deleted the arv/execution_error_stack branch September 5, 2023 16:17
PhilWindle pushed a commit that referenced this pull request Sep 5, 2023
🤖 I have created a new Aztec Packages release
---


##
[0.1.0-alpha52](v0.1.0-alpha51...v0.1.0-alpha52)
(2023-09-05)


### Features

* **docs:** set up noir contracts in getting-started
([#1770](#1770))
([33eb99d](33eb99d))


### Bug Fixes

* Complete JS call stacks across ACVM wasm boundaries
([#2013](#2013))
([8e84e46](8e84e46))
* deploy_ecr calculating CONTENT_HASH
([#2024](#2024))
([edee198](edee198))
* Option to fail silently when retrying
([#2015](#2015))
([453c9c1](453c9c1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants