mirror of
https://github.com/fluencelabs/lazy-snark
synced 2025-06-26 13:11:49 +00:00
add fluence mock back
This commit is contained in:
backend_fluence
.idea
Cargo.lockCargo.tomlrust-toolchainsrc
target
.rustc_info.json
release
.cargo-lock
.fingerprint
arrayvec-ea55a7b21e304da7
build-script-build_script_build-ea55a7b21e304da7build-script-build_script_build-ea55a7b21e304da7.jsondep-build-script-build_script_build-ea55a7b21e304da7invoked.timestamp
autocfg-a21adae664065943
dep-lib-autocfg-a21adae664065943invoked.timestamplib-autocfg-a21adae664065943lib-autocfg-a21adae664065943.json
autocfg-ba156e2488837a29
dep-lib-autocfg-ba156e2488837a29invoked.timestamplib-autocfg-ba156e2488837a29lib-autocfg-ba156e2488837a29.json
byteorder-e7b4102bc0021d30
build-script-build_script_build-e7b4102bc0021d30build-script-build_script_build-e7b4102bc0021d30.jsondep-build-script-build_script_build-e7b4102bc0021d30invoked.timestamp
cfg-if-6c9c1b9b1a7d8d7a
dep-lib-cfg_if-6c9c1b9b1a7d8d7ainvoked.timestamplib-cfg_if-6c9c1b9b1a7d8d7alib-cfg_if-6c9c1b9b1a7d8d7a.json
cfg-if-daabbf7333629fd7
dep-lib-cfg_if-daabbf7333629fd7invoked.timestamplib-cfg_if-daabbf7333629fd7lib-cfg_if-daabbf7333629fd7.json
ff_derive_ce-c5ae21c1f8ab5ac7
dep-lib-ff_derive_ce-c5ae21c1f8ab5ac7invoked.timestamplib-ff_derive_ce-c5ae21c1f8ab5ac7lib-ff_derive_ce-c5ae21c1f8ab5ac7.json
fluence-sdk-macro-1c145f93000bea20
dep-lib-fluence_sdk_macro-1c145f93000bea20invoked.timestamplib-fluence_sdk_macro-1c145f93000bea20lib-fluence_sdk_macro-1c145f93000bea20.json
fluence-sdk-macro-59c1eea12a9b2c0d
dep-lib-fluence_sdk_macro-59c1eea12a9b2c0dinvoked.timestamplib-fluence_sdk_macro-59c1eea12a9b2c0dlib-fluence_sdk_macro-59c1eea12a9b2c0d.json
fluence-sdk-main-6a27385252a26784
dep-lib-fluence_sdk_main-6a27385252a26784invoked.timestamplib-fluence_sdk_main-6a27385252a26784lib-fluence_sdk_main-6a27385252a26784.json
fluence-sdk-main-c564be5e2fc1903f
dep-lib-fluence_sdk_main-c564be5e2fc1903finvoked.timestamplib-fluence_sdk_main-c564be5e2fc1903flib-fluence_sdk_main-c564be5e2fc1903f.json
libc-b4ce19d8090a783a
build-script-build_script_build-b4ce19d8090a783abuild-script-build_script_build-b4ce19d8090a783a.jsondep-build-script-build_script_build-b4ce19d8090a783ainvoked.timestamp
log-38b7c2175f00b0f3
log-f76806c89c8607f3
num-bigint-66a8b9fa7a80d758
run-build-script-build_script_build-66a8b9fa7a80d758run-build-script-build_script_build-66a8b9fa7a80d758.json
num-bigint-7ba5afc88e8c7a05
build-script-build_script_build-7ba5afc88e8c7a05build-script-build_script_build-7ba5afc88e8c7a05.jsondep-build-script-build_script_build-7ba5afc88e8c7a05invoked.timestamp
num-bigint-86a8ab2e4cc571ce
dep-lib-num_bigint-86a8ab2e4cc571ceinvoked.timestamplib-num_bigint-86a8ab2e4cc571celib-num_bigint-86a8ab2e4cc571ce.json
num-integer-0a2c58f76f00762b
run-build-script-build_script_build-0a2c58f76f00762brun-build-script-build_script_build-0a2c58f76f00762b.json
num-integer-406fc3efec8aed11
build-script-build_script_build-406fc3efec8aed11build-script-build_script_build-406fc3efec8aed11.jsondep-build-script-build_script_build-406fc3efec8aed11invoked.timestamp
num-integer-e8194b2713db02ec
dep-lib-num_integer-e8194b2713db02ecinvoked.timestamplib-num_integer-e8194b2713db02eclib-num_integer-e8194b2713db02ec.json
num-traits-aef35c6e6450aa43
build-script-build_script_build-aef35c6e6450aa43build-script-build_script_build-aef35c6e6450aa43.jsondep-build-script-build_script_build-aef35c6e6450aa43invoked.timestamp
num-traits-b09213e89d96dd78
dep-lib-num_traits-b09213e89d96dd78invoked.timestamplib-num_traits-b09213e89d96dd78lib-num_traits-b09213e89d96dd78.json
num-traits-b51f66da3c55f140
run-build-script-build_script_build-b51f66da3c55f140run-build-script-build_script_build-b51f66da3c55f140.json
proc-macro2-9fe724c5f79cd05c
build-script-build_script_build-9fe724c5f79cd05cbuild-script-build_script_build-9fe724c5f79cd05c.jsondep-build-script-build_script_build-9fe724c5f79cd05cinvoked.timestamp
proc-macro2-a63c5f1e11c7060b
dep-lib-proc_macro2-a63c5f1e11c7060binvoked.timestamplib-proc_macro2-a63c5f1e11c7060blib-proc_macro2-a63c5f1e11c7060b.json
proc-macro2-ead4a744d39d3147
run-build-script-build_script_build-ead4a744d39d3147run-build-script-build_script_build-ead4a744d39d3147.json
quote-99b34e2ee1846fb4
dep-lib-quote-99b34e2ee1846fb4invoked.timestamplib-quote-99b34e2ee1846fb4lib-quote-99b34e2ee1846fb4.json
rand-27d1c77cb9bd74b4
build-script-build_script_build-27d1c77cb9bd74b4build-script-build_script_build-27d1c77cb9bd74b4.jsondep-build-script-build_script_build-27d1c77cb9bd74b4invoked.timestamp
rand_chacha-8528f9ea58c1ad98
build-script-build_script_build-8528f9ea58c1ad98build-script-build_script_build-8528f9ea58c1ad98.jsondep-build-script-build_script_build-8528f9ea58c1ad98invoked.timestamp
rand_pcg-e58a7e152f11a848
build-script-build_script_build-e58a7e152f11a848build-script-build_script_build-e58a7e152f11a848.jsondep-build-script-build_script_build-e58a7e152f11a848invoked.timestamp
ryu-0c4efe1ab59118e7
build-script-build_script_build-0c4efe1ab59118e7build-script-build_script_build-0c4efe1ab59118e7.jsondep-build-script-build_script_build-0c4efe1ab59118e7invoked.timestamp
serde-d2d9e67dc1cdccdc
build-script-build_script_build-d2d9e67dc1cdccdcbuild-script-build_script_build-d2d9e67dc1cdccdc.jsondep-build-script-build_script_build-d2d9e67dc1cdccdcinvoked.timestamp
serde_derive-653c9486920110a7
dep-lib-serde_derive-653c9486920110a7invoked.timestamplib-serde_derive-653c9486920110a7lib-serde_derive-653c9486920110a7.json
syn-4f8a64e2e5dc6e89
syn-722248f601b148c3
unicode-xid-33d131be9b306246
deps
autocfg-a21adae664065943.dautocfg-ba156e2488837a29.dcfg_if-6c9c1b9b1a7d8d7a.dcfg_if-daabbf7333629fd7.dff_derive_ce-c5ae21c1f8ab5ac7.dfluence_sdk_macro-1c145f93000bea20.dfluence_sdk_macro-59c1eea12a9b2c0d.dfluence_sdk_main-6a27385252a26784.dfluence_sdk_main-c564be5e2fc1903f.dlibautocfg-a21adae664065943.rliblibautocfg-a21adae664065943.rmetalibautocfg-ba156e2488837a29.rliblibautocfg-ba156e2488837a29.rmetalibcfg_if-6c9c1b9b1a7d8d7a.rliblibcfg_if-6c9c1b9b1a7d8d7a.rmetalibcfg_if-daabbf7333629fd7.rliblibcfg_if-daabbf7333629fd7.rmetalibff_derive_ce-c5ae21c1f8ab5ac7.solibfluence_sdk_macro-1c145f93000bea20.solibfluence_sdk_macro-59c1eea12a9b2c0d.solibfluence_sdk_main-6a27385252a26784.rliblibfluence_sdk_main-6a27385252a26784.rmetalibfluence_sdk_main-c564be5e2fc1903f.rliblibfluence_sdk_main-c564be5e2fc1903f.rmetaliblog-38b7c2175f00b0f3.rlibliblog-38b7c2175f00b0f3.rmetaliblog-f76806c89c8607f3.rlibliblog-f76806c89c8607f3.rmetalibnum_bigint-86a8ab2e4cc571ce.rliblibnum_bigint-86a8ab2e4cc571ce.rmetalibnum_integer-e8194b2713db02ec.rliblibnum_integer-e8194b2713db02ec.rmetalibnum_traits-b09213e89d96dd78.rliblibnum_traits-b09213e89d96dd78.rmetalibproc_macro2-a63c5f1e11c7060b.rliblibproc_macro2-a63c5f1e11c7060b.rmetalibquote-99b34e2ee1846fb4.rliblibquote-99b34e2ee1846fb4.rmetalibserde_derive-653c9486920110a7.solibsyn-4f8a64e2e5dc6e89.rliblibsyn-4f8a64e2e5dc6e89.rmetalibsyn-722248f601b148c3.rliblibsyn-722248f601b148c3.rmetalibunicode_xid-33d131be9b306246.rliblibunicode_xid-33d131be9b306246.rmetalog-38b7c2175f00b0f3.dlog-f76806c89c8607f3.dnum_bigint-86a8ab2e4cc571ce.dnum_integer-e8194b2713db02ec.dnum_traits-b09213e89d96dd78.dproc_macro2-a63c5f1e11c7060b.dquote-99b34e2ee1846fb4.dserde_derive-653c9486920110a7.dsyn-4f8a64e2e5dc6e89.dsyn-722248f601b148c3.dunicode_xid-33d131be9b306246.d
wasm32-unknown-unknown
release
.cargo-lock
.fingerprint
arrayvec-26a712ec6eb8a596
run-build-script-build_script_build-26a712ec6eb8a596run-build-script-build_script_build-26a712ec6eb8a596.json
arrayvec-e4d13d11b9c8e583
dep-lib-arrayvec-e4d13d11b9c8e583invoked.timestamplib-arrayvec-e4d13d11b9c8e583lib-arrayvec-e4d13d11b9c8e583.json
bellman_ce-45b031182769eed9
dep-lib-bellman_ce-45b031182769eed9invoked.timestamplib-bellman_ce-45b031182769eed9lib-bellman_ce-45b031182769eed9.json
bit-vec-65b93952bb20551d
dep-lib-bit_vec-65b93952bb20551dinvoked.timestamplib-bit_vec-65b93952bb20551dlib-bit_vec-65b93952bb20551d.json
byteorder-2d0b1c06a365e0b8
run-build-script-build_script_build-2d0b1c06a365e0b8run-build-script-build_script_build-2d0b1c06a365e0b8.json
byteorder-3c51ba592e6d3b50
dep-lib-byteorder-3c51ba592e6d3b50invoked.timestamplib-byteorder-3c51ba592e6d3b50lib-byteorder-3c51ba592e6d3b50.json
cfg-if-11151b130f6208d0
dep-lib-cfg_if-11151b130f6208d0invoked.timestamplib-cfg_if-11151b130f6208d0lib-cfg_if-11151b130f6208d0.json
cfg-if-90a93e2e13b6a483
dep-lib-cfg_if-90a93e2e13b6a483invoked.timestamplib-cfg_if-90a93e2e13b6a483lib-cfg_if-90a93e2e13b6a483.json
crossbeam-582a84922b4d48d2
dep-lib-crossbeam-582a84922b4d48d2invoked.timestamplib-crossbeam-582a84922b4d48d2lib-crossbeam-582a84922b4d48d2.json
crossbeam-channel-a24f62230ef8a42c
dep-lib-crossbeam_channel-a24f62230ef8a42cinvoked.timestamplib-crossbeam_channel-a24f62230ef8a42clib-crossbeam_channel-a24f62230ef8a42c.json
crossbeam-deque-0ecf36f3818a0e84
dep-lib-crossbeam_deque-0ecf36f3818a0e84invoked.timestamplib-crossbeam_deque-0ecf36f3818a0e84lib-crossbeam_deque-0ecf36f3818a0e84.json
crossbeam-epoch-0f1f8be3bd1f8b1e
dep-lib-crossbeam_epoch-0f1f8be3bd1f8b1einvoked.timestamplib-crossbeam_epoch-0f1f8be3bd1f8b1elib-crossbeam_epoch-0f1f8be3bd1f8b1e.json
crossbeam-queue-b0f8473866f717ac
dep-lib-crossbeam_queue-b0f8473866f717acinvoked.timestamplib-crossbeam_queue-b0f8473866f717aclib-crossbeam_queue-b0f8473866f717ac.json
crossbeam-utils-ac9b224bbe836056
dep-lib-crossbeam_utils-ac9b224bbe836056invoked.timestamplib-crossbeam_utils-ac9b224bbe836056lib-crossbeam_utils-ac9b224bbe836056.json
dice-game-c860f00935fec605
ff_ce-7207766552b1a30f
dep-lib-ff_ce-7207766552b1a30finvoked.timestamplib-ff_ce-7207766552b1a30flib-ff_ce-7207766552b1a30f.json
fluence-2547ab1e78be0ac7
dep-lib-fluence-2547ab1e78be0ac7invoked.timestamplib-fluence-2547ab1e78be0ac7lib-fluence-2547ab1e78be0ac7.json
fluence-b7def85b68ba4b54
dep-lib-fluence-b7def85b68ba4b54invoked.timestamplib-fluence-b7def85b68ba4b54lib-fluence-b7def85b68ba4b54.json
fluence-sdk-main-9679e542f83dccf0
dep-lib-fluence_sdk_main-9679e542f83dccf0invoked.timestamplib-fluence_sdk_main-9679e542f83dccf0lib-fluence_sdk_main-9679e542f83dccf0.json
fluence-sdk-main-e7a6a85e164e889e
dep-lib-fluence_sdk_main-e7a6a85e164e889einvoked.timestamplib-fluence_sdk_main-e7a6a85e164e889elib-fluence_sdk_main-e7a6a85e164e889e.json
futures-38e96e86071d74fb
dep-lib-futures-38e96e86071d74fbinvoked.timestamplib-futures-38e96e86071d74fblib-futures-38e96e86071d74fb.json
futures-cpupool-550de56f1d8d1a24
dep-lib-futures_cpupool-550de56f1d8d1a24invoked.timestamplib-futures_cpupool-550de56f1d8d1a24lib-futures_cpupool-550de56f1d8d1a24.json
hex-55bc06e734fdbc7c
itoa-ec63c91963630276
dep-lib-itoa-ec63c91963630276invoked.timestamplib-itoa-ec63c91963630276lib-itoa-ec63c91963630276.json
lazy_static-69049182576e0fa8
dep-lib-lazy_static-69049182576e0fa8invoked.timestamplib-lazy_static-69049182576e0fa8lib-lazy_static-69049182576e0fa8.json
libc-36f745807a4fb21f
dep-lib-libc-36f745807a4fb21finvoked.timestamplib-libc-36f745807a4fb21flib-libc-36f745807a4fb21f.json
libc-55326d5584ab0a77
run-build-script-build_script_build-55326d5584ab0a77run-build-script-build_script_build-55326d5584ab0a77.json
linked-hash-map-aa5546e76ac9b1be
dep-lib-linked_hash_map-aa5546e76ac9b1beinvoked.timestamplib-linked_hash_map-aa5546e76ac9b1belib-linked_hash_map-aa5546e76ac9b1be.json
log-b8727f7386747703
log-cc2cd388e376df6a
memoffset-3b5a58fb4cfaacbd
dep-lib-memoffset-3b5a58fb4cfaacbdinvoked.timestamplib-memoffset-3b5a58fb4cfaacbdlib-memoffset-3b5a58fb4cfaacbd.json
nodrop-d52ffa4a3305d830
dep-lib-nodrop-d52ffa4a3305d830invoked.timestamplib-nodrop-d52ffa4a3305d830lib-nodrop-d52ffa4a3305d830.json
num_cpus-da102c30c4b59bff
dep-lib-num_cpus-da102c30c4b59bffinvoked.timestamplib-num_cpus-da102c30c4b59bfflib-num_cpus-da102c30c4b59bff.json
pairing_ce-41ba5819410f2c41
dep-lib-pairing_ce-41ba5819410f2c41invoked.timestamplib-pairing_ce-41ba5819410f2c41lib-pairing_ce-41ba5819410f2c41.json
proc-macro2-a3e8f7c2c37c81da
dep-lib-proc_macro2-a3e8f7c2c37c81dainvoked.timestamplib-proc_macro2-a3e8f7c2c37c81dalib-proc_macro2-a3e8f7c2c37c81da.json
proc-macro2-c831c221dd6c46cd
run-build-script-build_script_build-c831c221dd6c46cdrun-build-script-build_script_build-c831c221dd6c46cd.json
proof-980ed51e7fdbef8f
quote-1a9295e549dcc272
dep-lib-quote-1a9295e549dcc272invoked.timestamplib-quote-1a9295e549dcc272lib-quote-1a9295e549dcc272.json
rand-4bc00f362b2262d3
run-build-script-build_script_build-4bc00f362b2262d3run-build-script-build_script_build-4bc00f362b2262d3.json
rand-80814ef5a49ed624
dep-lib-rand-80814ef5a49ed624invoked.timestamplib-rand-80814ef5a49ed624lib-rand-80814ef5a49ed624.json
rand-9128a36de5dcf07f
dep-lib-rand-9128a36de5dcf07finvoked.timestamplib-rand-9128a36de5dcf07flib-rand-9128a36de5dcf07f.json
rand_chacha-5dfd7de6154814fd
dep-lib-rand_chacha-5dfd7de6154814fdinvoked.timestamplib-rand_chacha-5dfd7de6154814fdlib-rand_chacha-5dfd7de6154814fd.json
rand_chacha-eaee9907d1289394
run-build-script-build_script_build-eaee9907d1289394run-build-script-build_script_build-eaee9907d1289394.json
rand_core-57c1dffc6685b28e
dep-lib-rand_core-57c1dffc6685b28einvoked.timestamplib-rand_core-57c1dffc6685b28elib-rand_core-57c1dffc6685b28e.json
rand_core-6fd76655bf5441fa
dep-lib-rand_core-6fd76655bf5441fainvoked.timestamplib-rand_core-6fd76655bf5441falib-rand_core-6fd76655bf5441fa.json
rand_hc-1fad6f195875b656
dep-lib-rand_hc-1fad6f195875b656invoked.timestamplib-rand_hc-1fad6f195875b656lib-rand_hc-1fad6f195875b656.json
rand_isaac-c2d9f323490df63f
dep-lib-rand_isaac-c2d9f323490df63finvoked.timestamplib-rand_isaac-c2d9f323490df63flib-rand_isaac-c2d9f323490df63f.json
rand_jitter-fb9535fb5fbf048d
dep-lib-rand_jitter-fb9535fb5fbf048dinvoked.timestamplib-rand_jitter-fb9535fb5fbf048dlib-rand_jitter-fb9535fb5fbf048d.json
rand_os-2d64b54ed1cc87a7
dep-lib-rand_os-2d64b54ed1cc87a7invoked.timestamplib-rand_os-2d64b54ed1cc87a7lib-rand_os-2d64b54ed1cc87a7.json
rand_pcg-1b5944f201fd435d
dep-lib-rand_pcg-1b5944f201fd435dinvoked.timestamplib-rand_pcg-1b5944f201fd435dlib-rand_pcg-1b5944f201fd435d.json
rand_pcg-6d86cb130048d540
run-build-script-build_script_build-6d86cb130048d540run-build-script-build_script_build-6d86cb130048d540.json
rand_xorshift-8ee3f3def2891a8d
dep-lib-rand_xorshift-8ee3f3def2891a8dinvoked.timestamplib-rand_xorshift-8ee3f3def2891a8dlib-rand_xorshift-8ee3f3def2891a8d.json
ryu-192e7cc650fc687a
ryu-2756c64f98b85c08
run-build-script-build_script_build-2756c64f98b85c08run-build-script-build_script_build-2756c64f98b85c08.json
scopeguard-4c6af0f8d2b4f98f
dep-lib-scopeguard-4c6af0f8d2b4f98finvoked.timestamplib-scopeguard-4c6af0f8d2b4f98flib-scopeguard-4c6af0f8d2b4f98f.json
serde-2b62fd1d30c91ea9
run-build-script-build_script_build-2b62fd1d30c91ea9run-build-script-build_script_build-2b62fd1d30c91ea9.json
serde-b23efdeec764650d
dep-lib-serde-b23efdeec764650dinvoked.timestamplib-serde-b23efdeec764650dlib-serde-b23efdeec764650d.json
serde_json-6c1f727a9c510d64
dep-lib-serde_json-6c1f727a9c510d64invoked.timestamplib-serde_json-6c1f727a9c510d64lib-serde_json-6c1f727a9c510d64.json
smallvec-04cff9e897a28769
dep-lib-smallvec-04cff9e897a28769invoked.timestamplib-smallvec-04cff9e897a28769lib-smallvec-04cff9e897a28769.json
syn-fb4d2419a727852e
unicode-xid-b0dd144b6454e258
deps
arrayvec-e4d13d11b9c8e583.dbellman_ce-45b031182769eed9.dbellman_ce-45b031182769eed9.wasmbit_vec-65b93952bb20551d.dbyteorder-3c51ba592e6d3b50.dcfg_if-11151b130f6208d0.dcfg_if-90a93e2e13b6a483.dcrossbeam-582a84922b4d48d2.dcrossbeam_channel-a24f62230ef8a42c.dcrossbeam_deque-0ecf36f3818a0e84.dcrossbeam_epoch-0f1f8be3bd1f8b1e.dcrossbeam_queue-b0f8473866f717ac.dcrossbeam_utils-ac9b224bbe836056.ddice_game.ddice_game.wasmff_ce-7207766552b1a30f.dfluence-2547ab1e78be0ac7.dfluence-b7def85b68ba4b54.dfluence_sdk_main-9679e542f83dccf0.dfluence_sdk_main-e7a6a85e164e889e.dfutures-38e96e86071d74fb.dfutures_cpupool-550de56f1d8d1a24.dhex-55bc06e734fdbc7c.ditoa-ec63c91963630276.dlazy_static-69049182576e0fa8.dlibarrayvec-e4d13d11b9c8e583.rliblibarrayvec-e4d13d11b9c8e583.rmetalibbellman_ce-45b031182769eed9.alibbellman_ce-45b031182769eed9.rliblibbit_vec-65b93952bb20551d.rliblibbit_vec-65b93952bb20551d.rmetalibbyteorder-3c51ba592e6d3b50.rliblibbyteorder-3c51ba592e6d3b50.rmetalibc-36f745807a4fb21f.dlibcfg_if-11151b130f6208d0.rliblibcfg_if-11151b130f6208d0.rmetalibcfg_if-90a93e2e13b6a483.rliblibcfg_if-90a93e2e13b6a483.rmetalibcrossbeam-582a84922b4d48d2.rliblibcrossbeam-582a84922b4d48d2.rmetalibcrossbeam_channel-a24f62230ef8a42c.rliblibcrossbeam_channel-a24f62230ef8a42c.rmetalibcrossbeam_deque-0ecf36f3818a0e84.rliblibcrossbeam_deque-0ecf36f3818a0e84.rmetalibcrossbeam_epoch-0f1f8be3bd1f8b1e.rliblibcrossbeam_epoch-0f1f8be3bd1f8b1e.rmetalibcrossbeam_queue-b0f8473866f717ac.rliblibcrossbeam_queue-b0f8473866f717ac.rmetalibcrossbeam_utils-ac9b224bbe836056.rliblibcrossbeam_utils-ac9b224bbe836056.rmetalibff_ce-7207766552b1a30f.rliblibff_ce-7207766552b1a30f.rmetalibfluence-2547ab1e78be0ac7.rliblibfluence-2547ab1e78be0ac7.rmetalibfluence-b7def85b68ba4b54.rliblibfluence-b7def85b68ba4b54.rmetalibfluence_sdk_main-9679e542f83dccf0.rliblibfluence_sdk_main-9679e542f83dccf0.rmetalibfluence_sdk_main-e7a6a85e164e889e.rliblibfluence_sdk_main-e7a6a85e164e889e.rmetalibfutures-38e96e86071d74fb.rliblibfutures-38e96e86071d74fb.rmetalibfutures_cpupool-550de56f1d8d1a24.rliblibfutures_cpupool-550de56f1d8d1a24.rmetalibhex-55bc06e734fdbc7c.rliblibhex-55bc06e734fdbc7c.rmetalibitoa-ec63c91963630276.rliblibitoa-ec63c91963630276.rmetaliblazy_static-69049182576e0fa8.rlibliblazy_static-69049182576e0fa8.rmetaliblibc-36f745807a4fb21f.rlibliblibc-36f745807a4fb21f.rmetaliblinked_hash_map-aa5546e76ac9b1be.rlibliblinked_hash_map-aa5546e76ac9b1be.rmetaliblog-b8727f7386747703.rlibliblog-b8727f7386747703.rmetaliblog-cc2cd388e376df6a.rlibliblog-cc2cd388e376df6a.rmetalibmemoffset-3b5a58fb4cfaacbd.rliblibmemoffset-3b5a58fb4cfaacbd.rmetalibnodrop-d52ffa4a3305d830.rliblibnodrop-d52ffa4a3305d830.rmetalibnum_cpus-da102c30c4b59bff.rliblibnum_cpus-da102c30c4b59bff.rmetalibpairing_ce-41ba5819410f2c41.rliblibpairing_ce-41ba5819410f2c41.rmetalibproc_macro2-a3e8f7c2c37c81da.rliblibproc_macro2-a3e8f7c2c37c81da.rmetalibquote-1a9295e549dcc272.rliblibquote-1a9295e549dcc272.rmetalibrand-80814ef5a49ed624.rliblibrand-80814ef5a49ed624.rmetalibrand-9128a36de5dcf07f.rliblibrand-9128a36de5dcf07f.rmetalibrand_chacha-5dfd7de6154814fd.rliblibrand_chacha-5dfd7de6154814fd.rmetalibrand_core-57c1dffc6685b28e.rliblibrand_core-57c1dffc6685b28e.rmetalibrand_core-6fd76655bf5441fa.rliblibrand_core-6fd76655bf5441fa.rmetalibrand_hc-1fad6f195875b656.rliblibrand_hc-1fad6f195875b656.rmetalibrand_isaac-c2d9f323490df63f.rliblibrand_isaac-c2d9f323490df63f.rmetalibrand_jitter-fb9535fb5fbf048d.rliblibrand_jitter-fb9535fb5fbf048d.rmetalibrand_os-2d64b54ed1cc87a7.rliblibrand_os-2d64b54ed1cc87a7.rmetalibrand_pcg-1b5944f201fd435d.rliblibrand_pcg-1b5944f201fd435d.rmetalibrand_xorshift-8ee3f3def2891a8d.rliblibrand_xorshift-8ee3f3def2891a8d.rmetalibryu-192e7cc650fc687a.rliblibryu-192e7cc650fc687a.rmetalibscopeguard-4c6af0f8d2b4f98f.rliblibscopeguard-4c6af0f8d2b4f98f.rmetalibserde-b23efdeec764650d.rliblibserde-b23efdeec764650d.rmetalibserde_json-6c1f727a9c510d64.rliblibserde_json-6c1f727a9c510d64.rmetalibsmallvec-04cff9e897a28769.rliblibsmallvec-04cff9e897a28769.rmetalibsyn-fb4d2419a727852e.rliblibsyn-fb4d2419a727852e.rmetalibunicode_xid-b0dd144b6454e258.rliblibunicode_xid-b0dd144b6454e258.rmetalinked_hash_map-aa5546e76ac9b1be.dlog-b8727f7386747703.dlog-cc2cd388e376df6a.dmemoffset-3b5a58fb4cfaacbd.dnodrop-d52ffa4a3305d830.dnum_cpus-da102c30c4b59bff.dpairing_ce-41ba5819410f2c41.dproc_macro2-a3e8f7c2c37c81da.dproof.dproof.wasmquote-1a9295e549dcc272.drand-80814ef5a49ed624.drand-9128a36de5dcf07f.drand_chacha-5dfd7de6154814fd.drand_core-57c1dffc6685b28e.drand_core-6fd76655bf5441fa.drand_hc-1fad6f195875b656.drand_isaac-c2d9f323490df63f.drand_jitter-fb9535fb5fbf048d.drand_os-2d64b54ed1cc87a7.drand_pcg-1b5944f201fd435d.drand_xorshift-8ee3f3def2891a8d.dryu-192e7cc650fc687a.dscopeguard-4c6af0f8d2b4f98f.dserde-b23efdeec764650d.dserde_json-6c1f727a9c510d64.dsmallvec-04cff9e897a28769.dsyn-fb4d2419a727852e.dunicode_xid-b0dd144b6454e258.d
proof.dproof.wasm
19
backend_fluence/src/error_type.rs
Normal file
19
backend_fluence/src/error_type.rs
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
pub type AppResult<T> = ::std::result::Result<T, Box<Error>>;
|
46
backend_fluence/src/lib.rs
Normal file
46
backend_fluence/src/lib.rs
Normal file
@ -0,0 +1,46 @@
|
||||
mod error_type;
|
||||
mod proof_manager;
|
||||
mod request_response;
|
||||
|
||||
use crate::error_type::AppResult;
|
||||
use crate::proof_manager::ProofManager;
|
||||
use crate::request_response::{Request, Response};
|
||||
|
||||
use fluence::sdk::*;
|
||||
use serde_json::Value;
|
||||
use std::cell::RefCell;
|
||||
|
||||
thread_local! {
|
||||
static PROOF_MANAGER: RefCell<ProofManager> = RefCell::new(ProofManager::new());
|
||||
}
|
||||
|
||||
fn do_request(req: String) -> AppResult<Value> {
|
||||
let request: Request = serde_json::from_str(req.as_str())?;
|
||||
|
||||
match request {
|
||||
|
||||
Request::Verify {
|
||||
proof_id,
|
||||
public_par,
|
||||
proof,
|
||||
} => PROOF_MANAGER.with(|gm| gm.borrow_mut().verify(proof_id, public_par, proof)),
|
||||
|
||||
Request::Check {
|
||||
proof_id,
|
||||
} => PROOF_MANAGER.with(|gm| gm.borrow_mut().check(proof_id))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[invocation_handler]
|
||||
fn main(req: String) -> String {
|
||||
match do_request(req) {
|
||||
Ok(res) => res.to_string(),
|
||||
Err(err) => {
|
||||
let response = Response::Error {
|
||||
message: err.to_string(),
|
||||
};
|
||||
serde_json::to_string(&response).unwrap()
|
||||
}
|
||||
}
|
||||
}
|
359
backend_fluence/src/proof_manager.rs
Normal file
359
backend_fluence/src/proof_manager.rs
Normal file
@ -0,0 +1,359 @@
|
||||
use crate::error_type::AppResult;
|
||||
use crate::request_response::Response;
|
||||
|
||||
use bellman_ce::groth16::*;
|
||||
|
||||
use linked_hash_map::LinkedHashMap;
|
||||
use serde_json::Value;
|
||||
|
||||
pub struct ProofManager {
|
||||
// map from job id to verify status
|
||||
proofs: LinkedHashMap<u64, u8>,
|
||||
}
|
||||
|
||||
impl ProofManager {
|
||||
|
||||
pub fn new() -> Self {
|
||||
ProofManager {
|
||||
proofs: LinkedHashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn verify(&mut self, proof_id: u64, public_par: [u64; 5], proof: [u64; 8]) -> AppResult<Value> {
|
||||
|
||||
// verify mock
|
||||
let result: u8 = 1;
|
||||
//test_xordemo();
|
||||
|
||||
// update proof status
|
||||
self.proofs.insert(proof_id, result);
|
||||
|
||||
let response = Response::Verify {
|
||||
result : result,
|
||||
};
|
||||
|
||||
serde_json::to_value(response).map_err(Into::into)
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub fn check(&self, proof_id: u64) -> AppResult<Value> {
|
||||
let status = self.proof_status(proof_id)?;
|
||||
let response = Response::Check { verifed: status };
|
||||
|
||||
serde_json::to_value(response).map_err(Into::into)
|
||||
}
|
||||
|
||||
fn proof_status(&self, proof_id: u64) -> AppResult<u8> {
|
||||
let status = self
|
||||
.proofs
|
||||
.get(&proof_id)
|
||||
.ok_or_else(|| format!("Proof with id {} wasn't found", proof_id))?;
|
||||
|
||||
Ok(*status)
|
||||
}
|
||||
/*
|
||||
fn test_xordemo() {
|
||||
let g1 = Fr::one();
|
||||
let g2 = Fr::one();
|
||||
let alpha = Fr::from_str("48577").unwrap();
|
||||
let beta = Fr::from_str("22580").unwrap();
|
||||
let gamma = Fr::from_str("53332").unwrap();
|
||||
let delta = Fr::from_str("5481").unwrap();
|
||||
let tau = Fr::from_str("3673").unwrap();
|
||||
|
||||
let params = {
|
||||
let c = XORDemo::<DummyEngine> {
|
||||
a: None,
|
||||
b: None,
|
||||
_marker: PhantomData
|
||||
};
|
||||
|
||||
generate_parameters(
|
||||
c,
|
||||
g1,
|
||||
g2,
|
||||
alpha,
|
||||
beta,
|
||||
gamma,
|
||||
delta,
|
||||
tau
|
||||
).unwrap()
|
||||
};
|
||||
|
||||
// This will synthesize the constraint system:
|
||||
//
|
||||
// public inputs: a_0 = 1, a_1 = c
|
||||
// aux inputs: a_2 = a, a_3 = b
|
||||
// constraints:
|
||||
// (a_0 - a_2) * (a_2) = 0
|
||||
// (a_0 - a_3) * (a_3) = 0
|
||||
// (a_2 + a_2) * (a_3) = (a_2 + a_3 - a_1)
|
||||
// (a_0) * 0 = 0
|
||||
// (a_1) * 0 = 0
|
||||
|
||||
// The evaluation domain is 8. The H query should
|
||||
// have 7 elements (it's a quotient polynomial)
|
||||
assert_eq!(7, params.h.len());
|
||||
|
||||
let mut root_of_unity = Fr::root_of_unity();
|
||||
|
||||
// We expect this to be a 2^10 root of unity
|
||||
assert_eq!(Fr::one(), root_of_unity.pow(&[1 << 10]));
|
||||
|
||||
// Let's turn it into a 2^3 root of unity.
|
||||
root_of_unity = root_of_unity.pow(&[1 << 7]);
|
||||
assert_eq!(Fr::one(), root_of_unity.pow(&[1 << 3]));
|
||||
assert_eq!(Fr::from_str("20201").unwrap(), root_of_unity);
|
||||
|
||||
// Let's compute all the points in our evaluation domain.
|
||||
let mut points = Vec::with_capacity(8);
|
||||
for i in 0..8 {
|
||||
points.push(root_of_unity.pow(&[i]));
|
||||
}
|
||||
|
||||
// Let's compute t(tau) = (tau - p_0)(tau - p_1)...
|
||||
// = tau^8 - 1
|
||||
let mut t_at_tau = tau.pow(&[8]);
|
||||
t_at_tau.sub_assign(&Fr::one());
|
||||
{
|
||||
let mut tmp = Fr::one();
|
||||
for p in &points {
|
||||
let mut term = tau;
|
||||
term.sub_assign(p);
|
||||
tmp.mul_assign(&term);
|
||||
}
|
||||
assert_eq!(tmp, t_at_tau);
|
||||
}
|
||||
|
||||
// We expect our H query to be 7 elements of the form...
|
||||
// {tau^i t(tau) / delta}
|
||||
let delta_inverse = delta.inverse().unwrap();
|
||||
let gamma_inverse = gamma.inverse().unwrap();
|
||||
{
|
||||
let mut coeff = delta_inverse;
|
||||
coeff.mul_assign(&t_at_tau);
|
||||
|
||||
let mut cur = Fr::one();
|
||||
for h in params.h.iter() {
|
||||
let mut tmp = cur;
|
||||
tmp.mul_assign(&coeff);
|
||||
|
||||
assert_eq!(*h, tmp);
|
||||
|
||||
cur.mul_assign(&tau);
|
||||
}
|
||||
}
|
||||
|
||||
// The density of the IC query is 2 (2 inputs)
|
||||
assert_eq!(2, params.vk.ic.len());
|
||||
|
||||
// The density of the L query is 2 (2 aux variables)
|
||||
assert_eq!(2, params.l.len());
|
||||
|
||||
// The density of the A query is 4 (each variable is in at least one A term)
|
||||
assert_eq!(4, params.a.len());
|
||||
|
||||
// The density of the B query is 2 (two variables are in at least one B term)
|
||||
assert_eq!(2, params.b_g1.len());
|
||||
assert_eq!(2, params.b_g2.len());
|
||||
|
||||
/*
|
||||
Lagrange interpolation polynomials in our evaluation domain:
|
||||
|
||||
,-------------------------------. ,-------------------------------. ,-------------------------------.
|
||||
| A TERM | | B TERM | | C TERM |
|
||||
`-------------------------------. `-------------------------------' `-------------------------------'
|
||||
| a_0 | a_1 | a_2 | a_3 | | a_0 | a_1 | a_2 | a_3 | | a_0 | a_1 | a_2 | a_3 |
|
||||
| 1 | 0 | 64512 | 0 | | 0 | 0 | 1 | 0 | | 0 | 0 | 0 | 0 |
|
||||
| 1 | 0 | 0 | 64512 | | 0 | 0 | 0 | 1 | | 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 2 | 0 | | 0 | 0 | 0 | 1 | | 0 | 64512 | 1 | 1 |
|
||||
| 1 | 0 | 0 | 0 | | 0 | 0 | 0 | 0 | | 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 | 0 | | 0 | 0 | 0 | 0 | | 0 | 0 | 0 | 0 |
|
||||
`-------'-------'-------'-------' `-------'-------'-------'-------' `-------'-------'-------'-------'
|
||||
|
||||
Example for u_0:
|
||||
|
||||
sage: r = 64513
|
||||
sage: Fr = GF(r)
|
||||
sage: omega = (Fr(5)^63)^(2^7)
|
||||
sage: tau = Fr(3673)
|
||||
sage: R.<x> = PolynomialRing(Fr, 'x')
|
||||
sage: def eval(tau, c0, c1, c2, c3, c4):
|
||||
....: p = R.lagrange_polynomial([(omega^0, c0), (omega^1, c1), (omega^2, c2), (omega^3, c3), (omega^4, c4), (omega^5, 0), (omega^6, 0), (omega^7, 0)])
|
||||
....: return p.substitute(tau)
|
||||
sage: eval(tau, 1, 1, 0, 1, 0)
|
||||
59158
|
||||
*/
|
||||
|
||||
let u_i = [59158, 48317, 21767, 10402].iter().map(|e| {
|
||||
Fr::from_str(&format!("{}", e)).unwrap()
|
||||
}).collect::<Vec<Fr>>();
|
||||
let v_i = [0, 0, 60619, 30791].iter().map(|e| {
|
||||
Fr::from_str(&format!("{}", e)).unwrap()
|
||||
}).collect::<Vec<Fr>>();
|
||||
let w_i = [0, 23320, 41193, 41193].iter().map(|e| {
|
||||
Fr::from_str(&format!("{}", e)).unwrap()
|
||||
}).collect::<Vec<Fr>>();
|
||||
|
||||
for (u, a) in u_i.iter()
|
||||
.zip(¶ms.a[..])
|
||||
{
|
||||
assert_eq!(u, a);
|
||||
}
|
||||
|
||||
for (v, b) in v_i.iter()
|
||||
.filter(|&&e| e != Fr::zero())
|
||||
.zip(¶ms.b_g1[..])
|
||||
{
|
||||
assert_eq!(v, b);
|
||||
}
|
||||
|
||||
for (v, b) in v_i.iter()
|
||||
.filter(|&&e| e != Fr::zero())
|
||||
.zip(¶ms.b_g2[..])
|
||||
{
|
||||
assert_eq!(v, b);
|
||||
}
|
||||
|
||||
for i in 0..4 {
|
||||
let mut tmp1 = beta;
|
||||
tmp1.mul_assign(&u_i[i]);
|
||||
|
||||
let mut tmp2 = alpha;
|
||||
tmp2.mul_assign(&v_i[i]);
|
||||
|
||||
tmp1.add_assign(&tmp2);
|
||||
tmp1.add_assign(&w_i[i]);
|
||||
|
||||
if i < 2 {
|
||||
// Check the correctness of the IC query elements
|
||||
tmp1.mul_assign(&gamma_inverse);
|
||||
|
||||
assert_eq!(tmp1, params.vk.ic[i]);
|
||||
} else {
|
||||
// Check the correctness of the L query elements
|
||||
tmp1.mul_assign(&delta_inverse);
|
||||
|
||||
assert_eq!(tmp1, params.l[i - 2]);
|
||||
}
|
||||
}
|
||||
|
||||
// Check consistency of the other elements
|
||||
assert_eq!(alpha, params.vk.alpha_g1);
|
||||
assert_eq!(beta, params.vk.beta_g1);
|
||||
assert_eq!(beta, params.vk.beta_g2);
|
||||
assert_eq!(gamma, params.vk.gamma_g2);
|
||||
assert_eq!(delta, params.vk.delta_g1);
|
||||
assert_eq!(delta, params.vk.delta_g2);
|
||||
|
||||
let pvk = prepare_verifying_key(¶ms.vk);
|
||||
|
||||
let r = Fr::from_str("27134").unwrap();
|
||||
let s = Fr::from_str("17146").unwrap();
|
||||
|
||||
let proof = {
|
||||
let c = XORDemo {
|
||||
a: Some(true),
|
||||
b: Some(false),
|
||||
_marker: PhantomData
|
||||
};
|
||||
|
||||
create_proof(
|
||||
c,
|
||||
¶ms,
|
||||
r,
|
||||
s
|
||||
).unwrap()
|
||||
};
|
||||
|
||||
// A(x) =
|
||||
// a_0 * (44865*x^7 + 56449*x^6 + 44865*x^5 + 8064*x^4 + 3520*x^3 + 56449*x^2 + 3520*x + 40321) +
|
||||
// a_1 * (8064*x^7 + 56449*x^6 + 8064*x^5 + 56449*x^4 + 8064*x^3 + 56449*x^2 + 8064*x + 56449) +
|
||||
// a_2 * (16983*x^7 + 24192*x^6 + 63658*x^5 + 56449*x^4 + 16983*x^3 + 24192*x^2 + 63658*x + 56449) +
|
||||
// a_3 * (5539*x^7 + 27797*x^6 + 6045*x^5 + 56449*x^4 + 58974*x^3 + 36716*x^2 + 58468*x + 8064) +
|
||||
{
|
||||
// proof A = alpha + A(tau) + delta * r
|
||||
let mut expected_a = delta;
|
||||
expected_a.mul_assign(&r);
|
||||
expected_a.add_assign(&alpha);
|
||||
expected_a.add_assign(&u_i[0]); // a_0 = 1
|
||||
expected_a.add_assign(&u_i[1]); // a_1 = 1
|
||||
expected_a.add_assign(&u_i[2]); // a_2 = 1
|
||||
// a_3 = 0
|
||||
assert_eq!(proof.a, expected_a);
|
||||
}
|
||||
|
||||
// B(x) =
|
||||
// a_0 * (0) +
|
||||
// a_1 * (0) +
|
||||
// a_2 * (56449*x^7 + 56449*x^6 + 56449*x^5 + 56449*x^4 + 56449*x^3 + 56449*x^2 + 56449*x + 56449) +
|
||||
// a_3 * (31177*x^7 + 44780*x^6 + 21752*x^5 + 42255*x^3 + 35861*x^2 + 33842*x + 48385)
|
||||
{
|
||||
// proof B = beta + B(tau) + delta * s
|
||||
let mut expected_b = delta;
|
||||
expected_b.mul_assign(&s);
|
||||
expected_b.add_assign(&beta);
|
||||
expected_b.add_assign(&v_i[0]); // a_0 = 1
|
||||
expected_b.add_assign(&v_i[1]); // a_1 = 1
|
||||
expected_b.add_assign(&v_i[2]); // a_2 = 1
|
||||
// a_3 = 0
|
||||
assert_eq!(proof.b, expected_b);
|
||||
}
|
||||
|
||||
// C(x) =
|
||||
// a_0 * (0) +
|
||||
// a_1 * (27797*x^7 + 56449*x^6 + 36716*x^5 + 8064*x^4 + 27797*x^3 + 56449*x^2 + 36716*x + 8064) +
|
||||
// a_2 * (36716*x^7 + 8064*x^6 + 27797*x^5 + 56449*x^4 + 36716*x^3 + 8064*x^2 + 27797*x + 56449) +
|
||||
// a_3 * (36716*x^7 + 8064*x^6 + 27797*x^5 + 56449*x^4 + 36716*x^3 + 8064*x^2 + 27797*x + 56449)
|
||||
//
|
||||
// If A * B = C at each point in the domain, then the following polynomial...
|
||||
// P(x) = A(x) * B(x) - C(x)
|
||||
// = 49752*x^14 + 13914*x^13 + 29243*x^12 + 27227*x^11 + 62362*x^10 + 35703*x^9 + 4032*x^8 + 14761*x^6 + 50599*x^5 + 35270*x^4 + 37286*x^3 + 2151*x^2 + 28810*x + 60481
|
||||
//
|
||||
// ... should be divisible by t(x), producing the quotient polynomial:
|
||||
// h(x) = P(x) / t(x)
|
||||
// = 49752*x^6 + 13914*x^5 + 29243*x^4 + 27227*x^3 + 62362*x^2 + 35703*x + 4032
|
||||
{
|
||||
let mut expected_c = Fr::zero();
|
||||
|
||||
// A * s
|
||||
let mut tmp = proof.a;
|
||||
tmp.mul_assign(&s);
|
||||
expected_c.add_assign(&tmp);
|
||||
|
||||
// B * r
|
||||
let mut tmp = proof.b;
|
||||
tmp.mul_assign(&r);
|
||||
expected_c.add_assign(&tmp);
|
||||
|
||||
// delta * r * s
|
||||
let mut tmp = delta;
|
||||
tmp.mul_assign(&r);
|
||||
tmp.mul_assign(&s);
|
||||
expected_c.sub_assign(&tmp);
|
||||
|
||||
// L query answer
|
||||
// a_2 = 1, a_3 = 0
|
||||
expected_c.add_assign(¶ms.l[0]);
|
||||
|
||||
// H query answer
|
||||
for (i, coeff) in [5040, 11763, 10755, 63633, 128, 9747, 8739].iter().enumerate() {
|
||||
let coeff = Fr::from_str(&format!("{}", coeff)).unwrap();
|
||||
|
||||
let mut tmp = params.h[i];
|
||||
tmp.mul_assign(&coeff);
|
||||
expected_c.add_assign(&tmp);
|
||||
}
|
||||
|
||||
assert_eq!(expected_c, proof.c);
|
||||
}
|
||||
|
||||
assert!(verify_proof(
|
||||
&pvk,
|
||||
&proof,
|
||||
&[Fr::one()]
|
||||
).unwrap());
|
||||
}*/
|
||||
|
||||
}
|
23
backend_fluence/src/request_response.rs
Normal file
23
backend_fluence/src/request_response.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(tag = "action")]
|
||||
pub enum Request {
|
||||
Verify {
|
||||
proof_id: u64,
|
||||
public_par: [u64; 5],
|
||||
proof: [u64; 8],
|
||||
},
|
||||
Check {
|
||||
proof_id: u64,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Response {
|
||||
Verify { result: u8 },
|
||||
Check { verifed: u8 },
|
||||
Error { message: String },
|
||||
}
|
130
backend_fluence/src/tests.rs
Normal file
130
backend_fluence/src/tests.rs
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
use crate::request_response::{Request, Response};
|
||||
use crate::main;
|
||||
|
||||
// TODO: add more tests
|
||||
|
||||
#[test]
|
||||
fn correct_bets() {
|
||||
let response = Response::Join { player_id: 0 };
|
||||
assert_eq!(
|
||||
main(create_join_request()),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Join { player_id: 1 };
|
||||
assert_eq!(
|
||||
main(create_join_request()),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Bet {
|
||||
outcome: 6,
|
||||
player_balance: 85,
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(0, 1, 15)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Bet {
|
||||
outcome: 4,
|
||||
player_balance: 85,
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(1, 1, 15)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Bet {
|
||||
outcome: 6,
|
||||
player_balance: 510,
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(0, 6, 85)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Bet {
|
||||
outcome: 2,
|
||||
player_balance: 0,
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(1, 1, 85)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::GetBalance {
|
||||
player_balance: 510,
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_get_balance_json(0)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incorrect_bets() {
|
||||
let response = Response::Join { player_id: 0 };
|
||||
assert_eq!(
|
||||
main(create_join_request()),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Error {
|
||||
message: "Incorrect placement, please choose number from 1 to 6".to_string(),
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(0, 7, 15)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Error {
|
||||
message: "Player with id 1 wasn\'t found".to_string(),
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(1, 1, 0)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
|
||||
let response = Response::Error {
|
||||
message: "Player hasn\'t enough money: player\'s current balance is 100 while the bet is 4294967295".to_string()
|
||||
};
|
||||
assert_eq!(
|
||||
main(create_bet_json(0, 6, std::u32::MAX)),
|
||||
serde_json::to_string(&response).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
fn create_join_request() -> String {
|
||||
let request = Request::Join;
|
||||
serde_json::to_value(request).unwrap().to_string()
|
||||
}
|
||||
|
||||
fn create_bet_json(player_id: u64, placement: u8, bet_amount: u32) -> String {
|
||||
let request = Request::Bet {
|
||||
player_id,
|
||||
placement,
|
||||
bet_amount,
|
||||
};
|
||||
serde_json::to_value(request).unwrap().to_string()
|
||||
}
|
||||
|
||||
fn create_get_balance_json(player_id: u64) -> String {
|
||||
let request = Request::GetBalance { player_id };
|
||||
serde_json::to_value(request).unwrap().to_string()
|
||||
}
|
Reference in New Issue
Block a user