Skip to content

Commit 478ddbc

Browse files
committed
bundle: no floats in config
1 parent 3dec6f0 commit 478ddbc

File tree

7 files changed

+24
-31
lines changed

7 files changed

+24
-31
lines changed

src/app/fdctl/config/default.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,14 +1159,14 @@ dynamic_port_range = "8900-9000"
11591159
# done using HTTP/2 PING frames. This option roughly configures
11601160
# the time between keepalives. The actual timing is randomized
11611161
# to reduce burst loads on the network. Must be within range
1162-
# [3,3600].
1163-
keepalive_interval_seconds = 5.0
1162+
# [3e3,3600e3]
1163+
keepalive_interval_millis = 5000
11641164

11651165
# Consider a connection failed if the bundle server fails to
11661166
# respond to a request in the given time frame. The validator
11671167
# will reconnect eventually, but with increasing delays if there
1168-
# are repeated failures. Must be within range [0.5,60].
1169-
request_timeout_seconds = 3.0
1168+
# are repeated failures. Must be within range [500,60000].
1169+
request_timeout_millis = 3000
11701170

11711171
# The pack tile takes incoming transactions that have been verified
11721172
# by the verify tile and then deduplicated, and attempts to order

src/app/fdctl/topology.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ fd_topo_initialize( config_t * config ) {
386386
strncpy( tile->bundle.key_log_path, config->development.bundle.ssl_key_log_file, sizeof(tile->bundle.key_log_path) );
387387
tile->bundle.buf_sz = config->development.bundle.buffer_size_kib<<10;
388388
tile->bundle.ssl_heap_sz = config->development.bundle.ssl_heap_size_mib<<20;
389-
tile->bundle.keepalive_interval_nanos = (ulong)( config->tiles.bundle.keepalive_interval_seconds * 1e9f );
390-
tile->bundle.request_timeout_nanos = (ulong)( config->tiles.bundle.request_timeout_seconds * 1e9f );
389+
tile->bundle.keepalive_interval_nanos = (ulong)( (float)config->tiles.bundle.keepalive_interval_millis * 1e6f );
390+
tile->bundle.request_timeout_nanos = (ulong)( (float)config->tiles.bundle.request_timeout_millis * 1e6f );
391391
} else if( FD_UNLIKELY( !strcmp( tile->name, "verify" ) ) ) {
392392
tile->verify.tcache_depth = config->tiles.verify.signature_cache_size;
393393

src/app/firedancer/config/default.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,14 +864,14 @@ user = ""
864864
# done using HTTP/2 PING frames. This option roughly configures
865865
# the time between keepalives. The actual timing is randomized
866866
# to reduce burst loads on the network. Must be within range
867-
# [3,3600].
868-
keepalive_interval_seconds = 5.0
867+
# [3e3,3600e3]
868+
keepalive_interval_millis = 5000
869869

870870
# Consider a connection failed if the bundle server fails to
871871
# respond to a request in the given time frame. The validator
872872
# will reconnect eventually, but with increasing delays if there
873-
# are repeated failures. Must be within range [0.5,60].
874-
request_timeout_seconds = 3.0
873+
# are repeated failures. Must be within range [500,60000].
874+
request_timeout_millis = 3000
875875

876876
# The pack tile takes incoming transactions that have been verified
877877
# by the verify tile and then deduplicated, and attempts to order

src/app/shared/fd_config.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -431,19 +431,6 @@ fd_config_fill( fd_config_t * config,
431431
} \
432432
} while(0)
433433

434-
FD_FN_CONST static int
435-
fd_float_in_range( float value,
436-
float low,
437-
float high ) {
438-
return value>=low && value<=high;
439-
}
440-
441-
#define CFG_FLOAT_RANGE_CHECK( value, low, high ) do { \
442-
if( FD_UNLIKELY( !fd_float_in_range( (config->value), (low), (high) ) ) ) { \
443-
FD_LOG_ERR(( "`%s` must be in range [%f,%f]", #value, (double)(low), (double)(high) )); \
444-
} \
445-
} while(0)
446-
447434
static void
448435
fd_config_validatef( fd_configf_t const * config ) {
449436
(void)config;
@@ -536,8 +523,14 @@ fd_config_validate( fd_config_t const * config ) {
536523

537524
CFG_HAS_NON_ZERO( tiles.gui.gui_listen_port );
538525

539-
CFG_FLOAT_RANGE_CHECK( tiles.bundle.keepalive_interval_seconds, 3.0f, 3600.f );
540-
CFG_FLOAT_RANGE_CHECK( tiles.bundle.request_timeout_seconds, 0.5f, 60.f );
526+
if( FD_UNLIKELY( config->tiles.bundle.keepalive_interval_millis < 3000 &&
527+
config->tiles.bundle.keepalive_interval_millis > 3600000 ) ) {
528+
FD_LOG_ERR(( "`tiles.bundle.keepalive_interval_millis` must be in range [3000, 3,600,000]" ));
529+
}
530+
if( FD_UNLIKELY( config->tiles.bundle.request_timeout_millis < 500 &&
531+
config->tiles.bundle.request_timeout_millis > 60000 ) ) {
532+
FD_LOG_ERR(( "`tiles.bundle.request_timeout_millis` must be in range [500, 60,000]" ));
533+
}
541534

542535
CFG_HAS_NON_EMPTY( development.netns.interface0 );
543536
CFG_HAS_NON_EMPTY( development.netns.interface0_mac );

src/app/shared/fd_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ struct fd_config {
335335
char tip_payment_program_addr[ FD_BASE58_ENCODED_32_SZ ];
336336
char tip_distribution_authority[ FD_BASE58_ENCODED_32_SZ ];
337337
uint commission_bps;
338-
float keepalive_interval_seconds;
339-
float request_timeout_seconds;
338+
ulong keepalive_interval_millis;
339+
ulong request_timeout_millis;
340340
} bundle;
341341

342342
struct {

src/app/shared/fd_config_parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ fd_config_extract_pod( uchar * pod,
188188
CFG_POP ( cstr, tiles.bundle.tip_payment_program_addr );
189189
CFG_POP ( cstr, tiles.bundle.tip_distribution_authority );
190190
CFG_POP ( uint, tiles.bundle.commission_bps );
191-
CFG_POP ( float, tiles.bundle.keepalive_interval_seconds );
192-
CFG_POP ( float, tiles.bundle.request_timeout_seconds );
191+
CFG_POP ( ulong, tiles.bundle.keepalive_interval_millis );
192+
CFG_POP ( ulong, tiles.bundle.request_timeout_millis );
193193

194194
CFG_POP ( uint, tiles.pack.max_pending_transactions );
195195
CFG_POP ( bool, tiles.pack.use_consumed_cus );

src/app/shared_dev/commands/bundle_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ bundle_client_topo( config_t * config ) {
5252
strncpy( bundle_tile->bundle.key_log_path, config->development.bundle.ssl_key_log_file, sizeof(bundle_tile->bundle.key_log_path) );
5353
bundle_tile->bundle.buf_sz = config->development.bundle.buffer_size_kib<<10;
5454
bundle_tile->bundle.ssl_heap_sz = config->development.bundle.ssl_heap_size_mib<<20;
55-
bundle_tile->bundle.keepalive_interval_nanos = (ulong)( config->tiles.bundle.keepalive_interval_seconds * 1e9f );
56-
bundle_tile->bundle.request_timeout_nanos = (ulong)( config->tiles.bundle.request_timeout_seconds * 1e9f );
55+
bundle_tile->bundle.keepalive_interval_nanos = (ulong)( (float)config->tiles.bundle.keepalive_interval_millis * 1e6f );
56+
bundle_tile->bundle.request_timeout_nanos = (ulong)( (float)config->tiles.bundle.request_timeout_millis * 1e6f );
5757

5858
strncpy( sign_tile->sign.identity_key_path, config->paths.identity_key, sizeof(sign_tile->sign.identity_key_path) );
5959

0 commit comments

Comments
 (0)