feat: implement EIP-4844 blob gas pricing and transaction validation - #830
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Code Review: Blob Gas ImplementationI've reviewed PR #830 which implements blob gas handling and transaction validity checks. Here's my comprehensive feedback: ✅ Strengths
🔍 Issues and Recommendations1. Potential integer overflow in blob gas calculation (src/eips_and_hardforks/eips.zig:517-520)const blob_gas = @as(u64, blob_count) * primitives.Blob.BLOB_GAS_PER_BLOB;
return @as(u256, blob_gas) * base_fee;While unlikely with MAX_BLOBS_PER_TRANSACTION=6, consider using checked multiplication or documenting the safety invariant. 2. Missing null check for origin account (src/evm.zig:366-369)The code uses const origin_account = self.database.get_account(self.origin.bytes) catch |err| {
log.err("Database error getting origin account: {}", .{err});
return CallResult.failure(0);
} orelse {
log.err("Origin account not found: {x}", .{self.origin.bytes});
return CallResult.failure(0);
};3. Gas refund calculation (src/evm.zig:461-471)The blob gas cost is included in 4. Test completeness (test/blob_gas_test.zig)The integration test appears incomplete (cuts off mid-definition at line 139). Please complete the test to ensure full transaction flow validation. 5. Method naming inconsistency (src/frame/call_params.zig)Renamed
🛡️ Security Considerations
🚀 PerformanceThe implementation is efficient with minimal allocations. The exponential pricing calculation has a loop limit (256 iterations) preventing infinite loops. 📋 Checklist ItemsPlease complete these before merging:
SummaryThis is a solid implementation of EIP-4844 blob gas handling. The core logic is correct and follows the specification. Address the minor issues above, complete the test coverage, and this will be ready to merge. Note: This review was performed by Claude AI assistant, not @roninjin10 or @fucory |
Pull Request Review for EIP-4844 Blob Gas ImplementationNote: This review was performed by Claude AI assistant, not @roninjin10 or @fucory 🎯 Overall AssessmentThis PR successfully implements EIP-4844 blob gas pricing and transaction validation. The implementation is comprehensive and follows the Ethereum specification correctly. The code quality is high and adheres to the project's CLAUDE.md standards. ✅ Strengths
🔍 Code Quality Observations
💡 Minor Suggestions
🔒 Security Considerations
✅ Testing VerificationThe PR includes comprehensive tests for:
🚀 Performance ImpactThe implementation is efficient:
📋 Checklist Verification
🎉 ConclusionAPPROVED - This is a high-quality implementation of EIP-4844 blob gas support. The code is correct, secure, performant, and well-tested. Great work on implementing this complex EIP! The implementation correctly handles all aspects of blob transactions including pricing, validation, fee burning, and balance checks. The forward-looking support for Prague parameters is also appreciated. Excellent job! 🚀 |
7bc9d17 to
7d35df5
Compare
cfc9dac to
27fd9bf
Compare
Code Review for PR #830: EIP-4844 Blob Gas ImplementationOverall AssessmentThis is a well-structured implementation of EIP-4844 blob gas pricing and transaction validation. The code follows the project's conventions well and includes comprehensive test coverage. However, there are several critical issues that need to be addressed. 🚨 Critical Issues1. Incorrect Variable Usage in blob_gas_price CalculationIn src/eips_and_hardforks/eips.zig:495 and src/primitives/blob.zig:213: // INCORRECT - using wrong variable name
excess_blob_gas = excess_blob_gas(excess_gas, blob_gas_used, TARGET_BLOB_GAS_PER_BLOCK_CANCUN);This should be: excess_gas = excess_blob_gas(excess_gas, blob_gas_used, TARGET_BLOB_GAS_PER_BLOCK_CANCUN);2. Balance Check Logic IssueIn src/evm.zig:365-378, the balance check should occur after transaction validation but before nonce increment. The current placement could lead to incorrect transaction ordering. 3. Missing Error PropagationIn src/evm.zig:367-369, using catch to handle database errors could mask critical failures: const origin_account = self.database.get_account(self.origin.bytes) catch {
log.err("Failed to get origin account for balance check", .{});
return CallResult.failure(0);
} orelse Account.zero();Per CLAUDE.md, errors should be properly propagated, not swallowed.
|
Code Review for PR #830: EIP-4844 Blob Gas ImplementationOverall AssessmentThis PR implements EIP-4844 blob gas pricing with solid architecture and comprehensive test coverage. The implementation correctly handles blob gas calculations, validation, and fee burning mechanics. 🚨 CRITICAL ISSUES1. Variable Shadowing in TestsLocation: src/primitives/blob.zig:310, 320 The test uses variable name that shadows the function:
Fix: Use distinct variable names like 2. Inconsistent Variable UsageLocation: src/evm.zig:354 Using
|
PR Review: EIP-4844 Blob Gas ImplementationSummaryThis PR implements EIP-4844 blob gas pricing and transaction validation, adding support for blob transactions (proto-danksharding) to the Guillotine EVM. The implementation appears comprehensive and well-structured. Strengths
Critical Issues1. Incorrect Function Naming/SignaturesIn src/primitives/blob.zig, there's inconsistency between old and new function signatures:
Impact: This creates confusion and potential compilation errors. 2. Missing Prague ConstantsThe Prague-specific constants are defined in eips.zig but reference non-existent exports from blob.zig:
These need to be added to blob.zig as public constants. 3. Potential Integer Overflow RiskIn evm.zig line 464, the blob gas calculation could theoretically overflow on systems where usize > u64. Minor Issues
Suggestions
Security Considerations
Performance
Code QualityThe code follows project conventions well:
Test CoverageExcellent coverage including:
ConclusionThis is a solid implementation of EIP-4844 blob gas mechanics. The critical issues are relatively minor and mostly involve cleanup of function signatures and adding missing constant exports. Once these issues are addressed, this PR will be production-ready. Recommendation: Fix the function signature inconsistencies and add the missing Prague constants, then this implementation will be ready to merge. Note: This review was performed by Claude AI assistant |
Code Review: EIP-4844 Blob Gas ImplementationNote: This review was performed by Claude AI assistant, not @roninjin10 or @fucory 🎯 SummaryThis PR implements EIP-4844 blob gas pricing and transaction validation for Cancun hardfork support. The implementation appears comprehensive and well-structured with proper test coverage. ✅ Strengths
🔍 Code Quality Issues1. Balance Check Redundancy (src/evm.zig:502-517)The balance check for blob gas costs is performed twice - once before execution and once during fee deduction. Consider consolidating these checks to avoid redundancy. 2. Error Handling Pattern (src/evm.zig:488-495)The error logging for blob validation failures could be improved by using a more structured approach: // Current: Multiple if-else branches with similar logging
// Better: Single validation result with specific error enum
const validation_result = config.eips.validate_blob_gas_with_error(...);
switch (validation_result) {
.ok => {},
.too_many_blobs => log.err(...),
.missing_max_fee => log.err(...),
// etc.
}3. Missing DocumentationThe new fields in 🐛 Potential Issues1. Integer Overflow Risk (src/evm.zig:510)const total_cost = max_gas_cost + value_transfer + max_blob_gas_cost;While u256 is unlikely to overflow, consider adding overflow checks or using saturating arithmetic for defense-in-depth. 2. Missing Null Check (src/evm.zig:638-640)The coinbase account retrieval doesn't handle the error case properly: var coinbase_account = self.database.get_account(
self.block_info.coinbase.bytes
) catch {
return result; // Should log error before returning
} orelse Account.zero();3. Test File Not ImportedThe new test file // test/root.zig line ~82
_ = @import("blob_gas_test.zig");🚀 Performance Considerations
🔒 Security Concerns
📝 Recommendations
✅ CLAUDE.md Compliance
🎬 ConclusionThis is a solid implementation of EIP-4844 blob gas mechanics. The main issues are minor - primarily around code organization, error handling patterns, and ensuring the new test file is properly imported. Once these issues are addressed, this PR will significantly enhance the EVM's Cancun hardfork support. Recommendation: Address the test import issue and consider the suggested improvements, then this PR should be ready to merge. |
Code Review for PR #830: EIP-4844 Blob Gas ImplementationOverall AssessmentThis is a comprehensive implementation of EIP-4844 blob gas pricing and transaction validation. The code is well-structured and follows the project's conventions. However, there are several critical issues that need to be addressed before merging.
|
Code Review: EIP-4844 Blob Gas ImplementationGreat work on implementing EIP-4844 blob gas pricing and transaction validation! The implementation is comprehensive and follows the codebase conventions well. Here's my detailed review: ✅ Strengths
🔍 Areas for Improvement1. Potential Integer Overflow in blob_gas_cost()In const blob_gas = @as(u64, blob_count) * primitives.Blob.BLOB_GAS_PER_BLOB;
return @as(u256, blob_gas) * base_fee;Consider using saturating multiplication or checking for overflow before the multiplication to prevent potential issues with large blob counts. 2. Missing Validation in excess_blob_gas()The function doesn't validate that if (parent_blob_gas_used > self.max_blob_gas()) return error.InvalidBlobGasUsed;3. Balance Check OrderingIn 4. Error Messages Could Be More SpecificSome log messages could provide more context. For example, line 489 could specify which validation failed: log.err("Blob validation failed: count={d}, max_fee={d}, base_fee={d}", .{...});5. Test Method Name UpdateThe test references
🎯 Performance Considerations
🔒 Security Review
📝 Minor Suggestions
✨ Overall AssessmentThis is a solid implementation of EIP-4844 that integrates well with the existing codebase. The code quality is high, follows project conventions, and includes good test coverage. With the minor improvements suggested above (particularly the overflow protection), this PR is ready for merge. The implementation correctly handles the complex interactions between blob gas pricing, transaction validation, and fee burning. The forward-compatibility with Prague hardfork parameters is particularly well done. Recommendation: Approve with minor changes Note: This review was performed by Claude AI assistant, not @roninjin10 or @fucory |
Code Review for PR #830: EIP-4844 Blob Gas ImplementationOverall AssessmentThis is a well-structured implementation of EIP-4844 blob gas pricing and transaction validation. The code quality is high and follows the project's standards well. However, there are several critical issues that need addressing before merge. ✅ Strengths
🚨 Critical Issues1. Memory Safety: Missing Balance Check Error HandlingIn const origin_account = self.database.get_account(self.origin.bytes) catch {
log.err("Failed to get origin account for balance check", .{});
return CallResult.failure(0);
} orelse Account.zero();Problem: Using 2. Bug in
|
Code Review: EIP-4844 Blob Gas ImplementationNote: This review was performed by Claude AI assistant, not @roninjin10 or @fucory ✅ StrengthsWell-Structured Implementation
Comprehensive Test Coverage
Security & Correctness
🔧 Suggestions for Improvement1. Error Handling Consistency 2. Memory Management 3. Function Naming 4. Test Fix Needed 🐛 Potential Issues1. Uninitialized Variable 2. Balance Check Logic 💡 Performance Considerations
✔️ Overall AssessmentThis is a high-quality implementation of EIP-4844 blob gas pricing. The code follows project conventions, includes comprehensive tests, and handles the complexity of blob transactions well. The suggestions above are mostly minor improvements for consistency and clarity. The implementation correctly handles the key aspects:
I recommend approval after addressing the minor issues identified, particularly the test variable naming issues and the error handling consistency in evm.zig. Test command validation: The PR description mentions running specific tests - I verified the test structure looks correct for the execution spec tests integration. |
Code Review for EIP-4844 Blob Gas ImplementationI've thoroughly reviewed PR #830 implementing EIP-4844 blob gas pricing and transaction validation. Strengths
Code Quality ObservationsMemory Management: The blob versioned hashes allocation in runner_guillotine.zig is properly handled with cleanup. Consider using errdefer for earlier error paths. Error Handling: Good error propagation throughout, but could be enhanced. Currently using silent fallback in some places - consider more explicit error types for different failure modes. API Design: The change from hasValue() to getValue() in CallParams is a good improvement - it's more explicit and reduces redundant checks. Potential Issues
Performance Considerations
Security ReviewGood practices observed:
Consider:
Minor Suggestions
Test Coverage AssessmentThe test suite is comprehensive with unit tests for blob gas calculations, integration tests with full transaction flow, hardfork-specific parameter tests, edge cases, and excess blob gas state transitions. Overall AssessmentThis is a solid implementation of EIP-4844 that correctly handles blob gas pricing, validation, and fee burning. The code is well-tested and follows project conventions. The issues mentioned are minor and mostly about defensive programming and optimization opportunities. Recommendation: APPROVE with minor revisions The implementation is production-ready after addressing the balance check ordering concern and considering the overflow edge case. Note: This review was performed by Claude AI assistant, not @roninjin10 or @fucory |
Code Review for PR #830: EIP-4844 Blob Gas ImplementationOverall AssessmentThis is a well-structured implementation of EIP-4844 blob gas pricing and transaction validation. The code quality is high, follows the project conventions, and includes comprehensive testing. However, there are several areas that need attention. ✅ Strengths
🔴 Critical Issues
|
Code Review - EIP-4844 Blob Gas ImplementationSummaryThis PR implements comprehensive support for EIP-4844 blob gas pricing and transaction validation. The implementation appears well-structured and follows the project's coding standards. Below is my detailed review. Strengths
Code Quality Observations
Potential Issues
Performance Considerations
Security Review
Minor Suggestions
Testing Verification NeededPlease ensure the following tests pass: ConclusionThis is a solid implementation of EIP-4844 blob gas support. The code is clean, follows project standards, and includes appropriate tests. With the minor issues addressed, this PR is ready for merge. Great work on implementing this complex EIP! Note: This review was performed by Claude AI assistant, not @roninjin10 or @fucory |
Code Review: EIP-4844 Blob Gas ImplementationOverall AssessmentThis is a well-structured implementation of EIP-4844 blob gas pricing and transaction validation. The code follows the project's strict coding standards and includes comprehensive testing. However, there are several critical issues that need addressing. Critical Issues1. Incorrect getValue() RefactoringThe refactoring from hasValue() to getValue() has broken test semantics. Tests now check exact values instead of presence/absence. Either restore hasValue() method or fix all test assertions to check getValue() > 0. 2. Missing Allocation CleanupIn src/evm.zig line 506, CallResult.failure() allocates without cleanup. This violates CLAUDE.md's memory management rules. Use proper error handling or defer/errdefer patterns. 3. Variable Name Mismatch BugIn src/evm.zig and blob gas tests, using wrong variable names (excess_gas vs excess_blob_gas) in several places causing compilation or logic errors. Important Issues4. Balance Check RedundancyThe balance check at line 502 duplicates existing logic. Consider consolidating all balance checks into a single location. 5. Incorrect Field ReferencesLine 519 references fields through wrong paths. Should use getter methods like self.get_max_fee_per_blob_gas() instead of direct field access. Performance Considerations
Security Observations✅ Correctly validates blob counts against MAX_BLOBS_PER_TRANSACTION Positive Aspects
Required Actions Before Merge
The implementation is solid overall, but these issues must be addressed to maintain the project's zero-error tolerance policy. Note: This review was performed by Claude AI assistant |
Code Review for PR #830: EIP-4844 Blob Gas ImplementationSummaryThis PR implements comprehensive support for EIP-4844 blob transactions, including gas pricing calculations, validation, and fee handling. The implementation appears solid with good test coverage and adherence to the project's coding standards. Strengths
Issues Found1. Critical: Inconsistent API in blob.zigThe refactored code has breaking changes that need attention. Function renamed from calculate_excess_blob_gas to excess_blob_gas with different signature. Function calculate_blob_gas_price now requires update_fraction parameter. These changes break existing callers and tests. (Lines: src/primitives/blob.zig:55-87) 2. Critical: Compilation Error in blob.zig testsTest at line 305 calls the old function name. Should use the new excess_blob_gas function with proper parameters. 3. Bug: Variable shadowing in blob testLine 298-315: Variable excess_blob_gas shadows itself and creates confusion with renamed function. 4. Missing Constants in updated blob.zigThe diff shows new constants being added but the actual blob.zig file (lines 14-16) still has old hardcoded values instead of the hardfork-specific constants. Security Considerations
Performance Considerations
Recommendations
VerdictThe implementation is well-structured and comprehensive but has critical compilation issues that must be fixed before merging. The API changes in blob.zig need to be reconciled with their usage throughout the codebase. Status: Changes Requested Note: This review was performed by Claude AI assistant, not @roninjin10 or @fucory |
Code Review: EIP-4844 Blob Gas ImplementationNote: This action was performed by Claude AI assistant, not @roninjin10 or @fucory Strengths
Areas for Improvement1. Critical: Balance Check Logic IssueIn src/evm.zig:502-516, there's a potential issue with the balance check:
2. Error Handling Pattern ViolationMultiple instances of error handling that violate CLAUDE.md's Zero Tolerance rules:
3. Memory Safety ConcernThe get_blob_versioned_hashes() function returns a slice without documenting ownership. Consider documenting that this returns a borrowed reference. 4. Variable Name IssueLine 314 in blob.zig has a recursive function call with incorrect variable name that needs fixing. Potential Bugs
Performance Considerations
Security Considerations
Recommendations
Test CoverageThe test coverage appears comprehensive with good edge case handling. However, consider adding:
Overall, this is a solid implementation of EIP-4844 with good structure and testing. The issues identified are mostly minor and can be quickly addressed. Once the CallResult.failure() calls are fixed, this should be ready to merge. |
Code Review for EIP-4844 Blob Gas ImplementationNote: This action was performed by Claude AI assistant, not @roninjin10 or @fucory SummaryThis PR implements EIP-4844 blob gas pricing and transaction validation, including support for both Cancun and Prague hardfork parameters. The implementation is comprehensive and well-structured, but there are several critical issues that must be addressed before merging. ✅ Strengths
🔴 Critical Issues1. CLAUDE.md Violations - Debug Print StatementsMultiple std.debug.print statements were added that violate the zero-tolerance policy:
2. API Breaking Change - hasValue() to getValue()The change from hasValue() returning bool to getValue() returning u256 is a breaking API change.
|
5a7808b to
692450b
Compare
df4bfa8 to
ffd766f
Compare
f0da483 to
9120e10
Compare
ffd766f to
b2f49ee
Compare
…825) ## Description Implements EIP-7623 (Floor Gas) and refactors gas calculation logic for transactions. This PR adds support for calculating the minimum gas a transaction must consume based on calldata tokens, which is required for the Prague hardfork. The implementation includes: 1. Adding EIP-7623 to the Prague hardfork EIP list 2. Implementing token-based calldata gas calculation 3. Adding floor gas cost calculation for Prague 4. Refactoring intrinsic gas calculation to be more modular 5. Ensuring transactions consume at least the floor gas amount The PR also adds comprehensive tests for all the new gas calculation functions, including edge cases and regression tests. ## Type of Change - [x] 🎉 New feature (non-breaking change which adds functionality) - [ ] ✅ Test additions or updates ## Testing - [x] `zig build test` passes - [x] `zig build` completes successfully - [x] All existing tests pass - [x] Added new tests for changes (if applicable) ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my own code - [x] I have commented my code where necessary - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes
…d deduct caller balance
…d deduct caller balance
b47d072 to
779c7c8
Compare
b2f49ee to
0d49b30
Compare
779c7c8 to
0087cd0
Compare

TLDR;
Test with
zig build test-execution-spec-guillotine -Dspec-path=test/execution-spec-tests/fixtures/fixtures_stable/state_tests/prague/eip7623_increase_calldata_cost/test_full_gas_consumption.json(only 2 tests with unsupported authorization list will fail).Description
Implement EIP-4844 blob gas pricing and transaction validation. This PR adds support for blob transactions by:
The implementation includes:
Type of Change
Testing
zig build testpasseszig buildcompletes successfullyChecklist