Skip to content

Commit

Permalink
Emit better balance diffs when comparing accounts
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
lithp committed Dec 12, 2018
1 parent 5055f5b commit 576a824
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eth/tools/fixtures/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def verify_account_db(expected_state: AccountState, account_db: BaseAccountDB) -
'balance',
actual_value,
expected_value,
expected_value - actual_value,
actual_value - expected_value,
)
)
else:
Expand Down

0 comments on commit 576a824

Please sign in to comment.