-
Notifications
You must be signed in to change notification settings - Fork 5
feat(consensus): update anchorV4 based on protocol #20304
#58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Claude finished @davidtaikocha's task —— View job Code Review CompleteReviewed PR #58: feat(consensus): update Todo List:
SummaryThis PR updates the Code Quality & Best Practices✅ Good:
Potential Bugs & Issues🔴 Critical - Parsing Logic: In const PROPOSAL_ID_WORD_OFFSET: usize = 1; // Comment says "submissionWindowEnd precedes proposalId"However, looking at the new function anchorV4(
(uint48, uint48, address, bytes, bytes32, (uint48, uint8, address, address)[]),
(uint48, bytes32, bytes32, bytes32)
) external;The first parameter is a tuple, and the proposal ID is the second
This appears correct for ABI-encoded tuple data, but the offset calculation is fragile. The logic assumes:
Recommendation: Add validation that the extracted offset is reasonable (not larger than input length) and document the exact ABI layout assumption. 🟡 Medium - Genesis Hash Update:
Performance Considerations✅ No performance concerns:
Security Concerns🟡 Input Validation: In let offset = usize::try_from(U256::from_be_bytes(offset_bytes)).ok()?;Good use of Recommendation: Add explicit validation: if offset > input.len() {
return None;
}✅ Good security practices:
Test Coverage✅ Good:
Recommendation: Add these test cases: #[test]
fn returns_none_for_invalid_offset() {
let calldata = hex_decode(concat!(
"0x3c7aa911",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" // massive offset
));
assert!(extract_anchor_v4_proposal_id(&calldata).is_none());
}Additional Observations
Recommendations Summary
|
)" This reverts commit 14b1a5f.
ref: taikoxyz/taiko-mono#20304