Skip to content
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

Add is_infinity field to secp256 point struct #828

Merged
merged 14 commits into from
Oct 8, 2024
177 changes: 5 additions & 172 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,19 @@ cairo-lang-runner = { version = "2.8.2", optional = true }
colored = { version = "2.1.0", optional = true }
# needed to interface with cairo-lang-*
keccak = "0.1.5"
k256 = "0.13.4"
p256 = "0.13.2"
sha2 = "0.10.8" # needed for the syscall handler stub
scarb-metadata = { version = "1.12.0", optional = true }
scarb-ui = { version = "0.1.5", optional = true }
sec1 = "0.7.3"
serde_json = { version = "1.0.125" }
stats_alloc = "0.1.10"

# for the syscallhandler stub to match blockifier
ark-secp256k1 = "0.4.0"
ark-secp256r1 = "0.4.0"
ark-ec = "0.4.2"
ark-ff = "0.4.2"
num-integer = "0.1.46"

[dev-dependencies]
cairo-vm = { version = "1.0.1", features = ["cairo-1-hints"] }
cairo-lang-runner = "2.8.2"
Expand Down
10 changes: 4 additions & 6 deletions src/arch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
error,
starknet::{ArrayAbi, U256},
starknet::{ArrayAbi, Secp256k1Point, Secp256r1Point},
types::TypeBuilder,
values::Value,
};
Expand Down Expand Up @@ -150,22 +150,20 @@ impl<'a> AbiArgument for JitValueWithInfoWrapper<'a> {
.to_bytes(buffer)?
}
(
Value::Secp256K1Point { x, y },
Value::Secp256K1Point(Secp256k1Point { x, y, is_infinity }),
CoreTypeConcrete::StarkNet(StarkNetTypeConcrete::Secp256Point(
Secp256PointTypeConcrete::K1(_),
)),
)
| (
Value::Secp256R1Point { x, y },
Value::Secp256R1Point(Secp256r1Point { x, y, is_infinity }),
CoreTypeConcrete::StarkNet(StarkNetTypeConcrete::Secp256Point(
Secp256PointTypeConcrete::R1(_),
)),
) => {
let x = U256 { lo: x.0, hi: x.1 };
let y = U256 { lo: y.0, hi: y.1 };

x.to_bytes(buffer)?;
y.to_bytes(buffer)?;
is_infinity.to_bytes(buffer)?;
}
(Value::Sint128(value), CoreTypeConcrete::Sint128(_)) => value.to_bytes(buffer)?,
(Value::Sint16(value), CoreTypeConcrete::Sint16(_)) => value.to_bytes(buffer)?,
Expand Down
Loading
Loading