feat!: use ruint & alloy for ethereum compat - #80
Open
paolodamico wants to merge 2 commits into
Open
Conversation
paolodamico
commented
Nov 19, 2024
| let point = point.into_bigint(); | ||
| let point_bytes = point.to_bytes_be(); | ||
| U256::from(&point_bytes[..]) | ||
| U256::try_from_be_slice(&point_bytes[..]).expect("always works") |
Author
There was a problem hiding this comment.
@recmo I believe we could move this to little Endian for consistency with u256_to_point, thoughts?
Contributor
|
Should probably bump crate version to |
Member
|
Hi, sorry for the delay on getting feedback for this PR. Is there still interest in getting this merged? If so, happy to merge once conflicts are resolved. |
Pratyush
reviewed
Mar 22, 2025
| impl From<ethereum::G1> for G1Point { | ||
| fn from(src: ethereum::G1) -> Self { | ||
| Self { x: src.x, y: src.y } | ||
| Self { X: src.x, Y: src.y } |
Member
There was a problem hiding this comment.
This seems to be a breaking change, right?
Pratyush
reviewed
Mar 22, 2025
Comment on lines
+79
to
+81
| A: src.a.into(), | ||
| B: src.b.into(), | ||
| C: src.c.into(), |
Pratyush
reviewed
Mar 22, 2025
Comment on lines
+88
to
+92
| alfa1: src.alpha1.into(), | ||
| beta2: src.beta2.into(), | ||
| gamma2: src.gamma2.into(), | ||
| delta2: src.delta2.into(), | ||
| IC: src.ic.into_iter().map(|i| i.into()).collect(), |
Pratyush
reviewed
Mar 22, 2025
Comment on lines
-98
to
-119
| impl<M: Middleware> Groth16Verifier<M> { | ||
| async fn check_proof< | ||
| I: Into<ethereum::Inputs>, | ||
| P: Into<ethereum::Proof>, | ||
| VK: Into<ethereum::VerifyingKey>, | ||
| >( | ||
| &self, | ||
| proof: P, | ||
| vk: VK, | ||
| inputs: I, | ||
| ) -> Result<bool, ContractError<M>> { | ||
| // convert into the expected format by the contract | ||
| let proof = proof.into().into(); | ||
| let vk = vk.into().into(); | ||
| let inputs = inputs.into().0; | ||
|
|
||
| // query the contract | ||
| let res = self.verify(inputs, proof, vk).call().await?; | ||
|
|
||
| Ok(res) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
U256directly, which alloy uses under the hood. This poses a minor breaking change for the Ethereum compatibility module because previously the output was a uint (different crate) coming from ethers-core.