You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -26,10 +20,10 @@ The toolchain consists of the following:
26
20
High-level source code is processed by third-party compilers. These compilers do the following:
27
21
28
22
1. Process and validate the high-level source code.
29
-
2. Translate the source code into IR and metadata.
30
-
3. Pass the IR and metadata to our IR compilers via the standard I/O streams.
23
+
2. Translate the source code to artifacts, namely IR and metadata.
24
+
3. Pass the IR and metadata to our IR compilers via stdout using standard JSON I/O.
31
25
32
-
We are using two high-level source code compilers at the time of writing:
26
+
We are using two high-level source code compilers:
33
27
34
28
-[solc](https://github.com/ethereum/solc-bin): the official Solidity compiler. For more info, see the latest [Solidity documentation](https://docs.soliditylang.org/en/latest/).
35
29
-[vyper](https://github.com/vyperlang/vyper/releases): the official Vyper compiler. For more info, see the latest [Vyper documentation](https://docs.vyperlang.org/en/latest/index.html).
@@ -43,43 +37,21 @@ to build smart contracts on ZKsync Era.
43
37
44
38
## IR Compilers
45
39
46
-
Our toolchain includes LLVM front ends, written in Rust, that process the output of high-level source code compilers:
40
+
Our toolchain includes LLVM front ends written in Rust. The front ends process the output of high-level source code compilers:
47
41
48
-
-[zksolc](%%zk_git_repo_zksolc-bin%%) which calls `solc` as a child process. For more info, see the latest [zksolc documentation](/zksync-protocol/compiler/toolchain/solidity).
49
-
-[zkvyper](%%zk_git_repo_zkvyper-bin%%): which calls `vyper` as a child process. For more info, see the latest [zkvyper documentation](/zksync-protocol/compiler/toolchain/vyper).
42
+
-[zksolc](%%zk_git_repo_zksolc-bin%%) which calls `solc` as a child process. For more info, see the latest [zksolc documentation](https://matter-labs.github.io/era-compiler-solidity/latest/).
43
+
-[zkvyper](%%zk_git_repo_zkvyper-bin%%): which calls `vyper` as a child process. For more info, see the latest [zkvyper documentation](https://matter-labs.github.io/era-compiler-vyper/latest/).
50
44
51
45
These IR compilers perform the following steps:
52
46
53
-
1. Receive the input, which is usually standard or combined JSON passed by the Hardhat plugin via standard input.
54
-
2. Save the relevant data, modify the input with zkEVM settings, and pass it to the underlying high-level source code compiler
55
-
which is called as a child process.
47
+
1. Receive the input, which is usually standard or combined JSON passed by a tool such as Foundry or Hardhat via standard input.
48
+
2. Save the relevant data, modify the input, and pass it to the underlying high-level source code compiler
49
+
called as a child process.
56
50
3. Receive the IR and metadata from the underlying compiler.
57
51
4. Translate the IR into LLVM IR, resolving dependencies with the help of metadata.
58
-
5. Optimize the LLVM IR with the powerful LLVM framework optimizer and emit zkEVM text assembly.
52
+
5. Optimize the LLVM IR with the powerful LLVM framework optimizer and emit bytecode.
59
53
6. Print the output matching the format of the input method the IR compiler is called with.
60
54
61
55
Our IR compilers leverage I/O mechanisms which already exist in the high-level source code
62
-
compilers. They may modify the input and output to some extent, add data for features unique to zkEVM,
56
+
compilers. They may modify the input and output to some extent, add data for features unique to ZKsync EraVM,
63
57
and remove unsupported feature artifacts.
64
-
65
-
## Assembler
66
-
67
-
The [assembler](%%zk_git_repo_era-zkEVM-assembly%%), which is written in Rust, compiles zkEVM assembly
68
-
to zkEVM bytecode. This tool is not a part of our LLVM back end as it uses several cryptographic libraries which are
69
-
easier to maintain outside of the framework.
70
-
71
-
## Hardhat Plugins
72
-
73
-
We recommend using our IR compilers via [their corresponding Hardhat plugins](/zksync-era/tooling/hardhat).
74
-
Add these plugins to the Hardhat's config file to compile new projects or migrate
75
-
existing ones to ZKsync Era. For a lower-level approach, download our compiler binaries via the
76
-
links above and use their CLI interfaces.
77
-
78
-
### Installing and configuring plugins
79
-
80
-
Add the plugins below to the Hardhat's config file to compile new projects or migrate
81
-
existing ones to ZKsync Era. For a lower-level approach, download our compiler binaries
82
-
[links above](#ir-compilers) and use their CLI interfaces.
Copy file name to clipboardExpand all lines: content/20.zksync-protocol/50.compiler/20.specification/60.instructions/10.index.md
+2-20Lines changed: 2 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ stated explicitly in the description of each instruction.
15
15
## Addressing modes
16
16
17
17
EraVM is a register-based virtual machine with different addressing modes.
18
-
It overrides all stack mechanics described in [the original EVM opcodes documentation](https://www.evm.codes/) including
18
+
It overrides all stack mechanics described in [the official documentation of EVM opcodes](https://www.evm.codes/) including
19
19
errors they produce on EVM.
20
20
21
21
## Solidity Intermediate Representations (IRs)
@@ -27,22 +27,4 @@ Every instruction is translated via two IRs available in the Solidity compiler u
27
27
28
28
## Yul Extensions
29
29
30
-
At the moment there is no way of adding ZKsync-specific instructions to Yul as long as we use the official Solidity
31
-
compiler, which would produce an error on an unknown instruction.
32
-
33
-
There are two ways of supporting such instructions: one for Solidity and one for Yul.
34
-
35
-
### The Solidity Mode
36
-
37
-
In Solidity we have introduced **call simulations**. They are not actual calls, as they are substituted by our Yul
38
-
translator with the needed instruction, depending on the constant address. This way the Solidity compiler is not
39
-
optimizing them out and is not emitting compilation errors.
40
-
41
-
The reference of such extensions is coming soon.
42
-
43
-
### The Yul Mode
44
-
45
-
The non-call ZKsync-specific instructions are only available in the Yul mode of **zksolc**.
46
-
To have better compatibility, they are implemented as `verbatim` instructions with some predefined keys.
47
-
48
-
The reference of such extensions is coming soon.
30
+
ZKsync EraVM introduced a set of EraVM-specific instructions. The set is documented at [the official *zksolc* documentation](https://matter-labs.github.io/era-compiler-solidity/latest/).
0 commit comments