Skip to content

Commit 67605de

Browse files
refactor: eliminate comptime DB generics; add phantom access fix
Replace Journal(DB)/Context(DB)/EvmFor(DB) comptime generics with a concrete Database vtable (ptr + fn pointers). Journal, Context, and Evm are now single concrete types — no more per-DB monomorphization. The @hasDecl pattern for optional DB methods is eliminated entirely. The one remaining optional capability (hasNonZeroStorageForAddress for CREATE collision detection) lives in the Database vtable as a nullable fn ptr. Also fixes phantom BAL entries at the opcode level: CALL now uses a worst-case getCallGasCost pre-check (assumes account non-existent) before loading the target, EXTCODECOPY moves all gas charges before codeInfo(), SELFDESTRUCT adds a worst-case pre-check before h.selfdestruct(), and CREATE moves the Amsterdam balance check before js.loadAccount(new_addr). untrackAddress/forceTrackAddress and bal_untracked are fully removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b35bd08 commit 67605de

19 files changed

+917
-977
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.DefaultContext.new(db, primitives.SpecId.prague);
21+
var ctx = context.DefaultContext.new(database.Database.forDb(database.InMemoryDB, &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)