3 Commits

Author SHA1 Message Date
lash
2fc3d4da0c Single adapter instantiation 2022-05-05 15:08:51 +00:00
lash
5fc27671da Upgrade chaind 2022-05-05 08:10:38 +00:00
lash
8f86e9c970 Implement unsafe address for send 2022-05-04 07:26:17 +00:00
5 changed files with 32 additions and 20 deletions

View File

@@ -83,7 +83,18 @@ signal.signal(signal.SIGTERM, ctrl.shutdown)
logg.info('session id is ' + settings.get('SESSION_ID')) logg.info('session id is ' + settings.get('SESSION_ID'))
logg.info('session socket path is ' + settings.get('SESSION_SOCKET_PATH')) logg.info('session socket path is ' + settings.get('SESSION_SOCKET_PATH'))
def main(): def main():
global dispatcher, settings
queue_adapter = ChaindFsAdapter(
settings.get('CHAIN_SPEC'),
settings.dir_for('queue'),
EthCacheTx,
dispatcher,
store_sync=False,
)
while True: while True:
v = None v = None
client_socket = None client_socket = None
@@ -100,16 +111,9 @@ def main():
if v == None: if v == None:
ctrl.process(conn) ctrl.process(conn)
#queue_adapter = create_adapter(settings, dispatcher)
continue continue
queue_adapter = ChaindFsAdapter(
settings.get('CHAIN_SPEC'),
settings.dir_for('queue'),
EthCacheTx,
dispatcher,
store_sync=False,
)
result_data = None result_data = None
r = 0 # no error r = 0 # no error
try: try:

View File

@@ -118,7 +118,7 @@ def main():
m = GasTokenResolver m = GasTokenResolver
token_resolver = m(chain_spec, rpc.get_sender_address(), rpc.get_signer(), rpc.get_gas_oracle(), rpc.get_nonce_oracle()) token_resolver = m(chain_spec, rpc.get_sender_address(), rpc.get_signer(), rpc.get_gas_oracle(), rpc.get_nonce_oracle())
processor = Processor(token_resolver, config.get('_SOURCE')) processor = Processor(token_resolver, config.get('_SOURCE'), use_checksum=not config.get('_UNSAFE'))
processor.add_processor(CSVProcessor()) processor.add_processor(CSVProcessor())
sends = None sends = None

View File

@@ -3,7 +3,10 @@ import logging
# external imports # external imports
from chaind.error import TxSourceError from chaind.error import TxSourceError
from chainlib.eth.address import is_checksum_address from chainlib.eth.address import (
is_checksum_address,
to_checksum_address,
)
from chainlib.eth.tx import unpack from chainlib.eth.tx import unpack
from chainlib.eth.gas import Gas from chainlib.eth.gas import Gas
from hexathon import ( from hexathon import (
@@ -17,10 +20,11 @@ logg = logging.getLogger(__name__)
class Processor: class Processor:
def __init__(self, resolver, source): def __init__(self, resolver, source, use_checksum=True):
self.resolver = resolver self.resolver = resolver
self.source = source self.source = source
self.processor = [] self.processor = []
self.safe = use_checksum
self.conn = None self.conn = None
@@ -50,9 +54,14 @@ class Processor:
txs = [] txs = []
for i, r in enumerate(self.content): for i, r in enumerate(self.content):
logg.debug('processing {}'.format(r)) logg.debug('processing {}'.format(r))
if not is_checksum_address(r[0]): address = r[0]
raise ValueError('invalid checksum address {} in record {}'.format(r[0], i)) if self.safe:
self.content[i][0] = add_0x(r[0]) if not is_checksum_address(address):
raise ValueError('invalid checksum address {} in record {}'.format(address, i))
else:
address = to_checksum_address(address)
self.content[i][0] = add_0x(address)
try: try:
self.content[i][1] = int(r[1]) self.content[i][1] = int(r[1])
except ValueError: except ValueError:

View File

@@ -1,6 +1,5 @@
chaind~=0.2.4 chaind~=0.2.10
hexathon~=0.1.5 hexathon~=0.1.6
chainlib-eth~=0.1.1 chainlib-eth~=0.1.2
pyxdg~=0.27 pyxdg~=0.27
shep~=0.2.5 funga-eth~=0.6.1
funga-eth~=0.6.0

View File

@@ -1,6 +1,6 @@
[metadata] [metadata]
name = chaind-eth name = chaind-eth
version = 0.2.2 version = 0.2.9
description = Queue server for ethereum description = Queue server for ethereum
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no