Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Commit 42ef88d

Browse files
authored
Merge pull request #73 from base-org/jack/clean-comments
clean comments
2 parents f450444 + 3455364 commit 42ef88d

18 files changed

Lines changed: 230 additions & 185 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Overview
66

7-
RIP-7755 is a Rollup Improvement Proposal designed to establish a standardized, permissionless, and decentralized protocol for low-level cross-chain calls. By implementing immutable on-chain rules that incentivize off-chain participants, known as “fulfillers” in this context, to compete for transaction fees associated with cross-chain calls, we anticipate a significant enhancement in user experience without compromising on security or decentralization.
7+
RIP-7755 is a Rollup Improvement Proposal designed to establish a standardized, permissionless, and decentralized protocol for low-level cross-chain calls. By implementing immutable onchain rules that incentivize offchain participants, known as “fulfillers” in this context, to compete for transaction fees associated with cross-chain calls, we anticipate a significant enhancement in user experience without compromising on security or decentralization.
88

99
When a user initiates a request for a cross-chain call, it is accompanied by a financial incentive for the first actor who can successfully execute the call. This reward is granted to the fulfiller only if they can provide cryptographic proof that the cross-chain call was executed successfully and correctly. One method to achieve this is through the use of storage proofs.
1010

contracts/src/ERC7786Base.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ contract ERC7786Base {
5555
bytes4 internal constant _USER_OP_ATTRIBUTE_SELECTOR = 0xd45448dd; // isUserOp(bool)
5656

5757
/// @notice This error is thrown if an attribute is not found in the attributes array
58+
///
5859
/// @param selector The selector of the attribute that was not found
5960
error AttributeNotFound(bytes4 selector);
6061

@@ -63,7 +64,7 @@ contract ERC7786Base {
6364
/// @custom:reverts If the attribute is not found
6465
///
6566
/// @param attributes The attributes array to search
66-
/// @param selector The selector of the attribute to find
67+
/// @param selector The selector of the attribute to find
6768
///
6869
/// @return attribute The attribute found
6970
function _locateAttribute(bytes[] calldata attributes, bytes4 selector) internal pure returns (bytes calldata) {
@@ -79,9 +80,9 @@ contract ERC7786Base {
7980
/// @notice Locates an attribute in the attributes array without checking if the attribute is found
8081
///
8182
/// @param attributes The attributes array to search
82-
/// @param selector The selector of the attribute to find
83+
/// @param selector The selector of the attribute to find
8384
///
84-
/// @return found Whether the attribute was found
85+
/// @return found Whether the attribute was found
8586
/// @return attribute The attribute found
8687
function _locateAttributeUnchecked(bytes[] calldata attributes, bytes4 selector)
8788
internal
@@ -99,7 +100,7 @@ contract ERC7786Base {
99100
/// @notice Locates an attribute value in the attributes array
100101
///
101102
/// @param attributes The attributes array to search
102-
/// @param selector The selector of the attribute to find
103+
/// @param selector The selector of the attribute to find
103104
///
104105
/// @return value The value of the attribute found
105106
function _locateAttributeValue(bytes[] calldata attributes, bytes4 selector) internal pure returns (uint256) {

contracts/src/RIP7755Inbox.sol

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {Paymaster} from "./Paymaster.sol";
1616
/// @author Coinbase (https://github.com/base-org/RIP-7755-poc)
1717
///
1818
/// @notice An inbox contract within RIP-7755. This contract's sole purpose is to route requested transactions on
19-
/// destination chains and store record of their fulfillment.
19+
/// destination chains and store record of their fulfillment.
2020
contract RIP7755Inbox is ERC7786Base, Paymaster {
2121
using Address for address payable;
2222
using Strings for string;
@@ -45,12 +45,15 @@ contract RIP7755Inbox is ERC7786Base, Paymaster {
4545
/// @param fulfilledBy The account that fulfilled the cross chain call
4646
event CallFulfilled(bytes32 indexed requestHash, address indexed fulfilledBy);
4747

48-
/// @notice This error is thrown when an account attempts to submit a cross chain call that has already been fulfilled
48+
/// @notice This error is thrown when an account attempts to submit a cross chain call that has already been
49+
/// fulfilled
4950
error CallAlreadyFulfilled();
5051

51-
/// @notice This error is thrown if a fulfiller submits a `msg.value` greater than the total value needed for all the calls
52+
/// @notice This error is thrown if a fulfiller submits a `msg.value` greater than the total value needed for all
53+
/// the calls
54+
///
5255
/// @param expected The total value needed for all the calls
53-
/// @param actual The received `msg.value`
56+
/// @param actual The received `msg.value`
5457
error InvalidValue(uint256 expected, uint256 actual);
5558

5659
/// @notice This error is thrown when an invalid caller is detected
@@ -66,9 +69,9 @@ contract RIP7755Inbox is ERC7786Base, Paymaster {
6669

6770
/// @notice Delivery of a message sent from another chain.
6871
///
69-
/// @param sourceChain The CAIP-2 source chain identifier
70-
/// @param sender The CAIP-10 account address of the sender
71-
/// @param messages The messages to be included in the request
72+
/// @param sourceChain The CAIP-2 source chain identifier
73+
/// @param sender The CAIP-10 account address of the sender
74+
/// @param messages The messages to be included in the request
7275
/// @param globalAttributes The attributes to be included in the message
7376
///
7477
/// @return selector The selector of the function
@@ -111,9 +114,9 @@ contract RIP7755Inbox is ERC7786Base, Paymaster {
111114
/// @dev Filters out the fulfiller attribute from the attributes array
112115
///
113116
/// @param sourceChain The CAIP-2 source chain identifier
114-
/// @param sender The CAIP-10 account address of the sender
115-
/// @param messages The messages to be included in the request
116-
/// @param attributes The attributes to be included in the message
117+
/// @param sender The CAIP-10 account address of the sender
118+
/// @param messages The messages to be included in the request
119+
/// @param attributes The attributes to be included in the message
117120
///
118121
/// @return _ The keccak256 hash of the message request
119122
function getRequestId(

contracts/src/RIP7755Outbox.sol

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -52,77 +52,87 @@ abstract contract RIP7755Outbox is ERC7786Base {
5252
uint256 private _nonce;
5353

5454
/// @notice Event emitted when a user sends a message to the `RIP7755Inbox`
55-
/// @param outboxId The keccak256 hash of the message request
55+
///
56+
/// @param outboxId The keccak256 hash of the message request
5657
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
57-
/// @param sender The CAIP-10 account address of the sender
58-
/// @param messages The messages to be included in the request
58+
/// @param sender The CAIP-10 account address of the sender
59+
/// @param messages The messages to be included in the request
5960
/// @param globalAttributes The attributes to be included in the message
6061
event MessagesPosted(
6162
bytes32 indexed outboxId, string destinationChain, string sender, Message[] messages, bytes[] globalAttributes
6263
);
6364

6465
/// @notice Event emitted when a cross chain call is successfully completed
66+
///
6567
/// @param requestHash The keccak256 hash of a `CrossChainRequest`
66-
/// @param submitter The address of the fulfiller that successfully completed the cross chain call
68+
/// @param submitter The address of the fulfiller that successfully completed the cross chain call
6769
event CrossChainCallCompleted(bytes32 indexed requestHash, address submitter);
6870

6971
/// @notice Event emitted when an expired cross chain call request is canceled
72+
///
7073
/// @param requestHash The keccak256 hash of a `CrossChainRequest`
7174
event CrossChainCallCanceled(bytes32 indexed requestHash);
7275

7376
/// @notice This error is thrown when a cross chain request specifies the native currency as the reward type but
7477
/// does not send the correct `msg.value`
78+
///
7579
/// @param expected The expected `msg.value` that should have been sent with the transaction
7680
/// @param received The actual `msg.value` that was sent with the transaction
7781
error InvalidValue(uint256 expected, uint256 received);
7882

7983
/// @notice This error is thrown if a user attempts to cancel a request or a Filler attempts to claim a reward for
8084
/// a request that is not in the `CrossChainCallStatus.Requested` state
85+
///
8186
/// @param expected The expected status during the transaction
82-
/// @param actual The actual request status during the transaction
87+
/// @param actual The actual request status during the transaction
8388
error InvalidStatus(CrossChainCallStatus expected, CrossChainCallStatus actual);
8489

8590
/// @notice This error is thrown if an attempt to cancel a request is made before the request's expiry timestamp
91+
///
8692
/// @param currentTimestamp The current block timestamp
87-
/// @param expiry The timestamp at which the request expires
93+
/// @param expiry The timestamp at which the request expires
8894
error CannotCancelRequestBeforeExpiry(uint256 currentTimestamp, uint256 expiry);
8995

9096
/// @notice This error is thrown if an account attempts to cancel a request that did not originate from that account
91-
/// @param caller The account attempting the request cancellation
97+
///
98+
/// @param caller The account attempting the request cancellation
9299
/// @param expectedCaller The account that created the request
93100
error InvalidCaller(address caller, address expectedCaller);
94101

95102
/// @notice This error is thrown if a request expiry does not give enough time for the delay attribute to pass
96103
error ExpiryTooSoon();
97104

98105
/// @notice This error is thrown if an unsupported attribute is provided
106+
///
99107
/// @param selector The selector of the unsupported attribute
100108
error UnsupportedAttribute(bytes4 selector);
101109

102110
/// @notice This error is thrown if the attribute length supplied to `sendMessage` is not equal to the expected
103111
/// length
112+
///
104113
/// @param expected The expected length of the attributes
105-
/// @param actual The actual length of the attributes
114+
/// @param actual The actual length of the attributes
106115
error InvalidAttributeLength(uint256 expected, uint256 actual);
107116

108117
/// @notice This error is thrown if a required attribute is missing from the global attributes array for a 7755
109118
/// request
119+
///
110120
/// @param selector The selector of the missing attribute
111121
error MissingRequiredAttribute(bytes4 selector);
112122

113123
/// @notice Initiates the sending of a 7755 request containing a single message
114124
///
115125
/// @custom:reverts If the attributes array length is less than 3
116126
/// @custom:reverts If a required attribute is missing from the global attributes array. Required attributes are:
117-
/// - Reward attribute
118-
/// - Delay attribute
119-
/// - Inbox attribute
127+
/// - Reward attribute
128+
/// - Delay attribute
129+
/// - Inbox attribute
120130
/// @custom:reverts If an unsupported attribute is provided
121131
///
122132
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
123-
/// @param receiver The CAIP-10 account address of the receiver (not including the chain identifier)
124-
/// @param payload The encoded calls array
125-
/// @param attributes The attributes to be included in the message
133+
/// @param receiver The CAIP-10 account address of the receiver (not including the chain identifier)
134+
/// @param payload The encoded calls array
135+
/// @param attributes The attributes to be included in the message
126136
///
127137
/// @return messageId The generated request id
128138
function sendMessage(
@@ -140,13 +150,13 @@ abstract contract RIP7755Outbox is ERC7786Base {
140150
///
141151
/// @custom:reverts If the attributes array length is less than 3
142152
/// @custom:reverts If a required attribute is missing from the global attributes array. Required attributes are:
143-
/// - Reward attribute
144-
/// - Delay attribute
145-
/// - Inbox attribute
153+
/// - Reward attribute
154+
/// - Delay attribute
155+
/// - Inbox attribute
146156
/// @custom:reverts If an unsupported attribute is provided
147157
///
148158
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
149-
/// @param messages The messages to be included in the request
159+
/// @param messages The messages to be included in the request
150160
/// @param globalAttributes The attributes to be included in the message
151161
///
152162
/// @return messageId The generated request id
@@ -166,13 +176,13 @@ abstract contract RIP7755Outbox is ERC7786Base {
166176
/// @custom:reverts If finality delay seconds have not passed since the request was fulfilled on destination chain
167177
/// @custom:reverts If the reward attribute is not found in the attributes array
168178
///
169-
/// @param sender The CAIP-10 account address of the sender
170-
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
171-
/// @param messages The messages to be included in the request
179+
/// @param sender The CAIP-10 account address of the sender
180+
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
181+
/// @param messages The messages to be included in the request
172182
/// @param expandedAttributes The attributes to be included in the message
173-
/// @param proof A proof that cryptographically verifies that `fulfillmentInfo` does, indeed, exist in storage on
174-
/// the destination chain
175-
/// @param payTo The address the Filler wants to receive the reward
183+
/// @param proof A proof that cryptographically verifies that `fulfillmentInfo` does, indeed, exist in
184+
/// storage on the destination chain
185+
/// @param payTo The address the Filler wants to receive the reward
176186
function claimReward(
177187
string calldata sender,
178188
string calldata destinationChain,
@@ -205,9 +215,9 @@ abstract contract RIP7755Outbox is ERC7786Base {
205215
/// @custom:reverts If the current block timestamp is less than the expiry timestamp plus the cancel delay seconds
206216
/// @custom:reverts If the reward attribute is not found in the attributes array
207217
///
208-
/// @param sender The CAIP-10 account address of the sender
209-
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
210-
/// @param messages The messages to be included in the request
218+
/// @param sender The CAIP-10 account address of the sender
219+
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
220+
/// @param messages The messages to be included in the request
211221
/// @param expandedAttributes The attributes to be included in the message
212222
function cancelMessage(
213223
string calldata sender,
@@ -262,10 +272,10 @@ abstract contract RIP7755Outbox is ERC7786Base {
262272

263273
/// @notice Returns the keccak256 hash of a message request
264274
///
265-
/// @param sender The CAIP-10 account address of the sender
275+
/// @param sender The CAIP-10 account address of the sender
266276
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
267-
/// @param messages The messages to be included in the request
268-
/// @param attributes The attributes to be included in the message
277+
/// @param messages The messages to be included in the request
278+
/// @param attributes The attributes to be included in the message
269279
///
270280
/// @return _ The keccak256 hash of the message request
271281
function getRequestId(
@@ -279,10 +289,10 @@ abstract contract RIP7755Outbox is ERC7786Base {
279289

280290
/// @notice Returns the keccak256 hash of a message request
281291
///
282-
/// @param sender The CAIP-10 account address of the sender
292+
/// @param sender The CAIP-10 account address of the sender
283293
/// @param destinationChain The CAIP-2 chain identifier of the destination chain
284-
/// @param messages The messages to be included in the request
285-
/// @param attributes The attributes to be included in the message
294+
/// @param messages The messages to be included in the request
295+
/// @param attributes The attributes to be included in the message
286296
///
287297
/// @return _ The keccak256 hash of the message request
288298
function getRequestIdCalldata(
@@ -305,9 +315,9 @@ abstract contract RIP7755Outbox is ERC7786Base {
305315
///
306316
/// @param inboxContractStorageKey The storage location of the data to verify on the destination chain
307317
/// `RIP7755Inbox` contract
308-
/// @param inbox The address of the `RIP7755Inbox` contract
309-
/// @param attributes The attributes to be included in the message
310-
/// @param proofData The proof to validate
318+
/// @param inbox The address of the `RIP7755Inbox` contract
319+
/// @param attributes The attributes to be included in the message
320+
/// @param proofData The proof to validate
311321
function _validateProof(
312322
bytes memory inboxContractStorageKey,
313323
address inbox,

contracts/src/interfaces/IPrecheckContract.sol

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import {ERC7786Base} from "../ERC7786Base.sol";
77
///
88
/// @author Coinbase (https://github.com/base-org/7755-poc)
99
///
10-
/// @notice A standardized interface for a valid Precheck Contract compatible with RIP-7755.
11-
///
12-
/// A cross-chain-call can optionally specify a Precheck Contract used to verify some arbitrary fulfillment condition during the `fulfill` transaction.
13-
/// To specify a Precheck contract, set its address in a global request attribute using the `_PRECHECK_ATTRIBUTE_SELECTOR` prefix.
14-
/// In order for the cross chain call to succeed with a precheck, the Precheck contract must inherit this interface and implement `precheckCall`.
10+
/// @notice A standardized interface for a valid Precheck Contract compatible with RIP-7755. A cross-chain-call can
11+
/// optionally specify a Precheck Contract used to verify some arbitrary fulfillment condition during the
12+
/// `fulfill` transaction. To specify a Precheck contract, set its address in a global request attribute using
13+
/// the `_PRECHECK_ATTRIBUTE_SELECTOR` prefix. In order for the cross chain call to succeed with a precheck,
14+
/// the Precheck contract must inherit this interface and implement `precheckCall`.
1515
interface IPrecheckContract {
1616
/// @notice A precheck function declaration.
1717
///
18-
/// @param sourceChain The CAIP-2 chain identifier of the source chain.
19-
/// @param sender The CAIP-10 account address of the sender.
20-
/// @param messages The messages to be included in the request.
18+
/// @param sourceChain The CAIP-2 chain identifier of the source chain.
19+
/// @param sender The CAIP-10 account address of the sender.
20+
/// @param messages The messages to be included in the request.
2121
/// @param globalAttributes The attributes array.
22-
/// @param caller The address of the filler account that submitted the transaction to RIP7755Inbox.
22+
/// @param caller The address of the filler account that submitted the transaction to RIP7755Inbox.
2323
function precheckCall(
2424
string calldata sourceChain,
2525
string calldata sender,

0 commit comments

Comments
 (0)