MCPcopy Create free account
hub / github.com/ProvableHQ/sdk / execute_authorization_inner

Method execute_authorization_inner

wasm/src/programs/manager/execute.rs:757–902  ·  view source on GitHub ↗
(
        process: &mut ProcessNative,
        authorization: Authorization,
        fee_authorization: Option<Authorization>,
        proving_key: Option<ProvingKey>,
        verifying_key: Option<Ve

Source from the content-addressed store, hash-verified

755 /// resolving imports, inserting keys) before calling this method.
756 #[allow(clippy::too_many_arguments)]
757 async fn execute_authorization_inner(
758 process: &mut ProcessNative,
759 authorization: Authorization,
760 fee_authorization: Option<Authorization>,
761 proving_key: Option<ProvingKey>,
762 verifying_key: Option<VerifyingKey>,
763 fee_proving_key: Option<ProvingKey>,
764 fee_verifying_key: Option<VerifyingKey>,
765 url: Option<String>,
766 query: Option<QueryOption>,
767 edition: u16,
768 program_native: ProgramNative,
769 ) -> Result<Transaction, String> {
770 let node_url = url.as_deref().unwrap_or(DEFAULT_URL);
771 let program_id = program_native.id().to_string();
772
773 // Get the latest height.
774 log("Checking the latest block height");
775 let latest_height = if let Some(ref query) = query {
776 query.current_block_height_async().await.map_err(|e| e.to_string())?
777 } else {
778 latest_block_height(node_url).await.map_err(|e| e.to_string())?
779 };
780
781 // Get the function name.
782 log("Checking the function name is valid.");
783 let function_name = IdentifierNative::from_str(&authorization.function_name()?).map_err(|e| e.to_string())?;
784
785 // Add the top-level program if not already present.
786 if program_id != "credits.aleo" && !process.contains_program(program_native.id()) {
787 process.lock().add_program_with_edition(&program_native, edition).map_err(|e| e.to_string())?;
788 }
789
790 // Insert the proving key if provided.
791 if let Some(proving_key) = proving_key {
792 if Self::contains_key(process, program_native.id(), &function_name) {
793 log(&format!(
794 "Proving & verifying keys were specified for {program_id} - {function_name:?} but a key already exists in the cache. Using cached keys"
795 ));
796 } else {
797 log(&format!(
798 "Inserting externally provided proving and verifying keys for {program_id} - {function_name:?}"
799 ));
800 process
801 .insert_proving_key(program_native.id(), &function_name, ProvingKeyNative::from(proving_key))
802 .map_err(|e| e.to_string())?;
803 if let Some(verifying_key) = verifying_key {
804 process
805 .insert_verifying_key(
806 program_native.id(),
807 &function_name,
808 VerifyingKeyNative::from(verifying_key),
809 )
810 .map_err(|e| e.to_string())?;
811 }
812 }
813 };
814

Callers

nothing calls this directly

Calls 9

latest_block_heightFunction · 0.85
is_fee_privateMethod · 0.80
containsMethod · 0.80
logFunction · 0.50
to_stringMethod · 0.45
idMethod · 0.45
function_nameMethod · 0.45
program_idMethod · 0.45

Tested by

no test coverage detected