Improve TransparentUpgradeableProxy's transparency (#3977)

Co-authored-by: Francisco <fg@frang.io>
(cherry picked from commit 2a62fb4a2d)
This commit is contained in:
Hadrien Croubois
2023-01-19 22:34:15 +01:00
committed by Francisco Giordano
parent 9eee01c5a2
commit 8dfeb5d79e
4 changed files with 36 additions and 11 deletions

View File

@ -333,14 +333,23 @@ module.exports = function shouldBehaveLikeTransparentUpgradeableProxy (createPro
);
});
context('when function names clash', function () {
describe('when function names clash', function () {
it('when sender is proxy admin should run the proxy function', async function () {
const value = await this.proxy.admin.call({ from: proxyAdminAddress });
const value = await this.proxy.admin.call({ from: proxyAdminAddress, value: 0 });
expect(value).to.be.equal(proxyAdminAddress);
});
it('when sender is other should delegate to implementation', async function () {
const value = await this.proxy.admin.call({ from: anotherAccount });
const value = await this.proxy.admin.call({ from: anotherAccount, value: 0 });
expect(value).to.be.equal('0x0000000000000000000000000000000011111142');
});
it('when sender is proxy admin value should not be accepted', async function () {
await expectRevert.unspecified(this.proxy.admin.call({ from: proxyAdminAddress, value: 1 }));
});
it('when sender is other value should be accepted', async function () {
const value = await this.proxy.admin.call({ from: anotherAccount, value: 1 });
expect(value).to.be.equal('0x0000000000000000000000000000000011111142');
});
});