Skip to content

Commit 78301c1

Browse files
committed
airlift across resolv stubbing out required functions
1 parent d69524d commit 78301c1

File tree

9 files changed

+138
-1
lines changed

9 files changed

+138
-1
lines changed

src/app/firedancer-dev/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ extern fd_topo_run_tile_t fd_tile_quic;
6969
extern fd_topo_run_tile_t fd_tile_verify;
7070
extern fd_topo_run_tile_t fd_tile_dedup;
7171
extern fd_topo_run_tile_t fd_tile_pack;
72+
extern fd_topo_run_tile_t fd_tile_resolv;
7273
extern fd_topo_run_tile_t fd_tile_shred;
7374
extern fd_topo_run_tile_t fd_tile_sign;
7475
extern fd_topo_run_tile_t fd_tile_metric;
@@ -108,6 +109,7 @@ fd_topo_run_tile_t * TILES[] = {
108109
&fd_tile_verify,
109110
&fd_tile_dedup,
110111
&fd_tile_pack,
112+
&fd_tile_resolv,
111113
&fd_tile_shred,
112114
&fd_tile_sign,
113115
&fd_tile_metric,

src/app/firedancer/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ extern fd_topo_run_tile_t fd_tile_quic;
5959
extern fd_topo_run_tile_t fd_tile_verify;
6060
extern fd_topo_run_tile_t fd_tile_dedup;
6161
extern fd_topo_run_tile_t fd_tile_pack;
62+
extern fd_topo_run_tile_t fd_tile_resolv;
6263
extern fd_topo_run_tile_t fd_tile_shred;
6364
extern fd_topo_run_tile_t fd_tile_sign;
6465
extern fd_topo_run_tile_t fd_tile_metric;
@@ -87,6 +88,7 @@ fd_topo_run_tile_t * TILES[] = {
8788
&fd_tile_verify,
8889
&fd_tile_dedup,
8990
&fd_tile_pack,
91+
&fd_tile_resolv,
9092
&fd_tile_shred,
9193
&fd_tile_sign,
9294
&fd_tile_metric,

src/app/firedancer/topology.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ fd_topo_initialize( config_t * config ) {
209209
ulong bank_tile_cnt = config->layout.bank_tile_count;
210210
ulong exec_tile_cnt = config->firedancer.layout.exec_tile_count;
211211
ulong writer_tile_cnt = config->firedancer.layout.writer_tile_count;
212+
ulong resolv_tile_cnt = config->layout.resolv_tile_count;
212213

213214
int enable_rpc = ( config->rpc.port != 0 );
214215
int enable_rstart = !!config->tiles.restart.enabled;
@@ -229,6 +230,9 @@ fd_topo_initialize( config_t * config ) {
229230
fd_topob_wksp( topo, "verify_dedup" );
230231
fd_topob_wksp( topo, "dedup_pack" );
231232

233+
// fd_topob_wksp( topo, "dedup_resolv" );
234+
fd_topob_wksp( topo, "resolv_pack" );
235+
232236
fd_topob_wksp( topo, "shred_storei" );
233237
fd_topob_wksp( topo, "shred_repair" );
234238
fd_topob_wksp( topo, "stake_out" );
@@ -283,6 +287,7 @@ fd_topo_initialize( config_t * config ) {
283287
fd_topob_wksp( topo, "dedup" );
284288
fd_topob_wksp( topo, "shred" );
285289
fd_topob_wksp( topo, "pack" );
290+
fd_topob_wksp( topo, "resolv" );
286291
fd_topob_wksp( topo, "storei" );
287292
fd_topob_wksp( topo, "sign" );
288293
fd_topob_wksp( topo, "repair" );
@@ -328,6 +333,10 @@ fd_topo_initialize( config_t * config ) {
328333
329334
/**/ fd_topob_link( topo, "gossip_sign", "gossip_sign", 128UL, 2048UL, 1UL );
330335
/**/ fd_topob_link( topo, "sign_gossip", "sign_gossip", 128UL, 64UL, 1UL );
336+
337+
// /**/ fd_topob_link( topo, "dedup_resolv", "dedup_resolv", 65536UL, FD_TPU_PARSED_MTU, 1UL );
338+
FOR(resolv_tile_cnt) fd_topob_link( topo, "resolv_pack", "resolv_pack", 65536UL, FD_TPU_RESOLVED_MTU, 1UL );
339+
331340
/* TODO: The MTU is currently relatively arbitrary and needs to be resized to the size of the largest
332341
message that is outbound from the replay to exec. */
333342
FOR(exec_tile_cnt) fd_topob_link( topo, "replay_exec", "replay_exec", 128UL, 10240UL, exec_tile_cnt );
@@ -423,6 +432,7 @@ fd_topo_initialize( config_t * config ) {
423432
FOR(quic_tile_cnt) fd_topob_tile( topo, "quic", "quic", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
424433
FOR(verify_tile_cnt) fd_topob_tile( topo, "verify", "verify", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
425434
/**/ fd_topob_tile( topo, "dedup", "dedup", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
435+
FOR(resolv_tile_cnt) fd_topob_tile( topo, "resolv", "resolv", "metric_in", tile_to_cpu[ topo->tile_cnt ], 1, 0 );
426436
FOR(shred_tile_cnt) fd_topob_tile( topo, "shred", "shred", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
427437
fd_topo_tile_t * store_tile = fd_topob_tile( topo, "storei", "storei", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
428438
/**/ fd_topob_tile( topo, "sign", "sign", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
@@ -582,6 +592,11 @@ fd_topo_initialize( config_t * config ) {
582592
/**/ fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "voter_dedup", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
583593
FOR(verify_tile_cnt) fd_topob_tile_in( topo, "dedup", 0UL, "metric_in", "verify_dedup", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
584594
/**/ fd_topob_tile_out( topo, "dedup", 0UL, "dedup_pack", 0UL );
595+
// FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "dedup_resolv", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
596+
// FOR(resolv_tile_cnt) fd_topob_tile_in( topo, "resolv", i, "metric_in", "replay_resol", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
597+
FOR(resolv_tile_cnt) fd_topob_tile_out( topo, "resolv", i, "resolv_pack", i );
598+
/**/ fd_topob_tile_in( topo, "pack", 0UL, "metric_in", "resolv_pack", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
599+
585600
/**/ fd_topos_tile_in_net( topo, "metric_in", "gossip_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
586601
/**/ fd_topos_tile_in_net( topo, "metric_in", "repair_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); /* No reliable consumers of networking fragments, may be dropped or overrun */
587602

@@ -793,6 +808,7 @@ fd_topo_initialize( config_t * config ) {
793808

794809
} else if( FD_UNLIKELY( !strcmp( tile->name, "dedup" ) ) ) {
795810
tile->dedup.tcache_depth = config->tiles.dedup.signature_cache_size;
811+
} else if( FD_UNLIKELY( !strcmp( tile->name, "resolv" ) ) ) {
796812

797813
} else if( FD_UNLIKELY( !strcmp( tile->name, "shred" ) ) ) {
798814
strncpy( tile->shred.identity_key_path, config->paths.identity_key, sizeof(tile->shred.identity_key_path) );

src/discof/bank/Local.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ifdef FD_HAS_ATOMIC
2+
ifdef FD_HAS_INT128
3+
ifdef FD_HAS_SSE
4+
$(call add-hdrs,fd_bank_abi.h)
5+
$(call add-objs,fd_bank_abi,fd_discof)
6+
endif
7+
endif
8+
endif

src/discof/bank/fd_bank_abi.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include "fd_bank_abi.h"
2+
3+
int
4+
fd_bank_abi_resolve_address_lookup_tables( void const * bank FD_PARAM_UNUSED,
5+
int fixed_root FD_PARAM_UNUSED,
6+
ulong slot FD_PARAM_UNUSED,
7+
fd_txn_t const * txn FD_PARAM_UNUSED,
8+
uchar const * payload FD_PARAM_UNUSED,
9+
fd_acct_addr_t * out_lut_accts FD_PARAM_UNUSED) {
10+
11+
12+
#if 0
13+
14+
// reference code to start with
15+
16+
/* Only resolve for V0 transaction versions */
17+
if( txn_descriptor->transaction_version == FD_TXN_V0 ) {
18+
fd_txn_acct_addr_lut_t const * addr_luts = fd_txn_get_address_tables_const( txn_descriptor );
19+
for( ulong i = 0UL; i < txn_descriptor->addr_table_lookup_cnt; i++ ) {
20+
fd_txn_acct_addr_lut_t const * addr_lut = &addr_luts[i];
21+
22+
fd_pubkey_t * addr_lut_acc = (fd_pubkey_t *)((uchar *)txn_raw.raw + addr_lut->addr_off);
23+
/* TODO: WRITE OUT RESOLVED PUBKEY */
24+
}
25+
26+
/* Look up the pubkeys from the ALTs */
27+
fd_slot_hashes_global_t const * slot_hashes_global = fd_sysvar_cache_slot_hashes(
28+
ctx->slot_ctx->sysvar_cache, ctx->runtime_public_wksp );
29+
if( FD_UNLIKELY( !slot_hashes_global ) ) {
30+
FD_LOG_ERR(( "failed to get slot hashes global" ));
31+
}
32+
fd_slot_hash_t * slot_hash = deq_fd_slot_hash_t_join( (uchar *)slot_hashes_global + slot_hashes_global->hashes_offset );
33+
fd_acct_addr_t * accts_alt = fd_spad_alloc(
34+
ctx->runtime_spad, alignof(fd_acct_addr_t), sizeof(fd_acct_addr_t) * txn_descriptor->addr_table_adtl_cnt );
35+
int err = fd_runtime_load_txn_address_lookup_tables( txn_descriptor,
36+
txn_raw.raw,
37+
ctx->funk,
38+
ctx->slot_ctx->funk_txn,
39+
ctx->curr_slot,
40+
slot_hash,
41+
accts_alt);
42+
if( FD_UNLIKELY( err != FD_RUNTIME_EXECUTE_SUCCESS ) ) {
43+
FD_LOG_WARNING(( "failed to load txn address lookup tables" ));
44+
}
45+
46+
for( ulong i = 0UL; i < txn_descriptor->addr_table_lookup_cnt; i++ ) {
47+
fd_pubkey_t * pubkey = fd_type_pun( &accts_alt[i] );
48+
/* TODO: WRITE OUT RESOLVED PUBKEY */
49+
}
50+
}
51+
} FD_SPAD_FRAME_END;
52+
53+
#endif
54+
55+
FD_LOG_ERR(("nope"));
56+
return 0;
57+
}
58+
59+
void fd_ext_bank_release( void const * bank FD_PARAM_UNUSED) {
60+
FD_LOG_ERR(("nope"));
61+
}

src/discof/bank/fd_bank_abi.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#ifndef HEADER_fd_src_discof_fd_bank_abi_h
2+
#define HEADER_fd_src_discof_fd_bank_abi_h
3+
4+
// Make sure the wrong header file doesn't also sneak in...
5+
#define HEADER_fd_src_discoh_fd_bank_abi_h
6+
7+
#include "../../disco/pack/fd_pack.h"
8+
9+
#define FD_BANK_ABI_TXN_INIT_SUCCESS ( 0)
10+
#define FD_BANK_ABI_TXN_INIT_ERR_ACCOUNT_NOT_FOUND (-1)
11+
#define FD_BANK_ABI_TXN_INIT_ERR_INVALID_ACCOUNT_OWNER (-2)
12+
#define FD_BANK_ABI_TXN_INIT_ERR_INVALID_ACCOUNT_DATA (-3)
13+
#define FD_BANK_ABI_TXN_INIT_ERR_ACCOUNT_UNINITIALIZED (-4)
14+
#define FD_BANK_ABI_TXN_INIT_ERR_INVALID_LOOKUP_INDEX (-5)
15+
16+
FD_PROTOTYPES_BEGIN
17+
18+
/* This function resolves the address lookup tables for the provided
19+
transaction by writing them out to the out_lut_accts. The accounts
20+
are written, writable first, then readable, in the order they are
21+
referenced by the transaction.
22+
23+
The function returns FD_BANK_ABI_TXN_INIT_SUCCESS on success and one
24+
of the FD_BANK_ABI_TXN_INIT_ERR_* error codes on failure.
25+
26+
The address lookup table is retrieved as-of a particular slot that's
27+
provided. The slot is important in determining if the ALUT has been
28+
deactivated yet, or if it has been extended and the extension is in
29+
effect (extensions do not become active on the slot they occur in). */
30+
31+
int
32+
fd_bank_abi_resolve_address_lookup_tables( void const * bank,
33+
int fixed_root,
34+
ulong slot,
35+
fd_txn_t const * txn,
36+
uchar const * payload,
37+
fd_acct_addr_t * out_lut_accts );
38+
39+
40+
void fd_ext_bank_release( void const * bank );
41+
42+
FD_PROTOTYPES_END
43+
44+
#endif

src/discof/resolv/Local.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ifdef FD_HAS_SSE
2+
$(call add-objs,fd_resolv_tile,fd_discof)
3+
endif

src/discof/resolv/fd_resolv_tile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../discoh/resolv/fd_resolv_tile.c

src/discoh/bank/Local.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ifdef FD_HAS_ATOMIC
22
ifdef FD_HAS_INT128
33
ifdef FD_HAS_SSE
44
$(call add-hdrs,fd_bank_abi.h)
5-
$(call add-objs,fd_bank_abi fd_bank_tile,fd_disco)
5+
$(call add-objs,fd_bank_abi fd_bank_tile,fd_discoh)
66
endif
77
endif
88
endif

0 commit comments

Comments
 (0)