-
Notifications
You must be signed in to change notification settings - Fork 721
"python ./runtest.py" is broken #7
Comments
it appears it's a json parsing problem. treat it as a dictionary? |
yeah .. looking into it now |
off-topic question: is there an an irc channel where ethereum devs hang out? |
not that i know of, try #ethereum or #ethereum-dev |
Here's what I get on OSX:
I can't quickly find out where this rlptest.txt is supposed to come from. (and yes both #ethereum and #ethereum-dev is active) |
You need to clone the "tests" which can be found here: https://github.com/ethereum/tests |
OSX Mavericks is throwing this error:
|
That's expected -- the runtest.py script was fixed but the test data in the "tests" repository wasn't updated. Please note also that a large part of runtest.py was ported to "proper" python tests (see the "tests" subdirectory). These use the same test data and will not pass either yet. In a next step I'd like to drop the dependency on the external "tests" repository and have the test data reside local to "pyethereum". |
Could someone help me out here with all the tests involved? @freizeit in #11 you introduce py.test and you reference this (#7) as fixed. However it is still open and runtest.py is still in the repo. Furthermore in #12 you reference #7 as fixed. @chenhouwu In commit 4703540 you introduced 'behave' as new test framework, but runtest.py is still in the repository. If I understand correctly, py.test and runtest.py still rely on cloning the tests repo (and fail if not cloned)? So...,
Thanks! |
Currently only test for trie and others are still same as before, but it surely will be migrated to behave later. |
runtest.py is obsolete and removed |
Hello there! Sorry I could not answer all the questions in time. My understanding is that the rlp module is broken and does not comply to https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP I am in the process of preparing a branch that will address some of this. Could you all please also join https://groups.google.com/forum/#!forum/ethereum-dev so we can discuss and agree on development issues? Thank you very much indeed! |
@konradkonrad yes, the py.test tests are still cloning the "tests" repository. In the "rlp fixes" branch (currently in progress) I test against the "develop" branch. However, I have doubts re. the following values in https://github.com/ethereum/tests/blob/develop/rlptest.json
and will prepare an email to the ethereum-dev to discuss this. Regarding test frameworks: I have used py.test with good success in the past and know the author well -- hence my inclination to use it for pyethereum as well. |
I've joined the google groups :-). rlp encoding would only encode string (ie. byte array) and list. If |
In the Ethereum(++) client |
Here's how utils.py should look like when encoding "zero" as the empty string. |
@heikoheiko I understand now -- thanks for the clarification ! |
Another question: encoding as follows is clear:
However, the other way around
How would I know whether the byte buffer should further be transformed into an integer or left as is? |
Further transformation depends on the application. You basically have to know what data and types you expect to get out of the deserialization. For example if you get |
@al-maisan , sorry, just mix the form of @heikoheiko, the utils.py fike is created by me, de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 1) def int_to_big_endian(integer): de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 2) '''convert a integer to big endian binary string de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 3) ''' de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 4) s = '%x' % integer f2b796b9 utils.py (Chen Houwu 2014-03-17 16:04:36 +0800 5) if len(s) & 1: f2b796b9 utils.py (Chen Houwu 2014-03-17 16:04:36 +0800 6) s = '0' + s f2b796b9 utils.py (Chen Houwu 2014-03-17 16:04:36 +0800 7) return s.decode('hex') de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 8) de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 9) def big_endian_to_int(string): de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 10) '''convert a big endian binary string to integer de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 11) ''' de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 12) s = string.encode('hex') de5d6c98 utils.py (Chen Houwu 2014-03-18 12:57:42 +0800 13) return int(s, 16) I don't give the special case when the value is 0. if integer == 0: return '' |
@al-maisan for RLP encoding, it only accept string(i.e raw byte) or a list of string. RLP itself is designed to work in low level without the know what the strings means. So how the high level data is serialized to string and deserialized from string is totally up to you. Hope it's clarified now. |
@chenhouwu in order to be compatible with the Ethereum(++) client (which is the most current spec) we need to treat the special case of zero/empty_string. i.e. |
@heikoheiko yes, blank string will be encoded to |
in fact, in the RLP encoding spec, it does not care about how you convert integer in high level codes. So in the low level RLP encoding, it will never meet the case of convert 0 to big endian array. |
If '{0}'.format(zero) then the result will be So, why the |
@chenhouwu can you please take that discussion to https://groups.google.com/forum/#!forum/ethereum-dev so other people see it as well and we document the outcome and the discussion? Thanks! P.S.: @vbuterin has subscribed to that list as well |
The way things should be: rlp.encode(0) = rlp.encode("") = '\x80' There is no need to special case zero; it's just a natural extension of the rules for nonzero length strings. For integer conversion, 0 -> '' is just the base case. |
@vbuterin |
From @vbuterin rlp.encode(x) = chr(x) holds for 1 <= x <= 255 and |
Fix rlp decoder bytecode
Here's what I see:
This is on ubuntu 12.10
The text was updated successfully, but these errors were encountered: