From fe83a048ce394c30fbc35423200fb517b4cea62e Mon Sep 17 00:00:00 2001 From: nolash Date: Tue, 13 Jul 2021 10:40:44 +0200 Subject: [PATCH] Fix fail in tx serialization on none to-address (contract creation) --- CHANGELOG | 1 + crypto_dev_signer/eth/transaction.py | 6 +++++- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 12fd08a..0e98dc3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ - Remove web3 / eth-* module dependencies - Add custom keyfile handling code and cli tool - Add zero-length password option to keyfile cli tool + - Fix tx serialization bug when to address is none (contract creation) * 0.4.13 - Implement DictKeystore - Remove unused insert_key method in keystore interface diff --git a/crypto_dev_signer/eth/transaction.py b/crypto_dev_signer/eth/transaction.py index bba8cc5..2c0b03c 100644 --- a/crypto_dev_signer/eth/transaction.py +++ b/crypto_dev_signer/eth/transaction.py @@ -127,13 +127,17 @@ class EIP155Transaction: 'nonce': add_0x(self.nonce.hex(), allow_empty=True), 'gasPrice': add_0x(self.gas_price.hex()), 'gas': add_0x(self.start_gas.hex()), - 'to': add_0x(self.to.hex()), 'value': add_0x(self.value.hex(), allow_empty=True), 'data': add_0x(self.data.hex(), allow_empty=True), 'v': add_0x(self.v.hex(), allow_empty=True), 'r': add_0x(self.r.hex(), allow_empty=True), 's': add_0x(self.s.hex(), allow_empty=True), } + if self.to == None or len(self.to) == 0: + tx['to'] = None + else: + tx['to'] = add_0x(self.to.hex()) + if tx['data'] == '': tx['data'] = '0x' diff --git a/setup.py b/setup.py index f4eb152..63bb7c6 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ f.close() setup( name="crypto-dev-signer", - version="0.4.14b6", + version="0.4.14b7", description="A signer and keystore daemon and library for cryptocurrency software development", author="Louis Holbrook", author_email="dev@holbrook.no",