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

Unnecessary requirements when uploading a contract #892

Closed
deuszx opened this issue Jan 5, 2023 · 6 comments · Fixed by #893
Closed

Unnecessary requirements when uploading a contract #892

deuszx opened this issue Jan 5, 2023 · 6 comments · Fixed by #893

Comments

@deuszx
Copy link
Contributor

deuszx commented Jan 5, 2023

Currently, cargo contract upload requires Cargo.toml and, by extensions, all of the contract's dependencies. This means that in practice I can't simply give someone my *.wasm or *.contract files for upload.

If I understand the code correctly, it uses that information to construct a transcoder which is then passed into upload_code for decoding events upon uploading.

Is it really required? Are there any contract-specific events that can be returned during contract upload? Or is the current state an unfortunate result of reusing code (DisplayEvents) that seemed similar enough?

For example, both the official wallet and ContractsUI work fine with just the *.wasm or *.contract files.

@ascjones
Copy link
Collaborator

ascjones commented Jan 6, 2023

You are absolutely right, we should provide the ability to work with just wasm or contract files. As you say though, when uploading a plain wasm file it won't be able to decode the events, but we can get around that by allowing it and just not showing the decoded events.

@deuszx
Copy link
Contributor Author

deuszx commented Jan 6, 2023

Hey @ascjones , thanks for quick reply 👋

Not decoding events would be quite a downside but I'm wondering whether it's really necessary here -- when uploading. Aren't the only events emitted then coming from other pallets, like Balance or System? I.e. there's no need to include contract's metadata b/c there will be no contract-specific events to decode.

@ascjones
Copy link
Collaborator

ascjones commented Jan 6, 2023

Yes you are right, contract metadata is not required at all for upload.

@ascjones
Copy link
Collaborator

ascjones commented Jan 6, 2023

I've been wanting to do this for a while, and unify across the extrinsics, so have made a start on it in #893.

@deuszx
Copy link
Contributor Author

deuszx commented Jan 8, 2023

Similarly, cargo contract call should require only the metadata file. If you agree I can open the issue.

@ascjones
Copy link
Collaborator

ascjones commented Jan 8, 2023

Agreed, I plan to do that as part of #893.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants