File tree 6 files changed +7
-45
lines changed 6 files changed +7
-45
lines changed Original file line number Diff line number Diff line change @@ -293,9 +293,7 @@ impl PodProver for Prover {
293
293
. signed_pods
294
294
. iter ( )
295
295
. map ( |p| {
296
- let p = p
297
- . as_any ( )
298
- . downcast_ref :: < SignedPod > ( )
296
+ let p = ( * p as & dyn Any ) . downcast_ref :: < SignedPod > ( )
299
297
. expect ( "type SignedPod" ) ;
300
298
p. clone ( )
301
299
} )
@@ -404,13 +402,6 @@ impl Pod for MainPod {
404
402
. collect ( )
405
403
}
406
404
407
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
408
- self
409
- }
410
- fn as_any ( & self ) -> & dyn Any {
411
- self
412
- }
413
-
414
405
fn serialized_proof ( & self ) -> String {
415
406
todo ! ( )
416
407
}
Original file line number Diff line number Diff line change 2
2
// MainPod
3
3
//
4
4
5
- use std:: { any :: Any , fmt} ;
5
+ use std:: fmt;
6
6
7
7
use anyhow:: { anyhow, Result } ;
8
8
@@ -274,13 +274,6 @@ impl Pod for MockMainPod {
274
274
. collect ( )
275
275
}
276
276
277
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
278
- self
279
- }
280
- fn as_any ( & self ) -> & dyn Any {
281
- self
282
- }
283
-
284
277
fn serialized_proof ( & self ) -> String {
285
278
todo ! ( )
286
279
// BASE64_STANDARD.encode(serde_json::to_string(self).unwrap())
Original file line number Diff line number Diff line change 1
- use std:: { any :: Any , collections:: HashMap } ;
1
+ use std:: collections:: HashMap ;
2
2
3
3
use anyhow:: { anyhow, Result } ;
4
4
use itertools:: Itertools ;
@@ -122,13 +122,6 @@ impl Pod for MockSignedPod {
122
122
. collect ( )
123
123
}
124
124
125
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
126
- self
127
- }
128
- fn as_any ( & self ) -> & dyn Any {
129
- self
130
- }
131
-
132
125
fn serialized_proof ( & self ) -> String {
133
126
self . signature . to_string ( )
134
127
}
Original file line number Diff line number Diff line change 1
- use std:: { any :: Any , collections:: HashMap } ;
1
+ use std:: collections:: HashMap ;
2
2
3
3
use anyhow:: { anyhow, Result } ;
4
4
use itertools:: Itertools ;
@@ -101,13 +101,6 @@ impl Pod for SignedPod {
101
101
. collect ( )
102
102
}
103
103
104
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
105
- self
106
- }
107
- fn as_any ( & self ) -> & dyn Any {
108
- self
109
- }
110
-
111
104
fn serialized_proof ( & self ) -> String {
112
105
let mut buffer = Vec :: new ( ) ;
113
106
use plonky2:: util:: serialization:: Write ;
@@ -140,7 +133,7 @@ pub mod tests {
140
133
let sk = SecretKey :: new_rand ( ) ;
141
134
let mut signer = Signer ( sk) ;
142
135
let pod = pod. sign ( & mut signer) . unwrap ( ) ;
143
- let pod = pod. pod . into_any ( ) . downcast :: < SignedPod > ( ) . unwrap ( ) ;
136
+ let pod = ( pod. pod as Box < dyn Any > ) . downcast :: < SignedPod > ( ) . unwrap ( ) ;
144
137
145
138
pod. verify ( ) ?;
146
139
println ! ( "id: {}" , pod. id( ) ) ;
Original file line number Diff line number Diff line change 1
1
#![ allow( clippy:: get_first) ]
2
+ #![ feature( trait_upcasting) ]
2
3
3
4
pub mod backends;
4
5
pub mod constants;
Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ impl Params {
487
487
}
488
488
}
489
489
490
- pub trait Pod : fmt:: Debug + DynClone {
490
+ pub trait Pod : fmt:: Debug + DynClone + Any {
491
491
fn verify ( & self ) -> Result < ( ) > ;
492
492
fn id ( & self ) -> PodId ;
493
493
fn pub_statements ( & self ) -> Vec < Statement > ;
@@ -501,9 +501,6 @@ pub trait Pod: fmt::Debug + DynClone {
501
501
} )
502
502
. collect ( )
503
503
}
504
- // Used for downcasting
505
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > ;
506
- fn as_any ( & self ) -> & dyn Any ;
507
504
// Front-end Pods keep references to middleware Pods. Most of the
508
505
// middleware data can be derived directly from front-end data, but the
509
506
// "proof" data is only created at the point of proving/signing, and
@@ -537,12 +534,6 @@ impl Pod for NonePod {
537
534
fn pub_statements ( & self ) -> Vec < Statement > {
538
535
Vec :: new ( )
539
536
}
540
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
541
- self
542
- }
543
- fn as_any ( & self ) -> & dyn Any {
544
- self
545
- }
546
537
fn serialized_proof ( & self ) -> String {
547
538
"" . to_string ( )
548
539
}
You can’t perform that action at this time.
0 commit comments