Skip to content

feat(precompiles/json): remove old API#1630

Merged
Pitasi merged 3 commits intomainfrom
remove-old-json-precompile
Jul 22, 2025
Merged

feat(precompiles/json): remove old API#1630
Pitasi merged 3 commits intomainfrom
remove-old-json-precompile

Conversation

@Pitasi
Copy link
Contributor

@Pitasi Pitasi commented Jul 21, 2025

This PR:

  • cleans up the json precompile, only keep the new build and pair functions
  • updates PluginGmpHandler to only use the new api
  • removes outdated tests

depends on #1609

@github-actions github-actions bot added the test label Jul 21, 2025
@Pitasi Pitasi force-pushed the rewrite-json-precompile branch from a7a8639 to 52ba314 Compare July 21, 2025 13:12
@Pitasi Pitasi force-pushed the remove-old-json-precompile branch from 14a5af3 to 166237c Compare July 21, 2025 13:19
@vercel
Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
warden-help-center ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 0:56am

@Pitasi Pitasi force-pushed the rewrite-json-precompile branch 3 times, most recently from f88a273 to 89a7037 Compare July 22, 2025 08:28
@Pitasi Pitasi force-pushed the remove-old-json-precompile branch 2 times, most recently from 27db637 to 786412b Compare July 22, 2025 09:11
@Pitasi Pitasi force-pushed the rewrite-json-precompile branch 3 times, most recently from f818d7e to 7c39d3c Compare July 22, 2025 12:26
Base automatically changed from rewrite-json-precompile to main July 22, 2025 12:39
@Pitasi Pitasi force-pushed the remove-old-json-precompile branch from 786412b to e7107a0 Compare July 22, 2025 12:43
@Pitasi Pitasi marked this pull request as ready for review July 22, 2025 12:43
@Pitasi Pitasi requested a review from a team as a code owner July 22, 2025 12:43
@github-actions
Copy link

Hey @Pitasi and thank you for opening this pull request! 👋🏼

It looks like you forgot to add a changelog entry for your changes. Make sure to add a changelog entry in the 'CHANGELOG.md' file.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

📝 Walkthrough

Walkthrough

This change removes nearly all granular JSON manipulation methods and related structs from the IJson precompile interface, its Go bindings, ABI, and precompile implementation, leaving only the Build and Parse methods. All corresponding tests and utility files for the removed methods are deleted, and related contract usage is refactored accordingly.

Changes

Files / Groups Change Summary
precompiles/json/IJson.go, IJson.sol, abi.json Removed all JSON get/set/read/remove methods and related structs; only Build and Parse methods remain in ABI and interface.
precompiles/json/query.go, json.go Deleted all granular JSON manipulation methods from the precompile implementation; only Build and Parse retained.
precompiles/json/conversions.go, json_read.go, validation.go Deleted utility functions for decimal conversion, JSON parsing, and decimal validation.
precompiles/json/json_test.go Deleted unit tests for decimal conversion utilities.
tests/cases/json_precompile.go, json_precompile_user.go Removed all end-to-end and user contract tests for JSON precompile functionality.
solidity/plugin-gmp-handler/src/PluginGmpHandler.sol Refactored plugin input decoding to use new minimal JSON interface; minor struct and signature changes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant IJsonPrecompile

    Client->>IJsonPrecompile: Build(ops, data)
    IJsonPrecompile-->>Client: bytes (JSON object)

    Client->>IJsonPrecompile: Parse(jsonBytes, schema)
    IJsonPrecompile-->>Client: bytes (ABI-encoded data)
Loading

Estimated code review effort

4 (~90 minutes)

Possibly related PRs

Suggested labels

protocol, protobuf, wardenjs

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
precompiles/json/IJson.sol (1)

10-14: Remove the unused ReadKeyValue struct.

This struct appears to be a remnant of the old API and is no longer used in the simplified interface.

-struct ReadKeyValue {
-    string key;
-    string valueType;
-    int64 decimals;
-}
-
🧹 Nitpick comments (1)
precompiles/json/query.go (1)

21-22: Consider using custom error types instead of fmt.Errorf.

Based on codebase conventions, custom error types are preferred over fmt.Errorf for better error handling and code clarity.

Example custom error types:

type WrongArgsNumber struct {
    Expected int
    Got      int
}

func (e WrongArgsNumber) Error() string {
    return fmt.Sprintf("wrong args number, expected %d, got %d", e.Expected, e.Got)
}

type WrongArgType struct {
    Position int
    Expected string
    Got      string
}

func (e WrongArgType) Error() string {
    return fmt.Sprintf("wrong arg #%d, expected %s, got %s", e.Position, e.Expected, e.Got)
}

Also applies to: 26-27, 31-32, 35-35, 41-41, 53-54, 58-59, 63-64, 69-69

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa70f93 and e7107a0.

⛔ Files ignored due to path filters (7)
  • tests/testdata/contracts/json-user/IJson.abi is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/IJson.bin is excluded by !**/*.bin, !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.abi is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.bin is excluded by !**/*.bin, !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.go is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.sol is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/remappings.txt is excluded by !tests/testdata/**
📒 Files selected for processing (12)
  • precompiles/json/IJson.go (3 hunks)
  • precompiles/json/IJson.sol (1 hunks)
  • precompiles/json/abi.json (1 hunks)
  • precompiles/json/conversions.go (0 hunks)
  • precompiles/json/json.go (1 hunks)
  • precompiles/json/json_read.go (0 hunks)
  • precompiles/json/json_test.go (0 hunks)
  • precompiles/json/query.go (1 hunks)
  • precompiles/json/validation.go (0 hunks)
  • solidity/plugin-gmp-handler/src/PluginGmpHandler.sol (5 hunks)
  • tests/cases/json_precompile.go (0 hunks)
  • tests/cases/json_precompile_user.go (0 hunks)
🧠 Learnings (7)
📓 Common learnings
Learnt from: backsapc
PR: warden-protocol/wardenprotocol#810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The `MarkProcessed` method has been removed from `keychain-sdk/internal/tracker/status_tracker.go` in the Go codebase, as it is no longer needed.
solidity/plugin-gmp-handler/src/PluginGmpHandler.sol (2)

Learnt from: mn13
PR: #1248
File: precompiles/async/IAsync.sol:67-73
Timestamp: 2025-02-18T11:53:28.386Z
Learning: The IAsync.sol file is an interface definition and should not include implementation details or validation logic. Interface files should only contain function signatures and event definitions.

Learnt from: mn13
PR: #1178
File: solidity/orders/src/OrderFactory.sol:78-91
Timestamp: 2025-01-21T15:35:49.044Z
Learning: In the Warden Protocol, view functions like computeOrderAddress should return values without reverting, even for unsupported cases. This maintains better composability and allows callers to handle edge cases as needed.

precompiles/json/json.go (2)

Learnt from: backsapc
PR: #975
File: precompiles/slinky/slinky.go:129-136
Timestamp: 2024-11-02T08:51:46.547Z
Learning: In the IsTransaction method, avoid returning false for unknown methods, as it suggests the method is a query. Instead, handle unknown methods by returning an error to indicate the method is unrecognized.

Learnt from: mn13
PR: #1196
File: prophet/handlers/pricepred/pricepred.go:175-236
Timestamp: 2025-01-30T08:02:40.983Z
Learning: In the Warden Protocol codebase, prefer using map-based function lookups over large switch-case blocks for metric type handling. Example implementation:

metricMap := map[MetricName]func(BacktestingMetrics) float64{
    MetricType: func(m BacktestingMetrics) float64 { return m.Value },
    // ...
}
precompiles/json/query.go (2)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

Learnt from: Pitasi
PR: #889
File: precompiles/act/query.go:170-171
Timestamp: 2024-10-16T15:30:41.746Z
Learning: In Go code within precompile methods (e.g., in precompiles/act/query.go), prefer defining and using a custom error type (like WrongArgsNumber) instead of using fmt.Errorf directly for error messages. This enhances error handling and code clarity.

precompiles/json/abi.json (1)

Learnt from: Svetomech
PR: #1042
File: precompiles/warden/abi.json:1633-1637
Timestamp: 2024-11-14T15:15:53.718Z
Learning: In the precompiles/warden/abi.json file, the broadcastType parameter in the newSignRequest method is intentionally defined as enum BroadcastType (uint8), even though it's defined as int32 in other locations.

precompiles/json/IJson.sol (1)

Learnt from: mn13
PR: #1248
File: precompiles/async/IAsync.sol:67-73
Timestamp: 2025-02-18T11:53:28.386Z
Learning: The IAsync.sol file is an interface definition and should not include implementation details or validation logic. Interface files should only contain function signatures and event definitions.

precompiles/json/IJson.go (1)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

💤 Files with no reviewable changes (6)
  • precompiles/json/validation.go
  • tests/cases/json_precompile_user.go
  • precompiles/json/conversions.go
  • tests/cases/json_precompile.go
  • precompiles/json/json_test.go
  • precompiles/json/json_read.go
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: backsapc
PR: warden-protocol/wardenprotocol#810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The `MarkProcessed` method has been removed from `keychain-sdk/internal/tracker/status_tracker.go` in the Go codebase, as it is no longer needed.
solidity/plugin-gmp-handler/src/PluginGmpHandler.sol (2)

Learnt from: mn13
PR: #1248
File: precompiles/async/IAsync.sol:67-73
Timestamp: 2025-02-18T11:53:28.386Z
Learning: The IAsync.sol file is an interface definition and should not include implementation details or validation logic. Interface files should only contain function signatures and event definitions.

Learnt from: mn13
PR: #1178
File: solidity/orders/src/OrderFactory.sol:78-91
Timestamp: 2025-01-21T15:35:49.044Z
Learning: In the Warden Protocol, view functions like computeOrderAddress should return values without reverting, even for unsupported cases. This maintains better composability and allows callers to handle edge cases as needed.

precompiles/json/json.go (2)

Learnt from: backsapc
PR: #975
File: precompiles/slinky/slinky.go:129-136
Timestamp: 2024-11-02T08:51:46.547Z
Learning: In the IsTransaction method, avoid returning false for unknown methods, as it suggests the method is a query. Instead, handle unknown methods by returning an error to indicate the method is unrecognized.

Learnt from: mn13
PR: #1196
File: prophet/handlers/pricepred/pricepred.go:175-236
Timestamp: 2025-01-30T08:02:40.983Z
Learning: In the Warden Protocol codebase, prefer using map-based function lookups over large switch-case blocks for metric type handling. Example implementation:

metricMap := map[MetricName]func(BacktestingMetrics) float64{
    MetricType: func(m BacktestingMetrics) float64 { return m.Value },
    // ...
}
precompiles/json/query.go (2)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

Learnt from: Pitasi
PR: #889
File: precompiles/act/query.go:170-171
Timestamp: 2024-10-16T15:30:41.746Z
Learning: In Go code within precompile methods (e.g., in precompiles/act/query.go), prefer defining and using a custom error type (like WrongArgsNumber) instead of using fmt.Errorf directly for error messages. This enhances error handling and code clarity.

precompiles/json/abi.json (1)

Learnt from: Svetomech
PR: #1042
File: precompiles/warden/abi.json:1633-1637
Timestamp: 2024-11-14T15:15:53.718Z
Learning: In the precompiles/warden/abi.json file, the broadcastType parameter in the newSignRequest method is intentionally defined as enum BroadcastType (uint8), even though it's defined as int32 in other locations.

precompiles/json/IJson.sol (1)

Learnt from: mn13
PR: #1248
File: precompiles/async/IAsync.sol:67-73
Timestamp: 2025-02-18T11:53:28.386Z
Learning: The IAsync.sol file is an interface definition and should not include implementation details or validation logic. Interface files should only contain function signatures and event definitions.

precompiles/json/IJson.go (1)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (8)
precompiles/json/json.go (1)

97-131: LGTM! Clean implementation with only Build and Parse methods.

The removal of old JSON manipulation methods is complete and the implementation correctly handles only the new API methods as queries.

solidity/plugin-gmp-handler/src/PluginGmpHandler.sol (1)

66-90: Excellent refactoring to use the new JSON API.

The migration from the old JSON API to JsonUtils.JsonBuilder is clean and consistent. The change from view to pure is also correct since the function doesn't read contract state.

precompiles/json/abi.json (1)

1-52: ABI correctly simplified to only Build and Parse methods.

The ABI definition properly reflects the new simplified JSON precompile interface with clear parameter names.

precompiles/json/query.go (1)

15-73: Build and Parse methods implementation looks solid.

The implementations correctly validate arguments, handle type conversions, and delegate to the appropriate builder/parser structs.

precompiles/json/IJson.sol (2)

31-47: Interface correctly simplified to build and parse methods.

The IJson interface now provides a clean API with only the essential JSON building and parsing functionality.


75-243: JsonUtils library provides excellent JSON building functionality.

The library offers a comprehensive and user-friendly API for constructing JSON with proper type safety and convenience methods.

precompiles/json/IJson.go (2)

34-34: ABI correctly reflects the simplified interface.

The updated ABI now contains only the build and parse methods, which aligns perfectly with the PR objective of removing the old API and retaining only these two functions.


214-243: Parse method bindings correctly implemented.

The Parse method bindings have been properly generated with the new signature accepting jsonBytes and schema parameters. All three binding variations (Caller, Session, CallerSession) are consistently updated.

@Pitasi Pitasi force-pushed the remove-old-json-precompile branch from e7107a0 to a30450e Compare July 22, 2025 12:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
precompiles/json/IJson.sol (1)

10-14: Remove unused ReadKeyValue struct.

The ReadKeyValue struct is no longer used since all read-related methods have been removed from the interface.

-struct ReadKeyValue {
-    string key;
-    string valueType;
-    int64 decimals;
-}
🧹 Nitpick comments (2)
precompiles/json/query.go (2)

15-45: Consider using custom error types instead of fmt.Errorf.

The Build method implementation is correct, but according to coding guidelines, custom error types are preferred over fmt.Errorf in precompile methods for better error handling and code clarity.

Consider defining custom error types:

type WrongArgsNumber struct {
    Expected int
    Got      int
}

func (e WrongArgsNumber) Error() string {
    return fmt.Sprintf("wrong args number, expected %d, got %d", e.Expected, e.Got)
}

type WrongArgType struct {
    ArgIndex int
    Expected string
    Got      interface{}
}

func (e WrongArgType) Error() string {
    return fmt.Sprintf("wrong arg #%d, expected %s, got %T", e.ArgIndex, e.Expected, e.Got)
}

Then use them in the method:

-return nil, fmt.Errorf("wrong args number, expected 2, got %d", len(args))
+return nil, WrongArgsNumber{Expected: 2, Got: len(args)}

47-73: Parse method implementation is correct.

The method properly validates arguments and delegates to the parser struct. The same custom error type suggestion applies here as well.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e7107a0 and a30450e.

⛔ Files ignored due to path filters (7)
  • tests/testdata/contracts/json-user/IJson.abi is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/IJson.bin is excluded by !**/*.bin, !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.abi is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.bin is excluded by !**/*.bin, !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.go is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/JsonUser.sol is excluded by !tests/testdata/**
  • tests/testdata/contracts/json-user/remappings.txt is excluded by !tests/testdata/**
📒 Files selected for processing (12)
  • precompiles/json/IJson.go (3 hunks)
  • precompiles/json/IJson.sol (1 hunks)
  • precompiles/json/abi.json (1 hunks)
  • precompiles/json/conversions.go (0 hunks)
  • precompiles/json/json.go (1 hunks)
  • precompiles/json/json_read.go (0 hunks)
  • precompiles/json/json_test.go (0 hunks)
  • precompiles/json/query.go (1 hunks)
  • precompiles/json/validation.go (0 hunks)
  • solidity/plugin-gmp-handler/src/PluginGmpHandler.sol (5 hunks)
  • tests/cases/json_precompile.go (0 hunks)
  • tests/cases/json_precompile_user.go (0 hunks)
🧠 Learnings (6)
📓 Common learnings
Learnt from: backsapc
PR: warden-protocol/wardenprotocol#810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The `MarkProcessed` method has been removed from `keychain-sdk/internal/tracker/status_tracker.go` in the Go codebase, as it is no longer needed.
precompiles/json/abi.json (1)

Learnt from: Svetomech
PR: #1042
File: precompiles/warden/abi.json:1633-1637
Timestamp: 2024-11-14T15:15:53.718Z
Learning: In the precompiles/warden/abi.json file, the broadcastType parameter in the newSignRequest method is intentionally defined as enum BroadcastType (uint8), even though it's defined as int32 in other locations.

precompiles/json/json.go (1)

Learnt from: backsapc
PR: #975
File: precompiles/slinky/slinky.go:129-136
Timestamp: 2024-11-02T08:51:46.547Z
Learning: In the IsTransaction method, avoid returning false for unknown methods, as it suggests the method is a query. Instead, handle unknown methods by returning an error to indicate the method is unrecognized.

precompiles/json/IJson.sol (1)

Learnt from: mn13
PR: #1248
File: precompiles/async/IAsync.sol:67-73
Timestamp: 2025-02-18T11:53:28.386Z
Learning: The IAsync.sol file is an interface definition and should not include implementation details or validation logic. Interface files should only contain function signatures and event definitions.

precompiles/json/query.go (2)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

Learnt from: Pitasi
PR: #889
File: precompiles/act/query.go:170-171
Timestamp: 2024-10-16T15:30:41.746Z
Learning: In Go code within precompile methods (e.g., in precompiles/act/query.go), prefer defining and using a custom error type (like WrongArgsNumber) instead of using fmt.Errorf directly for error messages. This enhances error handling and code clarity.

precompiles/json/IJson.go (1)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

💤 Files with no reviewable changes (6)
  • precompiles/json/validation.go
  • precompiles/json/json_test.go
  • precompiles/json/conversions.go
  • tests/cases/json_precompile_user.go
  • precompiles/json/json_read.go
  • tests/cases/json_precompile.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • solidity/plugin-gmp-handler/src/PluginGmpHandler.sol
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: backsapc
PR: warden-protocol/wardenprotocol#810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The `MarkProcessed` method has been removed from `keychain-sdk/internal/tracker/status_tracker.go` in the Go codebase, as it is no longer needed.
precompiles/json/abi.json (1)

Learnt from: Svetomech
PR: #1042
File: precompiles/warden/abi.json:1633-1637
Timestamp: 2024-11-14T15:15:53.718Z
Learning: In the precompiles/warden/abi.json file, the broadcastType parameter in the newSignRequest method is intentionally defined as enum BroadcastType (uint8), even though it's defined as int32 in other locations.

precompiles/json/json.go (1)

Learnt from: backsapc
PR: #975
File: precompiles/slinky/slinky.go:129-136
Timestamp: 2024-11-02T08:51:46.547Z
Learning: In the IsTransaction method, avoid returning false for unknown methods, as it suggests the method is a query. Instead, handle unknown methods by returning an error to indicate the method is unrecognized.

precompiles/json/IJson.sol (1)

Learnt from: mn13
PR: #1248
File: precompiles/async/IAsync.sol:67-73
Timestamp: 2025-02-18T11:53:28.386Z
Learning: The IAsync.sol file is an interface definition and should not include implementation details or validation logic. Interface files should only contain function signatures and event definitions.

precompiles/json/query.go (2)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

Learnt from: Pitasi
PR: #889
File: precompiles/act/query.go:170-171
Timestamp: 2024-10-16T15:30:41.746Z
Learning: In Go code within precompile methods (e.g., in precompiles/act/query.go), prefer defining and using a custom error type (like WrongArgsNumber) instead of using fmt.Errorf directly for error messages. This enhances error handling and code clarity.

precompiles/json/IJson.go (1)

Learnt from: backsapc
PR: #810
File: keychain-sdk/internal/tracker/status_tracker.go:0-0
Timestamp: 2024-10-24T13:03:19.344Z
Learning: The MarkProcessed method has been removed from keychain-sdk/internal/tracker/status_tracker.go in the Go codebase, as it is no longer needed.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: lint
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
precompiles/json/json.go (2)

97-103: LGTM! Switch statement correctly handles only the remaining methods.

The Run method now only processes BuildMethod and ParseMethod, which aligns with the PR objective of retaining only the new API.


125-125: Good simplification of the non-transactional method list.

The IsTransaction method correctly identifies both BuildMethod and ParseMethod as non-transactional (queries).

precompiles/json/abi.json (1)

1-52: ABI correctly reflects the simplified JSON precompile interface.

The ABI now exposes only two functions (build and parse) as intended, with appropriate parameter names and types.

precompiles/json/query.go (1)

11-13: Methods correctly reduced to only Build and Parse.

The constants now only define the two remaining methods, aligning with the simplified API.

precompiles/json/IJson.sol (2)

31-47: Interface correctly simplified to only build and parse methods.

The IJson interface now exposes only the two core methods as intended by the PR.


201-201: Whitespace-only change on line 201—no action needed.

The diff around line 201 shows only a blank line between the pair overloads for uint256 and bool. There’s no functional change in the code.

precompiles/json/IJson.go (2)

1-2: Auto-generated file correctly reflects the simplified interface.

This file is auto-generated from the ABI and properly contains only the Build and Parse method bindings.


214-243: Parse method binding correctly updated.

The Parse method signature has been properly updated to accept jsonBytes and schema parameters and return abiEncodedData.

@Pitasi Pitasi merged commit fbd66a0 into main Jul 22, 2025
20 checks passed
@Pitasi Pitasi deleted the remove-old-json-precompile branch July 22, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant