Skip to content

Commit f153b85

Browse files
authored
Merge branch 'compatible' into georgeee/signkind-out-of-transcation
2 parents 7755a92 + 6e0c310 commit f153b85

File tree

13 files changed

+477
-433
lines changed

13 files changed

+477
-433
lines changed

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
inputs.utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
1515
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
1616
inputs.nixpkgs-old.url = "github:nixos/nixpkgs/nixos-23.05-small";
17+
inputs.nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
1718

1819
inputs.mix-to-nix.url = "github:serokell/mix-to-nix";
1920
inputs.nix-npm-buildPackage.url = "github:serokell/nix-npm-buildpackage";
@@ -38,7 +39,8 @@
3839
# - flake.nix (and flake.lock after running
3940
# `nix flake update opam-repository`).
4041
# - scripts/update_opam_switch.sh
41-
inputs.opam-repository.url = "github:ocaml/opam-repository/08d8c16c16dc6b23a5278b06dff0ac6c7a217356";
42+
inputs.opam-repository.url =
43+
"github:ocaml/opam-repository/08d8c16c16dc6b23a5278b06dff0ac6c7a217356";
4244
inputs.opam-repository.flake = false;
4345

4446
inputs.nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla";
@@ -60,7 +62,7 @@
6062

6163
outputs = inputs@{ self, nixpkgs, utils, mix-to-nix, nix-npm-buildPackage
6264
, opam-nix, opam-repository, nixpkgs-mozilla, flake-buildkite-pipeline
63-
, nix-utils, flockenzeit, nixpkgs-old, ... }:
65+
, nix-utils, flockenzeit, nixpkgs-old, nixpkgs-unstable, ... }:
6466
let
6567
inherit (nixpkgs) lib;
6668

@@ -103,9 +105,7 @@
103105
# Skip tests on nodejs dep due to known issue with nixpkgs 24.11 https://github.com/NixOS/nixpkgs/issues/402079
104106
# this can be removed after upgrading
105107
skipNodeTests = final: prev: {
106-
nodejs = prev.nodejs.overrideAttrs(old: {
107-
doCheck = false;
108-
});
108+
nodejs = prev.nodejs.overrideAttrs (old: { doCheck = false; });
109109
};
110110
};
111111
nixosModules.mina = import ./nix/modules/mina.nix inputs;
@@ -273,12 +273,47 @@
273273
};
274274
} // utils.lib.eachDefaultSystem (system:
275275
let
276-
rocksdbOverlay = pkgs: prev:
277-
if prev.stdenv.isx86_64 then {
278-
rocksdb-mina = pkgs.rocksdb511;
279-
} else {
280-
rocksdb-mina = pkgs.rocksdb;
281-
};
276+
# Helper function to map dependencies to current nixpkgs equivalents
277+
mapDepsToCurrentPkgs = pkgs: deps:
278+
map (dep:
279+
if pkgs ? ${dep.pname or dep.name or ""} then
280+
pkgs.${dep.pname or dep.name or ""}
281+
else
282+
dep) deps;
283+
284+
# Helper function to disable compression libraries in cmake flags
285+
disableCompressionLibs = flags:
286+
builtins.filter (flag: flag != [ ]) (map (flag:
287+
if builtins.isString flag
288+
&& builtins.match ".*WITH_(BZ2|LZ4|SNAPPY|ZLIB|ZSTD)=1.*" flag
289+
!= null then
290+
builtins.replaceStrings [ "=1" ] [ "=0" ] flag
291+
else
292+
flag) flags);
293+
294+
rocksdbOverlay = pkgs: prev: {
295+
rocksdb-mina = let
296+
# Get the full derivation from unstable but build with current nixpkgs
297+
unstableRocksdb =
298+
(nixpkgs-unstable.legacyPackages.${system}.rocksdb.override {
299+
enableShared = false;
300+
enableLiburing = false;
301+
bzip2 = null;
302+
lz4 = null;
303+
snappy = null;
304+
zlib = null;
305+
zstd = null;
306+
});
307+
in pkgs.stdenv.mkDerivation (unstableRocksdb.drvAttrs // {
308+
cmakeFlags =
309+
disableCompressionLibs unstableRocksdb.drvAttrs.cmakeFlags;
310+
# Override the build environment to use current nixpkgs toolchain
311+
nativeBuildInputs = mapDepsToCurrentPkgs pkgs
312+
(unstableRocksdb.nativeBuildInputs or [ ]);
313+
buildInputs =
314+
mapDepsToCurrentPkgs pkgs (unstableRocksdb.buildInputs or [ ]);
315+
});
316+
};
282317
go119Overlay = (_: _: {
283318
inherit (nixpkgs-old.legacyPackages.${system})
284319
go_1_19 buildGo119Module;
@@ -326,7 +361,7 @@
326361
(pkgs.python3.withPackages
327362
(python-pkgs: [ python-pkgs.click python-pkgs.requests ]))
328363
jq
329-
rocksdb.tools
364+
rocksdb-mina.tools
330365
];
331366
in {
332367

nix/impure-shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pkgs.mkShell {
2121
wasm-pack
2222
lmdb
2323
rosetta-cli
24-
rocksdb.tools
24+
rocksdb-mina.tools
2525
];
2626
OPAMSWITCH = "mina";
2727
MINA_ROCKSDB = "${pkgs.rocksdb-mina}/lib/librocksdb.a";

nix/misc.nix

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,4 @@
22
final: prev: {
33
sodium-static =
44
final.libsodium.overrideAttrs (o: { dontDisableStatic = true; });
5-
6-
rocksdb = (prev.rocksdb.override {
7-
snappy = null;
8-
lz4 = null;
9-
zstd = null;
10-
bzip2 = null;
11-
}).overrideAttrs (_: {
12-
cmakeFlags = [
13-
"-DPORTABLE=1"
14-
"-DWITH_JEMALLOC=0"
15-
"-DWITH_JNI=0"
16-
"-DWITH_BENCHMARK_TOOLS=0"
17-
"-DWITH_TESTS=1"
18-
"-DWITH_TOOLS=0"
19-
"-DWITH_BZ2=0"
20-
"-DWITH_LZ4=0"
21-
"-DWITH_SNAPPY=0"
22-
"-DWITH_ZLIB=0"
23-
"-DWITH_ZSTD=0"
24-
"-DWITH_GFLAGS=0"
25-
"-DUSE_RTTI=1"
26-
];
27-
});
28-
29-
rocksdb511 = let
30-
impl = (import (fetchTarball {
31-
url = "https://github.com/NixOS/nixpkgs/archive/nixos-19.03-small.tar.gz";
32-
sha256 = "11z6ajj108fy2q5g8y4higlcaqncrbjm3dnv17pvif6avagw4mcb";
33-
}) { system = "x86_64-linux"; }).rocksdb.override {
34-
snappy = null;
35-
lz4 = null;
36-
bzip2 = null;
37-
};
38-
in if impl.version == "5.11.3" then
39-
impl
40-
else
41-
throw "Expected rocksdb version 5.11.3, but got ${impl.version}";
425
}

nix/ocaml.nix

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,14 @@ let
6565
'';
6666
};
6767

68-
rocksdb_stubs = super.rocksdb_stubs.overrideAttrs (oa: {
69-
MINA_ROCKSDB = let
70-
mainPath = "${pkgs.rocksdb-mina}/lib/librocksdb.a";
71-
staticPath =
72-
"${pkgs.rocksdb-mina.static or pkgs.rocksdb-mina}/lib/librocksdb.a";
73-
in if builtins.pathExists mainPath then
74-
mainPath
75-
else if builtins.pathExists staticPath then
76-
staticPath
77-
else
78-
throw
79-
"Could not find librocksdb.a in either ${mainPath} or ${staticPath}";
80-
});
68+
rocksdb_stubs =
69+
# TODO uncomment after updating rocksdb_stubs to 10.5.1
70+
# assert (super.rocksdb_stubs.version == pkgs.rocksdb-mina.version)
71+
# || builtins.throw
72+
# "rocksdb_stubs version (${super.rocksdb_stubs.version}) does not match rocksdb-mina version (${pkgs.rocksdb-mina.version})";
73+
super.rocksdb_stubs.overrideAttrs {
74+
MINA_ROCKSDB = "${pkgs.rocksdb-mina}/lib/librocksdb.a";
75+
};
8176

8277
# This is needed because
8378
# - lld package is not wrapped to pick up the correct linker flags

scripts/tests/rosetta-load.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ readonly DEFAULT_PAYMENT_TX_INTERVAL="2"
5959
readonly DEFAULT_ZKAPP_TX_INTERVAL="1"
6060

6161
# Default memory threshold for PostgreSQL processes
62-
readonly DEFAULT_POSTGRES_MEMORY_THRESHOLD="2500" # MB
62+
readonly DEFAULT_POSTGRES_MEMORY_THRESHOLD="3000" # MB
6363

6464
# Default memory threshold for Rosetta API processes
6565
readonly DEFAULT_ROSETTA_MEMORY_THRESHOLD="300" # MB

src/app/zkapps_examples/dune

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
(public_name zkapps_examples)
44
(libraries
55
;; opam libraries
6-
base
76
async_kernel
7+
base
88
core_kernel
99
;; local libraries
10-
mina_numbers
1110
crypto_params
1211
currency
13-
pasta_bindings
1412
kimchi_backend
1513
kimchi_backend_common
1614
kimchi_pasta
1715
kimchi_pasta.basic
1816
mina_base
1917
mina_base.import
2018
mina_ledger
19+
mina_numbers
20+
mina_stdlib
21+
pasta_bindings
2122
pickles
2223
pickles.backend
2324
pickles_types
2425
random_oracle
2526
random_oracle_input
26-
snarky.backendless
27-
snark_params
28-
mina_stdlib
2927
sgn
3028
signature_lib
29+
snarky.backendless
30+
snark_params
3131
tuple_lib
3232
with_hash)
3333
(instrumentation
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
(executable
1+
(test
22
(name empty_update)
33
(libraries
44
;; opam libraries
5+
alcotest
56
async
67
async_kernel
78
async_unix
89
base
910
core
1011
core_kernel
11-
ppx_inline_test.config
1212
yojson
1313
;; local libraries
1414
cache_dir
1515
currency
1616
data_hash_lib
1717
genesis_constants
18-
pasta_bindings
1918
kimchi_backend
2019
kimchi_pasta
2120
kimchi_pasta.basic
@@ -24,13 +23,15 @@
2423
mina_ledger
2524
mina_numbers
2625
mina_state
26+
mina_stdlib
2727
mina_transaction_logic
28+
pasta_bindings
2829
pickles
2930
pickles.backend
3031
pickles_base
3132
pickles_types
32-
random_oracle_input
3333
random_oracle
34+
random_oracle_input
3435
sgn
3536
signature_lib
3637
snark_params
@@ -40,14 +41,8 @@
4041
transaction_snark_tests
4142
with_hash
4243
zkapps_empty_update
43-
zkapps_examples
44-
mina_stdlib)
44+
zkapps_examples)
4545
(preprocess
4646
(pps ppx_snarky ppx_version ppx_jane))
4747
(instrumentation
4848
(backend bisect_ppx)))
49-
50-
(rule
51-
(alias runtest)
52-
(action
53-
(run ./empty_update.exe)))

src/app/zkapps_examples/test/empty_update/empty_update.ml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(** Testing
2+
-------
3+
4+
Component: Zkapps_examples
5+
Subject: Test zkapp empty update
6+
Invocation: \
7+
dune exec src/app/zkapps_examples/test/empty_update/empty_update.exe
8+
*)
9+
110
open Transaction_snark_tests.Util
211
open Core_kernel
312
open Mina_base
@@ -137,7 +146,7 @@ let zkapp_command : Zkapp_command.t =
137146
; memo
138147
}
139148

140-
let () =
149+
let test_empty_update () =
141150
Ledger.with_ledger ~depth:ledger_depth ~f:(fun ledger ->
142151
Async.Thread_safe.block_on_async_exn (fun () ->
143152
let (_ : _) =
@@ -148,3 +157,8 @@ let () =
148157
(add_amount zero (Currency.Amount.of_nanomina_int_exn 500))) )
149158
in
150159
check_zkapp_command_with_merges_exn ledger [ zkapp_command ] ) )
160+
161+
let () =
162+
let open Alcotest in
163+
run "Empty update test"
164+
[ ("empty_update", [ test_case "Empty_update" `Quick test_empty_update ]) ]

src/app/zkapps_examples/test/initialize_state/dune

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
(library
1+
(test
22
(name initialize_state)
33
(libraries
44
;; opam libraries
5+
alcotest
56
async
67
async_kernel
78
async_unix
89
base
910
core
1011
core_kernel
11-
ppx_inline_test.config
1212
yojson
1313
;; local libraries
1414
cache_dir
1515
currency
1616
data_hash_lib
1717
genesis_constants
18-
pasta_bindings
1918
kimchi_backend
2019
kimchi_pasta
2120
kimchi_pasta.basic
@@ -26,11 +25,12 @@
2625
mina_numbers
2726
mina_state
2827
mina_transaction_logic
28+
pasta_bindings
2929
pickles
3030
pickles.backend
3131
pickles_types
32-
random_oracle_input
3332
random_oracle
33+
random_oracle_input
3434
sgn
3535
signature_lib
3636
snark_params
@@ -39,10 +39,8 @@
3939
transaction_snark
4040
transaction_snark_tests
4141
with_hash
42-
zkapps_initialize_state
43-
zkapps_examples)
44-
(inline_tests
45-
(flags -verbose -show-counts))
42+
zkapps_examples
43+
zkapps_initialize_state)
4644
(preprocess
4745
(pps ppx_snarky ppx_version ppx_jane))
4846
(instrumentation

0 commit comments

Comments
 (0)