Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ce9c088
add getoraclequery command and help text
Franziska-Mueller Jan 12, 2026
ccf68fc
add subcommands for query id, pending, pending+
Franziska-Mueller Jan 12, 2026
53d6418
Add new files to CMakeLists.txt
philippwerner Jan 13, 2026
4089569
implement print function
Franziska-Mueller Jan 13, 2026
dda86b1
fix printing for query and reply, add printing for querying identity
Franziska-Mueller Jan 13, 2026
226802a
Fixes based on first tests
philippwerner Jan 13, 2026
00eb1e9
add core as submodule
Franziska-Mueller Jan 15, 2026
bf8b6f3
Fix bug in receiving oracle reply
philippwerner Jan 15, 2026
bcd4ce0
add command for submodule to build instructions
Franziska-Mueller Jan 15, 2026
b3db8ca
Implement print functions for Mock interface
philippwerner Jan 16, 2026
9fab0b9
Improve output in case of no queries / invalid query ID
philippwerner Jan 16, 2026
a5e4ac2
Add command "-getoraclequery stats"
philippwerner Jan 19, 2026
051296d
Fix oracle query id output bug
philippwerner Jan 20, 2026
2f2e131
Decode oracle status, type, and status flags
philippwerner Jan 29, 2026
5b0e9f2
Decode timestamps and price oracle query/reply
philippwerner Jan 29, 2026
97baec2
Implement -getoraclequery all/all+
philippwerner Jan 30, 2026
356ed0a
Fix receiveQueryInformation() for consecutive calling
philippwerner Jan 30, 2026
62bab50
Skip irrelevant field in printing oracle metadata
philippwerner Feb 2, 2026
9554bd6
Support for additional query filter commands
philippwerner Feb 2, 2026
23b317e
Better handling of empty respondQueryIds message
philippwerner Feb 2, 2026
2cca14a
Increase limit of query ticks
philippwerner Feb 2, 2026
4591a4d
Change connection timeout for getting oracle queries by tick range
philippwerner Feb 2, 2026
884272d
Fix typos
philippwerner Feb 2, 2026
072be78
Fix github workflows (checkout submodules)
philippwerner Feb 2, 2026
fa46948
Fix gcc/clang compile issues
philippwerner Feb 2, 2026
7802edf
Rename oracle_interface_adapter.h and move part in cpp file
philippwerner Feb 2, 2026
4bb9fa7
Fix build error
philippwerner Feb 2, 2026
a0ae923
Use flexible receive buffer size in -getoraclequery
philippwerner Feb 6, 2026
ebd55d0
Implement -queryoracle
philippwerner Feb 6, 2026
2939580
Merge branch 'main' into feature/2026-01-07-oracle-queries
philippwerner Feb 6, 2026
3f7815f
Add command -getoraclequery revenue
philippwerner Feb 7, 2026
6d23b70
Improve output of -queryoracle
philippwerner Feb 7, 2026
fe7871e
Get oracle IDs: print if tick is out of available range
philippwerner Feb 7, 2026
767a31e
Reduce default tx scheduling tick offset to 8
philippwerner Feb 7, 2026
cb72021
Improve some help/error output
philippwerner Feb 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Set reusable strings
id: strings
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Configure CMake
run: >
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/core"]
path = submodules/core
url = git@github.com:qubic/core.git
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ SET(FILES ${CMAKE_SOURCE_DIR}/asset_utils.cpp
${CMAKE_SOURCE_DIR}/msvault.cpp
${CMAKE_SOURCE_DIR}/node_utils.cpp
${CMAKE_SOURCE_DIR}/nostromo.cpp
${CMAKE_SOURCE_DIR}/oracle_utils.cpp
${CMAKE_SOURCE_DIR}/proposal.cpp
${CMAKE_SOURCE_DIR}/qbond.cpp
${CMAKE_SOURCE_DIR}/qearn.cpp
${CMAKE_SOURCE_DIR}/qpi_adapter.cpp
${CMAKE_SOURCE_DIR}/qswap.cpp
${CMAKE_SOURCE_DIR}/quottery.cpp
${CMAKE_SOURCE_DIR}/qutil.cpp
Expand All @@ -38,6 +40,8 @@ SET(HEADER_FILES
msvault.h
node_utils.h
nostromo.h
qpi_adapter.h
oracle_utils.h
prompt.h
proposal.h
qbond.h
Expand All @@ -60,8 +64,16 @@ SET(HEADER_FILES
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

ADD_EXECUTABLE(qubic-cli main.cpp ${FILES} ${HEADER_FILES})
set_property(TARGET qubic-cli PROPERTY COMPILE_WARNING_AS_ERROR ON)
target_include_directories(qubic-cli PUBLIC ${CMAKE_SOURCE_DIR}/submodules)
target_include_directories(qubic-cli PUBLIC ${CMAKE_SOURCE_DIR}/submodules/core)
target_include_directories(qubic-cli PUBLIC ${CMAKE_SOURCE_DIR}/submodules/core/src)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(${PROJECT_NAME} PRIVATE -mrdrnd -mavx2)
endif()

ADD_LIBRARY(fourq-qubic SHARED fourq_qubic.cpp)
set_property(TARGET fourq-qubic PROPERTY SOVERSION 1)
target_compile_options(fourq-qubic PRIVATE -DBUILD_4Q_LIB)
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ Commands:
-getexecutionfeemultiplier
Get the current multiplier for the conversion of raw execution time to contract execution fees, valid seed and node ip/port are required.

[ORACLE COMMANDS]
-getoraclequery <...>
Get information about oracle queries. Skip arguments to get detailed documentation.
-queryoracle [INTERFACE] [QUERY_STRING] [TIMEOUT_IN_SECONDS]
Send user oracle query. Skip arguments to get detailed documentation.

[SMART CONTRACT COMMANDS]
-callcontractfunction <CONTRACT_INDEX> <CONTRACT_FUNCTION> <INPUT_FORMAT_STRING> <OUTPUT_FORMAT_STRING>
Call a contract function of contract index and print the output. Valid node ip/port are required.
Expand Down Expand Up @@ -452,6 +458,11 @@ enabled.

### BUILD

Run the following command to get `qubic/core` as a submodule:
```
git submodule update --init --recursive
```

On Linux or MacOS, make sure `cmake` and `make` commands are installed and then run:
```
mkdir build;
Expand Down
34 changes: 34 additions & 0 deletions argparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ void print_help()
printf("\t-getexecutionfeemultiplier\n");
printf("\t\tGet the current multiplier for the conversion of raw execution time to contract execution fees, valid seed and node ip/port are required.\t\n");

printf("\n[ORACLE COMMANDS]\n");
printf("\t-getoraclequery <...>\n");
printf("\t\tGet information about oracle queries. Skip arguments to get detailed documentation.\n");
printf("\t-queryoracle [INTERFACE] [QUERY_STRING] [TIMEOUT_IN_SECONDS]\n");
printf("\t\tSend user oracle query. Skip arguments to get detailed documentation.\n");

printf("\n[SMART CONTRACT COMMANDS]\n");
printf("\t-callcontractfunction <CONTRACT_INDEX> <CONTRACT_FUNCTION> <INPUT_FORMAT_STRING> <OUTPUT_FORMAT_STRING>\n");
Expand Down Expand Up @@ -1163,6 +1168,35 @@ void parseArgument(int argc, char** argv)
break;
}

/***********************
*** ORACLE COMMANDS ***
***********************/

if (strcmp(argv[i], "-getoraclequery") == 0)
{
g_cmd = GET_ORACLE_QUERY;
if (i + 1 < argc)
g_paramString1 = argv[i + 1];
if (i + 2 < argc)
g_paramString2 = argv[i + 2];
i += 3;
CHECK_OVER_PARAMETERS
break;
}
if (strcmp(argv[i], "-queryoracle") == 0)
{
g_cmd = SEND_ORACLE_QUERY_TX;
if (i + 1 < argc)
g_paramString1 = argv[i + 1];
if (i + 2 < argc)
g_paramString2 = argv[i + 2];
if (i + 3 < argc)
g_paramString3 = argv[i + 3];
i += 4;
CHECK_OVER_PARAMETERS
break;
}

/***********************
***** QX COMMANDS *****
***********************/
Expand Down
6 changes: 3 additions & 3 deletions connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "qutil.h"
#include "qbond.h"

#define DEFAULT_TIMEOUT_MSEC 1000

#ifdef _MSC_VER

Expand Down Expand Up @@ -113,7 +112,7 @@ static int connect(const char* nodeIp, int nodePort)

#endif

QubicConnection::QubicConnection(const char* nodeIp, int nodePort)
QubicConnection::QubicConnection(const char* nodeIp, int nodePort, unsigned long timeoutMillisec)
{
memset(mNodeIp, 0, 32);
memcpy(mNodeIp, nodeIp, strlen(nodeIp));
Expand All @@ -136,7 +135,8 @@ QubicConnection::QubicConnection(const char* nodeIp, int nodePort)
*((RequestComputors*)data) = receivePacketWithHeaderAs<RequestComputors>();
}
catch(std::logic_error) {}
setTimeout(mSocket, SO_RCVTIMEO, DEFAULT_TIMEOUT_MSEC);
setTimeout(mSocket, SO_RCVTIMEO, timeoutMillisec);
setTimeout(mSocket, SO_SNDTIMEO, timeoutMillisec);
}

void QubicConnection::getHandshakeData(std::vector<uint8_t>& buffer)
Expand Down
14 changes: 11 additions & 3 deletions connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
#include <memory>
#include <stdexcept>

#define DEFAULT_TIMEOUT_MSEC 1000

// Not thread safe
class QubicConnection
{
public:
QubicConnection(const char* nodeIp, int nodePort);
QubicConnection(const char* nodeIp, int nodePort, unsigned long timeoutMillisec = DEFAULT_TIMEOUT_MSEC);
~QubicConnection();

// Establish connection to mNodePort on node mNodeIp.
Expand Down Expand Up @@ -52,13 +54,19 @@ class QubicConnection

typedef std::shared_ptr<QubicConnection> QCPtr;

static QCPtr make_qc(const char* nodeIp, int nodePort)
static QCPtr make_qc(const char* nodeIp, int nodePort, unsigned long timeoutMsec = DEFAULT_TIMEOUT_MSEC)
{
return std::make_shared<QubicConnection>(nodeIp, nodePort);
return std::make_shared<QubicConnection>(nodeIp, nodePort, timeoutMsec);
}

class EndResponseReceived : public std::runtime_error
{
public:
explicit EndResponseReceived(const char* message = "Received end response message") : std::runtime_error(message) {}
};

class ConnectionTimeout : public std::runtime_error
{
public:
explicit ConnectionTimeout(const char* message = "Connection timeout") : std::runtime_error(message) {}
};
4 changes: 1 addition & 3 deletions defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <chrono>
#include <thread>

#define DEFAULT_SCHEDULED_TICK_OFFSET 20
#define DEFAULT_SCHEDULED_TICK_OFFSET 8
#define DEFAULT_NODE_PORT 21841
#define DEFAULT_NODE_IP "127.0.0.1"
#define NUMBER_OF_TRANSACTIONS_PER_TICK 1024
Expand Down Expand Up @@ -61,6 +61,4 @@
#define QX_CONTRACT_INDEX 1
#define QX_FEE_FUNCTION_INDEX 1

constexpr unsigned long long CONTRACT_ACTION_TRACKER_SIZE = 16 * 1024 * 1024;

#define Q_SLEEP(X) std::this_thread::sleep_for (std::chrono::milliseconds(X));
1 change: 1 addition & 0 deletions global.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const char* g_proposalString = "";
const char* g_voteValueString = "";
const char* g_paramString1 = "";
const char* g_paramString2 = "";
const char* g_paramString3 = "";
const char* g_invokeContractProcedureInputFormat = "";
const char* g_callContractFunctionInputFormat = "";
const char* g_callContractFunctionOutputFormat = "";
Expand Down
10 changes: 10 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "key_utils.h"
#include "sanity_check.h"
#include "sc_utils.h"
#include "oracle_utils.h"
#include "quottery.h"
#include "qutil.h"
#include "qx.h"
Expand Down Expand Up @@ -390,6 +391,15 @@ int run(int argc, char* argv[])
sanityCheckSeed(g_seed);
getExecutionFeeMultiplier(g_nodeIp, g_nodePort, g_seed);
break;
case GET_ORACLE_QUERY:
sanityCheckNode(g_nodeIp, g_nodePort);
processGetOracleQuery(g_nodeIp, g_nodePort, g_paramString1, g_paramString2);
break;
case SEND_ORACLE_QUERY_TX:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
makeOracleUserQueryTransaction(g_nodeIp, g_nodePort, g_seed, g_paramString1, g_paramString2, g_paramString3, g_offsetScheduledTick);
break;
case QUTIL_SEND_TO_MANY_V1:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
Expand Down
Loading