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

Alias is currently overwrote with no warning #1417

Open
willemneal opened this issue Jun 28, 2024 · 3 comments
Open

Alias is currently overwrote with no warning #1417

willemneal opened this issue Jun 28, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@willemneal
Copy link
Member

Currently when reusing an alias it will overwrite the old contract id. Should we add a --force flag to allow this but fail otherwise?

@willemneal willemneal added the bug Something isn't working label Jun 28, 2024
@fnando
Copy link
Member

fnando commented Jun 28, 2024

The original implementation had --force, but Leigh suggested to always replace the contract id. Is there any real case where you wouldn't want to persist the latest contract id?

#1356 (comment)

@leighmcculloch
Copy link
Member

leighmcculloch commented Jul 11, 2024

My feedback was that --force is confusing because it doesn't communicate the scope of what is being forced. An option like --force should be focused on the primary action being performed by a command which in this case is deploying the contract, and not related to an ancillary action being performed like saving an alias. Why: It's natural to see options related to their primary action. For example, if we add --force, this command looks like it forces deployment but is actually invalid:

$ stellar contract deploy --wasm ... --force

Or this command which is valid but I think most folks would assume means deployment is forced and the force is unrelated to the alias:

$ stellar contract deploy --wasm ... --force --alias c1

If we want aliases to not overwrite by default, then I think the path that results in a clearer API is:

  1. Disallow overriding and add no options for overwriting
  2. Add a rm command for removing the alias

@leighmcculloch
Copy link
Member

I expect that someone interacting with a pubnet network is probably keeping a record of their contract addresses concretely somewhere that isn't just in these aliases given that it is a production use case, and that these aliases are more useful during development, in which case overwriting feels fine. We overwrite elsewhere.

We could output a log line, or a stderr output saying the alias is being ovewritten and what the old value was and new value, so if someone accidentally ovewrites they can fix it.

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
Status: Backlog (Not Ready)
Development

No branches or pull requests

3 participants