EVM-Simulator icon indicating copy to clipboard operation
EVM-Simulator copied to clipboard

Error in tests as well when I used the sample contract then it crash at MLOAD

Open devrajsinghrawat opened this issue 2 years ago • 4 comments

(venv) ➜  EVM-Simulator git:(master) ✗ pytest tests/     

==================================================== test session starts =====================================================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/devraj/work/playground/EVM-Simulator
collected 12 items                                                                                                           

tests/core/test_contracts.py FFFFFFFF                                                                                  [ 66%]
tests/core/test_evmhandler.py FF..                                                                                     [100%]

========================================================== FAILURES ==========================================================
__________________________________________________ TestContracts.test_call ___________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_call>

    def test_call(self):
        """
        Tries to create a contract which has a function that calls itself 10 times recursively.
        """
        call_contract = get_contract("Call")
>       self.create_contract_and_set_address(call_contract, False)

tests/core/test_contracts.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
_________________________________________________ TestContracts.test_create __________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_create>

    def test_create(self):
        """
        Tries to create a contract which internally creates another contract. The inner contract is passed a
        parameter during construction, that is queried and compared with what was passed to the outer contract.
        :return:
        """
        create_contract = get_contract("Creation")
        factory_contract = get_contract("Factory")
    
>       self.create_contract_and_set_address(factory_contract, False)

tests/core/test_contracts.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
________________________________________________ TestContracts.test_delegate _________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_delegate>

    def test_delegate(self):
        """
        Creates two contracts, base and front. Front delegates all calls to base. Base changes a variable in the front's
        storage. The variable is queried and checked if new value matches up with what was passed.
        :return:
        """
        base_contract = get_contract("DelegateBase")
        front_contract = get_contract("DelegateFront")
>       self.create_contract_and_set_address(base_contract, False)

tests/core/test_contracts.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
__________________________________________________ TestContracts.test_event __________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_event>

    def test_event(self):
        """
        Creates a contract that fires an event. The logs of the receipt are read and it is asserted that they are not
        empty.
        :return:
        """
        event_contract = get_contract("Event")
>       self.create_contract_and_set_address(event_contract, False)

tests/core/test_contracts.py:103: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
________________________________________________ TestContracts.test_modifier _________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_modifier>

    def test_modifier(self):
        """
        Creates a contract that uses a modifier which checks whether msg.value > 1. A variable is incremented if true.
        The function is first called with a value of 1 wei which should increment the value.
        Then the function is called with a value of 0 wei which should show_result_cb in an error and the value should remain 1.
        :return:
        """
        modifier_contract = get_contract("Modifier")
>       self.create_contract_and_set_address(modifier_contract, False)

tests/core/test_contracts.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
_________________________________________________ TestContracts.test_payable _________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_payable>

    def test_payable(self):
        """
        Creates a payable contract and tries to send wei to it.
        :return:
        """
        payable_contract = get_contract("Payable")
>       self.create_contract_and_set_address(payable_contract, True)

tests/core/test_contracts.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
______________________________________________ TestContracts.test_selfdestruct _______________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_selfdestruct>

    def test_selfdestruct(self):
        """
        Creates a contract with inital value of 1 wei which then selfdestructs onto address 0x00...01 whose vale is then
        asserted to be 1.
        :return:
        """
        destroy_contract = get_contract("SelfDestruct")
>       self.create_contract_and_set_address(destroy_contract, True)

tests/core/test_contracts.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
__________________________________________________ TestContracts.test_types __________________________________________________

self = <tests.core.test_contracts.TestContracts testMethod=test_types>

    def test_types(self):
        """
        Creates a contract which makes use of varying types in solidity.
        :return:
        """
        type_contract = get_contract("Types")
>       self.create_contract_and_set_address(type_contract, False)

tests/core/test_contracts.py:170: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/core/test_contracts.py:181: in create_contract_and_set_address
    self.evm_handler.create_contract(
app/evmhandler.py:105: in create_contract
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
____________________________________ TestEVMHandler.test__mine_block_and_get_block_number ____________________________________

self = <tests.core.test_evmhandler.TestEVMHandler testMethod=test__mine_block_and_get_block_number>

    def test__mine_block_and_get_block_number(self):
        """
        Tries to mine a block and checks whether the correct block number is returned.
        :return:
        """
        genesis = self.evm_handler.get_block_number()
        assert genesis == 1
>       self.evm_handler._mine_block()

tests/core/test_evmhandler.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
________________________________ TestEVMHandler.test_send_wei_and_get_balance_and_set_balance ________________________________

self = <tests.core.test_evmhandler.TestEVMHandler testMethod=test_send_wei_and_get_balance_and_set_balance>

    def test_send_wei_and_get_balance_and_set_balance(self):
        """
        Tries to set the balance of a contract with 1) normal transactions and 2) dirtily by setting the value and
        omitting block validation. The actual value is compared with the expected
        :return:
        """
        addr1 = Address(decode_hex("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
        addr2 = Address(decode_hex("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
        addr3 = Address(decode_hex("9742421b7279129e6791e67921d9787df9779fa7"))
        assert 0 == self.evm_handler.get_balance(addr1)
        assert 0 == self.evm_handler.get_balance(addr2)
        assert 0 == self.evm_handler.get_balance(addr3)
>       self.evm_handler.send_wei(addr1, to_wei(20, "finney"))

tests/core/test_evmhandler.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
app/evmhandler.py:85: in send_wei
    self._mine_block()
app/evmhandler.py:282: in _mine_block
    nonce, mix_hash = mine_pow_nonce(
venv/lib/python3.10/site-packages/eth/consensus/pow.py:92: in mine_pow_nonce
    cache = get_cache(block_number)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

block_number = 1

    def get_cache(block_number: int) -> bytes:
        epoch_index = block_number // EPOCH_LENGTH
    
        # doing explicit caching, because functools.lru_cache is 70% slower in the tests
    
        # Get the cache if already generated, marking it as recently used
        if epoch_index in cache_by_epoch:
            c = cache_by_epoch.pop(epoch_index)  # pop and append at end
            cache_by_epoch[epoch_index] = c
            return c
    
        # Generate the cache if it was not already in memory
        # Simulate requesting mkcache by block number: multiply index by epoch length
>       c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

venv/lib/python3.10/site-packages/eth/consensus/pow.py:49: SystemError
====================================================== warnings summary ======================================================
venv/lib/python3.10/site-packages/eth_utils/toolz.py:2
  /home/devraj/work/playground/EVM-Simulator/venv/lib/python3.10/site-packages/eth_utils/toolz.py:2: DeprecationWarning: The toolz.compatibility module is no longer needed in Python 3 and has been deprecated. Please import these utilities directly from the standard library. This module will be removed in a future release.
    from cytoolz import (

venv/lib/python3.10/site-packages/eth_keys/datatypes.py:28
  /home/devraj/work/playground/EVM-Simulator/venv/lib/python3.10/site-packages/eth_keys/datatypes.py:28: DeprecationWarning: The eth_utils.typing module will be deprecated in favor of eth-typing in the next major version bump.
    from eth_utils.typing import (

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================== short test summary info ===================================================
FAILED tests/core/test_contracts.py::TestContracts::test_call - SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#'...
FAILED tests/core/test_contracts.py::TestContracts::test_create - SystemError: PY_SSIZE_T_CLEAN macro must be defined for '...
FAILED tests/core/test_contracts.py::TestContracts::test_delegate - SystemError: PY_SSIZE_T_CLEAN macro must be defined for...
FAILED tests/core/test_contracts.py::TestContracts::test_event - SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#...
FAILED tests/core/test_contracts.py::TestContracts::test_modifier - SystemError: PY_SSIZE_T_CLEAN macro must be defined for...
FAILED tests/core/test_contracts.py::TestContracts::test_payable - SystemError: PY_SSIZE_T_CLEAN macro must be defined for ...
FAILED tests/core/test_contracts.py::TestContracts::test_selfdestruct - SystemError: PY_SSIZE_T_CLEAN macro must be defined...
FAILED tests/core/test_contracts.py::TestContracts::test_types - SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#...
FAILED tests/core/test_evmhandler.py::TestEVMHandler::test__mine_block_and_get_block_number - SystemError: PY_SSIZE_T_CLEAN...
FAILED tests/core/test_evmhandler.py::TestEVMHandler::test_send_wei_and_get_balance_and_set_balance - SystemError: PY_SSIZE...
========================================== 10 failed, 2 passed, 2 warnings in 5.11s ==========================================

devrajsinghrawat avatar Oct 15 '22 03:10 devrajsinghrawat

Interesting, I will look into this when I get back to my linux machine. In the meantime: did you get any errors when installing the dependencies?

tanmaster avatar Oct 15 '22 10:10 tanmaster

I could reproduce the errors using python 3.10. Here's a related issue in the py-evm repo: https://github.com/ethereum/py-evm/issues/2071

A workaround would be to use an older python version. Version 3.8 worked fine for me:

# perform steps 1 and 2 from here: https://linuxize.com/post/how-to-install-python-3-8-on-ubuntu-18-04/
# install version 3.8
sudo apt install python3.8 python3.8-distutils python3.8-dev
# create venv using version 3.8:
virtualenv -p python3.8 venv

Afterwards you can try to continue the setup as described in the readme. Let me know if this helps.

tanmaster avatar Oct 16 '22 11:10 tanmaster

I get this too on Arch Linux with python 3.10.10

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Traceback (most recent call last):
  File "/home/kai/dev/blockchain/EVM-Simulator/app/util/workers.py", line 123, in run
    con = self.fn(*self.args, **self.kwargs)
  File "/home/kai/dev/blockchain/EVM-Simulator/app/evmhandler.py", line 105, in create_contract
    self._mine_block()
  File "/home/kai/dev/blockchain/EVM-Simulator/app/evmhandler.py", line 282, in _mine_block
    nonce, mix_hash = mine_pow_nonce(
  File "/home/kai/dev/pyenv/lib/python3.10/site-packages/eth/consensus/pow.py", line 92, in mine_pow_nonce
    cache = get_cache(block_number)
  File "/home/kai/dev/pyenv/lib/python3.10/site-packages/eth/consensus/pow.py", line 49, in get_cache
    c = mkcache_bytes(epoch_index * EPOCH_LENGTH)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

kaimast avatar Apr 19 '23 18:04 kaimast

I am in the midst of some version update refactorings. One thing missing is a pypi release from py-ethash maintainers: https://github.com/ethereum/ethash/pull/135 which in turn needs to be included in py-evm. Once that is done I will publish my changes.

tanmaster avatar Apr 26 '23 21:04 tanmaster