Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 1ee7f2c

Browse files
vubvub
authored andcommitted
Fixed s-value vs secp256k1n checking
1 parent 4832acb commit 1ee7f2c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

ethereum/bloom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def bloom(val):
2727

2828
def bloom_insert(bloom, val):
2929
h = utils.sha3(val)
30-
# print 'bloom_insert', bloom_bits(val), repr(val)
30+
# print 'bloom_insert', bloom_bits(val), repr(val)
3131
for i in range(0, BUCKETS_PER_VAL * 2, 2):
3232
bloom |= 1 << ((safe_ord(h[i + 1]) + (safe_ord(h[i]) << 8)) & 2047)
3333
return bloom

ethereum/specials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def proc_ecrecover(ext, msg):
1818
v = msg.data.extract32(32)
1919
r = msg.data.extract32(64)
2020
s = msg.data.extract32(96)
21-
if r >= bitcoin.N or s >= bitcoin.P or v < 27 or v > 28:
22-
return 1, msg.gas - opcodes.GECRECOVER, [0] * 32
21+
if r >= bitcoin.N or s >= bitcoin.N or v < 27 or v > 28:
22+
return 1, msg.gas - opcodes.GECRECOVER, []
2323
recovered_addr = bitcoin.ecdsa_raw_recover(h, (v, r, s))
2424
if recovered_addr in (False, (0, 0)):
2525
return 1, msg.gas - gas_cost, []

ethereum/transactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def sender(self):
7272
if not self._sender:
7373
# Determine sender
7474
if self.v:
75-
if self.r >= N or self.s >= P or self.v < 27 or self.v > 28 \
76-
or self.r == 0 or self.s == 0 or self.s >= secpk1n:
75+
if self.r >= N or self.s >= N or self.v < 27 or self.v > 28 \
76+
or self.r == 0 or self.s == 0:
7777
raise InvalidTransaction("Invalid signature values!")
7878
log.debug('recovering sender')
7979
rlpdata = rlp.encode(self, UnsignedTransaction)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ def run_tests(self):
5151
install_requires=install_requires,
5252
tests_require=tests_require,
5353
entry_points=dict(console_scripts=console_scripts),
54-
version='1.0.5',
54+
version='1.0.6',
5555
cmdclass=cmdclass
5656
)

0 commit comments

Comments
 (0)