Compare commits
15 Commits
lash/funga
...
lash/geth-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a1123dc8
|
||
|
|
5c09630b6e
|
||
|
|
e9f31ed7f1
|
||
|
|
7f2c32975d
|
||
|
|
109666ba1d
|
||
|
|
8ac349f092 | ||
|
|
677b742690
|
||
|
|
96a0f3beb0
|
||
|
|
1fbd94d382
|
||
|
|
1a73c0d1ed
|
||
|
|
e9b7d27670
|
||
|
|
f688cba5cc
|
||
|
|
700e668a4b
|
||
|
|
7832071512 | ||
|
|
5cfb6a7dda
|
11
CHANGELOG
11
CHANGELOG
@@ -1,3 +1,14 @@
|
||||
- 0.0.25:
|
||||
* Upgrade chainlib to get passphrase file for wallet keyfile
|
||||
- 0.0.24:
|
||||
* Upgrade from hexathon bug breaking compact hex function
|
||||
- 0.0.23:
|
||||
* Make get block args and responses compatible with picky golang marhaling in geth
|
||||
- 0.0.22:
|
||||
* Enable unpack of pre EIP-155 transactions
|
||||
* Allow missing status property of receipts in non-strict modes
|
||||
- 0.0.21:
|
||||
* Remove warnings from cytoolz/rlp in funga-eth
|
||||
- 0.0.15:
|
||||
* Correct inverted addess checksum check for gas cli
|
||||
- 0.0.5-unreleased:
|
||||
|
||||
@@ -4,7 +4,7 @@ from chainlib.block import Block as BaseBlock
|
||||
from hexathon import (
|
||||
add_0x,
|
||||
strip_0x,
|
||||
even,
|
||||
compact,
|
||||
)
|
||||
|
||||
# local imports
|
||||
@@ -34,7 +34,8 @@ def block_by_hash(hsh, include_tx=True, id_generator=None):
|
||||
def block_by_number(n, include_tx=True, id_generator=None):
|
||||
"""Implements chainlib.interface.ChainInterface method
|
||||
"""
|
||||
nhx = add_0x(even(hex(n)[2:]))
|
||||
hx = strip_0x(hex(n))
|
||||
nhx = add_0x(compact(hx), compact_value=True)
|
||||
j = JSONRPCRequest(id_generator)
|
||||
o = j.template()
|
||||
o['method'] = 'eth_getBlockByNumber'
|
||||
|
||||
@@ -53,7 +53,7 @@ logg = logging.getLogger()
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
||||
|
||||
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC
|
||||
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE
|
||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
||||
argparser.add_argument('--notx', action='store_true', help='Network send is not a transaction')
|
||||
argparser.add_argument('--signature', type=str, help='Method signature to encode')
|
||||
@@ -66,9 +66,6 @@ extra_args = {
|
||||
}
|
||||
config = chainlib.eth.cli.Config.from_args(args, arg_flags, extra_args=extra_args, default_config_dir=config_dir)
|
||||
|
||||
if not config.get('_EXEC_ADDRESS'):
|
||||
argparser.error('exec address (-e) must be defined')
|
||||
|
||||
block_all = args.ww
|
||||
block_last = args.w or block_all
|
||||
|
||||
@@ -109,19 +106,30 @@ def main():
|
||||
print(strip_0x(code))
|
||||
return
|
||||
|
||||
exec_address = add_0x(to_checksum_address(config.get('_EXEC_ADDRESS')))
|
||||
exec_address = config.get('_EXEC_ADDRESS')
|
||||
if exec_address:
|
||||
exec_address = add_0x(to_checksum_address(exec_address))
|
||||
|
||||
if signer == None or config.true('_NOTX'):
|
||||
if config.true('_RAW'):
|
||||
print(strip_0x(code))
|
||||
return
|
||||
|
||||
if not exec_address:
|
||||
argparser.error('exec address (-e) must be defined')
|
||||
|
||||
c = TxFactory(chain_spec)
|
||||
j = JSONRPCRequest(id_generator=rpc.id_generator)
|
||||
o = j.template()
|
||||
o['method'] = 'eth_call'
|
||||
gas_limit = add_0x(int.to_bytes(config.get('_FEE_LIMIT'), 8, byteorder='big').hex(), compact_value=True)
|
||||
gas_price = add_0x(int.to_bytes(config.get('_FEE_PRICE'), 8, byteorder='big').hex(), compact_value=True)
|
||||
o['params'].append({
|
||||
'to': exec_address,
|
||||
'from': signer_address,
|
||||
'value': '0x00',
|
||||
'gas': add_0x(int.to_bytes(8000000, 8, byteorder='big').hex()), # TODO: better get of network gas limit
|
||||
'gasPrice': '0x01',
|
||||
'value': '0x0',
|
||||
'gas': gas_limit, # TODO: better get of network gas limit
|
||||
'gasPrice': gas_price,
|
||||
'data': add_0x(code),
|
||||
})
|
||||
height = to_blockheight_param(config.get('_HEIGHT'))
|
||||
@@ -135,6 +143,9 @@ def main():
|
||||
sys.stderr.write('query returned an empty value ({})\n'.format(r))
|
||||
sys.exit(1)
|
||||
|
||||
if not exec_address:
|
||||
argparser.error('exec address (-e) must be defined')
|
||||
|
||||
if chain_spec == None:
|
||||
raise ValueError('chain spec must be specified')
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ def main():
|
||||
logg.debug('sender {} balance after: {}'.format(signer_address, sender_balance))
|
||||
logg.debug('recipient {} balance after: {}'.format(recipient, recipient_balance))
|
||||
if r['status'] == 0:
|
||||
logg.critical('VM revert. Wish I could tell you more')
|
||||
logg.critical('VM revert for {}. Wish I could tell you more'.format(tx_hash_hex))
|
||||
sys.exit(1)
|
||||
print(tx_hash_hex)
|
||||
else:
|
||||
|
||||
@@ -105,7 +105,10 @@ def main():
|
||||
|
||||
o = block_latest(id_generator=rpc.id_generator)
|
||||
r = conn.do(o)
|
||||
n = int(r, 16)
|
||||
try:
|
||||
n = int(r, 16)
|
||||
except ValueError:
|
||||
n = int(r)
|
||||
first_block_number = n
|
||||
if human:
|
||||
n = format(n, ',')
|
||||
|
||||
@@ -133,6 +133,11 @@ def main():
|
||||
o = raw(args.data, id_generator=rpc.id_generator)
|
||||
if send:
|
||||
r = conn.do(o)
|
||||
if block_last:
|
||||
r = conn.wait(tx_hash_hex)
|
||||
if r['status'] == 0:
|
||||
logg.critical('VM revert for {}. Wish I could tell you more'.format(tx_hash_hex))
|
||||
sys.exit(1)
|
||||
print(r)
|
||||
else:
|
||||
print(o)
|
||||
|
||||
@@ -162,7 +162,8 @@ def __unpack_raw(tx_raw_bytes, chain_id=1):
|
||||
vb = chain_id
|
||||
if chain_id != 0:
|
||||
v = int.from_bytes(d[6], 'big')
|
||||
vb = v - (chain_id * 2) - 35
|
||||
if v > 29:
|
||||
vb = v - (chain_id * 2) - 35
|
||||
r = bytearray(32)
|
||||
r[32-len(d[7]):] = d[7]
|
||||
s = bytearray(32)
|
||||
@@ -518,7 +519,7 @@ class Tx(BaseTx):
|
||||
#:todo: divide up constructor method
|
||||
"""
|
||||
|
||||
def __init__(self, src, block=None, rcpt=None):
|
||||
def __init__(self, src, block=None, rcpt=None, strict=False):
|
||||
self.__rcpt_block_hash = None
|
||||
|
||||
src = self.src_normalize(src)
|
||||
@@ -574,7 +575,7 @@ class Tx(BaseTx):
|
||||
self.logs = None
|
||||
|
||||
if rcpt != None:
|
||||
self.apply_receipt(rcpt)
|
||||
self.apply_receipt(rcpt, strict=strict)
|
||||
|
||||
self.v = src.get('v')
|
||||
self.r = src.get('r')
|
||||
@@ -617,7 +618,7 @@ class Tx(BaseTx):
|
||||
return self.src()
|
||||
|
||||
|
||||
def apply_receipt(self, rcpt):
|
||||
def apply_receipt(self, rcpt, strict=False):
|
||||
"""Apply receipt data to transaction object.
|
||||
|
||||
Effect is the same as passing a receipt at construction.
|
||||
@@ -641,6 +642,12 @@ class Tx(BaseTx):
|
||||
status_number = int(rcpt['status'], 16)
|
||||
except TypeError:
|
||||
status_number = int(rcpt['status'])
|
||||
except KeyError as e:
|
||||
if strict:
|
||||
raise(e)
|
||||
logg.warning('setting "sucess" status on missing status property for {}'.format(self.hash))
|
||||
status_number = 1
|
||||
|
||||
if rcpt['block_number'] == None:
|
||||
self.status = Status.PENDING
|
||||
else:
|
||||
@@ -695,12 +702,12 @@ class Tx(BaseTx):
|
||||
|
||||
|
||||
@staticmethod
|
||||
def from_src(src, block=None, rcpt=None):
|
||||
def from_src(src, block=None, rcpt=None, strict=False):
|
||||
"""Creates a new Tx object.
|
||||
|
||||
Alias of constructor.
|
||||
"""
|
||||
return Tx(src, block=block, rcpt=rcpt)
|
||||
return Tx(src, block=block, rcpt=rcpt, strict=strict)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
funga-eth~=0.5.1
|
||||
funga-eth~=0.5.3
|
||||
pysha3==1.0.2
|
||||
hexathon~=0.1.0
|
||||
hexathon~=0.1.3
|
||||
websocket-client==0.57.0
|
||||
potaahto~=0.1.0
|
||||
chainlib~=0.0.14
|
||||
confini~=0.5.2
|
||||
chainlib~=0.0.19
|
||||
confini~=0.5.3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = chainlib-eth
|
||||
version = 0.0.15
|
||||
version = 0.0.25
|
||||
description = Ethereum implementation of the chainlib interface
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
@@ -48,4 +48,3 @@ console_scripts =
|
||||
eth-info = chainlib.eth.runnable.info:main
|
||||
eth-nonce = chainlib.eth.runnable.count:main
|
||||
eth-wait = chainlib.eth.runnable.wait:main
|
||||
eth = chainlib.eth.runnable.info:main
|
||||
|
||||
Reference in New Issue
Block a user