Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 72870a5

Browse files
committed
Made more tests pass
1 parent b6db14c commit 72870a5

File tree

11 files changed

+12
-8
lines changed

11 files changed

+12
-8
lines changed

ethereum/tests/test_transactions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import rlp
44
from rlp.utils import decode_hex, encode_hex, str_to_bytes
55
from ethereum.tools import testutils
6-
from ethereum.messages import config_fork_specific_validation
6+
from ethereum.messages import config_fork_specific_validation, null_address
77
import ethereum.config as config
88
import sys
99
import json
@@ -28,6 +28,9 @@ def test_transaction(filename, testname, testdata):
2828
#if blknum >= config.default_config["HOMESTEAD_FORK_BLKNUM"]:
2929
# tx.check_low_s_homestead()
3030
assert config_fork_specific_validation(konfig, blknum, tx)
31+
assert tx.startgas >= tx.intrinsic_gas_used
32+
if tx.sender == null_address:
33+
assert tx.value == 0 and tx.gasprice == 0 and tx.nonce == 0
3134
o["sender"] = tx.sender
3235
o["transaction"] = {
3336
"data": '0x' * (len(tx.data) > 0) + encode_hex(tx.data),
@@ -44,11 +47,12 @@ def test_transaction(filename, testname, testdata):
4447
tx = None
4548
sys.stderr.write(str(e))
4649
if 'transaction' not in testdata: # expected to fail
50+
# print(tx.to_dict(), testdata)
4751
assert tx is None
4852
else:
4953
assert set(o['transaction'].keys()) == set(testdata.get("transaction", dict()).keys())
5054
o.get("transaction", None) == testdata.get("transaction", None)
51-
assert str_to_bytes(encode_hex(o.get("sender", ''))) == testdata.get("sender", '')
55+
assert str_to_bytes(encode_hex(o.get("sender", ''))) == str_to_bytes(testdata.get("sender", ''))
5256

5357

5458
def pytest_generate_tests(metafunc):

ethereum/tests/test_trie.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import itertools
66
from ethereum.slogging import get_logger
77
from rlp.utils import decode_hex
8-
from ethereum.utils import encode_hex
8+
from ethereum.utils import encode_hex, to_string
99
from ethereum.abi import is_string
1010
logger = get_logger()
1111

@@ -53,15 +53,15 @@ def _dec(x):
5353
for k, v in permut:
5454
#logger.debug('updating with (%s, %s)' %(k, v))
5555
if v is not None:
56-
t.update(k, v)
56+
t.update(to_string(k), to_string(v))
5757
else:
58-
t.delete(k)
58+
t.delete(to_string(k))
5959
# make sure we have deletes at the end
6060
for k, v in deletes:
61-
t.delete(k)
62-
if pairs['root'] != b'0x' + encode_hex(t.root_hash):
61+
t.delete(to_string(k))
62+
if pairs['root'] != '0x' + encode_hex(t.root_hash):
6363
raise Exception("Mismatch: %r %r %r %r" % (
64-
name, pairs['root'], b'0x' + encode_hex(t.root_hash), (i, list(permut) + deletes)))
64+
name, pairs['root'], '0x' + encode_hex(t.root_hash), (i, list(permut) + deletes)))
6565

6666

6767
if __name__ == '__main__':
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)