Feature/json rpc api improvements - #793
Open
renatomaia wants to merge 13 commits into
Open
Conversation
…ion, and default block
…puts, and reports Changes include: - Added optional from and to JSON-RPC parameters. - Added IndexRange *Range to all four repository filters. - Added index-backed >= from and <= to PostgreSQL predicates shared by COUNT(*) and list queries. - Added shared hex-bound parsing and from <= to validation returning -32602 (invalid params). - Preserved positional-parameter compatibility by appending new fields after existing parameters. - Updated the OpenRPC specification. - Added repository tests confirming range composition with total count, descending order, offset, and limit. - Added no-database tests for reversed and malformed bounds.
…ctors
Changes:
- Added optional executed *bool to ListOutputsParams.
- output_type now accepts either one selector string or a non-empty selector array.
- Empty arrays return -32602 (invalid paramters).
- Changed OutputFilter.OutputType to a selector slice and added Executed.
- PostgreSQL now uses IN for selector OR semantics.
- Extracted shared execution and selector predicates reused by GetNumberOfPendingExecutableOutputs.
- Updated OpenRPC with string-or-array schema and executed.
- Added tests for:
- Single-selector compatibility
- Selector arrays
- Empty-array rejection
- Executed tri-state decoding
- Combined selector/execution filtering
- Unchanged nil-filter behavior required by validator claim generation
Targeted tests, package compilation, OpenRPC validation, and git diff --check pass. Validator compilation remains blocked by the environment’s missing
Cartesi machine C header.
- Added flag '--executed' to `read outputs`
- '--executed' filters for executed outputs.
- '--executed=false' filters for unexecuted outputs.
- Omitting the flag leaves execution status unfiltered.
- Updated the CLI example.
- Flag '--output-type' now can be repeated multiple times.
- All selectors are forwarded in request order.
- The help example and flag description were updated.
…utputs
Methods added:
- cartesi_getExecutedOutputCount
- cartesi_getPendingExecutableOutputCount
Each method:
- Accepts an application parameter.
- Returns {"data":"0x..."}.
- Explicitly checks application existence before querying the aggregate.
- Returns -32002 (application not found) for unknown applications.
- Is registered in the dispatch table.
Also updated the OpenRPC specification with the requested descriptions and added tests distinguishing unknown applications from existing applications with zero outputs.
- 'status' now accepts either a string or string array. - Every status is validated through 'EpochStatus.Scan'. - Invalid values return -32602 (invalid params) and identify the bad value. - An explicit empty array returns -32602 with Invalid epoch status: expected at least one status. - Added coverage for scalar/list decoding, multiple-status filtering, invalid list elements, and empty arrays. - Documents 'status' as 'oneOf': a single EpochStatus or a non-empty array of EpochStatus. - Documents omission as no filter and rejects empty arrays. - Documents the non-terminal watch set. - Clarifies terminal statuses never regress, preventing settled epochs from being re-read.
- '--status' now uses a repeatable string-array flag. - Multiple values are sent as StringOrList. - Updated help text and example.
Added 'UnsignedInteger256' schema for uint256 reference it in field 'Voucher.value'.
Updated these 'EvmAdvance' uint256 fields to reference 'UnsignedInteger256':
- chain_id
- block_number
- block_timestamp
- prev_randao
Kept 'EvmAdvance.index' and other genuine uint64 indexes on 'UnsignedInteger'.
…hAdvance - Renamed handler to handleGetMatchAdvance. - Renamed params struct to GetMatchAdvanceParams across node and CLI. - Updated OpenRPC discovery and JSON-RPC tests. - Normalized the parsed parent hash before repository lookup. - Added a mixed-case parent-hash regression test.
Tests covers all structs declared in `params.go`, comparing positional decoding against equivalent named decoding.
renatomaia
force-pushed
the
feature/JsonRpcApiImprovements
branch
from
July 30, 2026 13:55
13bd7c4 to
31e82e1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSON-RPC API Improvements
Nine self-contained improvements identified as F1 to F9 as described here. The table below lists the commits, and column
IDindicates which improvement is introduced.