Coder Social home page Coder Social logo

Comments (12)

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

starknet-crypto does contain the logic of decompressing public keys as it needs to do that for verifying signatures. See this line:

let full_public_key = EcPoint::from_x(*public_key);

However as of today, this functionality is an implementation detail and not exposed as part of the public API. If you need to use it, the best way to do that today would be to fork this repository and expose the function yourself.

from starknet-rs.

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

Optimistically closing this. Feel free to re-open if you have further questions on the topic.

from starknet-rs.

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

Hi @rhobro I noticed you just forked our library, and just want to remind you that we just discovered a critical bug which causes the decimal representation of FieldElement to be incorrect. This bug is currently tracked as #74.

So if you print out the coordinates you get, you'll be getting incorrect numbers. You might want to incorporate the fix once it's implemented (very soon).

from starknet-rs.

rhobro avatar rhobro commented on July 17, 2024

@xJonathanLEI thank you very much for the update. Please could you ping me on this issue when it's sorted? I'll then update the commits on the fork.

Thank you so much for letting me know.

from starknet-rs.

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

Sure thing :)

from starknet-rs.

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

The commit fixing the issue is on master now @rhobro

from starknet-rs.

rhobro avatar rhobro commented on July 17, 2024

That was rapid. Thanks man.

from starknet-rs.

rhobro avatar rhobro commented on July 17, 2024

I forked it and exposed just the logic to get the y coordinate which I found in EcPoint::from_x. It is amazing that it was the same logic I found on the starkware website.

Out of interest @xJonathanLEI, would it be possible to be able to do arithmetic with references to FieldElements rather than having to clone them to pass into a function?

from starknet-rs.

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

Yeah I'd expect the same logic to be used everywhere. I guess that means we have a correct implementation :)

As for using references for arithmetic, yes we will be implementing ops that take references alongside the existing ones. However, I'd say you shouldn't worry about this for performance reasons (I'm presuming you're trying to do it for performance reasons; please ignore me if that's not the case :)), as this will be taken care of by the Rust optimizer.

from starknet-rs.

rhobro avatar rhobro commented on July 17, 2024

I was trying to do it for performance reasons 😳. How can the rust optimiser solve it?

from starknet-rs.

xJonathanLEI avatar xJonathanLEI commented on July 17, 2024

Obviously you'd need to benchmark for your case yourself, but generally speaking, if ownership is taken without being used, the compiler might turn it into a reference instead, depending on a lot of factors including the size of the struct in question.

from starknet-rs.

rhobro avatar rhobro commented on July 17, 2024

Ok. Thanks for the info.

from starknet-rs.

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.