Merge branch 'main' into Pravdyvy/db-sc-public-data-storage

This commit is contained in:
Oleksandr Pravdyvyi 2025-04-03 10:34:32 +03:00
commit a05cde7256
13 changed files with 570 additions and 31 deletions

364
Cargo.lock generated
View File

@ -392,35 +392,52 @@ dependencies = [
"ark-ff",
"ark-r1cs-std",
"ark-std",
"ark-ec",
"ark-ff",
"ark-r1cs-std",
"ark-std",
]
[[package]]
name = "ark-crypto-primitives"
version = "0.5.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e"
checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e"
dependencies = [
"ahash 0.8.11",
"ark-crypto-primitives-macros",
"ark-ec",
"ark-ff",
"ahash 0.8.11",
"ark-crypto-primitives-macros",
"ark-ec",
"ark-ff",
"ark-relations",
"ark-serialize",
"ark-serialize",
"ark-snark",
"ark-std",
"ark-std",
"blake2",
"derivative",
"digest 0.10.7",
"fnv",
"merlin",
"fnv",
"merlin",
"sha2 0.10.8",
]
[[package]]
name = "ark-crypto-primitives-macros"
version = "0.5.0"
name = "ark-crypto-primitives-macros"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a"
checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a"
dependencies = [
"proc-macro2",
"quote",
@ -438,6 +455,10 @@ dependencies = [
"ark-poly",
"ark-serialize",
"ark-std",
"ark-ff",
"ark-poly",
"ark-serialize",
"ark-std",
"educe",
"fnv",
"hashbrown 0.15.2",
@ -454,6 +475,10 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70"
dependencies = [
"ark-ff-asm",
"ark-ff-macros",
"ark-serialize",
"ark-std",
"ark-ff-asm",
"ark-ff-macros",
"ark-serialize",
@ -494,16 +519,23 @@ dependencies = [
[[package]]
name = "ark-groth16"
version = "0.5.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e"
checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e"
dependencies = [
"ark-crypto-primitives",
"ark-ec",
"ark-ff",
"ark-poly",
"ark-ec",
"ark-ff",
"ark-poly",
"ark-relations",
"ark-serialize",
"ark-std",
"ark-serialize",
"ark-std",
]
[[package]]
@ -516,6 +548,9 @@ dependencies = [
"ark-ff",
"ark-serialize",
"ark-std",
"ark-ff",
"ark-serialize",
"ark-std",
"educe",
"fnv",
"hashbrown 0.15.2",
@ -524,9 +559,20 @@ dependencies = [
[[package]]
name = "ark-r1cs-std"
version = "0.5.0"
name = "ark-r1cs-std"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1"
checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1"
dependencies = [
"ark-ec",
"ark-ff",
"ark-relations",
"ark-std",
"educe",
"num-bigint 0.4.6",
"num-integer",
"num-traits",
"ark-ec",
"ark-ff",
"ark-relations",
@ -541,13 +587,20 @@ dependencies = [
[[package]]
name = "ark-relations"
version = "0.5.1"
name = "ark-relations"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384"
checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384"
dependencies = [
"ark-ff",
"ark-std",
"tracing",
"tracing-subscriber",
"ark-ff",
"ark-std",
"tracing",
"tracing-subscriber",
]
[[package]]
@ -556,6 +609,8 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7"
dependencies = [
"ark-serialize-derive",
"ark-std",
"ark-serialize-derive",
"ark-std",
"arrayvec 0.7.6",
@ -577,20 +632,27 @@ dependencies = [
[[package]]
name = "ark-snark"
version = "0.5.1"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88"
checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88"
dependencies = [
"ark-ff",
"ark-ff",
"ark-relations",
"ark-serialize",
"ark-std",
"ark-serialize",
"ark-std",
]
[[package]]
name = "ark-std"
version = "0.5.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a"
checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a"
dependencies = [
"num-traits",
"rand 0.8.5",
@ -599,8 +661,11 @@ dependencies = [
[[package]]
name = "arraydeque"
version = "0.5.1"
name = "arraydeque"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
[[package]]
name = "arrayref"
@ -638,6 +703,15 @@ dependencies = [
"critical-section",
]
[[package]]
name = "atomic-polyfill"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"
dependencies = [
"critical-section",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -736,6 +810,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
[[package]]
name = "bit-vec"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
[[package]]
name = "bitcoin-private"
version = "0.1.0"
@ -958,8 +1038,10 @@ dependencies = [
[[package]]
name = "cargo_metadata"
version = "0.19.2"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"
checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"
dependencies = [
"camino",
"cargo-platform",
@ -1041,6 +1123,7 @@ dependencies = [
"indexmap 1.9.3",
"once_cell",
"strsim 0.10.0",
"strsim 0.10.0",
"termcolor",
"textwrap",
]
@ -1051,6 +1134,7 @@ version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008"
dependencies = [
"heck 0.4.1",
"heck 0.4.1",
"proc-macro-error",
"proc-macro2",
@ -1073,6 +1157,12 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15"
[[package]]
name = "cobs"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15"
[[package]]
name = "common"
version = "0.1.0"
@ -1145,6 +1235,22 @@ dependencies = [
"libc",
]
[[package]]
name = "core_primitives"
version = "0.1.0"
dependencies = [
"anyhow",
"elliptic-curve",
"env_logger",
"log",
"monotree",
"sequencer_core",
"serde",
"serde_json",
"sha2 0.10.8",
"storage",
]
[[package]]
name = "cpp_demangle"
version = "0.4.4"
@ -1175,8 +1281,11 @@ dependencies = [
[[package]]
name = "critical-section"
version = "1.2.0"
name = "critical-section"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
[[package]]
name = "crossbeam-channel"
@ -1423,8 +1532,10 @@ dependencies = [
[[package]]
name = "derive_more"
version = "2.0.1"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
dependencies = [
"derive_more-impl",
]
@ -1432,8 +1543,10 @@ dependencies = [
[[package]]
name = "derive_more-impl"
version = "2.0.1"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [
"proc-macro2",
"quote",
@ -1535,6 +1648,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb"
dependencies = [
"heck 0.4.1",
"heck 0.4.1",
"proc-macro-error",
]
@ -1608,6 +1722,18 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
[[package]]
name = "embedded-io"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced"
[[package]]
name = "embedded-io"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
[[package]]
name = "encoding_rs"
version = "0.8.35"
@ -2057,6 +2183,15 @@ dependencies = [
"byteorder",
]
[[package]]
name = "hash32"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
dependencies = [
"byteorder",
]
[[package]]
name = "hashbrown"
version = "0.7.2"
@ -2079,8 +2214,10 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.14.5"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash 0.8.11",
]
@ -2117,6 +2254,29 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "hashlink"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
dependencies = [
"hashbrown 0.14.5",
]
[[package]]
name = "heapless"
version = "0.7.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"
dependencies = [
"atomic-polyfill",
"hash32",
"rustc_version",
"serde",
"spin",
"stable_deref_trait",
]
[[package]]
name = "heck"
version = "0.4.1"
@ -2129,6 +2289,12 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -2466,6 +2632,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "1.0.3"
@ -2493,6 +2665,12 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ee796ad498c8d9a1d68e477df8f754ed784ef875de1414ebdaf169f70a6a784"
[[package]]
name = "include_bytes_aligned"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ee796ad498c8d9a1d68e477df8f754ed784ef875de1414ebdaf169f70a6a784"
[[package]]
name = "indexmap"
version = "1.9.3"
@ -2566,6 +2744,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.13.0"
@ -2670,6 +2857,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
dependencies = [
"spin",
]
dependencies = [
"spin",
]
[[package]]
name = "lazycell"
@ -2740,6 +2930,8 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3d87542063daaccbfecd78b60f988079b6ec4e089249658b9455075c78d42"
dependencies = [
"ark-bn254",
"ark-ff",
"ark-bn254",
"ark-ff",
"num-bigint 0.4.6",
@ -2881,6 +3073,64 @@ dependencies = [
"malachite-nz",
]
[[package]]
name = "malachite"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fbdf9cb251732db30a7200ebb6ae5d22fe8e11397364416617d2c2cf0c51cb5"
dependencies = [
"malachite-base",
"malachite-float",
"malachite-nz",
"malachite-q",
]
[[package]]
name = "malachite-base"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea0ed76adf7defc1a92240b5c36d5368cfe9251640dcce5bd2d0b7c1fd87aeb"
dependencies = [
"hashbrown 0.14.5",
"itertools 0.11.0",
"libm",
"ryu",
]
[[package]]
name = "malachite-float"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af9d20db1c73759c1377db7b27575df6f2eab7368809dd62c0a715dc1bcc39f7"
dependencies = [
"itertools 0.11.0",
"malachite-base",
"malachite-nz",
"malachite-q",
]
[[package]]
name = "malachite-nz"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34a79feebb2bc9aa7762047c8e5495269a367da6b5a90a99882a0aeeac1841f7"
dependencies = [
"itertools 0.11.0",
"libm",
"malachite-base",
]
[[package]]
name = "malachite-q"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f235d5747b1256b47620f5640c2a17a88c7569eebdf27cd9cb130e1a619191"
dependencies = [
"itertools 0.11.0",
"malachite-base",
"malachite-nz",
]
[[package]]
name = "malloc_buf"
version = "0.0.6"
@ -2949,6 +3199,18 @@ dependencies = [
"zeroize",
]
[[package]]
name = "merlin"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d"
dependencies = [
"byteorder",
"keccak",
"rand_core 0.6.4",
"zeroize",
]
[[package]]
name = "metal"
version = "0.29.0"
@ -3072,6 +3334,12 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5b0c77c1b780822bc749a33e39aeb2c07584ab93332303babeabb645298a76e"
[[package]]
name = "no_std_strings"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5b0c77c1b780822bc749a33e39aeb2c07584ab93332303babeabb645298a76e"
[[package]]
name = "node_core"
version = "0.1.0"
@ -3536,6 +3804,19 @@ dependencies = [
"serde",
]
[[package]]
name = "postcard"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8"
dependencies = [
"cobs",
"embedded-io 0.4.0",
"embedded-io 0.6.1",
"heapless",
"serde",
]
[[package]]
name = "powerfmt"
version = "0.2.0"
@ -4019,6 +4300,12 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df6368f71f205ff9c33c076d170dd56ebf68e8161c733c0caa07a7a5509ed53"
[[package]]
name = "ringbuffer"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df6368f71f205ff9c33c076d170dd56ebf68e8161c733c0caa07a7a5509ed53"
[[package]]
name = "risc0-binfmt"
version = "2.0.0"
@ -4027,12 +4314,16 @@ dependencies = [
"anyhow",
"borsh",
"derive_more 2.0.1",
"derive_more 2.0.1",
"elf",
"lazy_static",
"postcard",
"lazy_static",
"postcard",
"risc0-zkp",
"risc0-zkvm-platform",
"semver",
"semver",
"serde",
"tracing",
]
@ -4045,18 +4336,23 @@ dependencies = [
"anyhow",
"cargo_metadata",
"derive_builder",
"derive_builder",
"dirs",
"docker-generate",
"hex",
"risc0-binfmt",
"risc0-zkos-v1compat",
"risc0-zkos-v1compat",
"risc0-zkp",
"risc0-zkvm-platform",
"rzup",
"semver",
"rzup",
"semver",
"serde",
"serde_json",
"stability",
"stability",
"tempfile",
]
@ -4103,6 +4399,7 @@ dependencies = [
"cc",
"cust",
"derive_more 2.0.1",
"derive_more 2.0.1",
"glob",
"risc0-build-kernel",
"risc0-core",
@ -4155,19 +4452,25 @@ dependencies = [
"anyhow",
"auto_ops",
"bit-vec",
"bit-vec",
"bytemuck",
"byteorder",
"cfg-if 1.0.0",
"derive_more 2.0.1",
"derive_more 2.0.1",
"enum-map",
"malachite",
"malachite",
"num-derive",
"num-traits",
"paste 1.0.15",
"postcard",
"paste 1.0.15",
"postcard",
"rand 0.8.5",
"rayon",
"ringbuffer",
"ringbuffer",
"risc0-binfmt",
"risc0-circuit-rv32im-sys",
"risc0-core",
@ -4175,6 +4478,7 @@ dependencies = [
"risc0-zkp",
"serde",
"smallvec",
"smallvec",
"tracing",
]
@ -4183,6 +4487,9 @@ name = "risc0-circuit-rv32im-sys"
version = "2.0.1"
source = "git+https://github.com/risc0/risc0.git?branch=release-2.0#fdd54f961b84b38831a8a488b9d67534a02d80a2"
dependencies = [
"cc",
"cust",
"derive_more 2.0.1",
"cc",
"cust",
"derive_more 2.0.1",
@ -4200,6 +4507,7 @@ source = "git+https://github.com/risc0/risc0.git?branch=release-2.0#fdd54f961b84
dependencies = [
"bytemuck",
"bytemuck_derive",
"bytemuck_derive",
"nvtx",
"puffin",
"rand_core 0.6.4",
@ -4213,8 +4521,11 @@ dependencies = [
"anyhow",
"ark-bn254",
"ark-ec",
"ark-bn254",
"ark-ec",
"ark-groth16",
"ark-serialize",
"ark-serialize",
"bytemuck",
"hex",
"num-bigint 0.4.6",
@ -4277,6 +4588,7 @@ dependencies = [
"serde",
"sha2 0.10.8",
"stability",
"stability",
"tracing",
]
@ -4293,6 +4605,7 @@ dependencies = [
"bytemuck",
"bytes",
"derive_more 2.0.1",
"derive_more 2.0.1",
"elf",
"enum-map",
"getrandom 0.2.15",
@ -4312,11 +4625,13 @@ dependencies = [
"risc0-core",
"risc0-groth16",
"risc0-zkos-v1compat",
"risc0-zkos-v1compat",
"risc0-zkp",
"risc0-zkvm-platform",
"rrs-lib",
"rustc-demangle",
"rzup",
"rzup",
"semver",
"serde",
"sha2 0.10.8",
@ -4522,6 +4837,20 @@ dependencies = [
"yaml-rust2",
]
[[package]]
name = "rzup"
version = "0.4.1"
source = "git+https://github.com/risc0/risc0.git?branch=release-2.0#6f038bd11ed725d7025687d163977d93ac1f82f9"
dependencies = [
"semver",
"serde",
"strum",
"tempfile",
"thiserror 2.0.11",
"toml 0.8.20",
"yaml-rust2",
]
[[package]]
name = "sc_core"
version = "0.1.0"
@ -4530,6 +4859,8 @@ dependencies = [
"anyhow",
"ark-bn254",
"ark-ff",
"ark-bn254",
"ark-ff",
"bincode",
"common",
"elliptic-curve",
@ -4713,6 +5044,7 @@ dependencies = [
"serde_json",
"tokio",
"toml 0.7.8",
"toml 0.7.8",
]
[[package]]
@ -4890,6 +5222,15 @@ dependencies = [
"lock_api",
]
[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
"lock_api",
]
[[package]]
name = "spki"
version = "0.7.3"
@ -5277,6 +5618,18 @@ dependencies = [
"toml_edit 0.22.24",
]
[[package]]
name = "toml"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit 0.22.24",
]
[[package]]
name = "toml_datetime"
version = "0.6.8"
@ -6051,6 +6404,17 @@ dependencies = [
"hashlink",
]
[[package]]
name = "yaml-rust2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a1a1c0bc9823338a3bdf8c61f994f23ac004c6fa32c08cd152984499b445e8d"
dependencies = [
"arraydeque",
"encoding_rs",
"hashlink",
]
[[package]]
name = "yoke"
version = "0.7.5"

View File

@ -18,6 +18,7 @@ members = [
"rpc_primitives",
"common",
"sc_core",
"core_primitives",
]
[workspace.dependencies]

View File

@ -4,7 +4,7 @@ use anyhow::Result;
use k256::AffinePoint;
use log::info;
use serde::Serialize;
use storage::{merkle_tree_public::TreeHashType, nullifier::UTXONullifier};
use storage::{merkle_tree_public::TreeHashType, nullifier::UTXONullifier, transaction::Tag};
use utxo::{
utxo_core::{UTXOPayload, UTXO},
utxo_tree::UTXOSparseMerkleTree,
@ -122,6 +122,10 @@ impl Account {
info!("Account address is {:?}", hex::encode(self.address));
info!("Account balance is {:?}", self.balance);
}
pub fn make_tag(&self) -> Tag {
self.address[0]
}
}
impl Default for Account {

View File

@ -0,0 +1,20 @@
[package]
name = "core_primitives"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow.workspace = true
serde_json.workspace = true
env_logger.workspace = true
log.workspace = true
serde.workspace = true
sha2.workspace = true
elliptic-curve.workspace = true
monotree.workspace = true
[dependencies.storage]
path = "../storage"
[dependencies.sequencer_core]
path = "../sequencer_core"

View File

@ -0,0 +1,16 @@
use crate::merkle_tree_public::CommitmentHashType;
use monotree::database::MemoryDB;
use monotree::hasher::Blake3;
use monotree::Monotree;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq)]
pub struct Commitment {
pub commitment_hash: CommitmentHashType,
}
pub struct CommitmentsSparseMerkleTree {
pub curr_root: Option<CommitmentHashType>,
pub tree: Monotree<MemoryDB, Blake3>,
pub hasher: Blake3,
}

View File

@ -0,0 +1,5 @@
pub mod commitment;
pub mod merkle_tree_public;
pub mod nullifier;
pub mod transaction;
pub mod utxo;

View File

@ -0,0 +1,2 @@
pub type TreeHashType = [u8; 32];
pub type CommitmentHashType = Vec<u8>;

View File

@ -0,0 +1,18 @@
use crate::merkle_tree_public::TreeHashType;
use monotree::database::MemoryDB;
use monotree::hasher::Blake3;
use monotree::Monotree;
use serde::{Deserialize, Serialize};
//ToDo: Update Nullifier model, when it is clear
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq)]
///General nullifier object
pub struct UTXONullifier {
pub utxo_hash: TreeHashType,
}
pub struct NullifierSparseMerkleTree {
pub curr_root: Option<TreeHashType>,
pub tree: Monotree<MemoryDB, Blake3>,
pub hasher: Blake3,
}

View File

@ -0,0 +1,65 @@
use serde::{Deserialize, Serialize};
use crate::merkle_tree_public::TreeHashType;
use elliptic_curve::{
consts::{B0, B1},
generic_array::GenericArray,
};
use sha2::digest::typenum::{UInt, UTerm};
pub type CipherText = Vec<u8>;
pub type Nonce = GenericArray<u8, UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>>;
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub enum TxKind {
Public,
Private,
Shielded,
Deshielded,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
///General transaction object
pub struct Transaction {
pub hash: TreeHashType,
pub tx_kind: TxKind,
///Tx input data (public part)
pub execution_input: Vec<u8>,
///Tx output data (public_part)
pub execution_output: Vec<u8>,
///Tx input utxo commitments
pub utxo_commitments_spent_hashes: Vec<TreeHashType>,
///Tx output utxo commitments
pub utxo_commitments_created_hashes: Vec<TreeHashType>,
///Tx output nullifiers
pub nullifier_created_hashes: Vec<TreeHashType>,
///Execution proof (private part)
pub execution_proof_private: String,
///Encoded blobs of data
pub encoded_data: Vec<(CipherText, Vec<u8>)>,
///Transaction senders ephemeral pub key
pub ephemeral_pub_key: Vec<u8>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
///General transaction object
pub struct TransactionPayload {
pub tx_kind: TxKind,
///Tx input data (public part)
pub execution_input: Vec<u8>,
///Tx output data (public_part)
pub execution_output: Vec<u8>,
///Tx input utxo commitments
pub utxo_commitments_spent_hashes: Vec<TreeHashType>,
///Tx output utxo commitments
pub utxo_commitments_created_hashes: Vec<TreeHashType>,
///Tx output nullifiers
pub nullifier_created_hashes: Vec<TreeHashType>,
///Execution proof (private part)
pub execution_proof_private: String,
///Encoded blobs of data
pub encoded_data: Vec<(CipherText, Vec<u8>)>,
///Transaction senders ephemeral pub key
pub ephemeral_pub_key: Vec<u8>,
}

View File

@ -0,0 +1,26 @@
use serde::{Deserialize, Serialize};
use storage::{merkle_tree_public::TreeHashType, nullifier::UTXONullifier, AccountId};
///Raw asset data
pub type Asset = Vec<u8>;
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
///Container for raw utxo payload
pub struct UTXO {
pub hash: TreeHashType,
pub owner: AccountId,
pub nullifier: Option<UTXONullifier>,
pub asset: Asset,
// TODO: change to u256
pub amount: u128,
pub privacy_flag: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UTXOPayload {
pub owner: AccountId,
pub asset: Asset,
// TODO: change to u256
pub amount: u128,
pub privacy_flag: bool,
}

View File

@ -189,6 +189,8 @@ impl NodeCore {
&serde_json::to_vec(&utxo).unwrap(),
);
let tag = accout.make_tag();
let comm = generate_commitments(&vec![utxo]);
Ok((
@ -206,7 +208,7 @@ impl NodeCore {
receipt,
)
.unwrap(),
encoded_data: vec![(encoded_data.0, encoded_data.1.to_vec())],
encoded_data: vec![(encoded_data.0, encoded_data.1.to_vec(), tag)],
ephemeral_pub_key: eph_pub_key.to_vec(),
}
.into(),
@ -235,13 +237,16 @@ impl NodeCore {
let encoded_data = utxos
.iter()
.map(|utxo| {
Account::encrypt_data(
&ephm_key_holder,
accout.key_holder.viewing_public_key,
&serde_json::to_vec(&utxo).unwrap(),
(
Account::encrypt_data(
&ephm_key_holder,
accout.key_holder.viewing_public_key,
&serde_json::to_vec(&utxo).unwrap(),
),
accout.make_tag(),
)
})
.map(|(ciphertext, nonce)| (ciphertext, nonce.to_vec()))
.map(|((ciphertext, nonce), tag)| (ciphertext, nonce.to_vec(), tag))
.collect();
let comm = generate_commitments(&utxos);
@ -305,7 +310,7 @@ impl NodeCore {
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
let encoded_data: Vec<(Vec<u8>, Vec<u8>)> = utxos
let encoded_data: Vec<(Vec<u8>, Vec<u8>, u8)> = utxos
.iter()
.map(|utxo_enc| {
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
@ -316,7 +321,9 @@ impl NodeCore {
&serde_json::to_vec(&utxo_enc).unwrap(),
);
(ciphertext, nonce.to_vec())
let tag = accout_enc.make_tag();
(ciphertext, nonce.to_vec(), tag)
})
.collect();
@ -387,7 +394,7 @@ impl NodeCore {
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
let mut encoded_data: Vec<(Vec<u8>, Vec<u8>)> = resulting_utxos_receiver
let mut encoded_data: Vec<(Vec<u8>, Vec<u8>, u8)> = resulting_utxos_receiver
.iter()
.map(|utxo_enc| {
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
@ -398,11 +405,13 @@ impl NodeCore {
&serde_json::to_vec(&utxo_enc).unwrap(),
);
(ciphertext, nonce.to_vec())
let tag = accout_enc.make_tag();
(ciphertext, nonce.to_vec(), tag)
})
.collect();
let encoded_data_1: Vec<(Vec<u8>, Vec<u8>)> = resulting_utxos_not_spent
let encoded_data_1: Vec<(Vec<u8>, Vec<u8>, u8)> = resulting_utxos_not_spent
.iter()
.map(|utxo_enc| {
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
@ -413,7 +422,9 @@ impl NodeCore {
&serde_json::to_vec(&utxo_enc).unwrap(),
);
(ciphertext, nonce.to_vec())
let tag = accout_enc.make_tag();
(ciphertext, nonce.to_vec(), tag)
})
.collect();
@ -489,7 +500,7 @@ impl NodeCore {
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
let encoded_data: Vec<(Vec<u8>, Vec<u8>)> = utxos
let encoded_data: Vec<(Vec<u8>, Vec<u8>, u8)> = utxos
.iter()
.map(|utxo_enc| {
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
@ -500,7 +511,9 @@ impl NodeCore {
&serde_json::to_vec(&utxo_enc).unwrap(),
);
(ciphertext, nonce.to_vec())
let tag = accout_enc.make_tag();
(ciphertext, nonce.to_vec(), tag)
})
.collect();
@ -1113,7 +1126,7 @@ impl NodeCore {
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
let encoded_data: Vec<(Vec<u8>, Vec<u8>)> = utxos
let encoded_data: Vec<(Vec<u8>, Vec<u8>, u8)> = utxos
.iter()
.map(|utxo_enc| {
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
@ -1124,7 +1137,9 @@ impl NodeCore {
&serde_json::to_vec(&utxo_enc).unwrap(),
);
(ciphertext, nonce.to_vec())
let tag = accout_enc.make_tag();
(ciphertext, nonce.to_vec(), tag)
})
.collect();

View File

@ -111,7 +111,7 @@ impl NodeChainStore {
if ephemeral_public_key_sender.is_some().into() {
let ephemeral_public_key_sender = ephemeral_public_key_sender.unwrap();
for (ciphertext, nonce) in tx.encoded_data.clone() {
for (ciphertext, nonce, tag) in tx.encoded_data.clone() {
let slice = nonce.as_slice();
let nonce =
accounts::key_management::constants_types::Nonce::clone_from_slice(
@ -119,19 +119,21 @@ impl NodeChainStore {
);
for (acc_id, acc) in self.acc_map.iter_mut() {
let decoded_data_curr_acc = acc.decrypt_data(
ephemeral_public_key_sender,
ciphertext.clone(),
nonce,
);
if acc_id[0] == tag {
let decoded_data_curr_acc = acc.decrypt_data(
ephemeral_public_key_sender,
ciphertext.clone(),
nonce,
);
if let Ok(decoded_data_curr_acc) = decoded_data_curr_acc {
let decoded_utxo_try =
serde_json::from_slice::<UTXO>(&decoded_data_curr_acc);
if let Ok(decoded_data_curr_acc) = decoded_data_curr_acc {
let decoded_utxo_try =
serde_json::from_slice::<UTXO>(&decoded_data_curr_acc);
if let Ok(utxo) = decoded_utxo_try {
if &utxo.owner == acc_id {
acc.utxo_tree.insert_item(utxo)?;
if let Ok(utxo) = decoded_utxo_try {
if &utxo.owner == acc_id {
acc.utxo_tree.insert_item(utxo)?;
}
}
}
}

View File

@ -12,6 +12,7 @@ use sha2::digest::typenum::{UInt, UTerm};
pub type CipherText = Vec<u8>;
pub type Nonce = GenericArray<u8, UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>>;
pub type Tag = u8;
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub enum TxKind {
@ -39,7 +40,7 @@ pub struct Transaction {
///Execution proof (private part)
pub execution_proof_private: String,
///Encoded blobs of data
pub encoded_data: Vec<(CipherText, Vec<u8>)>,
pub encoded_data: Vec<(CipherText, Vec<u8>, Tag)>,
///Transaction senders ephemeral pub key
pub ephemeral_pub_key: Vec<u8>,
}
@ -61,7 +62,7 @@ pub struct TransactionPayload {
///Execution proof (private part)
pub execution_proof_private: String,
///Encoded blobs of data
pub encoded_data: Vec<(CipherText, Vec<u8>)>,
pub encoded_data: Vec<(CipherText, Vec<u8>, Tag)>,
///Transaction senders ephemeral pub key
pub ephemeral_pub_key: Vec<u8>,
}