-
Notifications
You must be signed in to change notification settings - Fork 127
feat!: use ruint & alloy for ethereum compat #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -185,7 +184,7 @@ fn u256_to_point<F: PrimeField>(point: U256) -> F { | |||
fn point_to_u256<F: PrimeField>(point: F) -> U256 { | |||
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@recmo I believe we could move this to little Endian for consistency with u256_to_point
, thoughts?
Should probably bump crate version to |
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. |
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 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a breaking change, right?
A: src.a.into(), | ||
B: src.b.into(), | ||
C: src.c.into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here?
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(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
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) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm why was this deleted?
U256
directly, 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.