-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
When defining a program module and instructions as follows
#[light_program]
#[program]
pub mod zktest {
use super::*;
pub fn compress01<'info>(
ctx: LightContext<'_, '_, '_, 'info, Compress01<'info>>,
) -> Result<()> {
ctx.light_accounts.compressed_user_record.user_authority = ctx.accounts.signer.key();
Ok(())
}
// It doesn't work
pub fn compress02<'info>(
ctx: LightContext<'_, '_, '_, 'info, Compress02<'info>>,
) -> Result<()> {
instructions::compress02(&mut ctx)
}
}the function body of compress02 is expanded like this:
let mut ctx: ::light_sdk::context::LightContext<Compress02, LightCompress02> = ::light_sdk::context::LightContext::new(
ctx,
inputs,
merkle_context,
merkle_tree_root_index,
address_merkle_context,
address_merkle_tree_root_index,
)?;
let inputs = ParamsCompress02 {};
ctx.check_constraints(&inputs)?;
ctx.derive_address_seeds(address_merkle_context, &inputs);
let ParamsCompress02 {} = inputs;
ctx.verify(proof)?;
instructions::compress02(&mut ctx)and changes made to ctx in the instructions::compress02 function are not being reflected.
Current workaround is to assign the result into a temporary variable and return it.
pub fn compress02<'info>(
ctx: LightContext<'_, '_, '_, 'info, Compress02<'info>>,
) -> Result<()> {
let retval = instructions::compress02(&mut ctx);
retval
}SwenSchaeferjohann and MuhtasimTanmoy
Metadata
Metadata
Assignees
Labels
No labels