Skip to content

fix(api): use correct value for LastBlockIDByBatchID#496

Merged
davidtaikocha merged 1 commit into
taikofrom
fix-LastBlockIDByBatchID-api
Jan 7, 2026
Merged

fix(api): use correct value for LastBlockIDByBatchID#496
davidtaikocha merged 1 commit into
taikofrom
fix-LastBlockIDByBatchID-api

Conversation

@MatusKysel
Copy link
Copy Markdown

@MatusKysel MatusKysel commented Jan 7, 2026

@claude
Copy link
Copy Markdown

claude Bot commented Jan 7, 2026

Claude finished @MatusKysel's task —— View job


PR Review: fix(api): use correct value for LastBlockIDByBatchID

Review Tasks

  • Read changed files to understand modifications
  • Analyze the LastBlockIDByBatchID API fix
  • Check for code quality issues
  • Look for potential bugs or security concerns
  • Assess performance implications
  • Provide feedback on test coverage
  • Complete review

Analysis

Changes Summary:
The PR changes return types from *big.Int to *hexutil.Big across the LastBlockIDByBatchID API chain to ensure consistent JSON serialization in RPC responses.

Files Modified:

  1. core/rawdb/taiko_l1_origin.go:144 - ReadBatchToLastBlockID return type + imports hexutil
  2. eth/taiko_api_backend.go:85,103 - LastBlockIDByBatchID and getLastBlockByBatchId return types
  3. ethclient/taiko_api.go:45 - Client method return type and response variable

Positive Aspects

Correct Type Choice: Using *hexutil.Big is appropriate for JSON-RPC APIs as it provides proper JSON marshaling/unmarshaling for big integers, ensuring consistent serialization across the API boundary.

Consistent API Design: The change aligns the return type with other Taiko API functions and follows Go-Ethereum patterns where RPC-exposed values use hexutil types.

Complete Implementation: All three layers (storage, backend, client) are updated consistently, maintaining type safety across the entire call chain.


⚠️ Critical Issue Found

Type Mismatch in LastL1OriginByBatchID (eth/taiko_api_backend.go:81):

// This line now has a type mismatch:
return s.L1OriginByID((*math.HexOrDecimal256)(blockID))

After your changes, blockID is now *hexutil.Big, but L1OriginByID expects *math.HexOrDecimal256. This will cause a compilation error.

Fix needed:

return s.L1OriginByID((*math.HexOrDecimal256)((*big.Int)(blockID)))

📋 Additional Observations

Code Quality: ✅ Clean, follows existing patterns
Security: ✅ No security concerns identified
Performance: ✅ No performance impact (just type conversion)
Error Handling: ✅ Preserved existing error handling patterns

Test Coverage: The existing tests in ethclient/taiko_api_test.go don't cover LastBlockIDByBatchID, but they do test similar functions. Consider adding a test case for this function to prevent regression.


🔧 Recommendation

  1. Fix the type mismatch in eth/taiko_api_backend.go:81 as described above
  2. Add test coverage for LastBlockIDByBatchID function
  3. Verify compilation after the fix

The overall approach is sound and necessary for proper JSON-RPC serialization, but the type conversion bug needs to be addressed before merging.

Copy link
Copy Markdown
Collaborator

@davidtaikocha davidtaikocha left a comment

Choose a reason for hiding this comment

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

Do we also need to update taiko-client for this?

@MatusKysel
Copy link
Copy Markdown
Author

Do we also need to update taiko-client for this?

yes, working on it right now

@davidtaikocha davidtaikocha enabled auto-merge (squash) January 7, 2026 10:02
@davidtaikocha davidtaikocha merged commit b472cd3 into taiko Jan 7, 2026
5 checks passed
@davidtaikocha davidtaikocha deleted the fix-LastBlockIDByBatchID-api branch January 7, 2026 10:08
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.

LastBlockIDByBatchID RPC Fails with Nethermind Client

2 participants