light-sdk-macros 0.23.0

Macros for Programs using the Light SDK for ZK Compression
Documentation
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
//! Visitor-based AST traversal utilities using syn's Visit trait.
//!
//! This module provides:
//! - `FieldExtractor`: A visitor for extracting field names from expressions
//! - `ClientSeedInfo`: Classification of seed elements for client code generation
//! - `classify_seed`: Classify a seed element into a `ClientSeedInfo`
//! - `generate_client_seed_code`: Generate (parameter, expression) from classified seed
//!
//! The implementation stores references during traversal to avoid allocations,
//! only cloning identifiers when producing the final output.

use std::collections::HashSet;

use proc_macro2::TokenStream;
use quote::quote;
use syn::{
    visit::{self, Visit},
    Expr, Ident, Member,
};

use super::instructions::{InstructionDataSpec, SeedElement};
use crate::light_pdas::{account::utils::is_pubkey_type, shared_utils::is_constant_identifier};

/// Visitor that extracts field names matching ctx.field, ctx.accounts.field, or data.field patterns.
///
/// Uses syn's Visit trait for efficient read-only traversal. Stores references during
/// traversal to minimize allocations, only cloning when producing final output.
///
/// # Example
/// ```ignore
/// let fields = FieldExtractor::ctx_fields(&["fee_payer"])
///     .extract(&some_expr);
/// ```
pub struct FieldExtractor<'ast, 'cfg> {
    /// Extract ctx.field and ctx.accounts.field patterns
    extract_ctx: bool,
    /// Extract data.field patterns
    extract_data: bool,
    /// Field names to exclude from results
    excluded: &'cfg [&'cfg str],
    /// The context parameter name (e.g., "ctx", "context", "anchor_ctx")
    ctx_name: &'cfg str,
    /// Collected field references (avoids cloning during traversal)
    fields: Vec<&'ast Ident>,
    /// Track seen field names for deduplication
    seen: HashSet<String>,
}

impl<'ast, 'cfg> FieldExtractor<'ast, 'cfg> {
    /// Create an extractor for ctx.field and ctx.accounts.field patterns.
    ///
    /// Uses the default context name "ctx".
    /// Excludes common infrastructure fields like fee_payer, rent_sponsor, etc.
    pub fn ctx_fields(excluded: &'cfg [&'cfg str]) -> Self {
        Self::ctx_fields_with_name(excluded, "ctx")
    }

    /// Create an extractor for ctx.field and ctx.accounts.field patterns with a custom context name.
    ///
    /// `ctx_name` is the context parameter name (e.g., "ctx", "context", "anchor_ctx").
    /// Excludes common infrastructure fields like fee_payer, rent_sponsor, etc.
    pub fn ctx_fields_with_name(excluded: &'cfg [&'cfg str], ctx_name: &'cfg str) -> Self {
        Self {
            extract_ctx: true,
            extract_data: false,
            excluded,
            ctx_name,
            fields: Vec::new(),
            seen: HashSet::new(),
        }
    }

    /// Create an extractor for data.field patterns.
    pub fn data_fields() -> Self {
        Self {
            extract_ctx: false,
            extract_data: true,
            excluded: &[],
            ctx_name: "ctx", // Not used for data extraction, but needed for struct
            fields: Vec::new(),
            seen: HashSet::new(),
        }
    }

    /// Extract field names from the given expression.
    ///
    /// Visits the expression tree and collects all field names matching the configured patterns.
    /// Returns deduplicated field identifiers in order of first occurrence.
    /// Cloning is deferred until this final output stage.
    pub fn extract(mut self, expr: &'ast Expr) -> Vec<Ident> {
        self.visit_expr(expr);
        // Clone only when producing final output
        self.fields.into_iter().cloned().collect()
    }

    /// Try to add a field reference if not excluded and not already seen.
    fn try_add(&mut self, field: &'ast Ident) {
        let name = field.to_string();
        if !self.excluded.contains(&name.as_str()) && self.seen.insert(name) {
            self.fields.push(field);
        }
    }

    /// Check if the base expression is `<ctx_name>.accounts` (e.g., `ctx.accounts`, `context.accounts`).
    /// Uses the default context name "ctx".
    pub fn is_ctx_accounts(base: &Expr) -> bool {
        Self::is_ctx_accounts_with_name(base, "ctx")
    }

    /// Check if the base expression is `<ctx_name>.accounts` with a custom context name.
    pub fn is_ctx_accounts_with_name(base: &Expr, ctx_name: &str) -> bool {
        if let Expr::Field(nested) = base {
            if let Member::Named(member) = &nested.member {
                return member == "accounts" && Self::is_path_ident(&nested.base, ctx_name);
            }
        }
        false
    }

    /// Check if the base expression matches the `<any>.accounts` pattern.
    /// This is flexible and accepts any identifier before `.accounts` (ctx, context, anchor_ctx, etc.).
    /// Returns the identifier name if matched.
    pub fn is_any_ctx_accounts(base: &Expr) -> Option<String> {
        if let Expr::Field(nested) = base {
            if let Member::Named(member) = &nested.member {
                if member == "accounts" {
                    if let Expr::Path(path) = &*nested.base {
                        if let Some(ident) = path.path.get_ident() {
                            return Some(ident.to_string());
                        }
                    }
                }
            }
        }
        None
    }

    /// Check if an expression is a path with the given identifier.
    pub fn is_path_ident(expr: &Expr, ident: &str) -> bool {
        matches!(expr, Expr::Path(p) if p.path.is_ident(ident))
    }
}

impl<'ast, 'cfg> Visit<'ast> for FieldExtractor<'ast, 'cfg> {
    fn visit_expr_field(&mut self, node: &'ast syn::ExprField) {
        if let Member::Named(field_name) = &node.member {
            // Check for ctx.accounts.field pattern (using configured ctx_name)
            if self.extract_ctx && Self::is_ctx_accounts_with_name(&node.base, self.ctx_name) {
                self.try_add(field_name);
                // Don't recurse further - we found our target
                return;
            }

            // Check for ctx.field pattern (direct access, using configured ctx_name)
            if self.extract_ctx && Self::is_path_ident(&node.base, self.ctx_name) {
                self.try_add(field_name);
                return;
            }

            // Check for data.field pattern
            if self.extract_data && Self::is_path_ident(&node.base, "data") {
                self.try_add(field_name);
                return;
            }
        }

        // Continue visiting child expressions
        visit::visit_expr_field(self, node);
    }
}

// =============================================================================
// CLIENT SEED CLASSIFICATION
// =============================================================================

/// Classified seed for client code generation.
///
/// Separates "what kind of seed is this?" from "what code to generate?".
/// Each variant captures all info needed for the generation phase.
#[derive(Debug, Clone)]
pub enum ClientSeedInfo {
    /// String literal: "seed" -> "seed".as_bytes()
    Literal(String),
    /// Byte literal: b"seed" -> &[...]
    ByteLiteral(Vec<u8>),
    /// Constant: fully qualified path -> path.as_ref()
    Constant {
        path: syn::Path,
        is_cpi_signer: bool,
    },
    /// ctx.field or ctx.accounts.field -> Pubkey parameter
    CtxField { field: Ident, method: Option<Ident> },
    /// data.field -> typed parameter from instruction_data
    DataField { field: Ident, method: Option<Ident> },
    /// Function call - stored as original expression for proper AST transformation
    FunctionCall(Box<syn::ExprCall>),
    /// Raw identifier that becomes a Pubkey parameter
    Identifier(Ident),
    /// Fallback for expressions that don't match other patterns
    RawExpr(Box<syn::Expr>),
}

/// Classify a SeedElement for client code generation.
pub fn classify_seed(seed: &SeedElement) -> syn::Result<ClientSeedInfo> {
    match seed {
        SeedElement::Literal(lit) => Ok(ClientSeedInfo::Literal(lit.value())),
        SeedElement::Expression(expr) => classify_seed_expr(expr),
    }
}

/// Classify an expression into a ClientSeedInfo variant.
fn classify_seed_expr(expr: &syn::Expr) -> syn::Result<ClientSeedInfo> {
    match expr {
        syn::Expr::Field(field_expr) => classify_field_expr(field_expr),
        syn::Expr::MethodCall(method_call) => classify_method_call(method_call),
        syn::Expr::Lit(lit_expr) => classify_lit_expr(lit_expr),
        syn::Expr::Path(path_expr) => classify_path_expr(path_expr),
        syn::Expr::Call(call_expr) => classify_call_expr(call_expr),
        syn::Expr::Reference(ref_expr) => classify_seed_expr(&ref_expr.expr),
        _ => Ok(ClientSeedInfo::RawExpr(Box::new(expr.clone()))),
    }
}

/// Classify a field expression (e.g., ctx.field, data.field).
/// Accepts any context name (ctx, context, anchor_ctx, etc.) for `.accounts.field` patterns.
fn classify_field_expr(field_expr: &syn::ExprField) -> syn::Result<ClientSeedInfo> {
    if let Member::Named(field_name) = &field_expr.member {
        // Check for <any>.accounts.field pattern (ctx.accounts.field, context.accounts.field, etc.)
        if FieldExtractor::is_any_ctx_accounts(&field_expr.base).is_some() {
            return Ok(ClientSeedInfo::CtxField {
                field: field_name.clone(),
                method: None,
            });
        }

        // Check for direct base.field patterns
        if let syn::Expr::Path(path) = &*field_expr.base {
            if let Some(segment) = path.path.segments.first() {
                if segment.ident == "data" {
                    return Ok(ClientSeedInfo::DataField {
                        field: field_name.clone(),
                        method: None,
                    });
                }
                // Any other single identifier followed by .field is likely a context field
                // This handles ctx.bumps, context.program_id, etc.
                return Ok(ClientSeedInfo::CtxField {
                    field: field_name.clone(),
                    method: None,
                });
            }
        }

        // Unrecognized field pattern - preserve as raw expression
        // This lets downstream code decide how to handle it
        return Ok(ClientSeedInfo::RawExpr(Box::new(syn::Expr::Field(
            field_expr.clone(),
        ))));
    }

    Ok(ClientSeedInfo::RawExpr(Box::new(syn::Expr::Field(
        field_expr.clone(),
    ))))
}

/// Classify a method call expression (e.g., data.field.method(), ctx.accounts.field.key()).
/// Accepts any context name (ctx, context, anchor_ctx, etc.) for `.accounts.field.method()` patterns.
fn classify_method_call(method_call: &syn::ExprMethodCall) -> syn::Result<ClientSeedInfo> {
    // Check if receiver is a field expression
    if let syn::Expr::Field(field_expr) = &*method_call.receiver {
        if let Member::Named(field_name) = &field_expr.member {
            // Check for <any>.accounts.field.method() pattern
            if FieldExtractor::is_any_ctx_accounts(&field_expr.base).is_some() {
                return Ok(ClientSeedInfo::CtxField {
                    field: field_name.clone(),
                    method: Some(method_call.method.clone()),
                });
            }

            // Check for direct base.field patterns
            if let syn::Expr::Path(path) = &*field_expr.base {
                if let Some(segment) = path.path.segments.first() {
                    if segment.ident == "data" {
                        return Ok(ClientSeedInfo::DataField {
                            field: field_name.clone(),
                            method: Some(method_call.method.clone()),
                        });
                    }
                    // Any other single identifier followed by .field is likely a context field
                    return Ok(ClientSeedInfo::CtxField {
                        field: field_name.clone(),
                        method: Some(method_call.method.clone()),
                    });
                }
            }
        }
    }

    // Check if receiver is a function call (e.g., func(args).as_ref())
    // Strip the trailing method call and classify the inner call as FunctionCall.
    // This handles expressions like crate::max_key(&ctx.fee_payer, &ctx.authority).as_ref()
    // and crate::id().as_ref() in standalone seed helper functions.
    if let syn::Expr::Call(call_expr) = &*method_call.receiver {
        return classify_call_expr(call_expr);
    }

    // Check if receiver is a path identifier (e.g., ident.as_ref())
    if let syn::Expr::Path(path_expr) = &*method_call.receiver {
        if let Some(ident) = path_expr.path.get_ident() {
            return Ok(ClientSeedInfo::Identifier(ident.clone()));
        }
    }

    Ok(ClientSeedInfo::RawExpr(Box::new(syn::Expr::MethodCall(
        method_call.clone(),
    ))))
}

/// Classify a literal expression.
fn classify_lit_expr(lit_expr: &syn::ExprLit) -> syn::Result<ClientSeedInfo> {
    if let syn::Lit::ByteStr(byte_str) = &lit_expr.lit {
        Ok(ClientSeedInfo::ByteLiteral(byte_str.value()))
    } else {
        Ok(ClientSeedInfo::RawExpr(Box::new(syn::Expr::Lit(
            lit_expr.clone(),
        ))))
    }
}

/// Classify a path expression (constant or identifier).
///
/// Constants are detected by checking if the last path segment is an uppercase identifier.
/// After `convert_classified_to_seed_elements`, constants are fully qualified
/// (e.g., `crate::module::CONSTANT`), so we store the full path.
///
/// Type-qualified paths like `<SeedHolder as HasSeed>::TRAIT_SEED` are NOT classified
/// as constants because stripping the qself would lose the type qualification.
fn classify_path_expr(path_expr: &syn::ExprPath) -> syn::Result<ClientSeedInfo> {
    // Type-qualified paths (qself present) must be preserved as raw expressions
    // to keep the <Type as Trait>:: qualification intact.
    if path_expr.qself.is_some() {
        return Ok(ClientSeedInfo::RawExpr(Box::new(syn::Expr::Path(
            path_expr.clone(),
        ))));
    }

    // Check last segment for constant pattern (works for both single and multi-segment paths)
    if let Some(last_seg) = path_expr.path.segments.last() {
        let last_str = last_seg.ident.to_string();
        if is_constant_identifier(&last_str) {
            return Ok(ClientSeedInfo::Constant {
                path: path_expr.path.clone(),
                is_cpi_signer: last_str == "LIGHT_CPI_SIGNER",
            });
        }
    }
    // Single-segment non-constant identifiers become Identifier
    if let Some(ident) = path_expr.path.get_ident() {
        return Ok(ClientSeedInfo::Identifier(ident.clone()));
    }
    Ok(ClientSeedInfo::RawExpr(Box::new(syn::Expr::Path(
        path_expr.clone(),
    ))))
}

/// Classify a function call expression.
/// We store the original expression because function call arguments need AST transformation,
/// not simple classification - we need to preserve method calls like `.key()` while mapping
/// base identifiers to parameters.
fn classify_call_expr(call_expr: &syn::ExprCall) -> syn::Result<ClientSeedInfo> {
    Ok(ClientSeedInfo::FunctionCall(Box::new(call_expr.clone())))
}

// =============================================================================
// CLIENT CODE GENERATION
// =============================================================================

/// Map a function call argument, extracting parameters and transforming ctx/data references.
///
/// This preserves the expression structure (method calls, references) while replacing
/// `ctx.field`, `ctx.accounts.field`, and `data.field` with just the field name.
/// Returns the transformed expression and collects parameters into the provided vectors.
fn map_call_arg(
    arg: &syn::Expr,
    instruction_data: &[InstructionDataSpec],
    seen_params: &mut HashSet<String>,
    parameters: &mut Vec<TokenStream>,
    is_pinocchio: bool,
) -> syn::Result<TokenStream> {
    // Choose the correct pubkey path based on framework
    let pubkey_param = if is_pinocchio {
        quote! { light_account_pinocchio::solana_pubkey::Pubkey }
    } else {
        quote! { solana_pubkey::Pubkey }
    };

    match arg {
        syn::Expr::Reference(ref_expr) => {
            let inner = map_call_arg(
                &ref_expr.expr,
                instruction_data,
                seen_params,
                parameters,
                is_pinocchio,
            )?;
            Ok(quote! { &#inner })
        }
        syn::Expr::Field(field_expr) => {
            if let syn::Member::Named(field_name) = &field_expr.member {
                // Check for ctx.accounts.field
                if FieldExtractor::is_ctx_accounts(&field_expr.base) {
                    if seen_params.insert(field_name.to_string()) {
                        parameters.push(quote! { #field_name: &#pubkey_param });
                    }
                    return Ok(quote! { #field_name });
                }
                // Check for ctx.field or data.field
                if let syn::Expr::Path(path) = &*field_expr.base {
                    if let Some(segment) = path.path.segments.first() {
                        if segment.ident == "data" {
                            if let Some(data_spec) = instruction_data
                                .iter()
                                .find(|d| d.field_name == *field_name)
                            {
                                if seen_params.insert(field_name.to_string()) {
                                    let param_type = &data_spec.field_type;
                                    let param_with_ref = if is_pubkey_type(param_type) {
                                        quote! { #field_name: &#param_type }
                                    } else {
                                        quote! { #field_name: #param_type }
                                    };
                                    parameters.push(param_with_ref);
                                }
                                return Ok(quote! { #field_name });
                            }
                            // data.field not in instruction_data (e.g., from FunctionCall args)
                            // Default to Pubkey parameter
                            if seen_params.insert(field_name.to_string()) {
                                parameters.push(quote! { #field_name: &#pubkey_param });
                            }
                            return Ok(quote! { #field_name });
                        } else if segment.ident == "ctx" {
                            if seen_params.insert(field_name.to_string()) {
                                parameters.push(quote! { #field_name: &#pubkey_param });
                            }
                            return Ok(quote! { #field_name });
                        }
                    }
                }
            }
            Ok(quote! { #field_expr })
        }
        syn::Expr::MethodCall(method_call) => {
            let receiver = map_call_arg(
                &method_call.receiver,
                instruction_data,
                seen_params,
                parameters,
                is_pinocchio,
            )?;
            let method = &method_call.method;
            let args: Vec<TokenStream> = method_call
                .args
                .iter()
                .map(|a| map_call_arg(a, instruction_data, seen_params, parameters, is_pinocchio))
                .collect::<syn::Result<_>>()?;
            Ok(quote! { (#receiver).#method(#(#args),*) })
        }
        syn::Expr::Call(nested_call) => {
            let func = &nested_call.func;
            let args: Vec<TokenStream> = nested_call
                .args
                .iter()
                .map(|a| map_call_arg(a, instruction_data, seen_params, parameters, is_pinocchio))
                .collect::<syn::Result<_>>()?;
            Ok(quote! { (#func)(#(#args),*) })
        }
        syn::Expr::Path(path_expr) => {
            // Check if this is a simple identifier that should become a parameter
            if let Some(ident) = path_expr.path.get_ident() {
                let name = ident.to_string();
                if name != "ctx"
                    && name != "data"
                    && !is_constant_identifier(&name)
                    && seen_params.insert(name)
                {
                    parameters.push(quote! { #ident: &#pubkey_param });
                }
            }
            Ok(quote! { #path_expr })
        }
        _ => Ok(quote! { #arg }),
    }
}

/// Generate code for a classified seed, adding to the provided parameter and expression lists.
///
/// This modifies the parameters and expressions vectors directly rather than returning
/// individual values, which allows for proper handling of function call seeds that may
/// contribute multiple parameters.
pub fn generate_client_seed_code(
    info: &ClientSeedInfo,
    instruction_data: &[InstructionDataSpec],
    seen_params: &mut HashSet<String>,
    parameters: &mut Vec<TokenStream>,
    expressions: &mut Vec<TokenStream>,
    is_pinocchio: bool,
) -> syn::Result<()> {
    // Choose the correct pubkey path based on framework
    let pubkey_param = if is_pinocchio {
        quote! { light_account_pinocchio::solana_pubkey::Pubkey }
    } else {
        quote! { solana_pubkey::Pubkey }
    };

    match info {
        ClientSeedInfo::Literal(s) => {
            expressions.push(quote! { #s.as_bytes() });
        }

        ClientSeedInfo::ByteLiteral(bytes) => {
            expressions.push(quote! { &[#(#bytes),*] });
        }

        ClientSeedInfo::Constant {
            path,
            is_cpi_signer,
        } => {
            let expr = if *is_cpi_signer {
                quote! { #path.cpi_signer.as_ref() }
            } else {
                quote! { { let __seed: &[u8] = #path.as_ref(); __seed } }
            };
            expressions.push(expr);
        }

        ClientSeedInfo::CtxField { field, method } => {
            if seen_params.insert(field.to_string()) {
                parameters.push(quote! { #field: &#pubkey_param });
            }
            let expr = match method {
                Some(m) => quote! { #field.#m().as_ref() },
                None => quote! { #field.as_ref() },
            };
            expressions.push(expr);
        }

        ClientSeedInfo::DataField { field, method } => {
            let data_spec = instruction_data
                .iter()
                .find(|d| d.field_name == *field)
                .ok_or_else(|| {
                    syn::Error::new(
                        field.span(),
                        format!("data.{} used in seeds but no type specified", field),
                    )
                })?;

            if seen_params.insert(field.to_string()) {
                let param_type = &data_spec.field_type;
                let param_with_ref = if is_pubkey_type(param_type) {
                    quote! { #field: &#param_type }
                } else {
                    quote! { #field: #param_type }
                };
                parameters.push(param_with_ref);
            }

            let expr = match method {
                Some(m) => quote! { #field.#m().as_ref() },
                None => quote! { #field.as_ref() },
            };
            expressions.push(expr);
        }

        ClientSeedInfo::Identifier(ident) => {
            if seen_params.insert(ident.to_string()) {
                parameters.push(quote! { #ident: &#pubkey_param });
            }
            expressions.push(quote! { #ident.as_ref() });
        }

        ClientSeedInfo::FunctionCall(call_expr) => {
            let mut mapped_args: Vec<TokenStream> = Vec::new();
            for arg in &call_expr.args {
                let mapped =
                    map_call_arg(arg, instruction_data, seen_params, parameters, is_pinocchio)?;
                mapped_args.push(mapped);
            }
            let func = &call_expr.func;
            expressions.push(quote! { (#func)(#(#mapped_args),*).as_ref() });
        }

        ClientSeedInfo::RawExpr(expr) => {
            expressions.push(quote! { { let __seed: &[u8] = (#expr).as_ref(); __seed } });
        }
    }
    Ok(())
}