Skip to content

Commit 6c47a55

Browse files
committed
Clean up RPC_VERSION hack
1 parent 5892c36 commit 6c47a55

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ jobs:
105105
extras: ${{ matrix.deps-extras || '' }}
106106
if: ${{ !contains(matrix.extras, 'no-deps') }}
107107
- uses: ./.github/actions/hugepages
108+
if: ${{ matrix.targets != 'check' }}
108109
- uses: ./.github/actions/cpusonline
109110
- uses: dtolnay/[email protected]
111+
if: ${{ contains(matrix.targets, 'fdctl') }}
110112

111113
- name: clean targets
112114
run: |

src/app/firedancer/Local.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ include src/app/firedancer/version.mk
22
$(shell echo "#define FIREDANCER_MAJOR_VERSION $(FIREDANCER_VERSION_MAJOR)" > src/app/firedancer/version2.h)
33
$(shell echo "#define FIREDANCER_MINOR_VERSION $(FIREDANCER_VERSION_MINOR)" >> src/app/firedancer/version2.h)
44
$(shell echo "#define FIREDANCER_PATCH_VERSION $(FIREDANCER_VERSION_PATCH)" >> src/app/firedancer/version2.h)
5+
$(shell echo "#define FIREDANCER_VERSION \"$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH)\"" >> src/app/firedancer/version2.h)
56
$(shell echo '#define FIREDANCER_COMMIT_REF_CSTR "$(FIREDANCER_CI_COMMIT)"' >> src/app/firedancer/version2.h)
67
$(shell echo "#define FIREDANCER_COMMIT_REF_U32 0x$(shell echo $(FIREDANCER_CI_COMMIT) | cut -c -8)" >> src/app/firedancer/version2.h)
78

src/discof/rpcserver/Local.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
include src/app/fdctl/with-version.mk
2-
$(info Using RPC_VERSION=$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH))
3-
CFLAGS += -DRPC_VERSION='"$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH)"'
4-
51
ifdef FD_HAS_INT128
62
ifdef FD_HAS_SSE
73
$(call add-hdrs,fd_rpc_service.h)

src/discof/rpcserver/fd_rpc_service.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <netinet/in.h>
2020
#include <stdarg.h>
2121

22+
#include "../../app/firedancer/version.h"
23+
2224
#define CRLF "\r\n"
2325
#define MATCH_STRING(_text_,_text_sz_,_str_) (_text_sz_ == sizeof(_str_)-1 && memcmp(_text_, _str_, sizeof(_str_)-1) == 0)
2426
#define EMIT_SIMPLE(_str_) fd_web_reply_append(ws, _str_, sizeof(_str_)-1)
@@ -265,7 +267,7 @@ method_getAccountInfo(struct json_values* values, fd_rpc_ctx_t * ctx) {
265267
fd_funk_rec_key_t recid = fd_funk_acc_key(&acct);
266268
const void * val = read_account(ctx, &recid, &val_sz);
267269
if (val == NULL) {
268-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":null},\"id\":%s}" CRLF,
270+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":null},\"id\":%s}" CRLF,
269271
fd_rpc_history_latest_slot( ctx->global->history ), ctx->call_id);
270272
return 0;
271273
}
@@ -291,7 +293,7 @@ method_getAccountInfo(struct json_values* values, fd_rpc_ctx_t * ctx) {
291293
long off = (off_ptr ? *(long *)off_ptr : FD_LONG_UNSET);
292294
long len = (len_ptr ? *(long *)len_ptr : FD_LONG_UNSET);
293295

294-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":",
296+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":",
295297
fd_rpc_history_latest_slot( ctx->global->history ) );
296298
const char * err = fd_account_to_json( ws, acct, enc, val, val_sz, off, len, ctx->global->spad );
297299
if( err ) {
@@ -333,12 +335,12 @@ method_getBalance(struct json_values* values, fd_rpc_ctx_t * ctx) {
333335
fd_funk_rec_key_t recid = fd_funk_acc_key(&acct);
334336
const void * val = read_account(ctx, &recid, &val_sz);
335337
if (val == NULL) {
336-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":0},\"id\":%s}" CRLF,
338+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":0},\"id\":%s}" CRLF,
337339
fd_rpc_history_latest_slot( ctx->global->history ), ctx->call_id);
338340
return 0;
339341
}
340342
fd_account_meta_t * metadata = (fd_account_meta_t *)val;
341-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":%lu},\"id\":%s}" CRLF,
343+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":%lu},\"id\":%s}" CRLF,
342344
fd_rpc_history_latest_slot( ctx->global->history ), metadata->info.lamports, ctx->call_id);
343345
} FD_SPAD_FRAME_END;
344346
return 0;
@@ -545,7 +547,7 @@ method_getBlockProduction(struct json_values* values, fd_rpc_ctx_t * ctx) {
545547
}
546548
}
547549

548-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"byIdentity\":{",
550+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"byIdentity\":{",
549551
fd_rpc_history_latest_slot( glob->history ) );
550552
int first=1;
551553
for ( product_rb_node_t* nd = product_rb_minimum(pool, root); nd; nd = product_rb_successor(pool, nd) ) {
@@ -784,7 +786,7 @@ method_getFeeForMessage(struct json_values* values, fd_rpc_ctx_t * ctx) {
784786
// TODO: implement this
785787
(void)data;
786788
(void)data_sz;
787-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":5000},\"id\":%s}" CRLF,
789+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":5000},\"id\":%s}" CRLF,
788790
fd_rpc_history_latest_slot( ctx->global->history ), ctx->call_id);
789791
return 0;
790792
}
@@ -917,7 +919,7 @@ method_getLatestBlockhash(struct json_values* values, fd_rpc_ctx_t * ctx) {
917919
fd_webserver_t * ws = &ctx->global->ws;
918920
ulong slot = get_slot_from_commitment_level( values, ctx );
919921
fd_replay_notif_msg_t * info = fd_rpc_history_get_block_info(ctx->global->history, slot);
920-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"blockhash\":\"",
922+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"blockhash\":\"",
921923
info->slot_exec.slot);
922924
fd_web_reply_encode_base58(ws, &info->slot_exec.block_hash, sizeof(fd_hash_t));
923925
fd_web_reply_sprintf(ws, "\",\"lastValidBlockHeight\":%lu}},\"id\":%s}" CRLF,
@@ -1089,7 +1091,7 @@ method_getMultipleAccounts(struct json_values* values, fd_rpc_ctx_t * ctx) {
10891091
return 0;
10901092
}
10911093

1092-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":[",
1094+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":[",
10931095
fd_rpc_history_latest_slot( ctx->global->history ));
10941096

10951097
// Iterate through account ids
@@ -1260,7 +1262,7 @@ method_getSignaturesForAddress(struct json_values* values, fd_rpc_ctx_t * ctx) {
12601262
static int
12611263
method_getSignatureStatuses(struct json_values* values, fd_rpc_ctx_t * ctx) {
12621264
fd_webserver_t * ws = &ctx->global->ws;
1263-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":[",
1265+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":[",
12641266
fd_rpc_history_latest_slot( ctx->global->history ));
12651267

12661268
// Iterate through account ids
@@ -1419,7 +1421,7 @@ method_getSupply(struct json_values* values, fd_rpc_ctx_t * ctx) {
14191421
return 0;
14201422
}
14211423
fd_webserver_t * ws = &ctx->global->ws;
1422-
fd_web_reply_sprintf( ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"circulating\":%lu,\"nonCirculating\":%lu,\"nonCirculatingAccounts\":[],\"total\":%lu}},\"id\":%s}",
1424+
fd_web_reply_sprintf( ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"circulating\":%lu,\"nonCirculating\":%lu,\"nonCirculatingAccounts\":[],\"total\":%lu}},\"id\":%s}",
14231425
slot, slot_bank->capitalization, 0UL, slot_bank->capitalization, ctx->call_id);
14241426
} FD_SPAD_FRAME_END;
14251427
return 0;
@@ -1558,7 +1560,7 @@ method_getTransaction(struct json_values* values, fd_rpc_ctx_t * ctx) {
15581560

15591561
fd_replay_notif_msg_t * info = fd_rpc_history_get_block_info( ctx->global->history, slot );
15601562

1561-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"blockTime\":%ld,\"slot\":%lu,",
1563+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"blockTime\":%ld,\"slot\":%lu,",
15621564
fd_rpc_history_latest_slot( ctx->global->history ), (long)info->slot_exec.ts/(long)1e9, slot);
15631565

15641566
const char * err = fd_txn_to_json( ws, (fd_txn_t *)txn_out, txn_data_raw, pay_sz, enc, 0, FD_BLOCK_DETAIL_FULL, ctx->global->spad );
@@ -1600,7 +1602,7 @@ method_getVersion(struct json_values* values, fd_rpc_ctx_t * ctx) {
16001602
(void) values;
16011603
fd_webserver_t * ws = &ctx->global->ws;
16021604
/* TODO Where does feature-set come from? */
1603-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"feature-set\":666,\"solana-core\":\"" RPC_VERSION "\"},\"id\":%s}" CRLF,
1605+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"feature-set\":666,\"solana-core\":\"" FIREDANCER_VERSION "\"},\"id\":%s}" CRLF,
16041606
ctx->call_id);
16051607
return 0;
16061608
}
@@ -2229,7 +2231,7 @@ ws_method_accountSubscribe_update(fd_rpc_ctx_t * ctx, fd_replay_notif_msg_t * ms
22292231
return 0;
22302232
}
22312233

2232-
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"method\":\"accountNotification\",\"params\":{\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":",
2234+
fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"method\":\"accountNotification\",\"params\":{\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":",
22332235
msg->slot_exec.slot);
22342236
const char * err = fd_account_to_json( ws, sub->acct_subscribe.acct, sub->acct_subscribe.enc, val, val_sz, sub->acct_subscribe.off, sub->acct_subscribe.len, ctx->global->spad );
22352237
if( err ) {

0 commit comments

Comments
 (0)