示例#1
0
from ethereum import tester
from ethereum import utils
from hydrachain import native_contracts as nc
from ethereum import abi
import logging
logging.NOTSET = logging.INFO
tester.disable_logging()

"""
test registration

test calling

test creation, how to do it in tester?
"""


class EchoContract(nc.NativeContractBase):
    address = utils.int_to_addr(2000)

    def _safe_call(self):
        res, gas, data = 1, self._msg.gas, self._msg.data.data
        return res, gas, data


def test_registry():
    reg = nc.registry
    assert tester.a0 not in reg

    nc.registry.register(EchoContract)
    assert issubclass(nc.registry[EchoContract.address].im_self, EchoContract)
示例#2
0
# etherex.py -- EtherEx tests
#
# Copyright (c) 2014 EtherEx
#
# This software may be modified and distributed under the terms
# of the MIT license.  See the LICENSE file for details.

import pytest
from ethereum import tester
from ethereum import utils
import logging

logger = logging.getLogger(__name__)

# DEBUG
tester.disable_logging()
logger.setLevel("INFO")
logging.getLogger('eth.pb').setLevel('INFO')
logging.getLogger('eth.pb.msg').setLevel('INFO')
logging.getLogger('eth.pb.msg.state').setLevel('INFO')
logging.getLogger('eth.pb.tx').setLevel('INFO')
logging.getLogger('eth.vm').setLevel('INFO')
logging.getLogger('eth.vm.op').setLevel('INFO')
logging.getLogger('eth.vm.exit').setLevel('INFO')
logging.getLogger('eth.chain.tx').setLevel('INFO')
logging.getLogger('transactions.py').setLevel('INFO')
logging.getLogger('eth.msg').setLevel('INFO')

# Boolean success/failure
SUCCESS = 1
FAILURE = 0