From 576a8244bb3edf4c566e126674fdef2143419207 Mon Sep 17 00:00:00 2001 From: Brian Cloutier Date: Tue, 11 Dec 2018 17:08:27 -0800 Subject: [PATCH] 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: - https://github.com/ethereum/py-evm/pull/1181#issuecomment-445986061 - https://github.com/ethereum/py-evm/pull/1573#issuecomment-446404858 --- eth/tools/fixtures/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/tools/fixtures/helpers.py b/eth/tools/fixtures/helpers.py index 6cb767cdac..099d61c928 100644 --- a/eth/tools/fixtures/helpers.py +++ b/eth/tools/fixtures/helpers.py @@ -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: