Skip to content

Commit 06cc95b

Browse files
author
Adrian Nagy
committed
fix: Derive debug on the graphql structs + remove leftover prints
1 parent dad2780 commit 06cc95b

File tree

5 files changed

+44
-47
lines changed

5 files changed

+44
-47
lines changed

node/native/src/graphql/account.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use mina_p2p_messages::{
1010

1111
use super::ConversionError;
1212

13-
#[derive(GraphQLObject)]
13+
#[derive(GraphQLObject, Debug)]
1414
#[graphql(description = "A Mina account")]
1515
pub struct GraphQLAccount {
1616
pub public_key: String,
@@ -34,12 +34,12 @@ pub struct GraphQLAccount {
3434
pub zkapp_uri: Option<String>,
3535
}
3636

37-
#[derive(GraphQLObject)]
37+
#[derive(GraphQLObject, Debug)]
3838
pub struct GraphQLDelegateAccount {
3939
pub public_key: String,
4040
}
4141

42-
#[derive(GraphQLObject)]
42+
#[derive(GraphQLObject, Debug)]
4343
pub struct GraphQLTiming {
4444
// pub is_timed: bool,
4545
pub initial_minimum_balance: Option<String>,
@@ -70,7 +70,7 @@ impl From<MinaBaseAccountUpdateUpdateTimingInfoStableV1> for GraphQLTiming {
7070
}
7171
}
7272
}
73-
#[derive(GraphQLObject)]
73+
#[derive(GraphQLObject, Debug)]
7474
pub struct GraphQLPermissions {
7575
pub edit_state: String,
7676
pub access: String,
@@ -87,18 +87,18 @@ pub struct GraphQLPermissions {
8787
pub set_timing: String,
8888
}
8989

90-
#[derive(GraphQLObject)]
90+
#[derive(GraphQLObject, Debug)]
9191
pub struct GraphQLSetVerificationKey {
9292
pub auth: String,
9393
pub txn_version: String,
9494
}
9595

96-
#[derive(GraphQLObject)]
96+
#[derive(GraphQLObject, Debug)]
9797
pub struct GraphQLBalance {
9898
pub total: String,
9999
}
100100

101-
// #[derive(GraphQLObject)]
101+
// #[derive(GraphQLObject, Debug)]
102102
// pub struct GraphQLZkAppAccount {
103103
// pub app_state: Vec<String>,
104104
// pub verification_key: Option<GraphQLVerificationKey>,
@@ -109,7 +109,7 @@ pub struct GraphQLBalance {
109109
// pub zkapp_uri: String,
110110
// }
111111

112-
#[derive(GraphQLObject)]
112+
#[derive(GraphQLObject, Debug)]
113113
pub struct GraphQLVerificationKey {
114114
// pub max_proofs_verified: String,
115115
// pub actual_wrap_domain_size: String,

node/native/src/graphql/block.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ use crate::graphql::zkapp::{GraphQLFailureReason, GraphQLFeePayer, GraphQLZkappC
66

77
use super::{zkapp::GraphQLZkapp, ConversionError};
88

9-
#[derive(GraphQLObject)]
9+
#[derive(GraphQLObject, Debug)]
1010
#[graphql(description = "A Mina block")]
1111
pub struct GraphQLBestChainBlock {
1212
pub protocol_state: GraphQLProtocolState,
1313
pub state_hash: String,
1414
pub transactions: GraphQLTransactions,
1515
}
1616

17-
#[derive(GraphQLObject)]
17+
#[derive(GraphQLObject, Debug)]
1818
pub struct GraphQLTransactions {
1919
pub zkapp_commands: Vec<GraphQLZkapp>,
2020
}
@@ -67,14 +67,14 @@ impl TryFrom<AppliedBlock> for GraphQLBestChainBlock {
6767
}
6868
}
6969

70-
#[derive(GraphQLObject)]
70+
#[derive(GraphQLObject, Debug)]
7171
pub struct GraphQLProtocolState {
7272
pub previous_state_hash: String,
7373
pub blockchain_state: GraphQLBlockchainState,
7474
pub consensus_state: GraphQLConsensusState,
7575
}
7676

77-
#[derive(GraphQLObject)]
77+
#[derive(GraphQLObject, Debug)]
7878
pub struct GraphQLBlockchainState {
7979
pub snarked_ledger_hash: String,
8080
pub staged_ledger_hash: String,
@@ -83,7 +83,7 @@ pub struct GraphQLBlockchainState {
8383
pub staged_ledger_proof_emitted: bool,
8484
}
8585

86-
#[derive(GraphQLObject)]
86+
#[derive(GraphQLObject, Debug)]
8787
pub struct GraphQLConsensusState {
8888
pub block_height: String,
8989
pub slot_since_genesis: String,
@@ -96,7 +96,7 @@ pub struct GraphQLConsensusState {
9696
pub epoch: String,
9797
}
9898

99-
#[derive(GraphQLObject)]
99+
#[derive(GraphQLObject, Debug)]
100100
pub struct GraphQLEpochData {
101101
pub ledger: GraphQLLedger,
102102
pub seed: String,
@@ -105,7 +105,7 @@ pub struct GraphQLEpochData {
105105
pub epoch_length: String,
106106
}
107107

108-
#[derive(GraphQLObject)]
108+
#[derive(GraphQLObject, Debug)]
109109
pub struct GraphQLLedger {
110110
pub hash: String,
111111
pub total_currency: String,

node/native/src/graphql/constants.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use openmina_core::{consensus::ConsensusConstants, constants::ConstraintConstant
33

44
use super::ConversionError;
55

6-
#[derive(GraphQLObject)]
6+
#[derive(GraphQLObject, Debug)]
77
pub struct GraphQLGenesisConstants {
88
pub genesis_timestamp: String,
99
pub coinbase: String,
@@ -25,12 +25,12 @@ impl GraphQLGenesisConstants {
2525
}
2626
}
2727

28-
#[derive(GraphQLObject)]
28+
#[derive(GraphQLObject, Debug)]
2929
pub struct GraphQLDaemonStatus {
3030
pub consensus_configuration: GraphQLConsensusConfiguration,
3131
}
3232

33-
#[derive(GraphQLObject)]
33+
#[derive(GraphQLObject, Debug)]
3434
pub struct GraphQLConsensusConfiguration {
3535
pub epoch_duration: i32,
3636
pub k: i32,

node/native/src/graphql/zkapp.rs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ impl TryFrom<SendZkappInput> for MinaBaseUserCommandStableV2 {
6666
}
6767
}
6868

69-
#[derive(GraphQLObject)]
69+
#[derive(GraphQLObject, Debug)]
7070
pub struct GraphQLSendZkappResponse {
7171
pub zkapp: GraphQLZkapp,
7272
}
7373

74-
#[derive(GraphQLObject)]
74+
#[derive(GraphQLObject, Debug)]
7575
pub struct GraphQLZkapp {
7676
pub hash: String,
7777
pub failure_reason: Option<Vec<GraphQLFailureReason>>,
@@ -89,7 +89,7 @@ pub struct InputGraphQLZkapp {
8989
pub zkapp_command: InputGraphQLZkappCommand,
9090
}
9191

92-
#[derive(GraphQLObject)]
92+
#[derive(GraphQLObject, Debug)]
9393
pub struct GraphQLZkappCommand {
9494
pub memo: String,
9595
pub account_updates: Vec<GraphQLAccountUpdate>,
@@ -156,7 +156,6 @@ impl TryFrom<InputGraphQLZkappCommand> for MinaBaseUserCommandStableV2 {
156156
fn try_tree_from_account_updates(
157157
updates: List<InputGraphQLAccountUpdate>,
158158
) -> Result<List<MinaBaseZkappCommandTStableV1WireStableV1AccountUpdatesA>, ConversionError> {
159-
println!("++++ Before the conversion {:?}", updates);
160159
let result =
161160
try_tree_from_account_updates_aux(updates)?
162161
.into_iter()
@@ -178,7 +177,6 @@ fn try_tree_from_account_updates(
178177
MinaBaseZkappCommandTStableV1WireStableV1AccountUpdatesA { elt, stack_hash }
179178
})
180179
.collect();
181-
println!("+++ After the conversion: {:?}", result);
182180
Ok(result)
183181
}
184182

@@ -219,7 +217,7 @@ fn try_tree_from_account_updates_aux(
219217
Ok(result)
220218
}
221219

222-
#[derive(GraphQLObject)]
220+
#[derive(GraphQLObject, Debug)]
223221
pub struct GraphQLFeePayer {
224222
pub body: GraphQLFeePayerBody,
225223
pub authorization: String,
@@ -231,7 +229,7 @@ pub struct InputGraphQLFeePayer {
231229
pub authorization: String,
232230
}
233231

234-
#[derive(GraphQLObject)]
232+
#[derive(GraphQLObject, Debug)]
235233
pub struct GraphQLFeePayerBody {
236234
pub public_key: String,
237235
pub fee: String,
@@ -247,7 +245,7 @@ pub struct InputGraphQLFeePayerBody {
247245
pub nonce: String,
248246
}
249247

250-
#[derive(GraphQLObject)]
248+
#[derive(GraphQLObject, Debug)]
251249
pub struct GraphQLAccountUpdate {
252250
pub body: GraphQLAccountUpdateBody,
253251
pub authorization: GraphQLAuthorization,
@@ -259,7 +257,7 @@ pub struct InputGraphQLAccountUpdate {
259257
pub authorization: InputGraphQLAuthorization,
260258
}
261259

262-
#[derive(GraphQLObject)]
260+
#[derive(GraphQLObject, Debug)]
263261
pub struct GraphQLAuthorization {
264262
pub proof: Option<String>,
265263
pub signature: Option<String>,
@@ -320,7 +318,7 @@ impl TryFrom<InputGraphQLAuthorization> for MinaBaseControlStableV2 {
320318
}
321319
}
322320

323-
#[derive(GraphQLObject)]
321+
#[derive(GraphQLObject, Debug)]
324322
pub struct GraphQLAccountUpdateBody {
325323
pub public_key: String,
326324
pub token_id: String,
@@ -356,7 +354,7 @@ pub struct InputGraphQLAccountUpdateBody {
356354
pub implicit_account_creation_fee: bool,
357355
}
358356

359-
#[derive(GraphQLObject)]
357+
#[derive(GraphQLObject, Debug)]
360358
pub struct GraphQLAuthorizationKind {
361359
pub is_signed: bool,
362360
pub is_proved: bool,
@@ -421,7 +419,7 @@ impl TryFrom<InputGraphQLAuthorizationKind> for MinaBaseAccountUpdateAuthorizati
421419
}
422420
}
423421

424-
#[derive(GraphQLObject)]
422+
#[derive(GraphQLObject, Debug)]
425423
pub struct GraphQLMayUseToken {
426424
pub parents_own_token: bool,
427425
pub inherit_from_parent: bool,
@@ -464,7 +462,7 @@ impl From<InputGraphQLMayUseToken> for MinaBaseAccountUpdateMayUseTokenStableV1
464462
}
465463
}
466464

467-
#[derive(GraphQLObject)]
465+
#[derive(GraphQLObject, Debug)]
468466
pub struct GraphQLEvent {
469467
pub event: String,
470468
pub data: String,
@@ -476,7 +474,7 @@ pub struct InputGraphQLEvent {
476474
pub data: String,
477475
}
478476

479-
#[derive(GraphQLObject)]
477+
#[derive(GraphQLObject, Debug)]
480478
pub struct GraphQLAction {
481479
pub action: String,
482480
pub data: String,
@@ -488,7 +486,7 @@ pub struct InputGraphQLAction {
488486
pub data: String,
489487
}
490488

491-
#[derive(GraphQLObject)]
489+
#[derive(GraphQLObject, Debug)]
492490
pub struct GraphQLPreconditions {
493491
pub network: GraphQLPreconditionsNetwork,
494492
pub account: GraphQLPreconditionsAccount,
@@ -502,7 +500,7 @@ pub struct InputGraphQLPreconditions {
502500
pub valid_while: Option<InputGraphQLPreconditionsNetworkBounds>,
503501
}
504502

505-
#[derive(GraphQLObject)]
503+
#[derive(GraphQLObject, Debug)]
506504
pub struct GraphQLPreconditionsAccount {
507505
pub balance: Option<GraphQLPreconditionsNetworkBounds>,
508506
pub nonce: Option<GraphQLPreconditionsNetworkBounds>,
@@ -685,7 +683,7 @@ impl TryFrom<InputGraphQLPreconditionsAccount>
685683
}))
686684
}
687685
}
688-
#[derive(GraphQLObject)]
686+
#[derive(GraphQLObject, Debug)]
689687
pub struct GraphQLPreconditionsNetwork {
690688
pub snarked_ledger_hash: Option<String>,
691689
pub blockchain_length: Option<GraphQLPreconditionsNetworkBounds>,
@@ -707,7 +705,7 @@ pub struct InputGraphQLPreconditionsNetwork {
707705
pub next_epoch_data: InputGraphQLPreconditionsNetworkEpochData,
708706
}
709707

710-
#[derive(GraphQLObject)]
708+
#[derive(GraphQLObject, Debug)]
711709
pub struct GraphQLPreconditionsNetworkEpochData {
712710
pub ledger: GraphQLPreconditionsNetworkLedger,
713711
pub seed: Option<String>,
@@ -725,7 +723,7 @@ pub struct InputGraphQLPreconditionsNetworkEpochData {
725723
pub epoch_length: Option<InputGraphQLPreconditionsNetworkBounds>,
726724
}
727725

728-
#[derive(GraphQLObject)]
726+
#[derive(GraphQLObject, Debug)]
729727
pub struct GraphQLPreconditionsNetworkLedger {
730728
pub hash: Option<String>,
731729
pub total_currency: Option<GraphQLPreconditionsNetworkBounds>,
@@ -736,7 +734,7 @@ pub struct InputGraphQLPreconditionsNetworkLedger {
736734
pub hash: Option<String>,
737735
pub total_currency: Option<InputGraphQLPreconditionsNetworkBounds>,
738736
}
739-
#[derive(GraphQLObject)]
737+
#[derive(GraphQLObject, Debug)]
740738
pub struct GraphQLPreconditionsNetworkBounds {
741739
pub upper: String,
742740
pub lower: String,
@@ -1008,7 +1006,7 @@ impl TryFrom<InputGraphQLPreconditionsNetwork> for MinaBaseZkappPreconditionProt
10081006
}
10091007
}
10101008

1011-
#[derive(GraphQLObject)]
1009+
#[derive(GraphQLObject, Debug)]
10121010
pub struct GraphQLAccountUpdateUpdate {
10131011
pub app_state: Vec<Option<String>>,
10141012
pub delegate: Option<String>,
@@ -1020,7 +1018,7 @@ pub struct GraphQLAccountUpdateUpdate {
10201018
pub voting_for: Option<String>,
10211019
}
10221020

1023-
#[derive(GraphQLObject)]
1021+
#[derive(GraphQLObject, Debug)]
10241022
pub struct GraphQLVerificationKey {
10251023
pub data: String,
10261024
pub hash: String,
@@ -1044,7 +1042,7 @@ pub struct InputGraphQLVerificationKey {
10441042
pub hash: String,
10451043
}
10461044

1047-
#[derive(GraphQLObject)]
1045+
#[derive(GraphQLObject, Debug)]
10481046
pub struct GraphQLAccountUpdateUpdatePermissions {
10491047
pub edit_state: String,
10501048
pub access: String,
@@ -1061,7 +1059,7 @@ pub struct GraphQLAccountUpdateUpdatePermissions {
10611059
pub increment_nonce: String,
10621060
}
10631061

1064-
#[derive(GraphQLObject)]
1062+
#[derive(GraphQLObject, Debug)]
10651063
pub struct GraphQLSetVerificationKeyPermissions {
10661064
pub auth: String,
10671065
pub txn_version: String,
@@ -1141,7 +1139,7 @@ impl TryFrom<InputGraphQLAccountUpdateUpdatePermissions> for MinaBasePermissions
11411139
}
11421140
}
11431141

1144-
#[derive(GraphQLObject)]
1142+
#[derive(GraphQLObject, Debug)]
11451143
pub struct GraphQLBalanceChange {
11461144
pub magnitude: String,
11471145
pub sgn: String,
@@ -1153,7 +1151,7 @@ pub struct InputGraphQLBalanceChange {
11531151
pub sgn: String,
11541152
}
11551153

1156-
#[derive(GraphQLObject)]
1154+
#[derive(GraphQLObject, Debug)]
11571155
pub struct GraphQLFailureReason {
11581156
pub index: String,
11591157
pub failures: Vec<String>,
@@ -1600,8 +1598,8 @@ mod test {
16001598
include_str!("../../../../tests/files/zkapps/proof_string.txt").to_string(),
16011599
),
16021600
};
1603-
let converted: MinaBaseControlStableV2 = proof.try_into().unwrap();
1604-
println!("{:?}", converted);
1601+
let converted: Result<MinaBaseControlStableV2, _> = proof.try_into();
1602+
assert!(converted.is_ok());
16051603
}
16061604

16071605
fn create_input_graphql_zkapp() -> InputGraphQLZkapp {

node/native/src/http_server.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ pub async fn run(port: u16, rpc_sender: RpcSender) {
489489
let rpc_sender_clone = rpc_sender_clone.clone();
490490

491491
async move {
492-
println!("Transaction inject post: {:#?}", body);
493492
rpc_sender_clone
494493
.oneshot_request(RpcRequest::TransactionInject(
495494
body.into_iter()

0 commit comments

Comments
 (0)