Skip to content

Commit e75e546

Browse files
refactor: make Context generic over DB, remove FallbackFns vtable
- Remove FallbackFns C-style vtable and InMemoryDB.fallback field - Make Context generic: Context(comptime DB: type); DefaultContext = Context(InMemoryDB) - Add Journal(DB) tracking wrappers guarded by @hasDecl (snapshotFrame, commitFrame, revertFrame, commitTracking, discardTracking, notifyStorageSlotCommit, hasNonZeroStorageForAddress, untrackAddress, forceTrackAddress) - Replace Host.ctx with type-erased JournalVTable (18 entries); Host.init(DB, ctx, prec) and Host.fromCtx(ctx, prec) constructors; opcode handlers unchanged - Make Evm generic: EvmFor(comptime DB: type); Evm = EvmFor(InMemoryDB) alias - Make MainnetHandler.* functions accept anytype evm for zero-cost duck typing - Fix getDb() dangling pointer: change self: @this() → self: *const @this() - Update test files to use Host.fromCtx() instead of Host{ .ctx = ... } literal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cb63379 commit e75e546

21 files changed

+1246
-1222
lines changed

examples/simple_contract.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn main() !void {
1818
defer db.deinit();
1919

2020
// Create a context with Prague specification
21-
var ctx = context.Context.new(db, primitives.SpecId.prague);
21+
var ctx = context.DefaultContext.new(db, primitives.SpecId.prague);
2222

2323
// Create a simple contract that adds two numbers
2424
// PUSH1 0x05 (push 5 onto stack)

0 commit comments

Comments
 (0)