Skip to content

chore: remove redundant decodeQueryComponent#1322

Merged
MicBun merged 5 commits into
mainfrom
moveDiscoverMarket
Mar 2, 2026
Merged

chore: remove redundant decodeQueryComponent#1322
MicBun merged 5 commits into
mainfrom
moveDiscoverMarket

Conversation

@MicBun
Copy link
Copy Markdown
Contributor

@MicBun MicBun commented Mar 2, 2026

resolves: https://github.com/truflation/website/issues/3382

Summary by CodeRabbit

  • Removals

    • Removed ability to filter markets by stream identifier and related market-listing action.
    • Market details no longer include query-component metadata or related stored fields and indexes.
    • Removed on-chain decoding endpoint for query components.
  • Tests

    • Deleted end-to-end and unit tests for query-component encoding/decoding and stream-based discovery.
  • Chores

    • Updated Go toolchain to 1.25.3 and bumped dependencies.

@MicBun MicBun requested a review from pr-time-tracker March 2, 2026 14:28
@MicBun MicBun self-assigned this Mar 2, 2026
@holdex
Copy link
Copy Markdown

holdex Bot commented Mar 2, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 4h Update time Mar 2, 2026, 4:46 PM

You can submit time with the command. Example:

@holdex pr submit-time 15m

See available commands to help comply with our Guidelines.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removes query-components ABI decoding and its precompile/handler, deletes related tests and discovery action, drops denormalized ob_queries columns/indexes and associated market-return fields, and updates Go toolchain and multiple module dependencies.

Changes

Cohort / File(s) Summary
Precompile & ABI
extensions/tn_utils/datapoints.go, extensions/tn_utils/precompiles.go
Removes queryComponentsABIArgs and the decodeQueryComponents precompile/handler; unpackQueryComponents now uses contractsapi.DecodeQueryComponents and util.NewEthereumAddressFromString.
Order-book migrations
internal/migrations/030-order-book-schema.sql, internal/migrations/032-order-book-actions.sql, internal/migrations/043-get-markets-by-stream.sql
Drops data_provider, stream_id, action_id, query_args columns and related indexes from ob_queries; removes ABI decode/insert logic from create_market; deletes get_markets_by_stream and omits ABI fields from get_market_info returns.
Tests removed
tests/streams/order_book/discovery_test.go, extensions/tn_utils/precompiles_decoding_test.go
Deletes end-to-end discovery and precompiles decoding tests (kwiltest-gated), including assertions around encode/decode and discovery flows.
Config & deps
go.mod, .github/workflows/ci.yaml, .golangci.yaml
Bumps Go toolchain to 1.25.3, updates many module versions (notable: testify, trufnetwork/sdk-go, golang.org/x/*, go-ethereum and indirects), updates CI Go version and golangci-lint, and adds kwiltest lint build tag.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • outerlook
  • pr-time-tracker

Poem

🐰 I hopped through bytes and gently swept the floor,
I tucked away handlers, then nudged out one more,
Columns unburdened, tests tucked into hay,
New toolchains humming to greet the bright day,
A soft little hop — tidy code, nap, encore.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and accurately summarizes the main objective—removing redundant decodeQueryComponent functionality across Go code, SQL migrations, and tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch moveDiscoverMarket

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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: 2

🧹 Nitpick comments (1)
internal/migrations/032-order-book-actions.sql (1)

239-266: Document this get_market_info return-shape change as a breaking API update.

The SQL changes are consistent, but this alters the public action contract. Please add migration/release notes for client consumers expecting the old columns.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/migrations/032-order-book-actions.sql` around lines 239 - 266, The
public action get_market_info had its return shape changed (column list now:
hash, query_components, bridge, settle_time, settled, winning_outcome,
settled_at, max_spread, min_order_size, created_at, creator); add a clear
migration/release note documenting this breaking API change so clients know the
new column order/names and any removed/renamed fields, include guidance for
updating client queries that consume get_market_info (refer to get_market_info
by name), the migration version or changelog entry referencing the
032-order-book-actions.sql commit, and an example of the old→new mapping and
upgrade steps for consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Line 292: Remove the local module replace directive "replace
github.com/trufnetwork/sdk-go => ../sdk-go" from go.mod; locate the replace
entry and delete that line so the module uses the canonical remote module path,
and if local overrides are needed for development, create a go.work file instead
of committing this replace into go.mod.
- Line 71: The go.mod declares vulnerable deps; update the module versions: bump
github.com/ethereum/go-ethereum to at least v1.16.9 (or v1.17.0+ if you want all
fixes) and bump github.com/consensys/gnark-crypto to at least v0.18.1 (or
v0.19.2+ for a minor upgrade), then run module updates so imports in
extensions/tn_settlement, extensions/tn_utils, and extensions/tn_attestation
resolve against the patched releases; ensure go.mod/go.sum are updated (e.g.,
via go get/update and go mod tidy) and run tests/build to confirm no breakage.

---

Nitpick comments:
In `@internal/migrations/032-order-book-actions.sql`:
- Around line 239-266: The public action get_market_info had its return shape
changed (column list now: hash, query_components, bridge, settle_time, settled,
winning_outcome, settled_at, max_spread, min_order_size, created_at, creator);
add a clear migration/release note documenting this breaking API change so
clients know the new column order/names and any removed/renamed fields, include
guidance for updating client queries that consume get_market_info (refer to
get_market_info by name), the migration version or changelog entry referencing
the 032-order-book-actions.sql commit, and an example of the old→new mapping and
upgrade steps for consumers.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fbb8053 and fda7420.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • extensions/tn_utils/datapoints.go
  • extensions/tn_utils/precompiles.go
  • go.mod
  • internal/migrations/030-order-book-schema.sql
  • internal/migrations/032-order-book-actions.sql
  • internal/migrations/043-get-markets-by-stream.sql
  • tests/streams/order_book/discovery_test.go
💤 Files with no reviewable changes (4)
  • tests/streams/order_book/discovery_test.go
  • internal/migrations/030-order-book-schema.sql
  • extensions/tn_utils/datapoints.go
  • internal/migrations/043-get-markets-by-stream.sql

Comment thread go.mod
Comment thread go.mod Outdated
Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yaml:
- Around line 29-35: The CI workflow currently uses golangci-lint-action@v8 with
version: latest which makes runs non-reproducible; update the golangci-lint job
(the job named "golangci-lint" and its input key "version") to pin a specific
linter release (for example replace latest with a concrete tag such as v2.10.1)
so CI uses a fixed linter version and only changes when you intentionally bump
it.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fda7420 and a78a58b.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

Comment thread .github/workflows/ci.yaml Outdated
@MicBun MicBun force-pushed the moveDiscoverMarket branch from a78a58b to 7e88d03 Compare March 2, 2026 14:46
Copy link
Copy Markdown

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/migrations/032-order-book-actions.sql (1)

239-251: ⚠️ Potential issue | 🟠 Major

Confirmed breaking change: get_market_info PUBLIC VIEW return shape reduced from 15 to 11 fields

The migration removes four fields from the public action return tuple: data_provider, stream_id, action_id, and query_args. This breaks any external consumer expecting the old positional layout (e.g., offchain clients, SDKs, integrations decoding by position).

Internal tests have been updated to the new 11-field structure. Ensure all external consumers are coordinated with this release, or deploy a versioned action variant (e.g., get_market_info_v1) to maintain backward compatibility during rollout.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/migrations/032-order-book-actions.sql` around lines 239 - 251, The
migration changes the PUBLIC VIEW action get_market_info to return 11 fields
instead of the previous 15, removing data_provider, stream_id, action_id, and
query_args which breaks consumers relying on positional layout; either restore
the original 15-field return shape in get_market_info or add a
backward-compatible action such as get_market_info_v1 that preserves the
original return tuple (including data_provider, stream_id, action_id,
query_args) and keep the new get_market_info for the updated shape so external
SDKs/offchain clients can migrate without breaking changes.
♻️ Duplicate comments (1)
go.mod (1)

71-71: ⚠️ Potential issue | 🔴 Critical

Upgrade vulnerable crypto/EVM dependencies before merge.

Line 71 and Line 94 still pin versions with known HIGH-severity advisories. Please bump:

  • github.com/consensys/gnark-crypto to >= v0.18.1 (or newer patched line),
  • github.com/ethereum/go-ethereum to >= v1.17.0 (covers the listed 2026 advisories).
#!/bin/bash
set -euo pipefail

echo "Current pinned versions:"
rg -n 'github.com/consensys/gnark-crypto|github.com/ethereum/go-ethereum' go.mod

echo ""
echo "Query OSV for pinned versions:"
curl -s https://api.osv.dev/v1/query \
  -H 'Content-Type: application/json' \
  -d '{"package":{"ecosystem":"Go","name":"github.com/consensys/gnark-crypto"},"version":"0.18.0"}' | jq '.vulns[]?.id'

curl -s https://api.osv.dev/v1/query \
  -H 'Content-Type: application/json' \
  -d '{"package":{"ecosystem":"Go","name":"github.com/ethereum/go-ethereum"},"version":"1.16.7"}' | jq '.vulns[]?.id'

Also applies to: 94-94

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 71, The go.mod pins for github.com/consensys/gnark-crypto and
github.com/ethereum/go-ethereum are vulnerable; update the dependency versions
in go.mod so github.com/consensys/gnark-crypto is bumped to >= v0.18.1 and
github.com/ethereum/go-ethereum is bumped to >= v1.17.0 (replace the current
v0.18.0 and older go-ethereum entries), then run go get/go mod tidy to refresh
the lockfile and verify no other modules require the older versions; target the
two package names "github.com/consensys/gnark-crypto" and
"github.com/ethereum/go-ethereum" when making the changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@internal/migrations/032-order-book-actions.sql`:
- Around line 239-251: The migration changes the PUBLIC VIEW action
get_market_info to return 11 fields instead of the previous 15, removing
data_provider, stream_id, action_id, and query_args which breaks consumers
relying on positional layout; either restore the original 15-field return shape
in get_market_info or add a backward-compatible action such as
get_market_info_v1 that preserves the original return tuple (including
data_provider, stream_id, action_id, query_args) and keep the new
get_market_info for the updated shape so external SDKs/offchain clients can
migrate without breaking changes.

---

Duplicate comments:
In `@go.mod`:
- Line 71: The go.mod pins for github.com/consensys/gnark-crypto and
github.com/ethereum/go-ethereum are vulnerable; update the dependency versions
in go.mod so github.com/consensys/gnark-crypto is bumped to >= v0.18.1 and
github.com/ethereum/go-ethereum is bumped to >= v1.17.0 (replace the current
v0.18.0 and older go-ethereum entries), then run go get/go mod tidy to refresh
the lockfile and verify no other modules require the older versions; target the
two package names "github.com/consensys/gnark-crypto" and
"github.com/ethereum/go-ethereum" when making the changes.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a78a58b and c30813b.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (9)
  • .golangci.yaml
  • extensions/tn_utils/datapoints.go
  • extensions/tn_utils/precompiles.go
  • extensions/tn_utils/precompiles_decoding_test.go
  • go.mod
  • internal/migrations/030-order-book-schema.sql
  • internal/migrations/032-order-book-actions.sql
  • internal/migrations/043-get-markets-by-stream.sql
  • tests/streams/order_book/discovery_test.go
💤 Files with no reviewable changes (5)
  • extensions/tn_utils/precompiles_decoding_test.go
  • extensions/tn_utils/datapoints.go
  • internal/migrations/030-order-book-schema.sql
  • internal/migrations/043-get-markets-by-stream.sql
  • tests/streams/order_book/discovery_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • extensions/tn_utils/precompiles.go

@MicBun MicBun force-pushed the moveDiscoverMarket branch from c30813b to aefe0a9 Compare March 2, 2026 15:54
Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@extensions/tn_utils/precompiles.go`:
- Line 736: The current return uses []byte(sid) which incorrectly converts the
Go string representation to ASCII bytes; instead, ensure streamID is serialized
as the original bytes32 raw content before hashing in compute_attestation_hash:
either change DecodeQueryComponents to return streamID as []byte (preferred) or,
if keeping a string, convert it back to the raw 32-byte value (e.g., strip "0x"
and hex-decode/pad to 32 bytes) and return that byte slice instead of
[]byte(sid); update the return in the function that currently returns
addr.Bytes(), []byte(sid), aid, argBytes, nil to return the correctly decoded
[]byte streamID so canonicalization matches the on-chain bytes32.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c30813b and aefe0a9.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (9)
  • .golangci.yaml
  • extensions/tn_utils/datapoints.go
  • extensions/tn_utils/precompiles.go
  • extensions/tn_utils/precompiles_decoding_test.go
  • go.mod
  • internal/migrations/030-order-book-schema.sql
  • internal/migrations/032-order-book-actions.sql
  • internal/migrations/043-get-markets-by-stream.sql
  • tests/streams/order_book/discovery_test.go
💤 Files with no reviewable changes (5)
  • extensions/tn_utils/datapoints.go
  • internal/migrations/030-order-book-schema.sql
  • tests/streams/order_book/discovery_test.go
  • extensions/tn_utils/precompiles_decoding_test.go
  • internal/migrations/043-get-markets-by-stream.sql

Comment thread extensions/tn_utils/precompiles.go
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

29-29: Consider centralizing the Go version to avoid future drift.

1.25.3 is duplicated in three jobs. Defining a workflow-level env var (for example GO_VERSION) would make upgrades safer and simpler.

♻️ Suggested cleanup
 name: CI
+env:
+  GO_VERSION: '1.25.3'
 
 on:
   workflow_call:
@@
       - uses: actions/setup-go@v5
         with:
-          go-version: '1.25.3'
+          go-version: ${{ env.GO_VERSION }}
           cache: false
@@
       - name: Setup Go
         uses: actions/setup-go@v5
         with:
-          go-version: '1.25.3'
+          go-version: ${{ env.GO_VERSION }}
@@
       - name: Setup Go
         uses: actions/setup-go@v5
         with:
-          go-version: '1.25.3'
+          go-version: ${{ env.GO_VERSION }}

Also applies to: 63-63, 229-229

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml at line 29, Centralize the duplicated Go version
by adding a workflow-level env var (e.g., env: GO_VERSION: '1.25.3') and update
each job's go-version entries to reference that variable (replace occurrences of
go-version: '1.25.3' with go-version: ${{ env.GO_VERSION }}); locate and change
the go-version keys in all jobs that currently hardcode '1.25.3' so future
upgrades only require changing the single GO_VERSION value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/ci.yaml:
- Line 29: Centralize the duplicated Go version by adding a workflow-level env
var (e.g., env: GO_VERSION: '1.25.3') and update each job's go-version entries
to reference that variable (replace occurrences of go-version: '1.25.3' with
go-version: ${{ env.GO_VERSION }}); locate and change the go-version keys in all
jobs that currently hardcode '1.25.3' so future upgrades only require changing
the single GO_VERSION value.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aefe0a9 and 945a38a.

📒 Files selected for processing (2)
  • .github/workflows/ci.yaml
  • extensions/tn_settlement/settlement_integration_test.go

@MicBun MicBun merged commit d52c42c into main Mar 2, 2026
6 of 7 checks passed
@MicBun MicBun deleted the moveDiscoverMarket branch March 2, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant