From 31e75f60dee5a03ee7488f7829f7d4c42755c9c4 Mon Sep 17 00:00:00 2001 From: nolash Date: Mon, 25 Oct 2021 09:57:31 +0200 Subject: [PATCH] Fix missing conflict resolution in eth-encode, non-0x address fallthrough in eth-info --- chainlib/eth/cli/encode.py | 14 ++++++++++++++ chainlib/eth/runnable/encode.py | 5 +---- chainlib/eth/runnable/info.py | 6 +++++- setup.cfg | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/chainlib/eth/cli/encode.py b/chainlib/eth/cli/encode.py index 7dbb14e..4343090 100644 --- a/chainlib/eth/cli/encode.py +++ b/chainlib/eth/cli/encode.py @@ -16,10 +16,12 @@ class CLIEncoder(ABIContractEncoder): __re_uint = r'^([uU])[int]*([0-9]+)?$' __re_bytes = r'^([bB])[ytes]*([0-9]+)?$' __re_string = r'^([sS])[tring]*$' + __re_address = r'^([aA])[ddress]*?$' __translations = [ 'to_uint', 'to_bytes', 'to_string', + 'to_address', ] def __init__(self, signature=None): @@ -58,6 +60,18 @@ class CLIEncoder(ABIContractEncoder): return (s, a) + def to_address(self, typ): + s = None + a = None + m = re.match(self.__re_address, typ) + if m == None: + return None + + s = 'ADDRESS' + a = getattr(ABIContractType, s) + return (s, a) + + def to_string(self, typ): m = re.match(self.__re_string, typ) if m == None: diff --git a/chainlib/eth/runnable/encode.py b/chainlib/eth/runnable/encode.py index 0efaffa..071d3b3 100644 --- a/chainlib/eth/runnable/encode.py +++ b/chainlib/eth/runnable/encode.py @@ -13,7 +13,7 @@ import sha3 # external imports import chainlib.eth.cli from chainlib.eth.cli.encode import CLIEncoder -from funga.eth.signer import ReferenceSigner as EIP155Signer +from funga.eth.signer import EIP155Signer from funga.eth.keystore.dict import DictKeystore from hexathon import ( add_0x, @@ -45,10 +45,7 @@ from chainlib.error import SignerMissingException from chainlib.chain import ChainSpec from chainlib.eth.runnable.util import decode_for_puny_humans from chainlib.eth.jsonrpc import to_blockheight_param -<<<<<<< HEAD from chainlib.eth.address import to_checksum_address -======= ->>>>>>> d6b258f2140f5ce555f765a90c14a65a5f3fc6de logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() diff --git a/chainlib/eth/runnable/info.py b/chainlib/eth/runnable/info.py index f4a4f53..156b90f 100644 --- a/chainlib/eth/runnable/info.py +++ b/chainlib/eth/runnable/info.py @@ -51,7 +51,11 @@ args = argparser.parse_args() config = chainlib.eth.cli.Config.from_args(args, arg_flags, extra_args={'long': None}, default_config_dir=config_dir) -holder_address = args.address +holder_address = None +try: + holder_address = add_0x(args.address) +except ValueError: + pass wallet = chainlib.eth.cli.Wallet() wallet.from_config(config) if wallet.get_signer_address() == None and holder_address != None: diff --git a/setup.cfg b/setup.cfg index a41be34..39813b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainlib-eth -version = 0.0.10a11 +version = 0.0.10a13 description = Ethereum implementation of the chainlib interface author = Louis Holbrook author_email = dev@holbrook.no