Skip to content

Commit 576a824

Browse files
committed
Emit better balance diffs when comparing accounts
Instead of emitting expected - actual, emit actual - expected. Rationale (by @veox): > For example, as things stand, if a fixture-expected value is 1000, and > the actual produced by py-evm is 500, the printed message will show a > delta of 500 - that is, a net positive, whereas what truly happened is > py-evm having produced a value that's too low. This is confusing: say, a > miner's account balance showing "Delta: 500" makes one think that the > miner received 500 wei more than expected (which is not true). Reference: - ethereum#1181 (comment) - ethereum#1573 (comment)
1 parent 5055f5b commit 576a824

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

eth/tools/fixtures/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def verify_account_db(expected_state: AccountState, account_db: BaseAccountDB) -
7878
'balance',
7979
actual_value,
8080
expected_value,
81-
expected_value - actual_value,
81+
actual_value - expected_value,
8282
)
8383
)
8484
else:

0 commit comments

Comments
 (0)