Skip to content

Commit

Permalink
tpu: add resolv tile for resolving aluts
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgee-jump committed Oct 22, 2024
1 parent 6e4df6a commit 925e9d8
Show file tree
Hide file tree
Showing 25 changed files with 461 additions and 19 deletions.
2 changes: 1 addition & 1 deletion agave
4 changes: 3 additions & 1 deletion book/api/websocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions src/app/fdctl/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/app/fdctl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/app/fdctl/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/app/fdctl/config_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down
7 changes: 7 additions & 0 deletions src/app/fdctl/external_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {}
Expand Down
2 changes: 2 additions & 0 deletions src/app/fdctl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions src/app/fdctl/run/tiles/fd_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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( chunk<ctx->in[ 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 ));

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -698,7 +698,8 @@ unprivileged_init( fd_topo_t * topo,
for( ulong i=0UL; i<tile->in_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;
Expand Down
18 changes: 12 additions & 6 deletions src/app/fdctl/run/tiles/fd_poh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 );
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 925e9d8

Please sign in to comment.