Conversation
| interface IOptimismMintableERC20Factory { | ||
| function deployments(address) external view returns (address); | ||
| } | ||
|
|
There was a problem hiding this comment.
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
|
This is looking great so far! |
|
The contract implementation looks good to me as well! |
* 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
0xDiscotech
left a comment
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
WDYT about this?
| 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(); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Why are extending the standard bridge instead of updating it? did you have this conversation with mark?
There was a problem hiding this comment.
It is how the interop contracts are being develop, here is a design guide https://github.com/ethereum-optimism/design-docs/blob/main/smart-contract-feature-development.md#composition-through-inheritance
| // 3. Valid SuperchainERC20 check | ||
| address _superRemoteToken = | ||
| IOptimismERC20Factory(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY).deployments(_superAddr); | ||
| if (_superRemoteToken == address(0)) revert InvalidSuperchainAddress(); |
There was a problem hiding this comment.
Is this check necessary? you are already checking that _legacy !=0 and that _legacy == _super
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Yeah, its also a very cheap check. Let's leave it for clarity :)
|
Amazing job sir! |
|
External review at ethereum-optimism#11479 |
|
Merged at ethereum-optimism#11479 |
…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>
…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>
* 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>
Closes OPT-175
Closes OPT-174
Closes OPT-177