#[zk_on_variable_rejected]
Expand description

Secret variable rejection zero-knowledge contract annotation

OPTIONAL HOOK: This is an optional hook, and is not required for a well-formed zero-knowledge contract. The default behaviour is to do nothing.

If the annotated function panics changes to the contract state will be rolled back.

Annotated function is automatically called when a Zk variable is rejected for any reason. This hook is exclusively called by the blockchain itself, and cannot be called manually from the dashboard, nor from another contract.

Allows the contract to automatically react to ZK input rejection.

Must have a signature of the following format:



#[zk_on_variable_rejected]
pub fn zk_on_variable_rejected(
  context: ContractContext,
  state: ContractState,
  zk_state: ZkState<Metadata>,
  variable_id: SecretVarId,
) -> (ContractState, Vec<EventGroup>, Vec<ZkStateChange>)