Esempio n. 1
0
def test_chain(alloc={},
               genesis_gas_limit=9999999,
               min_gas_limit=5000,
               startgas=3141592):
    # alloc
    alloc[tester.a0] = {'balance': 100000 * utils.denoms.ether}

    for i in range(9):
        alloc[utils.int_to_addr(i)] = {'balance': 1}
    # genesis
    header = {
        "number": 0,
        "gas_limit": genesis_gas_limit,
        "gas_used": 0,
        "timestamp": 1467446877,
        "difficulty": 1,
        "uncles_hash": '0x' + utils.encode_hex(utils.sha3(rlp.encode([])))
    }
    genesis = mk_basic_state(alloc, header, tester.get_env(None))
    # tester
    tester.languages['viper'] = compiler.Compiler()
    tester.STARTGAS = startgas
    chain = tester.Chain(alloc=alloc, genesis=genesis)
    chain.chain.env.config['MIN_GAS_LIMIT'] = min_gas_limit
    chain.mine(1)
    return chain
Esempio n. 2
0
    def setUp(self):
        env = tester.get_env(None)
        env.config['BLOCK_GAS_LIMIT'] = 5**10
        chain = tester.Chain(env=env)

        with open('BN256G2.sol') as handle:
            source = handle.read()
            BN256G2 = chain.contract(source, language='solidity')
        with open('BLSValidators.sol') as handle:
            source = handle.read()
            self.contract = chain.contract(
                source,
                libraries={'BN256G2': hexlify(BN256G2.address)},
                language='solidity')
Esempio n. 3
0
def test_chain(alloc=tester.base_alloc, genesis_gas_limit=9999999,
               min_gas_limit=5000, startgas=3141592):
    # genesis
    header = {
        "number": 0, "gas_limit": genesis_gas_limit,
        "gas_used": 0, "timestamp": 1467446877, "difficulty": 1,
        "uncles_hash": '0x'+utils.encode_hex(utils.sha3(rlp.encode([])))
    }
    genesis = mk_basic_state(alloc, header, tester.get_env(None))
    # tester
    tester.languages['vyper'] = compiler.Compiler()
    tester.STARTGAS = startgas
    chain = tester.Chain(alloc=alloc, genesis=genesis)
    chain.chain.env.config['MIN_GAS_LIMIT'] = min_gas_limit
    chain.mine(1)
    return chain
Esempio n. 4
0
 def init_chain_tester(self):
     """Init a chain tester."""
     chain_env = eth_tester.get_env(None)
     chain_env.config['BLOCK_GAS_LIMIT'] = BLOCK_GAS_LIMIT
     self.chain_tester = eth_tester.Chain(env=chain_env)