From 41bcd9cff50781964728cca28aea0f6d2e2f0919 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Thu, 30 Jun 2022 22:20:01 +0000 Subject: [PATCH 1/3] Bump solana --- .github/workflows/docker.yaml | 2 +- program/src/oracle/upd_aggregate.h | 1 - program/src/oracle/util/compat_stdint.h | 4 ++- scripts/solana.patch | 34 ++++++++++--------------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 7fea7bb69..59dd36ea3 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -6,7 +6,7 @@ on: branches: [ main ] env: - SOLANA_VERSION: 1.7.12 + SOLANA_VERSION: 1.10.29 DOCKER_HUB: docker.io DOCKER_USER: ${{ secrets.DOCKER_IO_USER }} IS_RELEASE: ${{ diff --git a/program/src/oracle/upd_aggregate.h b/program/src/oracle/upd_aggregate.h index ed0b8f9ee..aaa7941b0 100644 --- a/program/src/oracle/upd_aggregate.h +++ b/program/src/oracle/upd_aggregate.h @@ -5,7 +5,6 @@ #include "model/price_model.c" /* FIXME: HACK TO DEAL WITH DOCKER LINKAGE ISSUES */ #include "pd.h" -#include #ifdef __cplusplus extern "C" { diff --git a/program/src/oracle/util/compat_stdint.h b/program/src/oracle/util/compat_stdint.h index 1842cc52c..759e1bd1b 100644 --- a/program/src/oracle/util/compat_stdint.h +++ b/program/src/oracle/util/compat_stdint.h @@ -8,14 +8,16 @@ types and that can conflicts with stdint.h) Defaults to 0 or 1 depending on if __bpf__ is set. */ + #ifndef PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE -#ifndef __bpf__ +#if !defined(__bpf__) && !defined(SOL_TEST) #define PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE 0 #else #define PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE 1 #endif #endif + #if PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE==0 #include #elif PYTH_ORACLE_UTIL_COMPAT_STDINT_STYLE==1 diff --git a/scripts/solana.patch b/scripts/solana.patch index d3ca0bb5d..8d024fa5d 100644 --- a/scripts/solana.patch +++ b/scripts/solana.patch @@ -1,5 +1,5 @@ diff --git a/sdk/bpf/c/bpf.mk b/sdk/bpf/c/bpf.mk -index 4b3039db1..018e8deb4 100644 +index 541629ad49..5046be7884 100644 --- a/sdk/bpf/c/bpf.mk +++ b/sdk/bpf/c/bpf.mk @@ -14,6 +14,12 @@ TEST_PREFIX ?= test_ @@ -13,9 +13,9 @@ index 4b3039db1..018e8deb4 100644 +endif + LLVM_DIR = $(LOCAL_PATH)../dependencies/bpf-tools/llvm - LLVM_SYSTEM_INC_DIRS := $(LLVM_DIR)/lib/clang/12.0.1/include + LLVM_SYSTEM_INC_DIRS := $(LLVM_DIR)/lib/clang/13.0.0/include COMPILER_RT_DIR = $(LOCAL_PATH)../dependencies/bpf-tools/rust/lib/rustlib/bpfel-unknown-unknown/lib -@@ -31,6 +37,9 @@ SYSTEM_INC_DIRS := \ +@@ -33,6 +39,9 @@ SYSTEM_INC_DIRS := \ $(LLVM_SYSTEM_INC_DIRS) \ C_FLAGS := \ @@ -25,7 +25,14 @@ index 4b3039db1..018e8deb4 100644 -Werror \ -O2 \ -fno-builtin \ -@@ -59,6 +68,7 @@ BPF_CXX_FLAGS := \ +@@ -40,6 +49,8 @@ C_FLAGS := \ + $(addprefix -isystem,$(SYSTEM_INC_DIRS)) \ + $(addprefix -I,$(STD_INC_DIRS)) \ + $(addprefix -I,$(INC_DIRS)) \ + + ifeq ($(SOL_SBFV2),1) + C_FLAGS := \ +@@ -68,6 +79,7 @@ BPF_CXX_FLAGS := \ -march=bpfel+solana BPF_LLD_FLAGS := \ @@ -33,24 +40,11 @@ index 4b3039db1..018e8deb4 100644 -z notext \ -shared \ --Bdynamic \ -@@ -195,7 +205,7 @@ endef - define TEST_EXEC_RULE +@@ -245,6 +257,7 @@ define TEST_EXEC_RULE $1: $2 LD_LIBRARY_PATH=$(TESTFRAMEWORK_RPATH) \ -- $2$(\n) + $2$(\n) + $2 $(TEST_FLAGS)$(\n) endef - .PHONY: $(INSTALL_SH) -diff --git a/sdk/bpf/c/inc/solana_sdk.h b/sdk/bpf/c/inc/solana_sdk.h -index b5cad9833..b3b496123 100644 ---- a/sdk/bpf/c/inc/solana_sdk.h -+++ b/sdk/bpf/c/inc/solana_sdk.h -@@ -565,6 +565,7 @@ uint64_t sol_try_find_program_address( - /** - * Internal cross-program invocation function - */ -+__attribute__(( weak )) - uint64_t sol_invoke_signed_c( - const SolInstruction *instruction, - const SolAccountInfo *account_infos, + .PHONY: $(INSTALL_SH) \ No newline at end of file From aa317ec456c038db469e550fd4621ff6b8ad9366 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Thu, 30 Jun 2022 22:20:29 +0000 Subject: [PATCH 2/3] Update comment --- scripts/patch-solana.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/patch-solana.sh b/scripts/patch-solana.sh index 24cbfc761..054d36058 100755 --- a/scripts/patch-solana.sh +++ b/scripts/patch-solana.sh @@ -2,7 +2,7 @@ # # Patch BPF makefile and solana_sdk.h: # - Build with `-Wall -Wextra -Wconversion`. -# - Link with `-z defs` and mark `sol_invoke_signed_c` as weak. +# - Link with `-z defs`. # - Add TEST_FLAGS for criterion CLI. # From 54e3604b5b535c154cc8e548f314a42fd438dfc3 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Thu, 30 Jun 2022 22:36:10 +0000 Subject: [PATCH 3/3] Fix patch --- scripts/solana.patch | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/solana.patch b/scripts/solana.patch index 8d024fa5d..a34ec6142 100644 --- a/scripts/solana.patch +++ b/scripts/solana.patch @@ -1,5 +1,5 @@ diff --git a/sdk/bpf/c/bpf.mk b/sdk/bpf/c/bpf.mk -index 541629ad49..5046be7884 100644 +index 541629ad49..8c2ec94041 100644 --- a/sdk/bpf/c/bpf.mk +++ b/sdk/bpf/c/bpf.mk @@ -14,6 +14,12 @@ TEST_PREFIX ?= test_ @@ -25,14 +25,7 @@ index 541629ad49..5046be7884 100644 -Werror \ -O2 \ -fno-builtin \ -@@ -40,6 +49,8 @@ C_FLAGS := \ - $(addprefix -isystem,$(SYSTEM_INC_DIRS)) \ - $(addprefix -I,$(STD_INC_DIRS)) \ - $(addprefix -I,$(INC_DIRS)) \ - - ifeq ($(SOL_SBFV2),1) - C_FLAGS := \ -@@ -68,6 +79,7 @@ BPF_CXX_FLAGS := \ +@@ -68,6 +77,7 @@ BPF_CXX_FLAGS := \ -march=bpfel+solana BPF_LLD_FLAGS := \ @@ -40,11 +33,11 @@ index 541629ad49..5046be7884 100644 -z notext \ -shared \ --Bdynamic \ -@@ -245,6 +257,7 @@ define TEST_EXEC_RULE +@@ -245,6 +255,7 @@ define TEST_EXEC_RULE $1: $2 LD_LIBRARY_PATH=$(TESTFRAMEWORK_RPATH) \ $2$(\n) + $2 $(TEST_FLAGS)$(\n) endef - .PHONY: $(INSTALL_SH) \ No newline at end of file + .PHONY: $(INSTALL_SH)