Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Gas estimation value on ContractTrapped prevents call execution #101

Open
cmichi opened this issue May 10, 2021 · 0 comments
Open

Gas estimation value on ContractTrapped prevents call execution #101

cmichi opened this issue May 10, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@cmichi
Copy link

cmichi commented May 10, 2021

If a contract contains an assertion which fails by default ‒ i.e. the contract traps for the RPC which does the gas estimation ‒ then the gas estimation goes crazy and the call cannot be executed with default settings. This does not happen in the polkadot-js UI.

Assertions in contracts are typically used to make sure that the contract execution is reverted. I've uploaded a minimal contract, which you can use for reproduction here: assertfalse.contract.zip.

It just contains a constructor and this method:

#[ink(message)]
pub fn assert_false(&self) {
    assert!(false);
}

When you open the "Execute assertfalse (instance)" page the gas estimation will be set to a red

127.001s execution time
6350.067% of block time

screenshot-paritytech github io-2021 05 10-11_43_33

It's not possible to execute the method with these settings, the "Call" button is disabled. If the "Max Gas Allowed" is set manually it works.

In the polkadot-js UI it works fine:
screenshot-polkadot js org-2021 05 10-13_37_13

My hunch is that there is maybe some default value which is used on ContractTrapped returned by the RPC and this one is way too large?

@cmichi cmichi added the bug Something isn't working label May 10, 2021
@cmichi cmichi changed the title Unfortunate gas estimation value on ContractTrapped Gas estimation value on ContractTrapped prevents call execution May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant