@@ -69,6 +69,22 @@ jsonp_double( fd_gui_t * gui,
6969 else fd_http_server_printf ( gui -> http , "%.2f," , value );
7070}
7171
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+
7288static void
7389jsonp_sanitize_str ( fd_http_server_t * http ,
7490 ulong start_len ) {
@@ -198,7 +214,7 @@ fd_gui_printf_identity_key( fd_gui_t * gui ) {
198214void
199215fd_gui_printf_uptime_nanos ( fd_gui_t * gui ) {
200216 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 ) );
202218 jsonp_close_envelope ( gui );
203219}
204220
@@ -413,14 +429,14 @@ fd_gui_printf_tiles( fd_gui_t * gui ) {
413429void
414430fd_gui_printf_identity_balance ( fd_gui_t * gui ) {
415431 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 );
417433 jsonp_close_envelope ( gui );
418434}
419435
420436void
421437fd_gui_printf_vote_balance ( fd_gui_t * gui ) {
422438 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 );
424440 jsonp_close_envelope ( gui );
425441}
426442
@@ -478,13 +494,13 @@ fd_gui_printf_epoch( fd_gui_t * gui,
478494 jsonp_open_envelope ( gui , "epoch" , "new" );
479495 jsonp_open_object ( gui , "value" );
480496 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 " );
485501 jsonp_ulong ( gui , "start_slot" , gui -> epoch .epochs [ epoch_idx ].start_slot );
486502 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 );
488504 jsonp_open_array ( gui , "staked_pubkeys" );
489505 fd_epoch_leaders_t * lsched = gui -> epoch .epochs [epoch_idx ].lsched ;
490506 for ( ulong i = 0UL ; i < lsched -> pub_cnt ; i ++ ) {
@@ -496,7 +512,7 @@ fd_gui_printf_epoch( fd_gui_t * gui,
496512
497513 jsonp_open_array ( gui , "staked_lamports" );
498514 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 );
500516 jsonp_close_array ( gui );
501517
502518 jsonp_open_array ( gui , "leader_slots" );
@@ -780,7 +796,7 @@ fd_gui_printf_peer( fd_gui_t * gui,
780796 char vote_account_base58 [ FD_BASE58_ENCODED_32_SZ ];
781797 fd_base58_encode_32 ( gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].vote_account -> uc , NULL , vote_account_base58 );
782798 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 );
784800 jsonp_ulong ( gui , "last_vote" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].last_vote );
785801 jsonp_ulong ( gui , "root_slot" , gui -> vote_account .vote_accounts [ vote_idxs [ i ] ].root_slot );
786802 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,
9851001 fd_gui_tile_timers_t const * prev ,
9861002 fd_gui_tile_timers_t const * cur ) {
9871003 jsonp_open_object ( gui , NULL );
988- jsonp_ulong ( gui , "timestamp_nanos" , 0 );
1004+ jsonp_ulong_as_str ( gui , "timestamp_nanos" , 0 );
9891005 jsonp_open_array ( gui , "tile_timers" );
9901006 fd_gui_printf_tile_timers ( gui , prev , cur );
9911007 jsonp_close_array ( gui );
@@ -1024,7 +1040,7 @@ fd_gui_printf_slot( fd_gui_t * gui,
10241040 if ( FD_UNLIKELY ( duration_nanos == LONG_MAX ) ) jsonp_null ( gui , "duration_nanos" );
10251041 else jsonp_long ( gui , "duration_nanos" , duration_nanos );
10261042 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 );
10281044 jsonp_string ( gui , "level" , level );
10291045 if ( FD_UNLIKELY ( slot -> total_txn_cnt == UINT_MAX ) ) jsonp_null ( gui , "transactions" );
10301046 else jsonp_ulong ( gui , "transactions" , slot -> total_txn_cnt );
@@ -1035,11 +1051,11 @@ fd_gui_printf_slot( fd_gui_t * gui,
10351051 if ( FD_UNLIKELY ( slot -> compute_units == UINT_MAX ) ) jsonp_null ( gui , "compute_units" );
10361052 else jsonp_ulong ( gui , "compute_units" , slot -> compute_units );
10371053 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 );
10391055 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 );
10411057 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 );
10431059 jsonp_close_object ( gui );
10441060 jsonp_close_object ( gui );
10451061 jsonp_close_envelope ( gui );
@@ -1252,8 +1268,8 @@ fd_gui_printf_slot_request_detailed( fd_gui_t * gui,
12521268 if ( FD_LIKELY ( !overwritten && processed_all_microblocks ) ) {
12531269 jsonp_open_object ( gui , "compute_units" );
12541270 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 );
12571273 jsonp_open_array ( gui , "compute_unit_timestamps_nanos" );
12581274 uint bank_offset [ 65 ];
12591275 int has_offset [ 65 ];
@@ -1262,7 +1278,7 @@ fd_gui_printf_slot_request_detailed( fd_gui_t * gui,
12621278 ulong offset ;
12631279 while ( (offset = cus_scan_next ( gui , slot , has_offset , bank_offset ))!= ULONG_MAX ) {
12641280 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 );
12661282 }
12671283 jsonp_close_array ( gui );
12681284 jsonp_open_array ( gui , "compute_units_deltas" );
0 commit comments