Skip to content

Commit

Permalink
Merge pull request #83 from firedancer-io/mjain/remove-rent-epoch
Browse files Browse the repository at this point in the history
Add rent epoch to transaction diffing
  • Loading branch information
mjain-jump authored Sep 10, 2024
2 parents f7a6955 + cf3352f commit 20fd030
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
20 changes: 10 additions & 10 deletions commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ $ solana-test-suite create-fixtures [OPTIONS]
**Options**:

* `-i, --input-dir PATH`: Either a file or directory containing InstrContext messages [default: corpus8]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /home/kbhargava/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have sol_compat_instr_execute_v1 defined [default: /home/kbhargava/repos/firedancer/build/native/gcc/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 (pairs with --keep-passing). Targets must have sol_compat_instr_execute_v1 defined
* `-o, --output-dir PATH`: Output directory for fixtures [default: test_fixtures]
* `-p, --num-processes INTEGER`: Number of processes to use [default: 4]
* `-r, --readable`: Output fixtures in human-readable format
Expand Down Expand Up @@ -80,12 +80,12 @@ $ solana-test-suite debug-mismatches [OPTIONS]

**Options**:

* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /home/kbhargava/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have sol_compat_instr_execute_v1 defined [default: /home/kbhargava/repos/firedancer/build/native/gcc/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 (pairs with --keep-passing). Targets must have sol_compat_instr_execute_v1 defined [default: impl/lib/libsolfuzz_firedancer.so]
* `-o, --output-dir PATH`: Output directory for InstrContext messages [default: debug_mismatch]
* `-u, --repro-urls TEXT`: Comma-delimited list of FuzzCorp mismatch links
* `-s, --section-names TEXT`: Comma-delimited list of FuzzCorp section names
* `-f, --fuzzcorp-url TEXT`: Comma-delimited list of FuzzCorp section names [default: https://api.dev.fuzzcorp.asymmetric.re/uglyweb/firedancer-io/solfuzz/bugs/]
* `-f, --fuzzcorp-url TEXT`: Comma-delimited list of FuzzCorp section names
* `--help`: Show this message and exit.

## `solana-test-suite debug-non-repros`
Expand All @@ -102,12 +102,12 @@ $ solana-test-suite debug-non-repros [OPTIONS]

**Options**:

* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /home/kbhargava/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-t, --target PATH`: Shared object (.so) target file paths (pairs with --keep-passing). Targets must have sol_compat_instr_execute_v1 defined [default: /home/kbhargava/repos/firedancer/build/native/gcc/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 (pairs with --keep-passing). Targets must have sol_compat_instr_execute_v1 defined [default: impl/lib/libsolfuzz_firedancer.so]
* `-o, --output-dir PATH`: Output directory for InstrContext messages [default: debug_mismatch]
* `-u, --repro-urls TEXT`: Comma-delimited list of FuzzCorp mismatch links
* `-s, --section-names TEXT`: Comma-delimited list of FuzzCorp section names
* `-f, --fuzzcorp-url TEXT`: Comma-delimited list of FuzzCorp section names [default: https://api.dev.fuzzcorp.asymmetric.re/uglyweb/firedancer-io/solfuzz/bugs/]
* `-f, --fuzzcorp-url TEXT`: Comma-delimited list of FuzzCorp section names
* `--help`: Show this message and exit.

## `solana-test-suite decode-protobuf`
Expand Down Expand Up @@ -191,8 +191,8 @@ $ solana-test-suite run-tests [OPTIONS]
**Options**:

* `-i, --input PATH`: Single input file or input directory containing InstrContext or InstrFixture messages [default: corpus8]
* `-s, --solana-target PATH`: Solana (or ground truth) shared object (.so) target file path [default: /home/kbhargava/repos/solfuzz-agave/target/release/libsolfuzz_agave.so]
* `-t, --target PATH`: Shared object (.so) target file paths [default: /home/kbhargava/repos/firedancer/build/native/gcc/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
7 changes: 6 additions & 1 deletion src/test_suite/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import time

"""
Harness options:
Expand Down Expand Up @@ -86,7 +87,11 @@ def exec_instr(

# Execute and cleanup
context = serialize_context(file)
start = time.time()
effects = process_target(lib, context)
end = time.time()

print(f"Total time taken for {file}: {(end - start) * 1000} ms\n------------")

if not effects:
print(f"No {globals.harness_ctx.effects_type.__name__} returned")
Expand Down Expand Up @@ -201,7 +206,7 @@ def create_fixtures(
help="Solana (or ground truth) shared object (.so) target file path",
),
shared_libraries: List[Path] = typer.Option(
[Path(os.getenv("FIREDANCER_TARGET", "impl/lib/libsolfuzz_firedancer.so"))],
[],
"--target",
"-t",
help="Shared object (.so) target file paths (pairs with --keep-passing)."
Expand Down
14 changes: 0 additions & 14 deletions src/test_suite/txn/diff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ def txn_diff_effects(a: txn_pb.TxnResult, b: txn_pb.TxnResult):
b_san = txn_pb.TxnResult()
b_san.CopyFrom(b)

# Don't compare rent epochs
for i in range(len(a_san.resulting_state.acct_states)):
a_san.resulting_state.acct_states[i].rent_epoch = 0

for i in range(len(b_san.resulting_state.acct_states)):
b_san.resulting_state.acct_states[i].rent_epoch = 0

# Don't compare compute units if both txns were executed and fail
if a_san.executed and b_san.executed and a_san.status and b_san.status:
a_san.executed_units = 0
Expand All @@ -28,13 +21,6 @@ def consensus_txn_diff_effects(a: txn_pb.TxnResult, b: txn_pb.TxnResult):
b_san = txn_pb.TxnResult()
b_san.CopyFrom(b)

# Don't compare rent epochs
for i in range(len(a_san.resulting_state.acct_states)):
a_san.resulting_state.acct_states[i].rent_epoch = 0

for i in range(len(b_san.resulting_state.acct_states)):
b_san.resulting_state.acct_states[i].rent_epoch = 0

# Don't compare transaction statuses and compute units if both txns were executed and fail
if a_san.executed and b_san.executed and a_san.status and b_san.status:
a_san.executed_units = 0
Expand Down

0 comments on commit 20fd030

Please sign in to comment.