Skip to content

Commit 6420505

Browse files
Update EC_DOUBLE_ASSIGN_NEW_X to v5
1 parent 3e5ab5c commit 6420505

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

vm/src/hint_processor/builtin_hint_processor/builtin_hint_processor_definition.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,14 @@ impl HintProcessorLogic for BuiltinHintProcessor {
644644
&SECP_P,
645645
"pt",
646646
),
647+
hint_code::EC_DOUBLE_ASSIGN_NEW_X_V5 => ec_double_assign_new_x(
648+
vm,
649+
exec_scopes,
650+
&hint_data.ids_data,
651+
&hint_data.ap_tracking,
652+
&SECP256R1_P,
653+
"point",
654+
),
647655
hint_code::EC_DOUBLE_ASSIGN_NEW_Y => ec_double_assign_new_y(exec_scopes),
648656
hint_code::KECCAK_WRITE_ARGS => {
649657
keccak_write_args(vm, &hint_data.ids_data, &hint_data.ap_tracking)

vm/src/hint_processor/builtin_hint_processor/hint_code.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,14 @@ x = pack(ids.pt.x, PRIME)
700700
y = pack(ids.pt.y, PRIME)
701701
702702
value = new_x = (pow(slope, 2, SECP_P) - 2 * x) % SECP_P"#}),
703+
(EC_DOUBLE_ASSIGN_NEW_X_V5, indoc! {r#"from starkware.cairo.common.cairo_secp.secp256r1_utils import SECP256R1_P
704+
from starkware.cairo.common.cairo_secp.secp_utils import pack
705+
706+
slope = pack(ids.slope, PRIME)
707+
x = pack(ids.point.x, PRIME)
708+
y = pack(ids.point.y, PRIME)
709+
710+
value = new_x = (pow(slope, 2, SECP256R1_P) - 2 * x) % SECP256R1_P"#}),
703711
(EC_DOUBLE_ASSIGN_NEW_Y, indoc! {r#"value = new_y = (slope * (x - new_x) - y) % SECP_P"#}),
704712
(SHA256_INPUT, indoc! {r#"ids.full_word = int(ids.n_bytes >= 4)"#}),
705713
(SHA256_MAIN_CONSTANT_INPUT_LENGTH, indoc! {r#"from starkware.cairo.common.cairo_sha256.sha256_utils import (

0 commit comments

Comments
 (0)