-
Notifications
You must be signed in to change notification settings - Fork 3
653 lines (591 loc) · 27.6 KB
/
ci.yml
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
name: CI
on:
merge_group:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.78.0
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
compile:
name: Compile
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Run cargo check
run: cargo check --workspace --all-features --all-targets
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt, clippy
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-features --benches --examples --tests -- -D warnings
build-compiler-tester:
name: Build Compiler Tester Bundle
runs-on: ubuntu-latest
env:
ROCKSDB_LIB_DIR: /usr/lib
SNAPPY_LIB_DIR: /usr/lib
LLVM_SYS_170_PREFIX: ${{ github.workspace }}/zksync-llvm/target-llvm/target-final
steps:
- name: Checkout vm sources
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/era_vm
- name: System Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: llvm clang clang-tools build-essential lld ninja-build librocksdb-dev libsnappy-dev
version: 1.0
- uses: dtolnay/[email protected]
with:
components: clippy
- name: Setup compiler-tester submodule
working-directory: ${{ github.workspace }}/era_vm
run: make submodules
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
era_vm
era_vm/era-compiler-tester
- name: Fetch zksync-llvm
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-binaries.yml
repo: matter-labs/era-compiler-llvm
if_no_artifact_found: fail
path: ${{ github.workspace }}/zksync-llvm
workflow_conclusion: success
name: llvm-bins-Linux-X64
search_artifacts: true
- name: Download zksolc compiler
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: |
curl -L https://github.com/matter-labs/zksolc-bin/releases/download/v1.5.1/zksolc-linux-amd64-musl-v1.5.1 --output zksolc
chmod +x zksolc
sudo cp zksolc /usr/bin/zksolc
# We use zkvyper v1.5.1 since v1.5.3 breaks with these tests
- name: Download zkvyper compiler
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: |
curl -L https://github.com/matter-labs/zkvyper-bin/releases/download/v1.5.1/zkvyper-linux-amd64-musl-v1.5.1 --output zkvyper
chmod +x zkvyper
sudo cp zkvyper /usr/bin/zkvyper
- name: Download solc compiler
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: |
curl -L https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux --output solc
chmod +x solc
sudo cp solc /usr/bin/solc
- name: Install zkLLVM
working-directory: ${{ github.workspace }}/zksync-llvm
run: |
rm -rfv llvm
tar -xvf Linux-X64-target-final.tar.gz
- name: Build compiler tester with Lambdaclass VM
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: |
cargo build --features lambda_vm --release --bin compiler-tester
mv target/release/compiler-tester compiler-tester-lambda_vm
cargo build --release --bin compiler-tester
mv target/release/compiler-tester compiler-tester-vm1
- name: Compile system contracts
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: |
./compiler-tester-lambda_vm --path tests/none --save-system-contracts system-contracts-prod.o
./compiler-tester-lambda_vm --path tests/none --save-system-contracts system-contracts-test.o --use-test-encoding
- name: Upload Bundle
uses: actions/cache/save@v3
with:
# Use github.sha in the key because this is valid only for this commit
key: compiler-tester-bundle-${{ github.sha }}
path: |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-prod.o
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-test.o
${{ github.workspace }}/era_vm/era-compiler-tester/compiler-tester-vm1
${{ github.workspace }}/era_vm/era-compiler-tester/compiler-tester-lambda_vm
${{ github.workspace }}/era_vm/era-compiler-tester/solc-bin
${{ github.workspace }}/era_vm/era-compiler-tester/vyper-bin
${{ github.workspace }}/era_vm/era-compiler-tester/solc
${{ github.workspace }}/era_vm/era-compiler-tester/zksolc
${{ github.workspace }}/era_vm/era-compiler-tester/zkvyper
test-with-compiler-tester:
needs: build-compiler-tester
strategy:
fail-fast: false
matrix:
testgroup: [
tests/solidity/complex/interpreter,
tests/llvm,
"tests/solidity/complex/array_one_element,balance,call_by_signature,call_chain,create,default,default_single_file,evaluation_order,forwarding,immutable_delegate_call,import_library_inline,indirect_recursion_fact,interface_casting,internal_function_pointers,invalid_signature,library_call_tuple,many_arguments,nested_calls,solidity_by_example}",
"tests/solidity/complex/{storage,sum_of_squares,try_catch,value,voting}",
"tests/solidity/complex/yul_instructions/{calldatasize,extcodehash,extcodesize}",
tests/solidity/complex/yul_instructions/call/,
tests/solidity/complex/yul_instructions/calldatacopy,
tests/solidity/complex/yul_instructions/calldataload,
tests/solidity/complex/yul_instructions/create,
tests/solidity/complex/yul_instructions/create2,
tests/solidity/complex/yul_instructions/codecopy,
tests/solidity/complex/yul_instructions/delegatecall,
tests/solidity/complex/yul_instructions/staticcall,
tests/solidity/ethereum/*.sol,
"tests/solidity/ethereum/{abiEncoderV[12],abiencodedecode}",
"tests/solidity/ethereum/{accessor,arithmetics,asmForLoop,builtinFunctions,c99_scoping_activation.sol,cleanup,constantEvaluator}",
"tests/solidity/ethereum/array/{*.sol,inline_*.sol,array_memory_allocation,concat,push,slices}",
tests/solidity/ethereum/array/copying,
"tests/solidity/ethereum/array/{delete,indexAccess,pop}",
"tests/solidity/ethereum/{calldata,constants,constructor,conversions,deployedCodeExclusion,ecrecover,enums,errors}",
"tests/solidity/ethereum/{events,experimental,exponentiation,expressions,externalContracts,externalSource}",
"tests/solidity/ethereum/{fallback,freeFunctions,functionCall,functionSelector,functionTypes}",
"tests/solidity/ethereum/{getters,immutable,inheritance,inlineAssembly,integer,interfaceID,isoltestTesting}",
"tests/solidity/ethereum/{libraries,literals,memoryManagement,metaTypes,modifiers,multiSource}",
"tests/solidity/ethereum/{operators,optimizer,payable,receive}",
"tests/solidity/ethereum/{reverts,revertStrings,salted_create,shanghai,smoke,specialFunctions,state}",
"tests/solidity/ethereum/{statements,storage,strings,structs}",
"tests/solidity/ethereum/{tryCatch,types,underscore,uninitializedFunctionPointer}",
"tests/solidity/ethereum/{userDefinedValueType,using,variables,various,virtualFunctions}",
"tests/solidity/simple/{algorithm,array,block,call_chain,conditional,constant_expressions,constants,constructor,context}",
"tests/solidity/simple/{destructuring,error,events,expression,fallback,fat_ptr,function,gas_value,immutable,interface,internal_function_pointers}",
"tests/solidity/simple/{linearity,loop,match,modular,order,overflow,pointer,recursion,return}",
tests/solidity/simple/operator/arithmetic,
tests/solidity/simple/operator/assignment,
"tests/solidity/simple/operator/{bitwise,casting,logical}",
tests/solidity/simple/operator/comparison,
"tests/solidity/simple/{solidity_by_example,storage,structure,system,try_catch,unused}",
"tests/solidity/simple/yul_instructions/{[a-j]*,lt}.sol",
"tests/solidity/simple/yul_instructions/m*.sol",
"tests/solidity/simple/yul_instructions/[n-p]*.sol",
"tests/solidity/simple/yul_instructions/s[a-h]*.sol",
"tests/solidity/simple/yul_instructions/s[i-z]*.sol",
"tests/solidity/simple/yul_instructions/[t-z]*.sol",
tests/solidity/simple/yul_instructions/returndatacopy.sol,
tests/solidity/simple/yul_instructions/returndatasize.sol,
tests/solidity/simple/yul_semantic,
"tests/vyper/complex/{array_one_element,call_by_signature,call_chain,create_from_blueprint}",
"tests/vyper/complex/{create_minimal_proxy_to,default,defi}",
"tests/vyper/complex/ethereum/[a-e]*",
"tests/vyper/complex/ethereum/[f-i]*",
"tests/vyper/complex/ethereum/[j-z]",
tests/vyper/complex/interface_casting,
tests/vyper/complex/nested_calls,
"tests/vyper/complex/{indirect_recursion_fact,invalid_signature,many_arguments}",
"tests/vyper/complex/{solidity_by_example,storage,sum_of_squares,value,voting}",
tests/vyper/ethereum/*.vy,
tests/vyper/ethereum/abiEncoderV1,
tests/vyper/ethereum/abiEncoderV2,
tests/vyper/ethereum/abiencodedecode,
tests/vyper/ethereum/accessor,
tests/vyper/ethereum/arithmetics,
tests/vyper/ethereum/array,
tests/vyper/ethereum/builtinFunctions,
tests/vyper/ethereum/calldata,
tests/vyper/ethereum/cleanup,
tests/vyper/ethereum/constantEvaluator,
tests/vyper/ethereum/constants,
tests/vyper/ethereum/constructor,
tests/vyper/ethereum/conversions,
tests/vyper/ethereum/ecrecover,
tests/vyper/ethereum/events,
tests/vyper/ethereum/expressions,
tests/vyper/ethereum/fallback,
tests/vyper/ethereum/functionCall,
tests/vyper/ethereum/getters,
tests/vyper/ethereum/immutable,
tests/vyper/ethereum/integer,
tests/vyper/ethereum/interfaceID,
tests/vyper/ethereum/isoltestTesting,
tests/vyper/ethereum/literals,
tests/vyper/ethereum/memoryManagement,
tests/vyper/ethereum/operators,
tests/vyper/ethereum/optimizer,
tests/vyper/ethereum/revertStrings,
tests/vyper/ethereum/reverts,
tests/vyper/ethereum/smoke,
tests/vyper/ethereum/specialFunctions,
tests/vyper/ethereum/state,
tests/vyper/ethereum/storage,
tests/vyper/ethereum/strings,
tests/vyper/ethereum/structs,
tests/vyper/ethereum/types,
tests/vyper/ethereum/underscore,
tests/vyper/ethereum/variables,
tests/vyper/ethereum/various,
tests/vyper/ethereum/viaYul,
tests/vyper/simple/*.vy,
tests/vyper/simple/algorithm,
tests/vyper/simple/array,
tests/vyper/simple/block,
tests/vyper/simple/built_in_functions,
tests/vyper/simple/conditional,
tests/vyper/simple/constructor,
tests/vyper/simple/destructuring,
tests/vyper/simple/error,
tests/vyper/simple/events,
tests/vyper/simple/expression,
tests/vyper/simple/fallback,
tests/vyper/simple/function,
tests/vyper/simple/immutable,
tests/vyper/simple/interface,
tests/vyper/simple/loop,
tests/vyper/simple/modular,
tests/vyper/simple/operator,
tests/vyper/simple/order,
tests/vyper/simple/overflow,
tests/vyper/simple/return,
tests/vyper/simple/revert_on_failure,
tests/vyper/simple/solidity_by_example,
tests/vyper/simple/storage,
tests/vyper/simple/structure,
tests/vyper/simple/unchecked_math,
tests/vyper/simple/unused,
"tests/yul/{*}",
]
mode: ['']
# Special case the slowest tests to parallelize on execution mode as well
include:
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/keccak256.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/log0.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/log0.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/log0.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/log0.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/log0.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/log0.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/log1.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/log1.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/log1.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/log1.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/log1.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/log1.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/log2.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/log2.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/log2.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/log2.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/log2.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/log2.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/log3.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/log3.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/log3.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/log3.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/log3.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/log3.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/log4.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/log4.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/log4.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/log4.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/log4.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/log4.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/operator
mode: '--mode M0'
- testgroup: tests/solidity/simple/operator
mode: '--mode M1'
- testgroup: tests/solidity/simple/operator
mode: '--mode M2'
- testgroup: tests/solidity/simple/operator
mode: '--mode M3'
- testgroup: tests/solidity/simple/operator
mode: '--mode Ms'
- testgroup: tests/solidity/simple/operator
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/return.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/return.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/return.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/return.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/return.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/return.sol
mode: '--mode Mz'
- testgroup: tests/solidity/simple/yul_instructions/revert.sol
mode: '--mode M0'
- testgroup: tests/solidity/simple/yul_instructions/revert.sol
mode: '--mode M1'
- testgroup: tests/solidity/simple/yul_instructions/revert.sol
mode: '--mode M2'
- testgroup: tests/solidity/simple/yul_instructions/revert.sol
mode: '--mode M3'
- testgroup: tests/solidity/simple/yul_instructions/revert.sol
mode: '--mode Ms'
- testgroup: tests/solidity/simple/yul_instructions/revert.sol
mode: '--mode Mz'
- testgroup: tests/solidity/complex/parser
encoding: 'test'
- testgroup: tests/solidity/complex/defi
encoding: 'test'
name: Run Compiler Tester
runs-on: ubuntu-latest
steps:
- name: System Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: llvm clang clang-tools build-essential lld ninja-build librocksdb-dev libsnappy-dev
version: 1.0
- name: Checkout vm sources
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/era_vm
- name: Setup compiler-tester submodule
working-directory: ${{ github.workspace }}/era_vm
run: make submodules
- name: Download Bundle
uses: actions/cache/restore@v3
with:
# Use github.sha in the key because this is valid only for this commit
key: compiler-tester-bundle-${{ github.sha }}
# This should be guaranteed to hit
fail-on-cache-miss: true
path: |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-prod.o
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-test.o
${{ github.workspace }}/era_vm/era-compiler-tester/compiler-tester-vm1
${{ github.workspace }}/era_vm/era-compiler-tester/compiler-tester-lambda_vm
${{ github.workspace }}/era_vm/era-compiler-tester/solc-bin
${{ github.workspace }}/era_vm/era-compiler-tester/vyper-bin
${{ github.workspace }}/era_vm/era-compiler-tester/solc
${{ github.workspace }}/era_vm/era-compiler-tester/zksolc
${{ github.workspace }}/era_vm/era-compiler-tester/zkvyper
- name: Install Bundle
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: sudo cp zksolc zkvyper solc /usr/bin/
- name: Run compiler-tester tests
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
env:
system-contracts: system-contracts-${{ matrix.encoding == 'test' && 'test' || 'prod' }}.o
encoding: ${{ matrix.encoding == 'test' && '--use-test-encoding' || '' }}
run: ./compiler-tester-lambda_vm --load-system-contracts ${{ env.system-contracts}} ${{ env.encoding }} --target EraVM ${{ matrix.mode }} --path ${{ matrix.testgroup }}
ergs-comparison:
needs: build-compiler-tester
strategy:
fail-fast: false
matrix:
type: ["vm1", "lambda_vm"]
name: Run Ergs Comparison
runs-on: ubuntu-latest
steps:
- name: System Dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: llvm clang clang-tools build-essential lld ninja-build librocksdb-dev libsnappy-dev
version: 1.0
- name: Checkout vm sources
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/era_vm
- name: Setup compiler-tester submodule
working-directory: ${{ github.workspace }}/era_vm
run: make submodules
- name: Download Bundle
uses: actions/cache/restore@v3
with:
# Use github.sha in the key because this is valid only for this commit
key: compiler-tester-bundle-${{ github.sha }}
# This should be guaranteed to hit
fail-on-cache-miss: true
path: |
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-prod.o
${{ github.workspace }}/era_vm/era-compiler-tester/system-contracts-test.o
${{ github.workspace }}/era_vm/era-compiler-tester/compiler-tester-vm1
${{ github.workspace }}/era_vm/era-compiler-tester/compiler-tester-lambda_vm
${{ github.workspace }}/era_vm/era-compiler-tester/solc-bin
${{ github.workspace }}/era_vm/era-compiler-tester/vyper-bin
${{ github.workspace }}/era_vm/era-compiler-tester/solc
${{ github.workspace }}/era_vm/era-compiler-tester/zksolc
${{ github.workspace }}/era_vm/era-compiler-tester/zkvyper
- name: Install Bundle
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: sudo cp zksolc zkvyper solc /usr/bin/
- name: Run interpreter ergs comparison
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: ./compiler-tester-${{ matrix.type }} --path tests/solidity/complex/interpreter/test.json --mode "Y+M3B3 0.8.26" --benchmark ${{ matrix.type }}.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: ergs-comparison-${{ matrix.type }}
path: ${{ github.workspace }}/era_vm/era-compiler-tester/${{ matrix.type }}.json
analysis:
name: "Ergs comparison analysis"
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs: ergs-comparison
if: failure() || success()
steps:
- name: Checkout vm sources
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/era_vm
- name: Setup compiler-tester submodule
working-directory: ${{ github.workspace }}/era_vm
run: make submodules
- uses: actions/download-artifact@v4
with:
pattern: ergs-comparison-*
merge-multiple: true
- name: Comparing the LLVM framework benchmark results
working-directory: ${{ github.workspace }}/era_vm/era-compiler-tester
run: |
cargo run --release --bin benchmark-analyzer -- \
--reference ${{ github.workspace }}/vm1.json --candidate ${{ github.workspace }}/lambda_vm.json --output-file result.txt
- name: Posting the LLVM benchmark results to the summary
run: |
printf "Ergs comparison results:\n" | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
cat ${{ github.workspace }}/era_vm/era-compiler-tester/result.txt | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
cat $GITHUB_STEP_SUMMARY > result.txt
- name: Posting the LLVM benchmark results to a PR comment
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
uses: mshick/add-pr-comment@v2
with:
message-path: result.txt
benchmark-run:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Zksync-era dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang clang-tools build-essential librocksdb-dev
version: 1.0
- name: Setup nodejs + yarn
uses: actions/setup-node@v4
with:
node-version: 18.20.2
cache-dependency-path: |
${{ github.workspace }}/zksync-era/contracts-test-data/yarn.lock
${{ github.workspace }}/zksync-era/contracts/l1-contracts/yarn.lock
${{ github.workspace }}/zksync-era/contracts/l2-contracts/yarn.lock
${{ github.workspace }}/zksync-era/contracts/system-contracts/yarn.lock
- name: Fetch submodules
run: make submodules
- name: Download zksolc compiler
working-directory: ${{ github.workspace }}/era-compiler-tester
run: |
curl -L https://github.com/matter-labs/zksolc-bin/releases/download/v1.5.1/zksolc-linux-amd64-musl-v1.5.1 --output zksolc
chmod +x zksolc
sudo cp zksolc /usr/bin/zksolc
- name: Download solc compiler
working-directory: ${{ github.workspace }}/era-compiler-tester
run: |
curl -L https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux --output solc
chmod +x solc
sudo cp solc /usr/bin/solc
- name: Build benchmark contracts
working-directory: ${{ github.workspace }}
run: make bench-setup
- name: Fetch toolchain version from zksync-era
run: |
cd ${{ github.workspace }}/zksync-era
echo "ERA_TOOLCHAIN=$(head ./rust-toolchain)" >> $GITHUB_ENV
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.ERA_TOOLCHAIN }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
${{ github.workspace }}/zksync-era/core/tests/vm-benchmark
- name: Check zksync-era benchmarks & era_vm build correctly
run: |
cd ${{ github.workspace }}/zksync-era
- name: Run benchmarks
working-directory: ${{ github.workspace }}
run: make bench
zksync_era_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout vm sources
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/era_vm
- name: Setup compiler-tester submodule
working-directory: ${{ github.workspace }}/era_vm
run: |
make submodules
- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Setup zksync-era
working-directory: ${{ github.workspace }}/era_vm/zksync-era
run: |
cargo install sqlx-cli --version 0.8.0
mkdir -p ./volumes/reth/data
mkdir -p ./volumes/postgres
docker compose -v up -d
sleep 15
export ZKSYNC_HOME=$(pwd)
export PATH=$PATH:./bin
zk
zk init
- name: Run tests
working-directory: ${{ github.workspace }}/era_vm
run: make era-test