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

feat(svm): initial sbfv1 virtual machine #478

Merged
merged 19 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 17 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
16 changes: 16 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn build(b: *Build) void {
const fuzz_step = b.step("fuzz", "Gossip fuzz testing");
const benchmark_step = b.step("benchmark", "Benchmark client");
const geyser_reader_step = b.step("geyser_reader", "Read data from geyser");
const svm_step = b.step("svm", "Run the SVM client");

// Dependencies
const dep_opts = .{ .target = target, .optimize = optimize };
Expand Down Expand Up @@ -211,6 +212,21 @@ pub fn build(b: *Build) void {
geyser_reader_exe_run.addArgs(b.args orelse &.{});
if (!no_run) geyser_reader_step.dependOn(&geyser_reader_exe_run.step);
if (no_run) geyser_reader_step.dependOn(&b.addInstallArtifact(geyser_reader_exe, .{}).step);

const svm_exe = b.addExecutable(.{
.name = "svm",
.root_source_file = b.path("src/svm/main.zig"),
.target = target,
.optimize = optimize,
.sanitize_thread = enable_tsan,
});
b.installArtifact(svm_exe);
svm_exe.root_module.addImport("sig", sig_mod);

const svm_exe_run = b.addRunArtifact(svm_exe);
svm_exe_run.addArgs(b.args orelse &.{});
if (!no_run) svm_step.dependOn(&svm_exe_run.step);
if (no_run) svm_step.dependOn(&b.addInstallArtifact(svm_exe, .{}).step);
}

const BlockstoreDB = enum {
Expand Down
Binary file added data/test-elfs/reloc_64_64_sbpfv1.so
dnut marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
Binary file added data/test-elfs/reloc_64_relative_data_sbpfv1.so
Binary file not shown.
Binary file added data/test-elfs/reloc_64_relative_sbpfv1.so
Binary file not shown.
Binary file added data/test-elfs/rodata_section_sbpfv1.so
Binary file not shown.
Binary file added data/test-elfs/static_internal_call_sbpfv1.so
Binary file not shown.
Binary file added data/test-elfs/syscall_reloc_64_32.so
Binary file not shown.
6 changes: 2 additions & 4 deletions src/geyser/core.zig
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,13 @@ test "streaming accounts" {
pubkeys[i] = Pubkey.initRandom(random);
}

const exit = try allocator.create(std.atomic.Value(bool));
defer allocator.destroy(exit);
exit.* = std.atomic.Value(bool).init(false);
var exit = std.atomic.Value(bool).init(false);

// setup writer
var stream_writer = try GeyserWriter.init(
allocator,
sig.TEST_DATA_DIR ++ "stream_test.pipe",
exit,
&exit,
1 << 18,
);
defer stream_writer.deinit();
Expand Down
4 changes: 3 additions & 1 deletion src/sig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ pub const prometheus = @import("prometheus/lib.zig");
pub const rand = @import("rand/rand.zig");
pub const rpc = @import("rpc/lib.zig");
pub const shred_network = @import("shred_network/lib.zig");
pub const svm = @import("svm/lib.zig");
pub const sync = @import("sync/lib.zig");
pub const trace = @import("trace/lib.zig");
pub const time = @import("time/lib.zig");
pub const trace = @import("trace/lib.zig");
pub const transaction_sender = @import("transaction_sender/lib.zig");
pub const utils = @import("utils/lib.zig");
pub const version = @import("version/version.zig");
Expand All @@ -31,6 +32,7 @@ pub const TEST_STATE_DIR = "data/test-state/";
pub const FUZZ_DATA_DIR = "data/fuzz-data/";
pub const BENCHMARK_RESULTS_DIR = "results/";
pub const GENESIS_DIR = "data/genesis-files/";
pub const ELF_DATA_DIR = "data/test-elfs/";

comptime {
// sig's global assertions/assumptions
Expand Down
Loading
Loading