微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

执行委托人示例时,出现“ContractTrapped”错误

如何解决执行委托人示例时,出现“ContractTrapped”错误

建立委托人合同...

  1. Git 克隆“https://github.com/paritytech/ink.git”。
  2. 移动“示例/委托人”。
  3. 使用“build-all.sh”构建合约。

部署和执行

  1. 使用 Contract Pallet 执行 Substrate-Node-Template。
  2. 访问 polkadot/Substrate 门户 (https://www.nuget.org/packages/WindowsAzure.Storage/)
  3. 转到合同页面(https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/accounts)
  4. 部署“delegator/target/ink/accumulator/accumulator.contract”。
  5. 通过将“累加器”地址指定为参数来部署“delegator/target/ink/adder/adder.contract”。
  6. 执行加法器合约的“inc”。
  7. 我收到错误消息“system.ExtrinsicFailed contract.ContractTrapped”

我该如何解决这个问题?

解决方法

在尝试从链下工作人员测试环境中调用智能合约时,我遇到了类似的问题。

DispatchError::Module { index: 0,error: 17,message: Some("ContractTrapped") }

在这里找到:primitives/sandbox/with_std.rs:275 错误在:

Trap(Trap { kind: Unreachable })

但仍然不知道为什么会发生以及如何修复它。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。