[KVEvent] User request.block_hash for parent block_hash#30544
Conversation
There was a problem hiding this comment.
Code Review
This pull request addresses a potential AssertionError that could occur when determining the parent block hash for KV cache events. The issue arises in scenarios where the parent block is a null_block, which does not have an associated block hash, causing the assertion to fail. The proposed change correctly resolves this by retrieving the parent block hash directly from request.block_hashes. This is the correct approach as request.block_hashes represents the logical sequence of hashes and is the reliable source of truth, independent of the physical block implementation. The fix is clean, direct, and I find no issues with the implementation.
mgoin
left a comment
There was a problem hiding this comment.
Seems reasonable to me. Should we add a unit test if this failed in some case?
Signed-off-by: Yifan Qiao <yifanqiao@berkeley.edu>
5741e19 to
77f6531
Compare
Good idea. I added a test case for null parent block hash. PTAL |
…#30544) Signed-off-by: Chen Zhang <zhangch99@outlook.com> Signed-off-by: Yifan Qiao <yifanqiao@berkeley.edu> Co-authored-by: Yifan Qiao <yifanqiao@berkeley.edu>
…#30544) Signed-off-by: Chen Zhang <zhangch99@outlook.com> Signed-off-by: Yifan Qiao <yifanqiao@berkeley.edu> Co-authored-by: Yifan Qiao <yifanqiao@berkeley.edu>
…#30544) Signed-off-by: Chen Zhang <zhangch99@outlook.com> Signed-off-by: Yifan Qiao <yifanqiao@berkeley.edu> Co-authored-by: Yifan Qiao <yifanqiao@berkeley.edu>
…#30544) Signed-off-by: Chen Zhang <zhangch99@outlook.com> Signed-off-by: Yifan Qiao <yifanqiao@berkeley.edu> Co-authored-by: Yifan Qiao <yifanqiao@berkeley.edu>
…#30544) Signed-off-by: Chen Zhang <zhangch99@outlook.com> Signed-off-by: Yifan Qiao <yifanqiao@berkeley.edu> Co-authored-by: Yifan Qiao <yifanqiao@berkeley.edu>
Purpose
Parent block can be a null block:
we will do:
So we extract parent block hash from request.block_hashes instead of null_block
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.