-
Notifications
You must be signed in to change notification settings - Fork 683
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
Directive: Early binding of names to contracts #1078
Comments
Names are unique within the context of the principal that created the smart contract. If your address is
In the near future, this will be done within a transaction. So, the developer will be supplying the contract name plus one or more private keys. The key(s), in turn, will be used to derive the address prefix above. Within the contracts deployed by the same keys (e.g. within all contracts deployed by If I deploy a separate contract
I agree that traceability is a legitimate concern. However, I don't currently believe that this is something Clarity needs to address (but am open to being convinced otherwise). I'll have to think more about this. |
I don't think this is the right way to go about this. This information is already captured in the current naming scheme Without gaining or losing safety, developers are free to adopt a convention for naming different versions of a contract or public function (or even data maps and variables). For example, I could have |
Ok, I missed that part, thank you for clarifying. |
Yep -- I think the proposed naming scheme of { pub-key-hash } . { chosen-name } takes care of most of this. As far as versioning goes, I think we should punt on that. |
I still think that providing the name of the contract at deploy time is a fragile flow where there's a too much room for human errors (typos, contract name intertwining, etc).
Sure, but a wallet can't build a version history + traceability, which is something that would definitely be a game changer, compared to other smart contract languages. |
I think we should think more about having an "early binding" on contract names. If we put them into the contract source itself, then the CLI tool can do an end-to-end check across a set of contracts to verify that all contract names are still available. |
|
One thing that we should be sure to do: This struct will also be used to enforce any constraints on contract names (name length, etc.). |
No. The contract name is defined outside of the contract code body (i.e. the type variant that encodes a transaction that instantiates a smart contract has a separate "name" field that will include the developer-given name, sans address). The fully-qualified name is derived from both the standard principal that sent the transaction, and the name given in the transaction. |
Addressed with #1105 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I’d like to improve the way we’re handling contract identification, deployment + dependency management.
#### Name being uniqueI think I’m concerned by the scarcity of contract's names. Developers will rush their contracts for getting the right name, or worst, the common names will be squatted with dangerous contracts (“token”, “blockstack”, “admin”, etc).
I'm having a hard time seeing the upsides.
Developer experience at deployment
I’m also concerned by deployment flows, being error prone.
At this point, if my understanding of the flow is correct, when a developer wants to deploy a contract, he would have to specify the name of his contract at deploy time, from the CLI.
Let’s consider the following scenario: I have 2 contracts,
rocket-factory
androcket-market
, with the lattercontract-call
-ing the former.My contracts are ready, tested, they’ve been audited, light is green for a deployment on main-net.
I’m trying to deploy
rocket-market
, but bummer, the name is already taken. I have to find another name + try again. If it worked, I'll have to manually editrocket-factory
, and update the name. Cherry on-top, my project is "git dirty", and thesha
deployed won’t match with thesha
audited.I’m concerned by the fact that there’s some room for a human error, at deploy time (the most stressful step).
Lack of versioning
Deploying a fixed version of a flawed contract is part of the real life. I'm obviously not saying that we should update the contract, but we should provide traceability, and be able to say that a contract B is a newer version of contract A.
As a user interacting with a contract, I'd like to be able to look at the history of that contract, and if for some reason, I'm not interacting with the latest version, or if one of the contract being called is not pointing to the latest and greatest version, I'd like to get a huge warning from the wallet interface
Here is my suggestion:
We can require a manifest / header in the contract for:
If your contract include a
contract-call
, then adefine-dependency
must be included, fully qualifying the contract you’d like to call: owner principal + name + version.You would end up with something like this:
The text was updated successfully, but these errors were encountered: