monerochan_runtime/syscalls/
mod.rs

1mod bigint;
2mod bls12381;
3mod bn254;
4mod ed25519;
5mod fptower;
6mod halt;
7mod io;
8mod keccak_permute;
9mod memory;
10mod secp256k1;
11mod secp256r1;
12mod sha_compress;
13mod sha_extend;
14mod sys;
15mod u256x2048_mul;
16mod uint256_mul;
17mod unconstrained;
18#[cfg(feature = "verify")]
19mod verify;
20
21pub use bigint::*;
22pub use bls12381::*;
23pub use bn254::*;
24pub use ed25519::*;
25pub use fptower::*;
26pub use halt::*;
27pub use io::*;
28pub use keccak_permute::*;
29pub use memory::*;
30pub use secp256k1::*;
31pub use secp256r1::*;
32pub use sha_compress::*;
33pub use sha_extend::*;
34pub use sys::*;
35pub use u256x2048_mul::*;
36pub use uint256_mul::*;
37pub use unconstrained::*;
38#[cfg(feature = "verify")]
39pub use verify::*;
40
41/// These codes MUST match the codes in `core/src/runtime/syscall.rs`. There is a derived test
42/// that checks that the enum is consistent with the syscalls.
43///
44/// Halts the program.
45pub const HALT: u32 = 0x00_00_00_00;
46
47/// Writes to a file descriptor. Currently only used for `STDOUT/STDERR`.
48pub const WRITE: u32 = 0x00_00_00_02;
49
50/// Enter an unconstrained execution block.
51pub const ENTER_UNCONSTRAINED: u32 = 0x00_00_00_03;
52
53/// Exit an unconstrained execution block.
54pub const EXIT_UNCONSTRAINED: u32 = 0x00_00_00_04;
55
56/// Executes `SHA_EXTEND`.
57pub const SHA_EXTEND: u32 = 0x00_30_01_05;
58
59/// Executes `SHA_COMPRESS`.
60pub const SHA_COMPRESS: u32 = 0x00_01_01_06;
61
62/// Executes `ED_ADD`.
63pub const ED_ADD: u32 = 0x00_01_01_07;
64
65/// Executes `ED_DECOMPRESS`.
66pub const ED_DECOMPRESS: u32 = 0x00_00_01_08;
67
68/// Executes `KECCAK_PERMUTE`.
69pub const KECCAK_PERMUTE: u32 = 0x00_01_01_09;
70
71/// Executes `SECP256K1_ADD`.
72pub const SECP256K1_ADD: u32 = 0x00_01_01_0A;
73
74/// Executes `SECP256K1_DOUBLE`.
75pub const SECP256K1_DOUBLE: u32 = 0x00_00_01_0B;
76
77/// Executes `K256_DECOMPRESS`.
78pub const SECP256K1_DECOMPRESS: u32 = 0x00_00_01_0C;
79
80/// Executes `SECP256R1_ADD`.
81pub const SECP256R1_ADD: u32 = 0x00_01_01_2C;
82
83/// Executes `SECP256R1_DOUBLE`.
84pub const SECP256R1_DOUBLE: u32 = 0x00_00_01_2D;
85
86/// Executes `SECP256R1_DECOMPRESS`.
87pub const SECP256R1_DECOMPRESS: u32 = 0x00_00_01_2E;
88
89/// Executes `U256XU2048_MUL`.
90pub const U256XU2048_MUL: u32 = 0x00_01_01_2F;
91
92/// Executes `BN254_ADD`.
93pub const BN254_ADD: u32 = 0x00_01_01_0E;
94
95/// Executes `BN254_DOUBLE`.
96pub const BN254_DOUBLE: u32 = 0x00_00_01_0F;
97
98/// Executes the `COMMIT` precompile.
99pub const COMMIT: u32 = 0x00_00_00_10;
100
101/// Executes the `COMMIT_DEFERRED_PROOFS` precompile.
102pub const COMMIT_DEFERRED_PROOFS: u32 = 0x00_00_00_1A;
103
104/// Executes the `VERIFY_MONEROCHAN_PROOF` precompile.
105pub const VERIFY_MONEROCHAN_PROOF: u32 = 0x00_00_00_1B;
106
107/// Executes `HINT_LEN`.
108pub const HINT_LEN: u32 = 0x00_00_00_F0;
109
110/// Executes `HINT_READ`.
111pub const HINT_READ: u32 = 0x00_00_00_F1;
112
113/// Executes `BLS12381_DECOMPRESS`.
114pub const BLS12381_DECOMPRESS: u32 = 0x00_00_01_1C;
115
116/// Executes the `UINT256_MUL` precompile.
117pub const UINT256_MUL: u32 = 0x00_01_01_1D;
118
119/// Executes the `BLS12381_ADD` precompile.
120pub const BLS12381_ADD: u32 = 0x00_01_01_1E;
121
122/// Executes the `BLS12381_DOUBLE` precompile.
123pub const BLS12381_DOUBLE: u32 = 0x00_00_01_1F;
124
125/// Executes the `BLS12381_FP_ADD` precompile.
126pub const BLS12381_FP_ADD: u32 = 0x00_01_01_20;
127
128/// Executes the `BLS12381_FP_SUB` precompile.
129pub const BLS12381_FP_SUB: u32 = 0x00_01_01_21;
130
131/// Executes the `BLS12381_FP_MUL` precompile.
132pub const BLS12381_FP_MUL: u32 = 0x00_01_01_22;
133
134/// Executes the `BLS12381_FP2_ADD` precompile.
135pub const BLS12381_FP2_ADD: u32 = 0x00_01_01_23;
136
137/// Executes the `BLS12381_FP2_SUB` precompile.
138pub const BLS12381_FP2_SUB: u32 = 0x00_01_01_24;
139
140/// Executes the `BLS12381_FP2_MUL` precompile.
141pub const BLS12381_FP2_MUL: u32 = 0x00_01_01_25;
142
143/// Executes the `BN254_FP_ADD` precompile.
144pub const BN254_FP_ADD: u32 = 0x00_01_01_26;
145
146/// Executes the `BN254_FP_SUB` precompile.
147pub const BN254_FP_SUB: u32 = 0x00_01_01_27;
148
149/// Executes the `BN254_FP_MUL` precompile.
150pub const BN254_FP_MUL: u32 = 0x00_01_01_28;
151
152/// Executes the `BN254_FP2_ADD` precompile.
153pub const BN254_FP2_ADD: u32 = 0x00_01_01_29;
154
155/// Executes the `BN254_FP2_SUB` precompile.
156pub const BN254_FP2_SUB: u32 = 0x00_01_01_2A;
157
158/// Executes the `BN254_FP2_MUL` precompile.
159pub const BN254_FP2_MUL: u32 = 0x00_01_01_2B;