Skip to content

Make Open function 7683 compliant - #80

Merged
reednaa merged 6 commits into
mainfrom
input-7683
Aug 1, 2025
Merged

reednaa merged 6 commits into
mainfrom
input-7683

Conversation

@reednaa

@reednaa reednaa commented Jul 31, 2025 •

Copy link
Copy Markdown
Member

The goal of this PR is to standardise the openX interfaces to 7683 interfaces. The following interfaces has been used for this PR:

function open(bytes calldata order) external;
function openFor(address sponsor, bytes calldata order, bytes calldata signature) external

Note: the implementation treats openFor as open if sponser == msg.sender && signature.length == 0

Each function takes in abi.encode(StandardOrder). This minimises integration overhead significantly at the cost of slightly increasing the calldata usage. The alternative would have been a custom encoding, however, I would argue that this adds unnecessary integration friction.

The OIF repository requires that everything is kept in calldata. To ensure that this is met, a bytes pointer is passed around and then the correct calldata slices are loaded on demand. uint256[2][] inputs and MandateOutput[] outputs are loaded as struct calldata slices for readability and compatibility purposes.

Open questions:

  • Should we also extend the bytes order to finalise?
  • Should we pass the pointer as a uint256? (Argument: We don't use the bytes length thus saving us 1 stack element)

This PR closes: #79

@reednaa
reednaa requested review from frangio and pepebndc July 31, 2025 12:19
@codecov

codecov Bot commented Jul 31, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.61702% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/input/escrow/InputSettlerEscrow.sol 88.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@reednaa
reednaa requested a review from jsanmigimeno July 31, 2025 13:21
@reednaa
reednaa marked this pull request as ready for review July 31, 2025 14:14
@reednaa

reednaa commented Jul 31, 2025 •

Copy link
Copy Markdown
Member Author

Will build resolve on-top: #82

Given our discussion surrounding what the resolve would actually look like and the fact that this is a read only extension, I decided not to finish it.

@luiz-lvj luiz-lvj left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!
Left a comment on how the library is used. Also curios on your thoughts if it would make sense to have two separate libraries, instead of handling both bytes and StandardOrder in the same StandarOrderType. Anyway, not blocking.

library StandardOrderType {
using StandardOrderType for bytes;

function orderIdentifier(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it would make sense to differentiate the functions when using StandardOrder type or bytes

Suggested change
function orderIdentifier(
function getOrderIdentifierFromBytes(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same for the functions below

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

wdyt @reednaa?

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.

I prefer reading the bytes as a struct for readability purposes.

This is especially true if we go a route where we have both the struct and the bytes. (i.e. not using bytes on the finalise function).

@jsanmigimeno jsanmigimeno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, just minor comments


// Collect input tokens
_openFor(order, signature, address(this));
if (msg.sender == sponsor && signature.length == 0) _open(order);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why would this ever be the case? Why wouldn't the sponsor just call open().

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.

There is an argument to be made that the open call is not needed. As a result, if that function gets removed in future contracts this contract would remain compatible.

/// @dev This method must emit the Open event
/// @param order The GaslessCrossChainOrder definition
/// @param order The order in raw encoding
/// @param user The user's address

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the second parameter be 'sponsor'?

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.

This is directly from the new spec. I would argue that sponsor better represents our usage.


/// @title IOriginSettler
/// @notice Standard interface for settlement contracts on the origin chain
interface IOriginSettler {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This interface is not being implemented anywhere, should it be implemented by InputSettlerEscrow?

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.

Resolve has not been defined yet.

/// @param order The GaslessCrossChainOrder definition
/// @param originFillerData Any filler-defined data required by the settler
/// @param order The order in raw encoding
/// @param user The user's address

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be 'sponsor'?

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.

This is directly from the new spec. I would argue that sponsor better represents our usage.

/// @param user The user's address
/// @param signature The user's signature over the order (optional)
/// @return ResolvedCrossChainOrder hydrated order data including the inputs and outputs of the order
function resolveFor(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this function required? It's not implemented anywhere.
Also, the function docstring mentions GaslessCrossChainOrder which doesn't exist anymore.

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.

This function is not final yet.

@reednaa
reednaa merged commit f0460cb into main Aug 1, 2025
@reednaa
reednaa deleted the input-7683 branch August 1, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make InputSettlers 7683 compliant

3 participants