Line data Source code
1 : #include "fd_precompiles.h"
2 : #include "../fd_bank.h"
3 : #include "../fd_executor_err.h"
4 : #include "../../../ballet/keccak256/fd_keccak256.h"
5 : #include "../../../ballet/ed25519/fd_ed25519.h"
6 : #include "../../../ballet/secp256k1/fd_secp256k1.h"
7 : #include "../../../ballet/secp256r1/fd_secp256r1.h"
8 :
9 : /* Docs:
10 : https://docs.solana.com/developing/runtime-facilities/programs#ed25519-program
11 : https://docs.solana.com/developing/runtime-facilities/programs#secp256k1-program */
12 :
13 : /* There are 3 precompiles and 2 ways to serialize data.
14 : The most recent one seems are ed25519 and secp256r1 with 2 bytes per instruction,
15 : that works better with JS sdk even though it consumes a few bytes. */
16 : struct __attribute__((packed)) fd_precompile_sig_offsets {
17 : ushort sig_offset;
18 : ushort sig_instr_idx;
19 : ushort pubkey_offset;
20 : ushort pubkey_instr_idx;
21 : ushort msg_offset;
22 : ushort msg_data_sz;
23 : ushort msg_instr_idx;
24 : };
25 : typedef struct fd_precompile_sig_offsets fd_ed25519_signature_offsets_t;
26 : typedef struct fd_precompile_sig_offsets fd_secp256r1_signature_offsets_t;
27 :
28 : struct __attribute__((packed)) fd_precompile_one_byte_idx_sig_offsets {
29 : ushort sig_offset;
30 : uchar sig_instr_idx;
31 : ushort pubkey_offset;
32 : uchar pubkey_instr_idx;
33 : ushort msg_offset;
34 : ushort msg_data_sz;
35 : uchar msg_instr_idx;
36 : };
37 : typedef struct fd_precompile_one_byte_idx_sig_offsets fd_secp256k1_signature_offsets_t;
38 :
39 : /*
40 : Common
41 : */
42 :
43 0 : #define SIGNATURE_SERIALIZED_SIZE (64UL)
44 0 : #define SIGNATURE_OFFSETS_SERIALIZED_SIZE (14UL)
45 0 : #define SIGNATURE_OFFSETS_START (2UL)
46 : #define DATA_START (SIGNATURE_OFFSETS_SERIALIZED_SIZE + SIGNATURE_OFFSETS_START)
47 :
48 : /*
49 : Custom
50 : */
51 :
52 0 : #define ED25519_PUBKEY_SERIALIZED_SIZE (32UL)
53 :
54 0 : #define SECP256R1_PUBKEY_SERIALIZED_SIZE (33UL)
55 :
56 0 : #define SECP256K1_PUBKEY_SERIALIZED_SIZE (20UL)
57 0 : #define SECP256K1_SIGNATURE_OFFSETS_SERIALIZED_SIZE (11UL)
58 0 : #define SECP256K1_SIGNATURE_OFFSETS_START (1UL)
59 : #define SECP256K1_DATA_START (SECP256K1_SIGNATURE_OFFSETS_SERIALIZED_SIZE + SECP256K1_SIGNATURE_OFFSETS_START)
60 :
61 : FD_STATIC_ASSERT( sizeof( fd_ed25519_signature_offsets_t )==SIGNATURE_OFFSETS_SERIALIZED_SIZE, fd_ballet );
62 : FD_STATIC_ASSERT( sizeof( fd_secp256k1_signature_offsets_t )==SECP256K1_SIGNATURE_OFFSETS_SERIALIZED_SIZE, fd_ballet );
63 :
64 : /*
65 : Common code
66 : */
67 :
68 : /* fd_precompile_get_instr_data fetches data across instructions.
69 : In Agave, the 2 precompiles have slightly different behavior:
70 : 1. Ed25519 has 16-bit instr index vs Secp256k1 has 8-bit
71 : 2. Ed25519 accepts instr index==0xFFFF as a special value to indicate
72 : the current instruction, Secp256k1 doesn't have this feature
73 : 3. Ed25519 always return InvalidDataOffsets, while Secp256k1 can
74 : return InvalidDataOffsets or InvalidSignature
75 : All these differences are completely useless, so we unify the logic.
76 : We handle the special case of index==0xFFFF as in Ed25519.
77 : We handle errors as in Secp256k1. */
78 : static inline int
79 : fd_precompile_get_instr_data( fd_exec_instr_ctx_t * ctx,
80 : ushort index,
81 : ushort offset,
82 : ushort sz,
83 0 : uchar const ** res ) {
84 0 : uchar const * data;
85 0 : ulong data_sz;
86 : /* The special value index==USHORT_MAX means current instruction.
87 : This feature has been introduced for ed25519, but not for secp256k1 where
88 : index is 1-byte only.
89 : So, fortunately, we can use the same function.
90 : https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L161-L163
91 : https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L1018 */
92 0 : if( index==USHORT_MAX ) {
93 :
94 : /* Use current instruction data */
95 0 : data = ctx->instr->data;
96 0 : data_sz = ctx->instr->data_sz;
97 :
98 0 : } else {
99 :
100 0 : if( FD_UNLIKELY( index>=TXN( ctx->txn_in->txn )->instr_cnt ) )
101 0 : return FD_EXECUTOR_PRECOMPILE_ERR_DATA_OFFSET;
102 :
103 0 : fd_txn_t const * txn = TXN( ctx->txn_in->txn );
104 0 : uchar const * payload = ctx->txn_in->txn->payload;
105 0 : fd_txn_instr_t const * instr = &txn->instr[ index ];
106 :
107 0 : data = fd_txn_get_instr_data( instr, payload );
108 0 : data_sz = instr->data_sz;
109 :
110 0 : }
111 :
112 0 : if( FD_UNLIKELY( (ulong)offset+(ulong)sz > data_sz ) ) /* (offset+sz) in [0,2^17) */
113 0 : return FD_EXECUTOR_PRECOMPILE_ERR_SIGNATURE;
114 :
115 0 : *res = data + offset;
116 0 : return 0;
117 0 : }
118 :
119 : /*
120 : Ed25519
121 : */
122 :
123 : int
124 0 : fd_precompile_ed25519_verify( fd_exec_instr_ctx_t * ctx ) {
125 :
126 0 : uchar const * data = ctx->instr->data;
127 0 : ulong data_sz = ctx->instr->data_sz;
128 :
129 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L90-L96
130 : note: this part is really silly and in fact in leaves out the edge case [0, 0].
131 :
132 : Our implementation does the following:
133 : 1. assert that there's enough data to deser 1+ fd_ed25519_sig_offsets
134 : (in particular, data[0] is accessible)
135 : - in the unlikely case, check for the Agave edge case
136 : 2. if data[0]==0 return
137 : 3. compute and check expected size */
138 0 : if( FD_UNLIKELY( data_sz < DATA_START ) ) {
139 0 : if( FD_UNLIKELY( data_sz == 2 && data[0] == 0 ) ) {
140 0 : return FD_EXECUTOR_INSTR_SUCCESS;
141 0 : }
142 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
143 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
144 0 : }
145 :
146 0 : ulong sig_cnt = data[0];
147 0 : if( FD_UNLIKELY( sig_cnt==0 ) ) {
148 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
149 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
150 0 : }
151 :
152 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L97-L103 */
153 0 : ulong expected_data_size = sig_cnt * SIGNATURE_OFFSETS_SERIALIZED_SIZE + SIGNATURE_OFFSETS_START;
154 0 : if( FD_UNLIKELY( data_sz < expected_data_size ) ) {
155 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
156 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
157 0 : }
158 :
159 0 : ulong off = SIGNATURE_OFFSETS_START;
160 0 : for( ulong i = 0; i < sig_cnt; ++i ) {
161 0 : fd_ed25519_signature_offsets_t const * sigoffs = (const fd_ed25519_signature_offsets_t *) (data + off);
162 0 : off += SIGNATURE_OFFSETS_SERIALIZED_SIZE;
163 :
164 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L110-L112 */
165 : // ???
166 :
167 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L114-L121 */
168 0 : uchar const * sig = NULL;
169 0 : int err = fd_precompile_get_instr_data( ctx,
170 0 : sigoffs->sig_instr_idx,
171 0 : sigoffs->sig_offset,
172 0 : SIGNATURE_SERIALIZED_SIZE,
173 0 : &sig );
174 0 : if( FD_UNLIKELY( err ) ) {
175 0 : ctx->txn_out->err.custom_err = (uint)err;
176 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
177 0 : }
178 :
179 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L123-L124
180 : Note: we parse the signature as part of fd_ed25519_verify.
181 : Because of this, the return error code might be different from Agave in some edge cases. */
182 :
183 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L126-L133 */
184 0 : uchar const * pubkey = NULL;
185 0 : err = fd_precompile_get_instr_data( ctx,
186 0 : sigoffs->pubkey_instr_idx,
187 0 : sigoffs->pubkey_offset,
188 0 : ED25519_PUBKEY_SERIALIZED_SIZE,
189 0 : &pubkey );
190 0 : if( FD_UNLIKELY( err ) ) {
191 0 : ctx->txn_out->err.custom_err = (uint)err;
192 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
193 0 : }
194 :
195 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L135-L136
196 : Note: we parse the public key as part of fd_ed25519_verify.
197 : Because of this, the return error code might be different from Agave in some edge cases. */
198 :
199 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L138-L145 */
200 0 : uchar const * msg = NULL;
201 0 : ushort msg_sz = sigoffs->msg_data_sz;
202 0 : err = fd_precompile_get_instr_data( ctx,
203 0 : sigoffs->msg_instr_idx,
204 0 : sigoffs->msg_offset,
205 0 : msg_sz,
206 0 : &msg );
207 0 : if( FD_UNLIKELY( err ) ) {
208 0 : ctx->txn_out->err.custom_err = (uint)err;
209 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
210 0 : }
211 :
212 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L147-L149 */
213 0 : fd_sha512_t sha[1];
214 0 : if( FD_UNLIKELY( fd_ed25519_verify( msg, msg_sz, sig, pubkey, sha )!=FD_ED25519_SUCCESS ) ) {
215 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_SIGNATURE;
216 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
217 0 : }
218 0 : }
219 :
220 0 : return FD_EXECUTOR_INSTR_SUCCESS;
221 0 : }
222 :
223 : /*
224 : Secp256K1
225 : */
226 :
227 : #if FD_HAS_SECP256K1
228 :
229 : int
230 0 : fd_precompile_secp256k1_verify( fd_exec_instr_ctx_t * ctx ) {
231 :
232 0 : uchar const * data = ctx->instr->data;
233 0 : ulong data_sz = ctx->instr->data_sz;
234 :
235 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L934-L947
236 : see comment in ed25519, here the special case is [0] instead of [0, 0] */
237 0 : if( FD_UNLIKELY( data_sz < SECP256K1_DATA_START ) ) {
238 0 : if( FD_UNLIKELY( data_sz == 1 && data[0] == 0 ) ) {
239 0 : return FD_EXECUTOR_INSTR_SUCCESS;
240 0 : }
241 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
242 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
243 0 : }
244 :
245 : /* https://github.com/anza-xyz/agave/blob/574bae8fefc0ed256b55340b9d87b7689bcdf222/sdk/src/secp256k1_instruction.rs#L938-L947 */
246 0 : ulong sig_cnt = data[0];
247 0 : if( FD_UNLIKELY( sig_cnt==0 && data_sz>1 ) ) {
248 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
249 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
250 0 : }
251 :
252 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L948-L953 */
253 0 : ulong expected_data_size = sig_cnt * SECP256K1_SIGNATURE_OFFSETS_SERIALIZED_SIZE + SECP256K1_SIGNATURE_OFFSETS_START;
254 0 : if( FD_UNLIKELY( data_sz < expected_data_size ) ) {
255 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
256 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
257 0 : }
258 :
259 0 : ulong off = SECP256K1_SIGNATURE_OFFSETS_START;
260 0 : for( ulong i = 0; i < sig_cnt; ++i ) {
261 0 : fd_secp256k1_signature_offsets_t const * sigoffs = (const fd_secp256k1_signature_offsets_t *) (data + off);
262 0 : off += SECP256K1_SIGNATURE_OFFSETS_SERIALIZED_SIZE;
263 :
264 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L960-L961 */
265 : // ???
266 :
267 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L963-L973
268 : Note: for whatever reason, Agave returns InvalidInstructionDataSize instead of InvalidDataOffsets.
269 : We just return the err as is. */
270 0 : uchar const * sig = NULL;
271 0 : int err = fd_precompile_get_instr_data( ctx,
272 0 : sigoffs->sig_instr_idx,
273 0 : sigoffs->sig_offset,
274 0 : SIGNATURE_SERIALIZED_SIZE + 1, /* extra byte is recovery id */
275 0 : &sig );
276 0 : if( FD_UNLIKELY( err ) ) {
277 0 : ctx->txn_out->err.custom_err = (uint)err;
278 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
279 0 : }
280 :
281 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L975-L981
282 : Note: we parse the signature and recovery id as part of fd_secp256k1_recover.
283 : Because of this, the return error code might be different from Agave in some edge cases. */
284 0 : int recovery_id = (int)sig[SIGNATURE_SERIALIZED_SIZE]; /* extra byte is recovery id */
285 :
286 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L983-L989 */
287 0 : uchar const * eth_address = NULL;
288 0 : err = fd_precompile_get_instr_data( ctx,
289 0 : sigoffs->pubkey_instr_idx,
290 0 : sigoffs->pubkey_offset,
291 0 : SECP256K1_PUBKEY_SERIALIZED_SIZE,
292 0 : ð_address );
293 0 : if( FD_UNLIKELY( err ) ) {
294 0 : ctx->txn_out->err.custom_err = (uint)err;
295 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
296 0 : }
297 :
298 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L991-L997 */
299 0 : uchar const * msg = NULL;
300 0 : ushort msg_sz = sigoffs->msg_data_sz;
301 0 : err = fd_precompile_get_instr_data( ctx,
302 0 : sigoffs->msg_instr_idx,
303 0 : sigoffs->msg_offset,
304 0 : msg_sz,
305 0 : &msg );
306 0 : if( FD_UNLIKELY( err ) ) {
307 0 : ctx->txn_out->err.custom_err = (uint)err;
308 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
309 0 : }
310 :
311 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L999-L1001 */
312 0 : uchar msg_hash[ FD_KECCAK256_HASH_SZ ];
313 0 : fd_keccak256_hash( msg, msg_sz, msg_hash );
314 :
315 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L1003-L1008 */
316 0 : uchar pubkey[64];
317 0 : if ( FD_UNLIKELY( fd_secp256k1_recover( pubkey, msg_hash, sig, recovery_id ) == NULL ) ) {
318 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_SIGNATURE;
319 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
320 0 : }
321 :
322 : /* https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L1009-L1013 */
323 0 : uchar pubkey_hash[ FD_KECCAK256_HASH_SZ ];
324 0 : fd_keccak256_hash( pubkey, 64, pubkey_hash );
325 :
326 0 : if( FD_UNLIKELY( memcmp( eth_address, pubkey_hash+(FD_KECCAK256_HASH_SZ-SECP256K1_PUBKEY_SERIALIZED_SIZE), SECP256K1_PUBKEY_SERIALIZED_SIZE ) ) ) {
327 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_SIGNATURE;
328 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
329 0 : }
330 0 : }
331 :
332 0 : return FD_EXECUTOR_INSTR_SUCCESS;
333 0 : }
334 :
335 : #endif
336 :
337 : /*
338 : Secp256r1
339 : */
340 :
341 : #ifdef FD_HAS_S2NBIGNUM
342 : int
343 0 : fd_precompile_secp256r1_verify( fd_exec_instr_ctx_t * ctx ) {
344 0 : if( FD_UNLIKELY( !FD_FEATURE_ACTIVE_BANK( ctx->bank, enable_secp256r1_precompile ) ) ) {
345 0 : return FD_EXECUTOR_INSTR_ERR_UNSUPPORTED_PROGRAM_ID;
346 0 : }
347 :
348 0 : uchar const * data = ctx->instr->data;
349 0 : ulong data_sz = ctx->instr->data_sz;
350 :
351 : /* ... */
352 0 : if( FD_UNLIKELY( data_sz < DATA_START ) ) {
353 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
354 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
355 0 : }
356 :
357 0 : ulong sig_cnt = data[0];
358 0 : if( FD_UNLIKELY( sig_cnt==0UL ) ) {
359 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
360 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
361 0 : }
362 :
363 : /* https://github.com/anza-xyz/agave/blob/v2.3.1/precompiles/src/secp256r1.rs#L30 */
364 0 : if( FD_UNLIKELY( sig_cnt>8UL ) ) {
365 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
366 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
367 0 : }
368 :
369 : /* ... */
370 0 : ulong expected_data_size = sig_cnt * SIGNATURE_OFFSETS_SERIALIZED_SIZE + SIGNATURE_OFFSETS_START;
371 0 : if( FD_UNLIKELY( data_sz < expected_data_size ) ) {
372 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
373 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
374 0 : }
375 :
376 0 : ulong off = SIGNATURE_OFFSETS_START;
377 0 : for( ulong i = 0; i < sig_cnt; ++i ) {
378 0 : fd_secp256r1_signature_offsets_t const * sigoffs = (const fd_secp256r1_signature_offsets_t *) (data + off);
379 0 : off += SIGNATURE_OFFSETS_SERIALIZED_SIZE;
380 :
381 : /* ... */
382 0 : uchar const * sig = NULL;
383 0 : int err = fd_precompile_get_instr_data( ctx,
384 0 : sigoffs->sig_instr_idx,
385 0 : sigoffs->sig_offset,
386 0 : SIGNATURE_SERIALIZED_SIZE,
387 0 : &sig );
388 0 : if( FD_UNLIKELY( err ) ) {
389 0 : ctx->txn_out->err.custom_err = (uint)err;
390 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
391 0 : }
392 :
393 : /* ... */
394 0 : uchar const * pubkey = NULL;
395 0 : err = fd_precompile_get_instr_data( ctx,
396 0 : sigoffs->pubkey_instr_idx,
397 0 : sigoffs->pubkey_offset,
398 0 : SECP256R1_PUBKEY_SERIALIZED_SIZE,
399 0 : &pubkey );
400 0 : if( FD_UNLIKELY( err ) ) {
401 0 : ctx->txn_out->err.custom_err = (uint)err;
402 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
403 0 : }
404 :
405 : /* ... */
406 0 : uchar const * msg = NULL;
407 0 : ushort msg_sz = sigoffs->msg_data_sz;
408 0 : err = fd_precompile_get_instr_data( ctx,
409 0 : sigoffs->msg_instr_idx,
410 0 : sigoffs->msg_offset,
411 0 : msg_sz,
412 0 : &msg );
413 0 : if( FD_UNLIKELY( err ) ) {
414 0 : ctx->txn_out->err.custom_err = (uint)err;
415 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
416 0 : }
417 :
418 : /* ... */
419 0 : fd_sha256_t sha[1];
420 0 : if( FD_UNLIKELY( fd_secp256r1_verify( msg, msg_sz, sig, pubkey, sha )!=FD_SECP256R1_SUCCESS ) ) {
421 0 : ctx->txn_out->err.custom_err = FD_EXECUTOR_PRECOMPILE_ERR_SIGNATURE;
422 0 : return FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR;
423 0 : }
424 0 : }
425 :
426 0 : return FD_EXECUTOR_INSTR_SUCCESS;
427 0 : }
428 : #else
429 : int
430 : fd_precompile_secp256r1_verify( FD_PARAM_UNUSED fd_exec_instr_ctx_t * ctx ) {
431 : return FD_EXECUTOR_INSTR_ERR_FATAL;
432 : }
433 : #endif
|