Skip to content

Commit 6070f6f

Browse files
committed
fix: poststate parsing
1 parent bcacc70 commit 6070f6f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

specs/runner.zig

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,23 @@ pub fn runJsonTest(allocator: std.mem.Allocator, test_case: std.json.Value) !voi
312312
}
313313

314314
// Validate post-state
315-
if (test_case.object.get("post")) |post| {
316-
if (post == .object) {
317-
var it = post.object.iterator();
315+
// Post structure: { "Prague": [ { "state": { "0x...": {...} } } ] }
316+
// Extract state directly from post.Prague[0].state
317+
const post_state = blk: {
318+
const post = test_case.object.get("post") orelse break :blk null;
319+
if (post != .object) break :blk null;
320+
321+
// TODO: when we run on specific hardforks don't hardcode that
322+
const prague = post.object.get("Prague") orelse break :blk null;
323+
if (prague != .array or prague.array.items.len == 0) break :blk null;
324+
325+
const expectation = prague.array.items[0];
326+
break :blk expectation.object.get("state");
327+
};
328+
329+
if (post_state) |state| {
330+
if (state == .object) {
331+
var it = state.object.iterator();
318332
while (it.next()) |kv| {
319333
const address = try parseAddress(kv.key_ptr.*);
320334
const expected = kv.value_ptr.*;

0 commit comments

Comments
 (0)