-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Summary
The performance EVM's Frame is hardcoded to use DefaultEvm type, which breaks when using custom EvmConfig configurations.
Location
src/frame/frame.zig:21 and src/frame/frame.zig:372-374
Current Code
// Line 21
const DefaultEvm = @import("../evm.zig").Evm(.{});
// Lines 372-374
pub inline fn getEvm(self: *const Self) *DefaultEvm {
return @as(*DefaultEvm, @ptrCast(@alignCast(self.evm_ptr)));
}Problem
The code has a comment acknowledging this issue (lines 366-370):
/// FIXME: This currently assumes DefaultEvm type which is incorrect for non-default configurations.
/// The proper fix requires either:
/// 1. Adding EvmType to FrameConfig (circular dependency issue)
/// 2. Using comptime type resolution (complex)
/// 3. Keeping as anyopaque and having callers cast (requires refactoring all handlers)Impact
- Custom hardfork configurations may not work correctly
- Custom gas settings could be ignored
- Type safety is compromised through
@ptrCast
Recommended Fix
Consider using a trait/interface pattern:
pub fn Frame(comptime EvmType: type, _config: FrameConfig) type {
return struct {
evm_ptr: *EvmType,
// ...
pub inline fn getEvm(self: *const Self) *EvmType {
return self.evm_ptr;
}
};
}Or use comptime type resolution through the config.
Note: This issue was created by Claude AI assistant during code review, not @roninjin10 or @fucory
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels