-
Notifications
You must be signed in to change notification settings - Fork 426
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
When set '0' value in contracts event, may cause Error::ContractTrapped
and panic in contract
#589
Comments
Error::ContractTrapped
and panic in contractError::ContractTrapped
and panic in contract
Usually, All of this said, I could reproduce this error and determined that it is exactly this kind of error that happened. The I guess the reason is that |
Oh, I forget to check the process in
In fact in our project europa version v0.2 plan, https://polkadot.polkassembly.io/motion/28,
we would try to enhance the error display for pallet-contracts.😂😂😂 It seems that we could wait after "two outstanding PRs for pallet contracts", then we can re-plan our design later. |
I am just gradually improving the on-chain error reporting so that you get a more diverse set of error messages when an extrinsic failed. It is no replacement nor does it collide with a fully fledged debugging VM like you are building. Those are all static error messages (basically glorified integers) that cannot contain any dynamic infos that would help during debugging. I added a |
@athei Thanks a lot for identifying this issue! |
When set '0' value in contracts event, may cause
Error::ContractTrapped
and panic in contractSetting 0 to strorage value is ok, but set 0 to event value, would cause this
ContractTrapped
This is a bug when I try to test contract example like "erc20" or something else.
ink commit: 3803a26
substrate contract module commit:
(I test this problem in substrate v2.0.0 version and newest substrate version)
Describe the bug
This bug happen when I try to test erc20 example contract. First I run canvas-ui and canvas-node, then I compile erc20 contracts, and use canvas-ui to put-code then deploy contract.
But when I try deploy contract, I pass "0" for
initialSupply
parameter(meaning init value is zero),then, deploy process return an ErrorError::ContractTrapped
.I use newest substrate node has the same error. Then I try to figure out the reason. I modified the erc20 example, and find that, when I set 0 to the event value, the deploy process must cause this error:
in erc20 contract:
And If set
value
to other value, like setvalue: 1_u128.into()
, this contract could run normally.Then I trace in substrate contract module, and find out the error
Error::ContractTrapped
is from:primitives/sandbox/with_std.rs
( in Native execution mode)this function return
HostError
and convert toTrapKind::Host
Error.and then
convert
TrapKind::Host
Error toError::Execution
and finally in
pallet-contracts
, detail inframe/contracts/src/wasm/runtime.rs
L200:convert
Error::Execution
toError::<E::T>::ContractTrapped
error.Expected behavior
contracts should run normally.
The text was updated successfully, but these errors were encountered: