From 58d801aa863512674a9a8fe9b7a39d7197ed4687 Mon Sep 17 00:00:00 2001 From: lash Date: Tue, 26 Apr 2022 10:10:04 +0000 Subject: [PATCH] Remove stale code, correct systemd syncer args --- MANIFEST.in | 2 +- chaind/eth/runnable/syncer.py | 3 ++- chainqueue/adapters/eth.py | 44 -------------------------------- erc20_requirements.txt | 2 +- requirements.txt | 2 +- setup.cfg | 11 ++++---- setup.py | 10 ++++++++ systemd/chaind-eth-sync@.service | 2 +- test_requirements.txt | 1 + 9 files changed, 22 insertions(+), 55 deletions(-) delete mode 100644 chainqueue/adapters/eth.py diff --git a/MANIFEST.in b/MANIFEST.in index 4731f39..9bf4703 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include *requirements.txt LICENSE chaind_eth/data/config/* chaind_eth/data/config/syncer/* +include *requirements.txt LICENSE chaind/eth/data/config/* chaind/eth/data/config/syncer/* diff --git a/chaind/eth/runnable/syncer.py b/chaind/eth/runnable/syncer.py index 550d2f1..d17db1d 100644 --- a/chaind/eth/runnable/syncer.py +++ b/chaind/eth/runnable/syncer.py @@ -105,7 +105,8 @@ def main(): fltr = StateFilter(queue_adapter) sync_store = SyncFsStore(config.get('SESSION_RUNTIME_DIR'), session_id=config.get('SESSION_ID')) sync_store.register(fltr) - sync_store.start() + + logg.debug('session block ofset {}'.format(session_block_offset)) chain_interface = EthChainInterface() drv = ChainInterfaceDriver(sync_store, chain_interface, offset=session_block_offset, target=block_limit) diff --git a/chainqueue/adapters/eth.py b/chainqueue/adapters/eth.py deleted file mode 100644 index fb28719..0000000 --- a/chainqueue/adapters/eth.py +++ /dev/null @@ -1,44 +0,0 @@ -# standard imports -import logging - -# external imports -from chainlib.eth.constant import ZERO_ADDRESS -from chainlib.eth.tx import ( - unpack, - raw, - ) -from hexathon import ( - add_0x, - strip_0x, - ) - -# local imports -from chainqueue.adapters.sessionindex import SessionIndexAdapter - -logg = logging.getLogger(__name__) - - -class EthAdapter(SessionIndexAdapter): - - - def translate(self, bytecode, chain_spec): - logg.debug('bytecode {}'.format(bytecode)) - tx = unpack(bytecode, chain_spec) - tx['source_token'] = ZERO_ADDRESS - tx['destination_token'] = ZERO_ADDRESS - tx['from_value'] = tx['value'] - tx['to_value'] = tx['value'] - return tx - - - def dispatch(self, chain_spec, rpc, tx_hash, signed_tx, session=None): - o = raw(signed_tx) - r = self.backend.dispatch(chain_spec, rpc, tx_hash, o) - return r - - -# def cache(self, chain_spec): -# session = self.backend.create_session() -# r = self.backend.create(chain_spec, tx['nonce'], tx['from'], tx['hash'], add_0x(bytecode.hex()), session=session) -# session.close() - diff --git a/erc20_requirements.txt b/erc20_requirements.txt index 534d4e4..4779dbe 100644 --- a/erc20_requirements.txt +++ b/erc20_requirements.txt @@ -1 +1 @@ -eth-erc20~=0.2.1 +eth-erc20~=0.3.0 diff --git a/requirements.txt b/requirements.txt index f63650d..b5321a6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ chaind~=0.1.0 hexathon~=0.1.5 chainlib-eth~=0.1.0 pyxdg~=0.27 -shep~=0.1.1 +shep~=0.2.3 funga-eth~=0.6.0 diff --git a/setup.cfg b/setup.cfg index 96bbe81..5fe9890 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ version = 0.1.0 description = Queue server for ethereum author = Louis Holbrook author_email = dev@holbrook.no -url = https://gitlab.com/chaintools/chainqueue +url = https://gitlab.com/chaintool/chaind-eth keywords = cic cryptocurrency @@ -25,17 +25,16 @@ licence_files = LICENSE [options] -python_requires = >= 3.6 +python_requires = >= 3.7 include_package_data = True packages = chaind.eth chaind.eth.runnable chaind.eth.cli -# chainqueue.adapters [options.entry_points] console_scripts = - chaind-eth-tasker = chaind_eth.runnable.tasker:main - chaind-eth-syncer = chaind_eth.runnable.syncer:main - chaind-eth-send = chaind_eth.runnable.send:main + chaind-eth-tasker = chaind.eth.runnable.tasker:main + chaind-eth-syncer = chaind.eth.runnable.syncer:main + chaind-eth-send = chaind.eth.runnable.send:main #chaind-eth-resend = chaind_eth.runnable.resend:main diff --git a/setup.py b/setup.py index 03e8842..c2d7ee8 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,16 @@ while True: test_requirements.append(l.rstrip()) f.close() +erc20_requirements = [] +f = open('erc20_requirements.txt', 'r') +while True: + l = f.readline() + if l == '': + break + test_requirements.append(l.rstrip()) +f.close() + + postgres_requirements = [ 'psycopg2==2.8.6', ] + requirements diff --git a/systemd/chaind-eth-sync@.service b/systemd/chaind-eth-sync@.service index 67b7b46..95981c6 100644 --- a/systemd/chaind-eth-sync@.service +++ b/systemd/chaind-eth-sync@.service @@ -4,5 +4,5 @@ Description=Ethereum chaind syncer [Service] Environment="SESSION_ID=%i" Environment="SESSION_RUNTIME_DIR=/run/user/%U/chaind/eth" -ExecStart=%h/.local/bin/chaind-eth-syncer -v --session-id %i --skip-history +ExecStart=%h/.local/bin/chaind-eth-syncer -v --session-id %i --head Restart=on-failure diff --git a/test_requirements.txt b/test_requirements.txt index fceb5cd..3eb3391 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -2,3 +2,4 @@ eth_tester==0.5.0b3 py-evm==0.3.0a20 rlp==2.0.1 coverage==5.5 +jsonrpc_std~=0.1.0