@@ -9,14 +9,13 @@ use crate::errors::AppError;
9
9
use crate :: txn:: CallTxn ;
10
10
use crate :: ArcDbIndexer ;
11
11
use crate :: { auth, util:: hash} ;
12
- use abi:: Parser ;
13
12
use actix_cors:: Cors ;
14
13
use actix_server:: Server ;
15
14
use actix_web:: { get, post, web, App , HttpRequest , HttpResponse , HttpServer , Responder } ;
16
15
use base64:: Engine ;
17
16
// use indexer::adaptor::IndexerAdaptor;
18
17
use indexer:: { auth_user:: AuthUser , cursor, list_query, where_query} ;
19
- use polylang_prover:: { compile_program, hash_this , Inputs , ProgramExt } ;
18
+ use polylang_prover:: { compile_program, Inputs , ProgramExt } ;
20
19
use schema:: record;
21
20
use serde:: { de:: IntoDeserializer , Deserialize , Serialize } ;
22
21
use serde_with:: serde_as;
@@ -420,8 +419,9 @@ struct ProveRequest {
420
419
abi : abi:: Abi ,
421
420
ctx_public_key : Option < abi:: publickey:: Key > ,
422
421
this : Option < serde_json:: Value > ,
422
+ this_salts : Vec < u32 > ,
423
423
args : Vec < serde_json:: Value > ,
424
- other_records : HashMap < String , Vec < serde_json:: Value > > ,
424
+ other_records : HashMap < String , Vec < ( serde_json:: Value , Vec < u32 > ) > > ,
425
425
}
426
426
427
427
#[ tracing:: instrument( skip_all, fields(
@@ -458,29 +458,13 @@ async fn prove(req: web::Json<ProveRequest>) -> Result<impl Responder, HTTPError
458
458
} ) ?,
459
459
) ;
460
460
461
- let this_hash = hash_this (
462
- req. abi . this_type . clone ( ) . ok_or_else ( || {
463
- HTTPError :: new (
464
- ReasonCode :: Internal ,
465
- Some ( Box :: new ( AppError :: ABIIsMissingThisType ) ) ,
466
- )
467
- } ) ?,
468
- & req. abi
469
- . this_type
470
- . as_ref ( )
471
- . ok_or_else ( || {
472
- HTTPError :: new (
473
- ReasonCode :: Internal ,
474
- Some ( Box :: new ( AppError :: ABIIsMissingThisType ) ) ,
475
- )
476
- } ) ?
477
- . parse ( & this)
478
- . map_err ( |err| {
479
- HTTPError :: new (
480
- ReasonCode :: Internal ,
481
- Some ( Box :: new ( AppError :: ABIError ( Box :: new ( err) ) ) ) ,
482
- )
483
- } ) ?,
461
+ let inputs = Inputs :: new (
462
+ req. abi . clone ( ) ,
463
+ req. ctx_public_key . clone ( ) ,
464
+ req. this_salts . clone ( ) ,
465
+ this. clone ( ) ,
466
+ req. args . clone ( ) ,
467
+ req. other_records . clone ( ) ,
484
468
)
485
469
. map_err ( |err| {
486
470
HTTPError :: new (
@@ -489,15 +473,6 @@ async fn prove(req: web::Json<ProveRequest>) -> Result<impl Responder, HTTPError
489
473
)
490
474
} ) ?;
491
475
492
- let inputs = Inputs {
493
- abi : req. abi . clone ( ) ,
494
- ctx_public_key : req. ctx_public_key . clone ( ) ,
495
- this : this. clone ( ) ,
496
- this_hash,
497
- args : req. args . clone ( ) ,
498
- other_records : req. other_records . clone ( ) ,
499
- } ;
500
-
501
476
let output = polylang_prover:: prove ( & program, & inputs) . map_err ( |err| {
502
477
HTTPError :: new (
503
478
ReasonCode :: Internal ,
@@ -516,12 +491,12 @@ async fn prove(req: web::Json<ProveRequest>) -> Result<impl Responder, HTTPError
516
491
Ok ( HttpResponse :: Ok ( ) . json ( serde_json:: json!( {
517
492
"old" : {
518
493
"this" : this,
519
- "hash " : inputs. this_hash ,
494
+ "hashes " : inputs. this_field_hashes ,
520
495
} ,
521
496
"new" : {
522
497
"selfDestructed" : output. self_destructed,
523
498
"this" : new_this,
524
- "hash " : output. new_hash ,
499
+ "hashes " : output. new_hashes ,
525
500
} ,
526
501
"stack" : {
527
502
"input" : output. input_stack,
0 commit comments