-
Notifications
You must be signed in to change notification settings - Fork 1
/
tag-paralle-evm.html
1252 lines (1249 loc) · 48.3 KB
/
tag-paralle-evm.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link
rel="alternate"
type="application/rss+xml"
href="https://chenyo-17.github.io/org-static-blog/rss.xml"
title="RSS feed for https://chenyo-17.github.io/org-static-blog"
/>
<title>org-static-blog</title>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'],['\\(','\\)']]}});
</script>
<meta name="author" content="chenyo" />
<meta name="referrer" content="no-referrer" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="static/style.css" type="text/css" />
</head>
<body>
<div id="preamble" class="status">
<header>
<h1>
<a href="https://chenyo-17.github.io/org-static-blog"
>Chenyo's org-static-blog</a
>
</h1>
<nav>
<a href="https://chenyo-17.github.io/org-static-blog">Home</a>
<a href="https://chenyo-17.github.io/org-static-blog/archive.html"
>Archive</a
>
<a href="https://chenyo-17.github.io/org-static-blog/tags.html"
>Tags</a
>
</nav>
</header>
</div>
<div id="content">
<h1 class="title">Posts tagged "paralle-evm":</h1>
<div class="post-date">24 Jul 2024</div>
<h1 class="post-title">
<a
href="https://chenyo-17.github.io/org-static-blog/2024-07-24-parallel-evm:-reth.html"
>Parallel EVM: Reth scaling plan</a
>
</h1>
<nav id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li>
<a href="#org121ed29">1. Blockchain fundamentals</a>
<ul>
<li><a href="#org18f32e0">1.1. Ethereum engine API</a></li>
<li><a href="#org06ba2a3">1.2. Foundry</a></li>
<li><a href="#org7d3584f">1.3. Revm</a></li>
<li><a href="#org4cd5425">1.4. Alloy</a></li>
<li><a href="#orgaf496a7">1.5. Erigon & Staged sync</a></li>
<li>
<a href="#org9c41463">1.6. Storage engines</a>
<ul>
<li><a href="#orgb7d63c8">1.6.1. ACID</a></li>
<li>
<a href="#orgfedb1f3"
>1.6.2. MVCC (Multi-version concurrency control)</a
>
</li>
<li>
<a href="#org051a77c">1.6.3. Common database models</a>
</li>
<li>
<a href="#orga561de6">1.6.4. Common storage engines</a>
</li>
</ul>
</li>
<li><a href="#org21fd9b1">1.7. Reth</a></li>
<li>
<a href="#orge685cb0"
>1.8. Why gas per second as the performance metric</a
>
</li>
<li><a href="#org6f8cae5">1.9. EVM cost models</a></li>
<li><a href="#orgcdcf75a">1.10. TPC benchmark</a></li>
<li><a href="#org2d87eef">1.11. State growth</a></li>
<li>
<a href="#orge86de58"
>1.12. JIT (Just-In-Time) and AOT (Ahead-of-Time) EVM</a
>
</li>
<li><a href="#org2af1f4c">1.13. Actor model</a></li>
<li><a href="#orgf82c2e9">1.14. Storage trie</a></li>
<li><a href="#orga4d3036">1.15. Serverless database</a></li>
</ul>
</li>
<li>
<a href="#org05dbdff">2. Reth scaling plan</a>
<ul>
<li>
<a href="#org7c54846">2.1. Vertical scaling (2024)</a>
<ul>
<li><a href="#orgb51851f">2.1.1. JIT/AOT EVM</a></li>
<li><a href="#org281400a">2.1.2. Parallel EVM</a></li>
<li>
<a href="#org3402678"
>2.1.3. Optimized state commitment</a
>
</li>
</ul>
</li>
<li>
<a href="#org3911d1a">2.2. Horizontal scaling (2025)</a>
<ul>
<li><a href="#orgc44579c">2.2.1. Multi-Rollup (?)</a></li>
<li>
<a href="#org0c3b092">2.2.2. Cloud-Native nodes.</a>
</li>
</ul>
</li>
<li><a href="#orgc6ab20b">2.3. Open questions</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<p>
This is a personal note for
<a href="https://www.paradigm.xyz/2024/04/reth-perf"
>Reth-performance-blog</a
>
as well as some terminology explain online, e.g.,
<a href="https://github.com/paradigmxyz/reth">Reth-repo</a> and
<a href="https://claude.ai/chat/6364436f-d279-4c6b-947e-237bfea26409"
>Claude.ai</a
>.
</p>
<div id="outline-container-org121ed29" class="outline-2">
<h2 id="org121ed29">
<span class="section-number-2">1.</span> Blockchain fundamentals
</h2>
<div class="outline-text-2" id="text-1"></div>
<div id="outline-container-org18f32e0" class="outline-3">
<h3 id="org18f32e0">
<span class="section-number-3">1.1.</span>
<a
href="https://github.com/ethereum/execution-apis/blob/a0d03086564ab1838b462befbc083f873dcf0c0f/src/engine/paris.md"
>Ethereum engine API</a
>
</h3>
<div class="outline-text-3" id="text-1-1">
<ul class="org-ul">
<li>
A collection of JSON-RPC methods that all execution clients
implement.
</li>
<li>
Specify the interfaces between consensus and execution layers.
</li>
</ul>
</div>
</div>
<div id="outline-container-org06ba2a3" class="outline-3">
<h3 id="org06ba2a3">
<span class="section-number-3">1.2.</span>
<a href="https://github.com/foundry-rs/foundry/">Foundry</a>
</h3>
<div class="outline-text-3" id="text-1-2">
<ul class="org-ul">
<li>
A Rust-written toolkit for Ethereum application development.
</li>
<li>
Consists of an Ethereum testing framework Forge; a framework to
interact with the chain Cast; a local Ethereum node Anvil; and a
Solidity REPL (Read-Eval-Print-Loop: an interactive environment)
Chisel.
</li>
</ul>
</div>
</div>
<div id="outline-container-org7d3584f" class="outline-3">
<h3 id="org7d3584f">
<span class="section-number-3">1.3.</span>
<a href="https://github.com/bluealloy/revm/">Revm</a>
</h3>
<div class="outline-text-3" id="text-1-3">
<ul class="org-ul">
<li>
A Rust-written EVM; responsible for executing transactions and
contracts.
</li>
</ul>
</div>
</div>
<div id="outline-container-org4cd5425" class="outline-3">
<h3 id="org4cd5425">
<span class="section-number-3">1.4.</span>
<a href="https://github.com/alloy-rs">Alloy</a>
</h3>
<div class="outline-text-3" id="text-1-4">
<ul class="org-ul">
<li>
A library to interact with the Ethereum and other EVM-base
chains.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgaf496a7" class="outline-3">
<h3 id="orgaf496a7">
<span class="section-number-3">1.5.</span>
<a href="https://erigon.tech/">Erigon</a> & Staged sync
</h3>
<div class="outline-text-3" id="text-1-5">
<ul class="org-ul">
<li>
Erigon: a Go-written Ethereum client implementation (execution
layer).
</li>
<li>
Staged sync: break the chain synchronization process into
distinct stages in order to achieve better efficiency.
</li>
</ul>
</div>
</div>
<div id="outline-container-org9c41463" class="outline-3">
<h3 id="org9c41463">
<span class="section-number-3">1.6.</span> Storage engines
</h3>
<div class="outline-text-3" id="text-1-6"></div>
<div id="outline-container-orgb7d63c8" class="outline-4">
<h4 id="orgb7d63c8">
<span class="section-number-4">1.6.1.</span> ACID
</h4>
<div class="outline-text-4" id="text-1-6-1">
<ul class="org-ul">
<li>
A set of properties for database transactions: atomicity,
consistency, isolation, duration.
</li>
<li>
Atomicity: a transaction is treated as an indivisible unit; if
any part of the transaction fails, the entire transaction is
rolled back.
</li>
<li>
Consistency: a transaction brings the database from one valid
state to another.
</li>
<li>
Isolation: concurrent transaction execution leave the database
in the same state as if transactions are executed sequentially
</li>
<li>
Duration: a committed transaction remains committed even when
the system fails.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgfedb1f3" class="outline-4">
<h4 id="orgfedb1f3">
<span class="section-number-4">1.6.2.</span> MVCC (Multi-version
concurrency control)
</h4>
<div class="outline-text-4" id="text-1-6-2">
<ul class="org-ul">
<li>A concurrency control model used in DBMS.</li>
<li>
MVCC keeps multiple version of data simultaneously, each
transaction sees a snapshot of the database.
</li>
</ul>
</div>
</div>
<div id="outline-container-org051a77c" class="outline-4">
<h4 id="org051a77c">
<span class="section-number-4">1.6.3.</span> Common database
models
</h4>
<div class="outline-text-4" id="text-1-6-3">
<ul class="org-ul">
<li>Relational model, e.g., SQL.</li>
<li>Document model.</li>
<li>Network model.</li>
<li>key-value, e.g., NoSQL.</li>
</ul>
</div>
</div>
<div id="outline-container-orga561de6" class="outline-4">
<h4 id="orga561de6">
<span class="section-number-4">1.6.4.</span> Common storage
engines
</h4>
<div class="outline-text-4" id="text-1-6-4">
<ul class="org-ul">
<li>
MDBX: Ultra-fate key-value embedded database with ACID and
MVCC supported.
</li>
<li>
LevelDB: Google-developed key-value store using log-structured
merge-tree for high write throughput.
</li>
<li>
RocksDB: Meta’s fork of LevelDB, optimized for fast
storage.
</li>
<li>
LSM-based DBs, e.g., BadgerDB: optimized for write-heavy
workloads with log-structured merge-tree.
</li>
<li>
BoltDB: Go-written key-value database with optimized B+ tree,
ACID supported.
</li>
<li>
LMDB: memory-mapped key-value store with ACID and MVCC
supported.
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org21fd9b1" class="outline-3">
<h3 id="org21fd9b1">
<span class="section-number-3">1.7.</span> Reth
</h3>
<div class="outline-text-3" id="text-1-7">
<ul class="org-ul">
<li>
A Rust implementation of an Ethereum full node; allows users to
interact with the Ethereum blockchain.
</li>
<li>
An execution layer that implements all Ethereum engine APIs.
</li>
<li>Modularity: every component is built as a library.</li>
<li>
Performance: uses Erigon staged-sync node architecture and other
Rust libraries (e.g., Alloy, revm); tests and optimizes on
Foundry.
</li>
<li>Database/Storage engine: MDBX.</li>
</ul>
</div>
</div>
<div id="outline-container-orge685cb0" class="outline-3">
<h3 id="orge685cb0">
<span class="section-number-3">1.8.</span> Why gas per second as the
performance metric
</h3>
<div class="outline-text-3" id="text-1-8">
<ul class="org-ul">
<li>More nuanced than TPS.</li>
<li>
Allows for a clear understanding for the capacity and
efficiency.
</li>
<li>Helps assessing the cost implications, e.g., DoS attacks.</li>
</ul>
</div>
</div>
<div id="outline-container-org6f8cae5" class="outline-3">
<h3 id="org6f8cae5">
<span class="section-number-3">1.9.</span> EVM cost models
</h3>
<div class="outline-text-3" id="text-1-9">
<ul class="org-ul">
<li>
Determines the computational and storage costs for the
execution.
</li>
<li>
Key aspects: gas, gas cost (for each operation), gas price (in
Wei), gas limit.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgcdcf75a" class="outline-3">
<h3 id="orgcdcf75a">
<span class="section-number-3">1.10.</span> TPC benchmark
</h3>
<div class="outline-text-3" id="text-1-10">
<ul class="org-ul">
<li>
Standardized performance tests for transaction processing and
databases, e.g., how many transactions a system can process in a
given period.
</li>
<li>
Offer benchmarks for different scenarios, e.g., TPC-C for online
transaction processing.
</li>
</ul>
</div>
</div>
<div id="outline-container-org2d87eef" class="outline-3">
<h3 id="org2d87eef">
<span class="section-number-3">1.11.</span> State growth
</h3>
<div class="outline-text-3" id="text-1-11">
<ul class="org-ul">
<li>
State: the set of data for building and validating new Ethereum
blocks.
</li>
<li>
State growth: the accumulation of new account and new contract
storage.
</li>
</ul>
</div>
</div>
<div id="outline-container-orge86de58" class="outline-3">
<h3 id="orge86de58">
<span class="section-number-3">1.12.</span> JIT (Just-In-Time) and
AOT (Ahead-of-Time) EVM
</h3>
<div class="outline-text-3" id="text-1-12">
<ul class="org-ul">
<li>
JIT: convert bytecode to native machine code just before
execution to bypass the VM’s interpretative process.
</li>
<li>
AOT: compile the highest demand contracts and store them on
disk, to avoid untrusted bytecode absuing native-code
compilation.
</li>
</ul>
</div>
</div>
<div id="outline-container-org2af1f4c" class="outline-3">
<h3 id="org2af1f4c">
<span class="section-number-3">1.13.</span> Actor model
</h3>
<div class="outline-text-3" id="text-1-13">
<ul class="org-ul">
<li>A paradigm/framework for designing distributed systems.</li>
<li>
Actor: each actor is an independent entity to receive, process
and send messages; create new actors or modify its state.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgf82c2e9" class="outline-3">
<h3 id="orgf82c2e9">
<span class="section-number-3">1.14.</span> Storage trie
</h3>
<div class="outline-text-3" id="text-1-14">
<ul class="org-ul">
<li>
Each contract account has its own storage trie, which is usually
stored in a KV database.
</li>
</ul>
</div>
</div>
<div id="outline-container-orga4d3036" class="outline-3">
<h3 id="orga4d3036">
<span class="section-number-3">1.15.</span> Serverless database
</h3>
<div class="outline-text-3" id="text-1-15">
<ul class="org-ul">
<li>
Allow developers to focus on writing queries without managing
database servers.
</li>
<li>Automatically scales up or down base on the workload.</li>
<li>Pay-per-use pricing.</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org05dbdff" class="outline-2">
<h2 id="org05dbdff">
<span class="section-number-2">2.</span> Reth scaling plan
</h2>
<div class="outline-text-2" id="text-2">
<ul class="org-ul">
<li>
Current status (April 2024): achieves 100-200 mg/s during live
sync, including sender recovery, transaction execution and block
trie calculation.
</li>
<li>The scaling plan does not involve solving state growth.</li>
</ul>
</div>
<div id="outline-container-org7c54846" class="outline-3">
<h3 id="org7c54846">
<span class="section-number-3">2.1.</span> Vertical scaling (2024)
</h3>
<div class="outline-text-3" id="text-2-1">
<ul class="org-ul">
<li>Optimize how each system handle transactions and data.</li>
</ul>
</div>
<div id="outline-container-orgb51851f" class="outline-4">
<h4 id="orgb51851f">
<span class="section-number-4">2.1.1.</span> JIT/AOT EVM
</h4>
<div class="outline-text-4" id="text-2-1-1">
<ul class="org-ul">
<li>
Reduce EVM interpreter overhead to speed up single-threaded
transaction processing.
</li>
<li>The processing costs \(\approx\) 50% EVM time</li>
<li>
Released on
<a href="https://www.paradigm.xyz/2024/06/revmc">June 2024</a
>.
</li>
</ul>
<figure id="orgd5dba2c">
<img
src="https://www.paradigm.xyz/static/reth-perf/3.png"
alt="3.png"
align="center"
width="500px"
/>
<figcaption>
<span class="figure-number">Figure 1: </span>The JIT/AOT
compiler (<a
href="https://www.paradigm.xyz/static/reth-perf/3.png"
>source</a
>)
</figcaption>
</figure>
</div>
</div>
<div id="outline-container-org281400a" class="outline-4">
<h4 id="org281400a">
<span class="section-number-4">2.1.2.</span> Parallel EVM
</h4>
<div class="outline-text-4" id="text-2-1-2">
<ul class="org-ul">
<li>Utilize multiple cores during EVM execution.</li>
<li>
<80% of historical transactions have non-conflicting
dependencies.
</li>
<li>
Historical sync: can calculate the best parallelization
schedule offline; an early attempt is
<a
href="https://github.com/paradigmxyz/reth/tree/rkrasiuk/parallel"
>available</a
>.
</li>
<li>
Live sync: combine serial and parallel execution based on
static analysis, since Block STM has poor performance during
heavy state contention periods; an early attempt is
<a href="https://github.com/risechain/pevm">available</a>.
</li>
</ul>
</div>
</div>
<div id="outline-container-org3402678" class="outline-4">
<h4 id="org3402678">
<span class="section-number-4">2.1.3.</span> Optimized state
commitment
</h4>
<div class="outline-text-4" id="text-2-1-3">
<ul class="org-ul">
<li>
Traditional EVM implementation <b><b>couples</b></b> the
transaction execution and the state root computation: the
state root is updated whenever a transaction updates a trie,
since the state root computation has to be sequential from the
updated node to the root, this is slow.
</li>
<li>
Reth <b><b>decouples</b></b> the process: raw state data is
stored in KV databases, and each trie is
<b><b>re-built</b></b> for each block from the databases in
the end.
<ul class="org-ul">
<li>Pro: can use more efficient databases.</li>
<li>
Con: need to re-calculate the entire trie, which costs
>75% of end-to-end block production time.
</li>
</ul>
</li>
<li>
Optimizations:
<ul class="org-ul">
<li>
Now already re-calculate the storage trie for each updated
contract in parallel.
</li>
<li>
Can also calculate the account trie when the storage tries
are computed.
</li>
<li>
Pre-fetch cached trie nodes (cached by the state root
computation) by tracking updated accounts and storage,
e.g., a part of the trie may remain the same hash.
</li>
</ul>
</li>
<li>
Going beyond:
<ul class="org-ul">
<li>Only calculate the state root every \(T\) blocks.</li>
<li>
<b><b>Lag</b></b> the state root computation a few blocks
behind to advance executions.
</li>
<li>Use a cheaper encoder and hash function (Blake3).</li>
<li>Use wider branch nodes.</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org3911d1a" class="outline-3">
<h3 id="org3911d1a">
<span class="section-number-3">2.2.</span> Horizontal scaling (2025)
</h3>
<div class="outline-text-3" id="text-2-2">
<ul class="org-ul">
<li>Spread the workload across multiple systems.</li>
</ul>
</div>
<div id="outline-container-orgc44579c" class="outline-4">
<h4 id="orgc44579c">
<span class="section-number-4">2.2.1.</span> Multi-Rollup (?)
</h4>
<div class="outline-text-4" id="text-2-2-1">
<ul class="org-ul">
<li>
Reduce operational overhead of running multiple rollups.
</li>
</ul>
</div>
</div>
<div id="outline-container-org0c3b092" class="outline-4">
<h4 id="org0c3b092">
<span class="section-number-4">2.2.2.</span> Cloud-Native nodes.
</h4>
<div class="outline-text-4" id="text-2-2-2">
<ul class="org-ul">
<li>
Deploy the heavy node (e.g., sequencer) as a service stack
that can autoscale with compute demand and use cloud storage
for persistence.
</li>
<li>Similar to serverless database projects, e.g., NeonDB.</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-orgc6ab20b" class="outline-3">
<h3 id="orgc6ab20b">
<span class="section-number-3">2.3.</span> Open questions
</h3>
<div class="outline-text-3" id="text-2-3">
<ul class="org-ul">
<li>
Second order effects of above changes, e.g., on light clients.
</li>
<li>
What is the best, average and worst case scenarios for each
optimization.
</li>
</ul>
</div>
</div>
</div>
<div class="taglist">
<a href="https://chenyo-17.github.io/org-static-blog/tags.html">Tags</a
>:
<a href="https://chenyo-17.github.io/org-static-blog/tag-evm.html"
>evm</a
>
<a
href="https://chenyo-17.github.io/org-static-blog/tag-paralle-evm.html"
>paralle-evm</a
>
<a href="https://chenyo-17.github.io/org-static-blog/tag-reth.html"
>reth</a
>
</div>
<div class="post-date">28 Jun 2024</div>
<h1 class="post-title">
<a
href="https://chenyo-17.github.io/org-static-blog/2024-06-28-parallel-evm:-sei-v2.html"
>Parallel EVM: Sei-v2</a
>
</h1>
<nav id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li>
<a href="#orgea14092">1. Blockchain fundamentals</a>
<ul>
<li><a href="#org576100f">1.1. Mainnet and Testnet</a></li>
<li><a href="#orge0833b6">1.2. Mainnet Alpha and Beta</a></li>
<li><a href="#orgab9ded1">1.3. Layer 1 and Layer 2</a></li>
<li><a href="#org364029f">1.4. Rollups</a></li>
<li><a href="#org19c7b33">1.5. State channels</a></li>
<li><a href="#org5d5dd5a">1.6. Sidechains</a></li>
<li><a href="#orgdd29a94">1.7. Ethereum and EVM</a></li>
<li><a href="#orgfd9a5ff">1.8. IAVL tree</a></li>
<li><a href="#orga79ba86">1.9. CosmWasm contract</a></li>
<li><a href="#org88c5135">1.10. Cosmos Ecosystem</a></li>
<li><a href="#orgc92e811">1.11. Blockchain layers</a></li>
<li>
<a href="#orgd9884f1">1.12. Optimistic parallelization</a>
</li>
<li>
<a href="#orgd3416df"
>1.13. Integrated and Modular blockchain</a
>
</li>
<li>
<a href="#org513355c"
>1.14. EVM Execution and storage layer</a
>
</li>
<li>
<a href="#org5aecc0a">1.15. Block time and finalize time</a>
</li>
<li><a href="#orgad8c29c">1.16. Blockchain audit</a></li>
</ul>
</li>
<li><a href="#org4313fbe">2. What is Sei</a></li>
<li>
<a href="#orgece446d">3. What is Sei v2</a>
<ul>
<li><a href="#org418b53c">3.1. Backwards compatibility</a></li>
<li>
<a href="#org2e3242a">3.2. Optimistic parallelization</a>
</li>
<li><a href="#org8498b72">3.3. SeiDB</a></li>
<li><a href="#org2550050">3.4. Interoperability</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<p>
This is a personal note for
<a href="https://blog.sei.io/sei-v2-the-first-parallelized-evm/"
>Sei-v2-blog</a
>
as well as some terminology explained by
<a href="https://chatgpt.com/g/g-TJq7kBEsX-evm-gpt">EVM GPT</a>.
</p>
<div id="outline-container-orgea14092" class="outline-2">
<h2 id="orgea14092">
<span class="section-number-2">1.</span> Blockchain fundamentals
</h2>
<div class="outline-text-2" id="text-1"></div>
<div id="outline-container-org576100f" class="outline-3">
<h3 id="org576100f">
<span class="section-number-3">1.1.</span> Mainnet and Testnet
</h3>
<div class="outline-text-3" id="text-1-1">
<ul class="org-ul">
<li>
Mainnet: real transactions occur and have real-world value; any
operation is final and irreversible.
</li>
<li>
Testnet: a sandbox environment with test cryptocurrencies
without real-world value.
</li>
</ul>
</div>
</div>
<div id="outline-container-orge0833b6" class="outline-3">
<h3 id="orge0833b6">
<span class="section-number-3">1.2.</span> Mainnet Alpha and Beta
</h3>
<div class="outline-text-3" id="text-1-2">
<ul class="org-ul">
<li>
Alpha: test core functionalities and gather initial feedback in
live environment.
</li>
<li>
Beta: more stable and feature-complete, but still need more
testing.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgab9ded1" class="outline-3">
<h3 id="orgab9ded1">
<span class="section-number-3">1.3.</span> Layer 1 and Layer 2
</h3>
<div class="outline-text-3" id="text-1-3">
<ul class="org-ul">
<li>
L1: the main network where all transactions are processed and
the primary chain is maintained.
</li>
<li>
L2: secondary frameworks on top of L1 chain, aimed to enhance
scalability without compromising the security of the L1.
</li>
</ul>
</div>
</div>
<div id="outline-container-org364029f" class="outline-3">
<h3 id="org364029f">
<span class="section-number-3">1.4.</span> Rollups
</h3>
<div class="outline-text-3" id="text-1-4">
<ul class="org-ul">
<li>
Processes transactions off-chain and periodically submits a
summary (rollup) to L1.
</li>
<li>
Optimistic rollups: assume transactions are valid be default and
use a challenge period to allow disputes
<ul class="org-ul">
<li>Examples: Optimism, Arbitrum.</li>
</ul>
</li>
<li>
ZK-rollups: use zero-knowledge proofs to validate transactions.
<ul class="org-ul">
<li>Examples: zkSync, StarkNet.</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org19c7b33" class="outline-3">
<h3 id="org19c7b33">
<span class="section-number-3">1.5.</span> State channels
</h3>
<div class="outline-text-3" id="text-1-5">
<ul class="org-ul">
<li>
allow participants to conduct numerous off-chain transactions,
with only the final state recorded on the L1.
</li>
<li>Examples: Bitcoin lightning network.</li>
</ul>
</div>
</div>
<div id="outline-container-org5d5dd5a" class="outline-3">
<h3 id="org5d5dd5a">
<span class="section-number-3">1.6.</span> Sidechains
</h3>
<div class="outline-text-3" id="text-1-6">
<ul class="org-ul">
<li>
Independent blockchains running parallel to the main chain, with
own consensus and security.
</li>
<li>Examples: Polygon.</li>
</ul>
</div>
</div>
<div id="outline-container-orgdd29a94" class="outline-3">
<h3 id="orgdd29a94">
<span class="section-number-3">1.7.</span> Ethereum and EVM
</h3>
<div class="outline-text-3" id="text-1-7">
<ul class="org-ul">
<li>
Ethereum: a blockchain ecosystem, includes the blockchain,
consensus mechanism, smart contracts, native cryptocurrency.
</li>
<li>
EVM: the runtime environment to execute smart contracts in
Ethereum.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgfd9a5ff" class="outline-3">
<h3 id="orgfd9a5ff">
<span class="section-number-3">1.8.</span> IAVL tree
</h3>
<div class="outline-text-3" id="text-1-8">
<ul class="org-ul">
<li>
AVL tree: self-balancing binary tree where the difference in
heights between left and right subtrees of anynode is at most
one.
</li>
<li>
IAVL tree: immutable AVL tree; node cannot be changed once it is
added.
</li>
</ul>
</div>
</div>
<div id="outline-container-orga79ba86" class="outline-3">
<h3 id="orga79ba86">
<span class="section-number-3">1.9.</span> CosmWasm contract
</h3>
<div class="outline-text-3" id="text-1-9">
<ul class="org-ul">
<li>
Allows developers to write fast and portable smart contracts in
WebAssembly.
</li>
<li>
Designed to be interoperable within in the Cosmos ecosystem, a
network of independent blockchains connected via the
Inter-blockchain communication (IBC) protocol.
</li>
</ul>
</div>
</div>
<div id="outline-container-org88c5135" class="outline-3">
<h3 id="org88c5135">
<span class="section-number-3">1.10.</span> Cosmos Ecosystem
</h3>
<div class="outline-text-3" id="text-1-10">
<ul class="org-ul">
<li>
A network of independent, interoperable blockchains designed to
create an Internet of blockchain.
</li>
<li>
Decouples the consensus (BFT consensus engine) and networking
(IBC protocol) layers from the application layers
</li>
<li>
Cosmos SDK: a modular framework for building
application-specific blockchains efficiently.
</li>
<li>
Cosmos Hub: the first blockchain in the Cosmos network, serves
as a central hub to connect multiple blockchains via IBC.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgc92e811" class="outline-3">
<h3 id="orgc92e811">
<span class="section-number-3">1.11.</span> Blockchain layers
</h3>
<div class="outline-text-3" id="text-1-11">
<ul class="org-ul">
<li>
Infrastructure layer: the physical devices that support the
network; and the underlying communication protocols for data
transfer between nodes.
</li>
<li>
Data layer: the distributed ledger and the storage methods.
</li>
<li>
Consensus layer: the protocols, validators and miners;
determines the transaction orders.
</li>
<li>
Execution layer: smart contracts and virtual machines;
determines the transaction update.
</li>
<li>
Application layer: dApps to provide service and user interfaces.
</li>
<li>
Governance layer: the community decision-making process and
proposals.
</li>
<li>
Security layer: cryptographic primitives and security protocols
to avoid attacks.
</li>
</ul>
</div>
</div>
<div id="outline-container-orgd9884f1" class="outline-3">
<h3 id="orgd9884f1">
<span class="section-number-3">1.12.</span> Optimistic
parallelization
</h3>
<div class="outline-text-3" id="text-1-12">
<ul class="org-ul">
<li>
Multiple transactions are processed in parallel under the
assumption that they will conflict with each other; necessary