Compare commits

..

No commits in common. "master" and "lash/man" have entirely different histories.

6 changed files with 12 additions and 48 deletions

View File

@ -1,8 +1,3 @@
- 0.1.1
* Add fee_limit, fee_price alias to Tx object
- 0.1.0:
* Allow nonce ommission in encode when not tx mode
* Add rcpt src to tx object
- 0.0.27: - 0.0.27:
* Add man pages with chainlib man page generator helper * Add man pages with chainlib man page generator helper
* Remove redundant arg flags from runnables: get * Remove redundant arg flags from runnables: get

View File

@ -11,7 +11,8 @@ import urllib
import sha3 import sha3
# external imports # external imports
from chainlib.cli import flag_reset import chainlib.eth.cli
from chainlib.eth.cli.encode import CLIEncoder
from funga.eth.signer import 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 (
@ -20,8 +21,6 @@ from hexathon import (
) )
# local imports # local imports
import chainlib.eth.cli
from chainlib.eth.cli.encode import CLIEncoder
from chainlib.eth.constant import ZERO_ADDRESS from chainlib.eth.constant import ZERO_ADDRESS
from chainlib.eth.address import to_checksum from chainlib.eth.address import to_checksum
from chainlib.eth.connection import EthHTTPConnection from chainlib.eth.connection import EthHTTPConnection
@ -48,7 +47,6 @@ config_dir = os.path.join(script_dir, '..', 'data', 'config')
arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE | chainlib.eth.cli.Flag.FMT_HUMAN | chainlib.eth.cli.Flag.FMT_WIRE | chainlib.eth.cli.Flag.FMT_RPC arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE | chainlib.eth.cli.Flag.FMT_HUMAN | chainlib.eth.cli.Flag.FMT_WIRE | chainlib.eth.cli.Flag.FMT_RPC
arg_flags = flag_reset(arg_flags, chainlib.cli.Flag.NO_TARGET)
argparser = chainlib.eth.cli.ArgumentParser(arg_flags) argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
argparser.add_argument('--mode', type=str, choices=['tx', 'call', 'arg'], help='Mode of operation') argparser.add_argument('--mode', type=str, choices=['tx', 'call', 'arg'], help='Mode of operation')
argparser.add_argument('--signature', type=str, help='Method signature to encode') argparser.add_argument('--signature', type=str, help='Method signature to encode')
@ -133,7 +131,6 @@ def main():
if not config.get('_FEE_LIMIT'): if not config.get('_FEE_LIMIT'):
config.add(limit, '_FEE_LIMIT') config.add(limit, '_FEE_LIMIT')
if mode == 'tx':
if not config.get('_NONCE'): if not config.get('_NONCE'):
nonce_oracle = rpc.get_nonce_oracle() nonce_oracle = rpc.get_nonce_oracle()
config.add(nonce_oracle.get_nonce(), '_NONCE') config.add(nonce_oracle.get_nonce(), '_NONCE')

View File

@ -95,11 +95,7 @@ def pack(tx_src, chain_spec):
tx_src['r'], tx_src['r'],
tx_src['s'], tx_src['s'],
]: ]:
try: for b in bytes.fromhex(strip_0x(a)):
a = strip_0x(a)
except TypeError:
a = strip_0x(hex(a)) # believe it or not, eth_tester returns signatures as ints not hex
for b in bytes.fromhex(a):
signature[cursor] = b signature[cursor] = b
cursor += 1 cursor += 1
@ -429,8 +425,6 @@ class TxFactory:
return self.build_raw(tx) return self.build_raw(tx)
elif tx_format == TxFormat.RAW_ARGS: elif tx_format == TxFormat.RAW_ARGS:
return strip_0x(tx['data']) return strip_0x(tx['data'])
elif tx_format == TxFormat.DICT:
return tx
raise NotImplementedError('tx formatting {} not implemented'.format(tx_format)) raise NotImplementedError('tx formatting {} not implemented'.format(tx_format))
@ -556,9 +550,6 @@ class Tx(BaseTx):
self.outputs = [to_checksum(address_from)] self.outputs = [to_checksum(address_from)]
self.contract = None self.contract = None
self.fee_limit = self.gas_limit
self.fee_price = self.gas_price
try: try:
inpt = src['input'] inpt = src['input']
except KeyError: except KeyError:
@ -580,12 +571,11 @@ class Tx(BaseTx):
try: try:
self.wire = src['raw'] self.wire = src['raw']
except KeyError: except KeyError:
logg.debug('no inline raw tx src, and no raw rendering implemented, field will be "None"') logg.warning('no inline raw tx src, and no raw rendering implemented, field will be "None"')
self.status = Status.PENDING self.status = Status.PENDING
self.logs = None self.logs = None
self.tx_rcpt_src = None
if rcpt != None: if rcpt != None:
self.apply_receipt(rcpt, strict=strict) self.apply_receipt(rcpt, strict=strict)
@ -630,10 +620,6 @@ class Tx(BaseTx):
return self.src() return self.src()
def rcpt_src(self):
return self.tx_rcpt_src
def apply_receipt(self, rcpt, strict=False): def apply_receipt(self, rcpt, strict=False):
"""Apply receipt data to transaction object. """Apply receipt data to transaction object.
@ -644,7 +630,6 @@ class Tx(BaseTx):
""" """
rcpt = self.src_normalize(rcpt) rcpt = self.src_normalize(rcpt)
logg.debug('rcpt {}'.format(rcpt)) logg.debug('rcpt {}'.format(rcpt))
self.tx_rcpt_src = rcpt
tx_hash = add_0x(rcpt['transaction_hash']) tx_hash = add_0x(rcpt['transaction_hash'])
if rcpt['transaction_hash'] != add_0x(self.hash): if rcpt['transaction_hash'] != add_0x(self.hash):
@ -662,7 +647,7 @@ class Tx(BaseTx):
except KeyError as e: except KeyError as e:
if strict: if strict:
raise(e) raise(e)
logg.debug('setting "success" status on missing status property for {}'.format(self.hash)) logg.warning('setting "sucess" status on missing status property for {}'.format(self.hash))
status_number = 1 status_number = 1
if rcpt['block_number'] == None: if rcpt['block_number'] == None:

View File

@ -1,7 +1,7 @@
funga-eth~=0.6.0 funga-eth~=0.5.6
pysha3==1.0.2 pysha3==1.0.2
hexathon~=0.1.5 hexathon~=0.1.5
websocket-client==0.57.0 websocket-client==0.57.0
potaahto~=0.1.1 potaahto~=0.1.1
chainlib~=0.1.0 chainlib~=0.0.23
confini~=0.6.0 confini~=0.5.7

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = chainlib-eth name = chainlib-eth
version = 0.1.1 version = 0.0.27
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

View File

@ -50,19 +50,6 @@ class TxTestCase(EthTesterCase):
self.assertTrue(is_same_address(tx['to'], self.accounts[1])) self.assertTrue(is_same_address(tx['to'], self.accounts[1]))
def test_tx_repack(self):
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
gas_oracle = RPCGasOracle(self.rpc)
c = Gas(signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle, chain_spec=self.chain_spec)
(tx_hash_hex, o) = c.create(self.accounts[0], self.accounts[1], 1024)
self.rpc.do(o)
o = transaction(tx_hash_hex)
tx_src = self.rpc.do(o)
tx = Tx(tx_src)
tx_bin = pack(tx.src(), self.chain_spec)
def test_tx_pack(self): def test_tx_pack(self):
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
gas_oracle = RPCGasOracle(self.rpc) gas_oracle = RPCGasOracle(self.rpc)