Skip to main content

CircuitContext

For the complete documentation index, see llms.txt

@midnight-ntwrk/compact-runtime v0.20.0


@midnight-ntwrk/compact-runtime / CircuitContext

Interface: CircuitContext<PS>

The external information accessible from within a Compact circuit call

Type Parameters​

PS​

PS = any

Properties​

activeContracts?​

optional activeContracts: Set<string>;

The contract addresses currently executing: the entry contract, plus every callee whose call has not returned. Shared by reference across the call tree, so crossContractCall can reject re-entry (A -> A, A -> B -> A) from any depth.


callContext​

callContext: CallContext<PS>;

The context for the current call.


callProofDataTrace​

callProofDataTrace: CallProofDataTrace;

Sequence of calls made during the execution of the circuit (including the call for the root circuit).


contractStates?​

optional contractStates: Record<string, ContractState>;

The deployed state of every cross-contract callee, keyed by address and filled on first resolution. The cached query context keeps only ledger data, so this is where a callee's verifier keys are read from, for any of its circuits and on every call. The entry contract is always on the call stack, so the re-entrancy guard keeps it out of callee position and it never appears here.


costModel​

costModel: CostModel;

The cost model to use for the execution.


events​

events: LogEvent[];

Events the VM emitted from log operations, each tagged with the contract that emitted it. One list for the whole call tree, threaded like callProofDataTrace.


gasCosts​

gasCosts: Record<ContractAddress, RunningCost>;

The current gas costs for every contract in the call tree.


gasLimit?​

optional gasLimit: RunningCost;

The gas limit for this circuit.


moduleProvider?​

optional moduleProvider: ContractModuleProvider;

The ContractModuleProvider. Absent unless the execution can make cross-contract calls; reaching crossContractCall without one is a ModuleProviderAbsent failure.


queryContexts​

queryContexts: Record<ContractAddress, QueryContext>;

The current query context of every contract in the call tree.


stateProvider?​

optional stateProvider: ContractStateProvider;

Can fetch the current state of a contract from the blockchain.


zswapLocalStates​

zswapLocalStates: Record<ContractAddress, EncodedZswapLocalState>;

The current Zswap local state of every contract in the call tree, keyed like queryContexts. Each contract has its own currentIndex, inputs and outputs; only the submitter's coinPublicKey is shared, since one wallet pays for the transaction.