Giter Club home page Giter Club logo

Comments (6)

laishulu avatar laishulu commented on August 19, 2024

can't reproduce the bug even without your modified code,
my test example maybe not be the exact case you reported.
So I delegate this issue to @vbuterin
Please modify features/trie.feature on line: 144 to reflect it.

from pyethereum.

laishulu avatar laishulu commented on August 19, 2024

maybe 44264f5 already fixed the bug,
but anyway, I want the example to be presented in the feature file.

from pyethereum.

vbuterin avatar vbuterin commented on August 19, 2024

That is weird. The bug is showing very clearly for me:

u = trie.Trie('/tmp/random_sub_directory')
u.root = ''
u.update('\x03\xe8','1')
[' \x03\xe8', '1']
u.update('\x03\xe9','2')
['\x10>', ['', '', '', '', '', '', '', '', [' ', '1'], [' ', '2'], '',
'', '', '', '', '', '']]
u.update('\x01\xf4','')
['\x10', 'D\xb2\x9fo\x17\x13<\xac\x02v\xb6\x90ke\x813\x99\x88v
\x8e\x0e\xf8\xdfk\xdd\xe3\xf3\x04\xf0\xe4\xca']

from pyethereum.

laishulu avatar laishulu commented on August 19, 2024
>> u.update('\x01\xf4','')

This will store a empty string to key \x01\xf4,
the current trie tree can accept and store any thing that can be rlp encoded, so emtpy string, list are all valid.

If you run

>> u.delete('\x01\xf4')

The result will be different, which internally has a empty string together with a value_is_node=True parameter invoked with _update.

from pyethereum.

vbuterin avatar vbuterin commented on August 19, 2024

Okay, thanks. Didn't realize you separated out update-to-empty and
delete. I think that solves the problem.

On 14-04-10 05:55 AM, chenhouwu wrote:

u.update('\x01\xf4','')

This will store a empty string to '\x01\xf4',
the current trie tree can accept and store any thing that can be rlp
encoded, so emtpy string, array are all valid.

If you run

u.delete('\x01\xf4')

The result will be different, which internally has a |empty string|
together with a |value_is_node=True| parameter invoked with _update.


Reply to this email directly or view it on GitHub
#57 (comment).

from pyethereum.

laishulu avatar laishulu commented on August 19, 2024

@vbuterin in commit: 563bcc7

  1. fixed the to_dict bug,
  2. also modified the test code, so now trie test has 1/3 probability to have empty string as value.
    3 remove the extra normalization code

all test passed.

from pyethereum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.