Skip to content

fix: support hex bytes and numeric ints in parsing#175

Merged
MicBun merged 3 commits intomainfrom
parsing
Feb 10, 2026
Merged

fix: support hex bytes and numeric ints in parsing#175
MicBun merged 3 commits intomainfrom
parsing

Conversation

@MicBun
Copy link
Copy Markdown
Member

@MicBun MicBun commented Feb 10, 2026

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

Summary by CodeRabbit

  • Bug Fixes

    • Binary parsing now accepts hex (0x-prefixed) and base64; numeric parsing accepts ints, floats, and strings.
  • New Features / Data Changes

    • Order book and position payloads updated: participant IDs included, position types added, last-updated removed, and wallet address ordering changed; depth levels now report buy/sell volumes separately.
  • Tests

    • Added tests covering the updated parsing and numeric/binary handling.

@MicBun MicBun self-assigned this Feb 10, 2026
@holdex
Copy link
Copy Markdown

holdex bot commented Feb 10, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 3h Update time Feb 10, 2026, 9:54 AM

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
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Reworks parsing and data models for order-book code: adds 0x hex decoding for BYTEA, accepts numeric types (float64/int) for INT/INT64 extraction, updates query row parsing to new column layouts, adjusts OrderBookEntry/UserPosition/DepthLevel structs, adds tests, and updates .gitignore.

Changes

Cohort / File(s) Summary
Configuration
/.gitignore
Added GEMINI.md to ignore list.
Parsing helpers & tests
core/contractsapi/attestation_actions.go, core/contractsapi/order_book.go, core/contractsapi/parsing_helpers_test.go
extractBytesColumn now detects 0x-prefixed hex and decodes it (falls back to base64). extractInt64Column and extractIntColumn accept float64, int, and string inputs with conversions. Added tests for hex BYTEA and numeric parsing.
Query parsing updates
core/contractsapi/order_book_queries.go
Row schemas changed: order-book entry rows now include participant_id as column 0 and wallet_address moved to last column; user position rows now include position_type in place of last_updated; depth rows split total into buy_volume and sell_volume. Length checks and extraction indices updated accordingly.
Type definitions
core/types/order_book_types.go
OrderBookEntry: added ParticipantID int, moved WalletAddress []byte. UserPosition: removed LastUpdated int64, added PositionType string. DepthLevel: replaced TotalAmount with BuyVolume and SellVolume.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibble hex and numbers bright,

0x snacks and floats take flight,
Rows reshuffled, structs stand tall,
Tests clap little paws for all,
A joyful hop — parsing delight!

🚥 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 title accurately describes the primary change—adding support for hex-encoded bytes and numeric integer types in parsing—which aligns with the main changes in attestation_actions.go and order_book.go.
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 docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch parsing

No actionable comments were generated in the recent review. 🎉


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.

@MicBun MicBun changed the title chore: support hex bytes and numeric ints in parsing fix: support hex bytes and numeric ints in parsing Feb 10, 2026
@holdex
Copy link
Copy Markdown

holdex bot commented Feb 10, 2026

Bug Report Checklist

Status Commit Link Bug Author HR Card
✅ Submitted commit link @MicBun HR Card

If this commit or author is incorrect, reply in this PR with:

@holdex bug dispute <correct-commit-url> && bug author @correct-user

Use git blame to identify the right commit and author before posting.

See available commands to help comply with our Guidelines.

@MicBun
Copy link
Copy Markdown
Member Author

MicBun commented Feb 10, 2026

@holdex bug commit 50630ee && bug author @MicBun

@MicBun MicBun merged commit d2c9a19 into main Feb 10, 2026
6 checks passed
@MicBun MicBun deleted the parsing branch February 10, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant