Handle multiple zero-bytes on signatures
This commit is contained in:
parent
c287e1dae7
commit
3fb5745f98
@ -40,10 +40,17 @@ class ReferenceSigner(Signer):
|
|||||||
tx.v = v.to_bytes(int(byts), 'big')
|
tx.v = v.to_bytes(int(byts), 'big')
|
||||||
tx.r = z[:32]
|
tx.r = z[:32]
|
||||||
tx.s = z[32:64]
|
tx.s = z[32:64]
|
||||||
if tx.r[0] == 0:
|
|
||||||
tx.r = tx.r[1:]
|
for i in range(len(tx.r)):
|
||||||
if tx.s[0] == 0:
|
if tx.r[i] > 0:
|
||||||
tx.s = tx.s[1:]
|
tx.r = tx.r[i:]
|
||||||
|
break
|
||||||
|
|
||||||
|
for i in range(len(tx.s)):
|
||||||
|
if tx.s[i] > 0:
|
||||||
|
tx.s = tx.s[i:]
|
||||||
|
break
|
||||||
|
|
||||||
return z
|
return z
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class EIP155Transaction:
|
|||||||
self.sender = strip_hex_prefix(tx['from'])
|
self.sender = strip_hex_prefix(tx['from'])
|
||||||
|
|
||||||
|
|
||||||
def rlp_serialize(self):
|
def __canonical_order(self):
|
||||||
s = [
|
s = [
|
||||||
self.nonce,
|
self.nonce,
|
||||||
self.gas_price,
|
self.gas_price,
|
||||||
@ -90,8 +90,22 @@ class EIP155Transaction:
|
|||||||
self.r,
|
self.r,
|
||||||
self.s,
|
self.s,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
|
def bytes_serialize(self):
|
||||||
|
s = self.__canonical_order()
|
||||||
|
b = b''
|
||||||
|
for e in s:
|
||||||
|
b += e
|
||||||
|
return b
|
||||||
|
|
||||||
|
|
||||||
|
def rlp_serialize(self):
|
||||||
|
s = self.__canonical_order()
|
||||||
return rlp_encode(s)
|
return rlp_encode(s)
|
||||||
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
tx = {
|
tx = {
|
||||||
'nonce': add_hex_prefix(self.nonce.hex()),
|
'nonce': add_hex_prefix(self.nonce.hex()),
|
||||||
|
2
setup.py
2
setup.py
@ -24,7 +24,7 @@ f.close()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="crypto-dev-signer",
|
name="crypto-dev-signer",
|
||||||
version="0.4.13rc3",
|
version="0.4.13rc4",
|
||||||
description="A signer and keystore daemon and library for cryptocurrency software development",
|
description="A signer and keystore daemon and library for cryptocurrency software development",
|
||||||
author="Louis Holbrook",
|
author="Louis Holbrook",
|
||||||
author_email="dev@holbrook.no",
|
author_email="dev@holbrook.no",
|
||||||
|
Loading…
Reference in New Issue
Block a user