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

Unify ink_env::{eval_contract, invoke_contract} #814

Closed
HCastano opened this issue Jun 9, 2021 · 1 comment · Fixed by #1165
Closed

Unify ink_env::{eval_contract, invoke_contract} #814

HCastano opened this issue Jun 9, 2021 · 1 comment · Fixed by #1165
Labels
A-ink_lang [ink_lang] Work item B-feature-request A request for a new feature. P-low Low priority issue.

Comments

@HCastano
Copy link
Contributor

HCastano commented Jun 9, 2021

It looks like eval_contract is just a special case of invoke_contract but with better performance due to not having to fetch the results of the contract invocation.

From an API point of view, I think it would be more user friendly to provide a single API for cross-contract calls and let the function internally optimize depending whether or not a return type is required by the user.

@HCastano HCastano added A-ink_lang [ink_lang] Work item B-feature-request A request for a new feature. P-low Low priority issue. labels Jun 9, 2021
@ascjones
Copy link
Collaborator

ascjones commented Mar 4, 2022

Rather invoke_contract is just a special case of eval_contract with a concrete () as the return type. invoke_contract<T, Args> == eval_contract<T, Args, ()>.

I agree it doesn't make a lot of sense to have separate fns which eventually both call invoke_contract_impl under the covers anyway which always attempts to decode the return value. Passing () as a type parameter to eval_contract will be the same thing, making the decoding a no-op.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_lang [ink_lang] Work item B-feature-request A request for a new feature. P-low Low priority issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants