Skip to content

Commit

Permalink
Fix getting transaction hash from competition data (#123)
Browse files Browse the repository at this point in the history
This PR changes how transaction hashes are fetched from competition
data.

To support multiple winners, the competition data format was changed to
allow for multiple transactions to be associated to an auction. This
meant, that instead of a `"transactionHash"` field containing a string,
a `"transactionHashes"` field containing a vector of strings is stored.
This PR, changes the code to use the new convention.
  • Loading branch information
fhenneke authored Oct 22, 2024
1 parent 7677080 commit 213dd6d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/monitoring_tests/combinatorial_auction_surplus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run_combinatorial_auction(self, competition_data: dict[str, Any]) -> bool:
log_output = "\t".join(
[
"Combinatorial auction surplus test:",
f"Tx Hash: {competition_data['transactionHash']}",
f"Tx Hash: {competition_data['transactionHashes'][0]}",
f"Winning Solver: {competition_data['solutions'][-1]['solver']}",
f"Winning surplus: {self.convert_fractions_to_floats(aggregate_solutions[-1])}",
f"Baseline surplus: {self.convert_fractions_to_floats(baseline_surplus)}",
Expand Down
2 changes: 1 addition & 1 deletion src/monitoring_tests/high_score_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def compute_winning_score(self, competition_data: dict[str, Any]) -> bool:
log_output = "\t".join(
[
"Large score test:",
f"Tx Hash: {competition_data['transactionHash']}",
f"Tx Hash: {competition_data['transactionHashes'][0]}",
f"Winning Solver: {solution['solver']}",
f"Score in ETH: {score}",
]
Expand Down
4 changes: 2 additions & 2 deletions src/monitoring_tests/reference_solver_surplus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def compare_orders_surplus(
log_output = "\t".join(
[
"Reference solver surplus test:",
f"Tx Hash: {competition_data['transactionHash']}",
f"Tx Hash: {competition_data['transactionHashes'][0]}",
f"Order UID: {uid}",
f"Winning Solver: {solution['solver']}",
"Solver providing more surplus: Reference solver",
Expand All @@ -85,7 +85,7 @@ def compare_orders_surplus(
)
ref_solver_log = "\t".join(
[
f"Tx Hash: {competition_data['transactionHash']}",
f"Tx Hash: {competition_data['transactionHashes'][0]}",
f"Order UID: {uid}",
f"Solution providing more surplus: {ref_solver_response}",
]
Expand Down
2 changes: 1 addition & 1 deletion src/monitoring_tests/solver_competition_surplus_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def compare_orders_surplus(self, competition_data: dict[str, Any]) -> bool:
log_output = "\t".join(
[
"Solver competition surplus test:",
f"Tx Hash: {competition_data['transactionHash']}",
f"Tx Hash: {competition_data['transactionHashes'][0]}",
f"Order UID: {uid}",
f"Winning Solver: {solution['solver']}",
f"Solver providing more surplus: {solver_alt}",
Expand Down
2 changes: 1 addition & 1 deletion src/monitoring_tests/uniform_directed_prices_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def check_udp(self, competition_data: dict[str, Any]) -> bool:
log_output = "\t".join(
[
"Uniform Directed Prices test:",
f"Tx Hash: {competition_data['transactionHash']}",
f"Tx Hash: {competition_data['transactionHashes'][0]}",
f"Winning Solver: {solution['solver']}",
f"Token pair: {pair}",
f"Directional prices: {[float(p) for p in prices_list]}",
Expand Down

0 comments on commit 213dd6d

Please sign in to comment.