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

Check that user-supplied contract name format is valid before issuing contract initialization requests to node. #187

Open
vikt0r0 opened this issue Nov 10, 2022 · 1 comment
Labels
good first issue Good for newcomers [Type] Change Request Some visible functionality should be change.

Comments

@vikt0r0
Copy link
Contributor

vikt0r0 commented Nov 10, 2022

Description

The client currently allows for issuing contract initialization transactions with contract names that have an invalid format. Instead the client should validate the contract name to ensure that it conforms to format expected by the node.

Steps to Reproduce
Issue contract init <module> --contract contains.invalid.char on a contract module.

Expected Result

$ contract init <module> --contract contains.invalid.char
Invalid contract name 'contains.invalid.char' specified. <description-of-valid-contract-name>

Actual Result

$ contract init <module> --contract contains.invalid.char
Initialize contract 'contains.invalid.char' from module 
<...>
Transaction '7c98d8bbeca7ea3800246fce6e7aa1746582836c79859b25005295deeff429c8' sent to the baker.
Waiting for the transaction to be committed and finalized.
<...>
Transaction rejected: serialization failed.
[13:04:15] Waiting for the transaction to be finalized......
Transaction is finalized into block d03f20e44480c66340e8a8555c10ecec7bd2ae434255170d640b7a87a054941c with status "rejected" and cost 0.482143 CCD (231 NRG).
Transaction rejected: serialization failed.
[13:04:30] Transaction finalized.
Error: Contract initialisation failed: Serialization failed.
@vikt0r0 vikt0r0 added the [Type] Change Request Some visible functionality should be change. label Nov 10, 2022
@Bargsteen
Copy link
Contributor

We can use Wasm.isValidInitName to check this.

@Bargsteen Bargsteen added the good first issue Good for newcomers label Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers [Type] Change Request Some visible functionality should be change.
Projects
None yet
Development

No branches or pull requests

2 participants