kadena-io / pact

The Pact Smart Contract Language
https://docs.kadena.io/build/pact
BSD 3-Clause "New" or "Revised" License
581 stars 99 forks source link

Improve error messages for keyset failures and module load in the web-repl #461

Closed mercadoa closed 3 years ago

mercadoa commented 5 years ago

When you deploy a contract, the module names and keyset names must be unique. If they already exist, then you need to have the right keys.

This interacts poorly with example contracts because example contracts are using the same module and keyset names for everyone. It's a pretty big usability problem because the obvious user path is broken once the contract has been deployed once. Even if you are the person who originally uploaded the contract, it's not at all obvious which keys you need to sign with.

We can make the error considerably more verbose, no harm in that. Currently Pact thinks you're trying to rotate the keyset, and enforces the old one, so you get a cryptic error; for modules it thinks you're trying to upgrade. We can easily improve these, such that define-keyset errors out with "Keyset redefinition failed: the keyset admin-keyset is already defined and cannot be rotated by the signatories of the current transaction. Either use a unique keyset name, or to redefine this keyset, sign the transaction with keys that will satisfy the old keyset." Likewise with module, we can say "Module redefinition failed: the module hello-world is already defined and cannot be upgraded without satisfying the module governance first. Either use a unique module name, or ensure the upgrade transaction can satisfy module governance."

sirlensalot commented 3 years ago

This is web-repl stuff, also pre-governance. Closing.