namecoin / namecoin-legacy

Legacy client. New version here: https://github.com/namecoin/namecoin-core Note the release branch! - Official website:
https://namecoin.org
MIT License
448 stars 177 forks source link

Enforce value length #94

Closed domob1812 closed 10 years ago

domob1812 commented 10 years ago

Disallow values longer than 520 bytes in the RPC commands name_update and name_firstupdate, and unify it with the value check in the Qt. I've tested that this successfully prevents "stuck names" on test-net, but it would be good if someone independently confirms that 520 byte values are still ok while 521 bytes make the name stuck (and that the patch guards against this).

muneeb-ali commented 10 years ago

I use 519 bytes to be on the safe side. I can confirm that 521 causes problems. I don't remember testing 520, but I use 519 as the max and since I used that I've never had any issues for names getting "stuck" (we've registered thousands of names via http://onename.io)

domob1812 commented 10 years ago

I tried 520 on test-net, too, see name_history of "value-520". But before we merge this patch, I'd be happy if someone else could test 520, too, in case I messed up the test (or at least look at "value-520" on test-net and confirm that I didn't get the length wrong).

phelixbtc commented 10 years ago

check (old version):

>>> for i,x in enumerate([519, 520, 521]):
        rpc.call("name_firstupdate", ["test_" + str(x), r[i][1], r[i][0], x*"x"])
>>> for i,x in enumerate([519, 520, 521]):
    print rpc.call("name_update", ["test_" + str(x), "x"])

6ff29f859e6140d95459d18c393be28f448e0fc6380f000d41cd311d9b733def
40594a2638ef431bb4bde55b9d0fe34a00e3b1d0e1f67c60ef2eee36be886ea6

Traceback (most recent call last):
  File "<pyshell#284>", line 2, in <module>
    print rpc.call("name_update", ["test_" + str(x), "x"])
RPCError: {u'id': 16, u'result': None, u'error': {u'message': u'Error: Transaction creation failed  ', u'code': -4}}
>>> 
phelixbtc commented 10 years ago

The new version works with 520 and blocks 521. ACK