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

Remove print_debug flag from cosmwasm-vm #1841

Closed
webmaster128 opened this issue Aug 29, 2023 · 1 comment · Fixed by #1953
Closed

Remove print_debug flag from cosmwasm-vm #1841

webmaster128 opened this issue Aug 29, 2023 · 1 comment · Fixed by #1953
Milestone

Comments

@webmaster128
Copy link
Member

With the new set_debug_handler coming in CosmWasm 1.4, there is no need to have a default implementation of the debug handler anymore. This code

            if print_debug {
                e.set_debug_handler(Some(Rc::new(RefCell::new(
                    |msg: &str, _gas_remaining: DebugInfo<'_>| {
                        eprintln!("{msg}");
                    },
                ))))
            }

can move into libwasmvm. Then cosmwasm-vm by default has no debug implementation and callers (libwasmvm, integration tests, cw-sdk, ...) can just do something like

    deps.set_debug_handler(move |msg, _info| {
        eprintln!("{msg}");
    });

if this is what they want to do. This might create a bit of work here and there, but dumping to STDERR from low level code is certainly not better.

@webmaster128
Copy link
Member Author

In CosmWasm/wasmvm#453, libwasmvm sets the debug handler it wants on its own. So we can remove the default implementation and leave it up to the caller to set one. By default, None is used.

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.

1 participant