Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): add solver support for l2 to l1 eth bridging #18805

Open
wants to merge 3 commits into
base: pacaya_fork
Choose a base branch
from

Conversation

AnshuJalan
Copy link
Collaborator

This is an extension of #18616 for L2 -> L1 FnS ETH bridging.

  • As of now, Ether bridging is facilitated directly via Bridge.sol. Thus, the Bridge contract itself acts as the “ether vault”.
  • We might as well modify Bridge.sol to incorporate a solver condition, but that would fundamentally change the core of the message passing system. Therefore, a better alternative implemented in this PR is a separate EtherBridgeWrapper.sol that handles just the “Eth in” and “Eth out” part of bridging by including a solver condition, leaving the existing functionality of Bridge.sol and surrounding infra untouched.
  • Bridge.sol can still be used for standard slow withdrawals.

Copy link

openzeppelin-code bot commented Jan 21, 2025

feat(protocol): add solver support for l2 to l1 eth bridging

Generated at commit: 0c2e116a4639a6a6971e7c57c66d59df7bfc1dbd

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
3
0
10
40
56
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@dantaik
Copy link
Contributor

dantaik commented Jan 21, 2025

@AnshuJalan I may need a few days on something else if that's OK.

@AnshuJalan
Copy link
Collaborator Author

@AnshuJalan I may need a few days on something else if that's OK.

Sure

@dantaik dantaik requested a review from adaki2004 January 25, 2025 13:49
contract EtherBridgeWrapper is EssentialContract {
using Address for address;
using LibAddress for address;

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets reserve a gap of 50 slots here, just in case.

import "src/shared/common/EssentialContract.sol";
import "@openzeppelin/contracts/utils/Address.sol";

contract EtherBridgeWrapper is EssentialContract {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add Natspac comments please

}

/// @dev Represents an operation to solve an Ether bridging intent
struct SolverOp {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to reuse the SolverOp defines in ERC20Vault (maybe extract to another file) and use 0x0 for EtherBridgeOp to indicate the asset is Ether.

Same recommendation for EtherBridgeOp.

/// @notice Sends Ether to another chain.
/// @param _op Options for sending Ether.
/// @return message_ The constructed message.
function sendToken(EtherBridgeOp calldata _op)
Copy link
Contributor

Choose a reason for hiding this comment

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

sendEther?

import "src/shared/common/EssentialContract.sol";
import "@openzeppelin/contracts/utils/Address.sol";

contract EtherBridgeWrapper is EssentialContract {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about we call it EtherVault? If this contract can be merged into ERC20Vault and we consider sending Ether is just another special instance of sending ERC20 tokens with a special token address 0x0, then I'd strongly prefer that implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants