diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 733a742bc4..f211726e2d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,18 +24,16 @@ jobs: - linux_clang_x86_64 - linux_clang_icelake - native + - native-no-deps # Attach additional params to machine types include: - test-case: linux_gcc_noarch64 machine: linux_gcc_noarch64 label: X64 - extras: "rpath handholding" deps-extras: "+dev" - targets: "all" + targets: "check" compiler: gcc compiler-version: 8.5.0 - run-unit-tests: false - run-integration-tests: false - test-case: linux_gcc_x86_64 machine: linux_gcc_x86_64 label: X64 @@ -45,7 +43,6 @@ jobs: compiler: gcc compiler-version: 8.5.0 run-unit-tests: true - run-integration-tests: false - test-case: linux_gcc_icelake machine: linux_gcc_icelake label: icelake @@ -55,7 +52,6 @@ jobs: compiler: gcc compiler-version: 12.4.0 run-unit-tests: true - run-integration-tests: false - test-case: linux_clang_x86_64 machine: linux_clang_x86_64 label: X64 @@ -65,7 +61,6 @@ jobs: compiler: clang compiler-version: 15.0.6 run-unit-tests: true - run-integration-tests: false - test-case: linux_clang_icelake machine: linux_clang_icelake label: icelake @@ -75,7 +70,6 @@ jobs: compiler: clang compiler-version: 15.0.6 run-unit-tests: true - run-integration-tests: false - test-case: native machine: native label: 512G @@ -86,6 +80,13 @@ jobs: compiler-version: 15.0.6 run-unit-tests: true run-integration-tests: true + - test-case: native-no-deps + machine: native + label: X64 + extras: no-deps + targets: check + compiler: clang + compiler-version: 15.0.6 runs-on: ${{ matrix.label }} env: MACHINE: ${{ matrix.machine }} @@ -102,9 +103,12 @@ jobs: compiler: ${{ matrix.compiler }} compiler-version: ${{ matrix.compiler-version }} extras: ${{ matrix.deps-extras || '' }} + if: ${{ !contains(matrix.extras, 'no-deps') }} - uses: ./.github/actions/hugepages + if: ${{ matrix.targets != 'check' }} - uses: ./.github/actions/cpusonline - uses: dtolnay/rust-toolchain@1.84.1 + if: ${{ contains(matrix.targets, 'fdctl') }} - name: clean targets run: | diff --git a/config/everything.mk b/config/everything.mk index 21bba19690..0ce0d1e382 100644 --- a/config/everything.mk +++ b/config/everything.mk @@ -1,7 +1,7 @@ MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-variables .SUFFIXES: -.PHONY: all info bin rust include lib unit-test integration-test fuzz-test help clean distclean asm ppp show-deps +.PHONY: all info check bin rust include lib unit-test integration-test fuzz-test help clean distclean asm ppp show-deps .PHONY: run-unit-test run-integration-test run-script-test run-fuzz-test .PHONY: seccomp-policies cov-report dist-cov-report frontend .SECONDARY: @@ -13,7 +13,10 @@ CPPFLAGS+=-DFD_BUILD_INFO=\"$(OBJDIR)/info\" CPPFLAGS+=$(EXTRA_CPPFLAGS) # Auxiliary rules that should not set up dependencies -AUX_RULES:=clean distclean help show-deps run-unit-test run-integration-test cov-report dist-cov-report seccomp-policies frontend +AUX_RULES:=clean distclean help run-unit-test run-integration-test cov-report dist-cov-report seccomp-policies frontend + +# Dry rules that should set up dependency targets, but not generate them +DRY_RULES:=check show-deps all: info bin include lib unit-test fuzz-test @@ -48,6 +51,7 @@ help: # Explicit goals are: all bin include lib unit-test integration-test help clean distclean asm ppp # "make all" is equivalent to "make bin include lib unit-test fuzz-test" # "make info" makes build info $(OBJDIR)/info for the current platform (if not already made) + # "make check" quickly checks for obvious compile errors # "make bin" makes all binaries for the current platform (except those requiring the Rust toolchain) # "make include" makes all include files for the current platform # "make lib" makes all libraries for the current platform @@ -356,6 +360,12 @@ $(OBJDIR)/obj/%.i : src/%.cxx $(OBJDIR)/info $(MKDIR) $(dir $@) && \ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E $< -o $@ +$(OBJDIR)/obj/%.check : src/%.c + @$(CC) $(CPPFLAGS) $(CFLAGS) -fsyntax-only $< + +$(OBJDIR)/obj/%.check : src/%.cxx + @$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fsyntax-only $< + $(OBJDIR)/lib/%.a : ####################################################################### # Creating library $@ from $^ @@ -402,7 +412,15 @@ $(foreach mk,$(shell $(FIND) -L src -type f -name Local.mk),$(eval $(call _inclu show-deps: @for d in $(DEPFILES); do echo $$d; done +# Define the check target. Must be after the make fragments include so that +# DEPFILES is fully populated + +check: $(DEPFILES:.d=.check) + +ifeq ($(filter $(MAKECMDGOALS),$(AUX_RULES) $(DRY_RULES)),) +# Generate dependency files include $(DEPFILES) +endif # Define the asm target. Must be after the make fragments include so that # DEPFILES is fully populated diff --git a/config/extra/with-no-deps-pre.mk b/config/extra/with-no-deps-pre.mk new file mode 100644 index 0000000000..24ecfa9962 --- /dev/null +++ b/config/extra/with-no-deps-pre.mk @@ -0,0 +1,2 @@ +# Set opt a path that does not exist +OPT:=/nonexistent diff --git a/config/extra/with-no-deps.mk b/config/extra/with-no-deps.mk new file mode 100644 index 0000000000..449e5a3621 --- /dev/null +++ b/config/extra/with-no-deps.mk @@ -0,0 +1 @@ +# See with-no-deps-pre.mk \ No newline at end of file diff --git a/src/app/fdctl/Local.mk b/src/app/fdctl/Local.mk index e3a3f7a158..04feec36d7 100644 --- a/src/app/fdctl/Local.mk +++ b/src/app/fdctl/Local.mk @@ -1,21 +1,5 @@ -ifdef FD_HAS_ALLOCA -ifdef FD_HAS_DOUBLE -ifdef FD_HAS_INT128 - -$(OBJDIR)/obj/app/fdctl/config.o: src/app/fdctl/config/default.toml - -# fdctl core -$(call add-objs,topology,fd_fdctl) -$(call add-objs,config,fd_fdctl) - -ifdef FD_HAS_HOSTED -ifdef FD_HAS_THREADS -ifdef FD_HAS_SSE - include src/app/fdctl/with-version.mk $(info Using FIREDANCER_VERSION=$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH) ($(FIREDANCER_CI_COMMIT))) - -# Always generate a version file $(shell echo "#define FDCTL_MAJOR_VERSION $(FIREDANCER_VERSION_MAJOR)" > src/app/fdctl/version2.h) $(shell echo "#define FDCTL_MINOR_VERSION $(FIREDANCER_VERSION_MINOR)" >> src/app/fdctl/version2.h) $(shell echo "#define FDCTL_PATCH_VERSION $(FIREDANCER_VERSION_PATCH)" >> src/app/fdctl/version2.h) @@ -30,6 +14,23 @@ endif $(OBJDIR)/obj/app/fdctl/version.d: src/app/fdctl/version.h +# Always generate a version file +include src/app/fdctl/version.h + +ifdef FD_HAS_ALLOCA +ifdef FD_HAS_DOUBLE +ifdef FD_HAS_INT128 + +$(OBJDIR)/obj/app/fdctl/config.o: src/app/fdctl/config/default.toml + +# fdctl core +$(call add-objs,topology,fd_fdctl) +$(call add-objs,config,fd_fdctl) + +ifdef FD_HAS_HOSTED +ifdef FD_HAS_THREADS +ifdef FD_HAS_SSE + .PHONY: fdctl cargo-validator cargo-solana cargo-ledger-tool cargo-plugin-bundle rust solana check-agave-hash # fdctl comands diff --git a/src/app/firedancer/Local.mk b/src/app/firedancer/Local.mk index 90808731da..e2dc84096b 100644 --- a/src/app/firedancer/Local.mk +++ b/src/app/firedancer/Local.mk @@ -1,18 +1,8 @@ -ifdef FD_HAS_HOSTED -ifdef FD_HAS_THREADS -ifdef FD_HAS_ALLOCA -ifdef FD_HAS_DOUBLE -ifdef FD_HAS_INT128 -ifdef FD_HAS_SSE -ifdef FD_HAS_SECP256K1 -ifdef FD_HAS_ZSTD include src/app/firedancer/version.mk -$(info Using FIREDANCER_VERSION=$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH) ($(FIREDANCER_CI_COMMIT))) - -# Always generate a version file $(shell echo "#define FIREDANCER_MAJOR_VERSION $(FIREDANCER_VERSION_MAJOR)" > src/app/firedancer/version2.h) $(shell echo "#define FIREDANCER_MINOR_VERSION $(FIREDANCER_VERSION_MINOR)" >> src/app/firedancer/version2.h) $(shell echo "#define FIREDANCER_PATCH_VERSION $(FIREDANCER_VERSION_PATCH)" >> src/app/firedancer/version2.h) +$(shell echo "#define FIREDANCER_VERSION \"$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH)\"" >> src/app/firedancer/version2.h) $(shell echo '#define FIREDANCER_COMMIT_REF_CSTR "$(FIREDANCER_CI_COMMIT)"' >> src/app/firedancer/version2.h) $(shell echo "#define FIREDANCER_COMMIT_REF_U32 0x$(shell echo $(FIREDANCER_CI_COMMIT) | cut -c -8)" >> src/app/firedancer/version2.h) @@ -22,6 +12,18 @@ src/app/firedancer/version.h: src/app/firedancer/version2.h cp -f src/app/firedancer/version2.h $@ endif +# Always generate a version file +include src/app/firedancer/version.h + +ifdef FD_HAS_HOSTED +ifdef FD_HAS_THREADS +ifdef FD_HAS_ALLOCA +ifdef FD_HAS_DOUBLE +ifdef FD_HAS_INT128 +ifdef FD_HAS_SSE +ifdef FD_HAS_SECP256K1 +ifdef FD_HAS_ZSTD + $(OBJDIR)/obj/app/firedancer/config.o: src/app/fdctl/config/default.toml $(OBJDIR)/obj/app/firedancer/config.o: src/app/firedancer/config/default.toml $(OBJDIR)/obj/app/firedancer/version.d: src/app/firedancer/version.h diff --git a/src/discof/rpcserver/Local.mk b/src/discof/rpcserver/Local.mk index 80e2f1b682..279b133a4f 100644 --- a/src/discof/rpcserver/Local.mk +++ b/src/discof/rpcserver/Local.mk @@ -1,7 +1,3 @@ -include src/app/fdctl/with-version.mk -$(info Using RPC_VERSION=$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH)) -CFLAGS += -DRPC_VERSION='"$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH)"' - ifdef FD_HAS_INT128 ifdef FD_HAS_SSE $(call add-hdrs,fd_rpc_service.h) diff --git a/src/discof/rpcserver/fd_block_to_json.c b/src/discof/rpcserver/fd_block_to_json.c index a02e0482de..cf1622feca 100644 --- a/src/discof/rpcserver/fd_block_to_json.c +++ b/src/discof/rpcserver/fd_block_to_json.c @@ -881,6 +881,8 @@ fd_account_to_json( fd_webserver_t * ws, encstr = "base64+zstd"; break; } +# else + (void)spad; # endif /* FD_HAS_ZSTD */ default: return "unsupported encoding"; diff --git a/src/discof/rpcserver/fd_rpc_service.c b/src/discof/rpcserver/fd_rpc_service.c index 797c413ac8..e2d18adc1e 100644 --- a/src/discof/rpcserver/fd_rpc_service.c +++ b/src/discof/rpcserver/fd_rpc_service.c @@ -19,6 +19,8 @@ #include #include +#include "../../app/firedancer/version.h" + #define CRLF "\r\n" #define MATCH_STRING(_text_,_text_sz_,_str_) (_text_sz_ == sizeof(_str_)-1 && memcmp(_text_, _str_, sizeof(_str_)-1) == 0) #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) { fd_funk_rec_key_t recid = fd_funk_acc_key(&acct); const void * val = read_account(ctx, &recid, &val_sz); if (val == NULL) { - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":null},\"id\":%s}" CRLF, + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":null},\"id\":%s}" CRLF, fd_rpc_history_latest_slot( ctx->global->history ), ctx->call_id); return 0; } @@ -291,7 +293,7 @@ method_getAccountInfo(struct json_values* values, fd_rpc_ctx_t * ctx) { long off = (off_ptr ? *(long *)off_ptr : FD_LONG_UNSET); long len = (len_ptr ? *(long *)len_ptr : FD_LONG_UNSET); - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":", fd_rpc_history_latest_slot( ctx->global->history ) ); const char * err = fd_account_to_json( ws, acct, enc, val, val_sz, off, len, ctx->global->spad ); if( err ) { @@ -333,12 +335,12 @@ method_getBalance(struct json_values* values, fd_rpc_ctx_t * ctx) { fd_funk_rec_key_t recid = fd_funk_acc_key(&acct); const void * val = read_account(ctx, &recid, &val_sz); if (val == NULL) { - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":0},\"id\":%s}" CRLF, + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":0},\"id\":%s}" CRLF, fd_rpc_history_latest_slot( ctx->global->history ), ctx->call_id); return 0; } fd_account_meta_t * metadata = (fd_account_meta_t *)val; - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":%lu},\"id\":%s}" CRLF, + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":%lu},\"id\":%s}" CRLF, fd_rpc_history_latest_slot( ctx->global->history ), metadata->info.lamports, ctx->call_id); } FD_SPAD_FRAME_END; return 0; @@ -545,7 +547,7 @@ method_getBlockProduction(struct json_values* values, fd_rpc_ctx_t * ctx) { } } - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"byIdentity\":{", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"byIdentity\":{", fd_rpc_history_latest_slot( glob->history ) ); int first=1; 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) { // TODO: implement this (void)data; (void)data_sz; - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":5000},\"id\":%s}" CRLF, + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":5000},\"id\":%s}" CRLF, fd_rpc_history_latest_slot( ctx->global->history ), ctx->call_id); return 0; } @@ -917,7 +919,7 @@ method_getLatestBlockhash(struct json_values* values, fd_rpc_ctx_t * ctx) { fd_webserver_t * ws = &ctx->global->ws; ulong slot = get_slot_from_commitment_level( values, ctx ); fd_replay_notif_msg_t * info = fd_rpc_history_get_block_info(ctx->global->history, slot); - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":{\"blockhash\":\"", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":{\"blockhash\":\"", info->slot_exec.slot); fd_web_reply_encode_base58(ws, &info->slot_exec.block_hash, sizeof(fd_hash_t)); 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) { return 0; } - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":[", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":[", fd_rpc_history_latest_slot( ctx->global->history )); // Iterate through account ids @@ -1260,7 +1262,7 @@ method_getSignaturesForAddress(struct json_values* values, fd_rpc_ctx_t * ctx) { static int method_getSignatureStatuses(struct json_values* values, fd_rpc_ctx_t * ctx) { fd_webserver_t * ws = &ctx->global->ws; - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":[", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":[", fd_rpc_history_latest_slot( ctx->global->history )); // Iterate through account ids @@ -1419,7 +1421,7 @@ method_getSupply(struct json_values* values, fd_rpc_ctx_t * ctx) { return 0; } fd_webserver_t * ws = &ctx->global->ws; - 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}", + 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}", slot, slot_bank->capitalization, 0UL, slot_bank->capitalization, ctx->call_id); } FD_SPAD_FRAME_END; return 0; @@ -1558,7 +1560,7 @@ method_getTransaction(struct json_values* values, fd_rpc_ctx_t * ctx) { fd_replay_notif_msg_t * info = fd_rpc_history_get_block_info( ctx->global->history, slot ); - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"blockTime\":%ld,\"slot\":%lu,", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"blockTime\":%ld,\"slot\":%lu,", fd_rpc_history_latest_slot( ctx->global->history ), (long)info->slot_exec.ts/(long)1e9, slot); 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) { (void) values; fd_webserver_t * ws = &ctx->global->ws; /* TODO Where does feature-set come from? */ - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"feature-set\":666,\"solana-core\":\"" RPC_VERSION "\"},\"id\":%s}" CRLF, + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"result\":{\"feature-set\":666,\"solana-core\":\"" FIREDANCER_VERSION "\"},\"id\":%s}" CRLF, ctx->call_id); return 0; } @@ -2229,7 +2231,7 @@ ws_method_accountSubscribe_update(fd_rpc_ctx_t * ctx, fd_replay_notif_msg_t * ms return 0; } - fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"method\":\"accountNotification\",\"params\":{\"result\":{\"context\":{\"apiVersion\":\"" RPC_VERSION "\",\"slot\":%lu},\"value\":", + fd_web_reply_sprintf(ws, "{\"jsonrpc\":\"2.0\",\"method\":\"accountNotification\",\"params\":{\"result\":{\"context\":{\"apiVersion\":\"" FIREDANCER_VERSION "\",\"slot\":%lu},\"value\":", msg->slot_exec.slot); 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 ); if( err ) {