@@ -69,6 +69,22 @@ jsonp_double( fd_gui_t * gui,
69
69
else fd_http_server_printf ( gui -> http , "%.2f," , value );
70
70
}
71
71
72
+ static void
73
+ jsonp_ulong_as_str ( fd_gui_t * gui ,
74
+ char const * key ,
75
+ ulong value ) {
76
+ if ( FD_LIKELY ( key ) ) fd_http_server_printf ( gui -> http , "\"%s\":\"%lu\"," , key , value );
77
+ else fd_http_server_printf ( gui -> http , "\"%lu\"," , value );
78
+ }
79
+
80
+ static void
81
+ jsonp_long_as_str ( fd_gui_t * gui ,
82
+ char const * key ,
83
+ long value ) {
84
+ if ( FD_LIKELY ( key ) ) fd_http_server_printf ( gui -> http , "\"%s\":\"%ld\"," , key , value );
85
+ else fd_http_server_printf ( gui -> http , "\"%ld\"," , value );
86
+ }
87
+
72
88
static void
73
89
jsonp_sanitize_str ( fd_http_server_t * http ,
74
90
ulong start_len ) {
@@ -198,7 +214,7 @@ fd_gui_printf_identity_key( fd_gui_t * gui ) {
198
214
void
199
215
fd_gui_printf_uptime_nanos ( fd_gui_t * gui ) {
200
216
jsonp_open_envelope ( gui , "summary" , "uptime_nanos" );
201
- jsonp_ulong ( gui , "value" , (ulong )(fd_log_wallclock () - gui -> summary .startup_time_nanos ) );
217
+ jsonp_ulong_as_str ( gui , "value" , (ulong )(fd_log_wallclock () - gui -> summary .startup_time_nanos ) );
202
218
jsonp_close_envelope ( gui );
203
219
}
204
220
@@ -413,14 +429,14 @@ fd_gui_printf_tiles( fd_gui_t * gui ) {
413
429
void
414
430
fd_gui_printf_identity_balance ( fd_gui_t * gui ) {
415
431
jsonp_open_envelope ( gui , "summary" , "identity_balance" );
416
- jsonp_ulong ( gui , "value" , gui -> summary .identity_account_balance );
432
+ jsonp_ulong_as_str ( gui , "value" , gui -> summary .identity_account_balance );
417
433
jsonp_close_envelope ( gui );
418
434
}
419
435
420
436
void
421
437
fd_gui_printf_vote_balance ( fd_gui_t * gui ) {
422
438
jsonp_open_envelope ( gui , "summary" , "vote_balance" );
423
- jsonp_ulong ( gui , "value" , gui -> summary .vote_account_balance );
439
+ jsonp_ulong_as_str ( gui , "value" , gui -> summary .vote_account_balance );
424
440
jsonp_close_envelope ( gui );
425
441
}
426
442
@@ -478,13 +494,13 @@ fd_gui_printf_epoch( fd_gui_t * gui,
478
494
jsonp_open_envelope ( gui , "epoch" , "new" );
479
495
jsonp_open_object ( gui , "value" );
480
496
jsonp_ulong ( gui , "epoch" , gui -> epoch .epochs [ epoch_idx ].epoch );
481
- if ( FD_LIKELY ( gui -> epoch .epochs [ epoch_idx ].start_time != LONG_MAX ) ) jsonp_ulong ( gui , "start_time " , (ulong )gui -> epoch .epochs [ epoch_idx ].start_time );
482
- else jsonp_null ( gui , "start_time " );
483
- if ( FD_LIKELY ( gui -> epoch .epochs [ epoch_idx ].end_time != LONG_MAX ) ) jsonp_ulong ( gui , "end_time " , (ulong )gui -> epoch .epochs [ epoch_idx ].end_time );
484
- else jsonp_null ( gui , "end_time " );
497
+ if ( FD_LIKELY ( gui -> epoch .epochs [ epoch_idx ].start_time != LONG_MAX ) ) jsonp_ulong_as_str ( gui , "start_time_nanos " , (ulong )gui -> epoch .epochs [ epoch_idx ].start_time );
498
+ else jsonp_null ( gui , "start_time_nanos " );
499
+ if ( FD_LIKELY ( gui -> epoch .epochs [ epoch_idx ].end_time != LONG_MAX ) ) jsonp_ulong_as_str ( gui , "end_time_nanos " , (ulong )gui -> epoch .epochs [ epoch_idx ].end_time );
500
+ else jsonp_null ( gui , "end_time_nanos " );
485
501
jsonp_ulong ( gui , "start_slot" , gui -> epoch .epochs [ epoch_idx ].start_slot );
486
502
jsonp_ulong ( gui , "end_slot" , gui -> epoch .epochs [ epoch_idx ].end_slot );
487
- jsonp_ulong ( gui , "excluded_stake_lamports" , gui -> epoch .epochs [ epoch_idx ].excluded_stake );
503
+ jsonp_ulong_as_str ( gui , "excluded_stake_lamports" , gui -> epoch .epochs [ epoch_idx ].excluded_stake );
488
504
jsonp_open_array ( gui , "staked_pubkeys" );
489
505
fd_epoch_leaders_t * lsched = gui -> epoch .epochs [epoch_idx ].lsched ;
490
506
for ( ulong i = 0UL ; i < lsched -> pub_cnt ; i ++ ) {
@@ -496,7 +512,7 @@ fd_gui_printf_epoch( fd_gui_t * gui,
496
512
497
513
jsonp_open_array ( gui , "staked_lamports" );
498
514
fd_stake_weight_t * stakes = gui -> epoch .epochs [epoch_idx ].stakes ;
499
- for ( ulong i = 0UL ; i < lsched -> pub_cnt ; i ++ ) jsonp_ulong ( gui , NULL , stakes [ i ].stake );
515
+ for ( ulong i = 0UL ; i < lsched -> pub_cnt ; i ++ ) jsonp_ulong_as_str ( gui , NULL , stakes [ i ].stake );
500
516
jsonp_close_array ( gui );
501
517
502
518
jsonp_open_array ( gui , "leader_slots" );
@@ -780,7 +796,7 @@ fd_gui_printf_peer( fd_gui_t * gui,
780
796
char vote_account_base58 [ FD_BASE58_ENCODED_32_SZ ];
781
797
fd_base58_encode_32 ( gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].vote_account -> uc , NULL , vote_account_base58 );
782
798
jsonp_string ( gui , "vote_account" , vote_account_base58 );
783
- jsonp_ulong ( gui , "activated_stake" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].activated_stake );
799
+ jsonp_ulong_as_str ( gui , "activated_stake" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].activated_stake );
784
800
jsonp_ulong ( gui , "last_vote" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].last_vote );
785
801
jsonp_ulong ( gui , "root_slot" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].root_slot );
786
802
jsonp_ulong ( gui , "epoch_credits" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].epoch_credits );
@@ -985,7 +1001,7 @@ fd_gui_printf_ts_tile_timers( fd_gui_t * gui,
985
1001
fd_gui_tile_timers_t const * prev ,
986
1002
fd_gui_tile_timers_t const * cur ) {
987
1003
jsonp_open_object ( gui , NULL );
988
- jsonp_ulong ( gui , "timestamp_nanos" , 0 );
1004
+ jsonp_ulong_as_str ( gui , "timestamp_nanos" , 0 );
989
1005
jsonp_open_array ( gui , "tile_timers" );
990
1006
fd_gui_printf_tile_timers ( gui , prev , cur );
991
1007
jsonp_close_array ( gui );
@@ -1024,7 +1040,7 @@ fd_gui_printf_slot( fd_gui_t * gui,
1024
1040
if ( FD_UNLIKELY ( duration_nanos == LONG_MAX ) ) jsonp_null ( gui , "duration_nanos" );
1025
1041
else jsonp_long ( gui , "duration_nanos" , duration_nanos );
1026
1042
if ( FD_UNLIKELY ( slot -> completed_time == LONG_MAX ) ) jsonp_null ( gui , "completed_time_nanos" );
1027
- else jsonp_long ( gui , "completed_time_nanos" , slot -> completed_time );
1043
+ else jsonp_long_as_str ( gui , "completed_time_nanos" , slot -> completed_time );
1028
1044
jsonp_string ( gui , "level" , level );
1029
1045
if ( FD_UNLIKELY ( slot -> total_txn_cnt == UINT_MAX ) ) jsonp_null ( gui , "transactions" );
1030
1046
else jsonp_ulong ( gui , "transactions" , slot -> total_txn_cnt );
@@ -1035,11 +1051,11 @@ fd_gui_printf_slot( fd_gui_t * gui,
1035
1051
if ( FD_UNLIKELY ( slot -> compute_units == UINT_MAX ) ) jsonp_null ( gui , "compute_units" );
1036
1052
else jsonp_ulong ( gui , "compute_units" , slot -> compute_units );
1037
1053
if ( FD_UNLIKELY ( slot -> transaction_fee == ULONG_MAX ) ) jsonp_null ( gui , "transaction_fee" );
1038
- else jsonp_ulong ( gui , "transaction_fee" , slot -> transaction_fee );
1054
+ else jsonp_ulong_as_str ( gui , "transaction_fee" , slot -> transaction_fee );
1039
1055
if ( FD_UNLIKELY ( slot -> priority_fee == ULONG_MAX ) ) jsonp_null ( gui , "priority_fee" );
1040
- else jsonp_ulong ( gui , "priority_fee" , slot -> priority_fee );
1056
+ else jsonp_ulong_as_str ( gui , "priority_fee" , slot -> priority_fee );
1041
1057
if ( FD_UNLIKELY ( slot -> tips == ULONG_MAX ) ) jsonp_null ( gui , "tips" );
1042
- else jsonp_ulong ( gui , "tips" , slot -> tips );
1058
+ else jsonp_ulong_as_str ( gui , "tips" , slot -> tips );
1043
1059
jsonp_close_object ( gui );
1044
1060
jsonp_close_object ( gui );
1045
1061
jsonp_close_envelope ( gui );
@@ -1252,8 +1268,8 @@ fd_gui_printf_slot_request_detailed( fd_gui_t * gui,
1252
1268
if ( FD_LIKELY ( !overwritten && processed_all_microblocks ) ) {
1253
1269
jsonp_open_object ( gui , "compute_units" );
1254
1270
jsonp_ulong ( gui , "max_compute_units" , slot -> cus .max_compute_units );
1255
- jsonp_long ( gui , "start_timestamp_nanos" , slot -> cus .leader_start_time );
1256
- jsonp_long ( gui , "target_end_timestamp_nanos" , slot -> cus .leader_end_time );
1271
+ jsonp_long_as_str ( gui , "start_timestamp_nanos" , slot -> cus .leader_start_time );
1272
+ jsonp_long_as_str ( gui , "target_end_timestamp_nanos" , slot -> cus .leader_end_time );
1257
1273
jsonp_open_array ( gui , "compute_unit_timestamps_nanos" );
1258
1274
uint bank_offset [ 65 ];
1259
1275
int has_offset [ 65 ];
@@ -1262,7 +1278,7 @@ fd_gui_printf_slot_request_detailed( fd_gui_t * gui,
1262
1278
ulong offset ;
1263
1279
while ( (offset = cus_scan_next ( gui , slot , has_offset , bank_offset ))!= ULONG_MAX ) {
1264
1280
long timestamp = fd_gui_cu_history_decompress_timestamp ( slot -> cus .reference_nanos , gui -> cus .history [ offset %FD_GUI_COMPUTE_UNITS_HISTORY_SZ ] );
1265
- jsonp_long ( gui , NULL , timestamp );
1281
+ jsonp_long_as_str ( gui , NULL , timestamp );
1266
1282
}
1267
1283
jsonp_close_array ( gui );
1268
1284
jsonp_open_array ( gui , "compute_units_deltas" );
0 commit comments