Skip to content

Commit

Permalink
fix(Lido): remove excessive initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
folkyatina committed Nov 28, 2024
1 parent d56c26f commit 038e2bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
28 changes: 10 additions & 18 deletions contracts/0.4.24/Lido.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,9 @@ contract Lido is Versioned, StETHPermit, AragonApp {
onlyInit
{
_bootstrapInitialHolder();
_initialize_v2(_lidoLocator, _eip712StETH);
_initialize_v3();
initialized();
}

/**
* initializer for the Lido version "2"
*/
function _initialize_v2(address _lidoLocator, address _eip712StETH) internal {
_setContractVersion(2);

LIDO_LOCATOR_POSITION.setStorageAddress(_lidoLocator);
emit LidoLocatorSet(_lidoLocator);
_initializeEIP712StETH(_eip712StETH);

// set infinite allowance for burner from withdrawal queue
Expand All @@ -231,14 +222,8 @@ contract Lido is Versioned, StETHPermit, AragonApp {
INFINITE_ALLOWANCE
);

emit LidoLocatorSet(_lidoLocator);
}

/**
* initializer for the Lido version "3"
*/
function _initialize_v3() internal {
_setContractVersion(3);
_initialize_v3();
initialized();
}

/**
Expand All @@ -253,6 +238,13 @@ contract Lido is Versioned, StETHPermit, AragonApp {
_initialize_v3();
}

/**
* initializer for the Lido version "3"
*/
function _initialize_v3() internal {
_setContractVersion(3);
}

/**
* @notice Stops accepting new Ether to the protocol
*
Expand Down
3 changes: 2 additions & 1 deletion test/0.4.24/lido/lido.initialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Lido.sol:initialize", () => {

context("initialize", () => {
const initialValue = 1n;
const contractVersion = 2n;
const contractVersion = 3n;

let withdrawalQueueAddress: string;
let burnerAddress: string;
Expand Down Expand Up @@ -86,6 +86,7 @@ describe("Lido.sol:initialize", () => {
expect(await lido.getEIP712StETH()).to.equal(eip712helperAddress);
expect(await lido.allowance(withdrawalQueueAddress, burnerAddress)).to.equal(MaxUint256);
expect(await lido.getInitializationBlock()).to.equal(latestBlock + 1n);
expect(await lido.getContractVersion()).to.equal(contractVersion);
});

it("Does not bootstrap initial holder if total shares is not zero", async () => {
Expand Down

0 comments on commit 038e2bd

Please sign in to comment.