Skip to content

Conversation

@EdNoepel
Copy link
Contributor

@EdNoepel EdNoepel commented Apr 2, 2025

Some notes:

  • To support CrossChain* attributes, significant chain-specific cruft was moved into root library. These facilities were removed from OZ libraries and are not readily available from other chain-specific repositories. I considered splitting things up into chain-specific folders, but the depth become onerous.
  • Moved SafeERC20's safeApprove logic into the token classes, as OZ dropped it. My opinion is that there was never an issue here, but a majority disagree with me. Preserving the logic felt like the right thing to do.
  • A Proxy's ProxyAdmin became immutable in OZ 5.x. As such, much of the functionality of ProxyOwner became irrelevant. It now exists solely for the 2-step ownership.

@EdNoepel EdNoepel marked this pull request as ready for review April 2, 2025 16:35
@EdNoepel EdNoepel requested review from kbrizzle and prateekdefi April 2, 2025 16:36
* @notice ProxyAdmin with 2-step ownership transfer
* @dev Adds 2-step ownership transfer to the OpenZeppelin ProxyAdmin contract, both for the owner of the ProxyAdmin
* and to the proxy ownership transfer.
* @dev Adds 2-step ownership transfer to the OpenZeppelin ProxyAdmin contract for the owner of the ProxyAdmin.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a lot cleaner / glad they made admin's immutable in the proxy layer.

proxyAdmin.transferOwnership(address(proxyOwner));
proxyOwner2 = new ProxyOwner();
vm.stopPrank();
console.log("owner %s proxyOwner %s admin %s", owner, address(proxyOwner), address(proxyAdmin));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: console logging

Copy link
Contributor Author

@EdNoepel EdNoepel Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in 08d3c8d
linter should have caught this; I will configure it outside of this PR

*/
function _constructing() private view returns (bool) {
return !Address.isContract(address(this));
return !(address(this).code.length > 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little nervous that they removed this, I think I read that EOF will break this check also.

How does their version of Initializable handle this initialization now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nvm looks like they removed it for misuse reasons: OpenZeppelin/openzeppelin-contracts#3945.

*/
function approve(Token18 self, address grantee, UFixed18 amount) internal {
IERC20(Token18.unwrap(self)).safeApprove(grantee, UFixed18.unwrap(amount));
IERC20 token = IERC20(Token18.unwrap(self));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree with you that we shouldn't pull this safe logic in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in 3a84ed3

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (introduced v4.6.0, adapted from v4.9) (crosschain/CrossChainEnabled.sol)

pragma solidity ^0.8.20;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should follow OZ's lead and remove this cross stuff as well for now.

If we need it again in the future we can either pull it back in or find a more modern way of constructing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in 33c6427

@EdNoepel EdNoepel requested a review from kbrizzle April 3, 2025 13:27
@github-actions
Copy link

github-actions bot commented Apr 3, 2025

Unit Test Coverage Report

Coverage after merging ed/pe-2399 into v3 will be
99.89%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/access
   ProxyOwner.sol100%100%100%100%
src/accumulator/types
   Accumulator6.sol100%100%100%100%
   UAccumulator6.sol100%100%100%100%
src/attribute
   Factory.sol100%100%100%100%
   Initializable.sol88.24%33.33%100%100%23–24
   Instance.sol100%100%100%100%
   Ownable.sol100%100%100%100%
   OwnableStub.sol100%100%100%100%
   OwnerDelegatable.sol100%100%100%100%
   OwnerExecutable.sol100%100%100%100%
   OwnerWithdrawable.sol100%100%100%100%
   Pausable.sol100%100%100%100%
src/number
   NumberMath.sol100%100%100%100%
src/number/types
   Fixed18.sol100%100%100%100%
   Fixed6.sol100%100%100%100%
   UFixed18.sol100%100%100%100%
   UFixed6.sol100%100%100%100%
src/synbook/types
   SynBook6.sol100%100%100%100%
src/token/types
   Token18.sol100%100%100%100%
   Token6.sol100%100%100%100%
src/utilization
   CurveMath18.sol100%100%100%100%
   CurveMath6.sol100%100%100%100%
src/utilization/types
   JumpRateUtilizationCurve18.sol100%100%100%100%
   JumpRateUtilizationCurve6.sol100%100%100%100%
src/utils
   console.sol100%100%100%100%
src/verifier
   VerifierBase.sol93.88%100%90%93.55%63–64
src/verifier/types
   Common.sol100%100%100%100%
   GroupCancellation.sol100%100%100%100%

Copy link
Contributor

@prateekdefi prateekdefi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@EdNoepel EdNoepel merged commit c25d6b8 into v3 Apr 4, 2025
1 check passed
@EdNoepel EdNoepel deleted the ed/pe-2399 branch April 4, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants