Writing automated tests for Proxy Contract #5298
Replies: 2 comments 3 replies
-
Hey @hadoanngoc thanks for opening this discussion! I cannot tell from the snippet you shared, but it looks like somewhere in your
I'm guessing you're using openzepplin here, look for a Additionally, you may find the Feel free to share reproduction steps and I'd be happy to take a deeper look :) |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for the reply @cliffoo . This is "npx truffle test", not "truffle migrate" command. And I do not call "changeAdmin" anywhere. I have re-compile all the contracts, restart local server and run "npx truffle test" again. But it seems the proxy ownership keeps changing everytime I run the tests, like this ✘ 0x4cFB3F70BF6a80397C2e634e5bDd85BC0bb189EE (transparent) proxy ownership not affected by admin proxy |
Beta Was this translation helpful? Give feedback.
-
I'm writing tests for an upgradeable contract. The first run works well. All tests passed.
However, runing again is showing me this error
Error: Returned error: VM Exception while processing transaction: revert Ownable: caller is not the owner
It seems like my Contract's owner was transferred to another address during the previous test. So I try to remove the build folder, compile everything again, remove .openzepplin folder, run again. But it still shows the above error.
Any idea about this?
Below is the test (I ignore the "require" lines...
In the first run, I noticed this
So somehow the ownership was transfered, but I don't know why it was transfered, and how to reset it
Beta Was this translation helpful? Give feedback.
All reactions