Skip to main content

Crate moonproof_contracts

Crate moonproof_contracts 

Source
Expand description

Node-side host orchestration — providers, deploy/call/maintenance lifecycle, submission, indexer-driven sync, fee balancing.

Sits on top of moonproof_runtime (the wasm-friendly contract execution core) and adds the network/disk/proving surface needed to drive an end-to-end contract deploy or call from a Node-side environment.

Re-exports§

pub use audit::audit_ir_path;
pub use error::ContractRuntimeError;
pub use error::ContractsError;
pub use error::Result;
pub use error::ScopedTxIdentity;
pub use types::CallResult;
pub use types::CallResultPrivate;
pub use types::CallResultPublic;
pub use types::ContractStateQueryAt;
pub use types::ContractStateStreamStart;
pub use types::Fees;
pub use types::FinalizedTxData;
pub use types::PartitionedTranscript;
pub use types::PartitionedTranscriptWire;
pub use types::SegmentStatus;
pub use types::TxStatus;
pub use types::UnshieldedBalance;
pub use types::UnshieldedBalances;
pub use types::UnshieldedUtxo;
pub use types::UnshieldedUtxos;
pub use fee_balancing::apply_fee_balancing;
pub use fee_balancing::FeeBalancingConfig;
pub use tx_phase::FinalizedTx;
pub use tx_phase::ProvenTx;
pub use tx_phase::UnprovenTx;
pub use providers::ContractModule;
pub use providers::ContractModuleProvider;
pub use providers::ContractModuleRegistry;
pub use providers::ContractProviders;
pub use providers::ErasedProviders;
pub use providers::FacadeWalletProvider;
pub use providers::FileSystemZkConfigProvider;
pub use providers::HasContractModules;
pub use providers::HasLogger;
pub use providers::HasMidnight;
pub use providers::HasPrivateState;
pub use providers::HasProof;
pub use providers::HasPublicData;
pub use providers::HasWallet;
pub use providers::HasZkConfig;
pub use providers::InMemoryPrivateStateProvider;
pub use providers::InProcessProofProvider;
pub use providers::IndexerPublicDataProvider;
pub use providers::LoggerProvider;
pub use providers::MidnightProvider;
pub use providers::NodeClientMidnightProvider;
pub use providers::PrivateStateProvider;
pub use providers::ProofProvider;
pub use providers::ProveTxConfig;
pub use providers::Providers;
pub use providers::PublicDataProvider;
pub use providers::WalletProvider;
pub use providers::ZkConfigProvider;
pub use state_fold::fold_contract_actions;
pub use transaction::with_contract_scoped_transaction;
pub use transaction::CachedStateIdentity;
pub use transaction::CachedStates;
pub use transaction::DeferredSubmission;
pub use transaction::ScopedTransactionOptions;
pub use transaction::TransactionContextImpl;
pub use contract::deploy_contract;
pub use contract::find_deployed_contract;
pub use contract::verifier_keys_equal;
pub use contract::verify_contract_state;
pub use contract::Contract;
pub use contract::FindDeployedContractOptions;
pub use maintenance::build_unproven_maintenance_tx;
pub use incremental_deploy::deploy_contract_incremental;
pub use incremental_deploy::measure_deploy_tx;
pub use incremental_deploy::measure_tx;
pub use incremental_deploy::plan_deploy;
pub use incremental_deploy::plan_incremental_deploy;
pub use incremental_deploy::CircuitWeight;
pub use incremental_deploy::CostVector;
pub use incremental_deploy::DeployPlan;
pub use incremental_deploy::IncrementalDeployOptions;
pub use incremental_deploy::IncrementalDeployOutcome;
pub use incremental_deploy::MaintenancePassResult;
pub use incremental_deploy::PackBudget;
pub use incremental_deploy::PassFee;
pub use incremental_deploy::PassFees;
pub use incremental_deploy::PlannedCircuit;
pub use incremental_deploy::TransactionBudget;
pub use incremental_deploy::TxMeasure;
pub use incremental_deploy::DEFAULT_MAX_TX_BYTES;
pub use incremental_deploy::LEDGER_TX_BYTE_LIMIT;
pub use incremental_deploy::NORMAL_TRANSACTION_SHARE_PPM;
pub use profile::diff_snapshots;
pub use profile::ledger_era_name;
pub use profile::profile_circuit;
pub use profile::profile_contract_dir;
pub use profile::CircuitDiff;
pub use profile::CircuitProfile;
pub use profile::ContractDiff;
pub use profile::ContractProfile;
pub use profile::CostDimension;
pub use profile::DeployDiff;
pub use profile::DeployProfile;
pub use profile::ProfileOptions;
pub use profile::Regression;
pub use profile::SnapshotDiff;
pub use profile::SnapshotFile;
pub use profile::SnapshotPolicy;
pub use profile::NEAR_CLIFF_THRESHOLD_BPS;
pub use profile::SNAPSHOT_SCHEMA_VERSION;
pub use profile::STANDARD_FEE_MARGIN_BLOCKS;
pub use tx_interfaces::CallOptions;
pub use tx_interfaces::CircuitMaintenanceTx;
pub use tx_interfaces::CircuitMaintenanceTxInterfaces;
pub use tx_interfaces::ContractCalls;
pub use tx_interfaces::ContractMaintenanceTx;
pub use tx_interfaces::MaintenanceOptions;
pub use tx_model::FinalizedCallTxData;
pub use tx_model::FinalizedDeployTxData;
pub use tx_model::FinalizedDeployTxPublicData;
pub use tx_model::SubmittedCallTx;
pub use tx_model::UnsubmittedCallTxData;
pub use tx_model::UnsubmittedDeployTxData;
pub use tx_model::UnsubmittedDeployTxPrivateData;
pub use tx_model::UnsubmittedDeployTxPublicData;
pub use tx_model::UnsubmittedTxData;
pub use submit_call_tx::submit_call_tx;
pub use submit_call_tx::CallTxOutcome;
pub use submit_call_tx::PreSubmitTxHook;
pub use submit_call_tx::PrivateStateSerializer;
pub use submit_deploy_tx::submit_deploy_tx;
pub use submit_insert_vk_tx::submit_insert_verifier_key_tx;
pub use submit_insert_vk_tx::submit_insert_verifier_keys_tx;
pub use submit_insert_vk_tx::SubmitInsertVerifierKeyTxOptions;
pub use submit_insert_vk_tx::SubmitInsertVerifierKeysTxOptions;
pub use submit_remove_vk_tx::submit_remove_verifier_key_tx;
pub use submit_remove_vk_tx::SubmitRemoveVerifierKeyTxOptions;
pub use submit_replace_authority_tx::submit_replace_authority_tx;
pub use submit_replace_authority_tx::SubmitReplaceAuthorityTxOptions;
pub use submit_tx::submit_tx;
pub use submit_tx::submit_tx_async;
pub use unproven_call_tx::create_unproven_call_tx;
pub use unproven_call_tx::create_unproven_call_tx_from_initial_states;
pub use unproven_call_tx::create_unproven_call_tx_in_scope;
pub use unproven_call_tx::BuildCallOptions;
pub use unproven_call_tx::InitialStates;
pub use unproven_deploy_tx::create_unproven_deploy_tx;
pub use unproven_deploy_tx::create_unproven_deploy_tx_from_keys;
pub use unproven_deploy_tx::DeployOptions;
pub use sync::spawn as spawn_sync;
pub use sync::Watcher;
pub use utils::ledger_utils::build_contract_call_prototype;
pub use utils::ledger_utils::build_contract_call_prototypes;
pub use utils::ledger_utils::build_contract_deploy;
pub use utils::ledger_utils::create_unproven_ledger_call_tx;
pub use utils::ledger_utils::one_intent_at_segment_one;
pub use utils::ledger_utils::ttl_one_hour;
pub use utils::ledger_utils::user_addressed_unshielded_outputs;
pub use utils::ledger_utils::AssembledCall;
pub use utils::ledger_utils::ContractCallParts;
pub use utils::ledger_utils::ContractCallPrototypeInputs;
pub use utils::zswap_utils::assert_receives_match_claims;
pub use utils::zswap_utils::create_encryption_public_key_resolver;
pub use utils::zswap_utils::create_zswap_output;
pub use utils::zswap_utils::encryption_public_key_resolver_for_zswap_state;
pub use utils::zswap_utils::zswap_calls_to_segmented_offer;
pub use utils::zswap_utils::zswap_state_to_new_coins;
pub use utils::zswap_utils::zswap_state_to_offer;
pub use utils::zswap_utils::ContractInputContext;
pub use utils::zswap_utils::EncryptionPublicKeyResolver;
pub use utils::zswap_utils::PartitionedTranscriptRef;
pub use utils::zswap_utils::SegmentedOffers;
pub use utils::zswap_utils::ZswapCallContribution;
pub use utils::zswap_utils::BURN_ENCRYPTION_PUBLIC_KEY;
pub use utils::zswap_utils::DEFAULT_SEGMENT_NUMBER;
pub use utils::zswap_utils::GUARANTEED_SEGMENT_NUMBER;
pub use utils::zswap_utils::SHIELDED_BURN_COIN_PUBLIC_KEY;
pub use chain_state::query_full;
pub use chain_state::query_public;
pub use chain_state::query_public_at;
pub use chain_state::query_with_private_state;
pub use chain_state::query_with_private_state_at;
pub use cross_contract::CalleeResolver;
pub use cross_contract::ChainCallees;
pub use cross_contract::ResolvedCallee;

Modules§

audit
Static IR taint and privacy analyzer for compiled Compact contracts.
call
build_call_recipe — port of @midnight-ntwrk/midnight-js-contracts’s call / submit-call-tx.
chain_state
Port of @midnight-ntwrk/midnight-js-contracts/src/get-states.ts.
contract
Contract handle + lifecycle entry points.
cross_contract
Resolving the callees of a call tree: each callee’s code from a ContractModuleProvider, its state from the chain, both pinned to the block the root’s state was read at so the whole tree sees one snapshot (midnight-js 5’s makeCalleeStateResolver).
deploy
build_deploy_recipe — port of @midnight-ntwrk/midnight-js-contracts’s deployContract / submit-deploy-tx.
error
Host-side error types.
fee_balancing
Contract-tx dust-fee balancing.
get_unshielded_balances
Port of @midnight-ntwrk/midnight-js-contracts/src/get-unshielded-balances.ts.
incremental_deploy
Deploy a contract whose full verifier-key set is too large for one transaction, by splitting the work across several transactions.
key_location
Contract key locations: the name a contract call’s proof preimage gives its proving keys.
maintenance
Contract-maintenance MaintenanceUpdate construction + signing.
profile
Circuit ZK constraint, 5-dimensional block-budget, and DUST fee profiling for compiled Compact contracts.
providers
Provider traits — Rust port of @midnight-ntwrk/midnight-js-types/src/providers.ts.
state_fold
Indexer-driven ContractRuntimeState fold.
submit_call_tx
Port of @midnight-ntwrk/midnight-js-contracts/src/submit-call-tx.ts.
submit_deploy_tx
Build, submit, and finalize a contract deploy transaction.
submit_insert_vk_tx
Port of @midnight-ntwrk/midnight-js-contracts/src/submit-insert-vk-tx.ts.
submit_remove_vk_tx
Port of @midnight-ntwrk/midnight-js-contracts/src/submit-remove-vk-tx.ts.
submit_replace_authority_tx
Port of @midnight-ntwrk/midnight-js-contracts/src/submit-replace-authority-tx.ts.
submit_tx
Port of @midnight-ntwrk/midnight-js-contracts/src/submit-tx.ts.
sync
Long-lived sync loop over moonproof_indexer_client::subscribe_contract_actions.
transaction
Port of @midnight-ntwrk/midnight-js-contracts/src/transaction.ts and internal/transaction.ts.
tx_interfaces
Port of @midnight-ntwrk/midnight-js-contracts/src/tx-interfaces.ts.
tx_model
Data shapes flowing between the unproven-tx builders (create_unproven_deploy_tx, create_unproven_call_tx), the submit-tx pipeline (submit_tx), and the high-level deploy_contract / find_deployed_contract / call entry points.
tx_phase
Typed transaction phase newtypes.
types
Lifecycle-side types — finalized tx data, transaction status, fees, balances, call-result shapes, contract-state stream config.
unproven_call_tx
Port of @midnight-ntwrk/midnight-js-contracts/src/unproven-call-tx.ts.
unproven_deploy_tx
Build an unproven deploy transaction.
utils
Port of @midnight-ntwrk/midnight-js-contracts/src/utils/.

Structs§

ContractAuditReport
Complete static audit report for one contract.
StaticAuditOptions
Configuration knobs for audit_ir.
StaticFinding
One static privacy or soundness finding produced by audit_ir.

Enums§

AuditRule
Static privacy audit rule identifier.
Severity
Finding severity ordered from lowest to highest (Low < Medium < High).
SinkKind
Public sink or audit locus where a finding occurred.

Functions§

audit_ir
Run the static IR privacy analyzer over ir.
format_audit_human
Format one or more contract audit reports for terminal display.
format_audit_json
Format one or more contract audit reports as structured JSON.
format_audit_sarif
Format one or more contract audit reports as SARIF 2.1.0 for GitHub Code Scanning and IDE diagnostic integrations.