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

[Bug] SDK deploy does not catch "existing program with the same name" #740

Open
onetrickwolf opened this issue Sep 13, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@onetrickwolf
Copy link
Collaborator

onetrickwolf commented Sep 13, 2023

🐛 Bug Report

https://github.com/AleoHQ/sdk/blob/testnet3/sdk/src/program-manager.ts#L149

This code does not throw properly if the program name already exists meaning the user won't know the program can't be deployed until after the lengthy deployment transaction build and response from the node.

Steps to Reproduce

  1. Attempt to deploy program with existing name from SDK
  2. Error in code linked above will never throw

Stack trace & error message

Failed due to duplicate name:

client.ts:18 [vite] connecting...
client.ts:150 [vite] connected.
function-key-provider.ts:331 Fetching proving keys from url https://testnet3.parameters.aleo.org/fee.prover.36542ce
function-key-provider.ts:333 Fetching verifying keys from url https://testnet3.parameters.aleo.org/fee.verifier.2de311b
aleo_wasm.js?v=fed4bba1:2889 Creating deployment transaction
aleo_wasm.js?v=fed4bba1:2889 Checking program has a valid name
aleo_wasm.js?v=fed4bba1:2889 Checking program imports are valid and add them to the process
aleo_wasm.js?v=fed4bba1:2889 Creating deployment
aleo_wasm.js?v=fed4bba1:2889 Ensuring the fee is sufficient to pay for the deployment
aleo_wasm.js?v=fed4bba1:2889 Inserting externally provided fee proving and verifying keys
aleo_wasm.js?v=fed4bba1:2889 Executing fee program
aleo_wasm.js?v=fed4bba1:2889 Verifying fee execution
aleo_wasm.js?v=fed4bba1:2889 Verifying the deployment and fees
aleo_wasm.js?v=fed4bba1:2889 Creating deployment transaction
App.jsx:38 Error: Error posting transaction. Aleo network response: "Something went wrong: Deployment verification failed: Program 'hello_hello.aleo' already exists"
    at AleoNetworkClient.<anonymous> (@aleohq_sdk.js?v=fed4bba1:2840:17)
    at Generator.throw (<anonymous>)
    at rejected (@aleohq_sdk.js?v=fed4bba1:20:32)

Success:

[vite] connecting...
client.ts:150 [vite] connected.
function-key-provider.ts:331 Fetching proving keys from url https://testnet3.parameters.aleo.org/fee.prover.36542ce
network-client.ts:367 Uncaught (in promise) Error: Error fetching program
    at AleoNetworkClient.<anonymous> (network-client.ts:367:13)
    at Generator.throw (<anonymous>)
    at rejected (tslib.es6.mjs:119:62)
(anonymous) @ network-client.ts:367
rejected @ tslib.es6.mjs:119
Promise.then (async)
step @ tslib.es6.mjs:120
(anonymous) @ tslib.es6.mjs:121
__awaiter @ tslib.es6.mjs:117
getProgram @ network-client.ts:363
(anonymous) @ program-manager.ts:143
(anonymous) @ tslib.es6.mjs:121
__awaiter @ tslib.es6.mjs:117
deploy @ program-manager.ts:136
deployProgram @ worker.js?type=module&worker_file:66
callback @ comlink.ts:329
Show 11 more frames
Show less
function-key-provider.ts:333 Fetching verifying keys from url https://testnet3.parameters.aleo.org/fee.verifier.2de311b
aleo_wasm.js?v=fed4bba1:2889 Creating deployment transaction
aleo_wasm.js?v=fed4bba1:2889 Checking program has a valid name
aleo_wasm.js?v=fed4bba1:2889 Checking program imports are valid and add them to the process
aleo_wasm.js?v=fed4bba1:2889 Creating deployment
aleo_wasm.js?v=fed4bba1:2889 Ensuring the fee is sufficient to pay for the deployment
aleo_wasm.js?v=fed4bba1:2889 Inserting externally provided fee proving and verifying keys
aleo_wasm.js?v=fed4bba1:2889 Executing fee program
aleo_wasm.js?v=fed4bba1:2889 Verifying fee execution
aleo_wasm.js?v=fed4bba1:2889 Verifying the deployment and fees
aleo_wasm.js?v=fed4bba1:2889 Creating deployment transaction
App.jsx:38 Error: Error fetching transaction.
    at AleoNetworkClient.<anonymous> (@aleohq_sdk.js?v=fed4bba1:2770:15)
    at Generator.throw (<anonymous>)
    at rejected (@aleohq_sdk.js?v=fed4bba1:20:32)

Despite error at end, deploying succeeded. Error is from node not having transaction available yet.

Expected Behavior

Should fail immediately, need to check how errors are bubbling up.

Your Environment

@aleohq/sdk: 0.5.10
MacOS

@onetrickwolf onetrickwolf added the bug Something isn't working label Sep 13, 2023
@onetrickwolf onetrickwolf self-assigned this Sep 13, 2023
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

No branches or pull requests

1 participant