snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

[Bug] Cannot deploy programs that contain imports

Open HarukaMa opened this issue 2 years ago • 4 comments

🐛 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

HarukaMa avatar Feb 16 '23 09:02 HarukaMa

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

ljedrz avatar Feb 16 '23 12:02 ljedrz

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 avatar Feb 16 '23 12:02 HarukaMa

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

HarukaMa avatar Feb 26 '23 19:02 HarukaMa

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.

howardwu avatar Dec 17 '23 23:12 howardwu