簡體   English   中英

'transaction: out of gas' 松露測試時,設置映射鍵值錯誤

[英]'transaction: out of gas' when truffle test, set mapping key value error

合約函數是

function _removeFlag(address sender) internal {
    //remove if in record
    if (mapping1[sender] > 0) {
       mapping1[sender] = 0;
    }
}        

當我的測試用例運行到這個函數時,顯示如下錯誤:

松露>:松露測試

Error: Returned error: VM Exception while processing transaction: out of gas

如果我設置它:
mapping1[sender] = 1;

錯誤消失,

有人可以幫我嗎? 謝謝你

版本信息

Truffle v5.4.0 (core: 5.4.0) Solidity v0.5.16 (solc-js) Node v16.4.2 Web3.js v1.4.0

首先檢查你的賬戶余額: balance = web3.eth.getBalance(someAddress); 然后嘗試指定 gaslimit contractInstance.createProposal("ADHD", "Foo", 2, {from: web3.eth.accounts[1], gas:3000000})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM