implement marlin with raw keys
This commit is contained in:
parent
1a311afb0b
commit
9705da1afc
9 changed files with 433 additions and 378 deletions
249
Cargo.lock
generated
249
Cargo.lock
generated
|
@ -133,7 +133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3e8cb28c2137af1ef058aa59616db3f7df67dbb70bf2be4ee6920008cc30d98c"
|
||||
dependencies = [
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -145,7 +145,7 @@ dependencies = [
|
|||
"num-bigint 0.4.0",
|
||||
"num-traits 0.2.14",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -238,7 +238,7 @@ checksum = "5ac3d78c750b01f5df5b2e76d106ed31487a93b3868f14a7f0eb3a74f45e1d8a"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -262,12 +262,6 @@ dependencies = [
|
|||
"rand_xorshift",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.4.12"
|
||||
|
@ -277,12 +271,6 @@ dependencies = [
|
|||
"nodrop",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "assert_cli"
|
||||
version = "0.5.4"
|
||||
|
@ -316,11 +304,12 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.56"
|
||||
version = "0.3.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc"
|
||||
checksum = "88fb5a785d6b44fd9d6700935608639af1b8356de1e55d5f7c2740f4faa15d82"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
|
@ -328,12 +317,6 @@ dependencies = [
|
|||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bellman_ce"
|
||||
version = "0.3.5"
|
||||
|
@ -391,22 +374,11 @@ version = "0.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdc60350286c7c3db13b98e91dbe5c8b6830a6821bc20af5b0c310ce94d74915"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.12",
|
||||
"arrayvec",
|
||||
"byteorder",
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blake2b_simd"
|
||||
version = "0.5.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec 0.5.2",
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.7.3"
|
||||
|
@ -419,6 +391,15 @@ dependencies = [
|
|||
"generic-array 0.12.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-padding"
|
||||
version = "0.1.5"
|
||||
|
@ -558,6 +539,12 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||
|
||||
[[package]]
|
||||
name = "cpuid-bool"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam"
|
||||
version = "0.7.3"
|
||||
|
@ -569,7 +556,7 @@ dependencies = [
|
|||
"crossbeam-deque",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -578,7 +565,7 @@ version = "0.4.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.7.2",
|
||||
"crossbeam-utils",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
|
@ -589,7 +576,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"crossbeam-utils",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
|
@ -601,7 +588,7 @@ checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
|
|||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"crossbeam-utils",
|
||||
"lazy_static",
|
||||
"maybe-uninit",
|
||||
"memoffset",
|
||||
|
@ -615,7 +602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam-utils 0.7.2",
|
||||
"crossbeam-utils",
|
||||
"maybe-uninit",
|
||||
]
|
||||
|
||||
|
@ -630,17 +617,6 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if 1.0.0",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.2"
|
||||
|
@ -686,7 +662,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d"
|
||||
dependencies = [
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -697,7 +673,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -732,18 +708,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "3.0.1"
|
||||
version = "3.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff"
|
||||
checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
|
||||
checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
|
@ -798,7 +774,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -842,7 +818,7 @@ dependencies = [
|
|||
"num-traits 0.2.14",
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -879,9 +855,9 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
|||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1"
|
||||
checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -894,9 +870,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939"
|
||||
checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -904,15 +880,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94"
|
||||
checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1"
|
||||
checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -922,27 +898,27 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59"
|
||||
checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04"
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3"
|
||||
checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80"
|
||||
checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1"
|
||||
checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1006,9 +982,9 @@ checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
|
|||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.13.17"
|
||||
version = "0.13.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d250f5f82326884bd39c2853577e70a121775db76818ffa452ed1e80de12986"
|
||||
checksum = "b483c6c2145421099df1b4efd50e0f6205479a072199460eff852fa15e5603c7"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
|
@ -1057,9 +1033,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
|||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21"
|
||||
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"unicode-bidi",
|
||||
|
@ -1083,9 +1059,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
|||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.21"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
|
||||
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -1107,15 +1083,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.92"
|
||||
version = "0.2.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714"
|
||||
checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
|
||||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.12.18+1.1.0"
|
||||
version = "0.12.19+1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885"
|
||||
checksum = "f322155d574c8b9ebe991a04f6908bb49e68a79463338d24a43d6274cb6443e6"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
@ -1324,9 +1300,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
|||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.61"
|
||||
version = "0.9.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
|
||||
checksum = "fa52160d45fa2e7608d504b7c3a3355afed615e6d8b627a74458634ba21b69bd"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cc",
|
||||
|
@ -1403,7 +1379,7 @@ dependencies = [
|
|||
"pest_meta",
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1629,28 +1605,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.57"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
|
||||
checksum = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.3.5"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
|
||||
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"redox_syscall 0.1.57",
|
||||
"rust-argon2",
|
||||
"getrandom 0.2.2",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1699,18 +1668,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-argon2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"blake2b_simd",
|
||||
"constant_time_eq",
|
||||
"crossbeam-utils 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.18"
|
||||
|
@ -1754,7 +1711,7 @@ dependencies = [
|
|||
"rand 0.4.6",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"sha2",
|
||||
"sha2 0.8.2",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
|
@ -1806,7 +1763,7 @@ checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1826,7 +1783,7 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"block-buffer 0.7.3",
|
||||
"digest 0.8.1",
|
||||
"fake-simd",
|
||||
"opaque-debug 0.2.3",
|
||||
|
@ -1838,12 +1795,25 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"block-buffer 0.7.3",
|
||||
"digest 0.8.1",
|
||||
"fake-simd",
|
||||
"opaque-debug 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0",
|
||||
"cfg-if 1.0.0",
|
||||
"cpuid-bool",
|
||||
"digest 0.9.0",
|
||||
"opaque-debug 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "single"
|
||||
version = "1.0.0"
|
||||
|
@ -1870,9 +1840,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
|
@ -1899,9 +1869,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.68"
|
||||
version = "1.0.71"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87"
|
||||
checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
|
@ -1916,7 +1886,7 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
|
@ -1939,7 +1909,7 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"rand 0.8.3",
|
||||
"redox_syscall 0.2.5",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
]
|
||||
|
@ -1973,9 +1943,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023"
|
||||
checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
@ -2006,7 +1976,7 @@ checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2050,9 +2020,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
|
||||
dependencies = [
|
||||
"matches",
|
||||
]
|
||||
|
@ -2104,9 +2074,9 @@ checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
|
|||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
||||
checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
|
@ -2170,7 +2140,7 @@ dependencies = [
|
|||
"log",
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -2204,7 +2174,7 @@ checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -2282,22 +2252,22 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36"
|
||||
checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd"
|
||||
dependencies = [
|
||||
"zeroize_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize_derive"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16"
|
||||
checksum = "a2c1e130bebaeab2f23886bf9acbaca14b092408c452543c857f66399cd6dab1"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.26",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.68",
|
||||
"syn 1.0.71",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -2348,6 +2318,8 @@ dependencies = [
|
|||
"ark-ff",
|
||||
"ark-gm17",
|
||||
"ark-marlin",
|
||||
"ark-poly",
|
||||
"ark-poly-commit",
|
||||
"ark-relations",
|
||||
"ark-serialize",
|
||||
"bellman_ce",
|
||||
|
@ -2371,6 +2343,7 @@ dependencies = [
|
|||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.9.3",
|
||||
"typed-arena",
|
||||
"wasm-bindgen-test",
|
||||
"zokrates_common",
|
||||
|
@ -2414,7 +2387,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"sha2 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -23,6 +23,7 @@ pub enum SchemeParameter {
|
|||
G16,
|
||||
GM17,
|
||||
PGHR13,
|
||||
MARLIN,
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for CurveParameter {
|
||||
|
@ -63,6 +64,7 @@ impl TryFrom<&str> for SchemeParameter {
|
|||
G16 => Ok(SchemeParameter::G16),
|
||||
GM17 => Ok(SchemeParameter::GM17),
|
||||
PGHR13 => Ok(SchemeParameter::PGHR13),
|
||||
MARLIN => Ok(SchemeParameter::MARLIN),
|
||||
_ => Err(format!("Unknown proving scheme {}", s)),
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +95,8 @@ impl TryFrom<(&str, &str, &str)> for Parameters {
|
|||
(BackendParameter::Ark, CurveParameter::Bw6_761, SchemeParameter::GM17) => Ok(()),
|
||||
#[cfg(feature = "ark")]
|
||||
(BackendParameter::Ark, CurveParameter::Bn128, SchemeParameter::GM17) => Ok(()),
|
||||
#[cfg(feature = "ark")]
|
||||
(BackendParameter::Ark, CurveParameter::Bls12_377, SchemeParameter::MARLIN) => Ok(()),
|
||||
#[cfg(feature = "libsnark")]
|
||||
(BackendParameter::Libsnark, CurveParameter::Bn128, SchemeParameter::GM17) => Ok(()),
|
||||
#[cfg(feature = "libsnark")]
|
||||
|
|
|
@ -118,9 +118,9 @@ pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> {
|
|||
},
|
||||
#[cfg(feature = "ark")]
|
||||
Parameters(BackendParameter::Ark, _, SchemeParameter::MARLIN) => match prog {
|
||||
ProgEnum::Bls12_377Program(p) => cli_generate_proof::<_, MARLIN, Ark>(p, sub_matches),
|
||||
ProgEnum::Bw6_761Program(p) => cli_generate_proof::<_, MARLIN, Ark>(p, sub_matches),
|
||||
ProgEnum::Bn128Program(p) => cli_generate_proof::<_, MARLIN, Ark>(p, sub_matches),
|
||||
ProgEnum::Bls12_377Program(p) => cli_generate_proof::<_, Marlin, Ark>(p, sub_matches),
|
||||
ProgEnum::Bw6_761Program(p) => cli_generate_proof::<_, Marlin, Ark>(p, sub_matches),
|
||||
ProgEnum::Bn128Program(p) => cli_generate_proof::<_, Marlin, Ark>(p, sub_matches),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
#[cfg(feature = "libsnark")]
|
||||
|
|
|
@ -106,6 +106,11 @@ pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> {
|
|||
ProgEnum::Bn128Program(p) => cli_setup::<_, GM17, Ark>(p, sub_matches),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
#[cfg(feature = "ark")]
|
||||
Parameters(BackendParameter::Ark, _, SchemeParameter::MARLIN) => match prog {
|
||||
ProgEnum::Bls12_377Program(p) => cli_setup::<_, Marlin, Ark>(p, sub_matches),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
#[cfg(feature = "libsnark")]
|
||||
Parameters(BackendParameter::Libsnark, CurveParameter::Bn128, SchemeParameter::GM17) => {
|
||||
match prog {
|
||||
|
|
|
@ -89,6 +89,10 @@ pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> {
|
|||
Parameters(BackendParameter::Ark, CurveParameter::Bn128, SchemeParameter::GM17) => {
|
||||
cli_verify::<Bn128Field, GM17, Ark>(sub_matches)
|
||||
}
|
||||
#[cfg(feature = "ark")]
|
||||
Parameters(BackendParameter::Ark, CurveParameter::Bls12_377, SchemeParameter::MARLIN) => {
|
||||
cli_verify::<Bls12_377Field, Marlin, Ark>(sub_matches)
|
||||
}
|
||||
#[cfg(feature = "libsnark")]
|
||||
Parameters(BackendParameter::Libsnark, CurveParameter::Bn128, SchemeParameter::GM17) => {
|
||||
cli_verify::<Bn128Field, GM17, Libsnark>(sub_matches)
|
||||
|
|
|
@ -13,7 +13,7 @@ libsnark = ["cc", "cmake", "git2"]
|
|||
bellman = ["bellman_ce", "pairing_ce", "ff_ce", "zokrates_field/bellman"]
|
||||
wasm = ["bellman_ce/nolog", "bellman_ce/wasm"]
|
||||
multicore = ["bellman_ce/multicore"]
|
||||
ark = ["ark-ff", "ark-ec", "ark-bn254", "ark-bls12-377", "ark-bw6-761", "ark-gm17", "ark-serialize", "ark-relations", "ark-marlin", "zokrates_field/ark"]
|
||||
ark = ["ark-ff", "ark-ec", "ark-bn254", "ark-bls12-377", "ark-bw6-761", "ark-gm17", "ark-serialize", "ark-relations", "ark-marlin", "ark-poly", "ark-poly-commit", "zokrates_field/ark", "sha2"]
|
||||
|
||||
[dependencies]
|
||||
cfg-if = "0.1"
|
||||
|
@ -52,6 +52,10 @@ ark-gm17 = { version = "^0.2.0", default-features = false, optional = true }
|
|||
ark-serialize = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-relations = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-marlin = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-poly = { version = "^0.2.0", default-features = false, optional = true }
|
||||
ark-poly-commit = { version = "^0.2.0", default-features = false, optional = true }
|
||||
sha2 = { version = "0.9.3", optional = true }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "^0.3.0"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![feature(box_patterns, box_syntax)]
|
||||
|
||||
use ark_marlin;
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "bellman")] {
|
||||
extern crate bellman_ce as bellman;
|
||||
|
|
|
@ -1,60 +1,100 @@
|
|||
use ark_marlin::{
|
||||
prepare_verifying_key, verify_proof, PreparedVerifyingKey, Proof as ArkProof, ProvingKey,
|
||||
VerifyingKey,
|
||||
};
|
||||
use ark_marlin::{IndexProverKey, IndexVerifierKey, Proof as ArkProof};
|
||||
|
||||
use ark_marlin::Marlin;
|
||||
|
||||
use ark_ec::PairingEngine;
|
||||
use ark_ff::{PrimeField, UniformRand};
|
||||
use ark_poly::univariate::DensePolynomial;
|
||||
use ark_poly_commit::marlin_pc::MarlinKZG10;
|
||||
use ark_relations::{
|
||||
lc,
|
||||
r1cs::{ConstraintSynthesizer, ConstraintSystemRef, SynthesisError},
|
||||
};
|
||||
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
|
||||
use sha2::Sha256;
|
||||
|
||||
use zokrates_field::{ArkFieldExtensions, Bw6_761Field, Field};
|
||||
|
||||
use crate::ir::{Prog, Witness};
|
||||
use crate::proof_system::ark::Ark;
|
||||
use crate::proof_system::ark::Computation;
|
||||
use crate::proof_system::ark::{parse_fr, parse_g1, parse_g2, parse_g2_fq};
|
||||
use crate::proof_system::marlin::{Marlin, NotBw6_761Field, ProofPoints, VerificationKey};
|
||||
use crate::proof_system::marlin::{self, NotBw6_761Field, ProofPoints, VerificationKey};
|
||||
use crate::proof_system::Scheme;
|
||||
use crate::proof_system::{Backend, Proof, SetupKeypair};
|
||||
|
||||
impl<T: Field + ArkFieldExtensions + NotBw6_761Field> Backend<T, Marlin> for Ark {
|
||||
fn setup(program: Prog<T>) -> SetupKeypair<<Marlin as Scheme<T>>::VerificationKey> {
|
||||
let parameters = Computation::without_witness(program).setup();
|
||||
impl<T: Field + ArkFieldExtensions + NotBw6_761Field> Backend<T, marlin::Marlin> for Ark {
|
||||
fn setup(program: Prog<T>) -> SetupKeypair<<marlin::Marlin as Scheme<T>>::VerificationKey> {
|
||||
let computation = Computation::without_witness(program);
|
||||
|
||||
let mut pk: Vec<u8> = Vec::new();
|
||||
parameters.serialize_uncompressed(&mut pk).unwrap();
|
||||
use rand_0_7::SeedableRng;
|
||||
|
||||
let vk = VerificationKey {
|
||||
h: parse_g2::<T>(¶meters.vk.h_g2),
|
||||
g_alpha: parse_g1::<T>(¶meters.vk.g_alpha_g1),
|
||||
h_beta: parse_g2::<T>(¶meters.vk.h_beta_g2),
|
||||
g_gamma: parse_g1::<T>(¶meters.vk.g_gamma_g1),
|
||||
h_gamma: parse_g2::<T>(¶meters.vk.h_gamma_g2),
|
||||
query: parameters
|
||||
.vk
|
||||
.query
|
||||
.iter()
|
||||
.map(|g1| parse_g1::<T>(g1))
|
||||
.collect(),
|
||||
};
|
||||
let rng = &mut rand_0_7::rngs::StdRng::from_entropy();
|
||||
|
||||
SetupKeypair::new(vk, pk)
|
||||
println!("setup not found, creating local srs");
|
||||
|
||||
let srs = Marlin::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
Sha256,
|
||||
>::universal_setup(2usize.pow(21), 2usize.pow(21), 2usize.pow(21), rng)
|
||||
.unwrap();
|
||||
|
||||
println!("srs done!");
|
||||
|
||||
use ark_poly_commit::PCUniversalParams;
|
||||
|
||||
println!("srs max degree: {}", srs.max_degree());
|
||||
println!(
|
||||
"computation constraint count {}",
|
||||
computation.program.constraint_count()
|
||||
);
|
||||
|
||||
let (pk, vk) = Marlin::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
Sha256,
|
||||
>::index(&srs, computation)
|
||||
.unwrap();
|
||||
|
||||
println!("srs specialized for dummy circuit!");
|
||||
|
||||
//let parameters = Computation::without_witness(program).setup();
|
||||
|
||||
let mut serialized_pk: Vec<u8> = Vec::new();
|
||||
pk.serialize_uncompressed(&mut serialized_pk).unwrap();
|
||||
|
||||
let mut serialized_vk: Vec<u8> = Vec::new();
|
||||
vk.serialize_uncompressed(&mut serialized_vk).unwrap();
|
||||
|
||||
SetupKeypair::new(VerificationKey { raw: serialized_vk }, serialized_pk)
|
||||
}
|
||||
|
||||
fn generate_proof(
|
||||
program: Prog<T>,
|
||||
witness: Witness<T>,
|
||||
proving_key: Vec<u8>,
|
||||
) -> Proof<<Marlin as Scheme<T>>::ProofPoints> {
|
||||
) -> Proof<<marlin::Marlin as Scheme<T>>::ProofPoints> {
|
||||
let computation = Computation::with_witness(program, witness);
|
||||
let params = ProvingKey::<<T as ArkFieldExtensions>::ArkEngine>::deserialize_uncompressed(
|
||||
&mut proving_key.as_slice(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let proof = computation.clone().prove(¶ms);
|
||||
let proof_points = ProofPoints {
|
||||
a: parse_g1::<T>(&proof.a),
|
||||
b: parse_g2::<T>(&proof.b),
|
||||
c: parse_g1::<T>(&proof.c),
|
||||
};
|
||||
use rand_0_7::SeedableRng;
|
||||
|
||||
let rng = &mut rand_0_7::rngs::StdRng::from_entropy();
|
||||
|
||||
let pk = IndexProverKey::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
>::deserialize_uncompressed(&mut proving_key.as_slice())
|
||||
.unwrap();
|
||||
|
||||
let inputs = computation
|
||||
.public_inputs_values()
|
||||
|
@ -62,36 +102,32 @@ impl<T: Field + ArkFieldExtensions + NotBw6_761Field> Backend<T, Marlin> for Ark
|
|||
.map(parse_fr::<T>)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Proof::new(proof_points, inputs)
|
||||
let proof = Marlin::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
Sha256,
|
||||
>::prove(&pk, computation, rng)
|
||||
.unwrap();
|
||||
|
||||
let mut serialized_proof: Vec<u8> = Vec::new();
|
||||
proof.serialize_uncompressed(&mut serialized_proof).unwrap();
|
||||
|
||||
Proof::new(
|
||||
ProofPoints {
|
||||
raw: serialized_proof,
|
||||
},
|
||||
inputs,
|
||||
)
|
||||
}
|
||||
|
||||
fn verify(
|
||||
vk: <Marlin as Scheme<T>>::VerificationKey,
|
||||
proof: Proof<<Marlin as Scheme<T>>::ProofPoints>,
|
||||
vk: <marlin::Marlin as Scheme<T>>::VerificationKey,
|
||||
proof: Proof<<marlin::Marlin as Scheme<T>>::ProofPoints>,
|
||||
) -> bool {
|
||||
let vk = VerifyingKey {
|
||||
h_g2: serialization::to_g2::<T>(vk.h),
|
||||
g_alpha_g1: serialization::to_g1::<T>(vk.g_alpha),
|
||||
h_beta_g2: serialization::to_g2::<T>(vk.h_beta),
|
||||
g_gamma_g1: serialization::to_g1::<T>(vk.g_gamma),
|
||||
h_gamma_g2: serialization::to_g2::<T>(vk.h_gamma),
|
||||
query: vk
|
||||
.query
|
||||
.into_iter()
|
||||
.map(serialization::to_g1::<T>)
|
||||
.collect(),
|
||||
};
|
||||
|
||||
let ark_proof = ArkProof {
|
||||
a: serialization::to_g1::<T>(proof.proof.a),
|
||||
b: serialization::to_g2::<T>(proof.proof.b),
|
||||
c: serialization::to_g1::<T>(proof.proof.c),
|
||||
};
|
||||
|
||||
let pvk: PreparedVerifyingKey<<T as ArkFieldExtensions>::ArkEngine> =
|
||||
prepare_verifying_key(&vk);
|
||||
|
||||
let public_inputs: Vec<_> = proof
|
||||
let inputs: Vec<_> = proof
|
||||
.inputs
|
||||
.iter()
|
||||
.map(|s| {
|
||||
|
@ -101,101 +137,137 @@ impl<T: Field + ArkFieldExtensions + NotBw6_761Field> Backend<T, Marlin> for Ark
|
|||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
verify_proof(&pvk, &ark_proof, &public_inputs).unwrap()
|
||||
let proof = ArkProof::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
>::deserialize_uncompressed(&mut proof.proof.raw.as_slice())
|
||||
.unwrap();
|
||||
|
||||
let vk = IndexVerifierKey::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
>::deserialize_uncompressed(&mut vk.raw.as_slice())
|
||||
.unwrap();
|
||||
|
||||
use rand_0_7::SeedableRng;
|
||||
|
||||
let rng = &mut rand_0_7::rngs::StdRng::from_entropy();
|
||||
|
||||
Marlin::<
|
||||
<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr,
|
||||
MarlinKZG10<
|
||||
T::ArkEngine,
|
||||
DensePolynomial<<<T as ArkFieldExtensions>::ArkEngine as PairingEngine>::Fr>,
|
||||
>,
|
||||
Sha256,
|
||||
>::verify(&vk, &inputs, &proof, rng)
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Backend<Bw6_761Field, Marlin> for Ark {
|
||||
impl Backend<Bw6_761Field, marlin::Marlin> for Ark {
|
||||
fn setup(
|
||||
program: Prog<Bw6_761Field>,
|
||||
) -> SetupKeypair<<Marlin as Scheme<Bw6_761Field>>::VerificationKey> {
|
||||
let parameters = Computation::without_witness(program).setup();
|
||||
) -> SetupKeypair<<marlin::Marlin as Scheme<Bw6_761Field>>::VerificationKey> {
|
||||
unimplemented!();
|
||||
|
||||
let mut pk: Vec<u8> = Vec::new();
|
||||
parameters.serialize_uncompressed(&mut pk).unwrap();
|
||||
// let parameters = Computation::without_witness(program).setup();
|
||||
|
||||
let vk = VerificationKey {
|
||||
h: parse_g2_fq::<Bw6_761Field>(¶meters.vk.h_g2),
|
||||
g_alpha: parse_g1::<Bw6_761Field>(¶meters.vk.g_alpha_g1),
|
||||
h_beta: parse_g2_fq::<Bw6_761Field>(¶meters.vk.h_beta_g2),
|
||||
g_gamma: parse_g1::<Bw6_761Field>(¶meters.vk.g_gamma_g1),
|
||||
h_gamma: parse_g2_fq::<Bw6_761Field>(¶meters.vk.h_gamma_g2),
|
||||
query: parameters
|
||||
.vk
|
||||
.query
|
||||
.iter()
|
||||
.map(|g1| parse_g1::<Bw6_761Field>(g1))
|
||||
.collect(),
|
||||
};
|
||||
// let mut pk: Vec<u8> = Vec::new();
|
||||
// parameters.serialize_uncompressed(&mut pk).unwrap();
|
||||
|
||||
SetupKeypair::new(vk, pk)
|
||||
// let vk = VerificationKey {
|
||||
// h: parse_g2_fq::<Bw6_761Field>(¶meters.vk.h_g2),
|
||||
// g_alpha: parse_g1::<Bw6_761Field>(¶meters.vk.g_alpha_g1),
|
||||
// h_beta: parse_g2_fq::<Bw6_761Field>(¶meters.vk.h_beta_g2),
|
||||
// g_gamma: parse_g1::<Bw6_761Field>(¶meters.vk.g_gamma_g1),
|
||||
// h_gamma: parse_g2_fq::<Bw6_761Field>(¶meters.vk.h_gamma_g2),
|
||||
// query: parameters
|
||||
// .vk
|
||||
// .query
|
||||
// .iter()
|
||||
// .map(|g1| parse_g1::<Bw6_761Field>(g1))
|
||||
// .collect(),
|
||||
// };
|
||||
|
||||
// SetupKeypair::new(vk, pk)
|
||||
}
|
||||
|
||||
fn generate_proof(
|
||||
program: Prog<Bw6_761Field>,
|
||||
witness: Witness<Bw6_761Field>,
|
||||
proving_key: Vec<u8>,
|
||||
) -> Proof<<Marlin as Scheme<Bw6_761Field>>::ProofPoints> {
|
||||
let computation = Computation::with_witness(program, witness);
|
||||
let params =
|
||||
ProvingKey::<<Bw6_761Field as ArkFieldExtensions>::ArkEngine>::deserialize_uncompressed(
|
||||
&mut proving_key.as_slice(),
|
||||
)
|
||||
.unwrap();
|
||||
) -> Proof<<marlin::Marlin as Scheme<Bw6_761Field>>::ProofPoints> {
|
||||
unimplemented!();
|
||||
|
||||
let proof = computation.clone().prove(¶ms);
|
||||
let proof_points = ProofPoints {
|
||||
a: parse_g1::<Bw6_761Field>(&proof.a),
|
||||
b: parse_g2_fq::<Bw6_761Field>(&proof.b),
|
||||
c: parse_g1::<Bw6_761Field>(&proof.c),
|
||||
};
|
||||
// let computation = Computation::with_witness(program, witness);
|
||||
// let params =
|
||||
// ProvingKey::<<Bw6_761Field as ArkFieldExtensions>::ArkEngine>::deserialize_uncompressed(
|
||||
// &mut proving_key.as_slice(),
|
||||
// )
|
||||
// .unwrap();
|
||||
|
||||
let inputs = computation
|
||||
.public_inputs_values()
|
||||
.iter()
|
||||
.map(parse_fr::<Bw6_761Field>)
|
||||
.collect::<Vec<_>>();
|
||||
// let proof = computation.clone().prove(¶ms);
|
||||
// let proof_points = ProofPoints {
|
||||
// a: parse_g1::<Bw6_761Field>(&proof.a),
|
||||
// b: parse_g2_fq::<Bw6_761Field>(&proof.b),
|
||||
// c: parse_g1::<Bw6_761Field>(&proof.c),
|
||||
// };
|
||||
|
||||
Proof::new(proof_points, inputs)
|
||||
// let inputs = computation
|
||||
// .public_inputs_values()
|
||||
// .iter()
|
||||
// .map(parse_fr::<Bw6_761Field>)
|
||||
// .collect::<Vec<_>>();
|
||||
|
||||
// Proof::new(proof_points, inputs)
|
||||
}
|
||||
|
||||
fn verify(
|
||||
vk: <Marlin as Scheme<Bw6_761Field>>::VerificationKey,
|
||||
proof: Proof<<Marlin as Scheme<Bw6_761Field>>::ProofPoints>,
|
||||
vk: <marlin::Marlin as Scheme<Bw6_761Field>>::VerificationKey,
|
||||
proof: Proof<<marlin::Marlin as Scheme<Bw6_761Field>>::ProofPoints>,
|
||||
) -> bool {
|
||||
let vk = VerifyingKey {
|
||||
h_g2: serialization::to_g2_fq::<Bw6_761Field>(vk.h),
|
||||
g_alpha_g1: serialization::to_g1::<Bw6_761Field>(vk.g_alpha),
|
||||
h_beta_g2: serialization::to_g2_fq::<Bw6_761Field>(vk.h_beta),
|
||||
g_gamma_g1: serialization::to_g1::<Bw6_761Field>(vk.g_gamma),
|
||||
h_gamma_g2: serialization::to_g2_fq::<Bw6_761Field>(vk.h_gamma),
|
||||
query: vk
|
||||
.query
|
||||
.into_iter()
|
||||
.map(serialization::to_g1::<Bw6_761Field>)
|
||||
.collect(),
|
||||
};
|
||||
unimplemented!();
|
||||
|
||||
let ark_proof = ArkProof {
|
||||
a: serialization::to_g1::<Bw6_761Field>(proof.proof.a),
|
||||
b: serialization::to_g2_fq::<Bw6_761Field>(proof.proof.b),
|
||||
c: serialization::to_g1::<Bw6_761Field>(proof.proof.c),
|
||||
};
|
||||
// let vk = VerifyingKey {
|
||||
// h_g2: serialization::to_g2_fq::<Bw6_761Field>(vk.h),
|
||||
// g_alpha_g1: serialization::to_g1::<Bw6_761Field>(vk.g_alpha),
|
||||
// h_beta_g2: serialization::to_g2_fq::<Bw6_761Field>(vk.h_beta),
|
||||
// g_gamma_g1: serialization::to_g1::<Bw6_761Field>(vk.g_gamma),
|
||||
// h_gamma_g2: serialization::to_g2_fq::<Bw6_761Field>(vk.h_gamma),
|
||||
// query: vk
|
||||
// .query
|
||||
// .into_iter()
|
||||
// .map(serialization::to_g1::<Bw6_761Field>)
|
||||
// .collect(),
|
||||
// };
|
||||
|
||||
let pvk: PreparedVerifyingKey<<Bw6_761Field as ArkFieldExtensions>::ArkEngine> =
|
||||
prepare_verifying_key(&vk);
|
||||
// let ark_proof = ArkProof {
|
||||
// a: serialization::to_g1::<Bw6_761Field>(proof.proof.a),
|
||||
// b: serialization::to_g2_fq::<Bw6_761Field>(proof.proof.b),
|
||||
// c: serialization::to_g1::<Bw6_761Field>(proof.proof.c),
|
||||
// };
|
||||
|
||||
let public_inputs: Vec<_> = proof
|
||||
.inputs
|
||||
.iter()
|
||||
.map(|s| {
|
||||
Bw6_761Field::try_from_str(s.trim_start_matches("0x"), 16)
|
||||
.unwrap()
|
||||
.into_ark()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
// let pvk: PreparedVerifyingKey<<Bw6_761Field as ArkFieldExtensions>::ArkEngine> =
|
||||
// prepare_verifying_key(&vk);
|
||||
|
||||
verify_proof(&pvk, &ark_proof, &public_inputs).unwrap()
|
||||
// let public_inputs: Vec<_> = proof
|
||||
// .inputs
|
||||
// .iter()
|
||||
// .map(|s| {
|
||||
// Bw6_761Field::try_from_str(s.trim_start_matches("0x"), 16)
|
||||
// .unwrap()
|
||||
// .into_ark()
|
||||
// })
|
||||
// .collect::<Vec<_>>();
|
||||
|
||||
// verify_proof(&pvk, &ark_proof, &public_inputs).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,30 +18,23 @@ impl NotBw6_761Field for Bn128Field {}
|
|||
pub struct Marlin;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ProofPoints<G1, G2> {
|
||||
pub a: G1,
|
||||
pub b: G2,
|
||||
pub c: G1,
|
||||
pub struct ProofPoints {
|
||||
pub raw: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct VerificationKey<G1, G2> {
|
||||
pub h: G2,
|
||||
pub g_alpha: G1,
|
||||
pub h_beta: G2,
|
||||
pub g_gamma: G1,
|
||||
pub h_gamma: G2,
|
||||
pub query: Vec<G1>,
|
||||
pub struct VerificationKey {
|
||||
pub raw: Vec<u8>,
|
||||
}
|
||||
|
||||
impl<T: Field + NotBw6_761Field> Scheme<T> for Marlin {
|
||||
type VerificationKey = VerificationKey<G1Affine, G2Affine>;
|
||||
type ProofPoints = ProofPoints<G1Affine, G2Affine>;
|
||||
type VerificationKey = VerificationKey;
|
||||
type ProofPoints = ProofPoints;
|
||||
}
|
||||
|
||||
impl Scheme<Bw6_761Field> for Marlin {
|
||||
type VerificationKey = VerificationKey<G1Affine, G2AffineFq>;
|
||||
type ProofPoints = ProofPoints<G1Affine, G2AffineFq>;
|
||||
type VerificationKey = VerificationKey;
|
||||
type ProofPoints = ProofPoints;
|
||||
}
|
||||
|
||||
impl<T: SolidityCompatibleField + NotBw6_761Field> SolidityCompatibleScheme<T> for Marlin {
|
||||
|
@ -49,108 +42,110 @@ impl<T: SolidityCompatibleField + NotBw6_761Field> SolidityCompatibleScheme<T> f
|
|||
vk: <Marlin as Scheme<T>>::VerificationKey,
|
||||
abi: SolidityAbi,
|
||||
) -> String {
|
||||
let (mut template_text, solidity_pairing_lib) = match abi {
|
||||
SolidityAbi::V1 => (
|
||||
String::from(CONTRACT_TEMPLATE),
|
||||
String::from(SOLIDITY_PAIRING_LIB),
|
||||
),
|
||||
SolidityAbi::V2 => (
|
||||
String::from(CONTRACT_TEMPLATE_V2),
|
||||
String::from(SOLIDITY_PAIRING_LIB_V2),
|
||||
),
|
||||
};
|
||||
unimplemented!("no solidity verifier for marlin");
|
||||
|
||||
// replace things in template
|
||||
let vk_regex = Regex::new(r#"(<%vk_[^i%]*%>)"#).unwrap();
|
||||
let vk_query_len_regex = Regex::new(r#"(<%vk_query_length%>)"#).unwrap();
|
||||
let vk_query_repeat_regex = Regex::new(r#"(<%vk_query_pts%>)"#).unwrap();
|
||||
let vk_input_len_regex = Regex::new(r#"(<%vk_input_length%>)"#).unwrap();
|
||||
let input_loop = Regex::new(r#"(<%input_loop%>)"#).unwrap();
|
||||
let input_argument = Regex::new(r#"(<%input_argument%>)"#).unwrap();
|
||||
// let (mut template_text, solidity_pairing_lib) = match abi {
|
||||
// SolidityAbi::V1 => (
|
||||
// String::from(CONTRACT_TEMPLATE),
|
||||
// String::from(SOLIDITY_PAIRING_LIB),
|
||||
// ),
|
||||
// SolidityAbi::V2 => (
|
||||
// String::from(CONTRACT_TEMPLATE_V2),
|
||||
// String::from(SOLIDITY_PAIRING_LIB_V2),
|
||||
// ),
|
||||
// };
|
||||
|
||||
template_text = vk_regex
|
||||
.replace(template_text.as_str(), vk.h.to_string().as_str())
|
||||
.into_owned();
|
||||
// // replace things in template
|
||||
// let vk_regex = Regex::new(r#"(<%vk_[^i%]*%>)"#).unwrap();
|
||||
// let vk_query_len_regex = Regex::new(r#"(<%vk_query_length%>)"#).unwrap();
|
||||
// let vk_query_repeat_regex = Regex::new(r#"(<%vk_query_pts%>)"#).unwrap();
|
||||
// let vk_input_len_regex = Regex::new(r#"(<%vk_input_length%>)"#).unwrap();
|
||||
// let input_loop = Regex::new(r#"(<%input_loop%>)"#).unwrap();
|
||||
// let input_argument = Regex::new(r#"(<%input_argument%>)"#).unwrap();
|
||||
|
||||
template_text = vk_regex
|
||||
.replace(template_text.as_str(), vk.g_alpha.to_string().as_str())
|
||||
.into_owned();
|
||||
// template_text = vk_regex
|
||||
// .replace(template_text.as_str(), vk.h.to_string().as_str())
|
||||
// .into_owned();
|
||||
|
||||
template_text = vk_regex
|
||||
.replace(template_text.as_str(), vk.h_beta.to_string().as_str())
|
||||
.into_owned();
|
||||
// template_text = vk_regex
|
||||
// .replace(template_text.as_str(), vk.g_alpha.to_string().as_str())
|
||||
// .into_owned();
|
||||
|
||||
template_text = vk_regex
|
||||
.replace(template_text.as_str(), vk.g_gamma.to_string().as_str())
|
||||
.into_owned();
|
||||
// template_text = vk_regex
|
||||
// .replace(template_text.as_str(), vk.h_beta.to_string().as_str())
|
||||
// .into_owned();
|
||||
|
||||
template_text = vk_regex
|
||||
.replace(template_text.as_str(), vk.h_gamma.to_string().as_str())
|
||||
.into_owned();
|
||||
// template_text = vk_regex
|
||||
// .replace(template_text.as_str(), vk.g_gamma.to_string().as_str())
|
||||
// .into_owned();
|
||||
|
||||
let query_count: usize = vk.query.len();
|
||||
template_text = vk_query_len_regex
|
||||
.replace(template_text.as_str(), format!("{}", query_count).as_str())
|
||||
.into_owned();
|
||||
// template_text = vk_regex
|
||||
// .replace(template_text.as_str(), vk.h_gamma.to_string().as_str())
|
||||
// .into_owned();
|
||||
|
||||
template_text = vk_input_len_regex
|
||||
.replace(
|
||||
template_text.as_str(),
|
||||
format!("{}", query_count - 1).as_str(),
|
||||
)
|
||||
.into_owned();
|
||||
// let query_count: usize = vk.query.len();
|
||||
// template_text = vk_query_len_regex
|
||||
// .replace(template_text.as_str(), format!("{}", query_count).as_str())
|
||||
// .into_owned();
|
||||
|
||||
// feed input values only if there are any
|
||||
template_text = if query_count > 1 {
|
||||
input_loop.replace(
|
||||
template_text.as_str(),
|
||||
r#"
|
||||
for(uint i = 0; i < input.length; i++){
|
||||
inputValues[i] = input[i];
|
||||
}"#,
|
||||
)
|
||||
} else {
|
||||
input_loop.replace(template_text.as_str(), "")
|
||||
}
|
||||
.to_string();
|
||||
// template_text = vk_input_len_regex
|
||||
// .replace(
|
||||
// template_text.as_str(),
|
||||
// format!("{}", query_count - 1).as_str(),
|
||||
// )
|
||||
// .into_owned();
|
||||
|
||||
// take input values as argument only if there are any
|
||||
template_text = if query_count > 1 {
|
||||
input_argument.replace(
|
||||
template_text.as_str(),
|
||||
format!(", uint[{}] memory input", query_count - 1).as_str(),
|
||||
)
|
||||
} else {
|
||||
input_argument.replace(template_text.as_str(), "")
|
||||
}
|
||||
.to_string();
|
||||
// // feed input values only if there are any
|
||||
// template_text = if query_count > 1 {
|
||||
// input_loop.replace(
|
||||
// template_text.as_str(),
|
||||
// r#"
|
||||
// for(uint i = 0; i < input.length; i++){
|
||||
// inputValues[i] = input[i];
|
||||
// }"#,
|
||||
// )
|
||||
// } else {
|
||||
// input_loop.replace(template_text.as_str(), "")
|
||||
// }
|
||||
// .to_string();
|
||||
|
||||
let mut query_repeat_text = String::new();
|
||||
for (i, g1) in vk.query.iter().enumerate() {
|
||||
query_repeat_text.push_str(
|
||||
format!(
|
||||
"vk.query[{}] = Pairing.G1Point({});",
|
||||
i,
|
||||
g1.to_string().as_str()
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
if i < query_count - 1 {
|
||||
query_repeat_text.push_str("\n ");
|
||||
}
|
||||
}
|
||||
// // take input values as argument only if there are any
|
||||
// template_text = if query_count > 1 {
|
||||
// input_argument.replace(
|
||||
// template_text.as_str(),
|
||||
// format!(", uint[{}] memory input", query_count - 1).as_str(),
|
||||
// )
|
||||
// } else {
|
||||
// input_argument.replace(template_text.as_str(), "")
|
||||
// }
|
||||
// .to_string();
|
||||
|
||||
template_text = vk_query_repeat_regex
|
||||
.replace(template_text.as_str(), query_repeat_text.as_str())
|
||||
.into_owned();
|
||||
// let mut query_repeat_text = String::new();
|
||||
// for (i, g1) in vk.query.iter().enumerate() {
|
||||
// query_repeat_text.push_str(
|
||||
// format!(
|
||||
// "vk.query[{}] = Pairing.G1Point({});",
|
||||
// i,
|
||||
// g1.to_string().as_str()
|
||||
// )
|
||||
// .as_str(),
|
||||
// );
|
||||
// if i < query_count - 1 {
|
||||
// query_repeat_text.push_str("\n ");
|
||||
// }
|
||||
// }
|
||||
|
||||
let re = Regex::new(r"(?P<v>0[xX][0-9a-fA-F]{64})").unwrap();
|
||||
template_text = re.replace_all(&template_text, "uint256($v)").to_string();
|
||||
// template_text = vk_query_repeat_regex
|
||||
// .replace(template_text.as_str(), query_repeat_text.as_str())
|
||||
// .into_owned();
|
||||
|
||||
format!(
|
||||
"{}{}{}",
|
||||
SOLIDITY_G2_ADDITION_LIB, solidity_pairing_lib, template_text
|
||||
)
|
||||
// let re = Regex::new(r"(?P<v>0[xX][0-9a-fA-F]{64})").unwrap();
|
||||
// template_text = re.replace_all(&template_text, "uint256($v)").to_string();
|
||||
|
||||
// format!(
|
||||
// "{}{}{}",
|
||||
// SOLIDITY_G2_ADDITION_LIB, solidity_pairing_lib, template_text
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue