Skip to content

Commit 5ea9b5b

Browse files
committed
fix: lint err
1 parent e625ca8 commit 5ea9b5b

File tree

3 files changed

+73
-68
lines changed

3 files changed

+73
-68
lines changed

docs/src/specs/interop/bundlesandcalls.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Basics Calls
44

5-
Interop Calls are the next level of interfaces, built on top of Interop Messages, enabling you to call contracts on other chains.
5+
Interop Calls are the next level of interfaces, built on top of Interop Messages, enabling you to call contracts on
6+
other chains.
67

78
![interopcall.png](../img/interopcall.png)
89

@@ -257,21 +258,15 @@ However, there are cases where the bundle should be cancelled. Cancellation can
257258
USDCBridge.recoverFailedTransfer(bundleId, cancellationMessage, proof);
258259
```
259260

260-
261-
262-
263261
### Some details on our approach
264262

265-
266263
#### Destination Contract
267264

268-
269265
- On ElasticChain, the destination contract does not need to know it is being called via an interop call. Requests
270-
arrive from `aliased accounts'.
266+
arrive from `aliased accounts'.
271267

272268
#### Batching
273269

274-
275270
- ElasticChain supports bundling of messages, ensuring shared fate and strict order.
276271

277272
#### Execution Permissions
@@ -280,6 +275,4 @@ arrive from `aliased accounts'.
280275

281276
#### Cancellations
282277

283-
284278
- ElasticChain supports restricting who can cancel. Cancellation can happen at any time.
285-

docs/src/specs/interop/interopmessages.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,26 +167,15 @@ global root.
167167
If the Gateway behaves maliciously, it wouldn’t be able to submit its batches to L1, as the proof would fail
168168
verification. A separate section will cover interop transaction security in more detail.
169169

170-
171-
172-
173-
174-
175-
176-
177-
178-
179-
180170
### Other Features
181171

182172
#### Dependency Set
183173

184-
- In ElasticChain, this is implicitly handled by the Gateway. Any chain that is part of the global
185-
root can exchange messages with any other chain, effectively forming an undirected graph.
174+
- In ElasticChain, this is implicitly handled by the Gateway. Any chain that is part of the global root can exchange
175+
messages with any other chain, effectively forming an undirected graph.
186176

187177
#### Timestamps and Expiration
188178

189-
190-
- In ElasticChain, older messages become increasingly difficult to validate as it becomes harder to
191-
gather the data required to construct a Merkle proof. Expiration is also being considered for this reason, but the
192-
specifics are yet to be determined.
179+
- In ElasticChain, older messages become increasingly difficult to validate as it becomes harder to gather the data
180+
required to construct a Merkle proof. Expiration is also being considered for this reason, but the specifics are yet
181+
to be determined.

docs/src/specs/interop/interoptransactions.md

Lines changed: 65 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,37 @@
22

33
## Basics
44

5-
The **InteropTransaction** sits at the top of our interop stack, acting as the “delivery” mechanism for **Interop Bundles**.
5+
The **InteropTransaction** sits at the top of our interop stack, acting as the “delivery” mechanism for **Interop
6+
Bundles**.
67

78
Think of it like a car that picks up our "hitchhiker" bundles and carries them to their destination.
89

910
![interoptx.png](../img/interoptx.png)
1011

11-
**Note:** Interop Transactions aren’t the only way to execute a bundle. Once an interop bundle is created on the source chain, users can simply send a regular transaction on the destination chain to execute it.
12+
**Note:** Interop Transactions aren’t the only way to execute a bundle. Once an interop bundle is created on the source
13+
chain, users can simply send a regular transaction on the destination chain to execute it.
1214

13-
However, this approach can be inconvenient as it requires users to have funds on the destination chain to cover gas fees and to configure the necessary network settings (like the RPC address).
15+
However, this approach can be inconvenient as it requires users to have funds on the destination chain to cover gas fees
16+
and to configure the necessary network settings (like the RPC address).
1417

15-
**InteropTransactions** simplify this process by handling everything from the source chain. They allow you to select which **interopBundle** to execute, specify gas details (such as gas amount and gas price), and determine who will cover the gas costs. This can be achieved using tokens on the source chain or through a paymaster.
18+
**InteropTransactions** simplify this process by handling everything from the source chain. They allow you to select
19+
which **interopBundle** to execute, specify gas details (such as gas amount and gas price), and determine who will cover
20+
the gas costs. This can be achieved using tokens on the source chain or through a paymaster.
1621

17-
Once configured, the transaction will automatically execute, either by the chain operator, the gateway, or off-chain tools.
22+
Once configured, the transaction will automatically execute, either by the chain operator, the gateway, or off-chain
23+
tools.
1824

1925
An **InteropTransaction** contains two pointers to bundles:
2026

21-
- **feesBundle**: Holds interop calls to cover fees.
22-
- **bundleHash**: Contains the main execution.
27+
- **feesBundle**: Holds interop calls to cover fees.
28+
- **bundleHash**: Contains the main execution.
2329

2430
![ipointers.png](../img/ipointers.png)
2531

2632
## Interface
2733

28-
The function `sendInteropTransaction` provides all the options. For simpler use cases, refer to the helper methods defined later in the article.
34+
The function `sendInteropTransaction` provides all the options. For simpler use cases, refer to the helper methods
35+
defined later in the article.
2936

3037
```solidity
3138
contract InteropCenter {
@@ -57,60 +64,70 @@ contract InteropCenter {
5764
}
5865
```
5966

60-
After creating the **InteropBundle**, you can simply call `sendInteropTransaction` to create the complete transaction that will execute the bundle.
67+
After creating the **InteropBundle**, you can simply call `sendInteropTransaction` to create the complete transaction
68+
that will execute the bundle.
6169

6270
## Retries
6371

64-
If your transaction fails to execute the bundle (e.g., due to a low gas limit) or isn’t included at all (e.g., due to too low gasPrice), you can send another transaction to **attempt to execute the same bundle again**.
72+
If your transaction fails to execute the bundle (e.g., due to a low gas limit) or isn’t included at all (e.g., due to
73+
too low gasPrice), you can send another transaction to **attempt to execute the same bundle again**.
6574

6675
Simply call `sendInteropTransaction` again with updated gas settings.
6776

68-
6977
### Example of Retrying
7078

71-
Here’s a concrete example: Suppose you created a bundle to perform a swap that includes transferring 100 ETH, executing the swap, and transferring some tokens back.
79+
Here’s a concrete example: Suppose you created a bundle to perform a swap that includes transferring 100 ETH, executing
80+
the swap, and transferring some tokens back.
7281

73-
You attempted to send the interop transaction with a low gas limit (e.g., 100). Since you didn’t have any base tokens on the destination chain, you created a separate bundle to transfer a small fee (e.g., 0.0001) to cover the gas.
82+
You attempted to send the interop transaction with a low gas limit (e.g., 100). Since you didn’t have any base tokens on
83+
the destination chain, you created a separate bundle to transfer a small fee (e.g., 0.0001) to cover the gas.
7484

75-
You sent your first interop transaction to the destination chain, but it failed due to insufficient gas. However, your “fee bundle” was successfully executed, as it covered the gas cost for the failed attempt.
85+
You sent your first interop transaction to the destination chain, but it failed due to insufficient gas. However, your
86+
“fee bundle” was successfully executed, as it covered the gas cost for the failed attempt.
7687

7788
Now, you have two options: either cancel the execution bundle (the one with 100 ETH) or retry.
7889

79-
To retry, you decide to set a higher gas limit (e.g., 10,000) and create another fee transfer (e.g., 0.01) but use **the same execution bundle** as before.
90+
To retry, you decide to set a higher gas limit (e.g., 10,000) and create another fee transfer (e.g., 0.01) but use **the
91+
same execution bundle** as before.
8092

81-
This time, the transaction succeeds — the swap completes on the destination chain, and the resulting tokens are successfully transferred back to the source chain.
93+
This time, the transaction succeeds — the swap completes on the destination chain, and the resulting tokens are
94+
successfully transferred back to the source chain.
8295

8396
![retryexample.png](../img/retryexample.png)
8497

8598
## Fees & Restrictions
8699

87-
Using an **InteropBundle** for fee payments offers flexibility, allowing users to transfer a small amount to cover the fees while keeping the main assets in the execution bundle itself.
100+
Using an **InteropBundle** for fee payments offers flexibility, allowing users to transfer a small amount to cover the
101+
fees while keeping the main assets in the execution bundle itself.
88102

89103
### Restrictions
90104

91-
This flexibility comes with trade-offs, similar to the validation phases in **Account Abstraction** or **ERC4337**, primarily designed to prevent DoS attacks. Key restrictions include:
105+
This flexibility comes with trade-offs, similar to the validation phases in **Account Abstraction** or **ERC4337**,
106+
primarily designed to prevent DoS attacks. Key restrictions include:
92107

93-
- **Lower gas limits**
108+
- **Lower gas limits**
94109
- **Limited access to specific slots**
95110

96-
Additionally, when the `INTEROP_CENTER` constructs an **InteropTransaction**, it enforces extra restrictions on **feePaymentBundles**:
111+
Additionally, when the `INTEROP_CENTER` constructs an **InteropTransaction**, it enforces extra restrictions on
112+
**feePaymentBundles**:
97113

98114
- **Restricted Executors**:
99-
Only your **AliasedAccount** on the receiving side can execute the `feePaymentBundle`.
100-
101-
This restriction is crucial for security, preventing others from executing your **fee bundle**, which could cause your transaction to fail and prevent the **execution bundle** from processing.
102-
115+
Only your **AliasedAccount** on the receiving side can execute the `feePaymentBundle`.
103116

117+
This restriction is crucial for security, preventing others from executing your **fee bundle**, which could cause your
118+
transaction to fail and prevent the **execution bundle** from processing.
104119

105120
### **Types of Fees**
106121

107122
#### Using the Destination Chain’s Base Token
108123

109-
The simplest scenario is when you (as the sender) already have the destination chain’s base token available on the source chain.
124+
The simplest scenario is when you (as the sender) already have the destination chain’s base token available on the
125+
source chain.
110126

111127
For example:
112128

113-
- If you are sending a transaction from **Era** (base token: ETH) to **Sophon** (base token: SOPH) and already have SOPH on ERA, you can use it for the fee.
129+
- If you are sending a transaction from **Era** (base token: ETH) to **Sophon** (base token: SOPH) and already have SOPH
130+
on ERA, you can use it for the fee.
114131

115132
To make this easier, we’ll provide a helper function:
116133

@@ -130,44 +147,50 @@ contract InteropCenter {
130147

131148
#### Using paymaster on the destination chain
132149

133-
If you don’t have the base token from the destination chain (e.g., SOPH in our example) on your source chain, you’ll need to use a paymaster on the destination chain instead.
150+
If you don’t have the base token from the destination chain (e.g., SOPH in our example) on your source chain, you’ll
151+
need to use a paymaster on the destination chain instead.
134152

135-
In this case, you’ll send the token you do have (e.g., USDC) to the destination chain as part of the **feeBundleHash**. Once there, you’ll use it to pay the paymaster on the destination chain to cover your gas fees.
153+
In this case, you’ll send the token you do have (e.g., USDC) to the destination chain as part of the **feeBundleHash**.
154+
Once there, you’ll use it to pay the paymaster on the destination chain to cover your gas fees.
136155

137156
Your **InteropTransaction** would look like this:
138157

139158
![paymastertx.png](../img/paymastertx.png)
140159

141160
## **Automatic Execution**
142161

143-
One of the main advantages of **InteropTransactions** is that they execute automatically. As the sender on the source chain, you don’t need to worry about technical details like RPC addresses or obtaining proofs — it’s all handled for you.
162+
One of the main advantages of **InteropTransactions** is that they execute automatically. As the sender on the source
163+
chain, you don’t need to worry about technical details like RPC addresses or obtaining proofs — it’s all handled for
164+
you.
144165

145-
After creating an **InteropTransaction**, it can be relayed to the destination chain by anyone. The transaction already includes a signature (also known as an interop message proof), making it fully self-contained and ready to send without requiring additional permissions.
166+
After creating an **InteropTransaction**, it can be relayed to the destination chain by anyone. The transaction already
167+
includes a signature (also known as an interop message proof), making it fully self-contained and ready to send without
168+
requiring additional permissions.
146169

147-
Typically, the destination chain’s operator will handle and include incoming **InteropTransactions**. However, if they don’t, the **Gateway** or other participants can step in to prepare and send them.
170+
Typically, the destination chain’s operator will handle and include incoming **InteropTransactions**. However, if they
171+
don’t, the **Gateway** or other participants can step in to prepare and send them.
148172

149-
You can also use the available tools to create and send the destination transaction yourself. Since the transaction is self-contained, it doesn’t require additional funds or signatures to execute.
173+
You can also use the available tools to create and send the destination transaction yourself. Since the transaction is
174+
self-contained, it doesn’t require additional funds or signatures to execute.
150175

151176
![Usually destination chain operator will keep querying gateway to see if there are any messages for their chain.](../img/autoexecution.png)
152177

153-
Once they see the message, they can request the proof from the **Gateway** and also fetch the **InteropBundles** contained within the message (along with their respective proofs).
178+
Once they see the message, they can request the proof from the **Gateway** and also fetch the **InteropBundles**
179+
contained within the message (along with their respective proofs).
154180

155181
![Operator getting necessary data from Gateway.](../img/chainop.png)
156182

157-
As the final step, the operator can use the received data to create a regular transaction, which can then be sent to their chain.
158-
183+
As the final step, the operator can use the received data to create a regular transaction, which can then be sent to
184+
their chain.
159185

160186
![Creating the final transaction to send to the destination chain](../img/finaltx.png)
161187

162188
The steps above don’t require any special permissions and can be executed by anyone.
163189

164-
While the **Gateway** was used above for tasks like providing proofs, if the Gateway becomes malicious, all this information can still be constructed off-chain using data available on L1.
165-
190+
While the **Gateway** was used above for tasks like providing proofs, if the Gateway becomes malicious, all this
191+
information can still be constructed off-chain using data available on L1.
166192

167193
### How it Works Under the hood
168194

169-
We’ll modify the default account to accept interop proofs as signatures, seamlessly integrating with the existing ZKSync native **Account Abstraction** model.
170-
171-
172-
173-
195+
We’ll modify the default account to accept interop proofs as signatures, seamlessly integrating with the existing ZKSync
196+
native **Account Abstraction** model.

0 commit comments

Comments
 (0)