Commit 2858ba0
authored
feat(gateway): Migration to Gateway (#3654)
## What ❔
Support migration to Gateway. That will be done through restart.
There are few major changes in server
1. Contracats config now splitted to 3 configs:
a. L1SpecificConfig - Stuff that exists only on l1 and will never be
migrated to gateway
b. L2Contracts - Contracts that were deployed on l2
c. ChainSpecificContracts - Contracts that deployed on l1 and on gateway
2. L1 specific contracts and L2 contracts, for now, should be specified
in contracts config, manually. In a future we will be able to load them
as well
3. ChainSpecificContracts, are loading from the Settlement Layer, no
need to specify
4. There are no configuration for settlement layer. The settlement layer
known during the start of the node and the source of truth is contracts
both on l1 and settlement layer.
5. Server constantly checks that settlement layer has not changed. If it
chaged, server will wait until all processed transaction are sent and
confirmed and the necessary contracts are deployed to l1. After that
server will be killed. We assume that kubernetes will restart the server
6. During the start server checks the settlement layer and download the
necessary contracts config, later on almost all components of the system
are manipulating only with settlement layer client and config. Only eth
watcher knows about both layers.
External Node:
1. During the sync with the server External node verifies the
transaction on l1 for consistency. Once consistency checker is
panicking, external node crashes
2. During the start External node checks the latest eth txs in db and
depends on it setup the system to work either on Gateway or on L1
Migration process
1. Operator call the server notifier contract and this contract will
send the message to server, that all commit operations, should be
stopped
2. Server stops the commit operations, but continue to work in all other
parts
3. Operator call the migrate to gateway function on contracts
4. Once the migration is executed both on l1 and gateway, server will
crash
5. During the next start server will load all necessary contracts and
continue to work
## Why ❔
The migration to settlement layer should be smooth. Without necessary of
manual restarts and setting the contracts, it will drastically increase
the mistakes, especially with multiple chains in operation.
## Is this a breaking change?
- [ ] Yes
- [x] No
## Operational changes
<!-- Any config changes? Any new flags? Any changes to any scripts? -->
<!-- Please add anything that non-Matter Labs entities running their own
ZK Chain may need to know -->
## Checklist
<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->
- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zkstack dev fmt` and `zkstack dev
lint`.
---------
Signed-off-by: Danil <[email protected]>1 parent 92a5156 commit 2858ba0
File tree
166 files changed
+3820
-2359
lines changed- .github/workflows
- chains/era
- core
- bin
- block_reverter
- src
- external_node/src
- config
- tests
- zksync_server/src
- lib
- basic_types/src
- config/src
- configs
- contracts
- contracts/src
- dal
- .sqlx
- migrations
- src
- models
- env_config/src
- eth_client
- src
- clients
- http
- protobuf_config/src
- proto/config
- types/src/api
- web3_decl/src/namespaces
- zksync_core_leftovers/src/temp_config_store
- node
- api_server/src
- tx_sender
- web3
- backend_jsonrpsee/namespaces
- namespaces
- tests
- block_reverter/src
- commitment_generator/src
- consensus/src
- consistency_checker/src
- tests
- da_clients/src/avail
- da_dispatcher/src
- eth_sender/src
- eth_watch/src
- event_processors
- tests
- fee_model/src
- l1_gas_price/gas_adjuster
- gateway_migrator
- src
- genesis/src
- node_framework
- src
- implementations
- layers
- base_token
- eth_sender
- node_storage_init
- state_keeper
- web3_api
- server
- resources
- service
- node_storage_init/src/main_node
- node_sync/src
- tree_data_fetcher
- provider
- state_keeper/src/io/tests
- tests
- gateway-migration-test
- tests
- loadnext/src
- sdk/ethereum
- recovery-test/tests
- etc
- env/file_based
- utils/src
- prover
- zkstack_cli
- crates
- common/src
- config/src
- forge_interface/gateway_preparation
- zkstack/src
- commands
- args
- chain
- genesis
- dev
- commands
- clean
- test
- args
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
166 files changed
+3820
-2359
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
418 | 422 | | |
419 | 423 | | |
420 | 424 | | |
421 | | - | |
| 425 | + | |
422 | 426 | | |
423 | 427 | | |
424 | 428 | | |
425 | 429 | | |
426 | 430 | | |
427 | 431 | | |
428 | 432 | | |
429 | | - | |
| 433 | + | |
430 | 434 | | |
431 | 435 | | |
432 | 436 | | |
433 | 437 | | |
434 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
435 | 443 | | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | 444 | | |
440 | 445 | | |
441 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
| 339 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
207 | 206 | | |
208 | 207 | | |
209 | 208 | | |
| |||
235 | 234 | | |
236 | 235 | | |
237 | 236 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
247 | 240 | | |
248 | | - | |
249 | | - | |
250 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
251 | 256 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
263 | 278 | | |
264 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
265 | 286 | | |
266 | 287 | | |
267 | 288 | | |
| |||
284 | 305 | | |
285 | 306 | | |
286 | 307 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | 308 | | |
292 | | - | |
| 309 | + | |
293 | 310 | | |
294 | 311 | | |
295 | 312 | | |
| |||
302 | 319 | | |
303 | 320 | | |
304 | 321 | | |
305 | | - | |
306 | 322 | | |
307 | 323 | | |
308 | 324 | | |
| |||
313 | 329 | | |
314 | 330 | | |
315 | 331 | | |
316 | | - | |
| 332 | + | |
317 | 333 | | |
318 | 334 | | |
319 | 335 | | |
320 | 336 | | |
321 | 337 | | |
322 | 338 | | |
323 | 339 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | 340 | | |
329 | 341 | | |
330 | 342 | | |
331 | 343 | | |
332 | | - | |
333 | | - | |
| 344 | + | |
| 345 | + | |
334 | 346 | | |
335 | 347 | | |
336 | 348 | | |
| |||
0 commit comments