Ethereum 调用外部协定在处理事务时引发错误:VM异常:还原

Ethereum 调用外部协定在处理事务时引发错误:VM异常:还原,ethereum,solidity,smartcontracts,truffle,Ethereum,Solidity,Smartcontracts,Truffle,我已经部署了ScoreStore契约来测试RPC,它工作得很好。这是商店合同: pragma solidity ^0.4.4; contract ScoreStore { mapping(string => int) PersonScores; function SetScore(string name, int score) { if(PersonScores[name]>0){ throw; }

我已经部署了ScoreStore契约来测试RPC,它工作得很好。这是商店合同:

pragma solidity ^0.4.4;
contract ScoreStore 
{
    mapping(string => int) PersonScores;

    function SetScore(string name, int score) {
        if(PersonScores[name]>0){
            throw;
        }
        else{
            PersonScores[name] = score;
        }
    }

    function GetScore(string name) returns (int){
        return PersonScores[name];
    }
}
现在我想在另一个名为MyGame的合同上使用此合同,合同代码如下:

pragma solidity ^0.4.4;
contract IScoreStore{
    function GetScore(string name) returns (int);
}
contract MyGame{
    function ShowScore(string name) returns (int){
        // Interface takes an address of the existing contract as parameter
        IScoreStore ss = IScoreStore(0x6c38cfb90e8fb1922e61ea4fbe09d29c7751bf82); 
        return ss.GetScore(name);
    }
}
当我在truffle控制台上发出此命令时,
mg.ShowScore.call(“Anna”)
它是这样的:

Error: VM Exception while processing transaction: revert
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
    at XMLHttpRequest._setReadyState (C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.
    at C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1
    at C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
    at Object.InvalidResponse (C:\Users\Fariha.Abbasi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1)
知道我做错了什么吗?
非常感谢您的帮助,请注意:testrpc已经在运行。

我能够在remix中编译这两个契约,并在成功地从ScoreStore契约中设置一些值后调用ShowScore函数


您确定给接口的地址正确吗?因为当我给出一个无效的地址时,我得到了同样的还原错误。

谢谢,我在混音上重新测试了它,效果很好。令我惊讶的是,我再次在testrpc上部署了它,并通过truffle运行,效果很好。无论如何,谢谢你。