m0_63280638 2024-03-29 21:30 采纳率: 50%
浏览 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 (<anonymous>)
      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.<anonymous> (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 (<anonymous>)
      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.<anonymous> (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)
  • 写回答

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 来调试智能合约代码,并逐步执行每一行代码,查看变量值等信息,以帮助找出问题所在。

    评论

报告相同问题?

问题事件

  • 创建了问题 3月29日

悬赏问题

  • ¥15 35114 SVAC视频验签的问题
  • ¥15 impedancepy
  • ¥15 在虚拟机环境下完成以下,要求截图!
  • ¥15 求往届大挑得奖作品(ppt…)
  • ¥15 如何在vue.config.js中读取到public文件夹下window.APP_CONFIG.API_BASE_URL的值
  • ¥50 浦育平台scratch图形化编程
  • ¥20 求这个的原理图 只要原理图
  • ¥15 vue2项目中,如何配置环境,可以在打完包之后修改请求的服务器地址
  • ¥20 微信的店铺小程序如何修改背景图
  • ¥15 UE5.1局部变量对蓝图不可见