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

Make query endpoint optional #708

Merged
merged 1 commit into from
Jan 12, 2021
Merged

Make query endpoint optional #708

merged 1 commit into from
Jan 12, 2021

Conversation

webmaster128
Copy link
Member

Closes #699

@webmaster128 webmaster128 added the Breaking (consensus) Breaks consensus, i.e. it is possible to have contracts that create different execution results label Jan 11, 2021
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Looks good.
It would be nice to have a cosmwasm-vm level (integration.rs) test showing the error message when trying to query a contract without the entry point. (Same for migrate).

@webmaster128
Copy link
Member Author

It would be nice to have a cosmwasm-vm level (integration.rs) test showing the error message when trying to query a contract without the entry point. (Same for migrate).

Agreed, will think about how to best integrate this. Not trivial to set up as it would require us to either maintain multiple testing contracts for the VM tests or create artificial test data using WebAssembly text format.

I tested this manually and you get a VmError::ResolveErr as expected. This is tested a bit lower level:

    #[test]
    fn call_function_fails_for_missing_function() {
        let (env, _instance) = make_instance(TESTING_GAS_LIMIT);
        leave_default_data(&env);

        let res = env.call_function("doesnt_exist", &[]);
        match res.unwrap_err() {
            VmError::ResolveErr { msg, .. } => {
                assert_eq!(msg, "Could not get export: Missing export doesnt_exist");
            }
            err => panic!("Unexpected error: {:?}", err),
        }
    }

@webmaster128 webmaster128 added the automerge See mergify.io label Jan 12, 2021
@mergify mergify bot merged commit f548fd4 into master Jan 12, 2021
@mergify mergify bot deleted the optional-query branch January 12, 2021 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge See mergify.io Breaking (consensus) Breaks consensus, i.e. it is possible to have contracts that create different execution results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make "query" entry point optional
2 participants