From 9e0bdeabb131509ab704801d732cd5e5811b29c3 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Wed, 8 Oct 2025 12:24:06 -0300 Subject: [PATCH 01/23] Add Nix support --- .envrc | 1 + .gitignore | 7 +- Cargo.lock | 370 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.lock | 59 +++++++++ flake.nix | 27 ++++ 5 files changed, 461 insertions(+), 3 deletions(-) create mode 100644 .envrc create mode 100644 Cargo.lock create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index ed2c0587..ad835dbc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,12 @@ .vscode .idea +# Direnv +.direnv + # Rust/Cargo debug/ target/ -# TODO(template) Cargo.lock should be tracked in binary crates, but not in libraries -Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb @@ -15,4 +16,4 @@ Cargo.lock **/*.rs.bk # Code coverage output -lcov.info \ No newline at end of file +lcov.info diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..6bca3cdc --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,370 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "examples" +version = "0.1.0" +dependencies = [ + "template_crate", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.176" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bb0be07becd10686a0bb407298fb425360a5c44a663774406340c59a22de4ce" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core", +] + +[[package]] +name = "regex-syntax" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +dependencies = [ + "fastrand", + "getrandom", + "once_cell", + "rustix", + "windows-sys", +] + +[[package]] +name = "template_crate" +version = "0.1.0" +dependencies = [ + "proptest", + "thiserror", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..4cef2615 --- /dev/null +++ b/flake.lock @@ -0,0 +1,59 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1759632233, + "narHash": "sha256-krgZxGAIIIKFJS+UB0l8do3sYUDWJc75M72tepmVMzE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..b190977d --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + inputs = { + utils.url = "github:numtide/flake-utils"; + }; + outputs = { nixpkgs, utils, ... }: utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + rustc + cargo + rust-analyzer + rustfmt + clippy + ]; + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + + shellHook = '' + chmod +x .githooks/* && ln -sf $(pwd)/.githooks/* .git/hooks/ + ''; + }; + + } + ); +} From 2a84c79749148c123e82b47db813c3250b6dee80 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Wed, 8 Oct 2025 15:04:18 -0300 Subject: [PATCH 02/23] Add `typos` --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index b190977d..504b2a40 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,8 @@ rust-analyzer rustfmt clippy + + typos ]; RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; From 00a2bc9a06e614251fda538ba09eacf91361aa83 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 10:45:27 -0300 Subject: [PATCH 03/23] Apply copilot suggestions --- flake.lock | 6 ++++-- flake.nix | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 4cef2615..0a8f9ecd 100644 --- a/flake.lock +++ b/flake.lock @@ -10,8 +10,10 @@ "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index 504b2a40..b09e554e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,6 @@ { inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/d7f52a7a640bc54c7bb414cca603835bf8dd4b10"; utils.url = "github:numtide/flake-utils"; }; outputs = { nixpkgs, utils, ... }: utils.lib.eachDefaultSystem (system: @@ -7,7 +8,7 @@ pkgs = nixpkgs.legacyPackages.${system}; in { - devShell = pkgs.mkShell { + devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ rustc cargo From 318c011cdf1e6c2825cde672db50c436a5b3a05f Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 11:42:02 -0300 Subject: [PATCH 04/23] Update Cargo.lock --- Cargo.lock | 363 ++++------------------------------------------------- 1 file changed, 26 insertions(+), 337 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6bca3cdc..54610fd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,368 +3,57 @@ version = 4 [[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "bit-set" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - -[[package]] -name = "bitflags" -version = "2.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" - -[[package]] -name = "cfg-if" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "examples" +name = "charon" version = "0.1.0" -dependencies = [ - "template_crate", -] - -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "getrandom" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.176" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" - -[[package]] -name = "linux-raw-sys" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proptest" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb0be07becd10686a0bb407298fb425360a5c44a663774406340c59a22de4ce" -dependencies = [ - "bit-set", - "bit-vec", - "bitflags", - "lazy_static", - "num-traits", - "rand", - "rand_chacha", - "rand_xorshift", - "regex-syntax", - "rusty-fork", - "tempfile", - "unarray", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quote" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core", -] [[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_xorshift" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" -dependencies = [ - "rand_core", -] - -[[package]] -name = "regex-syntax" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" - -[[package]] -name = "rustix" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "rusty-fork" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" -dependencies = [ - "fnv", - "quick-error", - "tempfile", - "wait-timeout", -] - -[[package]] -name = "syn" -version = "2.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" -dependencies = [ - "fastrand", - "getrandom", - "once_cell", - "rustix", - "windows-sys", -] - -[[package]] -name = "template_crate" +name = "charon-cli" version = "0.1.0" -dependencies = [ - "proptest", - "thiserror", -] [[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] +name = "charon-cluster" +version = "0.1.0" [[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +name = "charon-consensus" +version = "0.1.0" [[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" +name = "charon-core" +version = "0.1.0" [[package]] -name = "unicode-ident" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +name = "charon-crypto" +version = "0.1.0" [[package]] -name = "wait-timeout" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" -dependencies = [ - "libc", -] +name = "charon-db" +version = "0.1.0" [[package]] -name = "wasi" -version = "0.14.7+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" -dependencies = [ - "wasip2", -] +name = "charon-dkg" +version = "0.1.0" [[package]] -name = "wasip2" -version = "1.0.1+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" -dependencies = [ - "wit-bindgen", -] +name = "charon-errors" +version = "0.1.0" [[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +name = "charon-eth2" +version = "0.1.0" [[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] +name = "charon-observability" +version = "0.1.0" [[package]] -name = "wit-bindgen" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +name = "charon-p2p" +version = "0.1.0" [[package]] -name = "zerocopy" -version = "0.8.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" -dependencies = [ - "zerocopy-derive", -] +name = "charon-serde" +version = "0.1.0" [[package]] -name = "zerocopy-derive" -version = "0.8.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +name = "charon-testutil" +version = "0.1.0" From bd92d4f6e30ff81f33f79ac6be76d74dcc5860c4 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Wed, 8 Oct 2025 12:40:08 -0300 Subject: [PATCH 05/23] Add Dockerfile and .dockerignore --- .dockerignore | 17 +++++++++++++++++ Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..0fa93ad4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +.git +.githooks +.gitignore +.github +.envrc +.direnv +.vscode +.idea + +debug +target + +*.pdb +**/*.rs.bk +lcov.info + +*.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..322d33fe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:22.04 AS builder + +# Set up Nix +RUN apt-get update && apt-get install curl -y +RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- \ + install linux \ + --extra-conf "sandbox = false" \ + --init none \ + --no-confirm +ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin" +RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf + +# Build the application +COPY . /build +WORKDIR /build +RUN nix develop --command bash -c \ + "cargo build --release" + +# Store all required dependencies in `/libs` +RUN mkdir -p /libs +RUN nix develop --command bash -c \ + "ldd /build/target/release/haron | awk '{if (\$3 ~ /^\//) print \$3}' | xargs -I '{}' cp --parents '{}' /libs" + +FROM alpine:3.21.4 AS app +# Could also use Debian: +# FROM debian:trixie-slim AS app + +# Copy the built application and its dependencies +COPY --from=builder /libs / +COPY --from=builder /build/target/release/haron /app/bin/haron + +# Fix interpreter path +RUN cp $(find /nix/store/ -name "*ld-linux*") $(find /nix/store/ -name "*ld-linux*" | sed s/lib64/lib/g) +# Could also use `patchelf`: +# RUN patchelf --set-interpreter $(find /nix/store/ -name "*ld-linux*") /app/bin/haron + +# Run the application +EXPOSE 3000 +CMD ["/app/bin/haron"] From 3b6eb629eb590f4acfc8006d95dede2ea781fca9 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 11:56:30 -0300 Subject: [PATCH 06/23] Add placeholder executable --- Cargo.lock | 707 ++++++++++++++++++++++++++++++++++ Cargo.toml | 4 + crates/charon-cli/Cargo.toml | 2 + crates/charon-cli/src/lib.rs | 39 -- crates/charon-cli/src/main.rs | 35 ++ 5 files changed, 748 insertions(+), 39 deletions(-) delete mode 100644 crates/charon-cli/src/lib.rs create mode 100644 crates/charon-cli/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 54610fd4..0ab12096 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,112 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "axum" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18ed336352031311f4e0b4dd2ff392d4fbb370777c9d18d7fc9d7359f73871" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59446ce19cd142f8833f856eb31f3eb097812d1479ab224f54d72428ca21ea22" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + [[package]] name = "charon" version = "0.1.0" @@ -9,6 +115,10 @@ version = "0.1.0" [[package]] name = "charon-cli" version = "0.1.0" +dependencies = [ + "axum", + "tokio", +] [[package]] name = "charon-cluster" @@ -57,3 +167,600 @@ version = "0.1.0" [[package]] name = "charon-testutil" version = "0.1.0" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "tokio" +version = "1.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml index 03f294c0..c2fb62b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,10 @@ repository = "https://github.com/NethermindEth/charon-rs" license = "Apache-2.0" # TODO(template) update license publish = false +[workspace.dependencies] +axum = "0.8.6" +tokio = { version = "1", features = ["full"] } + [workspace.lints.rust] missing_docs = "deny" unsafe_code = "forbid" diff --git a/crates/charon-cli/Cargo.toml b/crates/charon-cli/Cargo.toml index 37a9cea3..a31d4e1a 100644 --- a/crates/charon-cli/Cargo.toml +++ b/crates/charon-cli/Cargo.toml @@ -7,6 +7,8 @@ license.workspace = true publish.workspace = true [dependencies] +axum.workspace = true +tokio.workspace = true [lints] workspace = true diff --git a/crates/charon-cli/src/lib.rs b/crates/charon-cli/src/lib.rs deleted file mode 100644 index 338a369a..00000000 --- a/crates/charon-cli/src/lib.rs +++ /dev/null @@ -1,39 +0,0 @@ -//! # Charon CLI -//! -//! Command-line interface for the Charon distributed validator node. -//! This crate provides the CLI tools and commands for managing and operating -//! Charon validator nodes. - -/// Adds two numbers together. -/// -/// # Arguments -/// -/// * `left` - The first number to add -/// * `right` - The second number to add -/// -/// # Returns -/// -/// The sum of the two numbers -/// -/// # Examples -/// -/// ``` -/// use charon_cli::add; -/// -/// let result = add(2, 2); -/// assert_eq!(result, 4); -/// ``` -pub fn add(left: u64, right: u64) -> u64 { - left.wrapping_add(right) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/crates/charon-cli/src/main.rs b/crates/charon-cli/src/main.rs new file mode 100644 index 00000000..a98f4f85 --- /dev/null +++ b/crates/charon-cli/src/main.rs @@ -0,0 +1,35 @@ +//! # Charon CLI +//! +//! Command-line interface for the Charon distributed validator node. +//! This crate provides the CLI tools and commands for managing and operating +//! Charon validator nodes. +//! +//! TODO: This is a placeholder to have an executable crate in the workspace. + +use axum::{Router, routing::get}; +use tokio::net::TcpListener; + +#[tokio::main] +async fn main() { + let app = Router::new().route("/", get(|| async { root() })); + + let addr = "0.0.0.0:3000"; + let listener = TcpListener::bind(addr).await.unwrap(); + println!("Listening on {}", addr); + + axum::serve(listener, app).await.unwrap(); +} + +fn root() -> &'static str { + "Hello, World!" +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn root_says_hello() { + assert_eq!(root(), "Hello, World!"); + } +} From 43f9d7c53c970e261236b24e491702ab0ca9b5a9 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 12:11:03 -0300 Subject: [PATCH 07/23] Include cargo tools in Nix --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flake.nix b/flake.nix index b09e554e..3ae08a1a 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,9 @@ rustfmt clippy + cargo-sort + cargo-deny + typos ]; RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; From b2c4de5504568f60e9ef96990c81dfd859d92806 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 12:11:18 -0300 Subject: [PATCH 08/23] Remove the need for nightly --- .githooks/pre-push | 6 +++--- rustfmt.toml | 20 +------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index 2d1ae936..ea206eb2 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -1,5 +1,5 @@ #!/bin/sh -set -e +set -e # Dependency sorting if ! cargo sort --workspace --check; then @@ -14,8 +14,8 @@ if ! cargo deny check; then fi # Formatting check -if ! cargo +nightly fmt --all -- --check; then - echo "❌ Formatting issues (run 'cargo +nightly fmt --all')" +if ! cargo fmt --all -- --check; then + echo "❌ Formatting issues (run 'cargo fmt --all')" exit 3 fi diff --git a/rustfmt.toml b/rustfmt.toml index e459209d..bc8aee96 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,26 +1,8 @@ -############################################################################## -# Rustfmt configuration – project-wide style guide -# -# Docs: https://rust-lang.github.io/rustfmt -############################################################################## - -# --- Imports ---------------------------------------------------------------- reorder_imports = true # Alphabetise & group `use` items. -imports_granularity = "Crate" # Merge paths that share the same crate - # → e.g. `use std::{fmt, io};` -condense_wildcard_suffixes = true # Prefer `use foo::{self, Bar};` - # over two separate lines. -# --- Readability ------------------------------------------------------------ max_width = 100 # Hard column limit for all code -wrap_comments = true # Break comments to fit on the line -format_code_in_doc_comments= true # Rust-format code blocks in docs -use_field_init_shorthand = true # `{ x, y }` instead of `{ x: x, y: y }` -trailing_comma = "Vertical" # Comma-terminate every multi-line list -# ---------- Implementation order ------------------------------------------- -reorder_impl_items = true # Deterministic ordering inside impl blocks +use_field_init_shorthand = true # `{ x, y }` instead of `{ x: x, y: y }` -# --- Misc ------------------------------------------------------------------- edition = "2024" # Controls the edition of the Rust Style Guide # to use for formatting (RFC 3338) From 557e18cad6fcf00bc2418f06d648b1da45277c77 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 12:11:23 -0300 Subject: [PATCH 09/23] Fix checks on placeholder app --- crates/charon-cli/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/charon-cli/src/main.rs b/crates/charon-cli/src/main.rs index a98f4f85..6077162d 100644 --- a/crates/charon-cli/src/main.rs +++ b/crates/charon-cli/src/main.rs @@ -14,10 +14,10 @@ async fn main() { let app = Router::new().route("/", get(|| async { root() })); let addr = "0.0.0.0:3000"; - let listener = TcpListener::bind(addr).await.unwrap(); + let listener = TcpListener::bind(addr).await.expect("Impossible!"); println!("Listening on {}", addr); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await.expect("Impossible!"); } fn root() -> &'static str { From 2efc02b61e5707f688a46ff0187f1f85abaa3cf6 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 12:18:27 -0300 Subject: [PATCH 10/23] Adjust target name --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 322d33fe..26680f0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN nix develop --command bash -c \ # Store all required dependencies in `/libs` RUN mkdir -p /libs RUN nix develop --command bash -c \ - "ldd /build/target/release/haron | awk '{if (\$3 ~ /^\//) print \$3}' | xargs -I '{}' cp --parents '{}' /libs" + "ldd /build/target/release/charon-cli | awk '{if (\$3 ~ /^\//) print \$3}' | xargs -I '{}' cp --parents '{}' /libs" FROM alpine:3.21.4 AS app # Could also use Debian: @@ -27,13 +27,13 @@ FROM alpine:3.21.4 AS app # Copy the built application and its dependencies COPY --from=builder /libs / -COPY --from=builder /build/target/release/haron /app/bin/haron +COPY --from=builder /build/target/release/charon-cli /app/bin/charon-cli # Fix interpreter path RUN cp $(find /nix/store/ -name "*ld-linux*") $(find /nix/store/ -name "*ld-linux*" | sed s/lib64/lib/g) # Could also use `patchelf`: -# RUN patchelf --set-interpreter $(find /nix/store/ -name "*ld-linux*") /app/bin/haron +# RUN patchelf --set-interpreter $(find /nix/store/ -name "*ld-linux*") /app/bin/charon-cli # Run the application EXPOSE 3000 -CMD ["/app/bin/haron"] +CMD ["/app/bin/charon-cli"] From 8159eb6c6fda54561acbf6bab4845a5349a68dfe Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Thu, 9 Oct 2025 13:20:24 -0300 Subject: [PATCH 11/23] Build only the CLI --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 26680f0d..8cbb603c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf COPY . /build WORKDIR /build RUN nix develop --command bash -c \ - "cargo build --release" + "cargo build --release --package charon-cli --locked --target x86_64-unknown-linux-gnu" # Store all required dependencies in `/libs` RUN mkdir -p /libs From 1f781b5758e451a4e00d5c4b9735c66ed18a2f4b Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 12:41:02 -0300 Subject: [PATCH 12/23] Rely on system libraries - Cannot set up nightly without breaking stuff --- flake.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 3ae08a1a..96678a58 100644 --- a/flake.nix +++ b/flake.nix @@ -10,18 +10,14 @@ { devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ - rustc - cargo - rust-analyzer - rustfmt - clippy + cargo-sort + cargo-deny cargo-sort cargo-deny typos ]; - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; shellHook = '' chmod +x .githooks/* && ln -sf $(pwd)/.githooks/* .git/hooks/ From 19ce2bda3a27179cbd6d744fd0bacae83b95a648 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 12:43:44 -0300 Subject: [PATCH 13/23] Remove duplicated inputs --- flake.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/flake.nix b/flake.nix index 96678a58..ee172405 100644 --- a/flake.nix +++ b/flake.nix @@ -13,9 +13,6 @@ cargo-sort cargo-deny - cargo-sort - cargo-deny - typos ]; From bc12ac4e4c1ee3758e9c4a815ff19230e7325f7c Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 12:52:08 -0300 Subject: [PATCH 14/23] Use `rust:1.89` and `debian:trixie-slim` as images - Bigger image (80 mb vs 14 mb) --- Dockerfile | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8cbb603c..21a3b979 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,11 @@ -FROM ubuntu:22.04 AS builder +FROM rust:1.89 AS builder -# Set up Nix -RUN apt-get update && apt-get install curl -y -RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- \ - install linux \ - --extra-conf "sandbox = false" \ - --init none \ - --no-confirm -ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin" -RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf - -# Build the application COPY . /build WORKDIR /build -RUN nix develop --command bash -c \ - "cargo build --release --package charon-cli --locked --target x86_64-unknown-linux-gnu" - -# Store all required dependencies in `/libs` -RUN mkdir -p /libs -RUN nix develop --command bash -c \ - "ldd /build/target/release/charon-cli | awk '{if (\$3 ~ /^\//) print \$3}' | xargs -I '{}' cp --parents '{}' /libs" +RUN cargo build --release --package charon-cli --locked -FROM alpine:3.21.4 AS app -# Could also use Debian: -# FROM debian:trixie-slim AS app +FROM debian:trixie-slim AS app -# Copy the built application and its dependencies -COPY --from=builder /libs / COPY --from=builder /build/target/release/charon-cli /app/bin/charon-cli -# Fix interpreter path -RUN cp $(find /nix/store/ -name "*ld-linux*") $(find /nix/store/ -name "*ld-linux*" | sed s/lib64/lib/g) -# Could also use `patchelf`: -# RUN patchelf --set-interpreter $(find /nix/store/ -name "*ld-linux*") /app/bin/charon-cli - -# Run the application -EXPOSE 3000 CMD ["/app/bin/charon-cli"] From bd94953bdfef7b5cfb2d2c8bf2500e4955e18a1f Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 12:55:56 -0300 Subject: [PATCH 15/23] Use bookworm instead of trixie --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 21a3b979..546a0933 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ COPY . /build WORKDIR /build RUN cargo build --release --package charon-cli --locked -FROM debian:trixie-slim AS app +FROM debian:bookworm-slim AS app COPY --from=builder /build/target/release/charon-cli /app/bin/charon-cli From 0fd00facc33b044340b954e292b38e87f3a77c7c Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 13:12:50 -0300 Subject: [PATCH 16/23] Formatting --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 546a0933..a41d3a1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ FROM rust:1.89 AS builder -COPY . /build WORKDIR /build +COPY . . RUN cargo build --release --package charon-cli --locked FROM debian:bookworm-slim AS app COPY --from=builder /build/target/release/charon-cli /app/bin/charon-cli - CMD ["/app/bin/charon-cli"] From c4a19f9b436fff2911b9ea8b31e1482d08119b98 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 13:15:21 -0300 Subject: [PATCH 17/23] Revert changes to `rustfmt.toml` --- rustfmt.toml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/rustfmt.toml b/rustfmt.toml index bc8aee96..e459209d 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,8 +1,26 @@ +############################################################################## +# Rustfmt configuration – project-wide style guide +# +# Docs: https://rust-lang.github.io/rustfmt +############################################################################## + +# --- Imports ---------------------------------------------------------------- reorder_imports = true # Alphabetise & group `use` items. +imports_granularity = "Crate" # Merge paths that share the same crate + # → e.g. `use std::{fmt, io};` +condense_wildcard_suffixes = true # Prefer `use foo::{self, Bar};` + # over two separate lines. +# --- Readability ------------------------------------------------------------ max_width = 100 # Hard column limit for all code - +wrap_comments = true # Break comments to fit on the line +format_code_in_doc_comments= true # Rust-format code blocks in docs use_field_init_shorthand = true # `{ x, y }` instead of `{ x: x, y: y }` +trailing_comma = "Vertical" # Comma-terminate every multi-line list + +# ---------- Implementation order ------------------------------------------- +reorder_impl_items = true # Deterministic ordering inside impl blocks +# --- Misc ------------------------------------------------------------------- edition = "2024" # Controls the edition of the Rust Style Guide # to use for formatting (RFC 3338) From 1b928f29baeb21153579317f83d0a3ae19a7aaa4 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 13:18:00 -0300 Subject: [PATCH 18/23] Revert changes to `pre-push` --- .githooks/pre-push | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index ea206eb2..3b2047b0 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -14,8 +14,8 @@ if ! cargo deny check; then fi # Formatting check -if ! cargo fmt --all -- --check; then - echo "❌ Formatting issues (run 'cargo fmt --all')" +if ! cargo +nightly fmt --all -- --check; then + echo "❌ Formatting issues (run 'cargo +nightly fmt --all')" exit 3 fi From b71f22954a495766db376a7ecb772f5e691a9de1 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Fri, 10 Oct 2025 13:19:17 -0300 Subject: [PATCH 19/23] Expose port 3030 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a41d3a1a..4a7557d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,5 @@ RUN cargo build --release --package charon-cli --locked FROM debian:bookworm-slim AS app COPY --from=builder /build/target/release/charon-cli /app/bin/charon-cli +EXPOSE 3030 CMD ["/app/bin/charon-cli"] From e2d9f847b3dbb8e988653e80c1d95824c6a20b02 Mon Sep 17 00:00:00 2001 From: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com> Date: Tue, 21 Oct 2025 00:02:45 +0800 Subject: [PATCH 20/23] feat: add core/types (#10) * feat: setup initial project structure * feat: update CI to use nightly toolchain for rustfmt * feat: update CI to use nightly toolchain for rustfmt * fix: fmt * refactor: reorganize workspace members and remove charon-types crate * feat: add core types and dependencies for Charon * feat: add is_valid method and tests for DutyType * feat: enhance Charon core types with new methods and error handling for PubKey * chore: remove unused proptest dependency from workspace * feat: implement Default trait for UnsignedDataSet, ParSignedDataSet, and SignedDataSet * refactor: update PubKey methods for improved error handling and add try_from implementation * docs: clarify slot duration comment and add debug prints for PubKey serialization/deserialization tests * fix: remove unnecessary println --- Cargo.toml | 6 + crates/charon-core/Cargo.toml | 4 + crates/charon-core/src/lib.rs | 35 +- crates/charon-core/src/types.rs | 910 ++++++++++++++++++++++++++++++++ 4 files changed, 922 insertions(+), 33 deletions(-) create mode 100644 crates/charon-core/src/types.rs diff --git a/Cargo.toml b/Cargo.toml index c2fb62b5..8eae91bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,12 @@ tokio = { version = "1", features = ["full"] } missing_docs = "deny" unsafe_code = "forbid" +[workspace.dependencies] +serde = { version = "1.0", features = ["derive"] } +serde_json = { version = "^1.0" } +hex = { version = "^0.4.3" } +chrono = { version = "0.4", features = ["serde"] } + [workspace.lints.clippy] arithmetic_side_effects = "deny" cast_lossless = "deny" diff --git a/crates/charon-core/Cargo.toml b/crates/charon-core/Cargo.toml index 3b92ed1a..baba8427 100644 --- a/crates/charon-core/Cargo.toml +++ b/crates/charon-core/Cargo.toml @@ -7,6 +7,10 @@ license.workspace = true publish.workspace = true [dependencies] +serde.workspace = true +serde_json.workspace = true +hex.workspace = true +chrono.workspace = true [lints] workspace = true diff --git a/crates/charon-core/src/lib.rs b/crates/charon-core/src/lib.rs index a3ed9a9d..7a6c37d5 100644 --- a/crates/charon-core/src/lib.rs +++ b/crates/charon-core/src/lib.rs @@ -4,36 +4,5 @@ //! This crate provides the fundamental building blocks, data structures, and //! core algorithms used throughout the Charon system. -/// Adds two numbers together. -/// -/// # Arguments -/// -/// * `left` - The first number to add -/// * `right` - The second number to add -/// -/// # Returns -/// -/// The sum of the two numbers -/// -/// # Examples -/// -/// ``` -/// use charon_core::add; -/// -/// let result = add(2, 2); -/// assert_eq!(result, 4); -/// ``` -pub fn add(left: u64, right: u64) -> u64 { - left.wrapping_add(right) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} +/// Types for the Charon core. +pub mod types; diff --git a/crates/charon-core/src/types.rs b/crates/charon-core/src/types.rs new file mode 100644 index 00000000..9328ded2 --- /dev/null +++ b/crates/charon-core/src/types.rs @@ -0,0 +1,910 @@ +//! Types for the Charon core. + +use std::{collections::HashMap, fmt::Display, iter}; + +use chrono::{DateTime, Duration, Utc}; +use serde::{Deserialize, Serialize}; +use std::fmt::Debug as StdDebug; + +/// The type of duty. +#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum DutyType { + /// Unknown duty type. + Unknown, + /// Proposer duty type. + Proposer, + /// Attester duty type. + Attester, + /// Signature duty type. + Signature, + /// Exit duty type. + Exit, + /// Builder proposer duty type. + BuilderProposer, + /// Builder registration duty type. + BuilderRegistration, + /// Randao duty type. + Randao, + /// Prepare aggregator duty type. + PrepareAggregator, + /// Aggregator duty type. + Aggregator, + /// Sync message duty type. + SyncMessage, + /// Prepare sync contribution duty type. + PrepareSyncContribution, + /// Sync contribution duty type. + SyncContribution, + /// Info sync duty type. + InfoSync, + /// Duty sentinel duty type. Must always be last. + DutySentinel(Box), +} + +impl Display for DutyType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + // safe to unwrap because we know the duty type is valid + let v = serde_json::to_value(self).expect("failed to serialize duty type"); + if let Some(s) = v.as_str() { + write!(f, "{}", s) + } else { + // fallback for non-string variants (structs, numbers, etc.) + write!(f, "{}", v) + } + } +} + +impl DutyType { + /// Returns true if the duty type is valid. + pub fn is_valid(&self) -> bool { + !matches!(self, DutyType::Unknown | DutyType::DutySentinel(_)) + } +} + +/// SlotNumber struct +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct SlotNumber(u64); + +impl Display for SlotNumber { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +impl From for SlotNumber { + fn from(slot: u64) -> Self { + Self::new(slot) + } +} + +impl From for u64 { + fn from(slot: SlotNumber) -> Self { + slot.inner() + } +} + +impl SlotNumber { + /// Create a new slot number. + pub fn new(slot: u64) -> Self { + SlotNumber(slot) + } + + /// Inner slot number. + pub fn inner(&self) -> u64 { + self.0 + } + + /// Next slot number. + pub fn next(&self) -> Self { + Self::new(self.inner().saturating_add(1)) + } +} + +/// Duty struct +#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Duty { + /// Ethereum consensus layer slot. + pub slot: SlotNumber, + /// Duty type performed in the slot. + pub duty_type: DutyType, +} + +impl Display for Duty { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}/{}", self.slot, self.duty_type) + } +} + +impl Duty { + /// Create a new duty. + pub fn new(slot: SlotNumber, duty_type: DutyType) -> Self { + Self { slot, duty_type } + } + + /// Create a new attester duty. + pub fn new_attester_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::Attester) + } + + /// Create a new randao duty. + pub fn new_randao_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::Randao) + } + + /// Create a new voluntary exit duty. + pub fn new_voluntary_exit_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::Exit) + } + + /// Create a new proposer duty. + pub fn new_proposer_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::Proposer) + } + + /// Create a new builder proposer duty. + pub fn new_builder_proposer_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::BuilderProposer) + } + + /// Create a new builder registration duty. + pub fn new_builder_registration_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::BuilderRegistration) + } + + /// Create a new sync contribution duty. + pub fn new_sync_contribution_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::SyncContribution) + } + + /// Create a new signature duty. + pub fn new_signature_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::Signature) + } + + /// Create a new prepare aggregator duty. + pub fn new_prepare_aggregator_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::PrepareAggregator) + } + + /// Create a new aggregator duty. + pub fn new_aggregator_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::Aggregator) + } + + /// Create a new sync message duty. + pub fn new_sync_message_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::SyncMessage) + } + + /// Create a new prepare sync contribution duty. + pub fn new_prepare_sync_contribution_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::PrepareSyncContribution) + } + + /// Create a new info sync duty. + pub fn new_info_sync_duty(slot: SlotNumber) -> Self { + Self::new(slot, DutyType::InfoSync) + } +} + +/// The type of proposal. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum ProposalType { + /// Full proposal type. + Full, + /// Builder proposal type. + Builder, + /// Synthetic proposal type. + Synthetic, +} + +// In golang implementation they use pk_len = 98, which is 0x + [48 bytes] +// We use pk_len = 48, which is [48 bytes], the main difference is that we store +// the pub key as [u8; 48] instead of string. +// [original implementation](https://github.com/ObolNetwork/charon/blob/b3008103c5429b031b63518195f4c49db4e9a68d/core/types.go#L264) +const PK_LEN: usize = 48; +const SIG_LEN: usize = 96; + +/// Public key struct +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct PubKey(pub(crate) [u8; PK_LEN]); + +impl Serialize for PubKey { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(&self.to_string()) + } +} + +impl TryFrom for PubKey { + type Error = PubKeyError; + + fn try_from(value: String) -> Result { + let value = value.strip_prefix("0x").unwrap_or(&value); + let hex_value = hex::decode(value).map_err(|_| PubKeyError::InvalidString)?; + PubKey::try_from(hex_value.as_slice()) + } +} + +impl<'de> Deserialize<'de> for PubKey { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let hex_str = String::deserialize(deserializer)?; + let hex_str = hex_str.strip_prefix("0x").unwrap_or(&hex_str); + + let bytes = hex::decode(hex_str).map_err(serde::de::Error::custom)?; + + if bytes.len() != PK_LEN { + return Err(serde::de::Error::custom(format!( + "invalid public key length: got {}, want {}", + bytes.len(), + PK_LEN + ))); + } + + let mut pk = [0u8; PK_LEN]; + pk.copy_from_slice(&bytes); + Ok(PubKey(pk)) + } +} + +impl From<[u8; PK_LEN]> for PubKey { + fn from(pk: [u8; PK_LEN]) -> Self { + PubKey(pk) + } +} + +/// Public key error type +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PubKeyError { + /// Invalid public key length. + InvalidLength, + /// Invalid public key string. + InvalidString, +} + +impl PubKey { + /// Create a new public key. + pub fn new(pk: [u8; PK_LEN]) -> Self { + PubKey(pk) + } + + /// Returns logging-friendly abbreviated form: "b82_97f" + pub fn abbreviated(&self) -> String { + let hex = hex::encode(self.0); + format!("{}_{}", &hex[0..3], &hex[93..96]) + } +} + +impl TryFrom<&[u8]> for PubKey { + type Error = PubKeyError; + + fn try_from(bytes: &[u8]) -> Result { + if bytes.len() != PK_LEN { + return Err(PubKeyError::InvalidLength); + } + let mut arr = [0u8; PK_LEN]; + arr.copy_from_slice(bytes); + Ok(PubKey(arr)) + } +} + +impl Display for PubKey { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "0x{}", hex::encode(self.0)) + } +} + +/// Implement AsRef<[u8]> for PubKey to allow for easy conversion to bytes. +impl AsRef<[u8]> for PubKey { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + +// todo: add toEth2Format for the pub key +// https://github.com/ObolNetwork/charon/blob/b3008103c5429b031b63518195f4c49db4e9a68d/core/types.go#L311 + +/// Duty definition type +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct DutyDefinition(T); + +impl DutyDefinition +where + T: Clone + Serialize + StdDebug, +{ + /// Create a new duty definition. + pub fn new(duty_definition: T) -> Self { + Self(duty_definition) + } +} + +/// Duty definition set +#[derive(Debug, Default, Clone, PartialEq, Eq)] +pub struct DutyDefinitionSet(HashMap>) +where + T: Clone + Serialize + StdDebug; + +impl DutyDefinitionSet +where + T: Clone + Serialize + StdDebug, +{ + /// Create a new duty definition set. + pub fn new() -> Self { + Self(HashMap::default()) + } + + /// Get a duty definition by duty type. + pub fn get(&self, duty_type: &DutyType) -> Option<&DutyDefinition> { + self.0.get(duty_type) + } + + /// Insert a duty definition. + pub fn insert(&mut self, duty_type: DutyType, duty_definition: DutyDefinition) { + self.0.insert(duty_type, duty_definition); + } + + /// Remove a duty definition by duty type. + pub fn remove(&mut self, duty_type: &DutyType) -> Option> { + self.0.remove(duty_type) + } + + /// Inner duty definition set. + pub fn inner(&self) -> &HashMap> { + &self.0 + } + + /// Inner duty definition set. + pub fn inner_mut(&mut self) -> &mut HashMap> { + &mut self.0 + } +} + +/// Unsigned data type +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct UnsignedData(T); + +impl UnsignedData +where + T: Clone + Serialize + StdDebug, +{ + /// Create a new unsigned data. + pub fn new(unsigned_data: T) -> Self { + Self(unsigned_data) + } +} +/// Unsigned data set +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct UnsignedDataSet(HashMap>) +where + T: Clone + Serialize + StdDebug; + +impl Default for UnsignedDataSet +where + T: Clone + Serialize + StdDebug, +{ + fn default() -> Self { + Self(HashMap::default()) + } +} + +impl UnsignedDataSet +where + T: Clone + Serialize + StdDebug, +{ + /// Create a new unsigned data set. + pub fn new() -> Self { + Self::default() + } + + /// Get an unsigned data by duty type. + pub fn get(&self, duty_type: &DutyType) -> Option<&UnsignedData> { + self.0.get(duty_type) + } + + /// Insert an unsigned data. + pub fn insert(&mut self, duty_type: DutyType, unsigned_data: UnsignedData) { + self.0.insert(duty_type, unsigned_data); + } + + /// Remove an unsigned data by duty type. + pub fn remove(&mut self, duty_type: &DutyType) -> Option> { + self.0.remove(duty_type) + } + + /// Inner unsigned data set. + pub fn inner(&self) -> &HashMap> { + &self.0 + } + + /// Inner unsigned data set. + pub fn inner_mut(&mut self) -> &mut HashMap> { + &mut self.0 + } +} + +// todo: add proper signature type +/// Signature type +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Signature(pub(crate) [u8; SIG_LEN]); + +impl Signature { + /// Create a new signature. + pub fn new(signature: [u8; SIG_LEN]) -> Self { + Signature(signature) + } +} + +/// Signed data type +pub trait SignedData: Clone + Serialize + StdDebug { + /// The error type + type Error: std::error::Error; + + /// signature returns the signed duty data's signature. + fn signature(&self) -> Signature; + + /// set_signature returns a copy of signed duty data with the signature + /// replaced. + fn set_signature(&mut self, signature: Signature) -> Result<(), Self::Error>; + + /// message_root returns the message root for the unsigned data. + fn message_root(&self) -> [u8; 32]; +} + +// todo: add Eth2SignedData type +// https://github.com/ObolNetwork/charon/blob/b3008103c5429b031b63518195f4c49db4e9a68d/core/types.go#L396 + +/// ParSignedData is a partially signed duty data only signed by a single +/// threshold BLS share. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ParSignedData { + /// Partially signed duty data. + pub signed_data: T, + + /// Threshold BLS share index. + pub share_idx: u64, +} + +impl ParSignedData +where + T: SignedData, +{ + /// Create a new partially signed data. + pub fn new(partially_signed_data: T, share_idx: u64) -> Self { + Self { + signed_data: partially_signed_data, + share_idx, + } + } +} + +/// ParSignedDataSet is a set of partially signed duty data only signed by a +/// single threshold BLS share. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ParSignedDataSet(HashMap>); + +impl Default for ParSignedDataSet +where + T: SignedData, +{ + fn default() -> Self { + Self(HashMap::default()) + } +} + +impl ParSignedDataSet +where + T: SignedData, +{ + /// Create a new partially signed data set. + pub fn new() -> Self { + Self::default() + } + + /// Get a partially signed data by public key. + pub fn get(&self, pub_key: &PubKey) -> Option<&ParSignedData> { + self.inner().get(pub_key) + } + + /// Insert a partially signed data. + pub fn insert(&mut self, pub_key: PubKey, partially_signed_data: ParSignedData) { + self.inner_mut().insert(pub_key, partially_signed_data); + } + + /// Remove a partially signed data by public key. + pub fn remove(&mut self, pub_key: &PubKey) -> Option> { + self.inner_mut().remove(pub_key) + } + + /// Inner partially signed data set. + pub fn inner(&self) -> &HashMap> { + &self.0 + } + + /// Inner partially signed data set. + pub fn inner_mut(&mut self) -> &mut HashMap> { + &mut self.0 + } +} + +/// SignedDataSet is a set of signed duty data. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SignedDataSet(HashMap); + +impl Default for SignedDataSet +where + T: SignedData, +{ + fn default() -> Self { + Self(HashMap::default()) + } +} + +impl SignedDataSet +where + T: SignedData, +{ + /// Create a new signed data set. + pub fn new() -> Self { + Self::default() + } + + /// Get a signed data by public key. + pub fn get(&self, pub_key: &PubKey) -> Option<&T> { + self.0.get(pub_key) + } + + /// Insert a signed data. + pub fn insert(&mut self, pub_key: PubKey, signed_data: T) { + self.0.insert(pub_key, signed_data); + } + + /// Remove a signed data by public key. + pub fn remove(&mut self, pub_key: &PubKey) -> Option { + self.0.remove(pub_key) + } + + /// Inner signed data set. + pub fn inner(&self) -> &HashMap { + &self.0 + } + + /// Inner signed data set. + pub fn inner_mut(&mut self) -> &mut HashMap { + &mut self.0 + } +} + +/// Slot struct +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Slot { + /// The slot number. + pub slot: SlotNumber, + + /// The time. + pub time: DateTime, + + /// The slot duration. + pub slot_duration: Duration, + + /// Slots per epoch. + pub slots_per_epoch: u64, +} + +impl Slot { + /// Get the epoch of the slot + pub fn epoch(&self) -> u64 { + #[allow(clippy::arithmetic_side_effects)] + self.slot.inner().saturating_div(self.slots_per_epoch) + } + + /// Returns true if this is the last slot in the epoch. + #[allow(clippy::arithmetic_side_effects)] + pub fn last_in_epoch(&self) -> bool { + self.slot.inner().wrapping_rem(self.slots_per_epoch) + == self.slots_per_epoch.saturating_sub(1) + } + + /// Returns true if this is the first slot in the epoch. + #[allow(clippy::arithmetic_side_effects)] + pub fn first_in_epoch(&self) -> bool { + self.slot.inner().wrapping_rem(self.slots_per_epoch) == 0 + } + + /// Returns the next slot + #[allow(clippy::arithmetic_side_effects)] + pub fn next_slot(&self) -> Slot { + Slot { + slot: self.slot.next(), + time: self.time + self.slot_duration, + slot_duration: self.slot_duration, + slots_per_epoch: self.slots_per_epoch, + } + } + + /// Returns an iterator over slots starting from this one + pub fn iter(&self) -> impl Iterator { + iter::successors(Some(self.clone()), |slot| Some(slot.next_slot())) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_pub_key_to_string() { + const ORIGINAL_PK_LEN: usize = 98; + + let key = PubKey::new([0; PK_LEN]); + + // Check whether the string representation is the same as the go's public key + // length + assert_eq!(key.to_string().len(), ORIGINAL_PK_LEN); + assert_eq!( + key.to_string(), + "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + } + + #[test] + fn test_new_builder_registration_duty() { + let duty = Duty::new_builder_registration_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::BuilderRegistration); + assert_eq!(duty.to_string(), "1/builder_registration"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_signature_duty() { + let duty = Duty::new_signature_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::Signature); + assert_eq!(duty.to_string(), "1/signature"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_prepare_aggregator_duty() { + let duty = Duty::new_prepare_aggregator_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::PrepareAggregator); + assert_eq!(duty.to_string(), "1/prepare_aggregator"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_aggregator_duty() { + let duty = Duty::new_aggregator_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::Aggregator); + assert_eq!(duty.to_string(), "1/aggregator"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_sync_contribution_duty() { + let duty = Duty::new_sync_contribution_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::SyncContribution); + assert_eq!(duty.to_string(), "1/sync_contribution"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_sync_message_duty() { + let duty = Duty::new_sync_message_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::SyncMessage); + assert_eq!(duty.to_string(), "1/sync_message"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_prepare_sync_contribution_duty() { + let duty = Duty::new_prepare_sync_contribution_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::PrepareSyncContribution); + assert_eq!(duty.to_string(), "1/prepare_sync_contribution"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_new_info_sync_duty() { + let duty = Duty::new_info_sync_duty(SlotNumber(1)); + assert_eq!(duty.duty_type, DutyType::InfoSync); + assert_eq!(duty.to_string(), "1/info_sync"); + assert_eq!(u64::from(duty.slot), 1); + } + + #[test] + fn test_slot() { + let slot = Slot { + slot: SlotNumber(123), + time: DateTime::from_timestamp(100, 100).unwrap(), + slot_duration: Duration::seconds(4), + slots_per_epoch: 32, + }; + + assert_eq!(u64::from(slot.slot), 0x7b); + assert_eq!(slot.epoch(), 3); + assert!(!slot.last_in_epoch()); + assert!(!slot.first_in_epoch()); + + let next = slot.next_slot(); + assert_eq!(next.slot, SlotNumber(124)); + assert_eq!(next.time, DateTime::from_timestamp(104, 100).unwrap()); + assert_eq!(next.slot_duration, Duration::seconds(4)); + assert_eq!(next.slots_per_epoch, 32); + } + + #[test] + fn test_serialize_pubkey() { + let pk = PubKey::new([42u8; PK_LEN]); + let serialized = serde_json::to_string(&pk).unwrap(); + assert_eq!(serialized, format!("\"0x{}\"", hex::encode([42u8; PK_LEN]))); + } + + #[test] + fn test_deserialize_pubkey() { + let serialized = format!("\"0x{}\"", hex::encode([42u8; PK_LEN])); + let deserialized: PubKey = serde_json::from_str(&serialized).unwrap(); + assert_eq!(deserialized, PubKey::new([42u8; PK_LEN])); + } + + #[test] + fn test_slot_iter() { + let slot = Slot { + slot: SlotNumber(123), + time: DateTime::from_timestamp(100, 100).unwrap(), + slot_duration: Duration::seconds(4), + slots_per_epoch: 32, + }; + + assert_eq!(slot.iter().nth(10).unwrap().slot, SlotNumber(133)); + assert_eq!(slot.iter().nth(31).unwrap().slot, SlotNumber(154)); + assert_eq!(slot.iter().nth(32).unwrap().slot, SlotNumber(155)); + assert_eq!(slot.iter().nth(33).unwrap().slot, SlotNumber(156)); + } + + #[test] + fn test_display_duty_type() { + assert_eq!(DutyType::Unknown.to_string(), "unknown"); + assert_eq!(DutyType::Proposer.to_string(), "proposer"); + assert_eq!(DutyType::Attester.to_string(), "attester"); + assert_eq!(DutyType::Signature.to_string(), "signature"); + assert_eq!(DutyType::Exit.to_string(), "exit"); + assert_eq!(DutyType::BuilderProposer.to_string(), "builder_proposer"); + assert_eq!( + DutyType::BuilderRegistration.to_string(), + "builder_registration" + ); + assert_eq!(DutyType::Randao.to_string(), "randao"); + assert_eq!( + DutyType::PrepareAggregator.to_string(), + "prepare_aggregator" + ); + assert_eq!(DutyType::Aggregator.to_string(), "aggregator"); + assert_eq!(DutyType::SyncMessage.to_string(), "sync_message"); + assert_eq!( + DutyType::PrepareSyncContribution.to_string(), + "prepare_sync_contribution" + ); + assert_eq!(DutyType::SyncContribution.to_string(), "sync_contribution"); + assert_eq!(DutyType::InfoSync.to_string(), "info_sync"); + } + + #[test] + fn test_duty_type_is_valid() { + assert!(!DutyType::Unknown.is_valid()); + assert!(DutyType::Proposer.is_valid()); + assert!(DutyType::Attester.is_valid()); + assert!(DutyType::Signature.is_valid()); + assert!(DutyType::Exit.is_valid()); + assert!(!DutyType::DutySentinel(Box::new(DutyType::Unknown)).is_valid()); + assert!(!DutyType::DutySentinel(Box::new(DutyType::Attester)).is_valid()); + } + + #[test] + fn test_pub_key_from_bytes() { + let bytes = [42u8; PK_LEN]; + let pk = PubKey::try_from(&bytes[..]).unwrap(); + assert_eq!(pk, PubKey::new(bytes)); + } + + #[test] + fn test_pub_key_from_bytes_invalid_length() { + let bytes = [42u8; PK_LEN + 1]; + let result = PubKey::try_from(&bytes[..]); + assert!(result.is_err()); + } + + #[test] + fn test_pub_key_abbreviated() { + let pk = PubKey::new([42u8; PK_LEN]); + assert_eq!(pk.abbreviated(), "2a2_a2a"); + } + + #[test] + fn test_duty_definition_set() { + let mut duty_definition_set = DutyDefinitionSet::new(); + duty_definition_set.insert(DutyType::Proposer, DutyDefinition::new(DutyType::Proposer)); + assert_eq!( + duty_definition_set.get(&DutyType::Proposer), + Some(&DutyDefinition::new(DutyType::Proposer)) + ); + } + + #[test] + fn test_unsigned_data_set() { + let mut unsigned_data_set = UnsignedDataSet::new(); + unsigned_data_set.insert(DutyType::Proposer, UnsignedData::new(DutyType::Proposer)); + assert_eq!( + unsigned_data_set.get(&DutyType::Proposer), + Some(&UnsignedData::new(DutyType::Proposer)) + ); + } + + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + struct MockSignedData; + + impl SignedData for MockSignedData { + type Error = std::io::Error; + + fn signature(&self) -> Signature { + Signature::new([42u8; SIG_LEN]) + } + + fn set_signature(&mut self, _signature: Signature) -> Result<(), std::io::Error> { + Ok(()) + } + + fn message_root(&self) -> [u8; 32] { + [42u8; 32] + } + } + + #[test] + fn test_partially_signed_data_set() { + let mut partially_signed_data_set = ParSignedDataSet::new(); + partially_signed_data_set.insert( + PubKey::new([42u8; PK_LEN]), + ParSignedData::new(MockSignedData, 0), + ); + assert_eq!( + partially_signed_data_set.get(&PubKey::new([42u8; PK_LEN])), + Some(&ParSignedData::new(MockSignedData, 0)) + ); + } + + #[test] + fn test_signed_data_set() { + let mut signed_data_set = SignedDataSet::new(); + signed_data_set.insert(PubKey::new([42u8; PK_LEN]), MockSignedData); + assert_eq!( + signed_data_set.get(&PubKey::new([42u8; PK_LEN])), + Some(&MockSignedData) + ); + } + + #[test] + fn test_pub_key_from_string() { + let pk_str = "0x7f790ba343adf8891fac21a94b02d6ca93d0bc2199a5ec083ff6676e8c2f9f78b08bb122f1093675f9d24c8b5e7af241".to_string(); + let pk = PubKey::try_from(pk_str).unwrap(); + assert_eq!( + pk, + PubKey::new([ + 127, 121, 11, 163, 67, 173, 248, 137, 31, 172, 33, 169, 75, 2, 214, 202, 147, 208, + 188, 33, 153, 165, 236, 8, 63, 246, 103, 110, 140, 47, 159, 120, 176, 139, 177, 34, + 241, 9, 54, 117, 249, 210, 76, 139, 94, 122, 242, 65 + ]) + ); + } + + #[test] + fn test_pub_key_from_string_invalid_length() { + let pk_str = "0x7f790ba343adf8891fac21a94b02d6ca93d0bc2199a5ec083ff6676e8c2f9f78b08bb121093675f9d24c8b5e7af241".to_string(); + let result = PubKey::try_from(pk_str); + assert!(result.is_err()); + } +} From a033307223b7bd9670dc15b20e10964df2ea7765 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel <31224949+emlautarom1@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:36:33 -0300 Subject: [PATCH 21/23] feat: Add Nix support (#11) * Add Nix support * Add `typos` * Apply copilot suggestions * Update Cargo.lock * Rely on system libraries - Cannot set up nightly without breaking stuff * Use `git config` instead of `ln` --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ee172405..51635e1e 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ ]; shellHook = '' - chmod +x .githooks/* && ln -sf $(pwd)/.githooks/* .git/hooks/ + chmod +x .githooks/* && git config --local core.hooksPath .githooks/ ''; }; From 4248d702eafb13c53405a6fdaaedafa68a59668a Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel Date: Mon, 20 Oct 2025 13:41:37 -0300 Subject: [PATCH 22/23] Fix merge --- Cargo.lock | 237 ++++++++++++++++++++++++++++++++++ Cargo.toml | 10 +- crates/charon-core/Cargo.toml | 4 +- 3 files changed, 243 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ab12096..91c32ff9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,27 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "atomic-waker" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + [[package]] name = "axum" version = "0.8.6" @@ -96,12 +111,28 @@ version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + [[package]] name = "bytes" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +[[package]] +name = "cc" +version = "1.2.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +dependencies = [ + "find-msvc-tools", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.3" @@ -131,6 +162,12 @@ version = "0.1.0" [[package]] name = "charon-core" version = "0.1.0" +dependencies = [ + "chrono", + "hex", + "serde", + "serde_json", +] [[package]] name = "charon-crypto" @@ -168,6 +205,32 @@ version = "0.1.0" name = "charon-testutil" version = "0.1.0" +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "find-msvc-tools" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" + [[package]] name = "fnv" version = "1.0.7" @@ -222,6 +285,12 @@ version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "http" version = "1.3.1" @@ -305,6 +374,30 @@ dependencies = [ "tower-service", ] +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "io-uring" version = "0.7.10" @@ -322,6 +415,16 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "js-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + [[package]] name = "libc" version = "0.2.177" @@ -381,6 +484,15 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "object" version = "0.37.3" @@ -470,6 +582,12 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + [[package]] name = "ryu" version = "1.0.20" @@ -489,6 +607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", + "serde_derive", ] [[package]] @@ -547,6 +666,12 @@ dependencies = [ "serde", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.6" @@ -686,12 +811,124 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-sys" version = "0.59.0" diff --git a/Cargo.toml b/Cargo.toml index 8eae91bb..72e34048 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,18 +26,16 @@ publish = false [workspace.dependencies] axum = "0.8.6" +chrono = { version = "0.4", features = ["serde"] } +hex = { version = "^0.4.3" } +serde = { version = "1.0", features = ["derive"] } +serde_json = { version = "^1.0" } tokio = { version = "1", features = ["full"] } [workspace.lints.rust] missing_docs = "deny" unsafe_code = "forbid" -[workspace.dependencies] -serde = { version = "1.0", features = ["derive"] } -serde_json = { version = "^1.0" } -hex = { version = "^0.4.3" } -chrono = { version = "0.4", features = ["serde"] } - [workspace.lints.clippy] arithmetic_side_effects = "deny" cast_lossless = "deny" diff --git a/crates/charon-core/Cargo.toml b/crates/charon-core/Cargo.toml index baba8427..82e06e30 100644 --- a/crates/charon-core/Cargo.toml +++ b/crates/charon-core/Cargo.toml @@ -7,10 +7,10 @@ license.workspace = true publish.workspace = true [dependencies] +chrono.workspace = true +hex.workspace = true serde.workspace = true serde_json.workspace = true -hex.workspace = true -chrono.workspace = true [lints] workspace = true From dac4f732b8cf58b6f9e59ffc5183996d23902dbe Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel <31224949+emlautarom1@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:55:20 -0300 Subject: [PATCH 23/23] Change exposed port Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4a7557d8..55d334fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,5 +7,5 @@ RUN cargo build --release --package charon-cli --locked FROM debian:bookworm-slim AS app COPY --from=builder /build/target/release/charon-cli /app/bin/charon-cli -EXPOSE 3030 +EXPOSE 3000 CMD ["/app/bin/charon-cli"]