diff --git a/Cargo.lock b/Cargo.lock index 7ffef9505..b56ff086a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -402,17 +402,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ark-pallas" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760ecac12a00211188c9101b63bd284b80da5abcc5d97d9d2b3803bca1f63a52" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-std", -] - [[package]] name = "ark-poly" version = "0.4.2" @@ -1351,7 +1340,8 @@ dependencies = [ "hotshot-stake-table", "hotshot-state-prover", "hotshot-types", - "jf-primitives 0.4.4", + "jf-merkle-tree", + "jf-signature", "portpicker", "rand 0.8.5", "sequencer", @@ -1359,7 +1349,7 @@ dependencies = [ "snafu 0.8.2", "surf", "surf-disco", - "tagged-base64 0.4.0", + "tagged-base64", "tide-disco", "tracing", "url", @@ -1521,7 +1511,7 @@ dependencies = [ [[package]] name = "cdn-broker" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.2#c41604361b634830b5ba874e06b997993055c25c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.6#569d6a6ec3ccbbd41c041a4c80bd260bc5c928ff" dependencies = [ "async-std", "cdn-proto", @@ -1529,7 +1519,7 @@ dependencies = [ "console-subscriber", "dashmap", "derivative", - "jf-primitives 0.4.0-pre.0", + "jf-signature", "lazy_static", "local-ip-address", "parking_lot", @@ -1545,12 +1535,12 @@ dependencies = [ [[package]] name = "cdn-client" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.2#c41604361b634830b5ba874e06b997993055c25c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.6#569d6a6ec3ccbbd41c041a4c80bd260bc5c928ff" dependencies = [ "async-std", "cdn-proto", "clap", - "jf-primitives 0.4.0-pre.0", + "jf-signature", "rand 0.8.5", "tokio", "tracing", @@ -1560,12 +1550,12 @@ dependencies = [ [[package]] name = "cdn-marshal" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.2#c41604361b634830b5ba874e06b997993055c25c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.6#569d6a6ec3ccbbd41c041a4c80bd260bc5c928ff" dependencies = [ "async-std", "cdn-proto", "clap", - "jf-primitives 0.4.0-pre.0", + "jf-signature", "tokio", "tracing", "tracing-subscriber 0.3.18", @@ -1574,7 +1564,7 @@ dependencies = [ [[package]] name = "cdn-proto" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.2#c41604361b634830b5ba874e06b997993055c25c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.3.6#569d6a6ec3ccbbd41c041a4c80bd260bc5c928ff" dependencies = [ "anyhow", "ark-serialize", @@ -1582,11 +1572,11 @@ dependencies = [ "capnp", "capnpc", "derivative", - "jf-primitives 0.4.0-pre.0", + "jf-signature", "kanal", "lazy_static", "mnemonic", - "mockall", + "num_enum", "pem 3.0.4", "prometheus", "quinn", @@ -1828,7 +1818,7 @@ dependencies = [ "hex", "serde", "sha3", - "tagged-base64 0.4.0", + "tagged-base64", ] [[package]] @@ -2156,18 +2146,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "crypto_kx" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704722d1d929489c8528bb1882805700f1ba20f54325704973e786352320b1ed" -dependencies = [ - "blake2", - "curve25519-dalek", - "rand_core 0.6.4", - "serdect", -] - [[package]] name = "csv" version = "1.3.0" @@ -2529,10 +2507,11 @@ dependencies = [ "hotshot-state-prover", "hotshot-types", "itertools 0.12.1", + "jf-pcs", "jf-plonk", - "jf-primitives 0.4.4", - "jf-relation 0.4.4", - "jf-utils 0.4.4", + "jf-relation", + "jf-signature", + "jf-utils", "sha3", ] @@ -2646,12 +2625,6 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" -[[package]] -name = "downcast" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" - [[package]] name = "downcast-rs" version = "1.2.1" @@ -3384,12 +3357,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - [[package]] name = "fs2" version = "0.4.3" @@ -3603,7 +3570,7 @@ dependencies = [ "hotshot-contract-adapter", "hotshot-stake-table", "hotshot-state-prover", - "jf-primitives 0.4.4", + "jf-pcs", ] [[package]] @@ -3985,7 +3952,7 @@ dependencies = [ [[package]] name = "hotshot" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "anyhow", "async-broadcast", @@ -4010,10 +3977,11 @@ dependencies = [ "hotshot-task", "hotshot-task-impls", "hotshot-types", - "jf-primitives 0.4.4", + "jf-signature", "libp2p-identity", "libp2p-networking", "lru 0.12.3", + "num_enum", "portpicker", "rand 0.8.5", "serde", @@ -4029,7 +3997,7 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.7" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "async-trait", "clap", @@ -4039,7 +4007,7 @@ dependencies = [ "hotshot-types", "serde", "snafu 0.8.2", - "tagged-base64 0.4.0", + "tagged-base64", "tide-disco", "toml", "vbs", @@ -4048,7 +4016,7 @@ dependencies = [ [[package]] name = "hotshot-builder-core" version = "0.1.18" -source = "git+https://github.com/EspressoSystems/hotshot-builder-core?tag=0.1.18#4f3f9169e709a74ae657e5425729ba19ed4aaecb" +source = "git+https://github.com/EspressoSystems/hotshot-builder-core?branch=cl/jf-update#8a2c3ba5d4d6d224ee1bc254cc7bd11289e3b585" dependencies = [ "anyhow", "async-broadcast", @@ -4068,7 +4036,7 @@ dependencies = [ "sha2 0.10.8", "snafu 0.8.2", "surf-disco", - "tagged-base64 0.4.0", + "tagged-base64", "tide-disco", "tracing", "vbs", @@ -4090,9 +4058,9 @@ dependencies = [ "diff-test-bn254", "ethers", "hotshot-types", + "jf-pcs", "jf-plonk", - "jf-primitives 0.4.4", - "jf-utils 0.4.4", + "jf-utils", "num-bigint", "num-traits", ] @@ -4100,7 +4068,7 @@ dependencies = [ [[package]] name = "hotshot-events-service" version = "0.1.19" -source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.19#b6b6ac5aa27742539bbc19eebe2e6a90b03a660c" +source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.20#f5f5ea98e438d8ee0f77c3d30b8fb6f362d8c818" dependencies = [ "async-broadcast", "async-compatibility-layer", @@ -4115,7 +4083,7 @@ dependencies = [ "hotshot-types", "serde", "snafu 0.8.2", - "tagged-base64 0.4.0", + "tagged-base64", "tide-disco", "toml", "tracing", @@ -4125,7 +4093,7 @@ dependencies = [ [[package]] name = "hotshot-example-types" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "anyhow", "async-broadcast", @@ -4155,7 +4123,7 @@ dependencies = [ [[package]] name = "hotshot-macros" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "derive_builder", "proc-macro2", @@ -4166,7 +4134,7 @@ dependencies = [ [[package]] name = "hotshot-orchestrator" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "anyhow", "async-compatibility-layer", @@ -4195,7 +4163,7 @@ dependencies = [ [[package]] name = "hotshot-query-service" version = "0.1.19" -source = "git+https://github.com/EspressoSystems/hotshot-query-service?tag=0.1.19#c4f0433ee7c7a7732eecb24f82ab23c91d0145a0" +source = "git+https://github.com/EspressoSystems/hotshot-query-service?tag=0.1.20#900e6e356945365ff3c6e9a2631b490c51f82db9" dependencies = [ "anyhow", "ark-serialize", @@ -4219,7 +4187,8 @@ dependencies = [ "hotshot-types", "include_dir", "itertools 0.12.1", - "jf-primitives 0.4.4", + "jf-merkle-tree", + "jf-vid", "native-tls", "portpicker", "postgres-native-tls", @@ -4231,7 +4200,7 @@ dependencies = [ "snafu 0.8.2", "spin_sleep", "surf-disco", - "tagged-base64 0.4.0", + "tagged-base64", "tempfile", "tide-disco", "time 0.3.36", @@ -4247,7 +4216,7 @@ dependencies = [ [[package]] name = "hotshot-stake-table" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "ark-bn254", "ark-ed-on-bn254", @@ -4257,10 +4226,12 @@ dependencies = [ "digest 0.10.7", "ethereum-types", "hotshot-types", - "jf-primitives 0.4.4", - "jf-utils 0.4.4", + "jf-crhf", + "jf-rescue", + "jf-signature", + "jf-utils", "serde", - "tagged-base64 0.4.0", + "tagged-base64", ] [[package]] @@ -4292,16 +4263,19 @@ dependencies = [ "hotshot-stake-table", "hotshot-types", "itertools 0.12.1", + "jf-crhf", + "jf-pcs", "jf-plonk", - "jf-primitives 0.4.4", - "jf-relation 0.4.4", - "jf-utils 0.4.4", + "jf-relation", + "jf-rescue", + "jf-signature", + "jf-utils", "rand_chacha 0.3.1", "sequencer-utils", "serde", "snafu 0.8.2", "surf-disco", - "tagged-base64 0.3.4", + "tagged-base64", "tide-disco", "time 0.3.36", "toml", @@ -4313,7 +4287,7 @@ dependencies = [ [[package]] name = "hotshot-task" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "async-broadcast", "async-compatibility-layer", @@ -4326,7 +4300,7 @@ dependencies = [ [[package]] name = "hotshot-task-impls" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "anyhow", "async-broadcast", @@ -4336,6 +4310,7 @@ dependencies = [ "async-trait", "bincode", "bitvec", + "cdn-proto", "chrono", "committable", "either", @@ -4343,13 +4318,14 @@ dependencies = [ "hotshot-builder-api", "hotshot-task", "hotshot-types", - "jf-primitives 0.4.4", + "jf-signature", + "jf-vid", "rand 0.8.5", "serde", "sha2 0.10.8", "snafu 0.8.2", "surf-disco", - "tagged-base64 0.4.0", + "tagged-base64", "time 0.3.36", "tokio", "tracing", @@ -4359,7 +4335,7 @@ dependencies = [ [[package]] name = "hotshot-testing" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "async-broadcast", "async-compatibility-layer", @@ -4380,7 +4356,8 @@ dependencies = [ "hotshot-task", "hotshot-task-impls", "hotshot-types", - "jf-primitives 0.4.4", + "jf-signature", + "jf-vid", "lru 0.12.3", "portpicker", "rand 0.8.5", @@ -4388,7 +4365,7 @@ dependencies = [ "sha2 0.10.8", "sha3", "snafu 0.8.2", - "tagged-base64 0.4.0", + "tagged-base64", "tide-disco", "tokio", "tracing", @@ -4398,7 +4375,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "anyhow", "ark-bls12-381", @@ -4428,9 +4405,10 @@ dependencies = [ "ethereum-types", "futures", "generic-array", - "jf-plonk", - "jf-primitives 0.4.4", - "jf-utils 0.4.4", + "jf-pcs", + "jf-signature", + "jf-utils", + "jf-vid", "lazy_static", "memoize", "rand 0.8.5", @@ -4438,7 +4416,7 @@ dependencies = [ "serde", "sha2 0.10.8", "snafu 0.8.2", - "tagged-base64 0.4.0", + "tagged-base64", "time 0.3.36", "tokio", "tracing", @@ -4980,126 +4958,111 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "jf-plonk" -version = "0.4.4" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.4#8f48813ca52d964090dbf0de62f07f5e0c7e22c6" +name = "jf-commitment" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-std", +] + +[[package]] +name = "jf-crhf" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-serialize", + "ark-std", +] + +[[package]] +name = "jf-merkle-tree" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", "ark-ec", "ark-ff", - "ark-poly", "ark-serialize", "ark-std", "derivative", + "digest 0.10.7", "displaydoc", - "downcast-rs", - "dyn-clone 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "espresso-systems-common 0.4.0", "hashbrown 0.14.5", "itertools 0.12.1", - "jf-primitives 0.4.4", - "jf-relation 0.4.4", - "jf-utils 0.4.4", - "merlin", + "jf-relation", + "jf-rescue", + "jf-utils", "num-bigint", - "rand_chacha 0.3.1", - "rayon", + "num-traits", "serde", "sha3", - "tagged-base64 0.4.0", + "tagged-base64", ] [[package]] -name = "jf-primitives" -version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.2#f85f9024ef42ab8be95b2c81bd15fd6cbadeafbf" +name = "jf-pcs" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ - "anyhow", - "ark-bls12-377", - "ark-bls12-381", - "ark-bn254", - "ark-bw6-761", - "ark-crypto-primitives", "ark-ec", - "ark-ed-on-bls12-377", - "ark-ed-on-bls12-381", - "ark-ed-on-bn254", "ark-ff", - "ark-pallas", "ark-poly", "ark-serialize", "ark-std", - "blst", - "chacha20poly1305", - "crypto_kx", "derivative", - "digest 0.10.7", "displaydoc", - "espresso-systems-common 0.4.0", - "generic-array", - "hashbrown 0.14.5", "itertools 0.12.1", - "jf-relation 0.4.0-pre.0", - "jf-utils 0.4.0-pre.0", + "jf-utils", "merlin", - "num-bigint", - "num-traits", - "rand_chacha 0.3.1", - "serde", - "sha2 0.10.8", - "sha3", - "tagged-base64 0.3.4", - "typenum", - "zeroize", + "rayon", ] [[package]] -name = "jf-primitives" +name = "jf-plonk" version = "0.4.4" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.4#8f48813ca52d964090dbf0de62f07f5e0c7e22c6" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ - "anyhow", - "ark-bls12-377", - "ark-bls12-381", - "ark-bn254", - "ark-bw6-761", - "ark-crypto-primitives", "ark-ec", - "ark-ed-on-bls12-377", - "ark-ed-on-bls12-381", - "ark-ed-on-bn254", "ark-ff", - "ark-pallas", "ark-poly", "ark-serialize", "ark-std", - "blst", - "chacha20poly1305", - "crypto_kx", "derivative", - "digest 0.10.7", "displaydoc", + "downcast-rs", + "dyn-clone 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", "espresso-systems-common 0.4.0", - "generic-array", "hashbrown 0.14.5", "itertools 0.12.1", - "jf-relation 0.4.4", - "jf-utils 0.4.4", + "jf-crhf", + "jf-pcs", + "jf-relation", + "jf-rescue", + "jf-utils", "merlin", "num-bigint", - "num-traits", "rand_chacha 0.3.1", "rayon", "serde", - "sha2 0.10.8", "sha3", - "tagged-base64 0.4.0", - "zeroize", + "tagged-base64", +] + +[[package]] +name = "jf-prf" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-serialize", + "ark-std", ] [[package]] name = "jf-relation" -version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.2#f85f9024ef42ab8be95b2c81bd15fd6cbadeafbf" +version = "0.4.4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ "ark-bls12-377", "ark-bls12-381", @@ -5116,66 +5079,108 @@ dependencies = [ "dyn-clone 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.14.5", "itertools 0.12.1", - "jf-utils 0.4.0-pre.0", + "jf-utils", "num-bigint", "rand_chacha 0.3.1", + "rayon", ] [[package]] -name = "jf-relation" -version = "0.4.4" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.4#8f48813ca52d964090dbf0de62f07f5e0c7e22c6" +name = "jf-rescue" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ "ark-bls12-377", "ark-bls12-381", "ark-bn254", "ark-bw6-761", + "ark-crypto-primitives", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-381", + "ark-ed-on-bn254", + "ark-ff", + "ark-std", + "displaydoc", + "itertools 0.12.1", + "jf-commitment", + "jf-crhf", + "jf-prf", + "jf-relation", + "jf-utils", +] + +[[package]] +name = "jf-signature" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-381", + "ark-bn254", "ark-ec", "ark-ff", - "ark-poly", "ark-serialize", "ark-std", + "blst", "derivative", + "digest 0.10.7", "displaydoc", - "downcast-rs", - "dyn-clone 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.14.5", "itertools 0.12.1", - "jf-utils 0.4.4", + "jf-crhf", + "jf-relation", + "jf-rescue", + "jf-utils", "num-bigint", - "rand_chacha 0.3.1", - "rayon", + "num-traits", + "serde", + "sha3", + "tagged-base64", + "zeroize", ] [[package]] name = "jf-utils" -version = "0.4.0-pre.0" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.2#f85f9024ef42ab8be95b2c81bd15fd6cbadeafbf" +version = "0.4.4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-381", "ark-ff", + "ark-poly", "ark-serialize", "ark-std", "digest 0.10.7", + "displaydoc", + "rand_chacha 0.3.1", + "rayon", "serde", "sha2 0.10.8", - "tagged-base64 0.3.4", + "tagged-base64", ] [[package]] -name = "jf-utils" -version = "0.4.4" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.4#8f48813ca52d964090dbf0de62f07f5e0c7e22c6" +name = "jf-vid" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" dependencies = [ + "anyhow", "ark-ec", "ark-ff", + "ark-poly", "ark-serialize", "ark-std", + "derivative", "digest 0.10.7", + "displaydoc", + "generic-array", + "itertools 0.12.1", + "jf-merkle-tree", + "jf-pcs", + "jf-utils", "rayon", "serde", - "sha2 0.10.8", - "tagged-base64 0.4.0", + "tagged-base64", ] [[package]] @@ -5633,7 +5638,7 @@ dependencies = [ [[package]] name = "libp2p-networking" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.50#6facd5bb4c5800486dd427c84b5de607f17b4224" +source = "git+https://github.com/EspressoSystems/hotshot?tag=0.5.51#0b6aa78b9e81d5f8875ebd9f1bb6a6a531297891" dependencies = [ "anyhow", "async-compatibility-layer", @@ -6279,33 +6284,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b8f3a258db515d5e91a904ce4ae3f73e091149b90cadbdb93d210bee07f63b" -[[package]] -name = "mockall" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" -dependencies = [ - "cfg-if", - "downcast", - "fragile", - "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", -] - -[[package]] -name = "mockall_derive" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "multiaddr" version = "0.18.1" @@ -7247,32 +7225,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "predicates" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" -dependencies = [ - "anstyle", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" - -[[package]] -name = "predicates-tree" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" -dependencies = [ - "predicates-core", - "termtree", -] - [[package]] name = "prettyplease" version = "0.2.19" @@ -7434,7 +7386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.60", @@ -8531,8 +8483,12 @@ dependencies = [ "hotshot-types", "include_dir", "itertools 0.12.1", - "jf-primitives 0.4.4", - "jf-utils 0.4.4", + "jf-crhf", + "jf-merkle-tree", + "jf-rescue", + "jf-signature", + "jf-utils", + "jf-vid", "lazy_static", "num-traits", "portpicker", @@ -8546,7 +8502,7 @@ dependencies = [ "snafu 0.8.2", "strum", "surf-disco", - "tagged-base64 0.4.0", + "tagged-base64", "tempfile", "tide-disco", "time 0.3.36", @@ -8706,16 +8662,6 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "serdect" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" -dependencies = [ - "base16ct", - "serde", -] - [[package]] name = "sha-1" version = "0.9.8" @@ -9643,21 +9589,6 @@ dependencies = [ "libc", ] -[[package]] -name = "tagged-base64" -version = "0.3.4" -source = "git+https://github.com/EspressoSystems/tagged-base64?tag=0.3.4#93be6f0f5c0ec8458f13dede3d2b68dcce12a608" -dependencies = [ - "ark-serialize", - "ark-std", - "base64 0.21.7", - "crc-any", - "serde", - "snafu 0.7.5", - "tagged-base64-macros 0.3.3", - "wasm-bindgen", -] - [[package]] name = "tagged-base64" version = "0.4.0" @@ -9670,19 +9601,10 @@ dependencies = [ "crc-any", "serde", "snafu 0.8.2", - "tagged-base64-macros 0.4.0", + "tagged-base64-macros", "wasm-bindgen", ] -[[package]] -name = "tagged-base64-macros" -version = "0.3.3" -source = "git+https://github.com/EspressoSystems/tagged-base64?tag=0.3.4#93be6f0f5c0ec8458f13dede3d2b68dcce12a608" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "tagged-base64-macros" version = "0.4.0" @@ -9722,12 +9644,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - [[package]] name = "thiserror" version = "1.0.59" @@ -9828,7 +9744,7 @@ dependencies = [ "snafu 0.8.2", "strum", "strum_macros", - "tagged-base64 0.4.0", + "tagged-base64", "tide", "tide-websockets", "toml", diff --git a/Cargo.toml b/Cargo.toml index a743d3f8d..04dec1440 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,39 +46,52 @@ dotenvy = "0.15" ethers = { version = "2.0", features = ["solc"] } futures = "0.3" -hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.50" } +hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.51" } # Hotshot imports -hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.50" } -hotshot-builder-core = { git = "https://github.com/EspressoSystems/hotshot-builder-core", tag = "0.1.18" } -hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.19" } -hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.50" } -hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.19" } -hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.50" } +hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.51" } +hotshot-builder-core = { git = "https://github.com/EspressoSystems/hotshot-builder-core", branch = "cl/jf-update" } +hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.20" } +hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.51" } +hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.20" } +hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.51" } hotshot-state-prover = { version = "0.1.0", path = "hotshot-state-prover" } -hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.50" } -hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.50" } -hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.50" } +hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.51" } +hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.51" } +hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.51" } # Push CDN imports cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", features = [ "runtime-async-std", "global-permits", -], tag = "0.3.2", package = "cdn-broker" } +], tag = "0.3.6", package = "cdn-broker" } cdn-marshal = { git = "https://github.com/EspressoSystems/Push-CDN", features = [ "runtime-async-std", "global-permits", -], tag = "0.3.2", package = "cdn-marshal" } +], tag = "0.3.6", package = "cdn-marshal" } -jf-plonk = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.4", features = [ +jf-plonk = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ "test-apis", ] } -jf-primitives = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.4", features = [ +jf-crhf = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5" } +jf-merkle-tree = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ "std", ] } -jf-relation = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.4", features = [ +jf-signature = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ "std", ] } -jf-utils = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.4" } +jf-pcs = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", "parallel" +] } +jf-vid = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", "parallel" +] } +jf-rescue = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", "parallel" +] } +jf-relation = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +jf-utils = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5" } snafu = "0.8" strum = { version = "0.26", features = ["derive"] } surf-disco = "0.6" diff --git a/builder/Cargo.toml b/builder/Cargo.toml index 9369567c9..fdd61ca1c 100644 --- a/builder/Cargo.toml +++ b/builder/Cargo.toml @@ -30,7 +30,8 @@ hotshot-orchestrator = { workspace = true } hotshot-stake-table = { workspace = true } hotshot-state-prover = { path = "../hotshot-state-prover" } hotshot-types = { workspace = true } -jf-primitives = { workspace = true } +jf-signature = { workspace = true, features = ["bls"] } +jf-merkle-tree = { workspace = true } portpicker = { workspace = true } rand = "0.8.5" sequencer = { path = "../sequencer", features = ["testing"] } diff --git a/builder/src/lib.rs b/builder/src/lib.rs index 50b6996e6..0c9e77468 100644 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -41,10 +41,8 @@ use hotshot_builder_api::builder::{ BuildError, Error as BuilderApiError, Options as HotshotBuilderApiOptions, }; use hotshot_builder_core::service::{GlobalState, ProxyGlobalState}; -use jf_primitives::{ - merkle_tree::{namespaced_merkle_tree::NamespacedMerkleTreeScheme, MerkleTreeScheme}, - signatures::bls_over_bn254::VerKey, -}; +use jf_merkle_tree::{namespaced_merkle_tree::NamespacedMerkleTreeScheme, MerkleTreeScheme}; +use jf_signature::bls_over_bn254::VerKey; use sequencer::catchup::mock::MockStateCatchup; use sequencer::state_signature::StakeTableCommitmentType; use sequencer::{ diff --git a/builder/src/permissioned.rs b/builder/src/permissioned.rs index 8a6f2b3b1..2e3d160a3 100644 --- a/builder/src/permissioned.rs +++ b/builder/src/permissioned.rs @@ -63,10 +63,8 @@ use hotshot_builder_core::{ }, }; use hotshot_state_prover; -use jf_primitives::{ - merkle_tree::{namespaced_merkle_tree::NamespacedMerkleTreeScheme, MerkleTreeScheme}, - signatures::bls_over_bn254::VerKey, -}; +use jf_merkle_tree::{namespaced_merkle_tree::NamespacedMerkleTreeScheme, MerkleTreeScheme}; +use jf_signature::bls_over_bn254::VerKey; use sequencer::state_signature::StakeTableCommitmentType; use sequencer::{catchup::mock::MockStateCatchup, eth_signature_key::EthKeyPair, ChainConfig}; use sequencer::{ diff --git a/contracts/rust/adapter/Cargo.toml b/contracts/rust/adapter/Cargo.toml index 3072bfc8a..9a66e2853 100644 --- a/contracts/rust/adapter/Cargo.toml +++ b/contracts/rust/adapter/Cargo.toml @@ -19,7 +19,7 @@ diff-test-bn254 = { git = "https://github.com/EspressoSystems/solidity-bn254.git ethers = { version = "2.0.4" } hotshot-types = { workspace = true } jf-plonk = { workspace = true } -jf-primitives = { workspace = true } +jf-pcs = { workspace = true } jf-utils = { workspace = true } num-bigint = { version = "0.4", default-features = false } num-traits = { version = "0.2", default-features = false } diff --git a/contracts/rust/adapter/src/jellyfish.rs b/contracts/rust/adapter/src/jellyfish.rs index 18943d847..1df5a92ab 100644 --- a/contracts/rust/adapter/src/jellyfish.rs +++ b/contracts/rust/adapter/src/jellyfish.rs @@ -11,10 +11,10 @@ use ethers::{ prelude::{AbiError, EthAbiCodec, EthAbiType}, types::{Bytes, H256, U256}, }; +use jf_pcs::prelude::Commitment; use jf_plonk::proof_system::structs::{OpenKey, Proof, ProofEvaluations, VerifyingKey}; use jf_plonk::testing_apis::Challenges; use jf_plonk::{constants::KECCAK256_STATE_SIZE, transcript::SolidityTranscript}; -use jf_primitives::pcs::prelude::Commitment; use num_bigint::BigUint; use num_traits::Num; diff --git a/contracts/rust/diff-test/Cargo.toml b/contracts/rust/diff-test/Cargo.toml index 59fdae91a..4180b2cf6 100644 --- a/contracts/rust/diff-test/Cargo.toml +++ b/contracts/rust/diff-test/Cargo.toml @@ -24,7 +24,8 @@ hotshot-state-prover = { path = "../../../hotshot-state-prover" } hotshot-types = { workspace = true } itertools = { workspace = true } jf-plonk = { workspace = true } -jf-primitives = { workspace = true } +jf-signature = { workspace = true } +jf-pcs = { workspace = true } jf-relation = { workspace = true } jf-utils = { workspace = true } sha3 = { version = "0.10.8", default-features = false } diff --git a/contracts/rust/diff-test/src/main.rs b/contracts/rust/diff-test/src/main.rs index b7dc3976d..5c7b58b40 100644 --- a/contracts/rust/diff-test/src/main.rs +++ b/contracts/rust/diff-test/src/main.rs @@ -17,17 +17,16 @@ use hotshot_state_prover::mock_ledger::{ gen_plonk_proof_for_test, MockLedger, MockSystemParam, STAKE_TABLE_CAPACITY, }; use itertools::multiunzip; +use jf_pcs::prelude::Commitment; use jf_plonk::proof_system::structs::{Proof, VerifyingKey}; use jf_plonk::proof_system::PlonkKzgSnark; use jf_plonk::{ testing_apis::Verifier, transcript::{PlonkTranscript, SolidityTranscript}, }; -use jf_primitives::constants::CS_ID_BLS_BN254; -use jf_primitives::pcs::prelude::Commitment; -use jf_primitives::signatures::bls_over_bn254::Signature; -use jf_primitives::signatures::bls_over_bn254::{hash_to_curve, KeyPair as BLSKeyPair}; -use jf_primitives::signatures::schnorr::KeyPair as SchnorrKeyPair; +use jf_signature::bls_over_bn254::{hash_to_curve, KeyPair as BLSKeyPair, Signature}; +use jf_signature::constants::CS_ID_BLS_BN254; +use jf_signature::schnorr::KeyPair as SchnorrKeyPair; use sha3::Keccak256; #[derive(Parser)] diff --git a/contracts/rust/gen-vk-contract/Cargo.toml b/contracts/rust/gen-vk-contract/Cargo.toml index 595c163d0..dc4920fc7 100644 --- a/contracts/rust/gen-vk-contract/Cargo.toml +++ b/contracts/rust/gen-vk-contract/Cargo.toml @@ -10,4 +10,4 @@ ark-srs = { workspace = true } hotshot-contract-adapter = { path = "../adapter" } hotshot-stake-table = { workspace = true } hotshot-state-prover = { path = "../../../hotshot-state-prover" } -jf-primitives = { workspace = true } +jf-pcs = { workspace = true } diff --git a/contracts/rust/gen-vk-contract/src/main.rs b/contracts/rust/gen-vk-contract/src/main.rs index ce32050aa..d6804eca7 100644 --- a/contracts/rust/gen-vk-contract/src/main.rs +++ b/contracts/rust/gen-vk-contract/src/main.rs @@ -9,7 +9,7 @@ use std::process::Command; use hotshot_contract_adapter::jellyfish::ParsedVerifyingKey; use hotshot_stake_table::config::STAKE_TABLE_CAPACITY; -use jf_primitives::pcs::prelude::UnivariateUniversalParams; +use jf_pcs::prelude::UnivariateUniversalParams; fn main() { let srs = { diff --git a/hotshot-state-prover/Cargo.toml b/hotshot-state-prover/Cargo.toml index d832988b4..037aabf18 100644 --- a/hotshot-state-prover/Cargo.toml +++ b/hotshot-state-prover/Cargo.toml @@ -32,7 +32,10 @@ hotshot-stake-table = { workspace = true } hotshot-types = { workspace = true } itertools = { workspace = true } jf-plonk = { workspace = true } -jf-primitives = { workspace = true } +jf-signature = { workspace = true, features = ["schnorr", "bls", "gadgets"] } +jf-rescue = { workspace = true, features = ["gadgets"] } +jf-pcs = { workspace = true } +jf-crhf = { workspace = true } jf-relation = { workspace = true } jf-utils = { workspace = true } rand_chacha = { workspace = true } @@ -40,7 +43,7 @@ sequencer-utils = { path = "../utils" } serde = { workspace = true } snafu = { workspace = true } surf-disco = { workspace = true } -tagged-base64 = { git = "https://github.com/EspressoSystems/tagged-base64", tag = "0.3.4" } +tagged-base64 = { workspace = true } tide-disco = { workspace = true } time = { workspace = true } toml = "0.8" @@ -51,4 +54,4 @@ vbs = { workspace = true } [features] default = ["parallel"] std = ["ark-std/std", "ark-ff/std"] -parallel = ["jf-primitives/parallel", "jf-utils/parallel", "ark-ff/parallel"] +parallel = ["jf-signature/parallel", "jf-utils/parallel", "ark-ff/parallel"] diff --git a/hotshot-state-prover/src/circuit.rs b/hotshot-state-prover/src/circuit.rs index cdd262d8b..e1e2603b9 100644 --- a/hotshot-state-prover/src/circuit.rs +++ b/hotshot-state-prover/src/circuit.rs @@ -5,16 +5,13 @@ use ark_ff::PrimeField; use ark_std::borrow::Borrow; use ethers::types::U256; use hotshot_types::light_client::{GenericLightClientState, GenericPublicInput}; -use jf_plonk::errors::PlonkError; -use jf_primitives::{ - circuit::{ - rescue::RescueNativeGadget, - signature::schnorr::{SignatureGadget, VerKeyVar}, - }, - rescue::RescueParameter, - signatures::schnorr::{Signature, VerKey as SchnorrVerKey}, +use jf_plonk::PlonkError; +use jf_relation::{BoolVar, Circuit, CircuitError, PlonkCircuit, Variable}; +use jf_rescue::{gadgets::RescueNativeGadget, RescueParameter}; +use jf_signature::{ + gadgets::schnorr::{SignatureGadget, VerKeyVar}, + schnorr::{Signature, VerKey as SchnorrVerKey}, }; -use jf_relation::{errors::CircuitError, BoolVar, Circuit, PlonkCircuit, Variable}; /// Lossy conversion of a U256 into a field element. pub(crate) fn u256_to_field(v: &U256) -> F { @@ -380,11 +377,13 @@ mod tests { use ark_ed_on_bn254::EdwardsConfig as Config; use ethers::types::U256; use hotshot_types::traits::stake_table::{SnapshotVersion, StakeTableScheme}; - use jf_primitives::{ - crhf::{VariableLengthRescueCRHF, CRHF}, - errors::PrimitivesError, - signatures::{schnorr::Signature, SchnorrSignatureScheme, SignatureScheme}, + use jf_crhf::CRHF; + use jf_rescue::crhf::VariableLengthRescueCRHF; + use jf_signature::{ + schnorr::{SchnorrSignatureScheme, Signature}, + SignatureScheme, }; + use jf_relation::Circuit; use jf_utils::test_rng; @@ -425,7 +424,7 @@ mod tests { let sigs = state_keys .iter() .map(|(key, _)| SchnorrSignatureScheme::::sign(&(), key, state_msg, &mut prng)) - .collect::, PrimitivesError>>() + .collect::, _>>() .unwrap(); // bit vector with total weight 26 @@ -532,7 +531,7 @@ mod tests { .map(|(key, _)| { SchnorrSignatureScheme::::sign(&(), key, bad_state_msg, &mut prng) }) - .collect::, PrimitivesError>>() + .collect::, _>>() .unwrap(); let (bad_circuit, public_inputs) = build( &entries, @@ -557,7 +556,7 @@ mod tests { .map(|(key, _)| { SchnorrSignatureScheme::::sign(&(), key, wrong_state_msg, &mut prng) }) - .collect::, PrimitivesError>>() + .collect::, _>>() .unwrap(); let (bad_circuit, public_inputs) = build( &entries, diff --git a/hotshot-state-prover/src/mock_ledger.rs b/hotshot-state-prover/src/mock_ledger.rs index 47dd33cef..0b59ceeef 100644 --- a/hotshot-state-prover/src/mock_ledger.rs +++ b/hotshot-state-prover/src/mock_ledger.rs @@ -23,21 +23,22 @@ use hotshot_types::{ traits::stake_table::SnapshotVersion, }; use itertools::izip; +use jf_pcs::prelude::UnivariateUniversalParams; use jf_plonk::proof_system::{PlonkKzgSnark, UniversalSNARK}; use jf_plonk::transcript::SolidityTranscript; -use jf_primitives::pcs::prelude::UnivariateUniversalParams; -use jf_primitives::signatures::schnorr::Signature; -use jf_primitives::signatures::{ +use jf_relation::{Arithmetization, Circuit, PlonkCircuit}; +use jf_signature::schnorr::Signature; +use jf_signature::{ bls_over_bn254::{BLSOverBN254CurveSignatureScheme, VerKey as BLSVerKey}, - SchnorrSignatureScheme, SignatureScheme, + schnorr::SchnorrSignatureScheme, + SignatureScheme, }; -use jf_relation::{Arithmetization, Circuit, PlonkCircuit}; use jf_utils::test_rng; use std::collections::HashMap; type F = ark_ed_on_bn254::Fq; -type SchnorrVerKey = jf_primitives::signatures::schnorr::VerKey; -type SchnorrSignKey = jf_primitives::signatures::schnorr::SignKey; +type SchnorrVerKey = jf_signature::schnorr::VerKey; +type SchnorrSignKey = jf_signature::schnorr::SignKey; /// Stake table capacity used for testing pub const STAKE_TABLE_CAPACITY: usize = 10; diff --git a/hotshot-state-prover/src/service.rs b/hotshot-state-prover/src/service.rs index 9233beb4c..7d9448c06 100644 --- a/hotshot-state-prover/src/service.rs +++ b/hotshot-state-prover/src/service.rs @@ -33,10 +33,10 @@ use hotshot_types::{ traits::signature_key::StakeTableEntryType, }; +use jf_pcs::prelude::UnivariateUniversalParams; use jf_plonk::errors::PlonkError; -use jf_primitives::constants::CS_ID_SCHNORR; -use jf_primitives::pcs::prelude::UnivariateUniversalParams; use jf_relation::Circuit as _; +use jf_signature::constants::CS_ID_SCHNORR; use std::{ iter, time::{Duration, Instant}, @@ -484,7 +484,7 @@ mod test { }; use hotshot_stake_table::vec_based::StakeTable; use hotshot_types::light_client::StateSignKey; - use jf_primitives::signatures::{SchnorrSignatureScheme, SignatureScheme}; + use jf_signature::{schnorr::SchnorrSignatureScheme, SignatureScheme}; use jf_utils::test_rng; use sequencer_utils::deployer; diff --git a/hotshot-state-prover/src/snark.rs b/hotshot-state-prover/src/snark.rs index 2e166003f..1e9f5c1f1 100644 --- a/hotshot-state-prover/src/snark.rs +++ b/hotshot-state-prover/src/snark.rs @@ -11,7 +11,7 @@ use jf_plonk::{ proof_system::{PlonkKzgSnark, UniversalSNARK}, transcript::SolidityTranscript, }; -use jf_primitives::signatures::schnorr::Signature; +use jf_signature::schnorr::Signature; /// BLS verification key, base field and Schnorr verification key pub use hotshot_stake_table::vec_based::config::QCVerKey; @@ -113,16 +113,17 @@ mod tests { light_client::GenericLightClientState, traits::stake_table::{SnapshotVersion, StakeTableScheme}, }; + use jf_crhf::CRHF; use jf_plonk::{ proof_system::{PlonkKzgSnark, UniversalSNARK}, transcript::SolidityTranscript, }; - use jf_primitives::{ - crhf::{VariableLengthRescueCRHF, CRHF}, - errors::PrimitivesError, - signatures::{schnorr::Signature, SchnorrSignatureScheme, SignatureScheme}, - }; use jf_relation::Circuit; + use jf_rescue::crhf::VariableLengthRescueCRHF; + use jf_signature::{ + schnorr::{SchnorrSignatureScheme, Signature}, + SignatureScheme, + }; use jf_utils::test_rng; const ST_CAPACITY: usize = 20; @@ -132,7 +133,7 @@ mod tests { fn universal_setup_for_testing( max_degree: usize, rng: &mut R, - ) -> Result + ) -> anyhow::Result where R: RngCore + CryptoRng, { @@ -219,7 +220,7 @@ mod tests { let sigs = schnorr_keys .iter() .map(|(key, _)| SchnorrSignatureScheme::::sign(&(), key, state_msg, &mut prng)) - .collect::, PrimitivesError>>() + .collect::, _>>() .unwrap(); // bit vector with total weight 26 diff --git a/hotshot-state-prover/src/test_utils.rs b/hotshot-state-prover/src/test_utils.rs index 06688790d..6822ae7e9 100644 --- a/hotshot-state-prover/src/test_utils.rs +++ b/hotshot-state-prover/src/test_utils.rs @@ -3,14 +3,15 @@ use ark_std::rand::{CryptoRng, RngCore}; use ethers::types::U256; use hotshot_stake_table::vec_based::StakeTable; use hotshot_types::traits::stake_table::StakeTableScheme; -use jf_primitives::signatures::{ +use jf_signature::{ bls_over_bn254::{BLSOverBN254CurveSignatureScheme, VerKey as BLSVerKey}, - SchnorrSignatureScheme, SignatureScheme, + schnorr::SchnorrSignatureScheme, + SignatureScheme, }; type F = ark_ed_on_bn254::Fq; -type SchnorrVerKey = jf_primitives::signatures::schnorr::VerKey; -type SchnorrSignKey = jf_primitives::signatures::schnorr::SignKey; +type SchnorrVerKey = jf_signature::schnorr::VerKey; +type SchnorrSignKey = jf_signature::schnorr::SignKey; /// Helper function for test pub(crate) fn key_pairs_for_testing( diff --git a/sequencer/Cargo.toml b/sequencer/Cargo.toml index fad3016d2..d6e6a13f6 100644 --- a/sequencer/Cargo.toml +++ b/sequencer/Cargo.toml @@ -67,7 +67,11 @@ hotshot-types = { workspace = true } include_dir = "0.7" itertools = { workspace = true } -jf-primitives = { workspace = true } +jf-signature = { workspace = true, features = ["bls", "schnorr"] } +jf-merkle-tree = { workspace = true } +jf-crhf = { workspace = true } +jf-vid = { workspace = true } +jf-rescue = { workspace = true } jf-utils = { workspace = true } # TODO temporary: used only for test_rng() lazy_static = "1.4" num-traits = "0.2.18" diff --git a/sequencer/src/api.rs b/sequencer/src/api.rs index 6cf8ae0b0..6ea94e34c 100644 --- a/sequencer/src/api.rs +++ b/sequencer/src/api.rs @@ -21,7 +21,7 @@ use hotshot::types::{Event, SystemContextHandle}; use hotshot_events_service::events_source::{BuilderEvent, EventsSource, EventsStreamer}; use hotshot_query_service::data_source::ExtensibleDataSource; use hotshot_types::{data::ViewNumber, light_client::StateSignatureRequestBody}; -use jf_primitives::merkle_tree::MerkleTreeScheme; +use jf_merkle_tree::MerkleTreeScheme; use serde::{Deserialize, Serialize}; use std::pin::Pin; use vbs::version::StaticVersionType; @@ -282,7 +282,7 @@ mod test_helpers { traits::{metrics::NoMetrics, node_implementation::ConsensusTime}, }; use itertools::izip; - use jf_primitives::merkle_tree::{MerkleCommitment, MerkleTreeScheme}; + use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; use portpicker::pick_unused_port; use std::time::Duration; use surf_disco::Client; @@ -815,7 +815,7 @@ mod test { event::LeafInfo, traits::{metrics::NoMetrics, node_implementation::ConsensusTime}, }; - use jf_primitives::merkle_tree::prelude::{MerkleProof, Sha3Node}; + use jf_merkle_tree::prelude::{MerkleProof, Sha3Node}; use portpicker::pick_unused_port; use std::time::Duration; use surf_disco::Client; diff --git a/sequencer/src/api/sql.rs b/sequencer/src/api/sql.rs index 5291d77d5..0394d36b4 100644 --- a/sequencer/src/api/sql.rs +++ b/sequencer/src/api/sql.rs @@ -18,7 +18,7 @@ use hotshot_query_service::{ merklized_state::{MerklizedStateDataSource, Snapshot}, }; use hotshot_types::data::ViewNumber; -use jf_primitives::merkle_tree::{prelude::MerkleNode, MerkleTreeScheme}; +use jf_merkle_tree::{prelude::MerkleNode, MerkleTreeScheme}; pub type DataSource = SqlDataSource; diff --git a/sequencer/src/bin/nasty-client.rs b/sequencer/src/bin/nasty-client.rs index 89cb37eaa..069b28d86 100644 --- a/sequencer/src/bin/nasty-client.rs +++ b/sequencer/src/bin/nasty-client.rs @@ -35,12 +35,10 @@ use hotshot_types::{ traits::metrics::{Counter, Gauge, Metrics as _}, vid::{vid_scheme, VidSchemeType}, }; -use jf_primitives::{ - merkle_tree::{ - ForgetableMerkleTreeScheme, MerkleCommitment, MerkleTreeScheme, UniversalMerkleTreeScheme, - }, - vid::VidScheme, +use jf_merkle_tree::{ + ForgetableMerkleTreeScheme, MerkleCommitment, MerkleTreeScheme, UniversalMerkleTreeScheme, }; +use jf_vid::VidScheme; use rand::{seq::SliceRandom, RngCore}; use sequencer::{ api::endpoints::NamespaceProofQueryData, diff --git a/sequencer/src/block/payload.rs b/sequencer/src/block/payload.rs index 1117bf747..fa8bb99e3 100644 --- a/sequencer/src/block/payload.rs +++ b/sequencer/src/block/payload.rs @@ -9,7 +9,7 @@ use hotshot::traits::BlockPayload; use hotshot_types::vid::{ vid_scheme, LargeRangeProofType, VidCommitment, VidCommon, VidSchemeType, }; -use jf_primitives::vid::{ +use jf_vid::{ payload_prover::{PayloadProver, Statement}, VidScheme, }; @@ -353,7 +353,7 @@ mod test { traits::{block_contents::TestableBlock, BlockPayload}, vid::vid_scheme, }; - use jf_primitives::vid::{payload_prover::PayloadProver, VidScheme}; + use jf_vid::{payload_prover::PayloadProver, VidScheme}; use rand::RngCore; use std::{collections::HashMap, marker::PhantomData, mem::size_of, ops::Range}; diff --git a/sequencer/src/block/queryable.rs b/sequencer/src/block/queryable.rs index f1d50877a..d8f1025b0 100644 --- a/sequencer/src/block/queryable.rs +++ b/sequencer/src/block/queryable.rs @@ -3,7 +3,7 @@ use crate::block::payload::Payload; use crate::block::tables::TxTable; use hotshot_query_service::availability::QueryablePayload; use hotshot_types::vid::{vid_scheme, SmallRangeProofType}; -use jf_primitives::vid::payload_prover::{PayloadProver, Statement}; +use jf_vid::payload_prover::{PayloadProver, Statement}; use serde::{Deserialize, Serialize}; use std::ops::Range; diff --git a/sequencer/src/catchup.rs b/sequencer/src/catchup.rs index 09ad387fe..29b53957b 100644 --- a/sequencer/src/catchup.rs +++ b/sequencer/src/catchup.rs @@ -8,9 +8,7 @@ use async_std::sync::RwLock; use async_trait::async_trait; use derive_more::From; use hotshot_types::{data::ViewNumber, traits::node_implementation::ConsensusTime as _}; -use jf_primitives::merkle_tree::{ - prelude::MerkleNode, ForgetableMerkleTreeScheme, MerkleTreeScheme, -}; +use jf_merkle_tree::{prelude::MerkleNode, ForgetableMerkleTreeScheme, MerkleTreeScheme}; use serde::de::DeserializeOwned; use std::{fmt::Debug, sync::Arc, time::Duration}; use surf_disco::Request; @@ -414,7 +412,7 @@ impl StateCatchup for Vec { pub mod mock { use super::*; use crate::state::{FeeAccountProof, ValidatedState}; - use jf_primitives::merkle_tree::MerkleTreeScheme; + use jf_merkle_tree::MerkleTreeScheme; use std::collections::HashMap; #[derive(Debug, Clone, Default)] diff --git a/sequencer/src/header.rs b/sequencer/src/header.rs index 0da4d0ef4..c16adcb74 100644 --- a/sequencer/src/header.rs +++ b/sequencer/src/header.rs @@ -19,7 +19,7 @@ use hotshot_types::{ utils::BuilderCommitment, vid::{VidCommitment, VidCommon}, }; -use jf_primitives::merkle_tree::prelude::*; +use jf_merkle_tree::prelude::*; use serde::{Deserialize, Serialize}; use snafu::Snafu; use time::OffsetDateTime; @@ -465,7 +465,7 @@ mod test_headers { utils::Anvil, }; use hotshot_types::{traits::signature_key::BuilderSignatureKey, vid::vid_scheme}; - use jf_primitives::vid::VidScheme; + use jf_vid::VidScheme; #[derive(Debug, Default)] #[must_use] diff --git a/sequencer/src/network.rs b/sequencer/src/network.rs index 8ef789181..95e9dae33 100644 --- a/sequencer/src/network.rs +++ b/sequencer/src/network.rs @@ -41,7 +41,7 @@ pub mod cdn { NoMiddleware, TrustedMiddleware, UntrustedMiddleware, }, crypto::signature::{Serializable, SignatureScheme}, - def::{ConnectionDef, RunDef}, + def::{ConnectionDef, RunDef, Topic}, discovery::{Embedded, Redis}, }; use hotshot::types::SignatureKey; @@ -88,6 +88,31 @@ pub mod cdn { } } + /// An implementation of `Topic` for testing purposes. + #[derive(Clone, PartialEq, Eq)] + pub enum TestTopic { + Global = 0, + DA = 1, + } + impl From for TestTopic { + fn from(value: u8) -> Self { + if value == 0 { + TestTopic::Global + } else { + TestTopic::DA + } + } + } + impl From for u8 { + fn from(value: TestTopic) -> u8 { + match value { + TestTopic::Global => 0, + TestTopic::DA => 1, + } + } + } + impl Topic for TestTopic {} + /// The production run definition for the Push CDN. /// Uses the real protocols and a Redis discovery client. pub struct ProductionDef(PhantomData); @@ -95,6 +120,7 @@ pub mod cdn { type User = UserDef; type Broker = BrokerDef; type DiscoveryClientType = Redis; + type Topic = TestTopic; } /// The user definition for the Push CDN. @@ -133,5 +159,6 @@ pub mod cdn { type User = UserDef; type Broker = BrokerDef; type DiscoveryClientType = Embedded; + type Topic = TestTopic; } } diff --git a/sequencer/src/persistence.rs b/sequencer/src/persistence.rs index e1c816eb7..db9e8feb2 100644 --- a/sequencer/src/persistence.rs +++ b/sequencer/src/persistence.rs @@ -222,7 +222,7 @@ mod persistence_tests { use hotshot::types::SignatureKey; use hotshot::{traits::BlockPayload, types::BLSPubKey}; use hotshot_types::{event::HotShotAction, vid::vid_scheme}; - use jf_primitives::vid::VidScheme; + use jf_vid::VidScheme; use rand::{RngCore, SeedableRng}; use sha2::{Digest, Sha256}; use testing::TestablePersistence; diff --git a/sequencer/src/state.rs b/sequencer/src/state.rs index 473a46281..0fe955a44 100644 --- a/sequencer/src/state.rs +++ b/sequencer/src/state.rs @@ -29,19 +29,13 @@ use hotshot_types::{ vid::{VidCommon, VidSchemeType}, }; use itertools::Itertools; -use jf_primitives::merkle_tree::{ - prelude::MerkleProof, ToTraversalPath, UniversalMerkleTreeScheme, -}; -use jf_primitives::{ - errors::PrimitivesError, - merkle_tree::{ - prelude::{LightWeightSHA3MerkleTree, Sha3Digest, Sha3Node}, - universal_merkle_tree::UniversalMerkleTree, - AppendableMerkleTreeScheme, ForgetableMerkleTreeScheme, - ForgetableUniversalMerkleTreeScheme, LookupResult, MerkleCommitment, MerkleTreeScheme, - }, - vid::VidScheme, +use jf_merkle_tree::{ + prelude::{LightWeightSHA3MerkleTree, MerkleProof, Sha3Digest, Sha3Node}, + universal_merkle_tree::UniversalMerkleTree, + AppendableMerkleTreeScheme, ForgetableMerkleTreeScheme, ForgetableUniversalMerkleTreeScheme, + LookupResult, MerkleCommitment, MerkleTreeScheme, ToTraversalPath, UniversalMerkleTreeScheme, }; +use jf_vid::VidScheme; use num_traits::CheckedSub; use sequencer_utils::impl_to_fixed_bytes; use serde::{Deserialize, Serialize}; @@ -133,11 +127,12 @@ impl ValidatedState { pub fn insert_fee_deposit( &mut self, fee_info: FeeInfo, - ) -> Result, PrimitivesError> { - self.fee_merkle_tree + ) -> anyhow::Result> { + Ok(self + .fee_merkle_tree .update_with(fee_info.account, |balance| { Some(balance.cloned().unwrap_or_default().add(fee_info.amount)) - }) + })?) } /// Charge a fee to an account. diff --git a/sequencer/src/state_signature.rs b/sequencer/src/state_signature.rs index 8e4609e34..a9b43f7ac 100644 --- a/sequencer/src/state_signature.rs +++ b/sequencer/src/state_signature.rs @@ -20,11 +20,10 @@ use hotshot_types::{ }, PeerConfig, }; -use jf_primitives::{ - crhf::{VariableLengthRescueCRHF, CRHF}, - errors::PrimitivesError, - signatures::SignatureScheme, -}; +use jf_crhf::CRHF; +use jf_rescue::crhf::VariableLengthRescueCRHF; +use jf_rescue::RescueError; +use jf_signature::SignatureScheme; use std::collections::{HashMap, VecDeque}; use surf_disco::{Client, Url}; use tide_disco::error::ServerError; @@ -138,7 +137,7 @@ impl StateSigner { } } -fn hash_bytes_to_field(bytes: &[u8]) -> Result { +fn hash_bytes_to_field(bytes: &[u8]) -> Result { // make sure that `mod_order` won't happen. let bytes_len = ((::MODULUS_BIT_SIZE + 7) / 8 - 1) as usize; let elem = bytes @@ -151,7 +150,7 @@ fn hash_bytes_to_field(bytes: &[u8]) -> Result { fn form_light_client_state( leaf: &Leaf, stake_table_comm: &StakeTableCommitmentType, -) -> Result { +) -> anyhow::Result { let header = leaf.get_block_header(); let mut block_comm_root_bytes = vec![]; header diff --git a/sequencer/src/state_signature/relay_server.rs b/sequencer/src/state_signature/relay_server.rs index 8cda5a88e..d61d3c417 100644 --- a/sequencer/src/state_signature/relay_server.rs +++ b/sequencer/src/state_signature/relay_server.rs @@ -8,7 +8,7 @@ use hotshot_stake_table::vec_based::config::FieldType; use hotshot_types::light_client::{ StateSignature, StateSignatureScheme, StateSignaturesBundle, StateVerKey, }; -use jf_primitives::signatures::SignatureScheme; +use jf_signature::SignatureScheme; use std::{ collections::{BTreeSet, HashMap}, path::PathBuf, diff --git a/sequencer/src/transaction.rs b/sequencer/src/transaction.rs index 912c36504..16d16384d 100644 --- a/sequencer/src/transaction.rs +++ b/sequencer/src/transaction.rs @@ -2,7 +2,7 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; use committable::{Commitment, Committable}; use derive_more::{Display, From, Into}; use hotshot_types::traits::block_contents::Transaction as HotShotTransaction; -use jf_primitives::merkle_tree::namespaced_merkle_tree::{Namespace, Namespaced}; +use jf_merkle_tree::namespaced_merkle_tree::{Namespace, Namespaced}; use serde::{Deserialize, Serialize}; #[derive(