diff --git a/CHANGES.md b/CHANGES.md index 040d0f55..bd0af461 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,8 +22,6 @@ It is recommended to upgrade in stages, checking your application still works af Calls to functions in the `Capnp_rpc_unix` and `Capnp_rpc_net` modules will need minor updates. They were previously called from Lwt context, so you'll need to wrap them with `Lwt_eio.run_eio` (or remove a `Lwt_eio.run_lwt` if you already updated the surrounding code). - You should also use `mirage-crypto-rng-eio` to ensure randomness is available - (`capnp-rpc-unix` no longer does this, although some other library might). 4. Upgrade code and libraries using `Capnp_rpc_lwt`: diff --git a/README.md b/README.md index 4946bdaa..04754b47 100644 --- a/README.md +++ b/README.md @@ -462,7 +462,6 @@ let start_server ~sw ~delay net = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let delay = Eio.Time.Timeout.seconds env#mono_clock delay in let uri = start_server ~sw ~delay env#net in @@ -476,12 +475,11 @@ let () =

-You'll need to edit your `dune` file to add dependencies -on `capnp-rpc-unix` and `mirage-crypto-rng-eio` in the `(libraries ...` line and also: +You'll need to edit your `dune` file to add a dependency on `capnp-rpc-unix` in the `(libraries ...)` line and also: ```sh -$ opam install capnp-rpc-unix mirage-crypto-rng-eio +$ opam install capnp-rpc-unix ``` Running this will give something like: @@ -569,7 +567,7 @@ Edit the `dune` file to build a client and server: ``` (executables (names client server) - (libraries eio_main capnp-rpc logs.fmt capnp-rpc-unix mirage-crypto-rng-eio)) + (libraries eio_main capnp-rpc logs.fmt capnp-rpc-unix)) (rule (targets echo_api.ml echo_api.mli) @@ -615,7 +613,6 @@ let serve_cmd env = let () = exit @@ Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Cmd.eval (serve_cmd env) ``` @@ -661,7 +658,6 @@ let connect_cmd env = let () = exit @@ Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Cmd.eval (connect_cmd env) ``` @@ -866,7 +862,6 @@ let run_client ~net cap_file msg = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let net = env#net in start_server ~sw net; @@ -910,7 +905,6 @@ We can use the new API like this: ```ocaml let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let net = env#net in let root_uri = start_server ~sw net in diff --git a/capnp-rpc-net.opam b/capnp-rpc-net.opam index 4c5e47b6..a960c2c2 100644 --- a/capnp-rpc-net.opam +++ b/capnp-rpc-net.opam @@ -27,8 +27,8 @@ depends: [ "asn1-combinators" {>= "0.2.0"} "x509" {>= "1.0.3"} "dune" {>= "3.16"} - "mirage-crypto" {>= "1.1.0"} - "mirage-crypto-rng" {>= "1.1.0"} + "mirage-crypto" {>= "1.2.0"} + "mirage-crypto-rng" {>= "1.2.0"} ] build: [ ["dune" "build" "-p" name "-j" jobs] diff --git a/capnp-rpc-unix.opam b/capnp-rpc-unix.opam index 862fd9dc..4d524bd8 100644 --- a/capnp-rpc-unix.opam +++ b/capnp-rpc-unix.opam @@ -22,7 +22,7 @@ depends: [ "dune" {>= "3.16"} "ipaddr" {>= "5.3.0" } "alcotest" {>= "1.6.0" & with-test} - "mirage-crypto-rng-eio" {>= "1.1.0" & with-test} + "mirage-crypto-rng" {>= "1.2.0"} "mdx" {>= "2.4.1" & with-test} "eio_main" {with-test} "eio" {>= "1.2"} diff --git a/examples/pipelining/dune b/examples/pipelining/dune index c3b83a62..a442e64c 100644 --- a/examples/pipelining/dune +++ b/examples/pipelining/dune @@ -1,6 +1,6 @@ (executable (name main) - (libraries eio_main capnp-rpc-unix mirage-crypto-rng-eio logs.fmt)) + (libraries eio_main capnp-rpc-unix logs.fmt)) (rule (targets echo_api.ml echo_api.mli) diff --git a/examples/pipelining/main.ml b/examples/pipelining/main.ml index f7591db3..5b759b73 100644 --- a/examples/pipelining/main.ml +++ b/examples/pipelining/main.ml @@ -33,7 +33,6 @@ let start_server ~sw ~delay net = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let delay = Eio.Time.Timeout.seconds env#mono_clock delay in let uri = start_server ~sw ~delay env#net in diff --git a/examples/sturdy-refs-2/dune b/examples/sturdy-refs-2/dune index cfebddc5..2f422404 100644 --- a/examples/sturdy-refs-2/dune +++ b/examples/sturdy-refs-2/dune @@ -1,6 +1,6 @@ (executable (name main) - (libraries eio_main capnp-rpc-unix mirage-crypto-rng-eio logs.fmt)) + (libraries eio_main capnp-rpc-unix logs.fmt)) (rule (targets api.ml api.mli) diff --git a/examples/sturdy-refs-2/main.ml b/examples/sturdy-refs-2/main.ml index 792e0ca1..59ceb8bf 100644 --- a/examples/sturdy-refs-2/main.ml +++ b/examples/sturdy-refs-2/main.ml @@ -28,7 +28,6 @@ let start_server ~sw net = (* $MDX part-begin=main *) let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let net = env#net in let root_uri = start_server ~sw net in diff --git a/examples/sturdy-refs-3/dune b/examples/sturdy-refs-3/dune index cfebddc5..2f422404 100644 --- a/examples/sturdy-refs-3/dune +++ b/examples/sturdy-refs-3/dune @@ -1,6 +1,6 @@ (executable (name main) - (libraries eio_main capnp-rpc-unix mirage-crypto-rng-eio logs.fmt)) + (libraries eio_main capnp-rpc-unix logs.fmt)) (rule (targets api.ml api.mli) diff --git a/examples/sturdy-refs-3/main.ml b/examples/sturdy-refs-3/main.ml index 8b05ee30..dd80d619 100644 --- a/examples/sturdy-refs-3/main.ml +++ b/examples/sturdy-refs-3/main.ml @@ -39,7 +39,6 @@ let run_client ~net cap_file = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let net = env#net in let root_uri = start_server ~sw net in diff --git a/examples/sturdy-refs-4/dune b/examples/sturdy-refs-4/dune index 364c6ebb..d10029b5 100644 --- a/examples/sturdy-refs-4/dune +++ b/examples/sturdy-refs-4/dune @@ -1,6 +1,6 @@ (executable (name main) - (libraries eio_main capnp-rpc-unix mirage-crypto-rng-eio logs.fmt cmdliner)) + (libraries eio_main capnp-rpc-unix logs.fmt cmdliner)) (rule (targets api.ml api.mli) diff --git a/examples/sturdy-refs-4/main.ml b/examples/sturdy-refs-4/main.ml index 58aab194..e0270f38 100644 --- a/examples/sturdy-refs-4/main.ml +++ b/examples/sturdy-refs-4/main.ml @@ -100,5 +100,4 @@ let () = let doc = "a command-line interface for logger service" in let info = Cmd.info ~doc "logger-client" in exit @@ Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Cmd.eval @@ Cmd.group info (cmds env) diff --git a/examples/sturdy-refs/dune b/examples/sturdy-refs/dune index cfebddc5..2f422404 100644 --- a/examples/sturdy-refs/dune +++ b/examples/sturdy-refs/dune @@ -1,6 +1,6 @@ (executable (name main) - (libraries eio_main capnp-rpc-unix mirage-crypto-rng-eio logs.fmt)) + (libraries eio_main capnp-rpc-unix logs.fmt)) (rule (targets api.ml api.mli) diff --git a/examples/sturdy-refs/main.ml b/examples/sturdy-refs/main.ml index 1ed819a5..261efd39 100644 --- a/examples/sturdy-refs/main.ml +++ b/examples/sturdy-refs/main.ml @@ -44,7 +44,6 @@ let run_client ~net cap_file msg = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let net = env#net in start_server ~sw net; diff --git a/examples/v3/dune b/examples/v3/dune index c3b83a62..a442e64c 100644 --- a/examples/v3/dune +++ b/examples/v3/dune @@ -1,6 +1,6 @@ (executable (name main) - (libraries eio_main capnp-rpc-unix mirage-crypto-rng-eio logs.fmt)) + (libraries eio_main capnp-rpc-unix logs.fmt)) (rule (targets echo_api.ml echo_api.mli) diff --git a/examples/v3/main.ml b/examples/v3/main.ml index 23a9cb86..1dbb29eb 100644 --- a/examples/v3/main.ml +++ b/examples/v3/main.ml @@ -26,7 +26,6 @@ let start_server ~sw ~delay net = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run @@ fun sw -> let delay = Eio.Time.Timeout.seconds env#mono_clock delay in let uri = start_server ~sw ~delay env#net in diff --git a/examples/v4/client.ml b/examples/v4/client.ml index 4bc666af..748a1978 100644 --- a/examples/v4/client.ml +++ b/examples/v4/client.ml @@ -33,5 +33,4 @@ let connect_cmd env = let () = exit @@ Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Cmd.eval (connect_cmd env) diff --git a/examples/v4/dune b/examples/v4/dune index 64753b86..84bc067b 100644 --- a/examples/v4/dune +++ b/examples/v4/dune @@ -1,6 +1,6 @@ (executables (names client server) - (libraries eio_main capnp-rpc logs.fmt capnp-rpc-unix mirage-crypto-rng-eio)) + (libraries eio_main capnp-rpc logs.fmt capnp-rpc-unix)) (rule (targets echo_api.ml echo_api.mli) diff --git a/examples/v4/server.ml b/examples/v4/server.ml index 00e108b0..1fa26398 100644 --- a/examples/v4/server.ml +++ b/examples/v4/server.ml @@ -32,5 +32,4 @@ let serve_cmd env = let () = exit @@ Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Cmd.eval (serve_cmd env) diff --git a/test-bin/calc.ml b/test-bin/calc.ml index a8b7e83e..fed49b82 100644 --- a/test-bin/calc.ml +++ b/test-bin/calc.ml @@ -76,7 +76,6 @@ let cmds env = [serve_cmd env; connect_cmd env] let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Fmt_tty.setup_std_outputs (); Logs.set_reporter reporter; Logs.set_level ~all:true (Some Logs.Info); diff --git a/test-bin/dune b/test-bin/dune index f51935d1..8220e654 100644 --- a/test-bin/dune +++ b/test-bin/dune @@ -1,4 +1,3 @@ (executables (names calc calc_direct) - (libraries testlib cmdliner astring logs.fmt fmt.tty capnp-rpc-unix eio_main - mirage-crypto-rng-eio)) + (libraries testlib cmdliner astring logs.fmt fmt.tty capnp-rpc-unix eio_main)) diff --git a/test-bin/echo/dune b/test-bin/echo/dune index 3cc3789b..29b59afb 100644 --- a/test-bin/echo/dune +++ b/test-bin/echo/dune @@ -1,6 +1,6 @@ (executable (name echo_bench) - (libraries eio_main capnp-rpc capnp-rpc-net capnp-rpc-unix mirage-crypto-rng-eio logs.fmt)) + (libraries eio_main capnp-rpc capnp-rpc-net capnp-rpc-unix logs.fmt)) (rule (targets echo_api.ml echo_api.mli) diff --git a/test-bin/echo/echo_bench.ml b/test-bin/echo/echo_bench.ml index d4a76452..6a06a55d 100755 --- a/test-bin/echo/echo_bench.ml +++ b/test-bin/echo/echo_bench.ml @@ -33,7 +33,6 @@ let start_server ~sw net = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> Switch.run ~name:"main" @@ fun sw -> let uri = start_server ~sw env#net in Fmt.pr "Connecting to echo service at: %a@." Uri.pp_hum uri; diff --git a/test/dune b/test/dune index b5824baa..67ba4905 100644 --- a/test/dune +++ b/test/dune @@ -2,4 +2,4 @@ (package capnp-rpc-unix) (name test) (libraries capnp-rpc capnp-rpc-unix testlib logs.fmt - mirage-crypto-rng-eio testbed eio_main eio.mock)) + testbed eio_main eio.mock)) diff --git a/test/test.ml b/test/test.ml index 4aaae1a7..5a349ded 100644 --- a/test/test.ml +++ b/test/test.ml @@ -806,7 +806,6 @@ let rpc_tests ~net ~dir = let () = Eio_main.run @@ fun env -> - Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun () -> (* Eio_unix.Ctf.with_tracing "/tmp/trace.ctf" @@ fun () -> *) Alcotest.run ~and_exit:false "capnp-rpc" [ "eio", rpc_tests ~net:env#net ~dir:env#cwd; diff --git a/unix/capnp_rpc_unix.ml b/unix/capnp_rpc_unix.ml index 2124a291..74798a22 100644 --- a/unix/capnp_rpc_unix.ml +++ b/unix/capnp_rpc_unix.ml @@ -2,6 +2,8 @@ open Eio.Std module Log = Capnp_rpc.Debug.Log +let () = Mirage_crypto_rng_unix.use_default () + module CapTP = Vat_network.CapTP module Vat = Vat_network.Vat module Network = Network diff --git a/unix/dune b/unix/dune index 57ef2fbc..5ac3d4de 100644 --- a/unix/dune +++ b/unix/dune @@ -1,4 +1,4 @@ (library (name capnp_rpc_unix) (public_name capnp-rpc-unix) - (libraries eio.unix astring capnp-rpc capnp-rpc-net fmt logs cmdliner cstruct extunix)) + (libraries eio.unix astring capnp-rpc capnp-rpc-net fmt logs mirage-crypto-rng.unix cmdliner cstruct extunix))