Coder Social home page Coder Social logo

Generic Merkle Operators about iavl HOT 2 CLOSED

mossid avatar mossid commented on August 26, 2024 1
Generic Merkle Operators

from iavl.

Comments (2)

ethanfrey avatar ethanfrey commented on August 26, 2024 2

Yes, this is very close to what I had in mind (and what I sketched in an earlier IBC paper). Much more generic (given those golang structs are translated to protobuf).

The PrependLengthOp is not needed. As you see there is already a prefix such as or Height + Size + Version which can be processed by the client. You can just add the length there.

So, we have eg. Prefix: Height + Size + Version + Length, Key, Suffix: Right

And the HashConcatOp should be able to handle any inner node.


We would need another type for leaf nodes that takes Key, Value as well-defined fields (so we know what is being proven) and then performs some ops on it. I don't have that function in mind, but probably could be formed with one other generic operator in addition to HashConcatOp.


The main problem with this currently is that such a proof seems incompatible with the ProofOp as defined in the tendermint api.

Unless we can figure a way to map your above constructs onto that, it will be a breaking change in tendermint and the rpc api.

from iavl.

mossid avatar mossid commented on August 26, 2024

I think it is better to have PrependLengthOp, even that the length of the input value is fixed in our case(SHA256 hashed), in general case the length may vary so we cannot determine which length bytes we have to prepend at the proof generation time. I'm also in favor of splitting HashConcatOp into SHA256Op(which is the same thing with HashValueOp above) and ConcatOp, so we can add other hash functions later too(for other merkle tree types)

ProofOp.data is just a dynamically serialized operator struct which the receiver will decode with ProofOpDecoder function. The only thing we need to implement is the encoder/decoder function for each of the operator types, which does not break the current api.

from iavl.

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.