Skip to content

Commit

Permalink
Merge pull request #77 from firedancer-io:cpi-harness
Browse files Browse the repository at this point in the history
CPI Harness
  • Loading branch information
ravyu-jump authored Sep 6, 2024
2 parents 768a07a + b185a39 commit d9e3bd9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/test_suite/fuzz_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
effects_human_encode_fn=syscall_codec.encode_output,
)

CPIHarness = HarnessCtx(
fuzz_fn_name="sol_compat_vm_cpi_syscall_v1",
fixture_desc=vm_pb.SyscallFixture.DESCRIPTOR,
effects_human_encode_fn=syscall_codec.encode_output,
)

ValidateVM = HarnessCtx(
fuzz_fn_name="sol_compat_vm_validate_v1",
fixture_desc=vm_pb.ValidateVmFixture.DESCRIPTOR,
Expand Down
43 changes: 31 additions & 12 deletions src/test_suite/vm_pb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package="org.solana.sealevel.v1",
syntax="proto3",
serialized_pb=_b(
'\n\x08vm.proto\x12\x16org.solana.sealevel.v1\x1a\x0cinvoke.proto\x1a\rcontext.proto"G\n\x0fInputDataRegion\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x0f\n\x07content\x18\x02 \x01(\x0c\x12\x13\n\x0bis_writable\x18\x03 \x01(\x08\x03\n\tVmContext\x12\x10\n\x08heap_max\x18\x01 \x01(\x04\x12\x0e\n\x06rodata\x18\x02 \x01(\x0c\x12"\n\x1arodata_text_section_offset\x18\x03 \x01(\x04\x12"\n\x1arodata_text_section_length\x18\x04 \x01(\x04\x12C\n\x12input_data_regions\x18\x05 \x03(\x0b2\'.org.solana.sealevel.v1.InputDataRegion\x12\n\n\x02r0\x18\x06 \x01(\x04\x12\n\n\x02r1\x18\x07 \x01(\x04\x12\n\n\x02r2\x18\x08 \x01(\x04\x12\n\n\x02r3\x18\t \x01(\x04\x12\n\n\x02r4\x18\n \x01(\x04\x12\n\n\x02r5\x18\x0b \x01(\x04\x12\n\n\x02r6\x18\x0c \x01(\x04\x12\n\n\x02r7\x18\r \x01(\x04\x12\n\n\x02r8\x18\x0e \x01(\x04\x12\n\n\x02r9\x18\x0f \x01(\x04\x12\x0b\n\x03r10\x18\x10 \x01(\x04\x12\x0b\n\x03r11\x18\x11 \x01(\x04\x12\x13\n\x0bcheck_align\x18\x12 \x01(\x08\x12\x12\n\ncheck_size\x18\x13 \x01(\x08\x12\x10\n\x08entry_pc\x18\x14 \x01(\x04\x12\x16\n\x0ecall_whitelist\x18\x15 \x01(\x0c\x12\x17\n\x0ftracing_enabled\x18\x16 \x01(\x08"U\n\x11SyscallInvocation\x12\x15\n\rfunction_name\x18\x01 \x01(\x0c\x12\x13\n\x0bheap_prefix\x18\x02 \x01(\x0c\x12\x14\n\x0cstack_prefix\x18\x03 \x01(\x0c\x01\n\x0eSyscallContext\x121\n\x06vm_ctx\x18\x01 \x01(\x0b2!.org.solana.sealevel.v1.VmContext\x127\n\tinstr_ctx\x18\x02 \x01(\x0b2$.org.solana.sealevel.v1.InstrContext\x12E\n\x12syscall_invocation\x18\x03 \x01(\x0b2).org.solana.sealevel.v1.SyscallInvocation"ð\x01\n\x0eSyscallEffects\x12\r\n\x05error\x18\x01 \x01(\x03\x12\n\n\x02r0\x18\x02 \x01(\x04\x12\x10\n\x08cu_avail\x18\x03 \x01(\x04\x12\x0c\n\x04heap\x18\x04 \x01(\x0c\x12\r\n\x05stack\x18\x05 \x01(\x0c\x12\x11\n\tinputdata\x18\x06 \x01(\x0c\x12C\n\x12input_data_regions\x18\x0b \x03(\x0b2\'.org.solana.sealevel.v1.InputDataRegion\x12\x13\n\x0bframe_count\x18\x07 \x01(\x04\x12\x0b\n\x03log\x18\x08 \x01(\x0c\x12\x0e\n\x06rodata\x18\t \x01(\x0c\x12\n\n\x02pc\x18\n \x01(\x04"\x7f\n\x0eSyscallFixture\x125\n\x05input\x18\x01 \x01(\x0b2&.org.solana.sealevel.v1.SyscallContext\x126\n\x06output\x18\x02 \x01(\x0b2&.org.solana.sealevel.v1.SyscallEffects"x\n\rFullVmContext\x121\n\x06vm_ctx\x18\x01 \x01(\x0b2!.org.solana.sealevel.v1.VmContext\x124\n\x08features\x18\x03 \x01(\x0b2".org.solana.sealevel.v1.FeatureSet"4\n\x11ValidateVmEffects\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x0f\n\x07success\x18\x02 \x01(\x08"\x84\x01\n\x11ValidateVmFixture\x124\n\x05input\x18\x01 \x01(\x0b2%.org.solana.sealevel.v1.FullVmContext\x129\n\x06output\x18\x02 \x01(\x0b2).org.solana.sealevel.v1.ValidateVmEffectsb\x06proto3'
'\n\x08vm.proto\x12\x16org.solana.sealevel.v1\x1a\x0cinvoke.proto\x1a\rcontext.proto"G\n\x0fInputDataRegion\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x0f\n\x07content\x18\x02 \x01(\x0c\x12\x13\n\x0bis_writable\x18\x03 \x01(\x08\x03\n\tVmContext\x12\x10\n\x08heap_max\x18\x01 \x01(\x04\x12\x0e\n\x06rodata\x18\x02 \x01(\x0c\x12"\n\x1arodata_text_section_offset\x18\x03 \x01(\x04\x12"\n\x1arodata_text_section_length\x18\x04 \x01(\x04\x12C\n\x12input_data_regions\x18\x05 \x03(\x0b2\'.org.solana.sealevel.v1.InputDataRegion\x12\n\n\x02r0\x18\x06 \x01(\x04\x12\n\n\x02r1\x18\x07 \x01(\x04\x12\n\n\x02r2\x18\x08 \x01(\x04\x12\n\n\x02r3\x18\t \x01(\x04\x12\n\n\x02r4\x18\n \x01(\x04\x12\n\n\x02r5\x18\x0b \x01(\x04\x12\n\n\x02r6\x18\x0c \x01(\x04\x12\n\n\x02r7\x18\r \x01(\x04\x12\n\n\x02r8\x18\x0e \x01(\x04\x12\n\n\x02r9\x18\x0f \x01(\x04\x12\x0b\n\x03r10\x18\x10 \x01(\x04\x12\x0b\n\x03r11\x18\x11 \x01(\x04\x12\x13\n\x0bcheck_align\x18\x12 \x01(\x08\x12\x12\n\ncheck_size\x18\x13 \x01(\x08\x12\x10\n\x08entry_pc\x18\x14 \x01(\x04\x12\x16\n\x0ecall_whitelist\x18\x15 \x01(\x0c\x12\x17\n\x0ftracing_enabled\x18\x16 \x01(\x08"U\n\x11SyscallInvocation\x12\x15\n\rfunction_name\x18\x01 \x01(\x0c\x12\x13\n\x0bheap_prefix\x18\x02 \x01(\x0c\x12\x14\n\x0cstack_prefix\x18\x03 \x01(\x0c"ÿ\x01\n\x0eSyscallContext\x121\n\x06vm_ctx\x18\x01 \x01(\x0b2!.org.solana.sealevel.v1.VmContext\x127\n\tinstr_ctx\x18\x02 \x01(\x0b2$.org.solana.sealevel.v1.InstrContext\x12E\n\x12syscall_invocation\x18\x03 \x01(\x0b2).org.solana.sealevel.v1.SyscallInvocation\x12:\n\x0cexec_effects\x18\x04 \x01(\x0b2$.org.solana.sealevel.v1.InstrEffects"ð\x01\n\x0eSyscallEffects\x12\r\n\x05error\x18\x01 \x01(\x03\x12\n\n\x02r0\x18\x02 \x01(\x04\x12\x10\n\x08cu_avail\x18\x03 \x01(\x04\x12\x0c\n\x04heap\x18\x04 \x01(\x0c\x12\r\n\x05stack\x18\x05 \x01(\x0c\x12\x11\n\tinputdata\x18\x06 \x01(\x0c\x12C\n\x12input_data_regions\x18\x0b \x03(\x0b2\'.org.solana.sealevel.v1.InputDataRegion\x12\x13\n\x0bframe_count\x18\x07 \x01(\x04\x12\x0b\n\x03log\x18\x08 \x01(\x0c\x12\x0e\n\x06rodata\x18\t \x01(\x0c\x12\n\n\x02pc\x18\n \x01(\x04"\x7f\n\x0eSyscallFixture\x125\n\x05input\x18\x01 \x01(\x0b2&.org.solana.sealevel.v1.SyscallContext\x126\n\x06output\x18\x02 \x01(\x0b2&.org.solana.sealevel.v1.SyscallEffects"x\n\rFullVmContext\x121\n\x06vm_ctx\x18\x01 \x01(\x0b2!.org.solana.sealevel.v1.VmContext\x124\n\x08features\x18\x03 \x01(\x0b2".org.solana.sealevel.v1.FeatureSet"4\n\x11ValidateVmEffects\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x0f\n\x07success\x18\x02 \x01(\x08"\x84\x01\n\x11ValidateVmFixture\x124\n\x05input\x18\x01 \x01(\x0b2%.org.solana.sealevel.v1.FullVmContext\x129\n\x06output\x18\x02 \x01(\x0b2).org.solana.sealevel.v1.ValidateVmEffectsb\x06proto3'
),
dependencies=[invoke__pb2.DESCRIPTOR, context__pb2.DESCRIPTOR],
)
Expand Down Expand Up @@ -642,6 +642,24 @@
options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="exec_effects",
full_name="org.solana.sealevel.v1.SyscallContext.exec_effects",
index=3,
number=4,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
Expand All @@ -652,7 +670,7 @@
extension_ranges=[],
oneofs=[],
serialized_start=669,
serialized_end=864,
serialized_end=924,
)
_SYSCALLEFFECTS = _descriptor.Descriptor(
name="SyscallEffects",
Expand Down Expand Up @@ -868,8 +886,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=867,
serialized_end=1107,
serialized_start=927,
serialized_end=1167,
)
_SYSCALLFIXTURE = _descriptor.Descriptor(
name="SyscallFixture",
Expand Down Expand Up @@ -923,8 +941,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1109,
serialized_end=1236,
serialized_start=1169,
serialized_end=1296,
)
_FULLVMCONTEXT = _descriptor.Descriptor(
name="FullVmContext",
Expand Down Expand Up @@ -978,8 +996,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1238,
serialized_end=1358,
serialized_start=1298,
serialized_end=1418,
)
_VALIDATEVMEFFECTS = _descriptor.Descriptor(
name="ValidateVmEffects",
Expand Down Expand Up @@ -1033,8 +1051,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1360,
serialized_end=1412,
serialized_start=1420,
serialized_end=1472,
)
_VALIDATEVMFIXTURE = _descriptor.Descriptor(
name="ValidateVmFixture",
Expand Down Expand Up @@ -1088,13 +1106,14 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1415,
serialized_end=1547,
serialized_start=1475,
serialized_end=1607,
)
_VMCONTEXT.fields_by_name["input_data_regions"].message_type = _INPUTDATAREGION
_SYSCALLCONTEXT.fields_by_name["vm_ctx"].message_type = _VMCONTEXT
_SYSCALLCONTEXT.fields_by_name["instr_ctx"].message_type = invoke__pb2._INSTRCONTEXT
_SYSCALLCONTEXT.fields_by_name["syscall_invocation"].message_type = _SYSCALLINVOCATION
_SYSCALLCONTEXT.fields_by_name["exec_effects"].message_type = invoke__pb2._INSTREFFECTS
_SYSCALLEFFECTS.fields_by_name["input_data_regions"].message_type = _INPUTDATAREGION
_SYSCALLFIXTURE.fields_by_name["input"].message_type = _SYSCALLCONTEXT
_SYSCALLFIXTURE.fields_by_name["output"].message_type = _SYSCALLEFFECTS
Expand Down

0 comments on commit d9e3bd9

Please sign in to comment.