Skip to content

Commit 0370a5c

Browse files
committed
Remove unused methods in zkapp interfaces
1 parent 091d551 commit 0370a5c

File tree

5 files changed

+17
-66
lines changed

5 files changed

+17
-66
lines changed

ledger/src/zkapps/intefaces.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ where
110110
type Bool: BoolInterface;
111111

112112
fn zero() -> Self;
113-
fn equal(&self, other: &Self) -> Self::Bool;
114-
fn add_flagged(&self, other: &Self, w: &mut Self::W) -> (Self, Self::Bool);
115-
fn add_signed_flagged(&self, signed: &impl SignedAmountInterface) -> (Self, Self::Bool);
116113
fn of_constant_fee(fee: currency::Fee) -> Self;
117114
}
118115

@@ -147,7 +144,6 @@ where
147144
type Amount: AmountInterface;
148145
type SignedAmount: SignedAmountInterface;
149146

150-
fn sub_amount_flagged(&self, amount: Self::Amount) -> (Self, Self::Bool);
151147
fn add_signed_amount_flagged(
152148
&self,
153149
signed_amount: Self::SignedAmount,
@@ -185,8 +181,6 @@ pub trait GlobalSlotSinceGenesisInterface {
185181
type W: WitnessGenerator<Fp>;
186182
type Bool: BoolInterface;
187183

188-
fn zero() -> Self;
189-
fn greater_than(&self, other: &Self) -> Self::Bool;
190184
fn equal(&self, other: &Self, w: &mut Self::W) -> Self::Bool;
191185
}
192186

@@ -195,7 +189,6 @@ pub trait GlobalSlotSpanInterface {
195189
type Bool: BoolInterface;
196190
type SlotSpan;
197191

198-
fn zero() -> Self;
199192
fn greater_than(this: &Self::SlotSpan, other: &Self::SlotSpan, w: &mut Self::W) -> Self::Bool;
200193
}
201194

@@ -261,7 +254,6 @@ where
261254

262255
fn empty() -> Self;
263256
fn is_empty(&self, w: &mut Self::W) -> Self::Bool;
264-
fn pop_exn(&self) -> (Self::Elt, Self);
265257
fn pop(&self, w: &mut Self::W) -> Opt<(Self::Elt, Self)>;
266258
fn push(elt: Self::Elt, onto: Self, w: &mut Self::W) -> Self;
267259
}
@@ -412,7 +404,7 @@ pub trait TransactionCommitmentInterface {
412404
type W: WitnessGenerator<Fp>;
413405

414406
fn empty() -> Fp;
415-
fn commitment(account_updates: &Self::CallForest, w: &mut Self::W) -> Fp;
407+
fn commitment(account_updates: &Self::CallForest) -> Fp;
416408
fn full_commitment(
417409
account_updates: &Self::AccountUpdate,
418410
memo_hash: Fp,

ledger/src/zkapps/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(unused)]
2-
31
pub mod intefaces;
42
pub mod non_snark;
53
pub mod snark;

ledger/src/zkapps/non_snark.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(unused)]
2+
13
use mina_hasher::Fp;
24

35
use crate::{
@@ -51,15 +53,6 @@ impl AmountInterface for Amount {
5153
fn zero() -> Self {
5254
todo!()
5355
}
54-
fn equal(&self, other: &Self) -> Self::Bool {
55-
todo!()
56-
}
57-
fn add_flagged(&self, other: &Self, w: &mut Self::W) -> (Self, Self::Bool) {
58-
todo!()
59-
}
60-
fn add_signed_flagged(&self, signed: &impl SignedAmountInterface) -> (Self, Self::Bool) {
61-
todo!()
62-
}
6356
fn of_constant_fee(fee: crate::scan_state::currency::Fee) -> Self {
6457
todo!()
6558
}
@@ -145,9 +138,6 @@ impl StackInterface for CallStack {
145138
fn is_empty(&self, w: &mut Self::W) -> Boolean {
146139
todo!()
147140
}
148-
fn pop_exn(&self) -> (Self::Elt, Self) {
149-
todo!()
150-
}
151141
fn pop(&self, w: &mut Self::W) -> Opt<(Self::Elt, Self)> {
152142
todo!()
153143
}

ledger/src/zkapps/snark.rs

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,6 @@ impl AmountInterface for SnarkAmount {
327327
fn zero() -> Self {
328328
<CheckedAmount<_> as CheckedCurrency<Fp>>::zero()
329329
}
330-
fn equal(&self, other: &Self) -> Self::Bool {
331-
todo!()
332-
}
333-
fn add_flagged(&self, other: &Self, w: &mut Self::W) -> (Self, Self::Bool) {
334-
todo!()
335-
}
336-
fn add_signed_flagged(&self, signed: &impl SignedAmountInterface) -> (Self, Self::Bool) {
337-
todo!()
338-
}
339330
fn of_constant_fee(fee: crate::scan_state::currency::Fee) -> Self {
340331
Amount::of_fee(&fee).to_checked()
341332
}
@@ -362,7 +353,7 @@ impl CallForestInterface for SnarkCallForest {
362353
field::equal(empty, *hash, w).var()
363354
}
364355
fn pop_exn(&self, w: &mut Self::W) -> ((Self::AccountUpdate, Self), Self) {
365-
let Self { data, hash } = self;
356+
let Self { data, hash: _ } = self;
366357
let hd_r = &data.first().unwrap().elt;
367358
let account_update = &hd_r.account_update;
368359
let auth = &account_update.authorization;
@@ -388,7 +379,7 @@ impl CallForestInterface for SnarkCallForest {
388379
});
389380
let tree_hash = [account_update.hash, subforest.hash]
390381
.checked_hash_with_param(Tree::<AccountUpdate>::HASH_PARAM, w);
391-
let hash_cons =
382+
let _hash_cons =
392383
[tree_hash, tl_hash].checked_hash_with_param(ACCOUNT_UPDATE_CONS_HASH_PARAM, w);
393384
let account = Self::AccountUpdate {
394385
body: account_update,
@@ -518,9 +509,6 @@ impl StackInterface for WithHash<Vec<WithStackHash<WithHash<StackFrame>>>> {
518509
let empty = Fp::zero();
519510
field::equal(empty, *hash, w).var()
520511
}
521-
fn pop_exn(&self) -> (Self::Elt, Self) {
522-
todo!()
523-
}
524512
fn pop(&self, w: &mut Self::W) -> Opt<(Self::Elt, Self)> {
525513
let Self { data, hash } = self;
526514
let input_is_empty = self.is_empty(w);
@@ -661,12 +649,6 @@ impl GlobalSlotSinceGenesisInterface for SnarkGlobalSlot {
661649
type W = Witness<Fp>;
662650
type Bool = SnarkBool;
663651

664-
fn zero() -> Self {
665-
todo!()
666-
}
667-
fn greater_than(&self, other: &Self) -> Self::Bool {
668-
todo!()
669-
}
670652
fn equal(&self, other: &Self, w: &mut Self::W) -> Self::Bool {
671653
<Self as CheckedNat<_, 32>>::equal(&self, other, w).var()
672654
}
@@ -813,7 +795,7 @@ impl LocalStateInterface for zkapp_logic::LocalState<ZkappSnark> {
813795

814796
fn add_check(
815797
local: &mut zkapp_logic::LocalState<Self::Z>,
816-
failure: TransactionFailure,
798+
_failure: TransactionFailure,
817799
b: Self::Bool,
818800
w: &mut Self::W,
819801
) {
@@ -1102,7 +1084,10 @@ impl LedgerInterface for LedgerWithHash {
11021084
account_update: &Self::AccountUpdate,
11031085
w: &mut Self::W,
11041086
) -> (Self::Account, Self::InclusionProof) {
1105-
let Self { ledger, hash: root } = self;
1087+
let Self {
1088+
ledger,
1089+
hash: _root,
1090+
} = self;
11061091
let idx = ledger.find_index_exn(account_update.body.account_id());
11071092
let account = w.exists(AccountUnhashed(ledger.get_exn(&idx)));
11081093
// TODO: Don't clone here
@@ -1256,9 +1241,6 @@ impl BalanceInterface for SnarkBalance {
12561241
type Amount = SnarkAmount;
12571242
type SignedAmount = SnarkSignedAmount;
12581243

1259-
fn sub_amount_flagged(&self, amount: Self::Amount) -> (Self, Self::Bool) {
1260-
todo!()
1261-
}
12621244
fn add_signed_amount_flagged(
12631245
&self,
12641246
signed_amount: Self::SignedAmount,
@@ -1278,7 +1260,7 @@ impl TransactionCommitmentInterface for SnarkTransactionCommitment {
12781260
Fp::zero()
12791261
}
12801262

1281-
fn commitment(account_updates: &Self::CallForest, w: &mut Self::W) -> Fp {
1263+
fn commitment(account_updates: &Self::CallForest) -> Fp {
12821264
let Self::CallForest {
12831265
data: _,
12841266
hash: account_updates_hash,
@@ -1347,7 +1329,7 @@ impl ControllerInterface for SnarkController {
13471329
type SingleData = ZkappSingleData;
13481330

13491331
fn check(
1350-
proof_verifies: Self::Bool,
1332+
_proof_verifies: Self::Bool,
13511333
signature_verifies: Self::Bool,
13521334
auth: &AuthRequired,
13531335
single_data: &Self::SingleData,
@@ -1384,10 +1366,6 @@ impl GlobalSlotSpanInterface for SnarkGlobalSlotSpan {
13841366
type Bool = SnarkBool;
13851367
type SlotSpan = SlotSpan;
13861368

1387-
fn zero() -> Self {
1388-
todo!()
1389-
}
1390-
13911369
fn greater_than(this: &Self::SlotSpan, other: &Self::SlotSpan, w: &mut Self::W) -> Self::Bool {
13921370
let this = this.to_checked::<Fp>();
13931371
let other = other.to_checked::<Fp>();

ledger/src/zkapps/zkapp_logic.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
#![allow(unused)]
2-
31
use mina_hasher::Fp;
42
use mina_signer::CompressedPubKey;
53

6-
use crate::scan_state::transaction_logic::zkapp_command::{
7-
Actions, Numeric, SetOrKeep, ZkAppPreconditions,
8-
};
4+
use crate::scan_state::transaction_logic::zkapp_command::{Actions, SetOrKeep};
95
use crate::Permissions;
106
use crate::{
11-
proofs::{numbers::nat::CheckedNat, transaction::transaction_snark::CONSTRAINT_CONSTANTS},
7+
proofs::transaction::transaction_snark::CONSTRAINT_CONSTANTS,
128
scan_state::{
13-
currency::{Amount, Magnitude, SlotSpan},
14-
scan_state::ConstraintConstants,
9+
currency::{Magnitude, SlotSpan},
1510
transaction_logic::{
1611
protocol_state::GlobalStateSkeleton, zkapp_command::CheckAuthorizationResult,
1712
TransactionFailure,
@@ -20,11 +15,10 @@ use crate::{
2015
zkapps::intefaces::*,
2116
AuthRequired, AuthRequiredEncoded, MyCow, TokenId, VerificationKey,
2217
};
23-
use ark_ff::{One, Zero};
2418

2519
use crate::proofs::{
2620
field::{Boolean, ToBoolean},
27-
zkapp::{StartDataSkeleton, ZkappSingleData},
21+
zkapp::StartDataSkeleton,
2822
};
2923

3024
pub enum IsStart<T> {
@@ -458,7 +452,7 @@ where
458452
),
459453
IsStart::Yes(start_data) | IsStart::Compute(start_data) => {
460454
let tx_commitment_on_start =
461-
Z::TransactionCommitment::commitment(remaining.calls(), w);
455+
Z::TransactionCommitment::commitment(remaining.calls());
462456
let full_tx_commitment_on_start = Z::TransactionCommitment::full_commitment(
463457
&account_update,
464458
start_data.memo_hash,
@@ -654,7 +648,6 @@ where
654648
w,
655649
);
656650
let timing = w.exists_no_check({
657-
use crate::scan_state::transaction_logic::zkapp_command::SetOrKeep;
658651
match timing {
659652
SetOrKeep::Set(timing) => timing.clone().to_account_timing(),
660653
SetOrKeep::Keep => a.get().timing.clone(),

0 commit comments

Comments
 (0)