Skip to content

Commit

Permalink
Updated definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
mjain-jump committed Jan 8, 2025
1 parent 8f28470 commit 01b050a
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 64 deletions.
20 changes: 10 additions & 10 deletions commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ $ solana-test-suite create-env [OPTIONS]

**Options**:

* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /data/mjain/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: impl/lib/libsolfuzz_agave_v2.0.so]
* `-h, --default-harness-type TEXT`: Harness type to use for Context protobufs [default: InstrHarness]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have required function entrypoints defined [default: /data/mjain/repos/firedancer/build/native/clang/lib/libfd_exec_sol_compat.so]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have required function entrypoints defined [default: impl/lib/libsolfuzz_firedancer.so]
* `-o, --output-dir PATH`: Output directory for messages [default: debug_mismatch]
* `-u, --repro-urls TEXT`: Comma-delimited list of FuzzCorp mismatch links
* `-n, --section-names TEXT`: Comma-delimited list of FuzzCorp section names
Expand Down Expand Up @@ -72,7 +72,7 @@ $ solana-test-suite create-fixtures [OPTIONS]

* `-i, --input PATH`: Input protobuf file or directory of protobuf files [default: corpus8]
* `-h, --default-harness-type TEXT`: Harness type to use for Context protobufs [default: InstrHarness]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /data/mjain/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: impl/lib/libsolfuzz_agave_v2.0.so]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have required function entrypoints defined
* `-o, --output-dir PATH`: Output directory for fixtures [default: test_fixtures]
* `-p, --num-processes INTEGER`: Number of processes to use [default: 4]
Expand All @@ -96,9 +96,9 @@ $ solana-test-suite debug-mismatches [OPTIONS]

**Options**:

* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /data/mjain/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: impl/lib/libsolfuzz_agave_v2.0.so]
* `-h, --default-harness-type TEXT`: Harness type to use for Context protobufs [default: InstrHarness]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have required function entrypoints defined [default: /data/mjain/repos/firedancer/build/native/clang/lib/libfd_exec_sol_compat.so]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have required function entrypoints defined [default: impl/lib/libsolfuzz_firedancer.so]
* `-o, --output-dir PATH`: Output directory for messages [default: debug_mismatch]
* `-u, --repro-urls TEXT`: Comma-delimited list of FuzzCorp mismatch links
* `-n, --section-names TEXT`: Comma-delimited list of FuzzCorp section names
Expand Down Expand Up @@ -211,8 +211,8 @@ $ solana-test-suite mass-regenerate-fixtures [OPTIONS]

* `-i, --input PATH`: Input test-vectors directory [default: corpus8]
* `-o, --output-dir PATH`: Output directory for regenerated fixtures [default: /tmp/regenerated_fixtures]
* `-t, --target PATH`: Shared object (.so) target file path to execute [default: /data/mjain/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-s, --stubbed-target PATH`: Stubbed shared object (.so) target file path to execute [default: /data/mjain/repos/solfuzz-agave/target/debug/libsolfuzz_agave_stubbed.so]
* `-t, --target PATH`: Shared object (.so) target file path to execute [default: impl/lib/libsolfuzz_agave_v2.0.so]
* `-s, --stubbed-target PATH`: Stubbed shared object (.so) target file path to execute [default: impl/lib/libsolfuzz_firedancer.so]
* `-f, --add-feature TEXT`: List of feature pubkeys to force add to the fixtures.
* `-r, --remove-feature TEXT`: List of feature pubkeys to force remove from the fixtures.
* `-k, --rekey-feature TEXT`: List of feature pubkeys to rekey in the fixtures, formatted 'old/new' (e.g. `--rekey-feature old/new`).
Expand All @@ -233,7 +233,7 @@ $ solana-test-suite regenerate-fixtures [OPTIONS]
**Options**:

* `-i, --input PATH`: Either a file or directory containing messages [default: corpus8]
* `-t, --target PATH`: Shared object (.so) target file path to execute [default: /data/mjain/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-t, --target PATH`: Shared object (.so) target file path to execute [default: impl/lib/libsolfuzz_agave_v2.0.so]
* `-o, --output-dir PATH`: Output directory for regenerated fixtures [default: regenerated_fixtures]
* `-d, --dry-run`: Only print the fixtures that would be regenerated
* `-f, --add-feature TEXT`: List of feature pubkeys to force add to the fixtures.
Expand All @@ -260,8 +260,8 @@ $ solana-test-suite run-tests [OPTIONS]

* `-i, --input PATH`: Input protobuf file or directory of protobuf files [default: corpus8]
* `-h, --default-harness-type TEXT`: Harness type to use for Context protobufs [default: InstrHarness]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /data/mjain/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-t, --target PATH`: Shared object (.so) target file paths [default: /data/mjain/repos/firedancer/build/native/clang/lib/libfd_exec_sol_compat.so]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: impl/lib/libsolfuzz_agave_v2.0.so]
* `-t, --target PATH`: Shared object (.so) target file paths [default: impl/lib/libsolfuzz_firedancer.so]
* `-o, --output-dir PATH`: Output directory for test results [default: test_results]
* `-p, --num-processes INTEGER`: Number of processes to use [default: 4]
* `-r, --randomize-output-buffer`: Randomizes bytes in output buffer before shared library execution
Expand Down
10 changes: 6 additions & 4 deletions src/test_suite/block/codec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def decode_input(context: block_pb.BlockContext):
if context.program_id:
context.program_id = fd58.dec32(context.program_id)

for i in range(len(context.txns)):
decode_sanitized_tx(context.txns[i])
for i in range(len(context.microblocks)):
for j in range(len(context.microblocks[i].txns)):
decode_sanitized_tx(context.microblocks[i].txns[j])

for i in range(len(context.acct_states)):
decode_acct_state(context.acct_states[i])
Expand All @@ -34,8 +35,9 @@ def encode_input(context: block_pb.BlockContext):
Args:
- context (block_pb.BlockContext): Instruction context (will be modified).
"""
for i in range(len(context.txns)):
encode_sanitized_tx(context.txns[i])
for i in range(len(context.microblocks)):
for j in range(len(context.microblocks[i].txns)):
encode_sanitized_tx(context.microblocks[i].txns[j])

for i in range(len(context.acct_states)):
encode_acct_state(context.acct_states[i])
Expand Down
101 changes: 82 additions & 19 deletions src/test_suite/block_pb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,51 @@
package="org.solana.sealevel.v1",
syntax="proto3",
serialized_pb=_b(
'\n\x0bblock.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto\x1a\ttxn.proto\x1a\x0emetadata.proto"\x8b\x02\n\x0cBlockContext\x12:\n\x04txns\x18\x01 \x03(\x0b2,.org.solana.sealevel.v1.SanitizedTransaction\x126\n\x0bacct_states\x18\x02 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x17\n\x0fblockhash_queue\x18\x03 \x03(\x0c\x125\n\x08slot_ctx\x18\x04 \x01(\x0b2#.org.solana.sealevel.v1.SlotContext\x127\n\tepoch_ctx\x18\x05 \x01(\x0b2$.org.solana.sealevel.v1.EpochContext"¥\x01\n\x0cBlockEffects\x12\x13\n\x0bfirst_error\x18\x01 \x01(\r\x126\n\x0bacct_states\x18\x02 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x1b\n\x13slot_capitalization\x18\x03 \x01(\x04\x12\x0f\n\x07lt_hash\x18\x04 \x01(\x0c\x12\x1a\n\x12account_delta_hash\x18\x05 \x01(\x0c\x01\n\x0cBlockFixture\x129\n\x08metadata\x18\x01 \x01(\x0b2\'.org.solana.sealevel.v1.FixtureMetadata\x123\n\x05input\x18\x02 \x01(\x0b2$.org.solana.sealevel.v1.BlockContext\x124\n\x06output\x18\x03 \x01(\x0b2$.org.solana.sealevel.v1.BlockEffectsb\x06proto3'
'\n\x0bblock.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto\x1a\ttxn.proto\x1a\x0emetadata.proto"H\n\nMicroblock\x12:\n\x04txns\x18\x01 \x03(\x0b2,.org.solana.sealevel.v1.SanitizedTransaction"\x88\x02\n\x0cBlockContext\x127\n\x0bmicroblocks\x18\x01 \x03(\x0b2".org.solana.sealevel.v1.Microblock\x126\n\x0bacct_states\x18\x02 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x17\n\x0fblockhash_queue\x18\x03 \x03(\x0c\x125\n\x08slot_ctx\x18\x04 \x01(\x0b2#.org.solana.sealevel.v1.SlotContext\x127\n\tepoch_ctx\x18\x05 \x01(\x0b2$.org.solana.sealevel.v1.EpochContext"¶\x01\n\x0cBlockEffects\x12\x11\n\thas_error\x18\x01 \x01(\x08\x126\n\x0bacct_states\x18\x02 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x1b\n\x13slot_capitalization\x18\x03 \x01(\x04\x12\x11\n\tbank_hash\x18\x04 \x01(\x0c\x12\x0f\n\x07lt_hash\x18\x05 \x01(\x0c\x12\x1a\n\x12account_delta_hash\x18\x06 \x01(\x0c\x01\n\x0cBlockFixture\x129\n\x08metadata\x18\x01 \x01(\x0b2\'.org.solana.sealevel.v1.FixtureMetadata\x123\n\x05input\x18\x02 \x01(\x0b2$.org.solana.sealevel.v1.BlockContext\x124\n\x06output\x18\x03 \x01(\x0b2$.org.solana.sealevel.v1.BlockEffectsb\x06proto3'
),
dependencies=[
context__pb2.DESCRIPTOR,
txn__pb2.DESCRIPTOR,
metadata__pb2.DESCRIPTOR,
],
)
_MICROBLOCK = _descriptor.Descriptor(
name="Microblock",
full_name="org.solana.sealevel.v1.Microblock",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="txns",
full_name="org.solana.sealevel.v1.Microblock.txns",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
file=DESCRIPTOR,
)
],
extensions=[],
nested_types=[],
enum_types=[],
options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=81,
serialized_end=153,
)
_BLOCKCONTEXT = _descriptor.Descriptor(
name="BlockContext",
full_name="org.solana.sealevel.v1.BlockContext",
Expand All @@ -33,8 +70,8 @@
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="txns",
full_name="org.solana.sealevel.v1.BlockContext.txns",
name="microblocks",
full_name="org.solana.sealevel.v1.BlockContext.microblocks",
index=0,
number=1,
type=11,
Expand Down Expand Up @@ -131,8 +168,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=82,
serialized_end=349,
serialized_start=156,
serialized_end=420,
)
_BLOCKEFFECTS = _descriptor.Descriptor(
name="BlockEffects",
Expand All @@ -142,15 +179,15 @@
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="first_error",
full_name="org.solana.sealevel.v1.BlockEffects.first_error",
name="has_error",
full_name="org.solana.sealevel.v1.BlockEffects.has_error",
index=0,
number=1,
type=13,
cpp_type=3,
type=8,
cpp_type=7,
label=1,
has_default_value=False,
default_value=0,
default_value=False,
message_type=None,
enum_type=None,
containing_type=None,
Expand Down Expand Up @@ -196,8 +233,8 @@
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="lt_hash",
full_name="org.solana.sealevel.v1.BlockEffects.lt_hash",
name="bank_hash",
full_name="org.solana.sealevel.v1.BlockEffects.bank_hash",
index=3,
number=4,
type=12,
Expand All @@ -214,8 +251,8 @@
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="account_delta_hash",
full_name="org.solana.sealevel.v1.BlockEffects.account_delta_hash",
name="lt_hash",
full_name="org.solana.sealevel.v1.BlockEffects.lt_hash",
index=4,
number=5,
type=12,
Expand All @@ -231,6 +268,24 @@
options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="account_delta_hash",
full_name="org.solana.sealevel.v1.BlockEffects.account_delta_hash",
index=5,
number=6,
type=12,
cpp_type=9,
label=1,
has_default_value=False,
default_value=_b(""),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
file=DESCRIPTOR,
),
],
extensions=[],
nested_types=[],
Expand All @@ -240,8 +295,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=352,
serialized_end=517,
serialized_start=423,
serialized_end=605,
)
_BLOCKFIXTURE = _descriptor.Descriptor(
name="BlockFixture",
Expand Down Expand Up @@ -313,21 +368,29 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=520,
serialized_end=700,
serialized_start=608,
serialized_end=788,
)
_BLOCKCONTEXT.fields_by_name["txns"].message_type = txn__pb2._SANITIZEDTRANSACTION
_MICROBLOCK.fields_by_name["txns"].message_type = txn__pb2._SANITIZEDTRANSACTION
_BLOCKCONTEXT.fields_by_name["microblocks"].message_type = _MICROBLOCK
_BLOCKCONTEXT.fields_by_name["acct_states"].message_type = context__pb2._ACCTSTATE
_BLOCKCONTEXT.fields_by_name["slot_ctx"].message_type = context__pb2._SLOTCONTEXT
_BLOCKCONTEXT.fields_by_name["epoch_ctx"].message_type = context__pb2._EPOCHCONTEXT
_BLOCKEFFECTS.fields_by_name["acct_states"].message_type = context__pb2._ACCTSTATE
_BLOCKFIXTURE.fields_by_name["metadata"].message_type = metadata__pb2._FIXTUREMETADATA
_BLOCKFIXTURE.fields_by_name["input"].message_type = _BLOCKCONTEXT
_BLOCKFIXTURE.fields_by_name["output"].message_type = _BLOCKEFFECTS
DESCRIPTOR.message_types_by_name["Microblock"] = _MICROBLOCK
DESCRIPTOR.message_types_by_name["BlockContext"] = _BLOCKCONTEXT
DESCRIPTOR.message_types_by_name["BlockEffects"] = _BLOCKEFFECTS
DESCRIPTOR.message_types_by_name["BlockFixture"] = _BLOCKFIXTURE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Microblock = _reflection.GeneratedProtocolMessageType(
"Microblock",
(_message.Message,),
dict(DESCRIPTOR=_MICROBLOCK, __module__="block_pb2"),
)
_sym_db.RegisterMessage(Microblock)
BlockContext = _reflection.GeneratedProtocolMessageType(
"BlockContext",
(_message.Message,),
Expand Down
Loading

0 comments on commit 01b050a

Please sign in to comment.