Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

import logging
import secrets
import time
import cloudpickle
from eth_utils import keccak
from trinity.components.builtin.peer_discovery import component
import secrets
import time
import trio
from trio_run_in_process import open_worker_pool
task_count = 1000
n_workers = 1
import asyncio
from concurrent.futures import ProcessPoolExecutor
import time
import trio
from trio_run_in_process import open_worker_pool
task_count = 1000
task_length = 0.1
n_workers = 100
# ===== Mining clique blocks on trinity ==============
# - Need a genesis block with a known signer
# encoded_pk = '0x9abedf188f6e81a2473c4385fdd3610695eb9c33a0d135cbcb19d9ad8e303e56'
# pk = PrivateKey(decode_hex(encoded_pk))
# extra_data = encode_hex(
# VANITY_LENGTH * b'0' + pk.public_key.to_canonical_address() + SIGNATURE_LENGTH * b'0')
# # Use the above value in the extraData of a custom genesis.json config
# # Run trinity with '--genesis <custom-genesis.json> --nodekey <encoded_pk>'
DEBUG 09-24 08:05:59 declarations.py SubFactory: Instantiating trinity.tools.factories.db.AsyncHeaderDBFactory(db=<eth.db.atomic.AtomicDB object at 0x7f9661dbe9a0>), create=<factory.builder.BuildStep object at 0x7f9661dc4700>
DEBUG 09-24 08:05:59 declarations.py SubFactory: Instantiating trinity.tools.factories.db.AsyncHeaderDBFactory(db=<eth.db.atomic.AtomicDB object at 0x7f9661dc4880>), create=<factory.builder.BuildStep object at 0x7f9661dc44c0>
DEBUG 09-24 08:05:59 declarations.py LazyFunction: Evaluating <class 'p2p.tools.factories.keys.PublicKeyFactory'> on <factory.builder.BuildStep object at 0x7f9661dd4190>
DEBUG 09-24 08:05:59 declarations.py LazyFunction: Evaluating <function _mk_public_key_bytes at 0x7f96646f78b0> on <factory.builder.BuildStep object at 0x7f9661dd4df0>
DEBUG 09-24 08:05:59 declarations.py LazyFunction: Evaluating <function _mk_private_key_bytes at 0x7f96646f7670> on <factory.builder.BuildStep object at 0x7f9661de9160>
DEBUG
import asyncio
import time
def noop():
time.sleep(0.0001)
async def f():
start = time.monotonic()
============================= test session starts ==============================
platform linux -- Python 3.8.2, pytest-5.3.5, py-1.9.0, pluggy-0.13.1
Using --randomly-seed=1597896722
rootdir: /home/salgado/src/snakecharmers/trinity, inifile: pytest.ini
plugins: xdist-1.29.0, forked-1.2.0, anyio-1.3.1, cov-2.8.1, sugar-0.9.3, hypothesis-4.57.1, repeat-0.8.0, mock-1.12.1, web3-5.11.1, asyncio-0.10.0, aiohttp-0.3.0, randomly-3.1.0, Faker-4.1.1
collected 1 item
tests/core/p2p-proto/test_eth_proto.py::test_decode_perf
======= Transactions(snappy=True) =======
1 items (msg len: 94): 0.00007
import pytest
import time
@pytest.mark.asyncio
async def test_warning():
async def f():
time.sleep(1)
await f()
(trinity-asyncio) salgado@t495~/src/trinity (master) $ pytest -n 4 tests/core/p2p-proto/
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.5, pytest-5.3.1, py-1.8.0, pluggy-0.13.1
Using --randomly-seed=1579793872
rootdir: /home/salgado/src/trinity, inifile: pytest.ini
plugins: xdist-1.29.0, cov-2.8.1, web3-5.4.0, mock-1.12.1, hypothesis-4.47.4, forked-1.1.3, asyncio-0.10.0, aiohttp-0.3.0, randomly-3.1.0
gw0 [202] / gw1 [202] / gw2 [202] / gw3 [202]
.........................................................................................................................................................................................................Beam Sync: retrying state data request after timeout. Stats so far: BeamStat: accts=0, a_nodes=0, codes=0, strg=0, s_nodes=0, nodes=0, rtt=0.000s, wait=20s
exception calling callb
@gsalgado
gsalgado / test_make_trie_root_and_nodes.py
Created August 23, 2018 05:40
profile make_trie_root_and_nodes()
import cProfile
import os
import pstats
import random
import rlp
from eth.db.trie import make_trie_root_and_nodes
from eth.vm.forks.frontier.transactions import FrontierTransaction