From 92c765b35ac505f25b3ba6e4119801f59d7a2463 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 11 Aug 2023 18:19:14 -0300 Subject: [PATCH] rebase and fixes Signed-off-by: Ignacio Hagopian --- build.zig | 11 ++++++++++- src/exec-spec-tests/execspectests.zig | 9 ++++++++- src/vm/vm.zig | 4 ---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index e1a57a3..adff67e 100644 --- a/build.zig +++ b/build.zig @@ -132,7 +132,16 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); - unit_tests.addIncludePath(LazyPath{ .path = "evmone" }); + unit_tests.addIncludePath(LazyPath{ .path = "evmone/include/evmone" }); + unit_tests.addIncludePath(LazyPath{ .path = "evmone/evmc/include" }); + if (target.getCpuArch() == .x86_64) { + // On x86_64, some functions are missing from the static library, + // so we define dummy functions to make sure that it compiles. + unit_tests.addCSourceFile(.{ + .file = .{ .path = "src/glue.c" }, + .flags = &cflags, + }); + } unit_tests.linkLibrary(ethash); unit_tests.linkLibrary(evmone); unit_tests.linkLibC(); diff --git a/src/exec-spec-tests/execspectests.zig b/src/exec-spec-tests/execspectests.zig index 490a9b3..693203a 100644 --- a/src/exec-spec-tests/execspectests.zig +++ b/src/exec-spec-tests/execspectests.zig @@ -206,9 +206,16 @@ test "execution-spec-tests" { defer ft.deinit(); var it = ft.tests.value.map.iterator(); + var count: usize = 0; + while (it.next()) |entry| { log.debug("##### Executing fixture {s} #####", .{entry.key_ptr.*}); try std.testing.expect(try entry.value_ptr.*.run(test_allocator)); - return; // TODO(jsign): only run the first test for now. Then we can enable all and continue with the integration. + count += 1; + + // TODO: Only run the first test for now. Then we can enable all and continue with the integration. + if (count == 1) { + break; + } } } diff --git a/src/vm/vm.zig b/src/vm/vm.zig index 9719032..3d8ce79 100644 --- a/src/vm/vm.zig +++ b/src/vm/vm.zig @@ -34,7 +34,6 @@ const BlockContext = struct { gas_limit: i64, prev_randao: u256, base_fee: u256, - blob_hashes: ?[]const [32]u8, }; pub const VM = struct { @@ -115,7 +114,6 @@ pub const VM = struct { .gas_limit = block.header.gas_limit, .prev_randao = std.mem.readIntSlice(u256, &block.header.prev_randao, std.builtin.Endian.Big), .base_fee = @as(u256, std.mem.readIntSlice(u32, &block.header.base_fee_per_gas, std.builtin.Endian.Big)), - .blob_hashes = null, // TODO }; } @@ -224,8 +222,6 @@ pub const VM = struct { .block_prev_randao = util.to_evmc_bytes32(vm.context.?.block.prev_randao), .chain_id = util.to_evmc_bytes32(vm.context.?.txn.chain_id), .block_base_fee = util.to_evmc_bytes32(vm.context.?.block.base_fee), - .blob_hashes = null, // TODO - .blob_hashes_count = 0, // TODO }; }