Skip to content

refactor(cold-sql): eliminate intermediate row structs#27

Merged
prestwich merged 2 commits intomainfrom
refactor/cold-sql-eliminate-row-structs
Feb 14, 2026
Merged

refactor(cold-sql): eliminate intermediate row structs#27
prestwich merged 2 commits intomainfrom
refactor/cold-sql-eliminate-row-structs

Conversation

@prestwich
Copy link
Member

@prestwich prestwich commented Feb 14, 2026

Summary

  • Remove HeaderRow, TxRow, ReceiptRow, LogRow, SignetEventRow, and ZenithHeaderRow structs from convert.rs, replacing with direct row-to-domain-type conversion functions in backend.rs
  • Add columns.rs module with pub(crate) constants for all ~35 SQL column names used in r.get() calls, preventing typo-induced runtime panics
  • Fix incorrect data inference: require chain_id for EIP-2930/1559/4844/7702 (was silently defaulting to 0), blob_versioned_hashes for EIP-4844, and authorization_list for EIP-7702
  • Make decode_b256_vec return Result and error on truncated data (was silently dropping entries)
  • Inline header_from_row_with/tx_from_row_with into their only callers, removing unused column-name parameterization
  • Extract repeated blob/opt_blob closures into module-level free functions

Test plan

  • cargo clippy --all-features clean
  • cargo clippy --no-default-features clean
  • SQLite conformance test passes
  • PostgreSQL conformance test passes (./scripts/test-postgres.sh)

🤖 Generated with Claude Code

Remove HeaderRow, TxRow, ReceiptRow, LogRow, SignetEventRow, and
ZenithHeaderRow structs from convert.rs, replacing them with direct
row-to-domain-type conversion functions in backend.rs. This reduces
indirection and simplifies the read path by building domain types
directly from sqlx AnyRow values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich
Copy link
Member Author

supersedes #25

…dead code

- Add columns.rs with pub(crate) constants for all SQL column names
  used in r.get() calls, preventing typo-induced runtime panics
- Require chain_id for EIP-2930/1559/4844/7702 (was silently defaulting
  to 0), blob_versioned_hashes for EIP-4844, and authorization_list for
  EIP-7702
- Make decode_b256_vec return Result and error on truncated data instead
  of silently dropping entries
- Inline header_from_row_with/tx_from_row_with into their only callers,
  removing unused column-name parameterization
- Extract blob/opt_blob closures into module-level free functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich prestwich merged commit 02eea6d into main Feb 14, 2026
6 checks passed
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