Skip to content

feat: liquidity migration#10

Closed
agusduha wants to merge 14 commits intodevelopfrom
sc/liquidity-migration
Closed

feat: liquidity migration#10
agusduha wants to merge 14 commits intodevelopfrom
sc/liquidity-migration

Conversation

@agusduha
Copy link
Copy Markdown
Member

@agusduha agusduha commented Aug 5, 2024

Closes OPT-175
Closes OPT-174
Closes OPT-177

@agusduha agusduha requested review from 0xDiscotech and 0xng August 5, 2024 14:33
interface IOptimismMintableERC20Factory {
function deployments(address) external view returns (address);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We could use an interface that is generic with just the deployments function. We currently do this sometimes, it reduces the number of files when verifying a contract and i think it will reduce compile time if we use interfaces everywhere rather than importing full implementations

@tynes
Copy link
Copy Markdown

tynes commented Aug 6, 2024

This is looking great so far!

@linear
Copy link
Copy Markdown

linear Bot commented Aug 6, 2024

@0xDiscotech
Copy link
Copy Markdown

The contract implementation looks good to me as well!

@agusduha agusduha self-assigned this Aug 6, 2024
* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: unit tests fixes

* fix: super to legacy tests failing

* fix: mock and expect mint and burn
* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: add generic factory interface
* test: add L2 standard bridge interop unit tests

* fix: add tests natspec

* fix: add generic factory interface

* feat: modify OptimismMintableERC20Factory for convert

* fix: use only a public function for create3

* feat: rollback interop factory, modify legacy one

* fix: delete local token return variable
@linear
Copy link
Copy Markdown

linear Bot commented Aug 13, 2024

@agusduha agusduha requested a review from 0xParti August 13, 2024 14:02
Copy link
Copy Markdown

@0xDiscotech 0xDiscotech left a comment

Choose a reason for hiding this comment

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

This way of handling the new semver is missing: https://github.com/ethereum-optimism/design-docs/blob/main/smart-contract-feature-development.md#handling-semver on L2StandardBridgeInterop.
Also, I think you need to sum a minor patch on the L2StandardBridge contract since you are adding functions and logic to it with the interop extension.

error InvalidTokenPair();

// TODO: Use an existing interface with `mint` and `burn`?
interface MintableAndBurnable is IERC20 {
Copy link
Copy Markdown

@0xDiscotech 0xDiscotech Aug 13, 2024

Choose a reason for hiding this comment

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

WDYT about this?

Suggested change
interface MintableAndBurnable is IERC20 {
interface Mintable {

// 3. Valid SuperchainERC20 check
address _superRemoteToken =
IOptimismERC20Factory(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY).deployments(_superAddr);
if (_superRemoteToken == address(0)) revert InvalidSuperchainAddress();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not convinced by the error name. It's understandable in context, but for a first time reader it might be confusing. Maybe InvalidSuperchainERC20Address, even if it sounds ugly. Wdty? I know it also affects the Legacy error, so maybe nay

/// @notice The L2StandardBridgeInterop is an extension of the L2StandardBridge that allows for
/// the conversion of tokens between legacy tokens (OptimismMintableERC20 or StandardL2ERC20)
/// and SuperchainERC20 tokens.
contract L2StandardBridgeInterop is L2StandardBridge {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why are extending the standard bridge instead of updating it? did you have this conversation with mark?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread packages/contracts-bedrock/src/libraries/Predeploys.sol
// 3. Valid SuperchainERC20 check
address _superRemoteToken =
IOptimismERC20Factory(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY).deployments(_superAddr);
if (_superRemoteToken == address(0)) revert InvalidSuperchainAddress();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this check necessary? you are already checking that _legacy !=0 and that _legacy == _super

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think is just for the revert error. I'd leave it, doesn't harm since we'll be using an OP chain so gas is not an issue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah, its also a very cheap check. Let's leave it for clarity :)

Copy link
Copy Markdown

@0xParti 0xParti left a comment

Choose a reason for hiding this comment

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

lesgooo

@0xDiscotech
Copy link
Copy Markdown

Amazing job sir!

@agusduha agusduha added the hold Do not merge for now label Aug 14, 2024
@agusduha
Copy link
Copy Markdown
Member Author

External review at ethereum-optimism#11479

@agusduha
Copy link
Copy Markdown
Member Author

Merged at ethereum-optimism#11479

@agusduha agusduha closed this Aug 22, 2024
@agusduha agusduha deleted the sc/liquidity-migration branch August 22, 2024 12:29
0xOneTony pushed a commit that referenced this pull request Mar 6, 2026
…thereum-optimism#19272)

* contracts: implement audit code fixes and add tests

Add onlyDelegateCall enforcement to upgradeSuperchain, upgrade, and
migrate functions (#17). Include msg.sender in deploy salt to prevent
cross-caller CREATE2 collisions (#17). Add duplicate instruction key
detection in upgrade validation (#9). Validate startingRespectedGameType
against enabled game configs (#10). Add code-existence check in
loadBytes (#18). Add setUp guard to VerifyOPCM.runSingle (#4). Remove
unused _findChar function (#5). Pass real AddressManager in migrator
proxy deploy args (#11). Add tests covering all audit fix behaviors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* contracts: regenerate semver-lock.json for OPContractsManagerV2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* contracts: bump OPContractsManagerV2 version to 7.0.10

Semver-diff requires a patch version bump when bytecode changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0xChin added a commit that referenced this pull request Mar 9, 2026
…edStaker

Cantina audit finding #10: when a beneficiary removes a staker from
their allowlist, the staker's lastUpdate is reset via _increasePeData,
losing accumulated staking weight. Document this as an inherent trust
assumption of the delegation model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@0xChin 0xChin mentioned this pull request Mar 9, 2026
0xOneTony pushed a commit that referenced this pull request Mar 16, 2026
* docs(staking): document pause bypass behavior in setAllowedStaker

* fix(staking): only reset lastUpdate on full unstake in _decreasePeData

Cantina audit finding #7: _decreasePeData unconditionally reset
lastUpdate on every decrease, penalizing partial unstakers by
resetting their staking weight. Now lastUpdate is only reset when
effectiveStake reaches zero.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(staking): implement two-step ownership transfer

Cantina audit finding #8: transferOwnership now nominates a pending
owner who must call acceptOwnership() to finalize the transfer,
preventing irrevocable ownership loss from incorrect addresses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs(staking): document lastUpdate reset trust assumption in setAllowedStaker

Cantina audit finding #10: when a beneficiary removes a staker from
their allowlist, the staker's lastUpdate is reset via _increasePeData,
losing accumulated staking weight. Document this as an inherent trust
assumption of the delegation model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: undo version change

* chore: upgrade natspec

* chore: update event emission order

* fix: wrong event args

* chore: add interface comments

* fix: pre-pr

* refactor: make ownable private functions public

* fix: pre-pr

* feat(ownable): reset pending owner on zeroaddress ownership transfer

* refactor: inherit OZ's ownable and use helper contract for mapping storage slot

* fix: ci

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Do not merge for now

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants