From 925e9d86fbe2d8bfe7e28ef472c9154c0e269755 Mon Sep 17 00:00:00 2001 From: Michael McGee Date: Tue, 22 Oct 2024 06:09:09 +0000 Subject: [PATCH] tpu: add resolv tile for resolving aluts --- agave | 2 +- book/api/websocket.md | 4 +- src/app/fdctl/Local.mk | 1 + src/app/fdctl/config.h | 1 + src/app/fdctl/config/default.toml | 10 + src/app/fdctl/config_parse.c | 2 + src/app/fdctl/external_functions.c | 7 + src/app/fdctl/main.c | 2 + src/app/fdctl/run/tiles/fd_pack.c | 9 +- src/app/fdctl/run/tiles/fd_poh.c | 18 +- src/app/fdctl/run/tiles/fd_resolv.c | 286 ++++++++++++++++++ src/app/fdctl/run/topos/fd_frankendancer.c | 20 +- src/app/fddev/main1.c | 2 + src/disco/fd_disco_base.h | 2 + src/disco/gui/fd_gui.c | 14 + src/disco/gui/fd_gui.h | 2 + src/disco/gui/fd_gui_printf.c | 1 + src/disco/metrics/generated/Local.mk | 2 +- src/disco/metrics/generated/fd_metrics_all.c | 3 + src/disco/metrics/generated/fd_metrics_all.h | 5 +- .../metrics/generated/fd_metrics_resolv.c | 12 + .../metrics/generated/fd_metrics_resolv.h | 52 ++++ src/disco/metrics/metrics.xml | 14 + src/disco/tiles.h | 8 + src/disco/topo/fd_topob.c | 1 + 25 files changed, 461 insertions(+), 19 deletions(-) create mode 100644 src/app/fdctl/run/tiles/fd_resolv.c create mode 100644 src/disco/metrics/generated/fd_metrics_resolv.c create mode 100644 src/disco/metrics/generated/fd_metrics_resolv.h diff --git a/agave b/agave index 3ee21a4c2d..98287070f8 160000 --- a/agave +++ b/agave @@ -1 +1 @@ -Subproject commit 3ee21a4c2ddc578c50ea0a17c4143332cf28604c +Subproject commit 98287070f8d0e3b633d5b5868830eba87282d685 diff --git a/book/api/websocket.md b/book/api/websocket.md index 5763cae8fb..e4e018e533 100644 --- a/book/api/websocket.md +++ b/book/api/websocket.md @@ -980,7 +980,8 @@ are skipped on the currently active fork. "verify_parse": 0, "verify_failed": 0, "verify_duplicate": 114, - "dedup_duplicate": 19387, + "dedup_duplicate": 19384, + "resolv_failed": 3, "pack_invalid": 0, "pack_expired": 0, "pack_retained": 2225, @@ -1086,6 +1087,7 @@ are skipped on the currently active fork. | verify_failed | `number` | Transactions were dropped because signature verification failed | | verify_duplicate | `number` | Transactions were dropped because the verify tiles determined that they had already been processed | | dedup_duplicate | `number` | Transactions were dropped because the dedup tile determined that they had already been processed | +| resolv_failed | `number` | Transactions were dropped because they contained invalid address lookup tables (LUTs) | | pack_invalid | `number` | Transactions were dropped because pack determined they would never execute. Reasons can include the transaction requested too many compute units, or was too large to fit in a block | | pack_expired | `number` | Transactions were dropped because pack determined that their TTL expired | | pack_retained | `number` | Transactions were retained inside the validator memory because they were not high enough priority to make it into a prior block we produced, but have not yet expired. We might include the transactions in a future block | diff --git a/src/app/fdctl/Local.mk b/src/app/fdctl/Local.mk index 04ff7db30c..feb416a4da 100644 --- a/src/app/fdctl/Local.mk +++ b/src/app/fdctl/Local.mk @@ -27,6 +27,7 @@ $(call add-objs,run/tiles/fd_net,fd_fdctl) $(call add-objs,run/tiles/fd_quic,fd_fdctl) $(call add-objs,run/tiles/fd_verify,fd_fdctl) $(call add-objs,run/tiles/fd_dedup,fd_fdctl) +$(call add-objs,run/tiles/fd_resolv,fd_fdctl) $(call add-objs,run/tiles/fd_pack,fd_fdctl) $(call add-objs,run/tiles/fd_bank,fd_fdctl) $(call add-objs,run/tiles/fd_poh,fd_fdctl) diff --git a/src/app/fdctl/config.h b/src/app/fdctl/config.h index 2e8b6d9ca7..84a454f401 100644 --- a/src/app/fdctl/config.h +++ b/src/app/fdctl/config.h @@ -134,6 +134,7 @@ typedef struct { uint net_tile_count; uint quic_tile_count; + uint resolv_tile_count; uint verify_tile_count; uint bank_tile_count; uint shred_tile_count; diff --git a/src/app/fdctl/config/default.toml b/src/app/fdctl/config/default.toml index 606f5ecc47..b18bbad44d 100644 --- a/src/app/fdctl/config/default.toml +++ b/src/app/fdctl/config/default.toml @@ -670,6 +670,16 @@ dynamic_port_range = "8900-9000" # QUIC tiles are designed to scale linearly when adding more tiles, quic_tile_count = 1 + # How many resolver tiles to run. Should be set to 1. This is + # configurable and designed to scale out for future network + # conditions but there is no need to run more than 1 resolver tile + # given current `mainnet-beta` conditions, unless the validator is + # under a DoS or spam attack. + # + # Resolve tiles are responsible for resolving address lookup tables + # before transactions are scheduled. + resolv_tile_count = 1 + # How many verify tiles to run. Verify tiles perform signature # verification on incoming transactions, an expensive operation that # is often the bottleneck of the validator. diff --git a/src/app/fdctl/config_parse.c b/src/app/fdctl/config_parse.c index c7cc16116a..882c906c2d 100644 --- a/src/app/fdctl/config_parse.c +++ b/src/app/fdctl/config_parse.c @@ -272,6 +272,7 @@ fdctl_pod_to_cfg( config_t * config, CFG_POP ( cstr, layout.agave_affinity ); CFG_POP ( uint, layout.net_tile_count ); CFG_POP ( uint, layout.quic_tile_count ); + CFG_POP ( uint, layout.resolv_tile_count ); CFG_POP ( uint, layout.verify_tile_count ); CFG_POP ( uint, layout.bank_tile_count ); CFG_POP ( uint, layout.shred_tile_count ); @@ -421,6 +422,7 @@ fdctl_cfg_validate( config_t * cfg ) { CFG_HAS_NON_EMPTY( layout.agave_affinity ); CFG_HAS_NON_ZERO ( layout.net_tile_count ); CFG_HAS_NON_ZERO ( layout.quic_tile_count ); + CFG_HAS_NON_ZERO ( layout.resolv_tile_count ); CFG_HAS_NON_ZERO ( layout.verify_tile_count ); CFG_HAS_NON_ZERO ( layout.bank_tile_count ); CFG_HAS_NON_ZERO ( layout.shred_tile_count ); diff --git a/src/app/fdctl/external_functions.c b/src/app/fdctl/external_functions.c index bc41b263cb..71d5b97f55 100644 --- a/src/app/fdctl/external_functions.c +++ b/src/app/fdctl/external_functions.c @@ -12,6 +12,13 @@ extern void fd_ext_bank_release_thunks( void * load_and_execute_output FD_PARAM_ extern void fd_ext_bank_release_pre_balance_info( void * pre_balance_info FD_PARAM_UNUSED ) {} extern int fd_ext_bank_verify_precompiles( void const * bank FD_PARAM_UNUSED, void const * txn FD_PARAM_UNUSED) { return 0; } +extern int +fd_ext_bank_load_account( void const * bank FD_PARAM_UNUSED, + uchar const * addr FD_PARAM_UNUSED, + uchar ** owner FD_PARAM_UNUSED, + uchar ** data FD_PARAM_UNUSED, + ulong * data_sz FD_PARAM_UNUSED ) { return 0; } + extern void fd_ext_bank_commit_txns( void const * bank FD_PARAM_UNUSED, void const * txns FD_PARAM_UNUSED, ulong txn_cnt FD_PARAM_UNUSED, void * load_and_execute_output FD_PARAM_UNUSED, void * pre_balance_info FD_PARAM_UNUSED ) {} extern void fd_ext_poh_signal_leader_change( void * sender FD_PARAM_UNUSED ) {} extern void fd_ext_poh_register_tick( void const * bank FD_PARAM_UNUSED, uchar const * hash FD_PARAM_UNUSED ) {} diff --git a/src/app/fdctl/main.c b/src/app/fdctl/main.c index 1e26ea922c..a6b3905f1c 100644 --- a/src/app/fdctl/main.c +++ b/src/app/fdctl/main.c @@ -18,6 +18,7 @@ extern fd_topo_run_tile_t fd_tile_net; extern fd_topo_run_tile_t fd_tile_quic; extern fd_topo_run_tile_t fd_tile_verify; extern fd_topo_run_tile_t fd_tile_dedup; +extern fd_topo_run_tile_t fd_tile_resolv; extern fd_topo_run_tile_t fd_tile_pack; extern fd_topo_run_tile_t fd_tile_bank; extern fd_topo_run_tile_t fd_tile_poh; @@ -35,6 +36,7 @@ fd_topo_run_tile_t * TILES[] = { &fd_tile_quic, &fd_tile_verify, &fd_tile_dedup, + &fd_tile_resolv, &fd_tile_pack, &fd_tile_bank, &fd_tile_poh, diff --git a/src/app/fdctl/run/tiles/fd_pack.c b/src/app/fdctl/run/tiles/fd_pack.c index 9a7b366e11..9dc438d216 100644 --- a/src/app/fdctl/run/tiles/fd_pack.c +++ b/src/app/fdctl/run/tiles/fd_pack.c @@ -15,7 +15,7 @@ multiple microblocks can execute in parallel, if they don't write to the same accounts. */ -#define IN_KIND_DEDUP (0UL) +#define IN_KIND_RESOLV (0UL) #define IN_KIND_POH (1UL) #define IN_KIND_BANK (2UL) #define IN_KIND_BUNDLE (3UL) @@ -556,7 +556,7 @@ during_frag( fd_pack_ctx_t * ctx, fd_memcpy( ctx->pending_rebate, dcache_entry, sz-sizeof(fd_microblock_trailer_t) ); return; } - case IN_KIND_DEDUP: { + case IN_KIND_RESOLV: { if( FD_UNLIKELY( chunkin[ in_idx ].chunk0 || chunk>ctx->in[ in_idx ].wmark || sz>FD_TPU_DCACHE_MTU ) ) FD_LOG_ERR(( "chunk %lu %lu corrupt, not in range [%lu,%lu]", chunk, sz, ctx->in[ in_idx ].chunk0, ctx->in[ in_idx ].wmark )); @@ -648,7 +648,7 @@ after_frag( fd_pack_ctx_t * ctx, ctx->pending_rebate_cnt = 0UL; break; } - case IN_KIND_DEDUP: { + case IN_KIND_RESOLV: { /* Normal transaction case */ if( FD_LIKELY( !ctx->insert_to_extra ) ) { long insert_duration = -fd_tickcount(); @@ -698,7 +698,8 @@ unprivileged_init( fd_topo_t * topo, for( ulong i=0UL; iin_cnt; i++ ) { fd_topo_link_t const * link = &topo->links[ tile->in_link_id[ i ] ]; - if( FD_LIKELY( !strcmp( link->name, "dedup_pack" ) ) ) ctx->in_kind[ i ] = IN_KIND_DEDUP; + if( FD_LIKELY( !strcmp( link->name, "resolv_pack" ) ) ) ctx->in_kind[ i ] = IN_KIND_RESOLV; + else if( FD_LIKELY( !strcmp( link->name, "dedup_pack" ) ) ) ctx->in_kind[ i ] = IN_KIND_RESOLV; else if( FD_LIKELY( !strcmp( link->name, "poh_pack" ) ) ) ctx->in_kind[ i ] = IN_KIND_POH; else if( FD_LIKELY( !strcmp( link->name, "bank_poh" ) ) ) ctx->in_kind[ i ] = IN_KIND_BANK; else if( FD_LIKELY( !strcmp( link->name, "bundle_pack" ) ) ) ctx->in_kind[ i ] = IN_KIND_BUNDLE; diff --git a/src/app/fdctl/run/tiles/fd_poh.c b/src/app/fdctl/run/tiles/fd_poh.c index 5b316b67b2..e79bba3582 100644 --- a/src/app/fdctl/run/tiles/fd_poh.c +++ b/src/app/fdctl/run/tiles/fd_poh.c @@ -558,6 +558,7 @@ typedef struct poh_link poh_link_t; poh_link_t gossip_dedup; poh_link_t stake_out; poh_link_t crds_shred; +poh_link_t replay_resolv; poh_link_t replay_plugin; poh_link_t gossip_plugin; @@ -1830,6 +1831,12 @@ fd_ext_plugin_publish_periodic( ulong sig, poh_link_publish( &gossip_plugin, sig, data, data_len ); } +void +fd_ext_resolv_publish_root_bank( uchar * data, + ulong data_len ) { + poh_link_publish( &replay_resolv, 0UL, data, data_len ); +} + static inline fd_poh_out_ctx_t out1( fd_topo_t const * topo, fd_topo_tile_t const * tile, @@ -1902,10 +1909,12 @@ unprivileged_init( fd_topo_t * topo, fd_shred_version = fd_fseq_join( fd_topo_obj_laddr( topo, poh_shred_obj_id ) ); FD_TEST( fd_shred_version ); + poh_link_init( &gossip_dedup, topo, tile, out1( topo, tile, "gossip_dedup" ).idx ); + poh_link_init( &stake_out, topo, tile, out1( topo, tile, "stake_out" ).idx ); + poh_link_init( &crds_shred, topo, tile, out1( topo, tile, "crds_shred" ).idx ); + poh_link_init( &replay_resolv, topo, tile, out1( topo, tile, "replay_resol" ).idx ); + if( FD_LIKELY( tile->poh.plugins_enabled ) ) { - poh_link_init( &gossip_dedup, topo, tile, out1( topo, tile, "gossip_dedup" ).idx ); - poh_link_init( &stake_out, topo, tile, out1( topo, tile, "stake_out" ).idx ); - poh_link_init( &crds_shred, topo, tile, out1( topo, tile, "crds_shred" ).idx ); poh_link_init( &replay_plugin, topo, tile, out1( topo, tile, "replay_plugi" ).idx ); poh_link_init( &gossip_plugin, topo, tile, out1( topo, tile, "gossip_plugi" ).idx ); poh_link_init( &start_progress_plugin, topo, tile, out1( topo, tile, "startp_plugi" ).idx ); @@ -1915,9 +1924,6 @@ unprivileged_init( fd_topo_t * topo, memory is not set so nothing will actually get published via. the links. */ FD_COMPILER_MFENCE(); - gossip_dedup.mcache = (fd_frag_meta_t*)1; - stake_out.mcache = (fd_frag_meta_t*)1; - crds_shred.mcache = (fd_frag_meta_t*)1; replay_plugin.mcache = (fd_frag_meta_t*)1; gossip_plugin.mcache = (fd_frag_meta_t*)1; start_progress_plugin.mcache = (fd_frag_meta_t*)1; diff --git a/src/app/fdctl/run/tiles/fd_resolv.c b/src/app/fdctl/run/tiles/fd_resolv.c new file mode 100644 index 0000000000..678606c56d --- /dev/null +++ b/src/app/fdctl/run/tiles/fd_resolv.c @@ -0,0 +1,286 @@ +#include "../../../../disco/tiles.h" + +#include "../../../../disco/metrics/fd_metrics.h" +#include "../../../../flamenco/types/fd_types.h" +#include "../../../../flamenco/runtime/fd_system_ids.h" + +#define FD_RESOLV_IN_KIND_FRAGMENT (0) +#define FD_RESOLV_IN_KIND_BANK (1) + +typedef struct { + int kind; + + fd_wksp_t * mem; + ulong chunk0; + ulong wmark; + ulong mtu; +} fd_resolv_in_ctx_t; + +typedef struct { + ulong round_robin_idx; + ulong round_robin_cnt; + + void * bank; + ulong slot; + ulong cutoff_slot; + + uchar _bank_msg[ sizeof(fd_rooted_bank_t) ]; + + ulong metrics[ FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_CNT ]; + + fd_resolv_in_ctx_t in[ 64UL ]; + + fd_wksp_t * out_mem; + ulong out_chunk0; + ulong out_wmark; + ulong out_chunk; +} fd_resolv_ctx_t; + +FD_FN_CONST static inline ulong +scratch_align( void ) { + return alignof( fd_resolv_ctx_t ); +} + +FD_FN_PURE static inline ulong +scratch_footprint( fd_topo_tile_t const * tile ) { + (void)tile; + ulong l = FD_LAYOUT_INIT; + l = FD_LAYOUT_APPEND( l, alignof( fd_resolv_ctx_t ), sizeof( fd_resolv_ctx_t ) ); + return FD_LAYOUT_FINI( l, scratch_align() ); +} + +extern void fd_ext_bank_release( void const * bank ); + +static ulong _fd_ext_resolv_tile_cnt; + +ulong +fd_ext_resolv_tile_cnt( void ) { + while( !_fd_ext_resolv_tile_cnt ) {} + return _fd_ext_resolv_tile_cnt; +} + +static inline void +metrics_write( fd_resolv_ctx_t * ctx ) { + FD_MCNT_ENUM_COPY( RESOLV, LUT_RESOLVED, ctx->metrics ); +} + +static int +before_frag( fd_resolv_ctx_t * ctx, + ulong in_idx, + ulong seq, + ulong sig ) { + (void)in_idx; + (void)sig; + + if( FD_UNLIKELY( ctx->in[in_idx].kind==FD_RESOLV_IN_KIND_BANK ) ) return 0; + + return (seq % ctx->round_robin_cnt) != ctx->round_robin_idx; +} + +static inline void +during_frag( fd_resolv_ctx_t * ctx, + ulong in_idx, + ulong seq, + ulong sig, + ulong chunk, + ulong sz ) { + (void)seq; + (void)sig; + + if( FD_UNLIKELY( chunkin[ in_idx ].chunk0 || chunk>ctx->in[ in_idx ].wmark || sz>ctx->in[ in_idx ].mtu ) ) + FD_LOG_ERR(( "chunk %lu %lu corrupt, not in range [%lu,%lu]", chunk, sz, ctx->in[ in_idx ].chunk0, ctx->in[ in_idx ].wmark )); + + switch( ctx->in[in_idx].kind ) { + case FD_RESOLV_IN_KIND_BANK: + fd_memcpy( ctx->_bank_msg, fd_chunk_to_laddr_const( ctx->in[in_idx].mem, chunk ), sz ); + break; + case FD_RESOLV_IN_KIND_FRAGMENT: { + uchar * src = (uchar *)fd_chunk_to_laddr( ctx->in[in_idx].mem, chunk ); + uchar * dst = (uchar *)fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk ); + fd_memcpy( dst, src, sz ); + break; + } + default: + FD_LOG_ERR(( "unknown in kind %d", ctx->in[in_idx].kind )); + } +} + +#define RESOLVE_LUT_SUCCESS ( 0) +#define RESOLVE_LUT_ERR_NO_BANK (-1) +#define RESOLVE_LUT_ERR_ACCOUNT_NOT_FOUND (-2) +#define RESOLVE_LUT_ERR_INVALID_ACCOUNT_OWNER (-3) +#define RESOLVE_LUT_ERR_INVALID_ACCOUNT_DATA (-4) +#define RESOLVE_LUT_ERR_ACCOUNT_UNINITIALIZED (-5) +#define RESOLVE_LUT_ERR_INVALID_LOOKUP_INDEX (-6) + +extern int +fd_ext_bank_load_account( void const * bank, + uchar const * addr, + uchar ** owner, + uchar ** data, + ulong * data_sz ); + +static inline int +resolve_lookup_table_addrs( fd_resolv_ctx_t * ctx, + uchar const * payload, + fd_txn_t const * txn, + fd_acct_addr_t lut_accts[ static 256 ] ) { + if( FD_UNLIKELY( !ctx->bank ) ) return RESOLVE_LUT_ERR_NO_BANK; + + for( ulong i=0UL; iaddr_table_adtl_cnt; i++ ) { + fd_txn_acct_addr_lut_t const * lut = &fd_txn_get_address_tables_const( txn )[ i ]; + uchar const * addr = payload + lut->addr_off; + + uchar * owner; + uchar * data; + ulong data_sz; + int result = fd_ext_bank_load_account( ctx->bank, addr, &owner, &data, &data_sz ); + if( FD_UNLIKELY( result ) ) return RESOLVE_LUT_ERR_ACCOUNT_NOT_FOUND; + + result = memcmp( owner, fd_solana_address_lookup_table_program_id.key, 32UL ); + if( FD_UNLIKELY( result ) ) return RESOLVE_LUT_ERR_INVALID_ACCOUNT_OWNER; + + fd_address_lookup_table_state_t table[1]; + fd_bincode_decode_ctx_t bincode = { + .data = data, + .dataend = data+data_sz, + .valloc = {0}, + }; + + result = fd_address_lookup_table_state_decode( table, &bincode ); + if( FD_UNLIKELY( result!=FD_BINCODE_SUCCESS ) ) return RESOLVE_LUT_ERR_INVALID_ACCOUNT_DATA; + + result = fd_address_lookup_table_state_is_lookup_table( table ); + if( FD_UNLIKELY( !result ) ) return RESOLVE_LUT_ERR_ACCOUNT_UNINITIALIZED; + + if( FD_UNLIKELY( (data_sz-56UL)%32UL ) ) return RESOLVE_LUT_ERR_INVALID_ACCOUNT_DATA; + + ulong addresses_len = (data_sz-56UL)/32UL; + fd_acct_addr_t const * addresses = fd_type_pun_const( data+56UL ); + + ulong deactivation_slot = table->inner.lookup_table.meta.deactivation_slot; + result = deactivation_slot!=ULONG_MAX && deactivation_slotcutoff_slot; + if( FD_UNLIKELY( result ) ) return RESOLVE_LUT_ERR_ACCOUNT_NOT_FOUND; + + ulong active_addresses_len = fd_ulong_if( ctx->slot>table->inner.lookup_table.meta.last_extended_slot, + addresses_len, + table->inner.lookup_table.meta.last_extended_slot_start_index ); + for( ulong j=0UL; jwritable_cnt; j++ ) { + uchar idx = payload[ lut->writable_off+j ]; + if( FD_UNLIKELY( idx>=active_addresses_len ) ) return RESOLVE_LUT_ERR_INVALID_LOOKUP_INDEX; + memcpy( &lut_accts[ j ], addresses+idx, sizeof(fd_acct_addr_t) ); + } + for( ulong j=0UL; jreadonly_cnt; j++ ) { + uchar idx = payload[ lut->readonly_off+j ]; + if( FD_UNLIKELY( idx>=active_addresses_len ) ) return RESOLVE_LUT_ERR_INVALID_LOOKUP_INDEX; + memcpy( &lut_accts[ lut->writable_cnt+j ], addresses+idx, sizeof(fd_acct_addr_t) ); + } + } + + return RESOLVE_LUT_SUCCESS; +} + +static inline void +after_frag( fd_resolv_ctx_t * ctx, + ulong in_idx, + ulong seq, + ulong sig, + ulong chunk, + ulong sz, + ulong tsorig, + fd_stem_context_t * stem ) { + (void)seq; + (void)sig; + (void)chunk; + + if( FD_UNLIKELY( ctx->in[in_idx].kind==FD_RESOLV_IN_KIND_BANK ) ) { + fd_rooted_bank_t * frag = (fd_rooted_bank_t *)ctx->_bank_msg; + if( FD_LIKELY( ctx->bank ) ) fd_ext_bank_release( ctx->bank ); + + ctx->bank = frag->bank; + ctx->slot = frag->slot; + ctx->cutoff_slot = frag->cutoff_slot; + return; + } + + uchar const * dcache_entry = fd_chunk_to_laddr_const( ctx->out_mem, ctx->out_chunk ); + + ulong payload_sz = *(ushort*)(dcache_entry + sz - sizeof(ushort)); + uchar const * payload = dcache_entry; + fd_txn_t const * txn = (fd_txn_t const *)( dcache_entry + fd_ulong_align_up( payload_sz, 2UL ) ); + + if( FD_UNLIKELY( txn->addr_table_adtl_cnt ) ) { + ulong txn_t_sz = fd_ulong_align_up( fd_ulong_align_up( payload_sz, 2UL ) + fd_txn_footprint( txn->instr_cnt, txn->addr_table_lookup_cnt ), 32UL ); + fd_acct_addr_t * lut_accts = (fd_acct_addr_t*)(dcache_entry+txn_t_sz); + ushort * next_payload_sz = (ushort*)(dcache_entry+txn_t_sz+txn->addr_table_adtl_cnt*sizeof(fd_acct_addr_t)); + int result = resolve_lookup_table_addrs( ctx, payload, txn, lut_accts ); + ctx->metrics[ (ulong)((long)FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_CNT-result-1L) ]++; + + *next_payload_sz = (ushort)payload_sz; + sz = txn_t_sz+txn->addr_table_adtl_cnt*sizeof(fd_acct_addr_t)+sizeof(ushort); + } + + fd_stem_publish( stem, 0UL, 0, ctx->out_chunk, sz, 0UL, tsorig, 0UL ); + ctx->out_chunk = fd_dcache_compact_next( ctx->out_chunk, sz, ctx->out_chunk0, ctx->out_wmark ); +} + +static void +unprivileged_init( fd_topo_t * topo, + fd_topo_tile_t * tile ) { + void * scratch = fd_topo_obj_laddr( topo, tile->tile_obj_id ); + + FD_SCRATCH_ALLOC_INIT( l, scratch ); + fd_resolv_ctx_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof( fd_resolv_ctx_t ), sizeof( fd_resolv_ctx_t ) ); + + ctx->round_robin_cnt = fd_topo_tile_name_cnt( topo, tile->name ); + ctx->round_robin_idx = tile->kind_id; + + if( FD_LIKELY( !tile->kind_id ) ) _fd_ext_resolv_tile_cnt = ctx->round_robin_cnt; + + ctx->bank = NULL; + + FD_TEST( tile->in_cnt<=sizeof( ctx->in )/sizeof( ctx->in[ 0 ] ) ); + for( ulong i=0UL; iin_cnt; i++ ) { + fd_topo_link_t * link = &topo->links[ tile->in_link_id[ i ] ]; + fd_topo_wksp_t * link_wksp = &topo->workspaces[ topo->objs[ link->dcache_obj_id ].wksp_id ]; + + if( FD_LIKELY( !strcmp( link->name, "replay_resol" ) ) ) ctx->in[i].kind = FD_RESOLV_IN_KIND_BANK; + else ctx->in[i].kind = FD_RESOLV_IN_KIND_FRAGMENT; + + ctx->in[i].mem = link_wksp->wksp; + ctx->in[i].chunk0 = fd_dcache_compact_chunk0( ctx->in[i].mem, link->dcache ); + ctx->in[i].wmark = fd_dcache_compact_wmark ( ctx->in[i].mem, link->dcache, link->mtu ); + ctx->in[i].mtu = link->mtu; + } + + ctx->out_mem = topo->workspaces[ topo->objs[ topo->links[ tile->out_link_id[ 0 ] ].dcache_obj_id ].wksp_id ].wksp; + ctx->out_chunk0 = fd_dcache_compact_chunk0( ctx->out_mem, topo->links[ tile->out_link_id[ 0 ] ].dcache ); + ctx->out_wmark = fd_dcache_compact_wmark ( ctx->out_mem, topo->links[ tile->out_link_id[ 0 ] ].dcache, topo->links[ tile->out_link_id[ 0 ] ].mtu ); + ctx->out_chunk = ctx->out_chunk0; + + ulong scratch_top = FD_SCRATCH_ALLOC_FINI( l, 1UL ); + if( FD_UNLIKELY( scratch_top > (ulong)scratch + scratch_footprint( tile ) ) ) + FD_LOG_ERR(( "scratch overflow %lu %lu %lu", scratch_top - (ulong)scratch - scratch_footprint( tile ), scratch_top, (ulong)scratch + scratch_footprint( tile ) )); +} + +#define STEM_BURST (1UL) + +#define STEM_CALLBACK_CONTEXT_TYPE fd_resolv_ctx_t +#define STEM_CALLBACK_CONTEXT_ALIGN alignof(fd_resolv_ctx_t) + +#define STEM_CALLBACK_METRICS_WRITE metrics_write +#define STEM_CALLBACK_BEFORE_FRAG before_frag +#define STEM_CALLBACK_DURING_FRAG during_frag +#define STEM_CALLBACK_AFTER_FRAG after_frag + +#include "../../../../disco/stem/fd_stem.c" + +fd_topo_run_tile_t fd_tile_resolv = { + .name = "resolv", + .populate_allowed_seccomp = NULL, + .populate_allowed_fds = NULL, + .scratch_align = scratch_align, + .scratch_footprint = scratch_footprint, + .unprivileged_init = unprivileged_init, + .run = stem_run, +}; diff --git a/src/app/fdctl/run/topos/fd_frankendancer.c b/src/app/fdctl/run/topos/fd_frankendancer.c index 5fb0f710e1..9a16fe9b63 100644 --- a/src/app/fdctl/run/topos/fd_frankendancer.c +++ b/src/app/fdctl/run/topos/fd_frankendancer.c @@ -11,6 +11,7 @@ fd_topo_initialize( config_t * config ) { ulong net_tile_cnt = config->layout.net_tile_count; ulong quic_tile_cnt = config->layout.quic_tile_count; ulong verify_tile_cnt = config->layout.verify_tile_count; + ulong resolv_tile_cnt = config->layout.resolv_tile_count; ulong bank_tile_cnt = config->layout.bank_tile_count; ulong shred_tile_cnt = config->layout.shred_tile_count; @@ -21,7 +22,8 @@ fd_topo_initialize( config_t * config ) { fd_topob_wksp( topo, "net_shred" ); fd_topob_wksp( topo, "quic_verify" ); fd_topob_wksp( topo, "verify_dedup" ); - fd_topob_wksp( topo, "dedup_pack" ); + fd_topob_wksp( topo, "dedup_resolv" ); + fd_topob_wksp( topo, "resolv_pack" ); fd_topob_wksp( topo, "pack_bank" ); fd_topob_wksp( topo, "bank_poh" ); fd_topob_wksp( topo, "bank_busy" ); @@ -40,6 +42,7 @@ fd_topo_initialize( config_t * config ) { fd_topob_wksp( topo, "quic" ); fd_topob_wksp( topo, "verify" ); fd_topob_wksp( topo, "dedup" ); + fd_topob_wksp( topo, "resolv" ); fd_topob_wksp( topo, "pack" ); fd_topob_wksp( topo, "bank" ); fd_topob_wksp( topo, "poh" ); @@ -62,7 +65,8 @@ fd_topo_initialize( config_t * config ) { /**/ fd_topob_link( topo, "gossip_dedup", "gossip_dedup", 0, 2048UL, FD_TPU_DCACHE_MTU, 1UL ); /* dedup_pack is large currently because pack can encounter stalls when running at very high throughput rates that would otherwise cause drops. */ - /**/ fd_topob_link( topo, "dedup_pack", "dedup_pack", 0, 65536UL, FD_TPU_DCACHE_MTU, 1UL ); + /**/ fd_topob_link( topo, "dedup_resolv", "dedup_resolv", 0, 65536UL, FD_TPU_DCACHE_MTU, 1UL ); + FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_pack", "resolv_pack", 0, 65536UL, FD_TPU_RESOLVED_DCACHE_MTU, 1UL ); /**/ fd_topob_link( topo, "stake_out", "stake_out", 0, 128UL, 40UL + 40200UL * 40UL, 1UL ); /* pack_bank is shared across all banks, so if one bank stalls due to complex transactions, the buffer neeeds to be large so that other banks can keep proceeding. */ @@ -71,6 +75,7 @@ fd_topo_initialize( config_t * config ) { /**/ fd_topob_link( topo, "poh_pack", "bank_poh", 0, 128UL, sizeof(fd_became_leader_t), 1UL ); /**/ fd_topob_link( topo, "poh_shred", "poh_shred", 0, 16384UL, USHORT_MAX, 1UL ); /**/ fd_topob_link( topo, "crds_shred", "poh_shred", 0, 128UL, 8UL + 40200UL * 38UL, 1UL ); + /**/ fd_topob_link( topo, "replay_resol", "bank_poh", 0, 128UL, sizeof(fd_rooted_bank_t), 1UL ); /* See long comment in fd_shred.c for an explanation about the size of this dcache. */ FOR(shred_tile_cnt) fd_topob_link( topo, "shred_store", "shred_store", 0, 16384UL, 4UL*FD_SHRED_STORE_MTU, 4UL+config->tiles.shred.max_pending_shred_sets ); @@ -110,6 +115,7 @@ fd_topo_initialize( config_t * config ) { FOR(quic_tile_cnt) fd_topob_tile( topo, "quic", "quic", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0 ); FOR(verify_tile_cnt) fd_topob_tile( topo, "verify", "verify", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0 ); /**/ fd_topob_tile( topo, "dedup", "dedup", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0 ); + FOR(resolv_tile_cnt) fd_topob_tile( topo, "resolv", "resolv", "metric_in", tile_to_cpu[ topo->tile_cnt ], 1 ); /**/ fd_topob_tile( topo, "pack", "pack", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0 ); FOR(bank_tile_cnt) fd_topob_tile( topo, "bank", "bank", "metric_in", tile_to_cpu[ topo->tile_cnt ], 1 ); /**/ fd_topob_tile( topo, "poh", "poh", "metric_in", tile_to_cpu[ topo->tile_cnt ], 1 ); @@ -176,8 +182,11 @@ fd_topo_initialize( config_t * config ) { /* Declare the single gossip link before the variable length verify-dedup links so we could have a compile-time index to the gossip link. */ /**/ fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "gossip_dedup", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); FOR(verify_tile_cnt) fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "verify_dedup", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); - /**/ fd_topob_tile_out( topo, "dedup", 0UL, "dedup_pack", 0UL ); - /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "dedup_pack", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); + /**/ fd_topob_tile_out( topo, "dedup", 0UL, "dedup_resolv", 0UL ); + FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); + FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "replay_resol", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); + FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv", i, "resolv_pack", i ); + /**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "resolv_pack", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); /* The PoH to pack link is reliable, and must be. The fragments going across here are "you became leader" which pack must respond to by publishing microblocks, otherwise the leader TPU will hang @@ -232,6 +241,7 @@ fd_topo_initialize( config_t * config ) { /**/ fd_topob_tile_out( topo, "poh", 0UL, "gossip_dedup", 0UL ); /**/ fd_topob_tile_out( topo, "poh", 0UL, "stake_out", 0UL ); /**/ fd_topob_tile_out( topo, "poh", 0UL, "crds_shred", 0UL ); + /**/ fd_topob_tile_out( topo, "poh", 0UL, "replay_resol", 0UL ); /* For now the only plugin consumer is the GUI */ int plugins_enabled = config->tiles.gui.enabled; @@ -381,6 +391,8 @@ fd_topo_initialize( config_t * config ) { } else if( FD_UNLIKELY( !strcmp( tile->name, "dedup" ) ) ) { tile->dedup.tcache_depth = config->tiles.dedup.signature_cache_size; + } else if( FD_UNLIKELY( !strcmp( tile->name, "resolv" ) ) ) { + } else if( FD_UNLIKELY( !strcmp( tile->name, "pack" ) ) ) { strncpy( tile->pack.identity_key_path, config->consensus.identity_path, sizeof(tile->pack.identity_key_path) ); diff --git a/src/app/fddev/main1.c b/src/app/fddev/main1.c index 0cf9f92a19..1a10531d78 100644 --- a/src/app/fddev/main1.c +++ b/src/app/fddev/main1.c @@ -36,6 +36,7 @@ extern fd_topo_run_tile_t fd_tile_net; extern fd_topo_run_tile_t fd_tile_quic; extern fd_topo_run_tile_t fd_tile_verify; extern fd_topo_run_tile_t fd_tile_dedup; +extern fd_topo_run_tile_t fd_tile_resolv; extern fd_topo_run_tile_t fd_tile_pack; extern fd_topo_run_tile_t fd_tile_bank; extern fd_topo_run_tile_t fd_tile_poh; @@ -67,6 +68,7 @@ fd_topo_run_tile_t * TILES[] = { &fd_tile_quic, &fd_tile_verify, &fd_tile_dedup, + &fd_tile_resolv, &fd_tile_pack, &fd_tile_bank, &fd_tile_poh, diff --git a/src/disco/fd_disco_base.h b/src/disco/fd_disco_base.h index 6be5dce1af..c2dde5d776 100644 --- a/src/disco/fd_disco_base.h +++ b/src/disco/fd_disco_base.h @@ -44,6 +44,8 @@ in the Rust code. */ FD_STATIC_ASSERT( FD_TPU_DCACHE_MTU==2086UL, tpu_dcache_mtu_check ); +#define FD_TPU_RESOLVED_DCACHE_MTU (FD_TPU_DCACHE_MTU + (256UL*32UL) + 32UL) + #define FD_NETMUX_SIG_MIN_HDR_SZ ( 42UL) /* The default header size, which means no vlan tags and no IP options. */ #define FD_NETMUX_SIG_IGNORE_HDR_SZ (102UL) /* Outside the allowable range, but still fits in 4 bits when compressed */ diff --git a/src/disco/gui/fd_gui.c b/src/disco/gui/fd_gui.c index ae45ecdde8..63ad2b37c0 100644 --- a/src/disco/gui/fd_gui.c +++ b/src/disco/gui/fd_gui.c @@ -78,6 +78,7 @@ fd_gui_new( void * shmem, gui->summary.net_tile_cnt = fd_topo_tile_name_cnt( gui->topo, "net" ); gui->summary.quic_tile_cnt = fd_topo_tile_name_cnt( gui->topo, "quic" ); gui->summary.verify_tile_cnt = fd_topo_tile_name_cnt( gui->topo, "verify" ); + gui->summary.resolv_tile_cnt = fd_topo_tile_name_cnt( gui->topo, "resolv" ); gui->summary.bank_tile_cnt = fd_topo_tile_name_cnt( gui->topo, "bank" ); gui->summary.shred_tile_cnt = fd_topo_tile_name_cnt( gui->topo, "shred" ); @@ -394,6 +395,19 @@ fd_gui_txn_waterfall_snap( fd_gui_t * gui, + pack_metrics[ MIDX( COUNTER, PACK, TRANSACTION_DROPPED_FROM_EXTRA ) ]; cur->out.pack_retained += fd_ulong_if( inserted_to_extra>=inserted_from_extra, inserted_to_extra-inserted_from_extra, 0UL ); + cur->out.resolv_failed = 0UL; + for( ulong i=0UL; isummary.resolv_tile_cnt; i++ ) { + fd_topo_tile_t const * resolv = &topo->tiles[ fd_topo_find_tile( topo, "resolv", i ) ]; + volatile ulong const * resolv_metrics = fd_metrics_tile( resolv->metrics ); + + cur->out.resolv_failed += resolv_metrics[ MIDX( COUNTER, RESOLV, LUT_RESOLVED_NO_BANK ) ]; + + resolv_metrics[ MIDX( COUNTER, RESOLV, LUT_RESOLVED_ACCOUNT_NOT_FOUND ) ] + + resolv_metrics[ MIDX( COUNTER, RESOLV, LUT_RESOLVED_INVALID_ACCOUNT_OWNER ) ] + + resolv_metrics[ MIDX( COUNTER, RESOLV, LUT_RESOLVED_INVALID_ACCOUNT_DATA ) ] + + resolv_metrics[ MIDX( COUNTER, RESOLV, LUT_RESOLVED_ACCOUNT_UNINITIALIZED ) ] + + resolv_metrics[ MIDX( COUNTER, RESOLV, LUT_RESOLVED_INVALID_LOOKUP_INDEX ) ]; + } + fd_topo_tile_t const * dedup = &topo->tiles[ fd_topo_find_tile( topo, "dedup", 0UL ) ]; volatile ulong const * dedup_metrics = fd_metrics_tile( dedup->metrics ); diff --git a/src/disco/gui/fd_gui.h b/src/disco/gui/fd_gui.h index 76070c9ef4..523e22a398 100644 --- a/src/disco/gui/fd_gui.h +++ b/src/disco/gui/fd_gui.h @@ -99,6 +99,7 @@ struct fd_gui_txn_waterfall { ulong verify_failed; ulong verify_duplicate; ulong dedup_duplicate; + ulong resolv_failed; ulong pack_invalid; ulong pack_expired; ulong pack_retained; @@ -240,6 +241,7 @@ struct fd_gui { ulong net_tile_cnt; ulong quic_tile_cnt; ulong verify_tile_cnt; + ulong resolv_tile_cnt; ulong bank_tile_cnt; ulong shred_tile_cnt; diff --git a/src/disco/gui/fd_gui_printf.c b/src/disco/gui/fd_gui_printf.c index ecde23d914..e1af1e6174 100644 --- a/src/disco/gui/fd_gui_printf.c +++ b/src/disco/gui/fd_gui_printf.c @@ -496,6 +496,7 @@ fd_gui_printf_waterfall( fd_gui_t * gui, jsonp_ulong( gui, "verify_failed", cur->out.verify_failed - prev->out.verify_failed ); jsonp_ulong( gui, "verify_duplicate", cur->out.verify_duplicate - prev->out.verify_duplicate ); jsonp_ulong( gui, "dedup_duplicate", cur->out.dedup_duplicate - prev->out.dedup_duplicate ); + jsonp_ulong( gui, "resolv_failed", cur->out.resolv_failed - prev->out.resolv_failed ); jsonp_ulong( gui, "pack_invalid", cur->out.pack_invalid - prev->out.pack_invalid ); jsonp_ulong( gui, "pack_expired", cur->out.pack_expired - prev->out.pack_expired ); jsonp_ulong( gui, "pack_retained", cur->out.pack_retained ); diff --git a/src/disco/metrics/generated/Local.mk b/src/disco/metrics/generated/Local.mk index a916a84212..b43b84c2fe 100644 --- a/src/disco/metrics/generated/Local.mk +++ b/src/disco/metrics/generated/Local.mk @@ -1,5 +1,5 @@ $(call add-hdrs,fd_metrics_all.h fd_metrics_quic.h) -$(call add-objs,fd_metrics_all fd_metrics_net fd_metrics_quic fd_metrics_verify fd_metrics_dedup fd_metrics_pack fd_metrics_bank fd_metrics_poh fd_metrics_store fd_metrics_shred,fd_disco) +$(call add-objs,fd_metrics_all fd_metrics_net fd_metrics_quic fd_metrics_verify fd_metrics_dedup fd_metrics_resolv fd_metrics_pack fd_metrics_bank fd_metrics_poh fd_metrics_store fd_metrics_shred,fd_disco) ifdef FD_HAS_NO_AGAVE $(call add-objs,fd_metrics_replay,fd_disco) diff --git a/src/disco/metrics/generated/fd_metrics_all.c b/src/disco/metrics/generated/fd_metrics_all.c index 370f144067..d77ef3b05e 100644 --- a/src/disco/metrics/generated/fd_metrics_all.c +++ b/src/disco/metrics/generated/fd_metrics_all.c @@ -39,6 +39,7 @@ const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT] = { "pack", "poh", "quic", + "resolv", "shred", "store", "verify", @@ -54,6 +55,7 @@ const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = { FD_METRICS_PACK_TOTAL, FD_METRICS_POH_TOTAL, FD_METRICS_QUIC_TOTAL, + FD_METRICS_RESOLV_TOTAL, FD_METRICS_SHRED_TOTAL, FD_METRICS_STORE_TOTAL, FD_METRICS_VERIFY_TOTAL, @@ -69,6 +71,7 @@ const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT] FD_METRICS_PACK, FD_METRICS_POH, FD_METRICS_QUIC, + FD_METRICS_RESOLV, FD_METRICS_SHRED, FD_METRICS_STORE, FD_METRICS_VERIFY, diff --git a/src/disco/metrics/generated/fd_metrics_all.h b/src/disco/metrics/generated/fd_metrics_all.h index 0b9181bb0b..e5c12bf215 100644 --- a/src/disco/metrics/generated/fd_metrics_all.h +++ b/src/disco/metrics/generated/fd_metrics_all.h @@ -8,6 +8,7 @@ #include "fd_metrics_pack.h" #include "fd_metrics_poh.h" #include "fd_metrics_quic.h" +#include "fd_metrics_resolv.h" #include "fd_metrics_shred.h" #include "fd_metrics_store.h" #include "fd_metrics_verify.h" @@ -187,9 +188,9 @@ extern const fd_metrics_meta_t FD_METRICS_ALL_LINK_OUT[FD_METRICS_ALL_LINK_OUT_T #define FD_METRICS_TOTAL_SZ (8UL*194UL) #ifndef FD_HAS_NO_AGAVE -#define FD_METRICS_TILE_KIND_CNT 9 +#define FD_METRICS_TILE_KIND_CNT 10 #else -#define FD_METRICS_TILE_KIND_CNT 11 +#define FD_METRICS_TILE_KIND_CNT 12 #endif extern const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT]; extern const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT]; diff --git a/src/disco/metrics/generated/fd_metrics_resolv.c b/src/disco/metrics/generated/fd_metrics_resolv.c new file mode 100644 index 0000000000..1e3aacabb8 --- /dev/null +++ b/src/disco/metrics/generated/fd_metrics_resolv.c @@ -0,0 +1,12 @@ +/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */ +#include "fd_metrics_resolv.h" + +const fd_metrics_meta_t FD_METRICS_RESOLV[FD_METRICS_RESOLV_TOTAL] = { + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_INVALID_LOOKUP_INDEX ), + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_ACCOUNT_UNINITIALIZED ), + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_INVALID_ACCOUNT_DATA ), + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_INVALID_ACCOUNT_OWNER ), + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_ACCOUNT_NOT_FOUND ), + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_NO_BANK ), + DECLARE_METRIC_COUNTER( RESOLV, LUT_RESOLVED_SUCCESS ), +}; diff --git a/src/disco/metrics/generated/fd_metrics_resolv.h b/src/disco/metrics/generated/fd_metrics_resolv.h new file mode 100644 index 0000000000..ebfe8dae02 --- /dev/null +++ b/src/disco/metrics/generated/fd_metrics_resolv.h @@ -0,0 +1,52 @@ +/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */ + +#include "../fd_metrics_base.h" + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_OFF (16UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_CNT (7UL) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_LOOKUP_INDEX_OFF (16UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_LOOKUP_INDEX_NAME "resolv_lut_resolved_invalid_lookup_index" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_LOOKUP_INDEX_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_LOOKUP_INDEX_DESC "Count of address lookup tables resolved (The transaction referenced an index in a LUT that didn't exist)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_LOOKUP_INDEX_CVT (FD_METRICS_CONVERTER_NONE) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_UNINITIALIZED_OFF (17UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_UNINITIALIZED_NAME "resolv_lut_resolved_account_uninitialized" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_UNINITIALIZED_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_UNINITIALIZED_DESC "Count of address lookup tables resolved (The account referenced as a LUT hasn't been initialized)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_UNINITIALIZED_CVT (FD_METRICS_CONVERTER_NONE) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_DATA_OFF (18UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_DATA_NAME "resolv_lut_resolved_invalid_account_data" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_DATA_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_DATA_DESC "Count of address lookup tables resolved (The account referenced as a LUT couldn't be parsed)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_DATA_CVT (FD_METRICS_CONVERTER_NONE) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_OWNER_OFF (19UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_OWNER_NAME "resolv_lut_resolved_invalid_account_owner" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_OWNER_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_OWNER_DESC "Count of address lookup tables resolved (The account referenced as a LUT wasn't owned by the ALUT program ID)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_INVALID_ACCOUNT_OWNER_CVT (FD_METRICS_CONVERTER_NONE) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_NOT_FOUND_OFF (20UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_NOT_FOUND_NAME "resolv_lut_resolved_account_not_found" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_NOT_FOUND_DESC "Count of address lookup tables resolved (The account referenced as a LUT couldn't be found)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_ACCOUNT_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_NO_BANK_OFF (21UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_NO_BANK_NAME "resolv_lut_resolved_no_bank" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_NO_BANK_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_NO_BANK_DESC "Count of address lookup tables resolved (There was no bank available to resolve against)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_NO_BANK_CVT (FD_METRICS_CONVERTER_NONE) + +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_SUCCESS_OFF (22UL) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_SUCCESS_NAME "resolv_lut_resolved_success" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_SUCCESS_TYPE (FD_METRICS_TYPE_COUNTER) +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_SUCCESS_DESC "Count of address lookup tables resolved (Resolved successfully)" +#define FD_METRICS_COUNTER_RESOLV_LUT_RESOLVED_SUCCESS_CVT (FD_METRICS_CONVERTER_NONE) + + +#define FD_METRICS_RESOLV_TOTAL (7UL) +extern const fd_metrics_meta_t FD_METRICS_RESOLV[FD_METRICS_RESOLV_TOTAL]; diff --git a/src/disco/metrics/metrics.xml b/src/disco/metrics/metrics.xml index 308d109384..d9afdc051b 100644 --- a/src/disco/metrics/metrics.xml +++ b/src/disco/metrics/metrics.xml @@ -258,6 +258,20 @@ metric introduced. + + + + + + + + + + + + + + Duration of scheduling one microblock diff --git a/src/disco/tiles.h b/src/disco/tiles.h index 819585067d..047e8e846a 100644 --- a/src/disco/tiles.h +++ b/src/disco/tiles.h @@ -64,6 +64,14 @@ struct fd_became_leader { }; typedef struct fd_became_leader fd_became_leader_t; +struct fd_rooted_bank { + void * bank; + ulong slot; + ulong cutoff_slot; +}; + +typedef struct fd_rooted_bank fd_rooted_bank_t; + struct fd_microblock_trailer { /* The hash of the transactions in the microblock, ready to be mixed into PoH. */ diff --git a/src/disco/topo/fd_topob.c b/src/disco/topo/fd_topob.c index 5ddde365a3..fb74b9eed3 100644 --- a/src/disco/topo/fd_topob.c +++ b/src/disco/topo/fd_topob.c @@ -347,6 +347,7 @@ fd_topob_auto_layout( fd_topo_t * topo ) { "quic", "verify", "dedup", + "resolv", "pack", "bank", "poh",