You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param _safeBridgeSender The address of the Safe Bridge sender on Arbitrum.
60
+
* @param _inbox The address of the Arbitrum Inbox contract.
61
+
* @param _claimDeposit The deposit amount to submit a claim in wei.
62
+
* @param _challengeDeposit The deposit amount to submit a challenge in wei.
63
+
* @param _challengeDuration The duration of the period allowing to challenge a claim.
64
+
* @param _alpha Basis point of claim or challenge deposit that are lost when dishonest.
65
+
*/
63
66
constructor(
64
67
address_governor,
65
68
address_safeBridgeSender,
@@ -79,6 +82,11 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
79
82
// * State Modifiers * //
80
83
// ************************************* //
81
84
85
+
/**
86
+
* @dev Submit a claim about the `messageHash` for a particular Fast Bridge `ticketID` and submit a deposit. The `messageHash` should match the one on the sending side otherwise the sender will lose his deposit.
87
+
* @param _ticketID The ticket identifier referring to a message going through the bridge.
88
+
* @param _messageHash The hash claimed for the ticket.
89
+
*/
82
90
function claim(uint256_ticketID, bytes32_messageHash) externalpayableoverride {
* @dev Submit a challenge for a particular Fast Bridge `ticketID` and submit a deposit. The `messageHash` in the claim already made for this `ticketID` should be different from the one on the sending side, otherwise the sender will lose his deposit.
109
+
* @param _ticketID The ticket identifier referring to a message going through the bridge.
110
+
*/
99
111
function challenge(uint256_ticketID) externalpayableoverride {
100
112
Ticket storage ticket = tickets[_ticketID];
101
113
require(ticket.claim.bridger !=address(0), "Claim does not exist");
@@ -109,18 +121,24 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
* @dev Relay the message for this `ticketID` if the challenge period has passed and the claim is unchallenged. The hash computed over `messageData` and the other parameters must match the hash provided by the claim.
129
+
* @param _ticketID The ticket identifier referring to a message going through the bridge.
130
+
* @param _blockNumber The block number on the cross-domain chain when the message with this ticketID has been sent.
131
+
* @param _messageData The data on the cross-domain chain for the message sent with this ticketID.
132
+
*/
115
133
function verifyAndRelay(
116
134
uint256_ticketID,
117
-
uint256blockNumber,
135
+
uint256_blockNumber,
118
136
bytescalldata_messageData
119
137
) externaloverride {
120
138
Ticket storage ticket = tickets[_ticketID];
121
139
require(ticket.claim.bridger !=address(0), "Claim does not exist");
if (ticket.claim.bridger !=address(0) && ticket.claim.messageHash == messageHash) {
148
173
ticket.claim.verified =true;
149
174
}
@@ -152,6 +177,10 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
152
177
require(_relay(_messageData), "Failed to call contract"); // Checks-Effects-Interaction
153
178
}
154
179
180
+
/**
181
+
* @dev Sends the deposit back to the Bridger if his claim is not successfully challenged. Includes a portion of the Challenger's deposit if unsuccessfully challenged.
182
+
* @param _ticketID The ticket identifier referring to a message going through the bridge.
183
+
*/
155
184
function withdrawClaimDeposit(uint256_ticketID) externaloverride {
156
185
Ticket storage ticket = tickets[_ticketID];
157
186
require(ticket.relayed ==true, "Message not relayed yet");
@@ -165,6 +194,10 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
165
194
// Checks-Effects-Interaction
166
195
}
167
196
197
+
/**
198
+
* @dev Sends the deposit back to the Challenger if his challenge is successful. Includes a portion of the Bridger's deposit.
199
+
* @param _ticketID The ticket identifier referring to a message going through the bridge.
200
+
*/
168
201
function withdrawChallengeDeposit(uint256_ticketID) externaloverride {
169
202
Ticket storage ticket = tickets[_ticketID];
170
203
require(ticket.relayed ==true, "Message not relayed");
@@ -182,7 +215,12 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
182
215
// * Public Views * //
183
216
// ************************************* //
184
217
185
-
function challengePeriod(uint256_ticketID) publicviewreturns (uint256start, uint256end) {
218
+
/**
219
+
* @dev Returns the `start` and `end` time of challenge period for this `ticketID`.
220
+
* @return start The start time of the challenge period.
221
+
* @return end The end time of the challenge period.
222
+
*/
223
+
function challengePeriod(uint256_ticketID) externalviewoverridereturns (uint256start, uint256end) {
186
224
Ticket storage ticket = tickets[_ticketID];
187
225
require(ticket.claim.bridger !=address(0), "Claim does not exist");
* @param _fastBridgeReceiver The address of the Fast Bridge on Ethereum.
55
+
* @param _fastBridgeSender The address of the Fast Bridge sender on Arbitrum, generally the Home Gateway.
56
+
*/
57
+
constructor(
58
+
address_governor,
59
+
IFastBridgeReceiver _fastBridgeReceiver,
60
+
address_fastBridgeSender
61
+
) SafeBridgeSenderToEthereum() {
68
62
governor = _governor;
69
63
fastBridgeReceiver = _fastBridgeReceiver;
64
+
fastBridgeSender = _fastBridgeSender;
70
65
}
71
66
72
67
// ************************************* //
73
68
// * State Modifiers * //
74
69
// ************************************* //
75
70
76
71
/**
77
-
* Sends an arbitrary message from one domain to another
78
-
* via the fast bridge mechanism
79
-
*
80
-
* @param _receiver The L1 contract address who will receive the calldata
72
+
* Note: Access restricted to the `fastSender`, generally the Gateway.
73
+
* @dev Sends an arbitrary message to Ethereum using the Fast Bridge.
74
+
* @param _receiver The address of the contract on Ethereum which receives the calldata.
81
75
* @param _calldata The receiving domain encoded message data.
82
-
* @return ticketID The identifier to provide to sendSafeFallback()
76
+
* @return ticketID The identifier to provide to sendSafeFallback().
83
77
*/
84
78
function sendFast(address_receiver, bytesmemory_calldata) externaloverridereturns (uint256ticketID) {
85
-
require(msg.sender==fastSender, "Access not allowed: Fast Sender only.");
79
+
require(msg.sender==fastBridgeSender, "Access not allowed: Fast Sender only.");
86
80
87
81
ticketID = currentTicketID++;
88
82
@@ -93,25 +87,17 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
93
87
}
94
88
95
89
/**
96
-
* Sends an arbitrary message from one domain to another
97
-
* via the safe bridge mechanism, which relies on the chain's native bridge.
98
-
*
99
-
* It is unnecessary during normal operations but essential only in case of challenge.
100
-
*
101
-
* It may require some ETH (or whichever native token) to pay for the bridging cost,
102
-
* depending on the underlying safe bridge.
103
-
*
104
-
* TODO: check if keeping _calldata in storage in sendFast() is cheaper than passing it again as a parameter here
105
-
*
106
-
* @param _ticketID The ticketID as provided by `sendFast()` if any.
107
-
* @param _receiver The L1 contract address who will receive the calldata
90
+
* @dev Sends an arbitrary message to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.
91
+
* @param _ticketID The ticketID as returned by `sendFast()`.
92
+
* @param _receiver The address of the contract on Ethereum which receives the calldata.
108
93
* @param _calldata The receiving domain encoded message data.
109
94
*/
110
95
function sendSafeFallback(
111
96
uint256_ticketID,
112
97
address_receiver,
113
98
bytesmemory_calldata
114
99
) externalpayableoverride {
100
+
// TODO: check if keeping _calldata in storage in sendFast() is cheaper than passing it again as a parameter here
115
101
Ticket storage ticket = tickets[_ticketID];
116
102
require(ticket.messageHash !=0, "Ticket does not exist.");
117
103
require(ticket.sentSafe ==false, "Ticket already sent safely.");
@@ -136,9 +122,8 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
136
122
// * Governance * //
137
123
// ************************ //
138
124
139
-
function changeFastSender(address_fastSender) external onlyByGovernor {
140
-
require(fastSender ==address(0));
141
-
fastSender = _fastSender;
125
+
function changeFastSender(address_fastBridgeSender) external onlyByGovernor {
0 commit comments