• 智能合约提款和转账错误


    关注 码龄 粉丝数 原力等级 -- 被采纳 被点赞 采纳率 m0_63280638 2024-03-29 21:30 采纳率: 33.3% 浏览 4 首页/ 区块链 / 智能合约提款和转账错误 智能合约 报错:Withdrawal failed: Error: VM Exception while processing transaction: revert Sigma protocol challenge equality怎么解决failure. > Artifacts written to C:\Users\86181\AppData\Local\Temp\test--2428-NByIu2wor025 > Compiled successfully using: - solc: 0.7.0+commit.9e61f92b.Emscripten.clang Contract: ZSC ✔ should allow minting and approving (1075ms) Registration submitted (txHash = "0xa96b547d86c8f0f38ba029d0d0d534035cc3c6eeb9db7a66dd512eb289623bd6"). Registration successful. ✔ should allow initialization (833ms) Initiating deposit. Deposit submitted (txHash = "0xe59cdb39ccfdf7dac668f450bef13c40db775cf48d2e8299c0beae99260ed79f"). Deposit of 200 was successful. Balance now 200. ✔ should allow funding (643ms) 余额0 余额0 Your withdrawal has been queued. Please wait 4 seconds, for the release of your funds... 余额200 Withdrawal failed: Error: VM Exception while processing transaction: revert Sigma protocol challenge equality failure. 1) should allow withdrawing > No events were emitted Registration submitted (txHash = "0x5f50e7e7449894b4790fa022908af3e2d4c2c9e8128e68ff8facdef582339fea"). Registration submitted (txHash = "0x9f6b63b9c415de46b08518b074c39328e2f138b227c78bfa0ed42a755e8a446b"). Registration submitted (txHash = "0x7b84c0493792891d87c3ae283c7b5ba24ee74d1709b6fdf51f129027351715ca"). Registration submitted (txHash = "0xb2413a5f360afb600e047ee9e8eef5eb3b056bb9e0bd15a591bebb76d221b220"). Registration successful. Registration successful. Registration successful. Registration successful. Initiating transfer. Transfer failed: Error: VM Exception while processing transaction: revert Sigma protocol challenge equality failure. 2) should allow transferring > No events were emitted 3 passing (18s) 2 failing 1) Contract: ZSC should allow withdrawing: Error: VM Exception while processing transaction: revert Sigma protocol challenge equality failure. at C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\packages\provider\wrapper.js:25:1 at Object.callback (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\packages\provider\wrapper.js:166:1) at C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\web3-providers-ws\lib\index.js:115:1 at Array.forEach () at WebsocketProvider._onMessage (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\web3-providers-ws\lib\index.js:103:1) at W3CWebSocket._dispatchEvent [as dispatchEvent] (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\yaeti\lib\EventTarget.js:115:1) at W3CWebSocket.onMessage (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\W3CWebSocket.js:234:1) at WebSocketConnection. (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\W3CWebSocket.js:205:1) at WebSocketConnection.emit (node:events:513:28) at WebSocketConnection.processFrame (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\WebSocketConnection.js:554:1) at C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\WebSocketConnection.js:323:35 at processTicksAndRejections (node:internal/process/task_queues:78:11) 2) Contract: ZSC should allow transferring: Error: VM Exception while processing transaction: revert Sigma protocol challenge equality failure. at C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\packages\provider\wrapper.js:25:1 at Object.callback (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\packages\provider\wrapper.js:166:1) at C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\web3-providers-ws\lib\index.js:115:1 at Array.forEach () at WebsocketProvider._onMessage (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\web3-providers-ws\lib\index.js:103:1) at W3CWebSocket._dispatchEvent [as dispatchEvent] (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\yaeti\lib\EventTarget.js:115:1) at W3CWebSocket.onMessage (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\W3CWebSocket.js:234:1) at WebSocketConnection. (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\W3CWebSocket.js:205:1) at WebSocketConnection.emit (node:events:513:28) at WebSocketConnection.processFrame (C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\WebSocketConnection.js:554:1) at C:\Users\86181\Desktop\zpay-main\node_modules\truffle\build\webpack:\node_modules\websocket\lib\WebSocketConnection.js:323:35 at processTicksAndRejections (node:internal/process/task_queues:78:11) 展开全部 收起 写回答 好问题 0 提建议 追加酬金 关注问题 微信扫一扫 点击复制链接 分享 邀请回答 编辑 收藏 删除 结题 收藏 举报 追加酬金 (90%的用户在追加酬金后获得了解决方案) 当前问题酬金 ¥ 0 (可追加 ¥500) ¥ 15¥ 20¥ 50¥ 100¥ 200 支付方式 扫码支付 二维码出错 点击刷新 支付金额 15 元 提供问题酬金的用户不参与问题酬金结算和分配 支付即为同意 《付费问题酬金结算规则》 结题 再想想 删除 再等等

    1条回答 默认 最新

    • 码农阿豪 Java领域优质创作者 2024-03-29 21:40
      关注
      让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言
      问题描述: 报错信息显示“Withdrawal failed: Error: VM Exception while processing transaction: revert Sigma protocol challenge equality”,请问如何解决? 回答: 这个错误一般是由于智能合约的某些条件验证失败,导致交易被回滚了。具体应该根据智能合约的代码来定位具体的问题所在。 以下是一些可能导致该问题的原因:
      1. 条件验证失败:在智能合约中,有时会执行一些条件验证,如果验证失败,则会抛出异常并回滚交易。这些验证可能涉及余额、权限、状态等方面。因此,首先应该检查智能合约的代码,找出可能导致条件验证失败的地方。
      2. 调用其他合约失败:在智能合约中,有时会调用其他合约的函数,如果该调用失败,则也会抛出异常并回滚交易。此时,需要检查被调用的合约代码,确保被调用的函数正常工作。
      3. 交易参数不正确:有时,交易的参数不正确也会导致交易失败并回滚。因此,需要检查调用交易的代码,确保传入的参数正确。 以下是一个示例代码,演示了如何调用智能合约并处理异常:
      try {
        const result = await contract.withdraw(amount);
        console.log('Withdrawal successful:', result);
      } catch (error) {
        console.error('Withdrawal failed:', error);
      }
      

      在这个例子中,我们先调用了合约的withdraw函数,传入了要提取的金额amount。然后,我们使用try-catch语句来处理异常。如果withdraw函数抛出异常,则控制流就会跳到catch语句块中,并打印错误信息。 最后,需要注意的是,如果无法定位具体的错误所在,可以考虑使用调试工具来辅助定位问题。例如,可以使用 Remix IDE 来调试智能合约代码,并逐步执行每一行代码,查看变量值等信息,以帮助找出问题所在。

      评论
      编辑
      预览

      报告相同问题?

    • 相关阅读:
      ubuntu下C++调用matplotlibcpp进行画图(超详细)
      guava缓存使用不当导致的FullGC
      [RSA议题分析] eBPF Warfare - Detecting Kernel & eBPF Rootkits with Tracee
      docker安装配置elasticsearch,kibana和IK分词器
      vue中的深拷贝lodash的用法及解释
      axios全局路由拦截的设置方法
      刷题笔记day15-二叉树层序遍历
      持续集成环境-maven、tomcat安装和配置
      TensorFlow入门(二十一、softmax算法与损失函数)
      Android /android_vendor.32_arm64_armv8-a_shared/libtinyals a.so.abidiff报错
    • 原文地址:https://ask.csdn.net/questions/8081188