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

Cannot deploy a SmartContract that uses multiple proofs #629

Closed
emlautarom1 opened this issue Apr 25, 2024 · 2 comments · Fixed by #690
Closed

Cannot deploy a SmartContract that uses multiple proofs #629

emlautarom1 opened this issue Apr 25, 2024 · 2 comments · Fixed by #690
Assignees
Labels
bug Something isn't working

Comments

@emlautarom1
Copy link

Describe the bug

All SmartContracts can use ZkPrograms proofs as inputs, and ZkPrograms can use other ZkPrograms proofs as inputs. Currently, it's impossible to deploy a SmartContract that makes use of such dependency tree.

Steps to Reproduce

  1. Create a basic ZkProgram with a single method. We'll call it Foo.
  2. Create a second ZkProgram that has a single method that takes a Foo proof as input. We'll call it Bar.
  3. Create a SmartContract that uses a Bar proof as input.
  4. Configure the deployment of the contract using the zk config command.
  5. Try to deploy the contract using the zk deploy command.

You should get the following stack trace:

✔ Build project
✔ Generate build.json
✔ Choose smart contract
  The 'MySmartContract' smart contract will be used
  for this deploy alias as specified in config.json.
Debugger attached.
✖ Generate verification key (takes 10-30 sec)
  Error: Bar.compile() depends on Foo, but we cannot find compilation output for Foo.
Try to run Foo.compile() first.
Error: Bar.compile() depends on Foo, but we cannot find compilation output for Foo.
Try to run Foo.compile() first.
    at file:///home/emlautarom1/dev/my-zk-app/node_modules/o1js/dist/node/lib/proof-system.js:432:23
    at Array.map (<anonymous>)
    at picklesRuleFromFunction (file:///home/emlautarom1/dev/my-zk-app/node_modules/o1js/dist/node/lib/proof-system.js:425:36)
    at file:///home/emlautarom1/dev/my-zk-app/node_modules/o1js/dist/node/lib/proof-system.js:299:53
    at Array.map (<anonymous>)
    at compileProgram (file:///home/emlautarom1/dev/my-zk-app/node_modules/o1js/dist/node/lib/proof-system.js:299:29)
    at Object.compile (file:///home/emlautarom1/dev/my-zk-app/node_modules/o1js/dist/node/lib/proof-system.js:150:58)
    at generateVerificationKey (file:///home/emlautarom1/.nvm/versions/node/v21.6.1/lib/node_modules/zkapp-cli/src/lib/deploy.js:551:23)
    at async file:///home/emlautarom1/.nvm/versions/node/v21.6.1/lib/node_modules/zkapp-cli/src/lib/deploy.js:274:7
    at async step (file:///home/emlautarom1/.nvm/versions/node/v21.6.1/lib/node_modules/zkapp-cli/src/lib/helpers.js:17:20)
    at async deploy (file:///home/emlautarom1/.nvm/versions/node/v21.6.1/lib/node_modules/zkapp-cli/src/lib/deploy.js:270:41)
    at async Object.handler (file:///home/emlautarom1/.nvm/versions/node/v21.6.1/lib/node_modules/zkapp-cli/src/bin/index.js:130:30)

On #547 support was added to deploy SmartContracts that use ZkPrograms proofs as inputs but it seems like there was no consideration for dependencies between ZkPrograms during the compilation process.

When testing this smart contract we don't face this issue since we're in control over the compilation order but this is not the case when using the CLI.

System Info

System:
  OS: Linux 6.8 Fedora Linux 39 (Workstation Edition)
  CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Binaries:
  Node: 21.6.1 - ~/.nvm/versions/node/v21.6.1/bin/node
  Yarn: 1.22.21 - /usr/local/bin/yarn
  npm: 10.2.4 - ~/.nvm/versions/node/v21.6.1/bin/npm
npmPackages:
  o1js: ^0.17.0 => 0.17.0 
npmGlobalPackages:
  zkapp-cli: 0.20.0

Severity

blocking all usage

Additional Information

No response

@ymekuria ymekuria added the bug Something isn't working label Apr 25, 2024
@ymekuria
Copy link
Collaborator

Thanks for all your feedback @emlautarom1. I agree the cli deploy needs to be updated to be flexible enough to handle dependency trees similar to what you mentioned.

@Shigoto-dev19
Copy link
Contributor

Issue resolved with the release of the zkapp-cli npm package v0.21.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants