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

Support multiple messages in CanExecute query #147

Closed
wants to merge 1 commit into from

Conversation

maurolacy
Copy link
Contributor

Closes the last part of #145, supporting multiple messages in CanExecute query.

@maurolacy maurolacy self-assigned this Nov 28, 2020
@maurolacy maurolacy force-pushed the cw1-can_execute-params branch from 49cd208 to 2276516 Compare November 28, 2020 16:19
Copy link
Contributor

@orkunkl orkunkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one comment. LGTM

Base automatically changed from cw1-rename-can_send to master November 30, 2020 09:22
@maurolacy maurolacy force-pushed the cw1-can_execute-params branch from 2276516 to 603950f Compare November 30, 2020 09:47
@ethanfrey
Copy link
Member

ethanfrey commented Nov 30, 2020

Since making queries is rather cheap and we now have a rather awkward Vec<CosmosMsg> -> Vec<bool> API, I wonder if this is actually useful. I am fine with the rename, but wonder about this API change.

The default case is just sending one message, and this makes that case noticibly more awkward.

@webmaster128
Copy link
Member

webmaster128 commented Nov 30, 2020

It is also a question how inteligent the query API is expected to be. What happens if you pass a bunch of bank send messages that are fine individually but together exceed the allowance.

What's the purpose/use case of this API at all?

@ethanfrey
Copy link
Member

The general idea was a generic way to query "can I do this?" without relying on the specifics (allowances/permissions only in cw1-subkeys). And yeah, it was not designed to be smart and handle messages interacting.

I don't know if there will be other approaches than cw1-subkeys. But this was a way to generically query "am I allowed to send 100 Atoms?" before doing so (which could help in generic UIs).

This can be removed and added later. Or just not supported in clients. I don't see adding more complexity here as beneficial.

(I almost consider making execute only take CosmosMsg, not Vec<CosmosMsg>, but that may be too restrictive.

@maurolacy
Copy link
Contributor Author

maurolacy commented Nov 30, 2020

It is also a question how inteligent the query API is expected to be. What happens if you pass a bunch of bank send messages that are fine individually but together exceed the allowance.

Good point. Since the checks are stateful, it seems to me that to support this API we would need to reproduce the state changes to be able to validate the sequence of messages. Which may be difficult / costly to do.
That, or we just support one message per query, as of now.

What's the purpose/use case of this API at all?

Tests look nicer / simpler, but I agree, that's not enough of a use case to justify this.

@maurolacy
Copy link
Contributor Author

Not merging because impl not stateful when checking multiple messages. Better to provide simpler, clearer API.

@maurolacy maurolacy closed this Nov 30, 2020
@ethanfrey ethanfrey deleted the cw1-can_execute-params branch August 26, 2021 09:25
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 this pull request may close these issues.

4 participants