CosmWasm / cosmwasm

Framework for building smart contracts in Wasm for the Cosmos SDK

Home Page:https://www.cosmwasm.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove try_br macro

webmaster128 opened this issue · comments

This is dangerous as it reports the gas value of the last call as the overall gas, which is not how it should behave in the caller.

/// The equivalent of the `?` operator, but for a [`BackendResult`]
macro_rules! try_br {
    ($res: expr $(,)?) => {
        let (result, gas) = $res;

        match result {
            Ok(v) => v,
            Err(e) => return (Err(e), gas),
        }
    };
}
pub(crate) use try_br;