hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
307 stars 141 forks source link

Support deployment plan generation without a mnemonic #1003

Open leahjlou opened 1 year ago

leahjlou commented 1 year ago

When running the clarinet deployment generate command, clarinet uses the deployer's mnemonic in settings/<Network>.toml under [accounts.deployer].

We'd like to be able to use deployment generation within the Platform without needing to store a mnemonic. We don't need the deployer info in the deployment plan yaml file anyway, since we are running the deploy steps from the browser using the Hiro Wallet extension.

I discovered that if you don't pass any mnemonic and just include [accounts.deployer] with a blank line underneath in the settings/ toml file, the deployment plan is generated anyway without a deployer principal. This will work for the Platform's purposes.

My question is: can this behavior in clarinet be relied on? Is this workaround considered a bug, or something that will be changed in Clarinet without realizing it'll affect the platform? If so, perhaps there should be a more explicit option to omit the deployer address in the deployment plan.

smcclellan commented 1 year ago

Task: Include test in clarinet for empty accounts.deployer.

leahjlou commented 1 year ago

We have a user running into some confusion with this. The deployment plan generation works when the settings Toml file has a line [accounts.deployer] with no mnemonic below, but it does not work without the [accounts.deployer] line.

Here is an example of a Testnet.toml that works:

[network]
name = "testnet"
stacks_node_rpc_address = "https://stacks-node-api.testnet.stacks.co"
deployment_fee_rate = 10

[accounts.deployer]

But this one:

[network]
name = "testnet"
stacks_node_rpc_address = "https://stacks-node-api.testnet.stacks.co"
deployment_fee_rate = 10

yields an error, "unable to retrieve default deployer account".

To reduce user confusion in the platform, can we have clarinet behave the same way if there is no line with [accounts.deployer] at all vs when there is an empty [accounts.deployer]?

lgalabru commented 1 year ago

yes, we could definitely do that. related, https://github.com/hirosystems/clarinet/issues/1059 can be an opportunity to get some adjustments making your life easier.

leahjlou commented 1 year ago

To add to this, it would be great if Clarinet could gracefully handle when the default <YOUR PRIVATE TESTNET MNEMONIC HERE> mnemonic is present (and just ignore it). This is something we've seen a couple users run into in the Platform -- they have the default mnemonic and get the message error: mnemonic for wallet 'deployer' invalid: mnemonic has a word count that is not a multiple of 6: 5, but in the Platform we want to be able to generate a deployment plan with no deployer principal.

Maybe the clarinet deployment generate command could accept an option to not expect/use a mnemonic when generating a plan?