mirror of
https://github.com/circify/circ.git
synced 2026-01-09 13:48:02 -05:00
bugfix: type error in obliv (#203)
This commit is contained in:
@@ -125,7 +125,7 @@ def doc(features):
|
||||
set of features required
|
||||
"""
|
||||
|
||||
cmd = ["cargo", "doc", "--document-private-items"]
|
||||
cmd = ["cargo", "doc", "--document-private-items", "--no-deps"]
|
||||
if features:
|
||||
cmd = cmd + ["--features"] + [",".join(features)]
|
||||
log_run_check(cmd)
|
||||
|
||||
19
examples/ZoKrates/pf/2024_07_01_chad_bug_wit.zok
Normal file
19
examples/ZoKrates/pf/2024_07_01_chad_bug_wit.zok
Normal file
@@ -0,0 +1,19 @@
|
||||
// TEST_FILE
|
||||
// FEATURES: r1cs poly
|
||||
// CMD: $circ $file r1cs --proof-impl mirage --action count
|
||||
def unsafe_baz<M>(field input) -> field[M]:
|
||||
return [input; M]
|
||||
|
||||
def foo<M>(field input) -> field[M]:
|
||||
unsafe witness field[M] inputs = unsafe_baz::<M>(input)
|
||||
assert(inputs[0] == input)
|
||||
return inputs
|
||||
|
||||
def bar<N,M>(field[N][M] input) -> field[M]:
|
||||
return foo::<M>(input[0][0])
|
||||
|
||||
def main(field[8] a) -> bool:
|
||||
field[8] x = bar::<2,8>([a, a])
|
||||
field[8] y = bar::<2,8>([x, a])
|
||||
//field[8] y = foo::<8>(x[0])
|
||||
return true
|
||||
@@ -83,8 +83,14 @@ impl OblivRewriter {
|
||||
(
|
||||
if let Some(aa) = self.tups.get(a) {
|
||||
if suitable_const(i) {
|
||||
trace!("simplify store at {}", i);
|
||||
Some(term![Op::Update(get_const(i)); aa.clone(), self.get_t(v).clone()])
|
||||
if matches!(check(aa), Sort::Tuple(..)) {
|
||||
trace!("simplify store at {}", i);
|
||||
Some(
|
||||
term![Op::Update(get_const(i)); aa.clone(), self.get_t(v).clone()],
|
||||
)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -99,16 +105,20 @@ impl OblivRewriter {
|
||||
let i = &t.cs()[1];
|
||||
if let Some(aa) = self.tups.get(a) {
|
||||
if suitable_const(i) {
|
||||
trace!("simplify select at {}", i);
|
||||
let tt = term![Op::Field(get_const(i)); aa.clone()];
|
||||
(
|
||||
Some(tt.clone()),
|
||||
if check(&tt).is_scalar() {
|
||||
Some(tt)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
)
|
||||
if matches!(check(aa), Sort::Tuple(..)) {
|
||||
trace!("simplify select at {}", i);
|
||||
let tt = term![Op::Field(get_const(i)); aa.clone()];
|
||||
(
|
||||
Some(tt.clone()),
|
||||
if check(&tt).is_scalar() {
|
||||
Some(tt)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
)
|
||||
} else {
|
||||
(None, None)
|
||||
}
|
||||
} else {
|
||||
(None, None)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user