Skip to content

Commit 0080b11

Browse files
authored
Record updates new syntax (#134)
* Adapts to anoma/juvix#3138
1 parent deaafbb commit 0080b11

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Stdlib/Cairo/Ec.juvix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ add (point1 point2 : Point) : Point :=
8484
in mkPoint r_x r_y;
8585

8686
--- Subtracts point2 from point1 on the EC.
87-
sub (point1 point2 : Point) : Point := add point1 point2@Point{y := 0 - y};
87+
sub (point1 point2 : Point) : Point :=
88+
add point1 point2@Point{y := 0 - Point.y point2};
8889

8990
--- Computes point1 + alpha * point2 on the elliptic curve.
9091
--- Because the EC operation builtin cannot handle inputs where additions of points with the same x

Stdlib/Cairo/Poseidon.juvix

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,19 @@ poseidonHash2 (x y : Field) : Field :=
3232
poseidonHashList (list : List Field) : Field :=
3333
let
3434
go (acc : PoseidonState) : List Field -> PoseidonState
35-
| [] := poseidonHash acc@PoseidonState{s0 := s0 + 1}
36-
| [x] := poseidonHash acc@PoseidonState{s0 := s0 + x; s1 := s1 + 1}
35+
| [] := poseidonHash acc@PoseidonState{s0 := PoseidonState.s0 acc + 1}
36+
| [x] :=
37+
poseidonHash
38+
acc@PoseidonState{
39+
s0 := PoseidonState.s0 acc + x;
40+
s1 := PoseidonState.s1 acc + 1;
41+
}
3742
| (x1 :: x2 :: xs) :=
38-
go (poseidonHash acc@PoseidonState{s0 := s0 + x1; s1 := s1 + x2}) xs;
43+
go
44+
(poseidonHash
45+
acc@PoseidonState{
46+
s0 := PoseidonState.s0 acc + x1;
47+
s1 := PoseidonState.s1 acc + x2;
48+
})
49+
xs;
3950
in PoseidonState.s0 (go (mkPoseidonState 0 0 0) list);

test/Package.juvix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package : Package :=
1111
github
1212
"anoma"
1313
"juvix-quickcheck"
14-
"4242b864714f98947753544ea1b2cb435f6473d3";
14+
"b28c74aeb181712e6a20a4371b09f3e9bea49702";
1515
github "anoma" "juvix-test" "85811914324b082549cb1f500323884442fc793c";
1616
];
1717
};

0 commit comments

Comments
 (0)