From 45708763b0a6b91e981a78db4298c08c1d98c27a Mon Sep 17 00:00:00 2001 From: Martin Ondejka Date: Tue, 3 Oct 2023 13:11:22 +0200 Subject: [PATCH] Revert transaction commitment --- core/vm/mina_contracts.go | 45 +- core/vm/testdata/precompiles/minaHasher.json | 7 - mina/Cargo.lock | 919 +------------------ mina/Cargo.toml | 22 +- mina/lib/mina.h | 7 - mina/src/lib.rs | 95 +- mina/src/mina.rs | 31 - 7 files changed, 40 insertions(+), 1086 deletions(-) diff --git a/core/vm/mina_contracts.go b/core/vm/mina_contracts.go index 6ebecc0f53..084ad8ef1e 100644 --- a/core/vm/mina_contracts.go +++ b/core/vm/mina_contracts.go @@ -13,10 +13,6 @@ package vm // HashParameter hashParameter, // bytes32[] memory fields // ) external view returns (bytes32); -// -// function transasctionCommitment( -// bytes memory zkappCommand -// ) external view returns (bytes32); // } // // interface ISigner { @@ -46,7 +42,6 @@ import ( var sol_bool, _ = abi.NewType("bool", "", nil) var sol_uint8, _ = abi.NewType("uint8", "", nil) var sol_string, _ = abi.NewType("string", "", nil) -var sol_bytes, _ = abi.NewType("bytes", "", nil) var sol_bytes32, _ = abi.NewType("bytes32", "", nil) var sol_bytes32Arr, _ = abi.NewType("bytes32[]", "", nil) @@ -107,51 +102,15 @@ func poseidonHash(calldata []byte) ([]byte, error) { return output_buffer[:], nil } -func transasctionCommitment(calldata []byte) ([]byte, error) { - unpacked, err := (abi.Arguments{{Type: sol_bytes}}).Unpack(calldata) - - if err != nil { - return packErr("Unable to unpack calldata"), err - } - - zkappCommand := unpacked[0].([]uint8) - - output_buffer := [32]byte{} - - if !C.transaction_commitment( - (*C.uint8_t)(&zkappCommand[0]), - C.uintptr_t(len(zkappCommand)), - (*C.uint8_t)(&output_buffer[0]), - ) { - return packErr("Calling Transaction Commitment failed"), errMinaCallingRustLibFailed - } - - return output_buffer[:], nil -} - // 0x1f831f84 var poseidonHashSignature = crypto.Keccak256([]byte("poseidonHash(uint8,bytes32[])"))[:4] -// 0x1a7f99b6 -var transasctionCommitmentSignature = crypto.Keccak256([]byte("transasctionCommitment(bytes)"))[:4] - func (c *MinaHasher) Run(input []byte) ([]byte, error) { - if len(input) < 4 { + if len(input) < 4 || !bytes.Equal(input[:4], poseidonHashSignature) { return packErr("Invalid signature"), errMinaInvalidSignature } - signature := input[:4] - calldata := input[4:] - - if bytes.Equal(signature, poseidonHashSignature) { - return poseidonHash(calldata) - } - - if bytes.Equal(signature, transasctionCommitmentSignature) { - return transasctionCommitment(calldata) - } - - return packErr("Invalid signature"), errMinaInvalidSignature + return poseidonHash(input[4:]) } type MinaSigner struct{} diff --git a/core/vm/testdata/precompiles/minaHasher.json b/core/vm/testdata/precompiles/minaHasher.json index abb573f297..e812b8f92f 100644 --- a/core/vm/testdata/precompiles/minaHasher.json +++ b/core/vm/testdata/precompiles/minaHasher.json @@ -40,12 +40,5 @@ "Name": "vector 6", "Gas": 1000, "NoBenchmark": false - }, - { - "Input": "1a7f99b6000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001ed01756ae9c3d6720d4e0404bb335498e59370db54a717b4088898483bfb3f1e850a00000000d290f924705fb714e91fedb9bed77e85bce8f5d932c3f4d692b20e4c3e5f9a3343c2baffce9ab0c2391e2f3de8ac891633338d827e6fd4f269331c248029b10601756ae9c3d6720d4e0404bb335498e59370db54a717b4088898483bfb3f1e850a000100000000000000000000000000000000000000000000000000000000000000010101010101010100010101010101010a01000000000000000000000000000000000000000000000000000000000000000000000001010100010101010101010101010101010102010100000001d290f924705fb714e91fedb9bed77e85bce8f5d932c3f4d692b20e4c3e5f9a3343c2baffce9ab0c2391e2f3de8ac891633338d827e6fd4f269331c248029b10600014ff72ff7bf9824551a1b2bd5a2bebdb0234732f6f967f5d727fd80864a35a810010100000000000000000000000000000000000000000000000000000000000000010101010101010100010101010101010a0000000000000000000000000000000000000000000000000000000000000000000000000101010001010101010101010101010101010201000000020200000000220100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "Expected": "9484a9d4aac1d64a958aa88dd1943a87216739980701a4c8e3963633a678603e", - "Name": "transaction commitment", - "Gas": 1000, - "NoBenchmark": false } ] diff --git a/mina/Cargo.lock b/mina/Cargo.lock index 44926b79c9..7b1e9baa17 100644 --- a/mina/Cargo.lock +++ b/mina/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "ahash" version = "0.7.6" @@ -28,25 +13,11 @@ dependencies = [ "version_check", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[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 = "ark-ec" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea978406c4b1ca13c2db2373b05cc55429c3575b8b21f1b9ee859aa5b03dd42" dependencies = [ "ark-ff", "ark-serialize", @@ -60,7 +31,8 @@ dependencies = [ [[package]] name = "ark-ff" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" dependencies = [ "ark-ff-asm", "ark-ff-macros", @@ -71,14 +43,15 @@ dependencies = [ "num-traits", "paste", "rayon", - "rustc_version 0.3.3", + "rustc_version", "zeroize", ] [[package]] name = "ark-ff-asm" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" dependencies = [ "quote", "syn 1.0.109", @@ -87,7 +60,8 @@ dependencies = [ [[package]] name = "ark-ff-macros" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ "num-bigint", "num-traits", @@ -98,7 +72,8 @@ dependencies = [ [[package]] name = "ark-poly" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0f78f47537c2f15706db7e98fe64cc1711dbf9def81218194e17239e53e5aa" dependencies = [ "ark-ff", "ark-serialize", @@ -111,7 +86,8 @@ dependencies = [ [[package]] name = "ark-serialize" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" dependencies = [ "ark-serialize-derive", "ark-std", @@ -121,7 +97,8 @@ dependencies = [ [[package]] name = "ark-serialize-derive" version = "0.3.0" -source = "git+https://github.com/openmina/algebra?branch=openmina#017531e7aaa15a2c856532b0843876e371b01122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd4e5f0bf8285d5ed538d27fab7411f3e297908fd93c62195de8bee3f199e82" dependencies = [ "proc-macro2", "quote", @@ -139,17 +116,6 @@ dependencies = [ "rayon", ] -[[package]] -name = "async-channel" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - [[package]] name = "atty" version = "0.2.14" @@ -167,27 +133,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "bcs" version = "0.1.5" @@ -198,34 +143,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "binprot" -version = "0.1.8" -source = "git+https://github.com/openmina/binprot-rs?rev=dfbd3bbda8b2681d86ac73065523c658ee31d45d#dfbd3bbda8b2681d86ac73065523c658ee31d45d" -dependencies = [ - "binprot_derive", - "byteorder", - "md5", -] - -[[package]] -name = "binprot_derive" -version = "0.1.7" -source = "git+https://github.com/openmina/binprot-rs?rev=dfbd3bbda8b2681d86ac73065523c658ee31d45d#dfbd3bbda8b2681d86ac73065523c658ee31d45d" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -253,15 +170,6 @@ dependencies = [ "digest 0.10.6", ] -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -276,21 +184,6 @@ name = "bs58" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" -dependencies = [ - "sha2 0.9.9", -] - -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cbindgen" @@ -323,21 +216,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "time", - "wasm-bindgen", - "winapi", -] - [[package]] name = "clap" version = "3.2.23" @@ -362,27 +240,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "concurrent-queue" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - [[package]] name = "cpufeatures" version = "0.2.6" @@ -392,15 +249,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - [[package]] name = "crossbeam-channel" version = "0.5.7" @@ -500,19 +348,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.4.0", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.9.0" @@ -528,17 +363,11 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", "subtle", ] -[[package]] -name = "disjoint-set" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d102f1a462fdcdddce88d6d46c06c074a2d2749b262230333726b06c52bb7585" - [[package]] name = "either" version = "1.8.1" @@ -566,12 +395,6 @@ dependencies = [ "libc", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - [[package]] name = "fastrand" version = "1.9.0" @@ -593,95 +416,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-executor" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.13", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -699,26 +433,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", - "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - -[[package]] -name = "groupmap" -version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" -dependencies = [ - "ark-ec", - "ark-ff", - "rand", + "wasi", ] [[package]] @@ -772,29 +488,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "iana-time-zone" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[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 = "ident_case" version = "1.0.1" @@ -831,77 +524,18 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "kimchi" -version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "blake2", - "disjoint-set", - "groupmap", - "hex", - "itertools", - "mina-curves", - "mina-poseidon 0.1.0 (git+https://github.com/openmina/proof-systems?branch=ledger-newtypes)", - "num-bigint", - "num-derive", - "num-integer", - "num-traits", - "o1-utils", - "once_cell", - "poly-commitment", - "rand", - "rand_core", - "rayon", - "rmp-serde", - "serde", - "serde_with", - "strum", - "strum_macros", - "thiserror", - "turshi", -] - [[package]] name = "libc" version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - [[package]] name = "linux-raw-sys" version = "0.3.1" @@ -917,18 +551,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - [[package]] name = "memoffset" version = "0.8.0" @@ -942,12 +564,9 @@ dependencies = [ name = "mina" version = "0.1.0" dependencies = [ - "binprot", "cbindgen", "mina-hasher", - "mina-p2p-messages", "mina-signer", - "mina-tree", "num-bigint", "o1-utils", "serde", @@ -957,7 +576,7 @@ dependencies = [ [[package]] name = "mina-curves" version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" +source = "git+https://github.com/o1-labs/proof-systems?tag=0.1.0#2e7f353719bdcb90f1f346f796b8ea69a3c30ec5" dependencies = [ "ark-ec", "ark-ff", @@ -966,61 +585,20 @@ dependencies = [ [[package]] name = "mina-hasher" version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" +source = "git+https://github.com/o1-labs/proof-systems?tag=0.1.0#2e7f353719bdcb90f1f346f796b8ea69a3c30ec5" dependencies = [ "ark-ff", "bitvec", "mina-curves", - "mina-poseidon 0.1.0 (git+https://github.com/openmina/proof-systems?branch=ledger-newtypes)", + "mina-poseidon", "o1-utils", "serde", ] -[[package]] -name = "mina-p2p-messages" -version = "0.6.4" -source = "git+https://github.com/openmina/mina-p2p-messages-rs?rev=94fd3389acdf6986aa6731b0e64f5cd8b0db5eed#94fd3389acdf6986aa6731b0e64f5cd8b0db5eed" -dependencies = [ - "ark-ff", - "base64", - "binprot", - "binprot_derive", - "blake2", - "bs58", - "derive_more", - "hex", - "mina-curves", - "mina-hasher", - "mina-poseidon 0.1.0 (git+https://github.com/o1-labs/proof-systems?rev=373a294cf87f94d1bb518a248fbf71364aa73526)", - "mina-signer", - "o1-utils", - "serde", - "serde_json", - "sha2 0.10.6", - "thiserror", -] - [[package]] name = "mina-poseidon" version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "mina-curves", - "o1-utils", - "once_cell", - "rand", - "rayon", - "serde", - "serde_with", -] - -[[package]] -name = "mina-poseidon" -version = "0.1.0" -source = "git+https://github.com/o1-labs/proof-systems?rev=373a294cf87f94d1bb518a248fbf71364aa73526#373a294cf87f94d1bb518a248fbf71364aa73526" +source = "git+https://github.com/o1-labs/proof-systems?tag=0.1.0#2e7f353719bdcb90f1f346f796b8ea69a3c30ec5" dependencies = [ "ark-ec", "ark-ff", @@ -1037,7 +615,7 @@ dependencies = [ [[package]] name = "mina-signer" version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" +source = "git+https://github.com/o1-labs/proof-systems?tag=0.1.0#2e7f353719bdcb90f1f346f796b8ea69a3c30ec5" dependencies = [ "ark-ec", "ark-ff", @@ -1049,67 +627,10 @@ dependencies = [ "mina-hasher", "o1-utils", "rand", - "sha2 0.10.6", + "sha2", "thiserror", ] -[[package]] -name = "mina-tree" -version = "0.1.0" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "backtrace", - "base64", - "bincode", - "binprot", - "binprot_derive", - "bitvec", - "blake2", - "bs58", - "chrono", - "crc32fast", - "derive_more", - "getrandom", - "hex", - "itertools", - "kimchi", - "libc", - "mina-curves", - "mina-hasher", - "mina-p2p-messages", - "mina-poseidon 0.1.0 (git+https://github.com/openmina/proof-systems?branch=ledger-newtypes)", - "mina-signer", - "num-bigint", - "o1-utils", - "once_cell", - "packed_simd_2", - "poly-commitment", - "rand", - "rand_pcg", - "rand_seeder", - "rayon", - "serde", - "serde_json", - "sha2 0.10.6", - "static_assertions", - "tuple-map", - "uuid", - "wasm-bindgen", - "wasm_thread", -] - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "num-bigint" version = "0.4.3" @@ -1120,18 +641,6 @@ dependencies = [ "num-integer", "num-traits", "rand", - "serde", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", ] [[package]] @@ -1166,7 +675,7 @@ dependencies = [ [[package]] name = "o1-utils" version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" +source = "git+https://github.com/o1-labs/proof-systems?tag=0.1.0#2e7f353719bdcb90f1f346f796b8ea69a3c30ec5" dependencies = [ "ark-ec", "ark-ff", @@ -1182,47 +691,22 @@ dependencies = [ "rayon", "serde", "serde_with", - "sha2 0.10.6", + "sha2", "thiserror", ] -[[package]] -name = "object" -version = "0.30.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - [[package]] name = "os_str_bytes" version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if", - "libm", -] - [[package]] name = "paste" version = "1.0.12" @@ -1239,42 +723,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "poly-commitment" -version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-poly", - "ark-serialize", - "blake2", - "groupmap", - "itertools", - "mina-curves", - "mina-poseidon 0.1.0 (git+https://github.com/openmina/proof-systems?branch=ledger-newtypes)", - "o1-utils", - "once_cell", - "rand", - "rand_core", - "rayon", - "serde", - "serde_with", - "thiserror", -] - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1335,24 +783,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_pcg" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_seeder" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" -dependencies = [ - "rand_core", -] - [[package]] name = "rayon" version = "1.7.0" @@ -1384,50 +814,13 @@ dependencies = [ "bitflags", ] -[[package]] -name = "rmp" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44519172358fd6d58656c86ab8e7fbc9e1490c3e8f14d35ed78ca0dd07403c9f" -dependencies = [ - "byteorder", - "num-traits", - "paste", -] - -[[package]] -name = "rmp-serde" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b13be192e0220b8afb7222aa5813cb62cc269ebb5cac346ca6487681d2913e" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustc_version" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.17", + "semver", ] [[package]] @@ -1444,12 +837,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "rustversion" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" - [[package]] name = "ryu" version = "1.0.13" @@ -1471,12 +858,6 @@ dependencies = [ "semver-parser", ] -[[package]] -name = "semver" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" - [[package]] name = "semver-parser" version = "0.10.2" @@ -1539,19 +920,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.6" @@ -1563,46 +931,12 @@ dependencies = [ "digest 0.10.6", ] -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" - -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - [[package]] name = "subtle" version = "2.4.1" @@ -1685,17 +1019,6 @@ dependencies = [ "syn 2.0.13", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "toml" version = "0.5.11" @@ -1705,22 +1028,6 @@ dependencies = [ "serde", ] -[[package]] -name = "tuple-map" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d5919d7121237af683b7fa982450597b1eaa2643e597aec3b519e4e5ab3d62" - -[[package]] -name = "turshi" -version = "0.1.0" -source = "git+https://github.com/openmina/proof-systems?branch=ledger-newtypes#debf1501e0f319771ffc1d5a65de5b2cf60e44b8" -dependencies = [ - "ark-ff", - "hex", - "o1-utils", -] - [[package]] name = "typenum" version = "1.16.0" @@ -1739,110 +1046,18 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" -[[package]] -name = "uuid" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" -dependencies = [ - "getrandom", -] - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.13", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.13", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "wasm_thread" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52fc987e67957cab58160d1ea273a2886972ef6f59c7fa0c02e9fe2c8e11706" -dependencies = [ - "async-channel", - "futures", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -1874,22 +1089,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.1", -] - [[package]] name = "windows-sys" version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets 0.42.2", + "windows-targets", ] [[package]] @@ -1898,28 +1104,13 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] @@ -1928,84 +1119,42 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - [[package]] name = "wyz" version = "0.5.1" diff --git a/mina/Cargo.toml b/mina/Cargo.toml index 5839f2a480..4049088cdc 100644 --- a/mina/Cargo.toml +++ b/mina/Cargo.toml @@ -9,13 +9,9 @@ edition = "2021" crate-type = ["staticlib"] [dependencies] -# rev 79f99e347dba72ed8217bdf5791e6ea2170ff975 -mina-tree = { path = "../../ledger" } -mina-p2p-messages = { git = "https://github.com/openmina/mina-p2p-messages-rs", features = ["hashing"], rev = "94fd3389acdf6986aa6731b0e64f5cd8b0db5eed" } -mina-hasher = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } -mina-signer = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } -o1-utils = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } -binprot = { git = "https://github.com/openmina/binprot-rs", rev = "dfbd3bbda8b2681d86ac73065523c658ee31d45d" } +mina-hasher = { git = "https://github.com/o1-labs/proof-systems", tag = "0.1.0", version = "0.1.0" } +mina-signer = { git = "https://github.com/o1-labs/proof-systems", tag = "0.1.0", version = "0.1.0" } +o1-utils = { git = "https://github.com/o1-labs/proof-systems", tag = "0.1.0", version = "0.1.0" } [build-dependencies] cbindgen = "0.24.3" @@ -24,15 +20,3 @@ cbindgen = "0.24.3" num-bigint = "0.4.3" serde = "1.0.160" serde_json = "1.0.96" - -[patch.crates-io] -ark-ff = { git = "https://github.com/openmina/algebra", branch = "openmina" } -ark-ec = { git = "https://github.com/openmina/algebra", branch = "openmina" } -ark-poly = { git = "https://github.com/openmina/algebra", branch = "openmina" } -ark-serialize = { git = "https://github.com/openmina/algebra", branch = "openmina" } - -[patch.'https://github.com/o1-labs/proof-systems'] -mina-hasher = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } -mina-signer = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } -mina-curves = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } -o1-utils = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes" } diff --git a/mina/lib/mina.h b/mina/lib/mina.h index d00617a5f8..84b5f591f9 100644 --- a/mina/lib/mina.h +++ b/mina/lib/mina.h @@ -24,10 +24,3 @@ bool verify(uint8_t network_id, const uint8_t *field_ptr, uintptr_t field_len, bool *output_ptr); - -/** - * * # Safety * this functions accepts raw pointer from golang - */ -bool transaction_commitment(const uint8_t *zkapp_command_ptr, - uintptr_t zkapp_command_len, - uint8_t *output_ptr); diff --git a/mina/src/lib.rs b/mina/src/lib.rs index 442377277c..967c596afd 100644 --- a/mina/src/lib.rs +++ b/mina/src/lib.rs @@ -2,13 +2,8 @@ mod mina; use std::array::TryFromSliceError; -use binprot::BinProtRead; -use mina::{full_transaction_commitment, HashParameter, Message}; -use mina_p2p_messages::v2::{ - MinaBaseUserCommandStableV2, MinaBaseZkappCommandTStableV1WireStableV1, -}; +use mina::{HashParameter, Message}; use mina_signer::{BaseField, CurvePoint, PubKey, ScalarField, Signature}; -use mina_tree::scan_state::transaction_logic::zkapp_command::ZkAppCommand; use o1_utils::FieldHelpers; pub const FIELD_SIZE: usize = 32; @@ -144,44 +139,6 @@ pub unsafe extern "C" fn verify( true } -/** - * # Safety - * this functions accepts raw pointer from golang - */ -#[no_mangle] -pub unsafe extern "C" fn transaction_commitment( - zkapp_command_ptr: *const u8, - zkapp_command_len: usize, - output_ptr: *mut u8, // 32 bytes -) -> bool { - if zkapp_command_ptr.is_null() || zkapp_command_len == 0 || output_ptr.is_null() { - return false; - } - - let mut raw_zkapp_command = - unsafe { std::slice::from_raw_parts(zkapp_command_ptr, zkapp_command_len * FIELD_SIZE) }; - - let p2p_user_command = match MinaBaseUserCommandStableV2::binprot_read(&mut raw_zkapp_command) { - Ok(p2p_user_command) => p2p_user_command, - Err(_) => return false, - }; - - let p2p_zkapp_command: MinaBaseZkappCommandTStableV1WireStableV1 = match p2p_user_command { - MinaBaseUserCommandStableV2::ZkappCommand(zkapp_command) => zkapp_command, - _ => return false, - }; - - let zkapp_command = ZkAppCommand::from(&p2p_zkapp_command); - - let commitment = full_transaction_commitment(&zkapp_command); - - let output = unsafe { std::slice::from_raw_parts_mut(output_ptr, FIELD_SIZE) }; - - output.copy_from_slice(&commitment.0.to_bytes()); - - true -} - #[cfg(test)] mod tests { use std::str::FromStr; @@ -309,56 +266,6 @@ mod tests { 0, std::ptr::null_mut() )); - assert!(!transaction_commitment( - std::ptr::null(), - 0, - std::ptr::null_mut() - )); } } - - #[test] - fn test_transaction_commitment() { - let expected_commitment = BaseField::from_str( - "28213846620687386246595472357080373779104425260189267168855581893969578656916", - ) - .expect("valid field element"); - - let zkapp_command_bytes: Vec = vec![ - 1, 117, 106, 233, 195, 214, 114, 13, 78, 4, 4, 187, 51, 84, 152, 229, 147, 112, 219, - 84, 167, 23, 180, 8, 136, 152, 72, 59, 251, 63, 30, 133, 10, 0, 0, 0, 0, 210, 144, 249, - 36, 112, 95, 183, 20, 233, 31, 237, 185, 190, 215, 126, 133, 188, 232, 245, 217, 50, - 195, 244, 214, 146, 178, 14, 76, 62, 95, 154, 51, 67, 194, 186, 255, 206, 154, 176, - 194, 57, 30, 47, 61, 232, 172, 137, 22, 51, 51, 141, 130, 126, 111, 212, 242, 105, 51, - 28, 36, 128, 41, 177, 6, 1, 117, 106, 233, 195, 214, 114, 13, 78, 4, 4, 187, 51, 84, - 152, 229, 147, 112, 219, 84, 167, 23, 180, 8, 136, 152, 72, 59, 251, 63, 30, 133, 10, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 10, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 0, 0, 0, 1, 210, 144, 249, - 36, 112, 95, 183, 20, 233, 31, 237, 185, 190, 215, 126, 133, 188, 232, 245, 217, 50, - 195, 244, 214, 146, 178, 14, 76, 62, 95, 154, 51, 67, 194, 186, 255, 206, 154, 176, - 194, 57, 30, 47, 61, 232, 172, 137, 22, 51, 51, 141, 130, 126, 111, 212, 242, 105, 51, - 28, 36, 128, 41, 177, 6, 0, 1, 79, 247, 47, 247, 191, 152, 36, 85, 26, 27, 43, 213, - 162, 190, 189, 176, 35, 71, 50, 246, 249, 103, 245, 215, 39, 253, 128, 134, 74, 53, - 168, 16, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 10, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, 0, 0, 2, 2, 0, 0, - 0, 0, 34, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - ]; - - let mut output = [0u8; 32]; - - assert!(unsafe { - transaction_commitment( - zkapp_command_bytes.as_ptr(), - zkapp_command_bytes.len(), - output.as_mut_ptr(), - ) - }); - - assert_eq!(BaseField::from_bytes(&output).unwrap(), expected_commitment); - } } diff --git a/mina/src/mina.rs b/mina/src/mina.rs index 17864b17cb..2883bd893b 100644 --- a/mina/src/mina.rs +++ b/mina/src/mina.rs @@ -1,6 +1,5 @@ use mina_hasher::{DomainParameter, Hashable, Hasher, ROInput}; use mina_signer::{BaseField, PubKey, Signature, Signer}; -use mina_tree::scan_state::transaction_logic::zkapp_command::{AccountUpdate, ZkAppCommand}; use o1_utils::{field_helpers::FieldHelpersError, FieldHelpers}; #[derive(Debug, Clone)] @@ -59,26 +58,6 @@ impl Hashable for Message { } } -#[derive(Clone, Debug)] -pub struct TransactionCommitment(pub BaseField); - -impl TransactionCommitment { - fn create(account_updates_hash: BaseField) -> Self { - Self(account_updates_hash) - } - - fn create_complete(&self, memo_hash: BaseField, fee_payer_hash: BaseField) -> Self { - let mut hasher = - mina_hasher::create_kimchi::(HashParameter::TransactionCommitment); - - let msg = &Message { - fields: vec![memo_hash, fee_payer_hash, self.0], - }; - - TransactionCommitment(hasher.hash(msg)) - } -} - pub fn poseidon(msg: &Message, network_id: HashParameter) -> BaseField { let mut hasher = mina_hasher::create_kimchi::(network_id); @@ -95,13 +74,3 @@ pub fn verify( signer.verify(signature, pubkey, msg) } - -pub fn full_transaction_commitment(zkapp_command: &ZkAppCommand) -> TransactionCommitment { - let memo_hash = zkapp_command.memo.hash(); - let fee_payer_hash = AccountUpdate::of_fee_payer(zkapp_command.fee_payer.clone()).digest(); - let account_updates_hash = zkapp_command.account_updates_hash(); - - let txn_commitment = TransactionCommitment::create(account_updates_hash); - - txn_commitment.create_complete(memo_hash, fee_payer_hash) -}