Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
733a8f4
feat(jsonrpc): add support for JSON-RPC 2.0 batch requests
renatomaia Jul 27, 2026
e954e1a
feat(jsonrpc): impose the same response size budget of batch requests…
renatomaia Aug 14, 2026
af29738
refactor(jsonrpc): remove unused field 'data' from error responses
renatomaia Jul 28, 2026
da49cc4
feat(jsonrpc): add operation to get epoch by a virtual contiguous index
renatomaia Jul 28, 2026
d9bd698
feat(jsonrpc): add operation to get Node info like its chain ID, vers…
renatomaia Jul 28, 2026
dca7255
feat(jsonrpc): add inclusive index ranges to list epochs, inputs, out…
renatomaia Jul 28, 2026
28ecb42
feat(jsonrpc): allows to filter output by execution and multiple sele…
renatomaia Jul 28, 2026
2037500
perf(repository): add DB index to improve filter output by execution
renatomaia Aug 12, 2026
8f63de2
feat(cli): allows to filter output by execution and multiple selectors
renatomaia Jul 28, 2026
77448ea
feat(jsonrpc): add methods to get the count of executed and pending o…
renatomaia Jul 29, 2026
f294cdc
feat(jsonrpc): support listing epochs with multiple statuses
renatomaia Jul 29, 2026
c12dd7b
feat(cli): support listing epochs with multiple statuses
renatomaia Jul 29, 2026
94d954b
fix(jsonrpc): report 256-bit integer fields in OpenRPC specification
renatomaia Jul 29, 2026
4906bcd
refactor(jsonrpc): rename cartesi_getMatchAdvanced as cartesi_getMatc…
renatomaia Jul 30, 2026
31568e8
test(jsonrpc): add tests for positional decoding of parameters
renatomaia Jul 30, 2026
3a769b3
fix(repository): avoid invalid SQL when listing outputs with empty ty…
renatomaia Aug 14, 2026
9ba37ea
test(jsonrpc): add tests for some use cases of listing operations
renatomaia Aug 14, 2026
bb9906e
perf(jsonrpc): parse JSON-RPC API spec on service initialization
renatomaia Aug 14, 2026
2911c1b
docs(repository): add comment to clarify expected behavior of module API
renatomaia Aug 14, 2026
2451ced
docs(jsonrpc): add warnings and recommendations on how to use the API
renatomaia Aug 14, 2026
7531899
docs(jsonrpc): improve documentation on response size limit
renatomaia Aug 14, 2026
65f2d40
fix(jsonrpc): skip ignored fields on positional decoding of parameters
renatomaia Aug 14, 2026
ebb3d95
test(jsonrpc): add more tests on parsing parameters
renatomaia Aug 14, 2026
9bcb40d
style(cli): avoid line length violation
renatomaia Aug 14, 2026
d79b075
test(jsonrpc): add test to enforce log of method call
renatomaia Aug 14, 2026
54231ee
feat(jsonrpc): impose the same listed items limit for all requests in…
renatomaia Aug 15, 2026
ac78085
feat(jsonrpc): add a dispatch timeout to prevent reaching the write t…
renatomaia Aug 18, 2026
f8c1723
fix(jsonrpc): refuse offsets that are too large to be handled correctly
renatomaia Aug 18, 2026
96c0a14
fix(jsonrpc): avoid logging canceled context errors due to disconnect…
renatomaia Aug 18, 2026
7c6012d
feat(jsonrpc): truncate long method names to avoid flooding the log
renatomaia Aug 19, 2026
01aeb98
feat(jsonrpc): report panic errors of individual methods in a request…
renatomaia Aug 18, 2026
4e9f329
feat(jsonrpc): avoid overlogging decoding errors of DApps inputs/outputs
renatomaia Aug 18, 2026
17f1542
fix(jsonrpc): avoid response with different ID value due to decoding …
renatomaia Aug 18, 2026
726d844
docs(jsonrpc): document the potential costs of DB transversal due to …
renatomaia Aug 18, 2026
d4ea032
test(jsonrpc): add endpoint-level tests for 'cartesi_listOutputs'
renatomaia Aug 18, 2026
b79a998
perf(jsonrpc): add DB index to improve filter of executed outputs
renatomaia Aug 18, 2026
55a3eb0
docs(jsonrpc): document wort-case memory scenario for responses
renatomaia Aug 18, 2026
2cdb69b
test(jsonrpc): avoid different test package setup to interfere with o…
renatomaia Aug 18, 2026
72003b4
style(jsonrpc): avoid lint errors
renatomaia Aug 19, 2026
a89cd03
style(cli): avoid lint errors
renatomaia Aug 19, 2026
4308df9
fix(jsonrpc): report JSON contents even on incomplete/malformed respo…
renatomaia Aug 20, 2026
57f4449
fix(jsonrpc): avoid corrupting the offset maximum reported by 'rpc.di…
renatomaia Aug 20, 2026
7558af6
fix(jsonrpc): improve error messages reported to the client
renatomaia Aug 24, 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
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ linters:
- common-false-positives
- legacy
- std-error-handling
rules:
- path: internal/jsonrpc/api/.*\.go
text: avoid meaningless package names
linters:
- revive
- path: internal/jsonrpc/.*\.go
text: avoid package names that conflict with Go standard library package names
linters:
- revive
paths:
- third_party$
- builtin$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func init() {

}

func run(cmd *cobra.Command, args []string) {
func run(cmd *cobra.Command, _ []string) {
// If no subcommand is provided, show help
err := cmd.Help()
cobra.CheckErr(err)
Expand All @@ -82,7 +82,7 @@ func run(cmd *cobra.Command, args []string) {
var getCmd = &cobra.Command{
Use: "get [application] [parameter]",
Short: "Get a specific configuration parameter",
Args: cobra.ExactArgs(2), // nolint: mnd
Args: cobra.ExactArgs(2), //nolint:mnd
Run: runGet,
Long: `
Supported Environment Variables:
Expand All @@ -93,7 +93,7 @@ Supported Environment Variables:
var setCmd = &cobra.Command{
Use: "set [application] [parameter] [value]",
Short: "Set a specific configuration parameter",
Args: cobra.ExactArgs(3), // nolint: mnd
Args: cobra.ExactArgs(3), //nolint:mnd
Run: runSet,
Long: `
Supported Environment Variables:
Expand Down Expand Up @@ -157,7 +157,8 @@ func runGet(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

params, err := repo.GetExecutionParameters(ctx, app.ID)
Expand Down Expand Up @@ -194,7 +195,8 @@ func runSet(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

params, err := repo.GetExecutionParameters(ctx, app.ID)
Expand Down Expand Up @@ -230,7 +232,8 @@ func runList(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

params, err := repo.GetExecutionParameters(ctx, app.ID)
Expand All @@ -256,7 +259,8 @@ func runDump(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

params, err := repo.GetExecutionParameters(ctx, app.ID)
Expand Down Expand Up @@ -284,7 +288,8 @@ func runLoad(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

// Read JSON from stdin with size limit to prevent memory exhaustion
Expand Down
4 changes: 2 additions & 2 deletions cmd/cartesi-rollups-cli/root/app/list/list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)

package list
package list //nolint:revive // The package implements the CLI's "list" subcommand.

import (
"encoding/json"
Expand Down Expand Up @@ -36,7 +36,7 @@ func init() {
})
}

func run(cmd *cobra.Command, args []string) {
func run(cmd *cobra.Command, _ []string) {
ctx := cmd.Context()

dsn, err := config.GetDatabaseConnection()
Expand Down
9 changes: 5 additions & 4 deletions cmd/cartesi-rollups-cli/root/app/register/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func init() {
"Application template hash. (DO NOT USE IN PRODUCTION)\nThis value is retrieved from the application contract",
)

Cmd.Flags().Uint64VarP(&epochLength, "epoch-length", "e", 0, // nolint: mnd
Cmd.Flags().Uint64VarP(&epochLength, "epoch-length", "e", 0,
"Consensus Epoch length. (DO NOT USE IN PRODUCTION)\nThis value is retrieved from the consensus contract",
)

Expand Down Expand Up @@ -121,7 +121,7 @@ func init() {
})
}

func run(cmd *cobra.Command, args []string) {
func run(cmd *cobra.Command, _ []string) {
ctx := cmd.Context()

validName, err := config.ToApplicationNameFromString(name)
Expand Down Expand Up @@ -181,7 +181,8 @@ func run(cmd *cobra.Command, args []string) {
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to get epoch length from consensus: %v\n",
cli.DecorateRevert(err, iconsensus.IConsensusMetaData))
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}
}

Expand Down Expand Up @@ -266,7 +267,7 @@ func run(cmd *cobra.Command, args []string) {
if executionParametersFileParam == "-" {
filePath = os.Stdin.Name()
}
contents, err := os.ReadFile(filePath)
contents, err := os.ReadFile(filePath) //nolint:gosec // The CLI user explicitly supplies this path.
cobra.CheckErr(err)

decoder := json.NewDecoder(strings.NewReader(string(contents)))
Expand Down
4 changes: 3 additions & 1 deletion cmd/cartesi-rollups-cli/root/app/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ func run(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

if app.Enabled {
fmt.Fprintf(os.Stderr, "Error: Application %s has enabled=true. Must disable it first\n", app.Name)
repo.Close()
os.Exit(1)
}

Expand Down
10 changes: 8 additions & 2 deletions cmd/cartesi-rollups-cli/root/app/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var Cmd = &cobra.Command{
Use: "status [app-name-or-address] [new-status]",
Short: "Display application status or set the enabled flag",
Example: examples,
Args: cobra.RangeArgs(1, 2), // nolint: mnd
Args: cobra.RangeArgs(1, 2), //nolint:mnd
Run: run,
Long: `
Supported Environment Variables:
Expand Down Expand Up @@ -67,7 +67,8 @@ func run(cmd *cobra.Command, args []string) {
cobra.CheckErr(err)
if app == nil {
fmt.Fprintf(os.Stderr, "application %q not found\n", nameOrAddress)
os.Exit(1)
repo.Close()
os.Exit(1) //nolint:gocritic // The repository is closed explicitly before exiting.
}

// If no new status is provided, display the current status, operator
Expand All @@ -93,6 +94,7 @@ func run(cmd *cobra.Command, args []string) {
fmt.Printf("Accounts drive merkle root: %s\n", app.AccountsDriveMerkleRoot.Hex())
}
}
repo.Close()
os.Exit(0)
}

Expand All @@ -107,11 +109,13 @@ func run(cmd *cobra.Command, args []string) {
targetEnabled = false
default:
fmt.Fprintf(os.Stderr, "Error: Invalid status %q. Valid values are 'enabled' or 'disabled'\n", newStatus)
repo.Close()
os.Exit(1)
}

if app.Enabled == targetEnabled && (app.Status != model.ApplicationStatus_Failed || !targetEnabled) {
fmt.Printf("Application %s enabled flag is already %t\n", app.Name, app.Enabled)
repo.Close()
os.Exit(0)
}

Expand All @@ -126,10 +130,12 @@ func run(cmd *cobra.Command, args []string) {
confirmed, err := cli.ConfirmPrompt("Proceed?")
if err != nil {
fmt.Fprintf(os.Stderr, "Error reading input: %v\n", err)
repo.Close()
os.Exit(1)
}
if !confirmed {
fmt.Println("Aborted.")
repo.Close()
os.Exit(0)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cartesi-rollups-cli/root/contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func computeIConsensusV3InterfaceID() [4]byte {
if !ok {
panic(fmt.Errorf("computeIConsensusV3InterfaceID: method %q not found in IConsensus ABI", name))
}
if len(m.ID) != 4 {
if len(m.ID) != 4 { //nolint:mnd // ABI method selectors are exactly four bytes.
panic(fmt.Errorf("computeIConsensusV3InterfaceID: method %q selector is %d bytes, expected 4", name, len(m.ID)))
}
for i := range 4 {
Expand Down
6 changes: 3 additions & 3 deletions cmd/cartesi-rollups-cli/root/db/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {
})
}

func run(cmd *cobra.Command, args []string) {
func run(_ *cobra.Command, _ []string) {
dsnURL, err := config.GetDatabaseConnection()
cobra.CheckErr(err)

Expand All @@ -40,13 +40,13 @@ func run(cmd *cobra.Command, args []string) {
if err == nil {
break
}
if i == 4 { // nolint: mnd
if i == 4 { //nolint:mnd
fmt.Fprintf(os.Stderr, "Failed to connect to database. (%s)\n", dsnURL)
os.Exit(1)
}
fmt.Fprintf(os.Stderr, "Connection to database failed. Trying again... (%s)\n", dsnURL)
// wait before retrying
time.Sleep(5 * time.Second) // nolint: mnd
time.Sleep(5 * time.Second) //nolint:mnd
}
defer s.Close()

Expand Down
6 changes: 3 additions & 3 deletions cmd/cartesi-rollups-cli/root/db/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
})
}

func run(cmd *cobra.Command, args []string) {
func run(_ *cobra.Command, _ []string) {
var s *schema.Schema
var err error

Expand All @@ -47,13 +47,13 @@ func run(cmd *cobra.Command, args []string) {
if err == nil {
break
}
if i == 4 { // nolint: mnd
if i == 4 { //nolint:mnd
fmt.Fprintf(os.Stderr, "Failed to connect to database. (%s)\n", dsnURL)
os.Exit(1)
}
fmt.Fprintf(os.Stderr, "Connection to database failed. Trying again... (%s)\n", dsnURL)
// wait before retrying
time.Sleep(5 * time.Second) // nolint: mnd
time.Sleep(5 * time.Second) //nolint:mnd
}
defer s.Close()

Expand Down
Loading