Git Product home page Git Product logo

Comments (3)

jtraglia avatar jtraglia commented on May 23, 2024

I think this is a good idea. @asn-d6 @pawanjay176 what do y'all think about this?

from c-kzg-4844.

mattsse avatar mattsse commented on May 23, 2024

perhaps a bit more context re the last part, building the c-kzg crate can be a problem on certain platforms, hence in alloy we'd like to use alloy-primitives, which are also just array wrappers:

https://github.com/alloy-rs/alloy/blob/1fc24a7545ad51f26b09747a3c7c2b204a56c869/crates/consensus/src/transaction/eip4844.rs#L963-L970

so we can use the type without needing c-kzg, they have the same array repr and could be casted to the c-kzg, but ideally we can move this step behind the KzgSettings API so that we can verify types that are AsRef<[]> for example.

from c-kzg-4844.

asn-d6 avatar asn-d6 commented on May 23, 2024

currently, all KzgProof functions take KzgSettings as argument:

pub fn compute_kzg_proof(
blob: &Blob,
z_bytes: &Bytes32,
kzg_settings: &KZGSettings,
) -> Result<(Self, Bytes32), Error> {

for convenience, all of those could also be implemented for KzgSettings directly that delegate with &self

No strong opinion about this change.

Gotta say that it seems a bit arbitrary to me to consider compute_kzg_proof() a method of KZGSettings. Because in a similar way, I could think of it as a method of Blob.

That said, if this makes people happy, I don't have a strong opinion about it. I think Justin also likes it because it will inadvertently also group all the public functions together.

Since these are new functions, this would make it possible to change the API and accept fixed arrays directly instead of the c-kzg Bytes wrapper types, which would be even more convenient.

Hm, this seems like an unrelated and more complicated change. I would make a separate issue for it.

The Bytes32 struct right now is part of bindgen's generated code, and we have also written a bunch of helper methods on top of it. How would it look like to make the API accept fixed arrays? I cannot easily visualize the change and understand if it simplifies or makes things more complicated.

from c-kzg-4844.

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.