diff --git a/packages/contracts/test/core/dao/dao.ts b/packages/contracts/test/core/dao/dao.ts index 95c36f226..0c539e8ac 100644 --- a/packages/contracts/test/core/dao/dao.ts +++ b/packages/contracts/test/core/dao/dao.ts @@ -204,7 +204,7 @@ describe('DAO', function () { ); }); - it('sets OZs `_initialized` at storage slot [0] to 2', async () => { + it('sets OZs `_initialized` at storage slot [0] to 3', async () => { expect( ethers.BigNumber.from( await ethers.provider.getStorageAt( @@ -212,7 +212,7 @@ describe('DAO', function () { OZ_INITIALIZED_SLOT_POSITION ) ).toNumber() - ).to.equal(2); + ).to.equal(3); }); it('sets the `_reentrancyStatus` at storage slot [304] to `_NOT_ENTERED = 1`', async () => { @@ -239,7 +239,7 @@ describe('DAO', function () { .withArgs([0, 1, 0]); }); - it('initializes `_reentrancyStatus` for versions < 1.3.0', async () => { + it('increments `_initialized` to `3`', async () => { // Create an unitialized DAO. const uninitializedDao = await deployWithProxy(DAO); @@ -252,14 +252,6 @@ describe('DAO', function () { ) ).toNumber() ).to.equal(0); - expect( - ethers.BigNumber.from( - await ethers.provider.getStorageAt( - uninitializedDao.address, - REENTRANCY_STATUS_SLOT_POSITION - ) - ).toNumber() - ).to.equal(0); // Call `initializeFrom` with version 1.2.0. await expect(uninitializedDao.initializeFrom([1, 2, 0], EMPTY_DATA)).to @@ -273,7 +265,15 @@ describe('DAO', function () { OZ_INITIALIZED_SLOT_POSITION ) ).toNumber() - ).to.equal(2); + ).to.equal(3); + }); + + it('initializes `_reentrancyStatus` for versions < 1.3.0', async () => { + // Create an unitialized DAO. + const uninitializedDao = await deployWithProxy(DAO); + + // Expect the contract to be uninitialized with `_reentrancyStatus = 0`. + expect( ethers.BigNumber.from( await ethers.provider.getStorageAt( @@ -281,22 +281,29 @@ describe('DAO', function () { REENTRANCY_STATUS_SLOT_POSITION ) ).toNumber() - ).to.equal(1); - }); + ).to.equal(0); - it('does not initialize `_reentrancyStatus` for versions >= 1.3.0', async () => { - // Create an unitialized DAO. - const uninitializedDao = await deployWithProxy(DAO); + // Call `initializeFrom` with version 1.2.0. + await expect(uninitializedDao.initializeFrom([1, 2, 0], EMPTY_DATA)).to + .not.be.reverted; - // Expect the contract to be uninitialized with `_initialized = 0` and `_reentrancyStatus = 0`. + // Expect the contract to be initialized with `_reentrancyStatus = 1`. expect( ethers.BigNumber.from( await ethers.provider.getStorageAt( uninitializedDao.address, - OZ_INITIALIZED_SLOT_POSITION + REENTRANCY_STATUS_SLOT_POSITION ) ).toNumber() - ).to.equal(0); + ).to.equal(1); + }); + + it('does not initialize `_reentrancyStatus` for versions >= 1.3.0', async () => { + // Create an unitialized DAO. + const uninitializedDao = await deployWithProxy(DAO); + + // Expect the contract to be uninitialized with `_reentrancyStatus = 0`. + expect( ethers.BigNumber.from( await ethers.provider.getStorageAt( @@ -310,7 +317,7 @@ describe('DAO', function () { await expect(uninitializedDao.initializeFrom([1, 3, 0], EMPTY_DATA)).to .not.be.reverted; - // Expect the contract to be initialized with `_initialized = 2` but `_reentrancyStatus` to remain unchanged. + // Expect the contract to be initialized with `_initialized = 3` but `_reentrancyStatus` to remain unchanged. expect( ethers.BigNumber.from( await ethers.provider.getStorageAt( @@ -318,7 +325,7 @@ describe('DAO', function () { OZ_INITIALIZED_SLOT_POSITION ) ).toNumber() - ).to.equal(2); + ).to.equal(3); expect( ethers.BigNumber.from( await ethers.provider.getStorageAt(