From 0080b1183ab55e5180e69bfc3987e4cd6edbc230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Czajka?= <62751+lukaszcz@users.noreply.github.com> Date: Wed, 6 Nov 2024 14:24:03 +0100 Subject: [PATCH] Record updates new syntax (#134) * Adapts to https://github.com/anoma/juvix/pull/3138 --- Stdlib/Cairo/Ec.juvix | 3 ++- Stdlib/Cairo/Poseidon.juvix | 17 ++++++++++++++--- test/Package.juvix | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Stdlib/Cairo/Ec.juvix b/Stdlib/Cairo/Ec.juvix index 46a4f07e..4d1ad6d2 100644 --- a/Stdlib/Cairo/Ec.juvix +++ b/Stdlib/Cairo/Ec.juvix @@ -84,7 +84,8 @@ add (point1 point2 : Point) : Point := in mkPoint r_x r_y; --- Subtracts point2 from point1 on the EC. -sub (point1 point2 : Point) : Point := add point1 point2@Point{y := 0 - y}; +sub (point1 point2 : Point) : Point := + add point1 point2@Point{y := 0 - Point.y point2}; --- Computes point1 + alpha * point2 on the elliptic curve. --- Because the EC operation builtin cannot handle inputs where additions of points with the same x diff --git a/Stdlib/Cairo/Poseidon.juvix b/Stdlib/Cairo/Poseidon.juvix index c205803c..0a78057f 100644 --- a/Stdlib/Cairo/Poseidon.juvix +++ b/Stdlib/Cairo/Poseidon.juvix @@ -32,8 +32,19 @@ poseidonHash2 (x y : Field) : Field := poseidonHashList (list : List Field) : Field := let go (acc : PoseidonState) : List Field -> PoseidonState - | [] := poseidonHash acc@PoseidonState{s0 := s0 + 1} - | [x] := poseidonHash acc@PoseidonState{s0 := s0 + x; s1 := s1 + 1} + | [] := poseidonHash acc@PoseidonState{s0 := PoseidonState.s0 acc + 1} + | [x] := + poseidonHash + acc@PoseidonState{ + s0 := PoseidonState.s0 acc + x; + s1 := PoseidonState.s1 acc + 1; + } | (x1 :: x2 :: xs) := - go (poseidonHash acc@PoseidonState{s0 := s0 + x1; s1 := s1 + x2}) xs; + go + (poseidonHash + acc@PoseidonState{ + s0 := PoseidonState.s0 acc + x1; + s1 := PoseidonState.s1 acc + x2; + }) + xs; in PoseidonState.s0 (go (mkPoseidonState 0 0 0) list); diff --git a/test/Package.juvix b/test/Package.juvix index 8304ebad..10df6e8e 100644 --- a/test/Package.juvix +++ b/test/Package.juvix @@ -11,7 +11,7 @@ package : Package := github "anoma" "juvix-quickcheck" - "4242b864714f98947753544ea1b2cb435f6473d3"; + "b28c74aeb181712e6a20a4371b09f3e9bea49702"; github "anoma" "juvix-test" "85811914324b082549cb1f500323884442fc793c"; ]; };