Skip to content

Commit 7506181

Browse files
committed
design: review feedback
1 parent d65977d commit 7506181

File tree

1 file changed

+56
-47
lines changed

1 file changed

+56
-47
lines changed

design/02_On_Chain_Quotes.md

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,30 @@ On EVM, two new contracts will be introduced.
6565

6666
1. **ExecutorQuoter** represents the on-chain quoting logic of a particular Quoter / Relay Provider. It may implement any logic desired by the Relay Provider as long as it adheres to this interface. It SHOULD be immutable.
6767

68-
```solidity
69-
interface IExecutorQuoter {
70-
function requestQuote(
71-
uint16 dstChain,
72-
bytes32 dstAddr,
73-
address refundAddr,
74-
bytes calldata requestBytes,
75-
bytes calldata relayInstructions
76-
) external view returns (bytes32 payeeAddress, uint256 requiredPayment);
77-
}
78-
```
68+
```solidity
69+
interface IExecutorQuoter {
70+
/// This method is used by on- or off-chain services which need to determine the cost of a relay
71+
/// It only returns the required cost (msg.value)
72+
/// It is explicitly marked view
73+
function requestQuote(
74+
uint16 dstChain,
75+
bytes32 dstAddr,
76+
address refundAddr,
77+
bytes calldata requestBytes,
78+
bytes calldata relayInstructions
79+
) external view returns (uint256 requiredPayment);
80+
/// This method is used by an ExecutorQuoterRouter during the execution flow
81+
/// It returns the required cost (msg.value) in addition to the payee and EQ02 quote body
82+
/// It is explicitly NOT marked view in order to allow the quoter the flexibility to emit events or update state
83+
function requestExecutionQuote(
84+
uint16 dstChain,
85+
bytes32 dstAddr,
86+
address refundAddr,
87+
bytes calldata requestBytes,
88+
bytes calldata relayInstructions
89+
) external returns (uint256 requiredPayment, bytes32 payeeAddress, bytes32 quoteBody);
90+
}
91+
```
7992

8093
2. **ExecutorQuoterRouter** replaces **Executor** as the entry-point for integrators. It MUST be immutable and non-administered / fully permissionless. This provides three critical functionalities.
8194

@@ -86,39 +99,39 @@ On EVM, two new contracts will be introduced.
8699
4. Verify the governance has not expired.
87100
5. Verify the signature `ecrecover`s to the quoter address on the governance.
88101
6. Assign the specified contract address to that quoter address.
89-
7. Emit a `QuoterContractUpdate` event.
102+
7. Emit a `QuoterContractUpdate` event (on applicable runtimes, e.g. EVM).
90103
2. `quoteExecution` allows an integrator to quote the cost of an execution for a given quoter in place of a signed quote. This MUST call `requestQuote` from that Quoter’s registered contract.
91104
3. `requestExecution` allows an integrator to request execution via Executor providing a quoter address in place of a signed quote. This MUST
92-
1. Call `requestQuote` from that Quoter’s registered contract.
105+
1. Call `requestExecutionQuote` from that Quoter’s registered contract.
93106
2. Enforce the required payment.
94107
3. Refund excess payment.
95108
4. Request execution, forming a `EQ02` quote on-chain.
96-
5. Emit an `OnChainQuote` event.
97-
98-
```solidity
99-
interface IExecutorQuoterRouter {
100-
event OnChainQuote(address implementation);
101-
event QuoterContractUpdate(address indexed quoterAddress, address implementation);
102-
103-
function quoteExecution(
104-
uint16 dstChain,
105-
bytes32 dstAddr,
106-
address refundAddr,
107-
address quoterAddr,
108-
bytes calldata requestBytes,
109-
bytes calldata relayInstructions
110-
) external view returns (uint256);
111-
112-
function requestExecution(
113-
uint16 dstChain,
114-
bytes32 dstAddr,
115-
address refundAddr,
116-
address quoterAddr,
117-
bytes calldata requestBytes,
118-
bytes calldata relayInstructions
119-
) external payable;
120-
}
121-
```
109+
5. Emit an `OnChainQuote` event (on applicable runtimes, e.g. EVM).
110+
111+
```solidity
112+
interface IExecutorQuoterRouter {
113+
event OnChainQuote(address implementation);
114+
event QuoterContractUpdate(address indexed quoterAddress, address implementation);
115+
116+
function quoteExecution(
117+
uint16 dstChain,
118+
bytes32 dstAddr,
119+
address refundAddr,
120+
address quoterAddr,
121+
bytes calldata requestBytes,
122+
bytes calldata relayInstructions
123+
) external view returns (uint256);
124+
125+
function requestExecution(
126+
uint16 dstChain,
127+
bytes32 dstAddr,
128+
address refundAddr,
129+
address quoterAddr,
130+
bytes calldata requestBytes,
131+
bytes calldata relayInstructions
132+
) external payable;
133+
}
134+
```
122135

123136
### SVM
124137

@@ -134,11 +147,9 @@ Other platforms are not in-scope at this time, but similar designs should be ach
134147

135148
## Protocol Integration
136149

137-
Relay Providers will need to change their verification for Executor requests. If the prefix is `EQ02`, they MUST check the following event to ensure it is an `OnChainQuote` emitted by the canonical `ExecutorQuoterRouter` on that chain in place of verifying the signature.
150+
Relay Providers will need to change their verification for Executor requests. If the prefix is [`EQ02`](#quote---version-2-eq02), they MUST check the following event to ensure it is an `OnChainQuote` emitted by the canonical `ExecutorQuoterRouter` on that chain in place of verifying the signature.
138151

139-
<aside>
140-
⚠️ TBD, if the 32 byte body from `EQ01` is added, no additional changes will be required.
141-
</aside>
152+
Since the 32 byte body from `EQ01` is added, no additional changes will be required apart from the above.
142153

143154
## **API / database schema**
144155

@@ -158,7 +169,7 @@ uint64 expiryTime; // The unix time, in seconds, after which this quote s
158169
[65]byte signature // Quoter's signature of the previous bytes
159170
```
160171

161-
### Quote - Version 2
172+
### Quote - Version 2 (EQ02)
162173

163174
This introduces a new Quote version to the [Executor spec](../README.md#api--database-schema). It has the same body as `EQ01` sans signature. This is useful for parsing and validating off-chain.
164175

@@ -188,9 +199,7 @@ It is possible to keep the same or similar interface as Executor in the Executor
188199

189200
## ExecutorQuoter ABI
190201

191-
<aside>
192-
🤔 Further investigation required to determine if the return should change. Document the results here.
193-
</aside>
202+
While it was not strictly necessary to return the quote body for on-chain execution purposes, it is useful for off-chain integrations to validate and display price information. In order to slightly reduce costs and allow the quoter contract to differentiate between the quote and execute paths, two different functions are used with different modifiers and return values.
194203

195204
# **Security Considerations**
196205

0 commit comments

Comments
 (0)