Summary
The memory module uses u24 for size parameters, limiting EVM memory to 16MB. While sufficient for most cases, this could be surprising and limiting.
Location
src/memory/memory.zig:100-107
Current Code
pub inline fn ensure_capacity(self: *Self, allocator: std.mem.Allocator, new_size: u24) !void {
// ...
if (required_total > MEMORY_LIMIT) {
@branchHint(.unlikely);
return MemoryError.MemoryOverflow;
}
Analysis
- u24 max value: 16,777,215 bytes (~16MB)
- EVM has no hard memory limit (only gas-bounded)
- Some edge cases or tests might require more
- Performance EVM's FrameConfig uses
memory_limit: u32 = 16 * 1024 * 1024 (16MB default)
Impact
- Contracts requiring >16MB memory will fail unexpectedly
- May cause issues with certain test cases
- Inconsistent with EVM specification (no hard limit)
Recommended Fix
Consider using u32 for size parameters:
pub inline fn ensure_capacity(self: *Self, allocator: std.mem.Allocator, new_size: u32) !void {
Or document the limitation clearly if intentional for performance.
Note: This issue was created by Claude AI assistant during code review, not @roninjin10 or @fucory
Summary
The memory module uses
u24for size parameters, limiting EVM memory to 16MB. While sufficient for most cases, this could be surprising and limiting.Location
src/memory/memory.zig:100-107Current Code
Analysis
memory_limit: u32 = 16 * 1024 * 1024(16MB default)Impact
Recommended Fix
Consider using
u32for size parameters:Or document the limitation clearly if intentional for performance.
Note: This issue was created by Claude AI assistant during code review, not @roninjin10 or @fucory