Пример #1
0
from ethereum import tester

import pytest
slow = pytest.mark.slow

from utilRelay import dblSha256Flip, disablePyethLogging

disablePyethLogging()


class TestBtcTx(object):

    CONTRACT = 'example-btc-eth/btcTx.se'
    CONTRACT_GAS = 55000

    ETHER = 10 ** 18

    def setup_class(cls):
        tester.gas_limit = 2 * 10**6
        cls.s = tester.state()
        cls.c = cls.s.abi_contract(cls.CONTRACT, endowment=2000*cls.ETHER)
        cls.snapshot = cls.s.snapshot()
        cls.seed = tester.seed


    def setup_method(self, method):
        self.s.revert(self.snapshot)
        tester.seed = self.seed


    # @pytest.mark.skipif(True,reason='crash like crash604branch')
Пример #2
0
from ethereum import tester

import datetime
import struct
import json
from functools import partial
import pytest
slow = pytest.mark.slow

from utilRelay import getHeaderBytes, argsForVerifyTx, dblSha256Flip, disablePyethLogging

disablePyethLogging()


class TestBtcRelay(object):
    CONTRACT_DEBUG = 'test/btcrelay_debug.se'

    ERR_NO_PREV_BLOCK = 10030
    ERR_BLOCK_ALREADY_EXISTS = 10040
    ERR_PROOF_OF_WORK = 10090
    ERR_CONFIRMATIONS = 20020
    ERR_CHAIN = 20030
    ERR_TX_64BYTE = 20050
    ERR_RELAY_VERIFY = 30010


    def setup_class(cls):
        tester.gas_limit = int(2.8e6)  # include costs of debug methods
        cls.s = tester.state()
        cls.c = cls.s.abi_contract(cls.CONTRACT_DEBUG)
        cls.snapshot = cls.s.snapshot()