-
Notifications
You must be signed in to change notification settings - Fork 152
Description
Request info via qubic-cli
A new command needs to be added to qubic-cli for requesting and displaying information about oracle queries. I think it would be good to make it similar to -queryassets (one command with several subcommands).
qubic-cli [...] -getoraclequery [QUERY_ID]-> printing the oracle query, metadata, and reply if availablequbic-cli [...] -getoraclequery pending-> print the query IDs or all pending queriesqubic-cli [...] -getoraclequery pending+-> printing the oracle query, metadata, and reply if available for each query ID received bypendingqubic-cli [...] -getoraclequery all [TICK]-> print the query IDs or all queries started in the given tickqubic-cli [...] -getoraclequery all+ [TICK]-> printing the oracle query, metadata, and reply if available for each query ID received byallqubic-cli [...] -getoraclequery user [TICK]-> print the query IDs or all user queries started in the given tickqubic-cli [...] -getoraclequery user+ [TICK]-> printing the oracle query, metadata, and reply if available for each query ID received byuserqubic-cli [...] -getoraclequery contract [TICK]-> print the query IDs or all contract one-time queries started in the given tickqubic-cli [...] -getoraclequery contract+ [TICK]-> printing the oracle query, metadata, and reply if available for each query ID received bycontractqubic-cli [...] -getoraclequery subscription [TICK]-> print the query IDs or all contract subscription queries started in the given tickqubic-cli [...] -getoraclequery subscription+ [TICK]-> printing the oracle query, metadata, and reply if available for each query ID received bysubscription
We will later add a similar command with subcommands for requesting and printing subscription metadata.
The communication protocol is defined in network_messages/oracles.h and the core side is implemented in oracle_core/net_msg_impl.h.
Start oracle query via qubic-cli
We should add a command for initiating a user query to a oracle by sending OracleUserQueryTransaction, such as:
qubic-cli [...] -queryoracle [INTERFACE] [QUERY_STRING] [TIMEOUT_IN_SECONDS]
- [INTERFACE] is an index or string name for one of the oracle interfaces in oracle_interfaces, such as "Price", "Mock", or "IntResult".
- [QUERY_STRING] interface-specific string, for example, key-value pairs of the values required for
Price::OracleQuery. On parsing error, empty string, etc., a interface-specific help on the QUERY_STRING should be shown. - [TIMEOUT_IN_SECONDS]: optional timeout, by default use a reasonable value such as 60 seconds.
Recommendations
RespondOracleDatais a variable-size response message, so receiving the data must must support that (similar to receiving transactions)- Oracle interfaces (Price etc) need to be supported in order to:
- print oracle queries and oracle replies
- parse oracle query parameters that need to be passed when a user oracle query is started
- compute the fees for an oracle query
- IMO, in order to reduce copy and paste of code we should add the core as a git submodule and include interface files from there directly. Same applies to network message definitions, at least in the long term.
- Building on the interface definitions from the core, we should implement parsing and printing in a generalized way, for example with a common template class that takes the oracle interface struct (for example Price) as a template parameter. Whenever an oracle interface is added a template specialization needs to implemented including functions for printing and parsing query and printing reply. And a function describing the [QUERY_STRING].
Priorities
The commands -getoraclequery [QUERY_ID], -getoraclequery pending, -getoraclequery pending+ are required first.
-queryoracle [INTERFACE] [QUERY_STRING] [TIMEOUT_IN_SECONDS] is lowest prio, because for early testing oracle query transactions can be also created with sendcustomtransaction.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status