Skip to content

Commit 72a35a4

Browse files
committed
Fix test executive
1 parent ff99520 commit 72a35a4

File tree

2 files changed

+47
-42
lines changed

2 files changed

+47
-42
lines changed

src/lib/graphql_lib/serializing.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ module Balance : S_JSON with type t = Currency.Balance.t = struct
139139
let serialize = unimplemented_serializer "balance"
140140
end
141141

142+
module Optional_balance = Optional (Balance)
143+
142144
module Token : S_JSON with type t = Mina_base.Token_id.t = struct
143145
type t = Mina_base.Token_id.t
144146

src/lib/integration_test_cloud_engine/kubernetes_network.ml

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ module Node = struct
267267
module Account =
268268
[%graphql
269269
{|
270-
query ($public_key: PublicKey, $token: UInt64) {
270+
query ($public_key: PublicKey!, $token: UInt64) {
271271
account (publicKey : $public_key, token : $token) {
272-
balance { liquid @bsDecoder(fn: "Decoders.optional_balance")
273-
locked @bsDecoder(fn: "Decoders.optional_balance")
274-
total @bsDecoder(fn: "Decoders.balance")
272+
balance { liquid @ppxCustom(module: "Serializing.Balance")
273+
locked @ppxCustom(module: "Serializing.Balance")
274+
total @ppxCustom(module: "Serializing.Balance")
275275
}
276276
delegate
277277
nonce
@@ -426,10 +426,12 @@ module Node = struct
426426
( ("pub_key", Signature_lib.Public_key.Compressed.to_yojson pk)
427427
:: logger_metadata t ) ;
428428
let get_account_obj =
429-
Graphql.Account.make
430-
~public_key:(Graphql_lib.Encoders.public_key pk)
431-
~token:(Graphql_lib.Encoders.token token)
432-
()
429+
Graphql.Account.(
430+
make
431+
@@ makeVariables
432+
~public_key:(Graphql_lib.Encoders.public_key pk)
433+
~token:(Graphql_lib.Encoders.token token)
434+
())
433435
in
434436
exec_graphql_request ~logger ~node:t ~query_name:"get_account_graphql"
435437
get_account_obj
@@ -491,19 +493,20 @@ module Node = struct
491493
| `Signature ->
492494
Signature
493495
in
496+
let open Graphql.Account in
494497
{ edit_sequence_state =
495-
to_auth_required account_permissions#editSequenceState
496-
; edit_state = to_auth_required account_permissions#editState
497-
; increment_nonce = to_auth_required account_permissions#incrementNonce
498-
; receive = to_auth_required account_permissions#receive
499-
; send = to_auth_required account_permissions#send
500-
; set_delegate = to_auth_required account_permissions#setDelegate
501-
; set_permissions = to_auth_required account_permissions#setPermissions
502-
; set_zkapp_uri = to_auth_required account_permissions#setZkappUri
503-
; set_token_symbol = to_auth_required account_permissions#setTokenSymbol
498+
to_auth_required account_permissions.editSequenceState
499+
; edit_state = to_auth_required account_permissions.editState
500+
; increment_nonce = to_auth_required account_permissions.incrementNonce
501+
; receive = to_auth_required account_permissions.receive
502+
; send = to_auth_required account_permissions.send
503+
; set_delegate = to_auth_required account_permissions.setDelegate
504+
; set_permissions = to_auth_required account_permissions.setPermissions
505+
; set_zkapp_uri = to_auth_required account_permissions.setZkappUri
506+
; set_token_symbol = to_auth_required account_permissions.setTokenSymbol
504507
; set_verification_key =
505-
to_auth_required account_permissions#setVerificationKey
506-
; set_voting_for = to_auth_required account_permissions#setVotingFor
508+
to_auth_required account_permissions.setVerificationKey
509+
; set_voting_for = to_auth_required account_permissions.setVotingFor
507510
}
508511

509512
let graphql_uri node = Graphql.ingress_uri node |> Uri.to_string
@@ -512,9 +515,9 @@ module Node = struct
512515
let open Deferred.Or_error in
513516
let open Let_syntax in
514517
let%bind account_obj = get_account ~logger t ~account_id in
515-
match account_obj#account with
518+
match account_obj.account with
516519
| Some account -> (
517-
match account#permissions with
520+
match account.permissions with
518521
| Some ledger_permissions ->
519522
return @@ permissions_of_account_permissions ledger_permissions
520523
| None ->
@@ -532,11 +535,11 @@ module Node = struct
532535
let open Deferred.Or_error in
533536
let open Let_syntax in
534537
let%bind account_obj = get_account ~logger t ~account_id in
535-
match account_obj#account with
538+
match account_obj.account with
536539
| Some account ->
537540
let open Mina_base.Zkapp_basic.Set_or_keep in
538541
let%bind app_state =
539-
match account#zkappState with
542+
match account.zkappState with
540543
| Some strs ->
541544
let fields =
542545
Array.to_list strs
@@ -554,7 +557,7 @@ module Node = struct
554557
(Mina_base.Account_id.public_key account_id) ) ) )
555558
in
556559
let%bind delegate =
557-
match account#delegate with
560+
match account.delegate with
558561
| Some (`String s) ->
559562
return
560563
(Set (Signature_lib.Public_key.Compressed.of_base58_check_exn s))
@@ -567,13 +570,13 @@ module Node = struct
567570
fail (Error.of_string "Expected delegate in account")
568571
in
569572
let%bind verification_key =
570-
match account#verificationKey with
573+
match account.verificationKey with
571574
| Some vk_obj ->
572575
let data =
573576
Pickles.Side_loaded.Verification_key.of_base58_check_exn
574-
vk_obj#verificationKey
577+
vk_obj.verificationKey
575578
in
576-
let hash = Pickles.Backend.Tick.Field.of_string vk_obj#hash in
579+
let hash = Pickles.Backend.Tick.Field.of_string vk_obj.hash in
577580
return (Set ({ data; hash } : _ With_hash.t))
578581
| None ->
579582
fail
@@ -585,33 +588,33 @@ module Node = struct
585588
(Mina_base.Account_id.public_key account_id) ) ) )
586589
in
587590
let%bind permissions =
588-
match account#permissions with
591+
match account.permissions with
589592
| Some perms ->
590593
return @@ Set (permissions_of_account_permissions perms)
591594
| None ->
592595
fail (Error.of_string "Expected permissions in account")
593596
in
594597
let%bind zkapp_uri =
595-
match account#zkappUri with
598+
match account.zkappUri with
596599
| Some s ->
597600
return @@ Set s
598601
| None ->
599602
fail (Error.of_string "Expected zkApp URI in account")
600603
in
601604
let%bind token_symbol =
602-
match account#tokenSymbol with
605+
match account.tokenSymbol with
603606
| Some s ->
604607
return @@ Set s
605608
| None ->
606609
fail (Error.of_string "Expected token symbol in account")
607610
in
608611
let%bind timing =
609-
let timing = account#timing in
610-
let cliff_amount = timing#cliffAmount in
611-
let cliff_time = timing#cliffTime in
612-
let vesting_period = timing#vestingPeriod in
613-
let vesting_increment = timing#vestingIncrement in
614-
let initial_minimum_balance = timing#initialMinimumBalance in
612+
let timing = account.timing in
613+
let cliff_amount = timing.cliffAmount in
614+
let cliff_time = timing.cliffTime in
615+
let vesting_period = timing.vestingPeriod in
616+
let vesting_increment = timing.vestingIncrement in
617+
let initial_minimum_balance = timing.initialMinimumBalance in
615618
match
616619
( cliff_amount
617620
, cliff_time
@@ -682,7 +685,7 @@ module Node = struct
682685
fail (Error.of_string "Some pieces of account timing are missing")
683686
in
684687
let%bind voting_for =
685-
match account#votingFor with
688+
match account.votingFor with
686689
| Some s ->
687690
return @@ Set (Mina_base.State_hash.of_base58_check_exn s)
688691
| None ->
@@ -776,14 +779,14 @@ module Node = struct
776779
in
777780
let send_zkapp_graphql () =
778781
let send_zkapp_obj =
779-
Graphql.Send_test_zkapp.make ~parties:parties_json ()
782+
Graphql.Send_test_zkapp.(make @@ makeVariables ~parties:parties_json ())
780783
in
781784
exec_graphql_request ~logger ~node:t ~query_name:"send_zkapp_graphql"
782785
send_zkapp_obj
783786
in
784787
let%bind sent_zkapp_obj = send_zkapp_graphql () in
785788
let%bind () =
786-
match sent_zkapp_obj#internalSendZkapp#zkapp#failureReason with
789+
match sent_zkapp_obj.internalSendZkapp.zkapp.failureReason with
787790
| None ->
788791
return ()
789792
| Some s ->
@@ -793,18 +796,18 @@ module Node = struct
793796
| None ->
794797
acc
795798
| Some f ->
796-
( Int.of_string (Option.value_exn f#index)
799+
( Int.of_string (Option.value_exn f.index)
797800
, Array.map
798801
~f:(fun s ->
799802
Mina_base.Transaction_status.Failure.of_string s
800803
|> Result.ok_or_failwith )
801-
f#failures
804+
f.failures
802805
|> Array.to_list |> List.rev )
803806
:: acc )
804807
|> Mina_base.Transaction_status.Failure.Collection.display_to_yojson
805808
|> Yojson.Safe.to_string )
806809
in
807-
let zkapp_id = sent_zkapp_obj#internalSendZkapp#zkapp#id in
810+
let zkapp_id = sent_zkapp_obj.internalSendZkapp.zkapp.id in
808811
[%log info] "Sent zkapp" ~metadata:[ ("zkapp_id", `String zkapp_id) ] ;
809812
return zkapp_id
810813

0 commit comments

Comments
 (0)