openzeppelin-labs icon indicating copy to clipboard operation
openzeppelin-labs copied to clipboard

Unstructure storage code doesn't work for onlyOwner methods.

Open ProphetDaniel opened this issue 5 years ago • 4 comments

If you try to call a method from the proxy with unstructured upgradeability pattern as follows:

    await aContractInstanceByProxy.anOnlyOnwerMethod(anAddress, {
      from: owner
    });

It gives you an error:

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: revert
    at Object.InvalidResponse (C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.j
s:38:1)
    at C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
    at C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:225:1
    at C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web
3\lib\web3\httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\
lib\xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.j
s:354:1)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xh
r2.js:509:1)
    at IncomingMessage.<anonymous> (C:\Users\Daniel\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:
469:1)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

But if you call directly without the proxy it works:

    await aContractInstance.anOnlyOnwerMethod(anAddress, {
      from: owner
    });

Or if you edit the contract and remove onlyOwner from the metod then still call by proxy it also works.

ProphetDaniel avatar Aug 28 '18 02:08 ProphetDaniel