1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) DUSK NETWORK. All rights reserved.
//! PLONK runtime controller
use dusk_bls12_381::BlsScalar;
use crate::constraint_system::{Constraint, Witness};
#[cfg(feature = "debug")]
use crate::debugger::Debugger;
/// Runtime events
#[derive(Debug, Clone, Copy)]
pub enum RuntimeEvent {
/// A witness was appended to the constraint system
WitnessAppended {
/// Appended witness
w: Witness,
/// Witness value
v: BlsScalar,
},
/// A constraint was appended
ConstraintAppended {
/// Appended constraint
c: Constraint,
},
/// The proof construction was finished
ProofFinished,
}
/// Runtime structure with debugger
#[derive(Debug, Clone)]
pub struct Runtime {
#[cfg(feature = "debug")]
debugger: Debugger,
}
impl Runtime {
/// Create a new PLONK runtime with the provided capacity
#[allow(unused_variables)]
pub fn with_capacity(capacity: usize) -> Self {
Self {
#[cfg(feature = "debug")]
debugger: Debugger::with_capacity(capacity),
}
}
#[allow(unused_variables)]
pub(crate) fn event(&mut self, event: RuntimeEvent) {
#[cfg(feature = "debug")]
self.debugger.event(event);
}
}