Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accounts-db: snapshot utils + hash verification #47

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 58 additions & 38 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -123,43 +123,63 @@ pub fn build(b: *std.Build) void {
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);

// gossip fuzz testing
// find ./zig-cache/o/* | grep fuzz
// lldb $(above path)
const fuzz_exe = b.addExecutable(.{
.name = "fuzz",
.root_source_file = .{ .path = "src/gossip/fuzz.zig" },
.target = target,
.optimize = optimize,
.main_pkg_path = .{ .path = "src" },
});
fuzz_exe.addModule("base58-zig", base58_module);
fuzz_exe.addModule("zig-network", zig_network_module);
fuzz_exe.addModule("zig-cli", zig_cli_module);
fuzz_exe.addModule("getty", getty_mod);
b.installArtifact(fuzz_exe);
const fuzz_cmd = b.addRunArtifact(fuzz_exe);
b.step("fuzz_gossip", "fuzz gossip").dependOn(&fuzz_cmd.step);

// benchmarking
const benchmark_exe = b.addExecutable(.{
.name = "benchmark",
.root_source_file = .{ .path = "src/benchmarks.zig" },
.target = target,
// TODO: make it work
// .optimize = std.builtin.Mode.ReleaseSafe, // to get decent results - but things get optimized away
.optimize = optimize,
.main_pkg_path = .{ .path = "src" },
});
benchmark_exe.addModule("base58-zig", base58_module);
benchmark_exe.addModule("zig-network", zig_network_module);
benchmark_exe.addModule("zig-cli", zig_cli_module);
benchmark_exe.addModule("getty", getty_mod);
b.installArtifact(benchmark_exe);
const benchmark_cmd = b.addRunArtifact(benchmark_exe);
if (b.args) |args| {
benchmark_cmd.addArgs(args);
const ExecCommand = struct {
name: []const u8,
path: []const u8,
description: []const u8 = "",
};

const exec_commands = [_]ExecCommand{
ExecCommand {
.name = "fuzz",
.path = "src/gossip/fuzz.zig",
.description = "gossip fuzz testing",
},
ExecCommand {
.name = "benchmark",
.path = "src/benchmarks.zig",
.description = "benchmark client",
},
ExecCommand {
.name = "snapshot_utils",
.path = "src/cmd/snapshot_utils.zig",
.description = "snapshot utils",
},
ExecCommand {
.name = "snapshot_verify",
.path = "src/cmd/snapshot_verify.zig",
.description = "verify snapshot account hashes",
},
// tmp :: remove when done with
ExecCommand {
.name = "accounts",
.path = "src/core/accounts_db.zig",
.description = "tmp file",
},
};

for (exec_commands) |command_info| {
const exec = b.addExecutable(.{
.name = command_info.name,
.root_source_file = .{ .path = command_info.path },
.target = target,
.optimize = optimize,
.main_pkg_path = .{ .path = "src" },
});

// TODO: maybe we dont need all these for all bins
exec.addModule("base58-zig", base58_module);
exec.addModule("zig-network", zig_network_module);
exec.addModule("zig-cli", zig_cli_module);
exec.addModule("getty", getty_mod);

// this lets us run it as an exec
b.installArtifact(exec);

const cmd = b.addRunArtifact(exec);
if (b.args) |args| cmd.addArgs(args);
b
.step(command_info.name, command_info.description)
.dependOn(&cmd.step);
}

b.step("benchmark", "benchmark gossip").dependOn(&benchmark_cmd.step);
}
Loading