AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.28k stars 2.61k forks source link

[Bug] Cannot deploy programs that contain imports #2257

Open HarukaMa opened 1 year ago

HarukaMa commented 1 year ago

🐛 Bug Report

Title.

Single file programs works as intended.

Steps to Reproduce

Use battleship in the workshop repo as an example:

$ ./snarkos developer deploy --path ~/src/workshop/battleship/build -p APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH -r "{  owner: aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px.private,  gates: 34375000000000u64.private,  _nonce: 5390133846023652488295956021531152578934221546674152157269813078137639717941group.public}" -q http://127.0.0.1:3030 -b http://127.0.0.1:3030/testnet3/transaction/broadcast battleship.aleo

📦 Creating deployment transaction for 'battleship.aleo'...

⚠️  Cannot add program 'battleship.aleo' because its import 'board.aleo' must be added first

(that private key is devnet beacon key so it's public. ...GPWH)

Expected Behavior

Your Environment

Latest

ljedrz commented 1 year ago

Has board.aleo been deployed yet? Possibly related: https://github.com/AleoHQ/snarkVM/issues/1089.

HarukaMa commented 1 year ago

Then the deploy command cannot deploy the imported program beforehand as it's not listed in the program manifest. Having to do that manually also sounds very strange if the imported program is only being introduced and used in the program that's being deployed.

I think the command should deploy the programs in the import folder first, automatically.

HarukaMa commented 1 year ago

So I tried to deploy the imported program first (explorer), then when I tried to deploy the main program, I'm still being told that

📦 Creating deployment transaction for 'explorer_test.aleo'...

⚠️  Cannot add program 'explorer_test.aleo' because its import 'explorer_test_ext.aleo' must be added first
howardwu commented 9 months ago

The imports are supposed to be deployed first (separately). This will become better structured once we have a registry/manager in place on the CLI level. Something I think will take priority after mainnet.