Fix missing conflict resolution in eth-encode, non-0x address fallthrough in eth-info

This commit is contained in:
nolash 2021-10-25 09:57:31 +02:00
parent b51e5dc408
commit 31e75f60de
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 21 additions and 6 deletions

View File

@ -16,10 +16,12 @@ class CLIEncoder(ABIContractEncoder):
__re_uint = r'^([uU])[int]*([0-9]+)?$' __re_uint = r'^([uU])[int]*([0-9]+)?$'
__re_bytes = r'^([bB])[ytes]*([0-9]+)?$' __re_bytes = r'^([bB])[ytes]*([0-9]+)?$'
__re_string = r'^([sS])[tring]*$' __re_string = r'^([sS])[tring]*$'
__re_address = r'^([aA])[ddress]*?$'
__translations = [ __translations = [
'to_uint', 'to_uint',
'to_bytes', 'to_bytes',
'to_string', 'to_string',
'to_address',
] ]
def __init__(self, signature=None): def __init__(self, signature=None):
@ -58,6 +60,18 @@ class CLIEncoder(ABIContractEncoder):
return (s, a) 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): def to_string(self, typ):
m = re.match(self.__re_string, typ) m = re.match(self.__re_string, typ)
if m == None: if m == None:

View File

@ -13,7 +13,7 @@ import sha3
# external imports # external imports
import chainlib.eth.cli import chainlib.eth.cli
from chainlib.eth.cli.encode import CLIEncoder 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 funga.eth.keystore.dict import DictKeystore
from hexathon import ( from hexathon import (
add_0x, add_0x,
@ -45,10 +45,7 @@ from chainlib.error import SignerMissingException
from chainlib.chain import ChainSpec from chainlib.chain import ChainSpec
from chainlib.eth.runnable.util import decode_for_puny_humans from chainlib.eth.runnable.util import decode_for_puny_humans
from chainlib.eth.jsonrpc import to_blockheight_param from chainlib.eth.jsonrpc import to_blockheight_param
<<<<<<< HEAD
from chainlib.eth.address import to_checksum_address from chainlib.eth.address import to_checksum_address
=======
>>>>>>> d6b258f2140f5ce555f765a90c14a65a5f3fc6de
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger() logg = logging.getLogger()

View File

@ -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) 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 = chainlib.eth.cli.Wallet()
wallet.from_config(config) wallet.from_config(config)
if wallet.get_signer_address() == None and holder_address != None: if wallet.get_signer_address() == None and holder_address != None:

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = chainlib-eth name = chainlib-eth
version = 0.0.10a11 version = 0.0.10a13
description = Ethereum implementation of the chainlib interface description = Ethereum implementation of the chainlib interface
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no