From 9ed9779e591dc0a1f42cc759ee2b95c3a26b38ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Andr=C3=A9=20Long?= Date: Mon, 15 Jul 2024 17:42:06 +0200 Subject: [PATCH] Multi-operations support: add_private, add_public, mul_public. --- README.md | 2 +- development/build.sh | 37 +- development/deploy.sh | 2 +- .../build/imports/data_custody_protocol.aleo | 3148 +++++++++-------- .../build/imports/dcp_core_protocol.aleo | 68 +- .../build/imports/dcp_fee_management.aleo | 19 +- .../build/imports/dcp_open_requests.aleo | 56 + .../build/imports/dcp_validator_shares.aleo | 55 +- .../build/imports/dcp_withdraw_requests.aleo | 54 - .../marketplace_example/build/main.aleo | 44 +- .../programs/marketplace_example/src/main.leo | 23 +- .../build/imports/dcp_core_protocol.aleo | 68 +- .../build/imports/dcp_fee_management.aleo | 19 +- .../build/imports/dcp_open_requests.aleo | 56 + .../build/imports/dcp_validator_shares.aleo | 55 +- .../build/imports/dcp_withdraw_requests.aleo | 54 - .../data_custody_protocol/build/main.aleo | 3148 +++++++++-------- programs/data_custody_protocol/program.json | 4 +- programs/data_custody_protocol/src/main.leo | 418 ++- .../.gitignore | 0 .../program.json | 2 +- programs/dcp_beaver_triples/src/main.leo | 7 + .../build/imports/dcp_fee_management.aleo | 19 +- .../build/imports/dcp_open_requests.aleo | 56 + .../build/imports/dcp_validator_shares.aleo | 55 +- .../build/imports/dcp_withdraw_requests.aleo | 54 - programs/dcp_core_protocol/build/main.aleo | 59 +- programs/dcp_core_protocol/program.json | 4 +- programs/dcp_core_protocol/src/main.leo | 63 +- programs/dcp_fee_management/build/main.aleo | 19 +- programs/dcp_fee_management/src/main.leo | 2 +- .../dcp_hash_custody_offchain/build/README.md | 2 - .../build/program.json | 10 +- programs/dcp_open_requests/.gitignore | 5 + .../build/README.md | 2 +- programs/dcp_open_requests/build/main.aleo | 56 + .../build/program.json | 2 +- programs/dcp_open_requests/program.json | 7 + .../src/main.leo | 138 +- .../build/imports/dcp_core_protocol.aleo | 68 +- .../build/imports/dcp_fee_management.aleo | 19 +- .../build/imports/dcp_open_requests.aleo | 56 + .../build/imports/dcp_validator_shares.aleo | 55 +- .../build/imports/dcp_withdraw_requests.aleo | 54 - .../dcp_reconstruct_secret/build/main.aleo | 3 +- programs/dcp_validator_shares/build/main.aleo | 55 +- programs/dcp_validator_shares/src/main.leo | 118 +- .../dcp_withdraw_requests/build/main.aleo | 54 - validators/run-validator/config/db.js | 2 +- validators/run-validator/config/programs.js | 6 +- validators/run-validator/lib/sync.js | 12 +- 51 files changed, 4483 insertions(+), 3911 deletions(-) create mode 100644 examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_open_requests.aleo delete mode 100644 examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_withdraw_requests.aleo create mode 100644 programs/data_custody_protocol/build/imports/dcp_open_requests.aleo delete mode 100644 programs/data_custody_protocol/build/imports/dcp_withdraw_requests.aleo rename programs/{dcp_withdraw_requests => dcp_beaver_triples}/.gitignore (100%) rename programs/{dcp_withdraw_requests => dcp_beaver_triples}/program.json (67%) create mode 100644 programs/dcp_beaver_triples/src/main.leo create mode 100644 programs/dcp_core_protocol/build/imports/dcp_open_requests.aleo delete mode 100644 programs/dcp_core_protocol/build/imports/dcp_withdraw_requests.aleo create mode 100644 programs/dcp_open_requests/.gitignore rename programs/{dcp_withdraw_requests => dcp_open_requests}/build/README.md (83%) create mode 100644 programs/dcp_open_requests/build/main.aleo rename programs/{dcp_withdraw_requests => dcp_open_requests}/build/program.json (61%) create mode 100644 programs/dcp_open_requests/program.json rename programs/{dcp_withdraw_requests => dcp_open_requests}/src/main.leo (54%) create mode 100644 programs/dcp_reconstruct_secret/build/imports/dcp_open_requests.aleo delete mode 100644 programs/dcp_reconstruct_secret/build/imports/dcp_withdraw_requests.aleo delete mode 100644 programs/dcp_withdraw_requests/build/main.aleo diff --git a/README.md b/README.md index 072934a..bdf980d 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ For a program to custody private data, it must import **`data_custody_protocol.a 1. To custody data, it can: - Call `data_custody_protocol.aleo/custody_data_as_program((data_view_key as field), threshold, ...)` - Send any records to `(data_view_key * 522678458525321116977504528531602186870683848189190546523208313015552693483group) as address` -2. It can then call `data_custody_protocol.aleo/request_data_as_program` to initiate a data request. +2. It can then call `data_custody_protocol.aleo/request_open_as_program` to initiate a data request. 3. Validator bots automatically call `dcp_core_protocol.aleo/process_request_as_validator` to accept the data request. 4. `data_custody_protocol.aleo/assert_completed_as_program` can then be used by the program to check if data was effectively transmitted. diff --git a/development/build.sh b/development/build.sh index 6374d4a..badcbc2 100644 --- a/development/build.sh +++ b/development/build.sh @@ -1,52 +1,37 @@ -cd ./programs/dcp_withdraw_requests -leo build +cd ./programs/dcp_open_requests +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../.. cd ./programs/dcp_validator_shares -leo build +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../.. cd ./programs/data_custody_protocol -leo build +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../.. cd ./programs/dcp_reconstruct_secret -leo build +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../.. cd ./programs/dcp_reconstruct_secret_offchain -leo build +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../.. cd ./programs/dcp_hash_custody_offchain -leo build -cd ../../../.. +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" +cd ../.. cd examples/nft_marketplace/programs/arc721_example -leo build +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../../../.. cd examples/nft_marketplace/programs/marketplace_example -leo build +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../../../.. - -# In './programs/dcp_core_protocol/src/main.leo' Uncomment transition : -# transition process_request_as_validator( -# This is due to: https://github.com/ProvableHQ/leo/issues/28192 - -while true; do - read -p "In './programs/dcp_core_protocol/src/main.leo', uncomment transition 'process_request_as_validator'. Is it done (yes/no)?" yn - case $yn in - [Yy]* ) make install; break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - - cd programs/dcp_core_protocol -leo build --non-recursive +leo build --network testnet --endpoint "https://api.explorer.aleo.org/v1" cd ../.. cd ./utils/snarkvm-scalar-to-viewkey diff --git a/development/deploy.sh b/development/deploy.sh index fd0b637..a160857 100644 --- a/development/deploy.sh +++ b/development/deploy.sh @@ -24,7 +24,7 @@ deploy_program () { sleep $SLEEP_BETWEEN_TX; } -deploy_program "dcp_withdraw_requests"; +deploy_program "dcp_open_requests"; deploy_program "dcp_validator_shares"; deploy_program "dcp_fee_management"; deploy_program "dcp_core_protocol"; diff --git a/examples/nft_marketplace/programs/marketplace_example/build/imports/data_custody_protocol.aleo b/examples/nft_marketplace/programs/marketplace_example/build/imports/data_custody_protocol.aleo index 7ec333d..193552d 100644 --- a/examples/nft_marketplace/programs/marketplace_example/build/imports/data_custody_protocol.aleo +++ b/examples/nft_marketplace/programs/marketplace_example/build/imports/data_custody_protocol.aleo @@ -1,6 +1,6 @@ import credits.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import dcp_fee_management.aleo; import dcp_core_protocol.aleo; program data_custody_protocol.aleo; @@ -18,7 +18,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -29,1564 +28,1637 @@ struct Proposal: current_validator_set_index as u64; +struct Operation: + is_addition as boolean; + operand_value as field; + is_operand_private as boolean; +function request_open: + input r0 as field.private; + input r1 as address.private; + input r2 as u8.private; + input r3 as field.public; + input r4 as [address; 16u32].public; + input r5 as u64.private; + input r6 as credits.aleo/credits.record; + input r7 as u32.public; + cast self.caller r0 r2 into r8 as Custody; + hash.bhp256 r8 into r9 as field; + cast r4[0u32] r4[1u32] r4[2u32] r4[3u32] r4[4u32] r4[5u32] r4[6u32] r4[7u32] r4[8u32] r4[9u32] r4[10u32] r4[11u32] r4[12u32] r4[13u32] r4[14u32] r4[15u32] into r10 as [address; 16u32]; + add r7 60u32 into r11; + add r11 180u32 into r12; + call dcp_open_requests.aleo/submit_requests_to_validators r10 r9 r1 r5 r3 r12 into r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28; + cast 16u8 into r29 as u64; + mul r29 r5 into r30; + call credits.aleo/transfer_private_to_public r6 dcp_fee_management.aleo r30 into r31 r32; + call dcp_core_protocol.aleo/request_open r9 r4 r3 into r33; + async request_open r7 r33 r32 into r34; + output r31 as credits.aleo/credits.record; + output r34 as data_custody_protocol.aleo/request_open.future; + +finalize request_open: + input r0 as u32.public; + input r1 as dcp_core_protocol.aleo/request_open.future; + input r2 as credits.aleo/transfer_private_to_public.future; + lte r0 block.height into r3; + assert.eq r3 true; + add r0 60u32 into r4; + lte block.height r4 into r5; + assert.eq r5 true; + await r1; + await r2; + + + + -function custody_data_as_program: + +function add_private: input r0 as field.private; input r1 as field.private; input r2 as [field; 15u32].private; input r3 as [address; 16u32].public; input r4 as u8.private; - assert.neq self.caller self.signer; - is.eq r2[0u32] 0field into r5; - or false r5 into r6; - is.eq r2[1u32] 0field into r7; - or r6 r7 into r8; - is.eq r2[2u32] 0field into r9; - or r8 r9 into r10; - is.eq r2[3u32] 0field into r11; - or r10 r11 into r12; - is.eq r2[4u32] 0field into r13; - or r12 r13 into r14; - is.eq r2[5u32] 0field into r15; - or r14 r15 into r16; - is.eq r2[6u32] 0field into r17; - or r16 r17 into r18; - is.eq r2[7u32] 0field into r19; - or r18 r19 into r20; - is.eq r2[8u32] 0field into r21; - or r20 r21 into r22; - is.eq r2[9u32] 0field into r23; - or r22 r23 into r24; - is.eq r2[10u32] 0field into r25; - or r24 r25 into r26; - is.eq r2[11u32] 0field into r27; - or r26 r27 into r28; - is.eq r2[12u32] 0field into r29; - or r28 r29 into r30; - is.eq r2[13u32] 0field into r31; - or r30 r31 into r32; - is.eq r2[14u32] 0field into r33; - or r32 r33 into r34; - not r34 into r35; - assert.eq r35 true; - cast self.caller r1 r4 into r36 as Custody; - hash.bhp256 r36 into r37 as field; - mul 1field 1field into r38; - sub r4 1u8 into r39; - lt 0u8 r39 into r40; - mul r2[0u32] r38 into r41; - ternary r40 r41 0field into r42; - add r0 r42 into r43; - mul r38 1field into r44; - sub r4 1u8 into r45; - lt 1u8 r45 into r46; - mul r2[1u32] r44 into r47; - ternary r46 r47 0field into r48; - add r43 r48 into r49; - mul r44 1field into r50; - sub r4 1u8 into r51; - lt 2u8 r51 into r52; - mul r2[2u32] r50 into r53; - ternary r52 r53 0field into r54; - add r49 r54 into r55; - mul r50 1field into r56; - sub r4 1u8 into r57; - lt 3u8 r57 into r58; - mul r2[3u32] r56 into r59; - ternary r58 r59 0field into r60; - add r55 r60 into r61; - mul r56 1field into r62; - sub r4 1u8 into r63; - lt 4u8 r63 into r64; - mul r2[4u32] r62 into r65; - ternary r64 r65 0field into r66; - add r61 r66 into r67; - mul r62 1field into r68; - sub r4 1u8 into r69; - lt 5u8 r69 into r70; - mul r2[5u32] r68 into r71; - ternary r70 r71 0field into r72; - add r67 r72 into r73; - mul r68 1field into r74; - sub r4 1u8 into r75; - lt 6u8 r75 into r76; - mul r2[6u32] r74 into r77; - ternary r76 r77 0field into r78; - add r73 r78 into r79; - mul r74 1field into r80; - sub r4 1u8 into r81; - lt 7u8 r81 into r82; - mul r2[7u32] r80 into r83; - ternary r82 r83 0field into r84; - add r79 r84 into r85; - mul r80 1field into r86; - sub r4 1u8 into r87; - lt 8u8 r87 into r88; - mul r2[8u32] r86 into r89; - ternary r88 r89 0field into r90; - add r85 r90 into r91; - mul r86 1field into r92; - sub r4 1u8 into r93; - lt 9u8 r93 into r94; - mul r2[9u32] r92 into r95; - ternary r94 r95 0field into r96; - add r91 r96 into r97; - mul r92 1field into r98; - sub r4 1u8 into r99; - lt 10u8 r99 into r100; - mul r2[10u32] r98 into r101; - ternary r100 r101 0field into r102; - add r97 r102 into r103; - mul r98 1field into r104; - sub r4 1u8 into r105; - lt 11u8 r105 into r106; - mul r2[11u32] r104 into r107; - ternary r106 r107 0field into r108; - add r103 r108 into r109; - mul r104 1field into r110; - sub r4 1u8 into r111; - lt 12u8 r111 into r112; - mul r2[12u32] r110 into r113; - ternary r112 r113 0field into r114; - add r109 r114 into r115; - mul r110 1field into r116; - sub r4 1u8 into r117; - lt 13u8 r117 into r118; - mul r2[13u32] r116 into r119; - ternary r118 r119 0field into r120; - add r115 r120 into r121; - mul r116 1field into r122; - sub r4 1u8 into r123; - lt 14u8 r123 into r124; - mul r2[14u32] r122 into r125; - ternary r124 r125 0field into r126; - add r121 r126 into r127; - cast r127 1field into r128 as Share; - cast r3[0u32] r128 1u64 into r129 as ValidatorShareData; - mul 1field 2field into r130; - sub r4 1u8 into r131; - lt 0u8 r131 into r132; - mul r2[0u32] r130 into r133; - ternary r132 r133 0field into r134; - add r0 r134 into r135; - mul r130 2field into r136; - sub r4 1u8 into r137; - lt 1u8 r137 into r138; - mul r2[1u32] r136 into r139; - ternary r138 r139 0field into r140; - add r135 r140 into r141; - mul r136 2field into r142; - sub r4 1u8 into r143; - lt 2u8 r143 into r144; - mul r2[2u32] r142 into r145; - ternary r144 r145 0field into r146; - add r141 r146 into r147; - mul r142 2field into r148; - sub r4 1u8 into r149; - lt 3u8 r149 into r150; - mul r2[3u32] r148 into r151; - ternary r150 r151 0field into r152; - add r147 r152 into r153; - mul r148 2field into r154; - sub r4 1u8 into r155; - lt 4u8 r155 into r156; - mul r2[4u32] r154 into r157; - ternary r156 r157 0field into r158; - add r153 r158 into r159; - mul r154 2field into r160; - sub r4 1u8 into r161; - lt 5u8 r161 into r162; - mul r2[5u32] r160 into r163; - ternary r162 r163 0field into r164; - add r159 r164 into r165; - mul r160 2field into r166; - sub r4 1u8 into r167; - lt 6u8 r167 into r168; - mul r2[6u32] r166 into r169; - ternary r168 r169 0field into r170; - add r165 r170 into r171; - mul r166 2field into r172; - sub r4 1u8 into r173; - lt 7u8 r173 into r174; - mul r2[7u32] r172 into r175; - ternary r174 r175 0field into r176; - add r171 r176 into r177; - mul r172 2field into r178; - sub r4 1u8 into r179; - lt 8u8 r179 into r180; - mul r2[8u32] r178 into r181; - ternary r180 r181 0field into r182; - add r177 r182 into r183; - mul r178 2field into r184; - sub r4 1u8 into r185; - lt 9u8 r185 into r186; - mul r2[9u32] r184 into r187; - ternary r186 r187 0field into r188; - add r183 r188 into r189; - mul r184 2field into r190; - sub r4 1u8 into r191; - lt 10u8 r191 into r192; - mul r2[10u32] r190 into r193; - ternary r192 r193 0field into r194; - add r189 r194 into r195; - mul r190 2field into r196; - sub r4 1u8 into r197; - lt 11u8 r197 into r198; - mul r2[11u32] r196 into r199; - ternary r198 r199 0field into r200; - add r195 r200 into r201; - mul r196 2field into r202; - sub r4 1u8 into r203; - lt 12u8 r203 into r204; - mul r2[12u32] r202 into r205; - ternary r204 r205 0field into r206; - add r201 r206 into r207; - mul r202 2field into r208; - sub r4 1u8 into r209; - lt 13u8 r209 into r210; - mul r2[13u32] r208 into r211; - ternary r210 r211 0field into r212; - add r207 r212 into r213; - mul r208 2field into r214; - sub r4 1u8 into r215; - lt 14u8 r215 into r216; - mul r2[14u32] r214 into r217; - ternary r216 r217 0field into r218; - add r213 r218 into r219; - cast r219 2field into r220 as Share; - cast r3[1u32] r220 1u64 into r221 as ValidatorShareData; - mul 1field 3field into r222; - sub r4 1u8 into r223; - lt 0u8 r223 into r224; - mul r2[0u32] r222 into r225; - ternary r224 r225 0field into r226; - add r0 r226 into r227; - mul r222 3field into r228; - sub r4 1u8 into r229; - lt 1u8 r229 into r230; - mul r2[1u32] r228 into r231; - ternary r230 r231 0field into r232; - add r227 r232 into r233; - mul r228 3field into r234; - sub r4 1u8 into r235; - lt 2u8 r235 into r236; - mul r2[2u32] r234 into r237; - ternary r236 r237 0field into r238; - add r233 r238 into r239; - mul r234 3field into r240; - sub r4 1u8 into r241; - lt 3u8 r241 into r242; - mul r2[3u32] r240 into r243; - ternary r242 r243 0field into r244; - add r239 r244 into r245; - mul r240 3field into r246; - sub r4 1u8 into r247; - lt 4u8 r247 into r248; - mul r2[4u32] r246 into r249; - ternary r248 r249 0field into r250; - add r245 r250 into r251; - mul r246 3field into r252; - sub r4 1u8 into r253; - lt 5u8 r253 into r254; - mul r2[5u32] r252 into r255; - ternary r254 r255 0field into r256; - add r251 r256 into r257; - mul r252 3field into r258; - sub r4 1u8 into r259; - lt 6u8 r259 into r260; - mul r2[6u32] r258 into r261; - ternary r260 r261 0field into r262; - add r257 r262 into r263; - mul r258 3field into r264; - sub r4 1u8 into r265; - lt 7u8 r265 into r266; - mul r2[7u32] r264 into r267; - ternary r266 r267 0field into r268; - add r263 r268 into r269; - mul r264 3field into r270; - sub r4 1u8 into r271; - lt 8u8 r271 into r272; - mul r2[8u32] r270 into r273; - ternary r272 r273 0field into r274; - add r269 r274 into r275; - mul r270 3field into r276; - sub r4 1u8 into r277; - lt 9u8 r277 into r278; - mul r2[9u32] r276 into r279; - ternary r278 r279 0field into r280; - add r275 r280 into r281; - mul r276 3field into r282; - sub r4 1u8 into r283; - lt 10u8 r283 into r284; - mul r2[10u32] r282 into r285; - ternary r284 r285 0field into r286; - add r281 r286 into r287; - mul r282 3field into r288; - sub r4 1u8 into r289; - lt 11u8 r289 into r290; - mul r2[11u32] r288 into r291; - ternary r290 r291 0field into r292; - add r287 r292 into r293; - mul r288 3field into r294; - sub r4 1u8 into r295; - lt 12u8 r295 into r296; - mul r2[12u32] r294 into r297; - ternary r296 r297 0field into r298; - add r293 r298 into r299; - mul r294 3field into r300; - sub r4 1u8 into r301; - lt 13u8 r301 into r302; - mul r2[13u32] r300 into r303; - ternary r302 r303 0field into r304; - add r299 r304 into r305; - mul r300 3field into r306; - sub r4 1u8 into r307; - lt 14u8 r307 into r308; - mul r2[14u32] r306 into r309; - ternary r308 r309 0field into r310; - add r305 r310 into r311; - cast r311 3field into r312 as Share; - cast r3[2u32] r312 1u64 into r313 as ValidatorShareData; - mul 1field 4field into r314; - sub r4 1u8 into r315; - lt 0u8 r315 into r316; - mul r2[0u32] r314 into r317; - ternary r316 r317 0field into r318; - add r0 r318 into r319; - mul r314 4field into r320; - sub r4 1u8 into r321; - lt 1u8 r321 into r322; - mul r2[1u32] r320 into r323; - ternary r322 r323 0field into r324; - add r319 r324 into r325; - mul r320 4field into r326; - sub r4 1u8 into r327; - lt 2u8 r327 into r328; - mul r2[2u32] r326 into r329; - ternary r328 r329 0field into r330; - add r325 r330 into r331; - mul r326 4field into r332; - sub r4 1u8 into r333; - lt 3u8 r333 into r334; - mul r2[3u32] r332 into r335; - ternary r334 r335 0field into r336; - add r331 r336 into r337; - mul r332 4field into r338; - sub r4 1u8 into r339; - lt 4u8 r339 into r340; - mul r2[4u32] r338 into r341; - ternary r340 r341 0field into r342; - add r337 r342 into r343; - mul r338 4field into r344; - sub r4 1u8 into r345; - lt 5u8 r345 into r346; - mul r2[5u32] r344 into r347; - ternary r346 r347 0field into r348; - add r343 r348 into r349; - mul r344 4field into r350; - sub r4 1u8 into r351; - lt 6u8 r351 into r352; - mul r2[6u32] r350 into r353; - ternary r352 r353 0field into r354; - add r349 r354 into r355; - mul r350 4field into r356; - sub r4 1u8 into r357; - lt 7u8 r357 into r358; - mul r2[7u32] r356 into r359; - ternary r358 r359 0field into r360; - add r355 r360 into r361; - mul r356 4field into r362; - sub r4 1u8 into r363; - lt 8u8 r363 into r364; - mul r2[8u32] r362 into r365; - ternary r364 r365 0field into r366; - add r361 r366 into r367; - mul r362 4field into r368; - sub r4 1u8 into r369; - lt 9u8 r369 into r370; - mul r2[9u32] r368 into r371; - ternary r370 r371 0field into r372; - add r367 r372 into r373; - mul r368 4field into r374; - sub r4 1u8 into r375; - lt 10u8 r375 into r376; - mul r2[10u32] r374 into r377; - ternary r376 r377 0field into r378; - add r373 r378 into r379; - mul r374 4field into r380; - sub r4 1u8 into r381; - lt 11u8 r381 into r382; - mul r2[11u32] r380 into r383; - ternary r382 r383 0field into r384; - add r379 r384 into r385; - mul r380 4field into r386; - sub r4 1u8 into r387; - lt 12u8 r387 into r388; - mul r2[12u32] r386 into r389; - ternary r388 r389 0field into r390; - add r385 r390 into r391; - mul r386 4field into r392; - sub r4 1u8 into r393; - lt 13u8 r393 into r394; - mul r2[13u32] r392 into r395; - ternary r394 r395 0field into r396; - add r391 r396 into r397; - mul r392 4field into r398; - sub r4 1u8 into r399; - lt 14u8 r399 into r400; - mul r2[14u32] r398 into r401; - ternary r400 r401 0field into r402; - add r397 r402 into r403; - cast r403 4field into r404 as Share; - cast r3[3u32] r404 1u64 into r405 as ValidatorShareData; - mul 1field 5field into r406; - sub r4 1u8 into r407; - lt 0u8 r407 into r408; - mul r2[0u32] r406 into r409; - ternary r408 r409 0field into r410; - add r0 r410 into r411; - mul r406 5field into r412; - sub r4 1u8 into r413; - lt 1u8 r413 into r414; - mul r2[1u32] r412 into r415; - ternary r414 r415 0field into r416; - add r411 r416 into r417; - mul r412 5field into r418; - sub r4 1u8 into r419; - lt 2u8 r419 into r420; - mul r2[2u32] r418 into r421; - ternary r420 r421 0field into r422; - add r417 r422 into r423; - mul r418 5field into r424; - sub r4 1u8 into r425; - lt 3u8 r425 into r426; - mul r2[3u32] r424 into r427; - ternary r426 r427 0field into r428; - add r423 r428 into r429; - mul r424 5field into r430; - sub r4 1u8 into r431; - lt 4u8 r431 into r432; - mul r2[4u32] r430 into r433; - ternary r432 r433 0field into r434; - add r429 r434 into r435; - mul r430 5field into r436; - sub r4 1u8 into r437; - lt 5u8 r437 into r438; - mul r2[5u32] r436 into r439; - ternary r438 r439 0field into r440; - add r435 r440 into r441; - mul r436 5field into r442; - sub r4 1u8 into r443; - lt 6u8 r443 into r444; - mul r2[6u32] r442 into r445; - ternary r444 r445 0field into r446; - add r441 r446 into r447; - mul r442 5field into r448; - sub r4 1u8 into r449; - lt 7u8 r449 into r450; - mul r2[7u32] r448 into r451; - ternary r450 r451 0field into r452; - add r447 r452 into r453; - mul r448 5field into r454; - sub r4 1u8 into r455; - lt 8u8 r455 into r456; - mul r2[8u32] r454 into r457; - ternary r456 r457 0field into r458; - add r453 r458 into r459; - mul r454 5field into r460; - sub r4 1u8 into r461; - lt 9u8 r461 into r462; - mul r2[9u32] r460 into r463; - ternary r462 r463 0field into r464; - add r459 r464 into r465; - mul r460 5field into r466; - sub r4 1u8 into r467; - lt 10u8 r467 into r468; - mul r2[10u32] r466 into r469; - ternary r468 r469 0field into r470; - add r465 r470 into r471; - mul r466 5field into r472; - sub r4 1u8 into r473; - lt 11u8 r473 into r474; - mul r2[11u32] r472 into r475; - ternary r474 r475 0field into r476; - add r471 r476 into r477; - mul r472 5field into r478; - sub r4 1u8 into r479; - lt 12u8 r479 into r480; - mul r2[12u32] r478 into r481; - ternary r480 r481 0field into r482; - add r477 r482 into r483; - mul r478 5field into r484; - sub r4 1u8 into r485; - lt 13u8 r485 into r486; - mul r2[13u32] r484 into r487; - ternary r486 r487 0field into r488; - add r483 r488 into r489; - mul r484 5field into r490; - sub r4 1u8 into r491; - lt 14u8 r491 into r492; - mul r2[14u32] r490 into r493; - ternary r492 r493 0field into r494; - add r489 r494 into r495; - cast r495 5field into r496 as Share; - cast r3[4u32] r496 1u64 into r497 as ValidatorShareData; - mul 1field 6field into r498; - sub r4 1u8 into r499; - lt 0u8 r499 into r500; - mul r2[0u32] r498 into r501; - ternary r500 r501 0field into r502; - add r0 r502 into r503; - mul r498 6field into r504; - sub r4 1u8 into r505; - lt 1u8 r505 into r506; - mul r2[1u32] r504 into r507; - ternary r506 r507 0field into r508; - add r503 r508 into r509; - mul r504 6field into r510; - sub r4 1u8 into r511; - lt 2u8 r511 into r512; - mul r2[2u32] r510 into r513; - ternary r512 r513 0field into r514; - add r509 r514 into r515; - mul r510 6field into r516; - sub r4 1u8 into r517; - lt 3u8 r517 into r518; - mul r2[3u32] r516 into r519; - ternary r518 r519 0field into r520; - add r515 r520 into r521; - mul r516 6field into r522; - sub r4 1u8 into r523; - lt 4u8 r523 into r524; - mul r2[4u32] r522 into r525; - ternary r524 r525 0field into r526; - add r521 r526 into r527; - mul r522 6field into r528; - sub r4 1u8 into r529; - lt 5u8 r529 into r530; - mul r2[5u32] r528 into r531; - ternary r530 r531 0field into r532; - add r527 r532 into r533; - mul r528 6field into r534; - sub r4 1u8 into r535; - lt 6u8 r535 into r536; - mul r2[6u32] r534 into r537; - ternary r536 r537 0field into r538; - add r533 r538 into r539; - mul r534 6field into r540; - sub r4 1u8 into r541; - lt 7u8 r541 into r542; - mul r2[7u32] r540 into r543; - ternary r542 r543 0field into r544; - add r539 r544 into r545; - mul r540 6field into r546; - sub r4 1u8 into r547; - lt 8u8 r547 into r548; - mul r2[8u32] r546 into r549; - ternary r548 r549 0field into r550; - add r545 r550 into r551; - mul r546 6field into r552; - sub r4 1u8 into r553; - lt 9u8 r553 into r554; - mul r2[9u32] r552 into r555; - ternary r554 r555 0field into r556; - add r551 r556 into r557; - mul r552 6field into r558; - sub r4 1u8 into r559; - lt 10u8 r559 into r560; - mul r2[10u32] r558 into r561; - ternary r560 r561 0field into r562; - add r557 r562 into r563; - mul r558 6field into r564; - sub r4 1u8 into r565; - lt 11u8 r565 into r566; - mul r2[11u32] r564 into r567; - ternary r566 r567 0field into r568; - add r563 r568 into r569; - mul r564 6field into r570; - sub r4 1u8 into r571; - lt 12u8 r571 into r572; - mul r2[12u32] r570 into r573; - ternary r572 r573 0field into r574; - add r569 r574 into r575; - mul r570 6field into r576; - sub r4 1u8 into r577; - lt 13u8 r577 into r578; - mul r2[13u32] r576 into r579; - ternary r578 r579 0field into r580; - add r575 r580 into r581; - mul r576 6field into r582; - sub r4 1u8 into r583; - lt 14u8 r583 into r584; - mul r2[14u32] r582 into r585; - ternary r584 r585 0field into r586; - add r581 r586 into r587; - cast r587 6field into r588 as Share; - cast r3[5u32] r588 1u64 into r589 as ValidatorShareData; - mul 1field 7field into r590; - sub r4 1u8 into r591; - lt 0u8 r591 into r592; - mul r2[0u32] r590 into r593; - ternary r592 r593 0field into r594; - add r0 r594 into r595; - mul r590 7field into r596; - sub r4 1u8 into r597; - lt 1u8 r597 into r598; - mul r2[1u32] r596 into r599; - ternary r598 r599 0field into r600; - add r595 r600 into r601; - mul r596 7field into r602; - sub r4 1u8 into r603; - lt 2u8 r603 into r604; - mul r2[2u32] r602 into r605; - ternary r604 r605 0field into r606; - add r601 r606 into r607; - mul r602 7field into r608; - sub r4 1u8 into r609; - lt 3u8 r609 into r610; - mul r2[3u32] r608 into r611; - ternary r610 r611 0field into r612; - add r607 r612 into r613; - mul r608 7field into r614; - sub r4 1u8 into r615; - lt 4u8 r615 into r616; - mul r2[4u32] r614 into r617; - ternary r616 r617 0field into r618; - add r613 r618 into r619; - mul r614 7field into r620; - sub r4 1u8 into r621; - lt 5u8 r621 into r622; - mul r2[5u32] r620 into r623; - ternary r622 r623 0field into r624; - add r619 r624 into r625; - mul r620 7field into r626; - sub r4 1u8 into r627; - lt 6u8 r627 into r628; - mul r2[6u32] r626 into r629; - ternary r628 r629 0field into r630; - add r625 r630 into r631; - mul r626 7field into r632; - sub r4 1u8 into r633; - lt 7u8 r633 into r634; - mul r2[7u32] r632 into r635; - ternary r634 r635 0field into r636; - add r631 r636 into r637; - mul r632 7field into r638; - sub r4 1u8 into r639; - lt 8u8 r639 into r640; - mul r2[8u32] r638 into r641; - ternary r640 r641 0field into r642; - add r637 r642 into r643; - mul r638 7field into r644; - sub r4 1u8 into r645; - lt 9u8 r645 into r646; - mul r2[9u32] r644 into r647; - ternary r646 r647 0field into r648; - add r643 r648 into r649; - mul r644 7field into r650; - sub r4 1u8 into r651; - lt 10u8 r651 into r652; - mul r2[10u32] r650 into r653; - ternary r652 r653 0field into r654; - add r649 r654 into r655; - mul r650 7field into r656; - sub r4 1u8 into r657; - lt 11u8 r657 into r658; - mul r2[11u32] r656 into r659; - ternary r658 r659 0field into r660; - add r655 r660 into r661; - mul r656 7field into r662; - sub r4 1u8 into r663; - lt 12u8 r663 into r664; - mul r2[12u32] r662 into r665; - ternary r664 r665 0field into r666; - add r661 r666 into r667; - mul r662 7field into r668; - sub r4 1u8 into r669; - lt 13u8 r669 into r670; - mul r2[13u32] r668 into r671; - ternary r670 r671 0field into r672; - add r667 r672 into r673; - mul r668 7field into r674; - sub r4 1u8 into r675; - lt 14u8 r675 into r676; - mul r2[14u32] r674 into r677; - ternary r676 r677 0field into r678; - add r673 r678 into r679; - cast r679 7field into r680 as Share; - cast r3[6u32] r680 1u64 into r681 as ValidatorShareData; - mul 1field 8field into r682; - sub r4 1u8 into r683; - lt 0u8 r683 into r684; - mul r2[0u32] r682 into r685; - ternary r684 r685 0field into r686; - add r0 r686 into r687; - mul r682 8field into r688; - sub r4 1u8 into r689; - lt 1u8 r689 into r690; - mul r2[1u32] r688 into r691; - ternary r690 r691 0field into r692; - add r687 r692 into r693; - mul r688 8field into r694; - sub r4 1u8 into r695; - lt 2u8 r695 into r696; - mul r2[2u32] r694 into r697; - ternary r696 r697 0field into r698; - add r693 r698 into r699; - mul r694 8field into r700; - sub r4 1u8 into r701; - lt 3u8 r701 into r702; - mul r2[3u32] r700 into r703; - ternary r702 r703 0field into r704; - add r699 r704 into r705; - mul r700 8field into r706; - sub r4 1u8 into r707; - lt 4u8 r707 into r708; - mul r2[4u32] r706 into r709; - ternary r708 r709 0field into r710; - add r705 r710 into r711; - mul r706 8field into r712; - sub r4 1u8 into r713; - lt 5u8 r713 into r714; - mul r2[5u32] r712 into r715; - ternary r714 r715 0field into r716; - add r711 r716 into r717; - mul r712 8field into r718; - sub r4 1u8 into r719; - lt 6u8 r719 into r720; - mul r2[6u32] r718 into r721; - ternary r720 r721 0field into r722; - add r717 r722 into r723; - mul r718 8field into r724; - sub r4 1u8 into r725; - lt 7u8 r725 into r726; - mul r2[7u32] r724 into r727; - ternary r726 r727 0field into r728; - add r723 r728 into r729; - mul r724 8field into r730; - sub r4 1u8 into r731; - lt 8u8 r731 into r732; - mul r2[8u32] r730 into r733; - ternary r732 r733 0field into r734; - add r729 r734 into r735; - mul r730 8field into r736; - sub r4 1u8 into r737; - lt 9u8 r737 into r738; - mul r2[9u32] r736 into r739; - ternary r738 r739 0field into r740; - add r735 r740 into r741; - mul r736 8field into r742; - sub r4 1u8 into r743; - lt 10u8 r743 into r744; - mul r2[10u32] r742 into r745; - ternary r744 r745 0field into r746; - add r741 r746 into r747; - mul r742 8field into r748; - sub r4 1u8 into r749; - lt 11u8 r749 into r750; - mul r2[11u32] r748 into r751; - ternary r750 r751 0field into r752; - add r747 r752 into r753; - mul r748 8field into r754; - sub r4 1u8 into r755; - lt 12u8 r755 into r756; - mul r2[12u32] r754 into r757; - ternary r756 r757 0field into r758; - add r753 r758 into r759; - mul r754 8field into r760; - sub r4 1u8 into r761; - lt 13u8 r761 into r762; - mul r2[13u32] r760 into r763; - ternary r762 r763 0field into r764; - add r759 r764 into r765; - mul r760 8field into r766; - sub r4 1u8 into r767; - lt 14u8 r767 into r768; - mul r2[14u32] r766 into r769; - ternary r768 r769 0field into r770; - add r765 r770 into r771; - cast r771 8field into r772 as Share; - cast r3[7u32] r772 1u64 into r773 as ValidatorShareData; - mul 1field 9field into r774; - sub r4 1u8 into r775; - lt 0u8 r775 into r776; - mul r2[0u32] r774 into r777; - ternary r776 r777 0field into r778; - add r0 r778 into r779; - mul r774 9field into r780; - sub r4 1u8 into r781; - lt 1u8 r781 into r782; - mul r2[1u32] r780 into r783; - ternary r782 r783 0field into r784; - add r779 r784 into r785; - mul r780 9field into r786; - sub r4 1u8 into r787; - lt 2u8 r787 into r788; - mul r2[2u32] r786 into r789; - ternary r788 r789 0field into r790; - add r785 r790 into r791; - mul r786 9field into r792; - sub r4 1u8 into r793; - lt 3u8 r793 into r794; - mul r2[3u32] r792 into r795; - ternary r794 r795 0field into r796; - add r791 r796 into r797; - mul r792 9field into r798; - sub r4 1u8 into r799; - lt 4u8 r799 into r800; - mul r2[4u32] r798 into r801; - ternary r800 r801 0field into r802; - add r797 r802 into r803; - mul r798 9field into r804; - sub r4 1u8 into r805; - lt 5u8 r805 into r806; - mul r2[5u32] r804 into r807; - ternary r806 r807 0field into r808; - add r803 r808 into r809; - mul r804 9field into r810; - sub r4 1u8 into r811; - lt 6u8 r811 into r812; - mul r2[6u32] r810 into r813; - ternary r812 r813 0field into r814; - add r809 r814 into r815; - mul r810 9field into r816; - sub r4 1u8 into r817; - lt 7u8 r817 into r818; - mul r2[7u32] r816 into r819; - ternary r818 r819 0field into r820; - add r815 r820 into r821; - mul r816 9field into r822; - sub r4 1u8 into r823; - lt 8u8 r823 into r824; - mul r2[8u32] r822 into r825; - ternary r824 r825 0field into r826; - add r821 r826 into r827; - mul r822 9field into r828; - sub r4 1u8 into r829; - lt 9u8 r829 into r830; - mul r2[9u32] r828 into r831; - ternary r830 r831 0field into r832; - add r827 r832 into r833; - mul r828 9field into r834; - sub r4 1u8 into r835; - lt 10u8 r835 into r836; - mul r2[10u32] r834 into r837; - ternary r836 r837 0field into r838; - add r833 r838 into r839; - mul r834 9field into r840; - sub r4 1u8 into r841; - lt 11u8 r841 into r842; - mul r2[11u32] r840 into r843; - ternary r842 r843 0field into r844; - add r839 r844 into r845; - mul r840 9field into r846; - sub r4 1u8 into r847; - lt 12u8 r847 into r848; - mul r2[12u32] r846 into r849; - ternary r848 r849 0field into r850; - add r845 r850 into r851; - mul r846 9field into r852; - sub r4 1u8 into r853; - lt 13u8 r853 into r854; - mul r2[13u32] r852 into r855; - ternary r854 r855 0field into r856; - add r851 r856 into r857; - mul r852 9field into r858; - sub r4 1u8 into r859; - lt 14u8 r859 into r860; - mul r2[14u32] r858 into r861; - ternary r860 r861 0field into r862; - add r857 r862 into r863; - cast r863 9field into r864 as Share; - cast r3[8u32] r864 1u64 into r865 as ValidatorShareData; - mul 1field 10field into r866; - sub r4 1u8 into r867; - lt 0u8 r867 into r868; - mul r2[0u32] r866 into r869; - ternary r868 r869 0field into r870; - add r0 r870 into r871; - mul r866 10field into r872; - sub r4 1u8 into r873; - lt 1u8 r873 into r874; - mul r2[1u32] r872 into r875; - ternary r874 r875 0field into r876; - add r871 r876 into r877; - mul r872 10field into r878; - sub r4 1u8 into r879; - lt 2u8 r879 into r880; - mul r2[2u32] r878 into r881; - ternary r880 r881 0field into r882; - add r877 r882 into r883; - mul r878 10field into r884; - sub r4 1u8 into r885; - lt 3u8 r885 into r886; - mul r2[3u32] r884 into r887; - ternary r886 r887 0field into r888; - add r883 r888 into r889; - mul r884 10field into r890; - sub r4 1u8 into r891; - lt 4u8 r891 into r892; - mul r2[4u32] r890 into r893; - ternary r892 r893 0field into r894; - add r889 r894 into r895; - mul r890 10field into r896; - sub r4 1u8 into r897; - lt 5u8 r897 into r898; - mul r2[5u32] r896 into r899; - ternary r898 r899 0field into r900; - add r895 r900 into r901; - mul r896 10field into r902; - sub r4 1u8 into r903; - lt 6u8 r903 into r904; - mul r2[6u32] r902 into r905; - ternary r904 r905 0field into r906; - add r901 r906 into r907; - mul r902 10field into r908; - sub r4 1u8 into r909; - lt 7u8 r909 into r910; - mul r2[7u32] r908 into r911; - ternary r910 r911 0field into r912; - add r907 r912 into r913; - mul r908 10field into r914; - sub r4 1u8 into r915; - lt 8u8 r915 into r916; - mul r2[8u32] r914 into r917; - ternary r916 r917 0field into r918; - add r913 r918 into r919; - mul r914 10field into r920; - sub r4 1u8 into r921; - lt 9u8 r921 into r922; - mul r2[9u32] r920 into r923; - ternary r922 r923 0field into r924; - add r919 r924 into r925; - mul r920 10field into r926; - sub r4 1u8 into r927; - lt 10u8 r927 into r928; - mul r2[10u32] r926 into r929; - ternary r928 r929 0field into r930; - add r925 r930 into r931; - mul r926 10field into r932; - sub r4 1u8 into r933; - lt 11u8 r933 into r934; - mul r2[11u32] r932 into r935; - ternary r934 r935 0field into r936; - add r931 r936 into r937; - mul r932 10field into r938; - sub r4 1u8 into r939; - lt 12u8 r939 into r940; - mul r2[12u32] r938 into r941; - ternary r940 r941 0field into r942; - add r937 r942 into r943; - mul r938 10field into r944; - sub r4 1u8 into r945; - lt 13u8 r945 into r946; - mul r2[13u32] r944 into r947; - ternary r946 r947 0field into r948; - add r943 r948 into r949; - mul r944 10field into r950; - sub r4 1u8 into r951; - lt 14u8 r951 into r952; - mul r2[14u32] r950 into r953; - ternary r952 r953 0field into r954; - add r949 r954 into r955; - cast r955 10field into r956 as Share; - cast r3[9u32] r956 1u64 into r957 as ValidatorShareData; - mul 1field 11field into r958; - sub r4 1u8 into r959; - lt 0u8 r959 into r960; - mul r2[0u32] r958 into r961; - ternary r960 r961 0field into r962; - add r0 r962 into r963; - mul r958 11field into r964; - sub r4 1u8 into r965; - lt 1u8 r965 into r966; - mul r2[1u32] r964 into r967; - ternary r966 r967 0field into r968; - add r963 r968 into r969; - mul r964 11field into r970; - sub r4 1u8 into r971; - lt 2u8 r971 into r972; - mul r2[2u32] r970 into r973; - ternary r972 r973 0field into r974; - add r969 r974 into r975; - mul r970 11field into r976; - sub r4 1u8 into r977; - lt 3u8 r977 into r978; - mul r2[3u32] r976 into r979; - ternary r978 r979 0field into r980; - add r975 r980 into r981; - mul r976 11field into r982; - sub r4 1u8 into r983; - lt 4u8 r983 into r984; - mul r2[4u32] r982 into r985; - ternary r984 r985 0field into r986; - add r981 r986 into r987; - mul r982 11field into r988; - sub r4 1u8 into r989; - lt 5u8 r989 into r990; - mul r2[5u32] r988 into r991; - ternary r990 r991 0field into r992; - add r987 r992 into r993; - mul r988 11field into r994; - sub r4 1u8 into r995; - lt 6u8 r995 into r996; - mul r2[6u32] r994 into r997; - ternary r996 r997 0field into r998; - add r993 r998 into r999; - mul r994 11field into r1000; - sub r4 1u8 into r1001; - lt 7u8 r1001 into r1002; - mul r2[7u32] r1000 into r1003; - ternary r1002 r1003 0field into r1004; - add r999 r1004 into r1005; - mul r1000 11field into r1006; - sub r4 1u8 into r1007; - lt 8u8 r1007 into r1008; - mul r2[8u32] r1006 into r1009; - ternary r1008 r1009 0field into r1010; - add r1005 r1010 into r1011; - mul r1006 11field into r1012; - sub r4 1u8 into r1013; - lt 9u8 r1013 into r1014; - mul r2[9u32] r1012 into r1015; - ternary r1014 r1015 0field into r1016; - add r1011 r1016 into r1017; - mul r1012 11field into r1018; - sub r4 1u8 into r1019; - lt 10u8 r1019 into r1020; - mul r2[10u32] r1018 into r1021; - ternary r1020 r1021 0field into r1022; - add r1017 r1022 into r1023; - mul r1018 11field into r1024; - sub r4 1u8 into r1025; - lt 11u8 r1025 into r1026; - mul r2[11u32] r1024 into r1027; - ternary r1026 r1027 0field into r1028; - add r1023 r1028 into r1029; - mul r1024 11field into r1030; - sub r4 1u8 into r1031; - lt 12u8 r1031 into r1032; - mul r2[12u32] r1030 into r1033; - ternary r1032 r1033 0field into r1034; - add r1029 r1034 into r1035; - mul r1030 11field into r1036; - sub r4 1u8 into r1037; - lt 13u8 r1037 into r1038; - mul r2[13u32] r1036 into r1039; - ternary r1038 r1039 0field into r1040; - add r1035 r1040 into r1041; - mul r1036 11field into r1042; - sub r4 1u8 into r1043; - lt 14u8 r1043 into r1044; - mul r2[14u32] r1042 into r1045; - ternary r1044 r1045 0field into r1046; - add r1041 r1046 into r1047; - cast r1047 11field into r1048 as Share; - cast r3[10u32] r1048 1u64 into r1049 as ValidatorShareData; - mul 1field 12field into r1050; - sub r4 1u8 into r1051; - lt 0u8 r1051 into r1052; - mul r2[0u32] r1050 into r1053; - ternary r1052 r1053 0field into r1054; - add r0 r1054 into r1055; - mul r1050 12field into r1056; - sub r4 1u8 into r1057; - lt 1u8 r1057 into r1058; - mul r2[1u32] r1056 into r1059; - ternary r1058 r1059 0field into r1060; - add r1055 r1060 into r1061; - mul r1056 12field into r1062; - sub r4 1u8 into r1063; - lt 2u8 r1063 into r1064; - mul r2[2u32] r1062 into r1065; - ternary r1064 r1065 0field into r1066; - add r1061 r1066 into r1067; - mul r1062 12field into r1068; - sub r4 1u8 into r1069; - lt 3u8 r1069 into r1070; - mul r2[3u32] r1068 into r1071; - ternary r1070 r1071 0field into r1072; - add r1067 r1072 into r1073; - mul r1068 12field into r1074; - sub r4 1u8 into r1075; - lt 4u8 r1075 into r1076; - mul r2[4u32] r1074 into r1077; - ternary r1076 r1077 0field into r1078; - add r1073 r1078 into r1079; - mul r1074 12field into r1080; - sub r4 1u8 into r1081; - lt 5u8 r1081 into r1082; - mul r2[5u32] r1080 into r1083; - ternary r1082 r1083 0field into r1084; - add r1079 r1084 into r1085; - mul r1080 12field into r1086; - sub r4 1u8 into r1087; - lt 6u8 r1087 into r1088; - mul r2[6u32] r1086 into r1089; - ternary r1088 r1089 0field into r1090; - add r1085 r1090 into r1091; - mul r1086 12field into r1092; - sub r4 1u8 into r1093; - lt 7u8 r1093 into r1094; - mul r2[7u32] r1092 into r1095; - ternary r1094 r1095 0field into r1096; - add r1091 r1096 into r1097; - mul r1092 12field into r1098; - sub r4 1u8 into r1099; - lt 8u8 r1099 into r1100; - mul r2[8u32] r1098 into r1101; - ternary r1100 r1101 0field into r1102; - add r1097 r1102 into r1103; - mul r1098 12field into r1104; - sub r4 1u8 into r1105; - lt 9u8 r1105 into r1106; - mul r2[9u32] r1104 into r1107; - ternary r1106 r1107 0field into r1108; - add r1103 r1108 into r1109; - mul r1104 12field into r1110; - sub r4 1u8 into r1111; - lt 10u8 r1111 into r1112; - mul r2[10u32] r1110 into r1113; - ternary r1112 r1113 0field into r1114; - add r1109 r1114 into r1115; - mul r1110 12field into r1116; - sub r4 1u8 into r1117; - lt 11u8 r1117 into r1118; - mul r2[11u32] r1116 into r1119; - ternary r1118 r1119 0field into r1120; - add r1115 r1120 into r1121; - mul r1116 12field into r1122; - sub r4 1u8 into r1123; - lt 12u8 r1123 into r1124; - mul r2[12u32] r1122 into r1125; - ternary r1124 r1125 0field into r1126; - add r1121 r1126 into r1127; - mul r1122 12field into r1128; - sub r4 1u8 into r1129; - lt 13u8 r1129 into r1130; - mul r2[13u32] r1128 into r1131; - ternary r1130 r1131 0field into r1132; - add r1127 r1132 into r1133; - mul r1128 12field into r1134; - sub r4 1u8 into r1135; - lt 14u8 r1135 into r1136; - mul r2[14u32] r1134 into r1137; - ternary r1136 r1137 0field into r1138; - add r1133 r1138 into r1139; - cast r1139 12field into r1140 as Share; - cast r3[11u32] r1140 1u64 into r1141 as ValidatorShareData; - mul 1field 13field into r1142; - sub r4 1u8 into r1143; - lt 0u8 r1143 into r1144; - mul r2[0u32] r1142 into r1145; - ternary r1144 r1145 0field into r1146; - add r0 r1146 into r1147; - mul r1142 13field into r1148; - sub r4 1u8 into r1149; - lt 1u8 r1149 into r1150; - mul r2[1u32] r1148 into r1151; - ternary r1150 r1151 0field into r1152; - add r1147 r1152 into r1153; - mul r1148 13field into r1154; - sub r4 1u8 into r1155; - lt 2u8 r1155 into r1156; - mul r2[2u32] r1154 into r1157; - ternary r1156 r1157 0field into r1158; - add r1153 r1158 into r1159; - mul r1154 13field into r1160; - sub r4 1u8 into r1161; - lt 3u8 r1161 into r1162; - mul r2[3u32] r1160 into r1163; - ternary r1162 r1163 0field into r1164; - add r1159 r1164 into r1165; - mul r1160 13field into r1166; - sub r4 1u8 into r1167; - lt 4u8 r1167 into r1168; - mul r2[4u32] r1166 into r1169; - ternary r1168 r1169 0field into r1170; - add r1165 r1170 into r1171; - mul r1166 13field into r1172; - sub r4 1u8 into r1173; - lt 5u8 r1173 into r1174; - mul r2[5u32] r1172 into r1175; - ternary r1174 r1175 0field into r1176; - add r1171 r1176 into r1177; - mul r1172 13field into r1178; - sub r4 1u8 into r1179; - lt 6u8 r1179 into r1180; - mul r2[6u32] r1178 into r1181; - ternary r1180 r1181 0field into r1182; - add r1177 r1182 into r1183; - mul r1178 13field into r1184; - sub r4 1u8 into r1185; - lt 7u8 r1185 into r1186; - mul r2[7u32] r1184 into r1187; - ternary r1186 r1187 0field into r1188; - add r1183 r1188 into r1189; - mul r1184 13field into r1190; - sub r4 1u8 into r1191; - lt 8u8 r1191 into r1192; - mul r2[8u32] r1190 into r1193; - ternary r1192 r1193 0field into r1194; - add r1189 r1194 into r1195; - mul r1190 13field into r1196; - sub r4 1u8 into r1197; - lt 9u8 r1197 into r1198; - mul r2[9u32] r1196 into r1199; - ternary r1198 r1199 0field into r1200; - add r1195 r1200 into r1201; - mul r1196 13field into r1202; - sub r4 1u8 into r1203; - lt 10u8 r1203 into r1204; - mul r2[10u32] r1202 into r1205; - ternary r1204 r1205 0field into r1206; - add r1201 r1206 into r1207; - mul r1202 13field into r1208; - sub r4 1u8 into r1209; - lt 11u8 r1209 into r1210; - mul r2[11u32] r1208 into r1211; - ternary r1210 r1211 0field into r1212; - add r1207 r1212 into r1213; - mul r1208 13field into r1214; - sub r4 1u8 into r1215; - lt 12u8 r1215 into r1216; - mul r2[12u32] r1214 into r1217; - ternary r1216 r1217 0field into r1218; - add r1213 r1218 into r1219; - mul r1214 13field into r1220; - sub r4 1u8 into r1221; - lt 13u8 r1221 into r1222; - mul r2[13u32] r1220 into r1223; - ternary r1222 r1223 0field into r1224; - add r1219 r1224 into r1225; - mul r1220 13field into r1226; - sub r4 1u8 into r1227; - lt 14u8 r1227 into r1228; - mul r2[14u32] r1226 into r1229; - ternary r1228 r1229 0field into r1230; - add r1225 r1230 into r1231; - cast r1231 13field into r1232 as Share; - cast r3[12u32] r1232 1u64 into r1233 as ValidatorShareData; - mul 1field 14field into r1234; - sub r4 1u8 into r1235; - lt 0u8 r1235 into r1236; - mul r2[0u32] r1234 into r1237; - ternary r1236 r1237 0field into r1238; - add r0 r1238 into r1239; - mul r1234 14field into r1240; - sub r4 1u8 into r1241; - lt 1u8 r1241 into r1242; - mul r2[1u32] r1240 into r1243; - ternary r1242 r1243 0field into r1244; - add r1239 r1244 into r1245; - mul r1240 14field into r1246; - sub r4 1u8 into r1247; - lt 2u8 r1247 into r1248; - mul r2[2u32] r1246 into r1249; - ternary r1248 r1249 0field into r1250; - add r1245 r1250 into r1251; - mul r1246 14field into r1252; - sub r4 1u8 into r1253; - lt 3u8 r1253 into r1254; - mul r2[3u32] r1252 into r1255; - ternary r1254 r1255 0field into r1256; - add r1251 r1256 into r1257; - mul r1252 14field into r1258; - sub r4 1u8 into r1259; - lt 4u8 r1259 into r1260; - mul r2[4u32] r1258 into r1261; - ternary r1260 r1261 0field into r1262; - add r1257 r1262 into r1263; - mul r1258 14field into r1264; - sub r4 1u8 into r1265; - lt 5u8 r1265 into r1266; - mul r2[5u32] r1264 into r1267; - ternary r1266 r1267 0field into r1268; - add r1263 r1268 into r1269; - mul r1264 14field into r1270; - sub r4 1u8 into r1271; - lt 6u8 r1271 into r1272; - mul r2[6u32] r1270 into r1273; - ternary r1272 r1273 0field into r1274; - add r1269 r1274 into r1275; - mul r1270 14field into r1276; - sub r4 1u8 into r1277; - lt 7u8 r1277 into r1278; - mul r2[7u32] r1276 into r1279; - ternary r1278 r1279 0field into r1280; - add r1275 r1280 into r1281; - mul r1276 14field into r1282; - sub r4 1u8 into r1283; - lt 8u8 r1283 into r1284; - mul r2[8u32] r1282 into r1285; - ternary r1284 r1285 0field into r1286; - add r1281 r1286 into r1287; - mul r1282 14field into r1288; - sub r4 1u8 into r1289; - lt 9u8 r1289 into r1290; - mul r2[9u32] r1288 into r1291; - ternary r1290 r1291 0field into r1292; - add r1287 r1292 into r1293; - mul r1288 14field into r1294; - sub r4 1u8 into r1295; - lt 10u8 r1295 into r1296; - mul r2[10u32] r1294 into r1297; - ternary r1296 r1297 0field into r1298; - add r1293 r1298 into r1299; - mul r1294 14field into r1300; - sub r4 1u8 into r1301; - lt 11u8 r1301 into r1302; - mul r2[11u32] r1300 into r1303; - ternary r1302 r1303 0field into r1304; - add r1299 r1304 into r1305; - mul r1300 14field into r1306; - sub r4 1u8 into r1307; - lt 12u8 r1307 into r1308; - mul r2[12u32] r1306 into r1309; - ternary r1308 r1309 0field into r1310; - add r1305 r1310 into r1311; - mul r1306 14field into r1312; - sub r4 1u8 into r1313; - lt 13u8 r1313 into r1314; - mul r2[13u32] r1312 into r1315; - ternary r1314 r1315 0field into r1316; - add r1311 r1316 into r1317; - mul r1312 14field into r1318; - sub r4 1u8 into r1319; - lt 14u8 r1319 into r1320; - mul r2[14u32] r1318 into r1321; - ternary r1320 r1321 0field into r1322; - add r1317 r1322 into r1323; - cast r1323 14field into r1324 as Share; - cast r3[13u32] r1324 1u64 into r1325 as ValidatorShareData; - mul 1field 15field into r1326; - sub r4 1u8 into r1327; - lt 0u8 r1327 into r1328; - mul r2[0u32] r1326 into r1329; - ternary r1328 r1329 0field into r1330; - add r0 r1330 into r1331; - mul r1326 15field into r1332; - sub r4 1u8 into r1333; - lt 1u8 r1333 into r1334; - mul r2[1u32] r1332 into r1335; - ternary r1334 r1335 0field into r1336; - add r1331 r1336 into r1337; - mul r1332 15field into r1338; - sub r4 1u8 into r1339; - lt 2u8 r1339 into r1340; - mul r2[2u32] r1338 into r1341; - ternary r1340 r1341 0field into r1342; - add r1337 r1342 into r1343; - mul r1338 15field into r1344; - sub r4 1u8 into r1345; - lt 3u8 r1345 into r1346; - mul r2[3u32] r1344 into r1347; - ternary r1346 r1347 0field into r1348; - add r1343 r1348 into r1349; - mul r1344 15field into r1350; - sub r4 1u8 into r1351; - lt 4u8 r1351 into r1352; - mul r2[4u32] r1350 into r1353; - ternary r1352 r1353 0field into r1354; - add r1349 r1354 into r1355; - mul r1350 15field into r1356; - sub r4 1u8 into r1357; - lt 5u8 r1357 into r1358; - mul r2[5u32] r1356 into r1359; - ternary r1358 r1359 0field into r1360; - add r1355 r1360 into r1361; - mul r1356 15field into r1362; - sub r4 1u8 into r1363; - lt 6u8 r1363 into r1364; - mul r2[6u32] r1362 into r1365; - ternary r1364 r1365 0field into r1366; - add r1361 r1366 into r1367; - mul r1362 15field into r1368; - sub r4 1u8 into r1369; - lt 7u8 r1369 into r1370; - mul r2[7u32] r1368 into r1371; - ternary r1370 r1371 0field into r1372; - add r1367 r1372 into r1373; - mul r1368 15field into r1374; - sub r4 1u8 into r1375; - lt 8u8 r1375 into r1376; - mul r2[8u32] r1374 into r1377; - ternary r1376 r1377 0field into r1378; - add r1373 r1378 into r1379; - mul r1374 15field into r1380; - sub r4 1u8 into r1381; - lt 9u8 r1381 into r1382; - mul r2[9u32] r1380 into r1383; - ternary r1382 r1383 0field into r1384; - add r1379 r1384 into r1385; - mul r1380 15field into r1386; - sub r4 1u8 into r1387; - lt 10u8 r1387 into r1388; - mul r2[10u32] r1386 into r1389; - ternary r1388 r1389 0field into r1390; - add r1385 r1390 into r1391; - mul r1386 15field into r1392; - sub r4 1u8 into r1393; - lt 11u8 r1393 into r1394; - mul r2[11u32] r1392 into r1395; - ternary r1394 r1395 0field into r1396; - add r1391 r1396 into r1397; - mul r1392 15field into r1398; - sub r4 1u8 into r1399; - lt 12u8 r1399 into r1400; - mul r2[12u32] r1398 into r1401; - ternary r1400 r1401 0field into r1402; - add r1397 r1402 into r1403; - mul r1398 15field into r1404; - sub r4 1u8 into r1405; - lt 13u8 r1405 into r1406; - mul r2[13u32] r1404 into r1407; - ternary r1406 r1407 0field into r1408; - add r1403 r1408 into r1409; - mul r1404 15field into r1410; - sub r4 1u8 into r1411; - lt 14u8 r1411 into r1412; - mul r2[14u32] r1410 into r1413; - ternary r1412 r1413 0field into r1414; - add r1409 r1414 into r1415; - cast r1415 15field into r1416 as Share; - cast r3[14u32] r1416 1u64 into r1417 as ValidatorShareData; - mul 1field 16field into r1418; - sub r4 1u8 into r1419; - lt 0u8 r1419 into r1420; - mul r2[0u32] r1418 into r1421; - ternary r1420 r1421 0field into r1422; - add r0 r1422 into r1423; - mul r1418 16field into r1424; - sub r4 1u8 into r1425; - lt 1u8 r1425 into r1426; - mul r2[1u32] r1424 into r1427; - ternary r1426 r1427 0field into r1428; - add r1423 r1428 into r1429; - mul r1424 16field into r1430; - sub r4 1u8 into r1431; - lt 2u8 r1431 into r1432; - mul r2[2u32] r1430 into r1433; - ternary r1432 r1433 0field into r1434; - add r1429 r1434 into r1435; - mul r1430 16field into r1436; - sub r4 1u8 into r1437; - lt 3u8 r1437 into r1438; - mul r2[3u32] r1436 into r1439; - ternary r1438 r1439 0field into r1440; - add r1435 r1440 into r1441; - mul r1436 16field into r1442; - sub r4 1u8 into r1443; - lt 4u8 r1443 into r1444; - mul r2[4u32] r1442 into r1445; - ternary r1444 r1445 0field into r1446; - add r1441 r1446 into r1447; - mul r1442 16field into r1448; - sub r4 1u8 into r1449; - lt 5u8 r1449 into r1450; - mul r2[5u32] r1448 into r1451; - ternary r1450 r1451 0field into r1452; - add r1447 r1452 into r1453; - mul r1448 16field into r1454; - sub r4 1u8 into r1455; - lt 6u8 r1455 into r1456; - mul r2[6u32] r1454 into r1457; - ternary r1456 r1457 0field into r1458; - add r1453 r1458 into r1459; - mul r1454 16field into r1460; - sub r4 1u8 into r1461; - lt 7u8 r1461 into r1462; - mul r2[7u32] r1460 into r1463; - ternary r1462 r1463 0field into r1464; - add r1459 r1464 into r1465; - mul r1460 16field into r1466; - sub r4 1u8 into r1467; - lt 8u8 r1467 into r1468; - mul r2[8u32] r1466 into r1469; - ternary r1468 r1469 0field into r1470; - add r1465 r1470 into r1471; - mul r1466 16field into r1472; - sub r4 1u8 into r1473; - lt 9u8 r1473 into r1474; - mul r2[9u32] r1472 into r1475; - ternary r1474 r1475 0field into r1476; - add r1471 r1476 into r1477; - mul r1472 16field into r1478; - sub r4 1u8 into r1479; - lt 10u8 r1479 into r1480; - mul r2[10u32] r1478 into r1481; - ternary r1480 r1481 0field into r1482; - add r1477 r1482 into r1483; - mul r1478 16field into r1484; - sub r4 1u8 into r1485; - lt 11u8 r1485 into r1486; - mul r2[11u32] r1484 into r1487; - ternary r1486 r1487 0field into r1488; - add r1483 r1488 into r1489; - mul r1484 16field into r1490; - sub r4 1u8 into r1491; - lt 12u8 r1491 into r1492; - mul r2[12u32] r1490 into r1493; - ternary r1492 r1493 0field into r1494; - add r1489 r1494 into r1495; - mul r1490 16field into r1496; - sub r4 1u8 into r1497; - lt 13u8 r1497 into r1498; - mul r2[13u32] r1496 into r1499; - ternary r1498 r1499 0field into r1500; - add r1495 r1500 into r1501; - mul r1496 16field into r1502; - sub r4 1u8 into r1503; - lt 14u8 r1503 into r1504; - mul r2[14u32] r1502 into r1505; - ternary r1504 r1505 0field into r1506; - add r1501 r1506 into r1507; - cast r1507 16field into r1508 as Share; - cast r3[15u32] r1508 1u64 into r1509 as ValidatorShareData; - cast r129 r221 r313 r405 r497 r589 r681 r773 r865 r957 r1049 r1141 r1233 r1325 r1417 r1509 into r1510 as [ValidatorShareData; 16u32]; - call dcp_validator_shares.aleo/submit_shares_to_validators r1510 r36 into r1511 r1512 r1513 r1514 r1515 r1516 r1517 r1518 r1519 r1520 r1521 r1522 r1523 r1524 r1525 r1526; - call dcp_core_protocol.aleo/custody_data_as_program r37 r3 into r1527; - async custody_data_as_program r1527 into r1528; - output r1528 as data_custody_protocol.aleo/custody_data_as_program.future; + input r5 as scalar.private; + is.eq r2[0u32] 0field into r6; + or false r6 into r7; + is.eq r2[1u32] 0field into r8; + or r7 r8 into r9; + is.eq r2[2u32] 0field into r10; + or r9 r10 into r11; + is.eq r2[3u32] 0field into r12; + or r11 r12 into r13; + is.eq r2[4u32] 0field into r14; + or r13 r14 into r15; + is.eq r2[5u32] 0field into r16; + or r15 r16 into r17; + is.eq r2[6u32] 0field into r18; + or r17 r18 into r19; + is.eq r2[7u32] 0field into r20; + or r19 r20 into r21; + is.eq r2[8u32] 0field into r22; + or r21 r22 into r23; + is.eq r2[9u32] 0field into r24; + or r23 r24 into r25; + is.eq r2[10u32] 0field into r26; + or r25 r26 into r27; + is.eq r2[11u32] 0field into r28; + or r27 r28 into r29; + is.eq r2[12u32] 0field into r30; + or r29 r30 into r31; + is.eq r2[13u32] 0field into r32; + or r31 r32 into r33; + is.eq r2[14u32] 0field into r34; + or r33 r34 into r35; + not r35 into r36; + assert.eq r36 true; + cast true r0 true into r37 as Operation; + hash.bhp256 r37 into r38 as field; + commit.bhp256 r38 r5 into r39 as field; + cast self.caller r1 r4 into r40 as Custody; + hash.bhp256 r40 into r41 as field; + mul 1field 1field into r42; + sub r4 1u8 into r43; + lt 0u8 r43 into r44; + mul r2[0u32] r42 into r45; + ternary r44 r45 0field into r46; + add r0 r46 into r47; + mul r42 1field into r48; + sub r4 1u8 into r49; + lt 1u8 r49 into r50; + mul r2[1u32] r48 into r51; + ternary r50 r51 0field into r52; + add r47 r52 into r53; + mul r48 1field into r54; + sub r4 1u8 into r55; + lt 2u8 r55 into r56; + mul r2[2u32] r54 into r57; + ternary r56 r57 0field into r58; + add r53 r58 into r59; + mul r54 1field into r60; + sub r4 1u8 into r61; + lt 3u8 r61 into r62; + mul r2[3u32] r60 into r63; + ternary r62 r63 0field into r64; + add r59 r64 into r65; + mul r60 1field into r66; + sub r4 1u8 into r67; + lt 4u8 r67 into r68; + mul r2[4u32] r66 into r69; + ternary r68 r69 0field into r70; + add r65 r70 into r71; + mul r66 1field into r72; + sub r4 1u8 into r73; + lt 5u8 r73 into r74; + mul r2[5u32] r72 into r75; + ternary r74 r75 0field into r76; + add r71 r76 into r77; + mul r72 1field into r78; + sub r4 1u8 into r79; + lt 6u8 r79 into r80; + mul r2[6u32] r78 into r81; + ternary r80 r81 0field into r82; + add r77 r82 into r83; + mul r78 1field into r84; + sub r4 1u8 into r85; + lt 7u8 r85 into r86; + mul r2[7u32] r84 into r87; + ternary r86 r87 0field into r88; + add r83 r88 into r89; + mul r84 1field into r90; + sub r4 1u8 into r91; + lt 8u8 r91 into r92; + mul r2[8u32] r90 into r93; + ternary r92 r93 0field into r94; + add r89 r94 into r95; + mul r90 1field into r96; + sub r4 1u8 into r97; + lt 9u8 r97 into r98; + mul r2[9u32] r96 into r99; + ternary r98 r99 0field into r100; + add r95 r100 into r101; + mul r96 1field into r102; + sub r4 1u8 into r103; + lt 10u8 r103 into r104; + mul r2[10u32] r102 into r105; + ternary r104 r105 0field into r106; + add r101 r106 into r107; + mul r102 1field into r108; + sub r4 1u8 into r109; + lt 11u8 r109 into r110; + mul r2[11u32] r108 into r111; + ternary r110 r111 0field into r112; + add r107 r112 into r113; + mul r108 1field into r114; + sub r4 1u8 into r115; + lt 12u8 r115 into r116; + mul r2[12u32] r114 into r117; + ternary r116 r117 0field into r118; + add r113 r118 into r119; + mul r114 1field into r120; + sub r4 1u8 into r121; + lt 13u8 r121 into r122; + mul r2[13u32] r120 into r123; + ternary r122 r123 0field into r124; + add r119 r124 into r125; + mul r120 1field into r126; + sub r4 1u8 into r127; + lt 14u8 r127 into r128; + mul r2[14u32] r126 into r129; + ternary r128 r129 0field into r130; + add r125 r130 into r131; + cast r131 1field into r132 as Share; + cast r3[0u32] r132 into r133 as ValidatorShareData; + mul 1field 2field into r134; + sub r4 1u8 into r135; + lt 0u8 r135 into r136; + mul r2[0u32] r134 into r137; + ternary r136 r137 0field into r138; + add r0 r138 into r139; + mul r134 2field into r140; + sub r4 1u8 into r141; + lt 1u8 r141 into r142; + mul r2[1u32] r140 into r143; + ternary r142 r143 0field into r144; + add r139 r144 into r145; + mul r140 2field into r146; + sub r4 1u8 into r147; + lt 2u8 r147 into r148; + mul r2[2u32] r146 into r149; + ternary r148 r149 0field into r150; + add r145 r150 into r151; + mul r146 2field into r152; + sub r4 1u8 into r153; + lt 3u8 r153 into r154; + mul r2[3u32] r152 into r155; + ternary r154 r155 0field into r156; + add r151 r156 into r157; + mul r152 2field into r158; + sub r4 1u8 into r159; + lt 4u8 r159 into r160; + mul r2[4u32] r158 into r161; + ternary r160 r161 0field into r162; + add r157 r162 into r163; + mul r158 2field into r164; + sub r4 1u8 into r165; + lt 5u8 r165 into r166; + mul r2[5u32] r164 into r167; + ternary r166 r167 0field into r168; + add r163 r168 into r169; + mul r164 2field into r170; + sub r4 1u8 into r171; + lt 6u8 r171 into r172; + mul r2[6u32] r170 into r173; + ternary r172 r173 0field into r174; + add r169 r174 into r175; + mul r170 2field into r176; + sub r4 1u8 into r177; + lt 7u8 r177 into r178; + mul r2[7u32] r176 into r179; + ternary r178 r179 0field into r180; + add r175 r180 into r181; + mul r176 2field into r182; + sub r4 1u8 into r183; + lt 8u8 r183 into r184; + mul r2[8u32] r182 into r185; + ternary r184 r185 0field into r186; + add r181 r186 into r187; + mul r182 2field into r188; + sub r4 1u8 into r189; + lt 9u8 r189 into r190; + mul r2[9u32] r188 into r191; + ternary r190 r191 0field into r192; + add r187 r192 into r193; + mul r188 2field into r194; + sub r4 1u8 into r195; + lt 10u8 r195 into r196; + mul r2[10u32] r194 into r197; + ternary r196 r197 0field into r198; + add r193 r198 into r199; + mul r194 2field into r200; + sub r4 1u8 into r201; + lt 11u8 r201 into r202; + mul r2[11u32] r200 into r203; + ternary r202 r203 0field into r204; + add r199 r204 into r205; + mul r200 2field into r206; + sub r4 1u8 into r207; + lt 12u8 r207 into r208; + mul r2[12u32] r206 into r209; + ternary r208 r209 0field into r210; + add r205 r210 into r211; + mul r206 2field into r212; + sub r4 1u8 into r213; + lt 13u8 r213 into r214; + mul r2[13u32] r212 into r215; + ternary r214 r215 0field into r216; + add r211 r216 into r217; + mul r212 2field into r218; + sub r4 1u8 into r219; + lt 14u8 r219 into r220; + mul r2[14u32] r218 into r221; + ternary r220 r221 0field into r222; + add r217 r222 into r223; + cast r223 2field into r224 as Share; + cast r3[1u32] r224 into r225 as ValidatorShareData; + mul 1field 3field into r226; + sub r4 1u8 into r227; + lt 0u8 r227 into r228; + mul r2[0u32] r226 into r229; + ternary r228 r229 0field into r230; + add r0 r230 into r231; + mul r226 3field into r232; + sub r4 1u8 into r233; + lt 1u8 r233 into r234; + mul r2[1u32] r232 into r235; + ternary r234 r235 0field into r236; + add r231 r236 into r237; + mul r232 3field into r238; + sub r4 1u8 into r239; + lt 2u8 r239 into r240; + mul r2[2u32] r238 into r241; + ternary r240 r241 0field into r242; + add r237 r242 into r243; + mul r238 3field into r244; + sub r4 1u8 into r245; + lt 3u8 r245 into r246; + mul r2[3u32] r244 into r247; + ternary r246 r247 0field into r248; + add r243 r248 into r249; + mul r244 3field into r250; + sub r4 1u8 into r251; + lt 4u8 r251 into r252; + mul r2[4u32] r250 into r253; + ternary r252 r253 0field into r254; + add r249 r254 into r255; + mul r250 3field into r256; + sub r4 1u8 into r257; + lt 5u8 r257 into r258; + mul r2[5u32] r256 into r259; + ternary r258 r259 0field into r260; + add r255 r260 into r261; + mul r256 3field into r262; + sub r4 1u8 into r263; + lt 6u8 r263 into r264; + mul r2[6u32] r262 into r265; + ternary r264 r265 0field into r266; + add r261 r266 into r267; + mul r262 3field into r268; + sub r4 1u8 into r269; + lt 7u8 r269 into r270; + mul r2[7u32] r268 into r271; + ternary r270 r271 0field into r272; + add r267 r272 into r273; + mul r268 3field into r274; + sub r4 1u8 into r275; + lt 8u8 r275 into r276; + mul r2[8u32] r274 into r277; + ternary r276 r277 0field into r278; + add r273 r278 into r279; + mul r274 3field into r280; + sub r4 1u8 into r281; + lt 9u8 r281 into r282; + mul r2[9u32] r280 into r283; + ternary r282 r283 0field into r284; + add r279 r284 into r285; + mul r280 3field into r286; + sub r4 1u8 into r287; + lt 10u8 r287 into r288; + mul r2[10u32] r286 into r289; + ternary r288 r289 0field into r290; + add r285 r290 into r291; + mul r286 3field into r292; + sub r4 1u8 into r293; + lt 11u8 r293 into r294; + mul r2[11u32] r292 into r295; + ternary r294 r295 0field into r296; + add r291 r296 into r297; + mul r292 3field into r298; + sub r4 1u8 into r299; + lt 12u8 r299 into r300; + mul r2[12u32] r298 into r301; + ternary r300 r301 0field into r302; + add r297 r302 into r303; + mul r298 3field into r304; + sub r4 1u8 into r305; + lt 13u8 r305 into r306; + mul r2[13u32] r304 into r307; + ternary r306 r307 0field into r308; + add r303 r308 into r309; + mul r304 3field into r310; + sub r4 1u8 into r311; + lt 14u8 r311 into r312; + mul r2[14u32] r310 into r313; + ternary r312 r313 0field into r314; + add r309 r314 into r315; + cast r315 3field into r316 as Share; + cast r3[2u32] r316 into r317 as ValidatorShareData; + mul 1field 4field into r318; + sub r4 1u8 into r319; + lt 0u8 r319 into r320; + mul r2[0u32] r318 into r321; + ternary r320 r321 0field into r322; + add r0 r322 into r323; + mul r318 4field into r324; + sub r4 1u8 into r325; + lt 1u8 r325 into r326; + mul r2[1u32] r324 into r327; + ternary r326 r327 0field into r328; + add r323 r328 into r329; + mul r324 4field into r330; + sub r4 1u8 into r331; + lt 2u8 r331 into r332; + mul r2[2u32] r330 into r333; + ternary r332 r333 0field into r334; + add r329 r334 into r335; + mul r330 4field into r336; + sub r4 1u8 into r337; + lt 3u8 r337 into r338; + mul r2[3u32] r336 into r339; + ternary r338 r339 0field into r340; + add r335 r340 into r341; + mul r336 4field into r342; + sub r4 1u8 into r343; + lt 4u8 r343 into r344; + mul r2[4u32] r342 into r345; + ternary r344 r345 0field into r346; + add r341 r346 into r347; + mul r342 4field into r348; + sub r4 1u8 into r349; + lt 5u8 r349 into r350; + mul r2[5u32] r348 into r351; + ternary r350 r351 0field into r352; + add r347 r352 into r353; + mul r348 4field into r354; + sub r4 1u8 into r355; + lt 6u8 r355 into r356; + mul r2[6u32] r354 into r357; + ternary r356 r357 0field into r358; + add r353 r358 into r359; + mul r354 4field into r360; + sub r4 1u8 into r361; + lt 7u8 r361 into r362; + mul r2[7u32] r360 into r363; + ternary r362 r363 0field into r364; + add r359 r364 into r365; + mul r360 4field into r366; + sub r4 1u8 into r367; + lt 8u8 r367 into r368; + mul r2[8u32] r366 into r369; + ternary r368 r369 0field into r370; + add r365 r370 into r371; + mul r366 4field into r372; + sub r4 1u8 into r373; + lt 9u8 r373 into r374; + mul r2[9u32] r372 into r375; + ternary r374 r375 0field into r376; + add r371 r376 into r377; + mul r372 4field into r378; + sub r4 1u8 into r379; + lt 10u8 r379 into r380; + mul r2[10u32] r378 into r381; + ternary r380 r381 0field into r382; + add r377 r382 into r383; + mul r378 4field into r384; + sub r4 1u8 into r385; + lt 11u8 r385 into r386; + mul r2[11u32] r384 into r387; + ternary r386 r387 0field into r388; + add r383 r388 into r389; + mul r384 4field into r390; + sub r4 1u8 into r391; + lt 12u8 r391 into r392; + mul r2[12u32] r390 into r393; + ternary r392 r393 0field into r394; + add r389 r394 into r395; + mul r390 4field into r396; + sub r4 1u8 into r397; + lt 13u8 r397 into r398; + mul r2[13u32] r396 into r399; + ternary r398 r399 0field into r400; + add r395 r400 into r401; + mul r396 4field into r402; + sub r4 1u8 into r403; + lt 14u8 r403 into r404; + mul r2[14u32] r402 into r405; + ternary r404 r405 0field into r406; + add r401 r406 into r407; + cast r407 4field into r408 as Share; + cast r3[3u32] r408 into r409 as ValidatorShareData; + mul 1field 5field into r410; + sub r4 1u8 into r411; + lt 0u8 r411 into r412; + mul r2[0u32] r410 into r413; + ternary r412 r413 0field into r414; + add r0 r414 into r415; + mul r410 5field into r416; + sub r4 1u8 into r417; + lt 1u8 r417 into r418; + mul r2[1u32] r416 into r419; + ternary r418 r419 0field into r420; + add r415 r420 into r421; + mul r416 5field into r422; + sub r4 1u8 into r423; + lt 2u8 r423 into r424; + mul r2[2u32] r422 into r425; + ternary r424 r425 0field into r426; + add r421 r426 into r427; + mul r422 5field into r428; + sub r4 1u8 into r429; + lt 3u8 r429 into r430; + mul r2[3u32] r428 into r431; + ternary r430 r431 0field into r432; + add r427 r432 into r433; + mul r428 5field into r434; + sub r4 1u8 into r435; + lt 4u8 r435 into r436; + mul r2[4u32] r434 into r437; + ternary r436 r437 0field into r438; + add r433 r438 into r439; + mul r434 5field into r440; + sub r4 1u8 into r441; + lt 5u8 r441 into r442; + mul r2[5u32] r440 into r443; + ternary r442 r443 0field into r444; + add r439 r444 into r445; + mul r440 5field into r446; + sub r4 1u8 into r447; + lt 6u8 r447 into r448; + mul r2[6u32] r446 into r449; + ternary r448 r449 0field into r450; + add r445 r450 into r451; + mul r446 5field into r452; + sub r4 1u8 into r453; + lt 7u8 r453 into r454; + mul r2[7u32] r452 into r455; + ternary r454 r455 0field into r456; + add r451 r456 into r457; + mul r452 5field into r458; + sub r4 1u8 into r459; + lt 8u8 r459 into r460; + mul r2[8u32] r458 into r461; + ternary r460 r461 0field into r462; + add r457 r462 into r463; + mul r458 5field into r464; + sub r4 1u8 into r465; + lt 9u8 r465 into r466; + mul r2[9u32] r464 into r467; + ternary r466 r467 0field into r468; + add r463 r468 into r469; + mul r464 5field into r470; + sub r4 1u8 into r471; + lt 10u8 r471 into r472; + mul r2[10u32] r470 into r473; + ternary r472 r473 0field into r474; + add r469 r474 into r475; + mul r470 5field into r476; + sub r4 1u8 into r477; + lt 11u8 r477 into r478; + mul r2[11u32] r476 into r479; + ternary r478 r479 0field into r480; + add r475 r480 into r481; + mul r476 5field into r482; + sub r4 1u8 into r483; + lt 12u8 r483 into r484; + mul r2[12u32] r482 into r485; + ternary r484 r485 0field into r486; + add r481 r486 into r487; + mul r482 5field into r488; + sub r4 1u8 into r489; + lt 13u8 r489 into r490; + mul r2[13u32] r488 into r491; + ternary r490 r491 0field into r492; + add r487 r492 into r493; + mul r488 5field into r494; + sub r4 1u8 into r495; + lt 14u8 r495 into r496; + mul r2[14u32] r494 into r497; + ternary r496 r497 0field into r498; + add r493 r498 into r499; + cast r499 5field into r500 as Share; + cast r3[4u32] r500 into r501 as ValidatorShareData; + mul 1field 6field into r502; + sub r4 1u8 into r503; + lt 0u8 r503 into r504; + mul r2[0u32] r502 into r505; + ternary r504 r505 0field into r506; + add r0 r506 into r507; + mul r502 6field into r508; + sub r4 1u8 into r509; + lt 1u8 r509 into r510; + mul r2[1u32] r508 into r511; + ternary r510 r511 0field into r512; + add r507 r512 into r513; + mul r508 6field into r514; + sub r4 1u8 into r515; + lt 2u8 r515 into r516; + mul r2[2u32] r514 into r517; + ternary r516 r517 0field into r518; + add r513 r518 into r519; + mul r514 6field into r520; + sub r4 1u8 into r521; + lt 3u8 r521 into r522; + mul r2[3u32] r520 into r523; + ternary r522 r523 0field into r524; + add r519 r524 into r525; + mul r520 6field into r526; + sub r4 1u8 into r527; + lt 4u8 r527 into r528; + mul r2[4u32] r526 into r529; + ternary r528 r529 0field into r530; + add r525 r530 into r531; + mul r526 6field into r532; + sub r4 1u8 into r533; + lt 5u8 r533 into r534; + mul r2[5u32] r532 into r535; + ternary r534 r535 0field into r536; + add r531 r536 into r537; + mul r532 6field into r538; + sub r4 1u8 into r539; + lt 6u8 r539 into r540; + mul r2[6u32] r538 into r541; + ternary r540 r541 0field into r542; + add r537 r542 into r543; + mul r538 6field into r544; + sub r4 1u8 into r545; + lt 7u8 r545 into r546; + mul r2[7u32] r544 into r547; + ternary r546 r547 0field into r548; + add r543 r548 into r549; + mul r544 6field into r550; + sub r4 1u8 into r551; + lt 8u8 r551 into r552; + mul r2[8u32] r550 into r553; + ternary r552 r553 0field into r554; + add r549 r554 into r555; + mul r550 6field into r556; + sub r4 1u8 into r557; + lt 9u8 r557 into r558; + mul r2[9u32] r556 into r559; + ternary r558 r559 0field into r560; + add r555 r560 into r561; + mul r556 6field into r562; + sub r4 1u8 into r563; + lt 10u8 r563 into r564; + mul r2[10u32] r562 into r565; + ternary r564 r565 0field into r566; + add r561 r566 into r567; + mul r562 6field into r568; + sub r4 1u8 into r569; + lt 11u8 r569 into r570; + mul r2[11u32] r568 into r571; + ternary r570 r571 0field into r572; + add r567 r572 into r573; + mul r568 6field into r574; + sub r4 1u8 into r575; + lt 12u8 r575 into r576; + mul r2[12u32] r574 into r577; + ternary r576 r577 0field into r578; + add r573 r578 into r579; + mul r574 6field into r580; + sub r4 1u8 into r581; + lt 13u8 r581 into r582; + mul r2[13u32] r580 into r583; + ternary r582 r583 0field into r584; + add r579 r584 into r585; + mul r580 6field into r586; + sub r4 1u8 into r587; + lt 14u8 r587 into r588; + mul r2[14u32] r586 into r589; + ternary r588 r589 0field into r590; + add r585 r590 into r591; + cast r591 6field into r592 as Share; + cast r3[5u32] r592 into r593 as ValidatorShareData; + mul 1field 7field into r594; + sub r4 1u8 into r595; + lt 0u8 r595 into r596; + mul r2[0u32] r594 into r597; + ternary r596 r597 0field into r598; + add r0 r598 into r599; + mul r594 7field into r600; + sub r4 1u8 into r601; + lt 1u8 r601 into r602; + mul r2[1u32] r600 into r603; + ternary r602 r603 0field into r604; + add r599 r604 into r605; + mul r600 7field into r606; + sub r4 1u8 into r607; + lt 2u8 r607 into r608; + mul r2[2u32] r606 into r609; + ternary r608 r609 0field into r610; + add r605 r610 into r611; + mul r606 7field into r612; + sub r4 1u8 into r613; + lt 3u8 r613 into r614; + mul r2[3u32] r612 into r615; + ternary r614 r615 0field into r616; + add r611 r616 into r617; + mul r612 7field into r618; + sub r4 1u8 into r619; + lt 4u8 r619 into r620; + mul r2[4u32] r618 into r621; + ternary r620 r621 0field into r622; + add r617 r622 into r623; + mul r618 7field into r624; + sub r4 1u8 into r625; + lt 5u8 r625 into r626; + mul r2[5u32] r624 into r627; + ternary r626 r627 0field into r628; + add r623 r628 into r629; + mul r624 7field into r630; + sub r4 1u8 into r631; + lt 6u8 r631 into r632; + mul r2[6u32] r630 into r633; + ternary r632 r633 0field into r634; + add r629 r634 into r635; + mul r630 7field into r636; + sub r4 1u8 into r637; + lt 7u8 r637 into r638; + mul r2[7u32] r636 into r639; + ternary r638 r639 0field into r640; + add r635 r640 into r641; + mul r636 7field into r642; + sub r4 1u8 into r643; + lt 8u8 r643 into r644; + mul r2[8u32] r642 into r645; + ternary r644 r645 0field into r646; + add r641 r646 into r647; + mul r642 7field into r648; + sub r4 1u8 into r649; + lt 9u8 r649 into r650; + mul r2[9u32] r648 into r651; + ternary r650 r651 0field into r652; + add r647 r652 into r653; + mul r648 7field into r654; + sub r4 1u8 into r655; + lt 10u8 r655 into r656; + mul r2[10u32] r654 into r657; + ternary r656 r657 0field into r658; + add r653 r658 into r659; + mul r654 7field into r660; + sub r4 1u8 into r661; + lt 11u8 r661 into r662; + mul r2[11u32] r660 into r663; + ternary r662 r663 0field into r664; + add r659 r664 into r665; + mul r660 7field into r666; + sub r4 1u8 into r667; + lt 12u8 r667 into r668; + mul r2[12u32] r666 into r669; + ternary r668 r669 0field into r670; + add r665 r670 into r671; + mul r666 7field into r672; + sub r4 1u8 into r673; + lt 13u8 r673 into r674; + mul r2[13u32] r672 into r675; + ternary r674 r675 0field into r676; + add r671 r676 into r677; + mul r672 7field into r678; + sub r4 1u8 into r679; + lt 14u8 r679 into r680; + mul r2[14u32] r678 into r681; + ternary r680 r681 0field into r682; + add r677 r682 into r683; + cast r683 7field into r684 as Share; + cast r3[6u32] r684 into r685 as ValidatorShareData; + mul 1field 8field into r686; + sub r4 1u8 into r687; + lt 0u8 r687 into r688; + mul r2[0u32] r686 into r689; + ternary r688 r689 0field into r690; + add r0 r690 into r691; + mul r686 8field into r692; + sub r4 1u8 into r693; + lt 1u8 r693 into r694; + mul r2[1u32] r692 into r695; + ternary r694 r695 0field into r696; + add r691 r696 into r697; + mul r692 8field into r698; + sub r4 1u8 into r699; + lt 2u8 r699 into r700; + mul r2[2u32] r698 into r701; + ternary r700 r701 0field into r702; + add r697 r702 into r703; + mul r698 8field into r704; + sub r4 1u8 into r705; + lt 3u8 r705 into r706; + mul r2[3u32] r704 into r707; + ternary r706 r707 0field into r708; + add r703 r708 into r709; + mul r704 8field into r710; + sub r4 1u8 into r711; + lt 4u8 r711 into r712; + mul r2[4u32] r710 into r713; + ternary r712 r713 0field into r714; + add r709 r714 into r715; + mul r710 8field into r716; + sub r4 1u8 into r717; + lt 5u8 r717 into r718; + mul r2[5u32] r716 into r719; + ternary r718 r719 0field into r720; + add r715 r720 into r721; + mul r716 8field into r722; + sub r4 1u8 into r723; + lt 6u8 r723 into r724; + mul r2[6u32] r722 into r725; + ternary r724 r725 0field into r726; + add r721 r726 into r727; + mul r722 8field into r728; + sub r4 1u8 into r729; + lt 7u8 r729 into r730; + mul r2[7u32] r728 into r731; + ternary r730 r731 0field into r732; + add r727 r732 into r733; + mul r728 8field into r734; + sub r4 1u8 into r735; + lt 8u8 r735 into r736; + mul r2[8u32] r734 into r737; + ternary r736 r737 0field into r738; + add r733 r738 into r739; + mul r734 8field into r740; + sub r4 1u8 into r741; + lt 9u8 r741 into r742; + mul r2[9u32] r740 into r743; + ternary r742 r743 0field into r744; + add r739 r744 into r745; + mul r740 8field into r746; + sub r4 1u8 into r747; + lt 10u8 r747 into r748; + mul r2[10u32] r746 into r749; + ternary r748 r749 0field into r750; + add r745 r750 into r751; + mul r746 8field into r752; + sub r4 1u8 into r753; + lt 11u8 r753 into r754; + mul r2[11u32] r752 into r755; + ternary r754 r755 0field into r756; + add r751 r756 into r757; + mul r752 8field into r758; + sub r4 1u8 into r759; + lt 12u8 r759 into r760; + mul r2[12u32] r758 into r761; + ternary r760 r761 0field into r762; + add r757 r762 into r763; + mul r758 8field into r764; + sub r4 1u8 into r765; + lt 13u8 r765 into r766; + mul r2[13u32] r764 into r767; + ternary r766 r767 0field into r768; + add r763 r768 into r769; + mul r764 8field into r770; + sub r4 1u8 into r771; + lt 14u8 r771 into r772; + mul r2[14u32] r770 into r773; + ternary r772 r773 0field into r774; + add r769 r774 into r775; + cast r775 8field into r776 as Share; + cast r3[7u32] r776 into r777 as ValidatorShareData; + mul 1field 9field into r778; + sub r4 1u8 into r779; + lt 0u8 r779 into r780; + mul r2[0u32] r778 into r781; + ternary r780 r781 0field into r782; + add r0 r782 into r783; + mul r778 9field into r784; + sub r4 1u8 into r785; + lt 1u8 r785 into r786; + mul r2[1u32] r784 into r787; + ternary r786 r787 0field into r788; + add r783 r788 into r789; + mul r784 9field into r790; + sub r4 1u8 into r791; + lt 2u8 r791 into r792; + mul r2[2u32] r790 into r793; + ternary r792 r793 0field into r794; + add r789 r794 into r795; + mul r790 9field into r796; + sub r4 1u8 into r797; + lt 3u8 r797 into r798; + mul r2[3u32] r796 into r799; + ternary r798 r799 0field into r800; + add r795 r800 into r801; + mul r796 9field into r802; + sub r4 1u8 into r803; + lt 4u8 r803 into r804; + mul r2[4u32] r802 into r805; + ternary r804 r805 0field into r806; + add r801 r806 into r807; + mul r802 9field into r808; + sub r4 1u8 into r809; + lt 5u8 r809 into r810; + mul r2[5u32] r808 into r811; + ternary r810 r811 0field into r812; + add r807 r812 into r813; + mul r808 9field into r814; + sub r4 1u8 into r815; + lt 6u8 r815 into r816; + mul r2[6u32] r814 into r817; + ternary r816 r817 0field into r818; + add r813 r818 into r819; + mul r814 9field into r820; + sub r4 1u8 into r821; + lt 7u8 r821 into r822; + mul r2[7u32] r820 into r823; + ternary r822 r823 0field into r824; + add r819 r824 into r825; + mul r820 9field into r826; + sub r4 1u8 into r827; + lt 8u8 r827 into r828; + mul r2[8u32] r826 into r829; + ternary r828 r829 0field into r830; + add r825 r830 into r831; + mul r826 9field into r832; + sub r4 1u8 into r833; + lt 9u8 r833 into r834; + mul r2[9u32] r832 into r835; + ternary r834 r835 0field into r836; + add r831 r836 into r837; + mul r832 9field into r838; + sub r4 1u8 into r839; + lt 10u8 r839 into r840; + mul r2[10u32] r838 into r841; + ternary r840 r841 0field into r842; + add r837 r842 into r843; + mul r838 9field into r844; + sub r4 1u8 into r845; + lt 11u8 r845 into r846; + mul r2[11u32] r844 into r847; + ternary r846 r847 0field into r848; + add r843 r848 into r849; + mul r844 9field into r850; + sub r4 1u8 into r851; + lt 12u8 r851 into r852; + mul r2[12u32] r850 into r853; + ternary r852 r853 0field into r854; + add r849 r854 into r855; + mul r850 9field into r856; + sub r4 1u8 into r857; + lt 13u8 r857 into r858; + mul r2[13u32] r856 into r859; + ternary r858 r859 0field into r860; + add r855 r860 into r861; + mul r856 9field into r862; + sub r4 1u8 into r863; + lt 14u8 r863 into r864; + mul r2[14u32] r862 into r865; + ternary r864 r865 0field into r866; + add r861 r866 into r867; + cast r867 9field into r868 as Share; + cast r3[8u32] r868 into r869 as ValidatorShareData; + mul 1field 10field into r870; + sub r4 1u8 into r871; + lt 0u8 r871 into r872; + mul r2[0u32] r870 into r873; + ternary r872 r873 0field into r874; + add r0 r874 into r875; + mul r870 10field into r876; + sub r4 1u8 into r877; + lt 1u8 r877 into r878; + mul r2[1u32] r876 into r879; + ternary r878 r879 0field into r880; + add r875 r880 into r881; + mul r876 10field into r882; + sub r4 1u8 into r883; + lt 2u8 r883 into r884; + mul r2[2u32] r882 into r885; + ternary r884 r885 0field into r886; + add r881 r886 into r887; + mul r882 10field into r888; + sub r4 1u8 into r889; + lt 3u8 r889 into r890; + mul r2[3u32] r888 into r891; + ternary r890 r891 0field into r892; + add r887 r892 into r893; + mul r888 10field into r894; + sub r4 1u8 into r895; + lt 4u8 r895 into r896; + mul r2[4u32] r894 into r897; + ternary r896 r897 0field into r898; + add r893 r898 into r899; + mul r894 10field into r900; + sub r4 1u8 into r901; + lt 5u8 r901 into r902; + mul r2[5u32] r900 into r903; + ternary r902 r903 0field into r904; + add r899 r904 into r905; + mul r900 10field into r906; + sub r4 1u8 into r907; + lt 6u8 r907 into r908; + mul r2[6u32] r906 into r909; + ternary r908 r909 0field into r910; + add r905 r910 into r911; + mul r906 10field into r912; + sub r4 1u8 into r913; + lt 7u8 r913 into r914; + mul r2[7u32] r912 into r915; + ternary r914 r915 0field into r916; + add r911 r916 into r917; + mul r912 10field into r918; + sub r4 1u8 into r919; + lt 8u8 r919 into r920; + mul r2[8u32] r918 into r921; + ternary r920 r921 0field into r922; + add r917 r922 into r923; + mul r918 10field into r924; + sub r4 1u8 into r925; + lt 9u8 r925 into r926; + mul r2[9u32] r924 into r927; + ternary r926 r927 0field into r928; + add r923 r928 into r929; + mul r924 10field into r930; + sub r4 1u8 into r931; + lt 10u8 r931 into r932; + mul r2[10u32] r930 into r933; + ternary r932 r933 0field into r934; + add r929 r934 into r935; + mul r930 10field into r936; + sub r4 1u8 into r937; + lt 11u8 r937 into r938; + mul r2[11u32] r936 into r939; + ternary r938 r939 0field into r940; + add r935 r940 into r941; + mul r936 10field into r942; + sub r4 1u8 into r943; + lt 12u8 r943 into r944; + mul r2[12u32] r942 into r945; + ternary r944 r945 0field into r946; + add r941 r946 into r947; + mul r942 10field into r948; + sub r4 1u8 into r949; + lt 13u8 r949 into r950; + mul r2[13u32] r948 into r951; + ternary r950 r951 0field into r952; + add r947 r952 into r953; + mul r948 10field into r954; + sub r4 1u8 into r955; + lt 14u8 r955 into r956; + mul r2[14u32] r954 into r957; + ternary r956 r957 0field into r958; + add r953 r958 into r959; + cast r959 10field into r960 as Share; + cast r3[9u32] r960 into r961 as ValidatorShareData; + mul 1field 11field into r962; + sub r4 1u8 into r963; + lt 0u8 r963 into r964; + mul r2[0u32] r962 into r965; + ternary r964 r965 0field into r966; + add r0 r966 into r967; + mul r962 11field into r968; + sub r4 1u8 into r969; + lt 1u8 r969 into r970; + mul r2[1u32] r968 into r971; + ternary r970 r971 0field into r972; + add r967 r972 into r973; + mul r968 11field into r974; + sub r4 1u8 into r975; + lt 2u8 r975 into r976; + mul r2[2u32] r974 into r977; + ternary r976 r977 0field into r978; + add r973 r978 into r979; + mul r974 11field into r980; + sub r4 1u8 into r981; + lt 3u8 r981 into r982; + mul r2[3u32] r980 into r983; + ternary r982 r983 0field into r984; + add r979 r984 into r985; + mul r980 11field into r986; + sub r4 1u8 into r987; + lt 4u8 r987 into r988; + mul r2[4u32] r986 into r989; + ternary r988 r989 0field into r990; + add r985 r990 into r991; + mul r986 11field into r992; + sub r4 1u8 into r993; + lt 5u8 r993 into r994; + mul r2[5u32] r992 into r995; + ternary r994 r995 0field into r996; + add r991 r996 into r997; + mul r992 11field into r998; + sub r4 1u8 into r999; + lt 6u8 r999 into r1000; + mul r2[6u32] r998 into r1001; + ternary r1000 r1001 0field into r1002; + add r997 r1002 into r1003; + mul r998 11field into r1004; + sub r4 1u8 into r1005; + lt 7u8 r1005 into r1006; + mul r2[7u32] r1004 into r1007; + ternary r1006 r1007 0field into r1008; + add r1003 r1008 into r1009; + mul r1004 11field into r1010; + sub r4 1u8 into r1011; + lt 8u8 r1011 into r1012; + mul r2[8u32] r1010 into r1013; + ternary r1012 r1013 0field into r1014; + add r1009 r1014 into r1015; + mul r1010 11field into r1016; + sub r4 1u8 into r1017; + lt 9u8 r1017 into r1018; + mul r2[9u32] r1016 into r1019; + ternary r1018 r1019 0field into r1020; + add r1015 r1020 into r1021; + mul r1016 11field into r1022; + sub r4 1u8 into r1023; + lt 10u8 r1023 into r1024; + mul r2[10u32] r1022 into r1025; + ternary r1024 r1025 0field into r1026; + add r1021 r1026 into r1027; + mul r1022 11field into r1028; + sub r4 1u8 into r1029; + lt 11u8 r1029 into r1030; + mul r2[11u32] r1028 into r1031; + ternary r1030 r1031 0field into r1032; + add r1027 r1032 into r1033; + mul r1028 11field into r1034; + sub r4 1u8 into r1035; + lt 12u8 r1035 into r1036; + mul r2[12u32] r1034 into r1037; + ternary r1036 r1037 0field into r1038; + add r1033 r1038 into r1039; + mul r1034 11field into r1040; + sub r4 1u8 into r1041; + lt 13u8 r1041 into r1042; + mul r2[13u32] r1040 into r1043; + ternary r1042 r1043 0field into r1044; + add r1039 r1044 into r1045; + mul r1040 11field into r1046; + sub r4 1u8 into r1047; + lt 14u8 r1047 into r1048; + mul r2[14u32] r1046 into r1049; + ternary r1048 r1049 0field into r1050; + add r1045 r1050 into r1051; + cast r1051 11field into r1052 as Share; + cast r3[10u32] r1052 into r1053 as ValidatorShareData; + mul 1field 12field into r1054; + sub r4 1u8 into r1055; + lt 0u8 r1055 into r1056; + mul r2[0u32] r1054 into r1057; + ternary r1056 r1057 0field into r1058; + add r0 r1058 into r1059; + mul r1054 12field into r1060; + sub r4 1u8 into r1061; + lt 1u8 r1061 into r1062; + mul r2[1u32] r1060 into r1063; + ternary r1062 r1063 0field into r1064; + add r1059 r1064 into r1065; + mul r1060 12field into r1066; + sub r4 1u8 into r1067; + lt 2u8 r1067 into r1068; + mul r2[2u32] r1066 into r1069; + ternary r1068 r1069 0field into r1070; + add r1065 r1070 into r1071; + mul r1066 12field into r1072; + sub r4 1u8 into r1073; + lt 3u8 r1073 into r1074; + mul r2[3u32] r1072 into r1075; + ternary r1074 r1075 0field into r1076; + add r1071 r1076 into r1077; + mul r1072 12field into r1078; + sub r4 1u8 into r1079; + lt 4u8 r1079 into r1080; + mul r2[4u32] r1078 into r1081; + ternary r1080 r1081 0field into r1082; + add r1077 r1082 into r1083; + mul r1078 12field into r1084; + sub r4 1u8 into r1085; + lt 5u8 r1085 into r1086; + mul r2[5u32] r1084 into r1087; + ternary r1086 r1087 0field into r1088; + add r1083 r1088 into r1089; + mul r1084 12field into r1090; + sub r4 1u8 into r1091; + lt 6u8 r1091 into r1092; + mul r2[6u32] r1090 into r1093; + ternary r1092 r1093 0field into r1094; + add r1089 r1094 into r1095; + mul r1090 12field into r1096; + sub r4 1u8 into r1097; + lt 7u8 r1097 into r1098; + mul r2[7u32] r1096 into r1099; + ternary r1098 r1099 0field into r1100; + add r1095 r1100 into r1101; + mul r1096 12field into r1102; + sub r4 1u8 into r1103; + lt 8u8 r1103 into r1104; + mul r2[8u32] r1102 into r1105; + ternary r1104 r1105 0field into r1106; + add r1101 r1106 into r1107; + mul r1102 12field into r1108; + sub r4 1u8 into r1109; + lt 9u8 r1109 into r1110; + mul r2[9u32] r1108 into r1111; + ternary r1110 r1111 0field into r1112; + add r1107 r1112 into r1113; + mul r1108 12field into r1114; + sub r4 1u8 into r1115; + lt 10u8 r1115 into r1116; + mul r2[10u32] r1114 into r1117; + ternary r1116 r1117 0field into r1118; + add r1113 r1118 into r1119; + mul r1114 12field into r1120; + sub r4 1u8 into r1121; + lt 11u8 r1121 into r1122; + mul r2[11u32] r1120 into r1123; + ternary r1122 r1123 0field into r1124; + add r1119 r1124 into r1125; + mul r1120 12field into r1126; + sub r4 1u8 into r1127; + lt 12u8 r1127 into r1128; + mul r2[12u32] r1126 into r1129; + ternary r1128 r1129 0field into r1130; + add r1125 r1130 into r1131; + mul r1126 12field into r1132; + sub r4 1u8 into r1133; + lt 13u8 r1133 into r1134; + mul r2[13u32] r1132 into r1135; + ternary r1134 r1135 0field into r1136; + add r1131 r1136 into r1137; + mul r1132 12field into r1138; + sub r4 1u8 into r1139; + lt 14u8 r1139 into r1140; + mul r2[14u32] r1138 into r1141; + ternary r1140 r1141 0field into r1142; + add r1137 r1142 into r1143; + cast r1143 12field into r1144 as Share; + cast r3[11u32] r1144 into r1145 as ValidatorShareData; + mul 1field 13field into r1146; + sub r4 1u8 into r1147; + lt 0u8 r1147 into r1148; + mul r2[0u32] r1146 into r1149; + ternary r1148 r1149 0field into r1150; + add r0 r1150 into r1151; + mul r1146 13field into r1152; + sub r4 1u8 into r1153; + lt 1u8 r1153 into r1154; + mul r2[1u32] r1152 into r1155; + ternary r1154 r1155 0field into r1156; + add r1151 r1156 into r1157; + mul r1152 13field into r1158; + sub r4 1u8 into r1159; + lt 2u8 r1159 into r1160; + mul r2[2u32] r1158 into r1161; + ternary r1160 r1161 0field into r1162; + add r1157 r1162 into r1163; + mul r1158 13field into r1164; + sub r4 1u8 into r1165; + lt 3u8 r1165 into r1166; + mul r2[3u32] r1164 into r1167; + ternary r1166 r1167 0field into r1168; + add r1163 r1168 into r1169; + mul r1164 13field into r1170; + sub r4 1u8 into r1171; + lt 4u8 r1171 into r1172; + mul r2[4u32] r1170 into r1173; + ternary r1172 r1173 0field into r1174; + add r1169 r1174 into r1175; + mul r1170 13field into r1176; + sub r4 1u8 into r1177; + lt 5u8 r1177 into r1178; + mul r2[5u32] r1176 into r1179; + ternary r1178 r1179 0field into r1180; + add r1175 r1180 into r1181; + mul r1176 13field into r1182; + sub r4 1u8 into r1183; + lt 6u8 r1183 into r1184; + mul r2[6u32] r1182 into r1185; + ternary r1184 r1185 0field into r1186; + add r1181 r1186 into r1187; + mul r1182 13field into r1188; + sub r4 1u8 into r1189; + lt 7u8 r1189 into r1190; + mul r2[7u32] r1188 into r1191; + ternary r1190 r1191 0field into r1192; + add r1187 r1192 into r1193; + mul r1188 13field into r1194; + sub r4 1u8 into r1195; + lt 8u8 r1195 into r1196; + mul r2[8u32] r1194 into r1197; + ternary r1196 r1197 0field into r1198; + add r1193 r1198 into r1199; + mul r1194 13field into r1200; + sub r4 1u8 into r1201; + lt 9u8 r1201 into r1202; + mul r2[9u32] r1200 into r1203; + ternary r1202 r1203 0field into r1204; + add r1199 r1204 into r1205; + mul r1200 13field into r1206; + sub r4 1u8 into r1207; + lt 10u8 r1207 into r1208; + mul r2[10u32] r1206 into r1209; + ternary r1208 r1209 0field into r1210; + add r1205 r1210 into r1211; + mul r1206 13field into r1212; + sub r4 1u8 into r1213; + lt 11u8 r1213 into r1214; + mul r2[11u32] r1212 into r1215; + ternary r1214 r1215 0field into r1216; + add r1211 r1216 into r1217; + mul r1212 13field into r1218; + sub r4 1u8 into r1219; + lt 12u8 r1219 into r1220; + mul r2[12u32] r1218 into r1221; + ternary r1220 r1221 0field into r1222; + add r1217 r1222 into r1223; + mul r1218 13field into r1224; + sub r4 1u8 into r1225; + lt 13u8 r1225 into r1226; + mul r2[13u32] r1224 into r1227; + ternary r1226 r1227 0field into r1228; + add r1223 r1228 into r1229; + mul r1224 13field into r1230; + sub r4 1u8 into r1231; + lt 14u8 r1231 into r1232; + mul r2[14u32] r1230 into r1233; + ternary r1232 r1233 0field into r1234; + add r1229 r1234 into r1235; + cast r1235 13field into r1236 as Share; + cast r3[12u32] r1236 into r1237 as ValidatorShareData; + mul 1field 14field into r1238; + sub r4 1u8 into r1239; + lt 0u8 r1239 into r1240; + mul r2[0u32] r1238 into r1241; + ternary r1240 r1241 0field into r1242; + add r0 r1242 into r1243; + mul r1238 14field into r1244; + sub r4 1u8 into r1245; + lt 1u8 r1245 into r1246; + mul r2[1u32] r1244 into r1247; + ternary r1246 r1247 0field into r1248; + add r1243 r1248 into r1249; + mul r1244 14field into r1250; + sub r4 1u8 into r1251; + lt 2u8 r1251 into r1252; + mul r2[2u32] r1250 into r1253; + ternary r1252 r1253 0field into r1254; + add r1249 r1254 into r1255; + mul r1250 14field into r1256; + sub r4 1u8 into r1257; + lt 3u8 r1257 into r1258; + mul r2[3u32] r1256 into r1259; + ternary r1258 r1259 0field into r1260; + add r1255 r1260 into r1261; + mul r1256 14field into r1262; + sub r4 1u8 into r1263; + lt 4u8 r1263 into r1264; + mul r2[4u32] r1262 into r1265; + ternary r1264 r1265 0field into r1266; + add r1261 r1266 into r1267; + mul r1262 14field into r1268; + sub r4 1u8 into r1269; + lt 5u8 r1269 into r1270; + mul r2[5u32] r1268 into r1271; + ternary r1270 r1271 0field into r1272; + add r1267 r1272 into r1273; + mul r1268 14field into r1274; + sub r4 1u8 into r1275; + lt 6u8 r1275 into r1276; + mul r2[6u32] r1274 into r1277; + ternary r1276 r1277 0field into r1278; + add r1273 r1278 into r1279; + mul r1274 14field into r1280; + sub r4 1u8 into r1281; + lt 7u8 r1281 into r1282; + mul r2[7u32] r1280 into r1283; + ternary r1282 r1283 0field into r1284; + add r1279 r1284 into r1285; + mul r1280 14field into r1286; + sub r4 1u8 into r1287; + lt 8u8 r1287 into r1288; + mul r2[8u32] r1286 into r1289; + ternary r1288 r1289 0field into r1290; + add r1285 r1290 into r1291; + mul r1286 14field into r1292; + sub r4 1u8 into r1293; + lt 9u8 r1293 into r1294; + mul r2[9u32] r1292 into r1295; + ternary r1294 r1295 0field into r1296; + add r1291 r1296 into r1297; + mul r1292 14field into r1298; + sub r4 1u8 into r1299; + lt 10u8 r1299 into r1300; + mul r2[10u32] r1298 into r1301; + ternary r1300 r1301 0field into r1302; + add r1297 r1302 into r1303; + mul r1298 14field into r1304; + sub r4 1u8 into r1305; + lt 11u8 r1305 into r1306; + mul r2[11u32] r1304 into r1307; + ternary r1306 r1307 0field into r1308; + add r1303 r1308 into r1309; + mul r1304 14field into r1310; + sub r4 1u8 into r1311; + lt 12u8 r1311 into r1312; + mul r2[12u32] r1310 into r1313; + ternary r1312 r1313 0field into r1314; + add r1309 r1314 into r1315; + mul r1310 14field into r1316; + sub r4 1u8 into r1317; + lt 13u8 r1317 into r1318; + mul r2[13u32] r1316 into r1319; + ternary r1318 r1319 0field into r1320; + add r1315 r1320 into r1321; + mul r1316 14field into r1322; + sub r4 1u8 into r1323; + lt 14u8 r1323 into r1324; + mul r2[14u32] r1322 into r1325; + ternary r1324 r1325 0field into r1326; + add r1321 r1326 into r1327; + cast r1327 14field into r1328 as Share; + cast r3[13u32] r1328 into r1329 as ValidatorShareData; + mul 1field 15field into r1330; + sub r4 1u8 into r1331; + lt 0u8 r1331 into r1332; + mul r2[0u32] r1330 into r1333; + ternary r1332 r1333 0field into r1334; + add r0 r1334 into r1335; + mul r1330 15field into r1336; + sub r4 1u8 into r1337; + lt 1u8 r1337 into r1338; + mul r2[1u32] r1336 into r1339; + ternary r1338 r1339 0field into r1340; + add r1335 r1340 into r1341; + mul r1336 15field into r1342; + sub r4 1u8 into r1343; + lt 2u8 r1343 into r1344; + mul r2[2u32] r1342 into r1345; + ternary r1344 r1345 0field into r1346; + add r1341 r1346 into r1347; + mul r1342 15field into r1348; + sub r4 1u8 into r1349; + lt 3u8 r1349 into r1350; + mul r2[3u32] r1348 into r1351; + ternary r1350 r1351 0field into r1352; + add r1347 r1352 into r1353; + mul r1348 15field into r1354; + sub r4 1u8 into r1355; + lt 4u8 r1355 into r1356; + mul r2[4u32] r1354 into r1357; + ternary r1356 r1357 0field into r1358; + add r1353 r1358 into r1359; + mul r1354 15field into r1360; + sub r4 1u8 into r1361; + lt 5u8 r1361 into r1362; + mul r2[5u32] r1360 into r1363; + ternary r1362 r1363 0field into r1364; + add r1359 r1364 into r1365; + mul r1360 15field into r1366; + sub r4 1u8 into r1367; + lt 6u8 r1367 into r1368; + mul r2[6u32] r1366 into r1369; + ternary r1368 r1369 0field into r1370; + add r1365 r1370 into r1371; + mul r1366 15field into r1372; + sub r4 1u8 into r1373; + lt 7u8 r1373 into r1374; + mul r2[7u32] r1372 into r1375; + ternary r1374 r1375 0field into r1376; + add r1371 r1376 into r1377; + mul r1372 15field into r1378; + sub r4 1u8 into r1379; + lt 8u8 r1379 into r1380; + mul r2[8u32] r1378 into r1381; + ternary r1380 r1381 0field into r1382; + add r1377 r1382 into r1383; + mul r1378 15field into r1384; + sub r4 1u8 into r1385; + lt 9u8 r1385 into r1386; + mul r2[9u32] r1384 into r1387; + ternary r1386 r1387 0field into r1388; + add r1383 r1388 into r1389; + mul r1384 15field into r1390; + sub r4 1u8 into r1391; + lt 10u8 r1391 into r1392; + mul r2[10u32] r1390 into r1393; + ternary r1392 r1393 0field into r1394; + add r1389 r1394 into r1395; + mul r1390 15field into r1396; + sub r4 1u8 into r1397; + lt 11u8 r1397 into r1398; + mul r2[11u32] r1396 into r1399; + ternary r1398 r1399 0field into r1400; + add r1395 r1400 into r1401; + mul r1396 15field into r1402; + sub r4 1u8 into r1403; + lt 12u8 r1403 into r1404; + mul r2[12u32] r1402 into r1405; + ternary r1404 r1405 0field into r1406; + add r1401 r1406 into r1407; + mul r1402 15field into r1408; + sub r4 1u8 into r1409; + lt 13u8 r1409 into r1410; + mul r2[13u32] r1408 into r1411; + ternary r1410 r1411 0field into r1412; + add r1407 r1412 into r1413; + mul r1408 15field into r1414; + sub r4 1u8 into r1415; + lt 14u8 r1415 into r1416; + mul r2[14u32] r1414 into r1417; + ternary r1416 r1417 0field into r1418; + add r1413 r1418 into r1419; + cast r1419 15field into r1420 as Share; + cast r3[14u32] r1420 into r1421 as ValidatorShareData; + mul 1field 16field into r1422; + sub r4 1u8 into r1423; + lt 0u8 r1423 into r1424; + mul r2[0u32] r1422 into r1425; + ternary r1424 r1425 0field into r1426; + add r0 r1426 into r1427; + mul r1422 16field into r1428; + sub r4 1u8 into r1429; + lt 1u8 r1429 into r1430; + mul r2[1u32] r1428 into r1431; + ternary r1430 r1431 0field into r1432; + add r1427 r1432 into r1433; + mul r1428 16field into r1434; + sub r4 1u8 into r1435; + lt 2u8 r1435 into r1436; + mul r2[2u32] r1434 into r1437; + ternary r1436 r1437 0field into r1438; + add r1433 r1438 into r1439; + mul r1434 16field into r1440; + sub r4 1u8 into r1441; + lt 3u8 r1441 into r1442; + mul r2[3u32] r1440 into r1443; + ternary r1442 r1443 0field into r1444; + add r1439 r1444 into r1445; + mul r1440 16field into r1446; + sub r4 1u8 into r1447; + lt 4u8 r1447 into r1448; + mul r2[4u32] r1446 into r1449; + ternary r1448 r1449 0field into r1450; + add r1445 r1450 into r1451; + mul r1446 16field into r1452; + sub r4 1u8 into r1453; + lt 5u8 r1453 into r1454; + mul r2[5u32] r1452 into r1455; + ternary r1454 r1455 0field into r1456; + add r1451 r1456 into r1457; + mul r1452 16field into r1458; + sub r4 1u8 into r1459; + lt 6u8 r1459 into r1460; + mul r2[6u32] r1458 into r1461; + ternary r1460 r1461 0field into r1462; + add r1457 r1462 into r1463; + mul r1458 16field into r1464; + sub r4 1u8 into r1465; + lt 7u8 r1465 into r1466; + mul r2[7u32] r1464 into r1467; + ternary r1466 r1467 0field into r1468; + add r1463 r1468 into r1469; + mul r1464 16field into r1470; + sub r4 1u8 into r1471; + lt 8u8 r1471 into r1472; + mul r2[8u32] r1470 into r1473; + ternary r1472 r1473 0field into r1474; + add r1469 r1474 into r1475; + mul r1470 16field into r1476; + sub r4 1u8 into r1477; + lt 9u8 r1477 into r1478; + mul r2[9u32] r1476 into r1479; + ternary r1478 r1479 0field into r1480; + add r1475 r1480 into r1481; + mul r1476 16field into r1482; + sub r4 1u8 into r1483; + lt 10u8 r1483 into r1484; + mul r2[10u32] r1482 into r1485; + ternary r1484 r1485 0field into r1486; + add r1481 r1486 into r1487; + mul r1482 16field into r1488; + sub r4 1u8 into r1489; + lt 11u8 r1489 into r1490; + mul r2[11u32] r1488 into r1491; + ternary r1490 r1491 0field into r1492; + add r1487 r1492 into r1493; + mul r1488 16field into r1494; + sub r4 1u8 into r1495; + lt 12u8 r1495 into r1496; + mul r2[12u32] r1494 into r1497; + ternary r1496 r1497 0field into r1498; + add r1493 r1498 into r1499; + mul r1494 16field into r1500; + sub r4 1u8 into r1501; + lt 13u8 r1501 into r1502; + mul r2[13u32] r1500 into r1503; + ternary r1502 r1503 0field into r1504; + add r1499 r1504 into r1505; + mul r1500 16field into r1506; + sub r4 1u8 into r1507; + lt 14u8 r1507 into r1508; + mul r2[14u32] r1506 into r1509; + ternary r1508 r1509 0field into r1510; + add r1505 r1510 into r1511; + cast r1511 16field into r1512 as Share; + cast r3[15u32] r1512 into r1513 as ValidatorShareData; + cast r133 r225 r317 r409 r501 r593 r685 r777 r869 r961 r1053 r1145 r1237 r1329 r1421 r1513 into r1514 as [ValidatorShareData; 16u32]; + call dcp_validator_shares.aleo/submit_shares_to_validators r1514 r40 r39 true into r1515 r1516 r1517 r1518 r1519 r1520 r1521 r1522 r1523 r1524 r1525 r1526 r1527 r1528 r1529 r1530; + call dcp_core_protocol.aleo/custody_data_as_program r41 r3 r39 into r1531; + async add_private r1531 into r1532; + output r1532 as data_custody_protocol.aleo/add_private.future; -finalize custody_data_as_program: +finalize add_private: input r0 as dcp_core_protocol.aleo/custody_data_as_program.future; await r0; -function request_data_as_program: +function add_or_mul_public: input r0 as field.private; - input r1 as address.private; - input r2 as u8.private; - input r3 as u64.public; - input r4 as [address; 16u32].public; - input r5 as u64.private; - input r6 as credits.aleo/credits.record; - assert.neq self.caller self.signer; - cast self.caller r0 r2 into r7 as Custody; + input r1 as boolean.private; + input r2 as field.private; + input r3 as [address; 16u32].public; + input r4 as u8.private; + cast r1 r0 false into r5 as Operation; + hash.bhp256 r5 into r6 as field; + cast self.caller r2 r4 into r7 as Custody; hash.bhp256 r7 into r8 as field; - cast r4[0u32] r4[1u32] r4[2u32] r4[3u32] r4[4u32] r4[5u32] r4[6u32] r4[7u32] r4[8u32] r4[9u32] r4[10u32] r4[11u32] r4[12u32] r4[13u32] r4[14u32] r4[15u32] into r9 as [address; 16u32]; - call dcp_withdraw_requests.aleo/submit_requests_to_validators r9 r8 r1 r5 r3 into r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25; - cast 16u8 into r26 as u64; - mul r26 r5 into r27; - call credits.aleo/transfer_private_to_public r6 dcp_fee_management.aleo r27 into r28 r29; - call dcp_core_protocol.aleo/request_data_as_program r8 r4 r3 into r30; - async request_data_as_program r30 r29 into r31; - output r28 as credits.aleo/credits.record; - output r31 as data_custody_protocol.aleo/request_data_as_program.future; + cast r0 1field into r9 as Share; + cast r3[0u32] r9 into r10 as ValidatorShareData; + cast r0 2field into r11 as Share; + cast r3[1u32] r11 into r12 as ValidatorShareData; + cast r0 3field into r13 as Share; + cast r3[2u32] r13 into r14 as ValidatorShareData; + cast r0 4field into r15 as Share; + cast r3[3u32] r15 into r16 as ValidatorShareData; + cast r0 5field into r17 as Share; + cast r3[4u32] r17 into r18 as ValidatorShareData; + cast r0 6field into r19 as Share; + cast r3[5u32] r19 into r20 as ValidatorShareData; + cast r0 7field into r21 as Share; + cast r3[6u32] r21 into r22 as ValidatorShareData; + cast r0 8field into r23 as Share; + cast r3[7u32] r23 into r24 as ValidatorShareData; + cast r0 9field into r25 as Share; + cast r3[8u32] r25 into r26 as ValidatorShareData; + cast r0 10field into r27 as Share; + cast r3[9u32] r27 into r28 as ValidatorShareData; + cast r0 11field into r29 as Share; + cast r3[10u32] r29 into r30 as ValidatorShareData; + cast r0 12field into r31 as Share; + cast r3[11u32] r31 into r32 as ValidatorShareData; + cast r0 13field into r33 as Share; + cast r3[12u32] r33 into r34 as ValidatorShareData; + cast r0 14field into r35 as Share; + cast r3[13u32] r35 into r36 as ValidatorShareData; + cast r0 15field into r37 as Share; + cast r3[14u32] r37 into r38 as ValidatorShareData; + cast r0 16field into r39 as Share; + cast r3[15u32] r39 into r40 as ValidatorShareData; + cast r10 r12 r14 r16 r18 r20 r22 r24 r26 r28 r30 r32 r34 r36 r38 r40 into r41 as [ValidatorShareData; 16u32]; + call dcp_validator_shares.aleo/submit_shares_to_validators r41 r7 r6 r1 into r42 r43 r44 r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57; + call dcp_core_protocol.aleo/custody_data_as_program r8 r3 r6 into r58; + async add_or_mul_public r58 into r59; + output r59 as data_custody_protocol.aleo/add_or_mul_public.future; -finalize request_data_as_program: - input r0 as dcp_core_protocol.aleo/request_data_as_program.future; - input r1 as credits.aleo/transfer_private_to_public.future; +finalize add_or_mul_public: + input r0 as dcp_core_protocol.aleo/custody_data_as_program.future; await r0; - await r1; + + diff --git a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_core_protocol.aleo b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_core_protocol.aleo index 9fe234d..eaa3a16 100644 --- a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_core_protocol.aleo +++ b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_core_protocol.aleo @@ -1,7 +1,7 @@ import credits.aleo; import dcp_fee_management.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; program dcp_core_protocol.aleo; @@ -18,7 +18,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -29,7 +28,7 @@ struct Proposal: struct CustodyState: validator_set_index as u64; - expected_weight as u64; + custody_trace as field; record DestinationShare: owner as address.private; @@ -339,50 +338,71 @@ finalize accept_proposal: + + function custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async custody_data_as_program r0 r1 into r2; - output r2 as dcp_core_protocol.aleo/custody_data_as_program.future; + async custody_data_as_program r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/custody_data_as_program.future; finalize custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; - cast 0u64 0u64 into r2 as CustodyState; - get.or_use custodies[r0] r2 into r3; - get validator_sets_length[true] into r4; - is.eq r3.expected_weight 0u64 into r5; - sub r4 1u64 into r6; - ternary r5 r6 r3.validator_set_index into r7; - get validator_sets[r7] into r8; - assert.eq r1 r8; - add r3.expected_weight 1u64 into r9; - cast r7 r9 into r10 as CustodyState; - set r10 into custodies[r0]; + input r2 as field.public; + cast 0u64 r2 into r3 as CustodyState; + get.or_use custodies[r0] r3 into r4; + get validator_sets_length[true] into r5; + is.eq r4.custody_trace r2 into r6; + sub r5 1u64 into r7; + ternary r6 r7 r4.validator_set_index into r8; + get validator_sets[r8] into r9; + assert.eq r1 r9; + cast r4.custody_trace r2 into r10 as [field; 2u32]; + hash.bhp256 r10 into r11 as field; + ternary r6 r2 r11 into r12; + cast r8 r12 into r13 as CustodyState; + set r13 into custodies[r0]; -function request_data_as_program: +function request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async request_data_as_program r0 r1 r2 into r3; - output r3 as dcp_core_protocol.aleo/request_data_as_program.future; + async request_open r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/request_open.future; -finalize request_data_as_program: +finalize request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; get custodies[r0] into r3; - assert.eq r2 r3.expected_weight; + assert.eq r2 r3.custody_trace; get validator_sets[r3.validator_set_index] into r4; assert.eq r1 r4; + + +function process_request_as_validator: + input r0 as dcp_validator_shares.aleo/ValidatorShare.record; + input r1 as dcp_open_requests.aleo/OpenRequest.record; + hash.bhp256 r0.custody into r2 as field; + assert.eq r1.custody_hash r2; + cast r1.to r0.share r0.custody into r3 as DestinationShare.record; + call dcp_open_requests.aleo/spend_open_request r1; + call dcp_fee_management.aleo/mint_fee self.caller r1.fee_amount r1.expire into r4; + assert.eq r1.custody_trace r0.custody_trace; + output r3 as DestinationShare.record; + output r4 as dcp_fee_management.aleo/Fee.record; + + function spend_destination_shares: input r0 as DestinationShare.record; input r1 as DestinationShare.record; @@ -407,5 +427,3 @@ function mint_null_destination_share: cast 0field 0field into r1 as Share; cast self.signer r1 r0 into r2 as DestinationShare.record; output r2 as DestinationShare.record; - - diff --git a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_fee_management.aleo b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_fee_management.aleo index ffc7c7f..52153ca 100644 --- a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_fee_management.aleo +++ b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_fee_management.aleo @@ -5,26 +5,33 @@ program dcp_fee_management.aleo; record Fee: owner as address.private; microcredits as u64.private; + expire as u32.private; function mint_fee: input r0 as address.public; input r1 as u64.private; + input r2 as u32.private; assert.eq self.caller dcp_core_protocol.aleo; - cast r0 r1 into r2 as Fee.record; - output r2 as Fee.record; + cast r0 r1 r2 into r3 as Fee.record; + output r3 as Fee.record; function burn_fee: input r0 as Fee.record; call credits.aleo/transfer_public r0.owner r0.microcredits into r1; - async burn_fee r1 into r2; + async burn_fee r1 r0.expire into r2; output r2 as dcp_fee_management.aleo/burn_fee.future; finalize burn_fee: input r0 as credits.aleo/transfer_public.future; + input r1 as u32.public; await r0; + gte r1 block.height into r2; + assert.eq r2 true; + + @@ -32,5 +39,7 @@ function join_fee: input r0 as Fee.record; input r1 as Fee.record; add r0.microcredits r1.microcredits into r2; - cast r0.owner r2 into r3 as Fee.record; - output r3 as Fee.record; + lt r0.expire r1.expire into r3; + ternary r3 r0.expire r1.expire into r4; + cast r0.owner r2 r4 into r5 as Fee.record; + output r5 as Fee.record; diff --git a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_open_requests.aleo b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_open_requests.aleo new file mode 100644 index 0000000..20d8a15 --- /dev/null +++ b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_open_requests.aleo @@ -0,0 +1,56 @@ +program dcp_open_requests.aleo; + +record OpenRequest: + owner as address.private; + custody_hash as field.private; + to as address.private; + fee_amount as u64.private; + custody_trace as field.private; + expire as u32.private; + + +function submit_requests_to_validators: + input r0 as [address; 16u32].public; + input r1 as field.public; + input r2 as address.private; + input r3 as u64.private; + input r4 as field.public; + input r5 as u32.public; + assert.eq self.caller data_custody_protocol.aleo; + cast r0[0u32] r1 r2 r3 r4 r5 into r6 as OpenRequest.record; + cast r0[1u32] r1 r2 r3 r4 r5 into r7 as OpenRequest.record; + cast r0[2u32] r1 r2 r3 r4 r5 into r8 as OpenRequest.record; + cast r0[3u32] r1 r2 r3 r4 r5 into r9 as OpenRequest.record; + cast r0[4u32] r1 r2 r3 r4 r5 into r10 as OpenRequest.record; + cast r0[5u32] r1 r2 r3 r4 r5 into r11 as OpenRequest.record; + cast r0[6u32] r1 r2 r3 r4 r5 into r12 as OpenRequest.record; + cast r0[7u32] r1 r2 r3 r4 r5 into r13 as OpenRequest.record; + cast r0[8u32] r1 r2 r3 r4 r5 into r14 as OpenRequest.record; + cast r0[9u32] r1 r2 r3 r4 r5 into r15 as OpenRequest.record; + cast r0[10u32] r1 r2 r3 r4 r5 into r16 as OpenRequest.record; + cast r0[11u32] r1 r2 r3 r4 r5 into r17 as OpenRequest.record; + cast r0[12u32] r1 r2 r3 r4 r5 into r18 as OpenRequest.record; + cast r0[13u32] r1 r2 r3 r4 r5 into r19 as OpenRequest.record; + cast r0[14u32] r1 r2 r3 r4 r5 into r20 as OpenRequest.record; + cast r0[15u32] r1 r2 r3 r4 r5 into r21 as OpenRequest.record; + output r6 as OpenRequest.record; + output r7 as OpenRequest.record; + output r8 as OpenRequest.record; + output r9 as OpenRequest.record; + output r10 as OpenRequest.record; + output r11 as OpenRequest.record; + output r12 as OpenRequest.record; + output r13 as OpenRequest.record; + output r14 as OpenRequest.record; + output r15 as OpenRequest.record; + output r16 as OpenRequest.record; + output r17 as OpenRequest.record; + output r18 as OpenRequest.record; + output r19 as OpenRequest.record; + output r20 as OpenRequest.record; + output r21 as OpenRequest.record; + + +function spend_open_request: + input r0 as OpenRequest.record; + assert.eq self.caller dcp_core_protocol.aleo; diff --git a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_validator_shares.aleo b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_validator_shares.aleo index 4ec6922..604611c 100644 --- a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_validator_shares.aleo +++ b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_validator_shares.aleo @@ -12,37 +12,37 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; record ValidatorShare: owner as address.private; share as Share.private; custody as Custody.private; - weight as u64.private; + custody_trace as field.private; + is_addition as boolean.private; function submit_shares_to_validators: input r0 as [ValidatorShareData; 16u32].private; input r1 as Custody.private; + input r2 as field.private; + input r3 as boolean.private; assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32].validator r0[0u32].share r1 r0[0u32].weight into r2 as ValidatorShare.record; - cast r0[1u32].validator r0[1u32].share r1 r0[1u32].weight into r3 as ValidatorShare.record; - cast r0[2u32].validator r0[2u32].share r1 r0[2u32].weight into r4 as ValidatorShare.record; - cast r0[3u32].validator r0[3u32].share r1 r0[3u32].weight into r5 as ValidatorShare.record; - cast r0[4u32].validator r0[4u32].share r1 r0[4u32].weight into r6 as ValidatorShare.record; - cast r0[5u32].validator r0[5u32].share r1 r0[5u32].weight into r7 as ValidatorShare.record; - cast r0[6u32].validator r0[6u32].share r1 r0[6u32].weight into r8 as ValidatorShare.record; - cast r0[7u32].validator r0[7u32].share r1 r0[7u32].weight into r9 as ValidatorShare.record; - cast r0[8u32].validator r0[8u32].share r1 r0[8u32].weight into r10 as ValidatorShare.record; - cast r0[9u32].validator r0[9u32].share r1 r0[9u32].weight into r11 as ValidatorShare.record; - cast r0[10u32].validator r0[10u32].share r1 r0[10u32].weight into r12 as ValidatorShare.record; - cast r0[11u32].validator r0[11u32].share r1 r0[11u32].weight into r13 as ValidatorShare.record; - cast r0[12u32].validator r0[12u32].share r1 r0[12u32].weight into r14 as ValidatorShare.record; - cast r0[13u32].validator r0[13u32].share r1 r0[13u32].weight into r15 as ValidatorShare.record; - cast r0[14u32].validator r0[14u32].share r1 r0[14u32].weight into r16 as ValidatorShare.record; - cast r0[15u32].validator r0[15u32].share r1 r0[15u32].weight into r17 as ValidatorShare.record; - output r2 as ValidatorShare.record; - output r3 as ValidatorShare.record; + cast r0[0u32].validator r0[0u32].share r1 r2 r3 into r4 as ValidatorShare.record; + cast r0[1u32].validator r0[1u32].share r1 r2 r3 into r5 as ValidatorShare.record; + cast r0[2u32].validator r0[2u32].share r1 r2 r3 into r6 as ValidatorShare.record; + cast r0[3u32].validator r0[3u32].share r1 r2 r3 into r7 as ValidatorShare.record; + cast r0[4u32].validator r0[4u32].share r1 r2 r3 into r8 as ValidatorShare.record; + cast r0[5u32].validator r0[5u32].share r1 r2 r3 into r9 as ValidatorShare.record; + cast r0[6u32].validator r0[6u32].share r1 r2 r3 into r10 as ValidatorShare.record; + cast r0[7u32].validator r0[7u32].share r1 r2 r3 into r11 as ValidatorShare.record; + cast r0[8u32].validator r0[8u32].share r1 r2 r3 into r12 as ValidatorShare.record; + cast r0[9u32].validator r0[9u32].share r1 r2 r3 into r13 as ValidatorShare.record; + cast r0[10u32].validator r0[10u32].share r1 r2 r3 into r14 as ValidatorShare.record; + cast r0[11u32].validator r0[11u32].share r1 r2 r3 into r15 as ValidatorShare.record; + cast r0[12u32].validator r0[12u32].share r1 r2 r3 into r16 as ValidatorShare.record; + cast r0[13u32].validator r0[13u32].share r1 r2 r3 into r17 as ValidatorShare.record; + cast r0[14u32].validator r0[14u32].share r1 r2 r3 into r18 as ValidatorShare.record; + cast r0[15u32].validator r0[15u32].share r1 r2 r3 into r19 as ValidatorShare.record; output r4 as ValidatorShare.record; output r5 as ValidatorShare.record; output r6 as ValidatorShare.record; @@ -57,6 +57,10 @@ function submit_shares_to_validators: output r15 as ValidatorShare.record; output r16 as ValidatorShare.record; output r17 as ValidatorShare.record; + output r18 as ValidatorShare.record; + output r19 as ValidatorShare.record; + + function join_shares_as_validator: @@ -67,7 +71,10 @@ function join_shares_as_validator: is.eq r0.share.index r1.share.index into r3; assert.eq r3 true; add r0.share.share_val r1.share.share_val into r4; - cast r4 r0.share.index into r5 as Share; - add r0.weight r1.weight into r6; - cast self.signer r5 r0.custody r6 into r7 as ValidatorShare.record; - output r7 as ValidatorShare.record; + mul r0.share.share_val r1.share.share_val into r5; + ternary r1.is_addition r4 r5 into r6; + cast r6 r0.share.index into r7 as Share; + cast r0.custody_trace r1.custody_trace into r8 as [field; 2u32]; + hash.bhp256 r8 into r9 as field; + cast self.signer r7 r0.custody r9 r1.is_addition into r10 as ValidatorShare.record; + output r10 as ValidatorShare.record; diff --git a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_withdraw_requests.aleo b/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_withdraw_requests.aleo deleted file mode 100644 index 9c9b144..0000000 --- a/examples/nft_marketplace/programs/marketplace_example/build/imports/dcp_withdraw_requests.aleo +++ /dev/null @@ -1,54 +0,0 @@ -program dcp_withdraw_requests.aleo; - -record WithdrawRequest: - owner as address.private; - custody_hash as field.private; - to as address.private; - fee_amount as u64.private; - expected_weight as u64.private; - - -function submit_requests_to_validators: - input r0 as [address; 16u32].public; - input r1 as field.public; - input r2 as address.private; - input r3 as u64.private; - input r4 as u64.public; - assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32] r1 r2 r3 r4 into r5 as WithdrawRequest.record; - cast r0[1u32] r1 r2 r3 r4 into r6 as WithdrawRequest.record; - cast r0[2u32] r1 r2 r3 r4 into r7 as WithdrawRequest.record; - cast r0[3u32] r1 r2 r3 r4 into r8 as WithdrawRequest.record; - cast r0[4u32] r1 r2 r3 r4 into r9 as WithdrawRequest.record; - cast r0[5u32] r1 r2 r3 r4 into r10 as WithdrawRequest.record; - cast r0[6u32] r1 r2 r3 r4 into r11 as WithdrawRequest.record; - cast r0[7u32] r1 r2 r3 r4 into r12 as WithdrawRequest.record; - cast r0[8u32] r1 r2 r3 r4 into r13 as WithdrawRequest.record; - cast r0[9u32] r1 r2 r3 r4 into r14 as WithdrawRequest.record; - cast r0[10u32] r1 r2 r3 r4 into r15 as WithdrawRequest.record; - cast r0[11u32] r1 r2 r3 r4 into r16 as WithdrawRequest.record; - cast r0[12u32] r1 r2 r3 r4 into r17 as WithdrawRequest.record; - cast r0[13u32] r1 r2 r3 r4 into r18 as WithdrawRequest.record; - cast r0[14u32] r1 r2 r3 r4 into r19 as WithdrawRequest.record; - cast r0[15u32] r1 r2 r3 r4 into r20 as WithdrawRequest.record; - output r5 as WithdrawRequest.record; - output r6 as WithdrawRequest.record; - output r7 as WithdrawRequest.record; - output r8 as WithdrawRequest.record; - output r9 as WithdrawRequest.record; - output r10 as WithdrawRequest.record; - output r11 as WithdrawRequest.record; - output r12 as WithdrawRequest.record; - output r13 as WithdrawRequest.record; - output r14 as WithdrawRequest.record; - output r15 as WithdrawRequest.record; - output r16 as WithdrawRequest.record; - output r17 as WithdrawRequest.record; - output r18 as WithdrawRequest.record; - output r19 as WithdrawRequest.record; - output r20 as WithdrawRequest.record; - - -function spend_withdraw_request: - input r0 as WithdrawRequest.record; - assert.eq self.caller dcp_core_protocol.aleo; diff --git a/examples/nft_marketplace/programs/marketplace_example/build/main.aleo b/examples/nft_marketplace/programs/marketplace_example/build/main.aleo index 780b5ea..e2fea2a 100644 --- a/examples/nft_marketplace/programs/marketplace_example/build/main.aleo +++ b/examples/nft_marketplace/programs/marketplace_example/build/main.aleo @@ -1,6 +1,6 @@ import credits.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import dcp_fee_management.aleo; import dcp_core_protocol.aleo; import data_custody_protocol.aleo; @@ -20,7 +20,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -71,18 +70,19 @@ function list: input r2 as field.public; input r3 as scalar.private; input r4 as [field; 15u32].private; - input r5 as [address; 16u32].private; - call arc721_example.aleo/transfer_private_to_public r0 marketplace_example.aleo into r6 r7; - cast r3 into r8 as field; - mul r3 522678458525321116977504528531602186870683848189190546523208313015552693483group into r9; - cast r9 into r10 as address; - cast r10 r0.data r0.edition into r11 as NFTView.record; - hash.bhp256 r0.data into r12 as field; - commit.bhp256 r12 r0.edition into r13 as field; - call data_custody_protocol.aleo/custody_data_as_program r8 r2 r4 r5 8u8 into r14; - async list r13 r1 self.caller r2 r7 r14 into r15; - output r11 as NFTView.record; - output r15 as marketplace_example.aleo/list.future; + input r5 as [address; 16u32].public; + input r6 as scalar.public; + call arc721_example.aleo/transfer_private_to_public r0 marketplace_example.aleo into r7 r8; + cast r3 into r9 as field; + mul r3 522678458525321116977504528531602186870683848189190546523208313015552693483group into r10; + cast r10 into r11 as address; + cast r11 r0.data r0.edition into r12 as NFTView.record; + hash.bhp256 r0.data into r13 as field; + commit.bhp256 r13 r0.edition into r14 as field; + call data_custody_protocol.aleo/add_private r9 r2 r4 r5 8u8 r6 into r15; + async list r14 r1 self.caller r2 r8 r15 into r16; + output r12 as NFTView.record; + output r16 as marketplace_example.aleo/list.future; finalize list: input r0 as field.public; @@ -90,7 +90,7 @@ finalize list: input r2 as address.public; input r3 as field.public; input r4 as arc721_example.aleo/transfer_private_to_public.future; - input r5 as data_custody_protocol.aleo/custody_data_as_program.future; + input r5 as data_custody_protocol.aleo/add_private.future; await r4; await r5; cast r1 r2 r3 into r6 as ListingData; @@ -109,18 +109,20 @@ function accept_listing: input r2 as [address; 16u32].public; input r3 as u64.public; input r4 as credits.aleo/credits.record; - call credits.aleo/transfer_public_as_signer r1.seller r1.price into r5; - call data_custody_protocol.aleo/request_data_as_program r1.dcp_key self.signer 8u8 1u64 r2 r3 r4 into r6 r7; - async accept_listing self.caller r0 r1 r5 r7 into r8; - output r6 as credits.aleo/credits.record; - output r8 as marketplace_example.aleo/accept_listing.future; + input r5 as u32.public; + input r6 as field.public; + call credits.aleo/transfer_public_as_signer r1.seller r1.price into r7; + call data_custody_protocol.aleo/request_open r1.dcp_key self.signer 8u8 r6 r2 r3 r4 r5 into r8 r9; + async accept_listing self.caller r0 r1 r7 r9 into r10; + output r8 as credits.aleo/credits.record; + output r10 as marketplace_example.aleo/accept_listing.future; finalize accept_listing: input r0 as address.public; input r1 as field.public; input r2 as ListingData.public; input r3 as credits.aleo/transfer_public_as_signer.future; - input r4 as data_custody_protocol.aleo/request_data_as_program.future; + input r4 as data_custody_protocol.aleo/request_open.future; get listings[r1] into r5; assert.eq r5 r2; contains listings_buyer[r1] into r6; diff --git a/examples/nft_marketplace/programs/marketplace_example/src/main.leo b/examples/nft_marketplace/programs/marketplace_example/src/main.leo index fae33e3..4ef9dfb 100644 --- a/examples/nft_marketplace/programs/marketplace_example/src/main.leo +++ b/examples/nft_marketplace/programs/marketplace_example/src/main.leo @@ -49,7 +49,7 @@ program marketplace_example.aleo { private secret_random_viewkey: scalar, private privacy_random_coefficients: [field; 15], public validators: [address; 16], - public current_block_height: u32 + public obfuscator: scalar ) -> (NFTView, Future) { let (nft_view, transfer_future): (arc721_example.aleo/NFTView, Future) = arc721_example.aleo/transfer_private_to_public( @@ -65,13 +65,13 @@ program marketplace_example.aleo { let nft_commit: field = commit_nft(nft.data, nft.edition); let custody_data_as_program_future: Future = - data_custody_protocol.aleo/custody_data_as_program( + data_custody_protocol.aleo/add_private( secret, // private data_view_key: scalar, dcp_key, // private custody_key: field, privacy_random_coefficients, // private coefficients: [field; 15], validators, // private validators: [address; 16], MPC_THRESHOLD, // private threshold: u8 <= 15 - current_block_height + obfuscator ); let list_future: Future = finalize_list( @@ -117,6 +117,8 @@ program marketplace_example.aleo { public validators: [address; 16], public validator_fee: u64, private protocol_fee_record: credits.aleo/credits, + public current_block_height: u32, + public custody_trace: field /* Validators associated with the listing can be retrieved using: protocol_validators.aleo/validator_sets.get( @@ -130,6 +132,8 @@ program marketplace_example.aleo { ) ) ) + + = dcp_core_protocol.aleo/custodies.get(custody_hash).custody_trace; */ ) -> (credits.aleo/credits, Future) { let pay_marketplace_future: Future = @@ -140,26 +144,27 @@ program marketplace_example.aleo { let ( change, - request_data_as_program_future + request_open_future ): ( credits.aleo/credits, Future ) = - data_custody_protocol.aleo/request_data_as_program( + data_custody_protocol.aleo/request_open( listing_data.dcp_key, // private data_address: address, self.signer, // private to: address, MPC_THRESHOLD, // private threshold: u8, - 1u64, // public expected_weight: u64, + custody_trace, // public custody_trace: field, validators, // public validators: [address; 16], validator_fee, // private validator_fee: u64, protocol_fee_record, // private protocol_fee_record: credits.aleo/credits, + current_block_height ); let accept_listing_future: Future = finalize_accept_listing( self.caller, nft_commit, listing_data, pay_marketplace_future, - request_data_as_program_future, + request_open_future, ); return (change, accept_listing_future); } @@ -168,7 +173,7 @@ program marketplace_example.aleo { nft_commit: field, listing_data: ListingData, pay_marketplace_future: Future, - request_data_as_program_future: Future + request_open_future: Future ) { let retrieved_listing_data: ListingData = listings.get(nft_commit); assert_eq(retrieved_listing_data, listing_data); @@ -176,7 +181,7 @@ program marketplace_example.aleo { listings_buyer.set(nft_commit, caller); pay_marketplace_future.await(); - request_data_as_program_future.await(); + request_open_future.await(); } diff --git a/programs/data_custody_protocol/build/imports/dcp_core_protocol.aleo b/programs/data_custody_protocol/build/imports/dcp_core_protocol.aleo index 9fe234d..eaa3a16 100644 --- a/programs/data_custody_protocol/build/imports/dcp_core_protocol.aleo +++ b/programs/data_custody_protocol/build/imports/dcp_core_protocol.aleo @@ -1,7 +1,7 @@ import credits.aleo; import dcp_fee_management.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; program dcp_core_protocol.aleo; @@ -18,7 +18,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -29,7 +28,7 @@ struct Proposal: struct CustodyState: validator_set_index as u64; - expected_weight as u64; + custody_trace as field; record DestinationShare: owner as address.private; @@ -339,50 +338,71 @@ finalize accept_proposal: + + function custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async custody_data_as_program r0 r1 into r2; - output r2 as dcp_core_protocol.aleo/custody_data_as_program.future; + async custody_data_as_program r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/custody_data_as_program.future; finalize custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; - cast 0u64 0u64 into r2 as CustodyState; - get.or_use custodies[r0] r2 into r3; - get validator_sets_length[true] into r4; - is.eq r3.expected_weight 0u64 into r5; - sub r4 1u64 into r6; - ternary r5 r6 r3.validator_set_index into r7; - get validator_sets[r7] into r8; - assert.eq r1 r8; - add r3.expected_weight 1u64 into r9; - cast r7 r9 into r10 as CustodyState; - set r10 into custodies[r0]; + input r2 as field.public; + cast 0u64 r2 into r3 as CustodyState; + get.or_use custodies[r0] r3 into r4; + get validator_sets_length[true] into r5; + is.eq r4.custody_trace r2 into r6; + sub r5 1u64 into r7; + ternary r6 r7 r4.validator_set_index into r8; + get validator_sets[r8] into r9; + assert.eq r1 r9; + cast r4.custody_trace r2 into r10 as [field; 2u32]; + hash.bhp256 r10 into r11 as field; + ternary r6 r2 r11 into r12; + cast r8 r12 into r13 as CustodyState; + set r13 into custodies[r0]; -function request_data_as_program: +function request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async request_data_as_program r0 r1 r2 into r3; - output r3 as dcp_core_protocol.aleo/request_data_as_program.future; + async request_open r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/request_open.future; -finalize request_data_as_program: +finalize request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; get custodies[r0] into r3; - assert.eq r2 r3.expected_weight; + assert.eq r2 r3.custody_trace; get validator_sets[r3.validator_set_index] into r4; assert.eq r1 r4; + + +function process_request_as_validator: + input r0 as dcp_validator_shares.aleo/ValidatorShare.record; + input r1 as dcp_open_requests.aleo/OpenRequest.record; + hash.bhp256 r0.custody into r2 as field; + assert.eq r1.custody_hash r2; + cast r1.to r0.share r0.custody into r3 as DestinationShare.record; + call dcp_open_requests.aleo/spend_open_request r1; + call dcp_fee_management.aleo/mint_fee self.caller r1.fee_amount r1.expire into r4; + assert.eq r1.custody_trace r0.custody_trace; + output r3 as DestinationShare.record; + output r4 as dcp_fee_management.aleo/Fee.record; + + function spend_destination_shares: input r0 as DestinationShare.record; input r1 as DestinationShare.record; @@ -407,5 +427,3 @@ function mint_null_destination_share: cast 0field 0field into r1 as Share; cast self.signer r1 r0 into r2 as DestinationShare.record; output r2 as DestinationShare.record; - - diff --git a/programs/data_custody_protocol/build/imports/dcp_fee_management.aleo b/programs/data_custody_protocol/build/imports/dcp_fee_management.aleo index ffc7c7f..52153ca 100644 --- a/programs/data_custody_protocol/build/imports/dcp_fee_management.aleo +++ b/programs/data_custody_protocol/build/imports/dcp_fee_management.aleo @@ -5,26 +5,33 @@ program dcp_fee_management.aleo; record Fee: owner as address.private; microcredits as u64.private; + expire as u32.private; function mint_fee: input r0 as address.public; input r1 as u64.private; + input r2 as u32.private; assert.eq self.caller dcp_core_protocol.aleo; - cast r0 r1 into r2 as Fee.record; - output r2 as Fee.record; + cast r0 r1 r2 into r3 as Fee.record; + output r3 as Fee.record; function burn_fee: input r0 as Fee.record; call credits.aleo/transfer_public r0.owner r0.microcredits into r1; - async burn_fee r1 into r2; + async burn_fee r1 r0.expire into r2; output r2 as dcp_fee_management.aleo/burn_fee.future; finalize burn_fee: input r0 as credits.aleo/transfer_public.future; + input r1 as u32.public; await r0; + gte r1 block.height into r2; + assert.eq r2 true; + + @@ -32,5 +39,7 @@ function join_fee: input r0 as Fee.record; input r1 as Fee.record; add r0.microcredits r1.microcredits into r2; - cast r0.owner r2 into r3 as Fee.record; - output r3 as Fee.record; + lt r0.expire r1.expire into r3; + ternary r3 r0.expire r1.expire into r4; + cast r0.owner r2 r4 into r5 as Fee.record; + output r5 as Fee.record; diff --git a/programs/data_custody_protocol/build/imports/dcp_open_requests.aleo b/programs/data_custody_protocol/build/imports/dcp_open_requests.aleo new file mode 100644 index 0000000..20d8a15 --- /dev/null +++ b/programs/data_custody_protocol/build/imports/dcp_open_requests.aleo @@ -0,0 +1,56 @@ +program dcp_open_requests.aleo; + +record OpenRequest: + owner as address.private; + custody_hash as field.private; + to as address.private; + fee_amount as u64.private; + custody_trace as field.private; + expire as u32.private; + + +function submit_requests_to_validators: + input r0 as [address; 16u32].public; + input r1 as field.public; + input r2 as address.private; + input r3 as u64.private; + input r4 as field.public; + input r5 as u32.public; + assert.eq self.caller data_custody_protocol.aleo; + cast r0[0u32] r1 r2 r3 r4 r5 into r6 as OpenRequest.record; + cast r0[1u32] r1 r2 r3 r4 r5 into r7 as OpenRequest.record; + cast r0[2u32] r1 r2 r3 r4 r5 into r8 as OpenRequest.record; + cast r0[3u32] r1 r2 r3 r4 r5 into r9 as OpenRequest.record; + cast r0[4u32] r1 r2 r3 r4 r5 into r10 as OpenRequest.record; + cast r0[5u32] r1 r2 r3 r4 r5 into r11 as OpenRequest.record; + cast r0[6u32] r1 r2 r3 r4 r5 into r12 as OpenRequest.record; + cast r0[7u32] r1 r2 r3 r4 r5 into r13 as OpenRequest.record; + cast r0[8u32] r1 r2 r3 r4 r5 into r14 as OpenRequest.record; + cast r0[9u32] r1 r2 r3 r4 r5 into r15 as OpenRequest.record; + cast r0[10u32] r1 r2 r3 r4 r5 into r16 as OpenRequest.record; + cast r0[11u32] r1 r2 r3 r4 r5 into r17 as OpenRequest.record; + cast r0[12u32] r1 r2 r3 r4 r5 into r18 as OpenRequest.record; + cast r0[13u32] r1 r2 r3 r4 r5 into r19 as OpenRequest.record; + cast r0[14u32] r1 r2 r3 r4 r5 into r20 as OpenRequest.record; + cast r0[15u32] r1 r2 r3 r4 r5 into r21 as OpenRequest.record; + output r6 as OpenRequest.record; + output r7 as OpenRequest.record; + output r8 as OpenRequest.record; + output r9 as OpenRequest.record; + output r10 as OpenRequest.record; + output r11 as OpenRequest.record; + output r12 as OpenRequest.record; + output r13 as OpenRequest.record; + output r14 as OpenRequest.record; + output r15 as OpenRequest.record; + output r16 as OpenRequest.record; + output r17 as OpenRequest.record; + output r18 as OpenRequest.record; + output r19 as OpenRequest.record; + output r20 as OpenRequest.record; + output r21 as OpenRequest.record; + + +function spend_open_request: + input r0 as OpenRequest.record; + assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/data_custody_protocol/build/imports/dcp_validator_shares.aleo b/programs/data_custody_protocol/build/imports/dcp_validator_shares.aleo index 4ec6922..604611c 100644 --- a/programs/data_custody_protocol/build/imports/dcp_validator_shares.aleo +++ b/programs/data_custody_protocol/build/imports/dcp_validator_shares.aleo @@ -12,37 +12,37 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; record ValidatorShare: owner as address.private; share as Share.private; custody as Custody.private; - weight as u64.private; + custody_trace as field.private; + is_addition as boolean.private; function submit_shares_to_validators: input r0 as [ValidatorShareData; 16u32].private; input r1 as Custody.private; + input r2 as field.private; + input r3 as boolean.private; assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32].validator r0[0u32].share r1 r0[0u32].weight into r2 as ValidatorShare.record; - cast r0[1u32].validator r0[1u32].share r1 r0[1u32].weight into r3 as ValidatorShare.record; - cast r0[2u32].validator r0[2u32].share r1 r0[2u32].weight into r4 as ValidatorShare.record; - cast r0[3u32].validator r0[3u32].share r1 r0[3u32].weight into r5 as ValidatorShare.record; - cast r0[4u32].validator r0[4u32].share r1 r0[4u32].weight into r6 as ValidatorShare.record; - cast r0[5u32].validator r0[5u32].share r1 r0[5u32].weight into r7 as ValidatorShare.record; - cast r0[6u32].validator r0[6u32].share r1 r0[6u32].weight into r8 as ValidatorShare.record; - cast r0[7u32].validator r0[7u32].share r1 r0[7u32].weight into r9 as ValidatorShare.record; - cast r0[8u32].validator r0[8u32].share r1 r0[8u32].weight into r10 as ValidatorShare.record; - cast r0[9u32].validator r0[9u32].share r1 r0[9u32].weight into r11 as ValidatorShare.record; - cast r0[10u32].validator r0[10u32].share r1 r0[10u32].weight into r12 as ValidatorShare.record; - cast r0[11u32].validator r0[11u32].share r1 r0[11u32].weight into r13 as ValidatorShare.record; - cast r0[12u32].validator r0[12u32].share r1 r0[12u32].weight into r14 as ValidatorShare.record; - cast r0[13u32].validator r0[13u32].share r1 r0[13u32].weight into r15 as ValidatorShare.record; - cast r0[14u32].validator r0[14u32].share r1 r0[14u32].weight into r16 as ValidatorShare.record; - cast r0[15u32].validator r0[15u32].share r1 r0[15u32].weight into r17 as ValidatorShare.record; - output r2 as ValidatorShare.record; - output r3 as ValidatorShare.record; + cast r0[0u32].validator r0[0u32].share r1 r2 r3 into r4 as ValidatorShare.record; + cast r0[1u32].validator r0[1u32].share r1 r2 r3 into r5 as ValidatorShare.record; + cast r0[2u32].validator r0[2u32].share r1 r2 r3 into r6 as ValidatorShare.record; + cast r0[3u32].validator r0[3u32].share r1 r2 r3 into r7 as ValidatorShare.record; + cast r0[4u32].validator r0[4u32].share r1 r2 r3 into r8 as ValidatorShare.record; + cast r0[5u32].validator r0[5u32].share r1 r2 r3 into r9 as ValidatorShare.record; + cast r0[6u32].validator r0[6u32].share r1 r2 r3 into r10 as ValidatorShare.record; + cast r0[7u32].validator r0[7u32].share r1 r2 r3 into r11 as ValidatorShare.record; + cast r0[8u32].validator r0[8u32].share r1 r2 r3 into r12 as ValidatorShare.record; + cast r0[9u32].validator r0[9u32].share r1 r2 r3 into r13 as ValidatorShare.record; + cast r0[10u32].validator r0[10u32].share r1 r2 r3 into r14 as ValidatorShare.record; + cast r0[11u32].validator r0[11u32].share r1 r2 r3 into r15 as ValidatorShare.record; + cast r0[12u32].validator r0[12u32].share r1 r2 r3 into r16 as ValidatorShare.record; + cast r0[13u32].validator r0[13u32].share r1 r2 r3 into r17 as ValidatorShare.record; + cast r0[14u32].validator r0[14u32].share r1 r2 r3 into r18 as ValidatorShare.record; + cast r0[15u32].validator r0[15u32].share r1 r2 r3 into r19 as ValidatorShare.record; output r4 as ValidatorShare.record; output r5 as ValidatorShare.record; output r6 as ValidatorShare.record; @@ -57,6 +57,10 @@ function submit_shares_to_validators: output r15 as ValidatorShare.record; output r16 as ValidatorShare.record; output r17 as ValidatorShare.record; + output r18 as ValidatorShare.record; + output r19 as ValidatorShare.record; + + function join_shares_as_validator: @@ -67,7 +71,10 @@ function join_shares_as_validator: is.eq r0.share.index r1.share.index into r3; assert.eq r3 true; add r0.share.share_val r1.share.share_val into r4; - cast r4 r0.share.index into r5 as Share; - add r0.weight r1.weight into r6; - cast self.signer r5 r0.custody r6 into r7 as ValidatorShare.record; - output r7 as ValidatorShare.record; + mul r0.share.share_val r1.share.share_val into r5; + ternary r1.is_addition r4 r5 into r6; + cast r6 r0.share.index into r7 as Share; + cast r0.custody_trace r1.custody_trace into r8 as [field; 2u32]; + hash.bhp256 r8 into r9 as field; + cast self.signer r7 r0.custody r9 r1.is_addition into r10 as ValidatorShare.record; + output r10 as ValidatorShare.record; diff --git a/programs/data_custody_protocol/build/imports/dcp_withdraw_requests.aleo b/programs/data_custody_protocol/build/imports/dcp_withdraw_requests.aleo deleted file mode 100644 index 9c9b144..0000000 --- a/programs/data_custody_protocol/build/imports/dcp_withdraw_requests.aleo +++ /dev/null @@ -1,54 +0,0 @@ -program dcp_withdraw_requests.aleo; - -record WithdrawRequest: - owner as address.private; - custody_hash as field.private; - to as address.private; - fee_amount as u64.private; - expected_weight as u64.private; - - -function submit_requests_to_validators: - input r0 as [address; 16u32].public; - input r1 as field.public; - input r2 as address.private; - input r3 as u64.private; - input r4 as u64.public; - assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32] r1 r2 r3 r4 into r5 as WithdrawRequest.record; - cast r0[1u32] r1 r2 r3 r4 into r6 as WithdrawRequest.record; - cast r0[2u32] r1 r2 r3 r4 into r7 as WithdrawRequest.record; - cast r0[3u32] r1 r2 r3 r4 into r8 as WithdrawRequest.record; - cast r0[4u32] r1 r2 r3 r4 into r9 as WithdrawRequest.record; - cast r0[5u32] r1 r2 r3 r4 into r10 as WithdrawRequest.record; - cast r0[6u32] r1 r2 r3 r4 into r11 as WithdrawRequest.record; - cast r0[7u32] r1 r2 r3 r4 into r12 as WithdrawRequest.record; - cast r0[8u32] r1 r2 r3 r4 into r13 as WithdrawRequest.record; - cast r0[9u32] r1 r2 r3 r4 into r14 as WithdrawRequest.record; - cast r0[10u32] r1 r2 r3 r4 into r15 as WithdrawRequest.record; - cast r0[11u32] r1 r2 r3 r4 into r16 as WithdrawRequest.record; - cast r0[12u32] r1 r2 r3 r4 into r17 as WithdrawRequest.record; - cast r0[13u32] r1 r2 r3 r4 into r18 as WithdrawRequest.record; - cast r0[14u32] r1 r2 r3 r4 into r19 as WithdrawRequest.record; - cast r0[15u32] r1 r2 r3 r4 into r20 as WithdrawRequest.record; - output r5 as WithdrawRequest.record; - output r6 as WithdrawRequest.record; - output r7 as WithdrawRequest.record; - output r8 as WithdrawRequest.record; - output r9 as WithdrawRequest.record; - output r10 as WithdrawRequest.record; - output r11 as WithdrawRequest.record; - output r12 as WithdrawRequest.record; - output r13 as WithdrawRequest.record; - output r14 as WithdrawRequest.record; - output r15 as WithdrawRequest.record; - output r16 as WithdrawRequest.record; - output r17 as WithdrawRequest.record; - output r18 as WithdrawRequest.record; - output r19 as WithdrawRequest.record; - output r20 as WithdrawRequest.record; - - -function spend_withdraw_request: - input r0 as WithdrawRequest.record; - assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/data_custody_protocol/build/main.aleo b/programs/data_custody_protocol/build/main.aleo index 7ec333d..193552d 100644 --- a/programs/data_custody_protocol/build/main.aleo +++ b/programs/data_custody_protocol/build/main.aleo @@ -1,6 +1,6 @@ import credits.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import dcp_fee_management.aleo; import dcp_core_protocol.aleo; program data_custody_protocol.aleo; @@ -18,7 +18,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -29,1564 +28,1637 @@ struct Proposal: current_validator_set_index as u64; +struct Operation: + is_addition as boolean; + operand_value as field; + is_operand_private as boolean; +function request_open: + input r0 as field.private; + input r1 as address.private; + input r2 as u8.private; + input r3 as field.public; + input r4 as [address; 16u32].public; + input r5 as u64.private; + input r6 as credits.aleo/credits.record; + input r7 as u32.public; + cast self.caller r0 r2 into r8 as Custody; + hash.bhp256 r8 into r9 as field; + cast r4[0u32] r4[1u32] r4[2u32] r4[3u32] r4[4u32] r4[5u32] r4[6u32] r4[7u32] r4[8u32] r4[9u32] r4[10u32] r4[11u32] r4[12u32] r4[13u32] r4[14u32] r4[15u32] into r10 as [address; 16u32]; + add r7 60u32 into r11; + add r11 180u32 into r12; + call dcp_open_requests.aleo/submit_requests_to_validators r10 r9 r1 r5 r3 r12 into r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28; + cast 16u8 into r29 as u64; + mul r29 r5 into r30; + call credits.aleo/transfer_private_to_public r6 dcp_fee_management.aleo r30 into r31 r32; + call dcp_core_protocol.aleo/request_open r9 r4 r3 into r33; + async request_open r7 r33 r32 into r34; + output r31 as credits.aleo/credits.record; + output r34 as data_custody_protocol.aleo/request_open.future; + +finalize request_open: + input r0 as u32.public; + input r1 as dcp_core_protocol.aleo/request_open.future; + input r2 as credits.aleo/transfer_private_to_public.future; + lte r0 block.height into r3; + assert.eq r3 true; + add r0 60u32 into r4; + lte block.height r4 into r5; + assert.eq r5 true; + await r1; + await r2; + + + + -function custody_data_as_program: + +function add_private: input r0 as field.private; input r1 as field.private; input r2 as [field; 15u32].private; input r3 as [address; 16u32].public; input r4 as u8.private; - assert.neq self.caller self.signer; - is.eq r2[0u32] 0field into r5; - or false r5 into r6; - is.eq r2[1u32] 0field into r7; - or r6 r7 into r8; - is.eq r2[2u32] 0field into r9; - or r8 r9 into r10; - is.eq r2[3u32] 0field into r11; - or r10 r11 into r12; - is.eq r2[4u32] 0field into r13; - or r12 r13 into r14; - is.eq r2[5u32] 0field into r15; - or r14 r15 into r16; - is.eq r2[6u32] 0field into r17; - or r16 r17 into r18; - is.eq r2[7u32] 0field into r19; - or r18 r19 into r20; - is.eq r2[8u32] 0field into r21; - or r20 r21 into r22; - is.eq r2[9u32] 0field into r23; - or r22 r23 into r24; - is.eq r2[10u32] 0field into r25; - or r24 r25 into r26; - is.eq r2[11u32] 0field into r27; - or r26 r27 into r28; - is.eq r2[12u32] 0field into r29; - or r28 r29 into r30; - is.eq r2[13u32] 0field into r31; - or r30 r31 into r32; - is.eq r2[14u32] 0field into r33; - or r32 r33 into r34; - not r34 into r35; - assert.eq r35 true; - cast self.caller r1 r4 into r36 as Custody; - hash.bhp256 r36 into r37 as field; - mul 1field 1field into r38; - sub r4 1u8 into r39; - lt 0u8 r39 into r40; - mul r2[0u32] r38 into r41; - ternary r40 r41 0field into r42; - add r0 r42 into r43; - mul r38 1field into r44; - sub r4 1u8 into r45; - lt 1u8 r45 into r46; - mul r2[1u32] r44 into r47; - ternary r46 r47 0field into r48; - add r43 r48 into r49; - mul r44 1field into r50; - sub r4 1u8 into r51; - lt 2u8 r51 into r52; - mul r2[2u32] r50 into r53; - ternary r52 r53 0field into r54; - add r49 r54 into r55; - mul r50 1field into r56; - sub r4 1u8 into r57; - lt 3u8 r57 into r58; - mul r2[3u32] r56 into r59; - ternary r58 r59 0field into r60; - add r55 r60 into r61; - mul r56 1field into r62; - sub r4 1u8 into r63; - lt 4u8 r63 into r64; - mul r2[4u32] r62 into r65; - ternary r64 r65 0field into r66; - add r61 r66 into r67; - mul r62 1field into r68; - sub r4 1u8 into r69; - lt 5u8 r69 into r70; - mul r2[5u32] r68 into r71; - ternary r70 r71 0field into r72; - add r67 r72 into r73; - mul r68 1field into r74; - sub r4 1u8 into r75; - lt 6u8 r75 into r76; - mul r2[6u32] r74 into r77; - ternary r76 r77 0field into r78; - add r73 r78 into r79; - mul r74 1field into r80; - sub r4 1u8 into r81; - lt 7u8 r81 into r82; - mul r2[7u32] r80 into r83; - ternary r82 r83 0field into r84; - add r79 r84 into r85; - mul r80 1field into r86; - sub r4 1u8 into r87; - lt 8u8 r87 into r88; - mul r2[8u32] r86 into r89; - ternary r88 r89 0field into r90; - add r85 r90 into r91; - mul r86 1field into r92; - sub r4 1u8 into r93; - lt 9u8 r93 into r94; - mul r2[9u32] r92 into r95; - ternary r94 r95 0field into r96; - add r91 r96 into r97; - mul r92 1field into r98; - sub r4 1u8 into r99; - lt 10u8 r99 into r100; - mul r2[10u32] r98 into r101; - ternary r100 r101 0field into r102; - add r97 r102 into r103; - mul r98 1field into r104; - sub r4 1u8 into r105; - lt 11u8 r105 into r106; - mul r2[11u32] r104 into r107; - ternary r106 r107 0field into r108; - add r103 r108 into r109; - mul r104 1field into r110; - sub r4 1u8 into r111; - lt 12u8 r111 into r112; - mul r2[12u32] r110 into r113; - ternary r112 r113 0field into r114; - add r109 r114 into r115; - mul r110 1field into r116; - sub r4 1u8 into r117; - lt 13u8 r117 into r118; - mul r2[13u32] r116 into r119; - ternary r118 r119 0field into r120; - add r115 r120 into r121; - mul r116 1field into r122; - sub r4 1u8 into r123; - lt 14u8 r123 into r124; - mul r2[14u32] r122 into r125; - ternary r124 r125 0field into r126; - add r121 r126 into r127; - cast r127 1field into r128 as Share; - cast r3[0u32] r128 1u64 into r129 as ValidatorShareData; - mul 1field 2field into r130; - sub r4 1u8 into r131; - lt 0u8 r131 into r132; - mul r2[0u32] r130 into r133; - ternary r132 r133 0field into r134; - add r0 r134 into r135; - mul r130 2field into r136; - sub r4 1u8 into r137; - lt 1u8 r137 into r138; - mul r2[1u32] r136 into r139; - ternary r138 r139 0field into r140; - add r135 r140 into r141; - mul r136 2field into r142; - sub r4 1u8 into r143; - lt 2u8 r143 into r144; - mul r2[2u32] r142 into r145; - ternary r144 r145 0field into r146; - add r141 r146 into r147; - mul r142 2field into r148; - sub r4 1u8 into r149; - lt 3u8 r149 into r150; - mul r2[3u32] r148 into r151; - ternary r150 r151 0field into r152; - add r147 r152 into r153; - mul r148 2field into r154; - sub r4 1u8 into r155; - lt 4u8 r155 into r156; - mul r2[4u32] r154 into r157; - ternary r156 r157 0field into r158; - add r153 r158 into r159; - mul r154 2field into r160; - sub r4 1u8 into r161; - lt 5u8 r161 into r162; - mul r2[5u32] r160 into r163; - ternary r162 r163 0field into r164; - add r159 r164 into r165; - mul r160 2field into r166; - sub r4 1u8 into r167; - lt 6u8 r167 into r168; - mul r2[6u32] r166 into r169; - ternary r168 r169 0field into r170; - add r165 r170 into r171; - mul r166 2field into r172; - sub r4 1u8 into r173; - lt 7u8 r173 into r174; - mul r2[7u32] r172 into r175; - ternary r174 r175 0field into r176; - add r171 r176 into r177; - mul r172 2field into r178; - sub r4 1u8 into r179; - lt 8u8 r179 into r180; - mul r2[8u32] r178 into r181; - ternary r180 r181 0field into r182; - add r177 r182 into r183; - mul r178 2field into r184; - sub r4 1u8 into r185; - lt 9u8 r185 into r186; - mul r2[9u32] r184 into r187; - ternary r186 r187 0field into r188; - add r183 r188 into r189; - mul r184 2field into r190; - sub r4 1u8 into r191; - lt 10u8 r191 into r192; - mul r2[10u32] r190 into r193; - ternary r192 r193 0field into r194; - add r189 r194 into r195; - mul r190 2field into r196; - sub r4 1u8 into r197; - lt 11u8 r197 into r198; - mul r2[11u32] r196 into r199; - ternary r198 r199 0field into r200; - add r195 r200 into r201; - mul r196 2field into r202; - sub r4 1u8 into r203; - lt 12u8 r203 into r204; - mul r2[12u32] r202 into r205; - ternary r204 r205 0field into r206; - add r201 r206 into r207; - mul r202 2field into r208; - sub r4 1u8 into r209; - lt 13u8 r209 into r210; - mul r2[13u32] r208 into r211; - ternary r210 r211 0field into r212; - add r207 r212 into r213; - mul r208 2field into r214; - sub r4 1u8 into r215; - lt 14u8 r215 into r216; - mul r2[14u32] r214 into r217; - ternary r216 r217 0field into r218; - add r213 r218 into r219; - cast r219 2field into r220 as Share; - cast r3[1u32] r220 1u64 into r221 as ValidatorShareData; - mul 1field 3field into r222; - sub r4 1u8 into r223; - lt 0u8 r223 into r224; - mul r2[0u32] r222 into r225; - ternary r224 r225 0field into r226; - add r0 r226 into r227; - mul r222 3field into r228; - sub r4 1u8 into r229; - lt 1u8 r229 into r230; - mul r2[1u32] r228 into r231; - ternary r230 r231 0field into r232; - add r227 r232 into r233; - mul r228 3field into r234; - sub r4 1u8 into r235; - lt 2u8 r235 into r236; - mul r2[2u32] r234 into r237; - ternary r236 r237 0field into r238; - add r233 r238 into r239; - mul r234 3field into r240; - sub r4 1u8 into r241; - lt 3u8 r241 into r242; - mul r2[3u32] r240 into r243; - ternary r242 r243 0field into r244; - add r239 r244 into r245; - mul r240 3field into r246; - sub r4 1u8 into r247; - lt 4u8 r247 into r248; - mul r2[4u32] r246 into r249; - ternary r248 r249 0field into r250; - add r245 r250 into r251; - mul r246 3field into r252; - sub r4 1u8 into r253; - lt 5u8 r253 into r254; - mul r2[5u32] r252 into r255; - ternary r254 r255 0field into r256; - add r251 r256 into r257; - mul r252 3field into r258; - sub r4 1u8 into r259; - lt 6u8 r259 into r260; - mul r2[6u32] r258 into r261; - ternary r260 r261 0field into r262; - add r257 r262 into r263; - mul r258 3field into r264; - sub r4 1u8 into r265; - lt 7u8 r265 into r266; - mul r2[7u32] r264 into r267; - ternary r266 r267 0field into r268; - add r263 r268 into r269; - mul r264 3field into r270; - sub r4 1u8 into r271; - lt 8u8 r271 into r272; - mul r2[8u32] r270 into r273; - ternary r272 r273 0field into r274; - add r269 r274 into r275; - mul r270 3field into r276; - sub r4 1u8 into r277; - lt 9u8 r277 into r278; - mul r2[9u32] r276 into r279; - ternary r278 r279 0field into r280; - add r275 r280 into r281; - mul r276 3field into r282; - sub r4 1u8 into r283; - lt 10u8 r283 into r284; - mul r2[10u32] r282 into r285; - ternary r284 r285 0field into r286; - add r281 r286 into r287; - mul r282 3field into r288; - sub r4 1u8 into r289; - lt 11u8 r289 into r290; - mul r2[11u32] r288 into r291; - ternary r290 r291 0field into r292; - add r287 r292 into r293; - mul r288 3field into r294; - sub r4 1u8 into r295; - lt 12u8 r295 into r296; - mul r2[12u32] r294 into r297; - ternary r296 r297 0field into r298; - add r293 r298 into r299; - mul r294 3field into r300; - sub r4 1u8 into r301; - lt 13u8 r301 into r302; - mul r2[13u32] r300 into r303; - ternary r302 r303 0field into r304; - add r299 r304 into r305; - mul r300 3field into r306; - sub r4 1u8 into r307; - lt 14u8 r307 into r308; - mul r2[14u32] r306 into r309; - ternary r308 r309 0field into r310; - add r305 r310 into r311; - cast r311 3field into r312 as Share; - cast r3[2u32] r312 1u64 into r313 as ValidatorShareData; - mul 1field 4field into r314; - sub r4 1u8 into r315; - lt 0u8 r315 into r316; - mul r2[0u32] r314 into r317; - ternary r316 r317 0field into r318; - add r0 r318 into r319; - mul r314 4field into r320; - sub r4 1u8 into r321; - lt 1u8 r321 into r322; - mul r2[1u32] r320 into r323; - ternary r322 r323 0field into r324; - add r319 r324 into r325; - mul r320 4field into r326; - sub r4 1u8 into r327; - lt 2u8 r327 into r328; - mul r2[2u32] r326 into r329; - ternary r328 r329 0field into r330; - add r325 r330 into r331; - mul r326 4field into r332; - sub r4 1u8 into r333; - lt 3u8 r333 into r334; - mul r2[3u32] r332 into r335; - ternary r334 r335 0field into r336; - add r331 r336 into r337; - mul r332 4field into r338; - sub r4 1u8 into r339; - lt 4u8 r339 into r340; - mul r2[4u32] r338 into r341; - ternary r340 r341 0field into r342; - add r337 r342 into r343; - mul r338 4field into r344; - sub r4 1u8 into r345; - lt 5u8 r345 into r346; - mul r2[5u32] r344 into r347; - ternary r346 r347 0field into r348; - add r343 r348 into r349; - mul r344 4field into r350; - sub r4 1u8 into r351; - lt 6u8 r351 into r352; - mul r2[6u32] r350 into r353; - ternary r352 r353 0field into r354; - add r349 r354 into r355; - mul r350 4field into r356; - sub r4 1u8 into r357; - lt 7u8 r357 into r358; - mul r2[7u32] r356 into r359; - ternary r358 r359 0field into r360; - add r355 r360 into r361; - mul r356 4field into r362; - sub r4 1u8 into r363; - lt 8u8 r363 into r364; - mul r2[8u32] r362 into r365; - ternary r364 r365 0field into r366; - add r361 r366 into r367; - mul r362 4field into r368; - sub r4 1u8 into r369; - lt 9u8 r369 into r370; - mul r2[9u32] r368 into r371; - ternary r370 r371 0field into r372; - add r367 r372 into r373; - mul r368 4field into r374; - sub r4 1u8 into r375; - lt 10u8 r375 into r376; - mul r2[10u32] r374 into r377; - ternary r376 r377 0field into r378; - add r373 r378 into r379; - mul r374 4field into r380; - sub r4 1u8 into r381; - lt 11u8 r381 into r382; - mul r2[11u32] r380 into r383; - ternary r382 r383 0field into r384; - add r379 r384 into r385; - mul r380 4field into r386; - sub r4 1u8 into r387; - lt 12u8 r387 into r388; - mul r2[12u32] r386 into r389; - ternary r388 r389 0field into r390; - add r385 r390 into r391; - mul r386 4field into r392; - sub r4 1u8 into r393; - lt 13u8 r393 into r394; - mul r2[13u32] r392 into r395; - ternary r394 r395 0field into r396; - add r391 r396 into r397; - mul r392 4field into r398; - sub r4 1u8 into r399; - lt 14u8 r399 into r400; - mul r2[14u32] r398 into r401; - ternary r400 r401 0field into r402; - add r397 r402 into r403; - cast r403 4field into r404 as Share; - cast r3[3u32] r404 1u64 into r405 as ValidatorShareData; - mul 1field 5field into r406; - sub r4 1u8 into r407; - lt 0u8 r407 into r408; - mul r2[0u32] r406 into r409; - ternary r408 r409 0field into r410; - add r0 r410 into r411; - mul r406 5field into r412; - sub r4 1u8 into r413; - lt 1u8 r413 into r414; - mul r2[1u32] r412 into r415; - ternary r414 r415 0field into r416; - add r411 r416 into r417; - mul r412 5field into r418; - sub r4 1u8 into r419; - lt 2u8 r419 into r420; - mul r2[2u32] r418 into r421; - ternary r420 r421 0field into r422; - add r417 r422 into r423; - mul r418 5field into r424; - sub r4 1u8 into r425; - lt 3u8 r425 into r426; - mul r2[3u32] r424 into r427; - ternary r426 r427 0field into r428; - add r423 r428 into r429; - mul r424 5field into r430; - sub r4 1u8 into r431; - lt 4u8 r431 into r432; - mul r2[4u32] r430 into r433; - ternary r432 r433 0field into r434; - add r429 r434 into r435; - mul r430 5field into r436; - sub r4 1u8 into r437; - lt 5u8 r437 into r438; - mul r2[5u32] r436 into r439; - ternary r438 r439 0field into r440; - add r435 r440 into r441; - mul r436 5field into r442; - sub r4 1u8 into r443; - lt 6u8 r443 into r444; - mul r2[6u32] r442 into r445; - ternary r444 r445 0field into r446; - add r441 r446 into r447; - mul r442 5field into r448; - sub r4 1u8 into r449; - lt 7u8 r449 into r450; - mul r2[7u32] r448 into r451; - ternary r450 r451 0field into r452; - add r447 r452 into r453; - mul r448 5field into r454; - sub r4 1u8 into r455; - lt 8u8 r455 into r456; - mul r2[8u32] r454 into r457; - ternary r456 r457 0field into r458; - add r453 r458 into r459; - mul r454 5field into r460; - sub r4 1u8 into r461; - lt 9u8 r461 into r462; - mul r2[9u32] r460 into r463; - ternary r462 r463 0field into r464; - add r459 r464 into r465; - mul r460 5field into r466; - sub r4 1u8 into r467; - lt 10u8 r467 into r468; - mul r2[10u32] r466 into r469; - ternary r468 r469 0field into r470; - add r465 r470 into r471; - mul r466 5field into r472; - sub r4 1u8 into r473; - lt 11u8 r473 into r474; - mul r2[11u32] r472 into r475; - ternary r474 r475 0field into r476; - add r471 r476 into r477; - mul r472 5field into r478; - sub r4 1u8 into r479; - lt 12u8 r479 into r480; - mul r2[12u32] r478 into r481; - ternary r480 r481 0field into r482; - add r477 r482 into r483; - mul r478 5field into r484; - sub r4 1u8 into r485; - lt 13u8 r485 into r486; - mul r2[13u32] r484 into r487; - ternary r486 r487 0field into r488; - add r483 r488 into r489; - mul r484 5field into r490; - sub r4 1u8 into r491; - lt 14u8 r491 into r492; - mul r2[14u32] r490 into r493; - ternary r492 r493 0field into r494; - add r489 r494 into r495; - cast r495 5field into r496 as Share; - cast r3[4u32] r496 1u64 into r497 as ValidatorShareData; - mul 1field 6field into r498; - sub r4 1u8 into r499; - lt 0u8 r499 into r500; - mul r2[0u32] r498 into r501; - ternary r500 r501 0field into r502; - add r0 r502 into r503; - mul r498 6field into r504; - sub r4 1u8 into r505; - lt 1u8 r505 into r506; - mul r2[1u32] r504 into r507; - ternary r506 r507 0field into r508; - add r503 r508 into r509; - mul r504 6field into r510; - sub r4 1u8 into r511; - lt 2u8 r511 into r512; - mul r2[2u32] r510 into r513; - ternary r512 r513 0field into r514; - add r509 r514 into r515; - mul r510 6field into r516; - sub r4 1u8 into r517; - lt 3u8 r517 into r518; - mul r2[3u32] r516 into r519; - ternary r518 r519 0field into r520; - add r515 r520 into r521; - mul r516 6field into r522; - sub r4 1u8 into r523; - lt 4u8 r523 into r524; - mul r2[4u32] r522 into r525; - ternary r524 r525 0field into r526; - add r521 r526 into r527; - mul r522 6field into r528; - sub r4 1u8 into r529; - lt 5u8 r529 into r530; - mul r2[5u32] r528 into r531; - ternary r530 r531 0field into r532; - add r527 r532 into r533; - mul r528 6field into r534; - sub r4 1u8 into r535; - lt 6u8 r535 into r536; - mul r2[6u32] r534 into r537; - ternary r536 r537 0field into r538; - add r533 r538 into r539; - mul r534 6field into r540; - sub r4 1u8 into r541; - lt 7u8 r541 into r542; - mul r2[7u32] r540 into r543; - ternary r542 r543 0field into r544; - add r539 r544 into r545; - mul r540 6field into r546; - sub r4 1u8 into r547; - lt 8u8 r547 into r548; - mul r2[8u32] r546 into r549; - ternary r548 r549 0field into r550; - add r545 r550 into r551; - mul r546 6field into r552; - sub r4 1u8 into r553; - lt 9u8 r553 into r554; - mul r2[9u32] r552 into r555; - ternary r554 r555 0field into r556; - add r551 r556 into r557; - mul r552 6field into r558; - sub r4 1u8 into r559; - lt 10u8 r559 into r560; - mul r2[10u32] r558 into r561; - ternary r560 r561 0field into r562; - add r557 r562 into r563; - mul r558 6field into r564; - sub r4 1u8 into r565; - lt 11u8 r565 into r566; - mul r2[11u32] r564 into r567; - ternary r566 r567 0field into r568; - add r563 r568 into r569; - mul r564 6field into r570; - sub r4 1u8 into r571; - lt 12u8 r571 into r572; - mul r2[12u32] r570 into r573; - ternary r572 r573 0field into r574; - add r569 r574 into r575; - mul r570 6field into r576; - sub r4 1u8 into r577; - lt 13u8 r577 into r578; - mul r2[13u32] r576 into r579; - ternary r578 r579 0field into r580; - add r575 r580 into r581; - mul r576 6field into r582; - sub r4 1u8 into r583; - lt 14u8 r583 into r584; - mul r2[14u32] r582 into r585; - ternary r584 r585 0field into r586; - add r581 r586 into r587; - cast r587 6field into r588 as Share; - cast r3[5u32] r588 1u64 into r589 as ValidatorShareData; - mul 1field 7field into r590; - sub r4 1u8 into r591; - lt 0u8 r591 into r592; - mul r2[0u32] r590 into r593; - ternary r592 r593 0field into r594; - add r0 r594 into r595; - mul r590 7field into r596; - sub r4 1u8 into r597; - lt 1u8 r597 into r598; - mul r2[1u32] r596 into r599; - ternary r598 r599 0field into r600; - add r595 r600 into r601; - mul r596 7field into r602; - sub r4 1u8 into r603; - lt 2u8 r603 into r604; - mul r2[2u32] r602 into r605; - ternary r604 r605 0field into r606; - add r601 r606 into r607; - mul r602 7field into r608; - sub r4 1u8 into r609; - lt 3u8 r609 into r610; - mul r2[3u32] r608 into r611; - ternary r610 r611 0field into r612; - add r607 r612 into r613; - mul r608 7field into r614; - sub r4 1u8 into r615; - lt 4u8 r615 into r616; - mul r2[4u32] r614 into r617; - ternary r616 r617 0field into r618; - add r613 r618 into r619; - mul r614 7field into r620; - sub r4 1u8 into r621; - lt 5u8 r621 into r622; - mul r2[5u32] r620 into r623; - ternary r622 r623 0field into r624; - add r619 r624 into r625; - mul r620 7field into r626; - sub r4 1u8 into r627; - lt 6u8 r627 into r628; - mul r2[6u32] r626 into r629; - ternary r628 r629 0field into r630; - add r625 r630 into r631; - mul r626 7field into r632; - sub r4 1u8 into r633; - lt 7u8 r633 into r634; - mul r2[7u32] r632 into r635; - ternary r634 r635 0field into r636; - add r631 r636 into r637; - mul r632 7field into r638; - sub r4 1u8 into r639; - lt 8u8 r639 into r640; - mul r2[8u32] r638 into r641; - ternary r640 r641 0field into r642; - add r637 r642 into r643; - mul r638 7field into r644; - sub r4 1u8 into r645; - lt 9u8 r645 into r646; - mul r2[9u32] r644 into r647; - ternary r646 r647 0field into r648; - add r643 r648 into r649; - mul r644 7field into r650; - sub r4 1u8 into r651; - lt 10u8 r651 into r652; - mul r2[10u32] r650 into r653; - ternary r652 r653 0field into r654; - add r649 r654 into r655; - mul r650 7field into r656; - sub r4 1u8 into r657; - lt 11u8 r657 into r658; - mul r2[11u32] r656 into r659; - ternary r658 r659 0field into r660; - add r655 r660 into r661; - mul r656 7field into r662; - sub r4 1u8 into r663; - lt 12u8 r663 into r664; - mul r2[12u32] r662 into r665; - ternary r664 r665 0field into r666; - add r661 r666 into r667; - mul r662 7field into r668; - sub r4 1u8 into r669; - lt 13u8 r669 into r670; - mul r2[13u32] r668 into r671; - ternary r670 r671 0field into r672; - add r667 r672 into r673; - mul r668 7field into r674; - sub r4 1u8 into r675; - lt 14u8 r675 into r676; - mul r2[14u32] r674 into r677; - ternary r676 r677 0field into r678; - add r673 r678 into r679; - cast r679 7field into r680 as Share; - cast r3[6u32] r680 1u64 into r681 as ValidatorShareData; - mul 1field 8field into r682; - sub r4 1u8 into r683; - lt 0u8 r683 into r684; - mul r2[0u32] r682 into r685; - ternary r684 r685 0field into r686; - add r0 r686 into r687; - mul r682 8field into r688; - sub r4 1u8 into r689; - lt 1u8 r689 into r690; - mul r2[1u32] r688 into r691; - ternary r690 r691 0field into r692; - add r687 r692 into r693; - mul r688 8field into r694; - sub r4 1u8 into r695; - lt 2u8 r695 into r696; - mul r2[2u32] r694 into r697; - ternary r696 r697 0field into r698; - add r693 r698 into r699; - mul r694 8field into r700; - sub r4 1u8 into r701; - lt 3u8 r701 into r702; - mul r2[3u32] r700 into r703; - ternary r702 r703 0field into r704; - add r699 r704 into r705; - mul r700 8field into r706; - sub r4 1u8 into r707; - lt 4u8 r707 into r708; - mul r2[4u32] r706 into r709; - ternary r708 r709 0field into r710; - add r705 r710 into r711; - mul r706 8field into r712; - sub r4 1u8 into r713; - lt 5u8 r713 into r714; - mul r2[5u32] r712 into r715; - ternary r714 r715 0field into r716; - add r711 r716 into r717; - mul r712 8field into r718; - sub r4 1u8 into r719; - lt 6u8 r719 into r720; - mul r2[6u32] r718 into r721; - ternary r720 r721 0field into r722; - add r717 r722 into r723; - mul r718 8field into r724; - sub r4 1u8 into r725; - lt 7u8 r725 into r726; - mul r2[7u32] r724 into r727; - ternary r726 r727 0field into r728; - add r723 r728 into r729; - mul r724 8field into r730; - sub r4 1u8 into r731; - lt 8u8 r731 into r732; - mul r2[8u32] r730 into r733; - ternary r732 r733 0field into r734; - add r729 r734 into r735; - mul r730 8field into r736; - sub r4 1u8 into r737; - lt 9u8 r737 into r738; - mul r2[9u32] r736 into r739; - ternary r738 r739 0field into r740; - add r735 r740 into r741; - mul r736 8field into r742; - sub r4 1u8 into r743; - lt 10u8 r743 into r744; - mul r2[10u32] r742 into r745; - ternary r744 r745 0field into r746; - add r741 r746 into r747; - mul r742 8field into r748; - sub r4 1u8 into r749; - lt 11u8 r749 into r750; - mul r2[11u32] r748 into r751; - ternary r750 r751 0field into r752; - add r747 r752 into r753; - mul r748 8field into r754; - sub r4 1u8 into r755; - lt 12u8 r755 into r756; - mul r2[12u32] r754 into r757; - ternary r756 r757 0field into r758; - add r753 r758 into r759; - mul r754 8field into r760; - sub r4 1u8 into r761; - lt 13u8 r761 into r762; - mul r2[13u32] r760 into r763; - ternary r762 r763 0field into r764; - add r759 r764 into r765; - mul r760 8field into r766; - sub r4 1u8 into r767; - lt 14u8 r767 into r768; - mul r2[14u32] r766 into r769; - ternary r768 r769 0field into r770; - add r765 r770 into r771; - cast r771 8field into r772 as Share; - cast r3[7u32] r772 1u64 into r773 as ValidatorShareData; - mul 1field 9field into r774; - sub r4 1u8 into r775; - lt 0u8 r775 into r776; - mul r2[0u32] r774 into r777; - ternary r776 r777 0field into r778; - add r0 r778 into r779; - mul r774 9field into r780; - sub r4 1u8 into r781; - lt 1u8 r781 into r782; - mul r2[1u32] r780 into r783; - ternary r782 r783 0field into r784; - add r779 r784 into r785; - mul r780 9field into r786; - sub r4 1u8 into r787; - lt 2u8 r787 into r788; - mul r2[2u32] r786 into r789; - ternary r788 r789 0field into r790; - add r785 r790 into r791; - mul r786 9field into r792; - sub r4 1u8 into r793; - lt 3u8 r793 into r794; - mul r2[3u32] r792 into r795; - ternary r794 r795 0field into r796; - add r791 r796 into r797; - mul r792 9field into r798; - sub r4 1u8 into r799; - lt 4u8 r799 into r800; - mul r2[4u32] r798 into r801; - ternary r800 r801 0field into r802; - add r797 r802 into r803; - mul r798 9field into r804; - sub r4 1u8 into r805; - lt 5u8 r805 into r806; - mul r2[5u32] r804 into r807; - ternary r806 r807 0field into r808; - add r803 r808 into r809; - mul r804 9field into r810; - sub r4 1u8 into r811; - lt 6u8 r811 into r812; - mul r2[6u32] r810 into r813; - ternary r812 r813 0field into r814; - add r809 r814 into r815; - mul r810 9field into r816; - sub r4 1u8 into r817; - lt 7u8 r817 into r818; - mul r2[7u32] r816 into r819; - ternary r818 r819 0field into r820; - add r815 r820 into r821; - mul r816 9field into r822; - sub r4 1u8 into r823; - lt 8u8 r823 into r824; - mul r2[8u32] r822 into r825; - ternary r824 r825 0field into r826; - add r821 r826 into r827; - mul r822 9field into r828; - sub r4 1u8 into r829; - lt 9u8 r829 into r830; - mul r2[9u32] r828 into r831; - ternary r830 r831 0field into r832; - add r827 r832 into r833; - mul r828 9field into r834; - sub r4 1u8 into r835; - lt 10u8 r835 into r836; - mul r2[10u32] r834 into r837; - ternary r836 r837 0field into r838; - add r833 r838 into r839; - mul r834 9field into r840; - sub r4 1u8 into r841; - lt 11u8 r841 into r842; - mul r2[11u32] r840 into r843; - ternary r842 r843 0field into r844; - add r839 r844 into r845; - mul r840 9field into r846; - sub r4 1u8 into r847; - lt 12u8 r847 into r848; - mul r2[12u32] r846 into r849; - ternary r848 r849 0field into r850; - add r845 r850 into r851; - mul r846 9field into r852; - sub r4 1u8 into r853; - lt 13u8 r853 into r854; - mul r2[13u32] r852 into r855; - ternary r854 r855 0field into r856; - add r851 r856 into r857; - mul r852 9field into r858; - sub r4 1u8 into r859; - lt 14u8 r859 into r860; - mul r2[14u32] r858 into r861; - ternary r860 r861 0field into r862; - add r857 r862 into r863; - cast r863 9field into r864 as Share; - cast r3[8u32] r864 1u64 into r865 as ValidatorShareData; - mul 1field 10field into r866; - sub r4 1u8 into r867; - lt 0u8 r867 into r868; - mul r2[0u32] r866 into r869; - ternary r868 r869 0field into r870; - add r0 r870 into r871; - mul r866 10field into r872; - sub r4 1u8 into r873; - lt 1u8 r873 into r874; - mul r2[1u32] r872 into r875; - ternary r874 r875 0field into r876; - add r871 r876 into r877; - mul r872 10field into r878; - sub r4 1u8 into r879; - lt 2u8 r879 into r880; - mul r2[2u32] r878 into r881; - ternary r880 r881 0field into r882; - add r877 r882 into r883; - mul r878 10field into r884; - sub r4 1u8 into r885; - lt 3u8 r885 into r886; - mul r2[3u32] r884 into r887; - ternary r886 r887 0field into r888; - add r883 r888 into r889; - mul r884 10field into r890; - sub r4 1u8 into r891; - lt 4u8 r891 into r892; - mul r2[4u32] r890 into r893; - ternary r892 r893 0field into r894; - add r889 r894 into r895; - mul r890 10field into r896; - sub r4 1u8 into r897; - lt 5u8 r897 into r898; - mul r2[5u32] r896 into r899; - ternary r898 r899 0field into r900; - add r895 r900 into r901; - mul r896 10field into r902; - sub r4 1u8 into r903; - lt 6u8 r903 into r904; - mul r2[6u32] r902 into r905; - ternary r904 r905 0field into r906; - add r901 r906 into r907; - mul r902 10field into r908; - sub r4 1u8 into r909; - lt 7u8 r909 into r910; - mul r2[7u32] r908 into r911; - ternary r910 r911 0field into r912; - add r907 r912 into r913; - mul r908 10field into r914; - sub r4 1u8 into r915; - lt 8u8 r915 into r916; - mul r2[8u32] r914 into r917; - ternary r916 r917 0field into r918; - add r913 r918 into r919; - mul r914 10field into r920; - sub r4 1u8 into r921; - lt 9u8 r921 into r922; - mul r2[9u32] r920 into r923; - ternary r922 r923 0field into r924; - add r919 r924 into r925; - mul r920 10field into r926; - sub r4 1u8 into r927; - lt 10u8 r927 into r928; - mul r2[10u32] r926 into r929; - ternary r928 r929 0field into r930; - add r925 r930 into r931; - mul r926 10field into r932; - sub r4 1u8 into r933; - lt 11u8 r933 into r934; - mul r2[11u32] r932 into r935; - ternary r934 r935 0field into r936; - add r931 r936 into r937; - mul r932 10field into r938; - sub r4 1u8 into r939; - lt 12u8 r939 into r940; - mul r2[12u32] r938 into r941; - ternary r940 r941 0field into r942; - add r937 r942 into r943; - mul r938 10field into r944; - sub r4 1u8 into r945; - lt 13u8 r945 into r946; - mul r2[13u32] r944 into r947; - ternary r946 r947 0field into r948; - add r943 r948 into r949; - mul r944 10field into r950; - sub r4 1u8 into r951; - lt 14u8 r951 into r952; - mul r2[14u32] r950 into r953; - ternary r952 r953 0field into r954; - add r949 r954 into r955; - cast r955 10field into r956 as Share; - cast r3[9u32] r956 1u64 into r957 as ValidatorShareData; - mul 1field 11field into r958; - sub r4 1u8 into r959; - lt 0u8 r959 into r960; - mul r2[0u32] r958 into r961; - ternary r960 r961 0field into r962; - add r0 r962 into r963; - mul r958 11field into r964; - sub r4 1u8 into r965; - lt 1u8 r965 into r966; - mul r2[1u32] r964 into r967; - ternary r966 r967 0field into r968; - add r963 r968 into r969; - mul r964 11field into r970; - sub r4 1u8 into r971; - lt 2u8 r971 into r972; - mul r2[2u32] r970 into r973; - ternary r972 r973 0field into r974; - add r969 r974 into r975; - mul r970 11field into r976; - sub r4 1u8 into r977; - lt 3u8 r977 into r978; - mul r2[3u32] r976 into r979; - ternary r978 r979 0field into r980; - add r975 r980 into r981; - mul r976 11field into r982; - sub r4 1u8 into r983; - lt 4u8 r983 into r984; - mul r2[4u32] r982 into r985; - ternary r984 r985 0field into r986; - add r981 r986 into r987; - mul r982 11field into r988; - sub r4 1u8 into r989; - lt 5u8 r989 into r990; - mul r2[5u32] r988 into r991; - ternary r990 r991 0field into r992; - add r987 r992 into r993; - mul r988 11field into r994; - sub r4 1u8 into r995; - lt 6u8 r995 into r996; - mul r2[6u32] r994 into r997; - ternary r996 r997 0field into r998; - add r993 r998 into r999; - mul r994 11field into r1000; - sub r4 1u8 into r1001; - lt 7u8 r1001 into r1002; - mul r2[7u32] r1000 into r1003; - ternary r1002 r1003 0field into r1004; - add r999 r1004 into r1005; - mul r1000 11field into r1006; - sub r4 1u8 into r1007; - lt 8u8 r1007 into r1008; - mul r2[8u32] r1006 into r1009; - ternary r1008 r1009 0field into r1010; - add r1005 r1010 into r1011; - mul r1006 11field into r1012; - sub r4 1u8 into r1013; - lt 9u8 r1013 into r1014; - mul r2[9u32] r1012 into r1015; - ternary r1014 r1015 0field into r1016; - add r1011 r1016 into r1017; - mul r1012 11field into r1018; - sub r4 1u8 into r1019; - lt 10u8 r1019 into r1020; - mul r2[10u32] r1018 into r1021; - ternary r1020 r1021 0field into r1022; - add r1017 r1022 into r1023; - mul r1018 11field into r1024; - sub r4 1u8 into r1025; - lt 11u8 r1025 into r1026; - mul r2[11u32] r1024 into r1027; - ternary r1026 r1027 0field into r1028; - add r1023 r1028 into r1029; - mul r1024 11field into r1030; - sub r4 1u8 into r1031; - lt 12u8 r1031 into r1032; - mul r2[12u32] r1030 into r1033; - ternary r1032 r1033 0field into r1034; - add r1029 r1034 into r1035; - mul r1030 11field into r1036; - sub r4 1u8 into r1037; - lt 13u8 r1037 into r1038; - mul r2[13u32] r1036 into r1039; - ternary r1038 r1039 0field into r1040; - add r1035 r1040 into r1041; - mul r1036 11field into r1042; - sub r4 1u8 into r1043; - lt 14u8 r1043 into r1044; - mul r2[14u32] r1042 into r1045; - ternary r1044 r1045 0field into r1046; - add r1041 r1046 into r1047; - cast r1047 11field into r1048 as Share; - cast r3[10u32] r1048 1u64 into r1049 as ValidatorShareData; - mul 1field 12field into r1050; - sub r4 1u8 into r1051; - lt 0u8 r1051 into r1052; - mul r2[0u32] r1050 into r1053; - ternary r1052 r1053 0field into r1054; - add r0 r1054 into r1055; - mul r1050 12field into r1056; - sub r4 1u8 into r1057; - lt 1u8 r1057 into r1058; - mul r2[1u32] r1056 into r1059; - ternary r1058 r1059 0field into r1060; - add r1055 r1060 into r1061; - mul r1056 12field into r1062; - sub r4 1u8 into r1063; - lt 2u8 r1063 into r1064; - mul r2[2u32] r1062 into r1065; - ternary r1064 r1065 0field into r1066; - add r1061 r1066 into r1067; - mul r1062 12field into r1068; - sub r4 1u8 into r1069; - lt 3u8 r1069 into r1070; - mul r2[3u32] r1068 into r1071; - ternary r1070 r1071 0field into r1072; - add r1067 r1072 into r1073; - mul r1068 12field into r1074; - sub r4 1u8 into r1075; - lt 4u8 r1075 into r1076; - mul r2[4u32] r1074 into r1077; - ternary r1076 r1077 0field into r1078; - add r1073 r1078 into r1079; - mul r1074 12field into r1080; - sub r4 1u8 into r1081; - lt 5u8 r1081 into r1082; - mul r2[5u32] r1080 into r1083; - ternary r1082 r1083 0field into r1084; - add r1079 r1084 into r1085; - mul r1080 12field into r1086; - sub r4 1u8 into r1087; - lt 6u8 r1087 into r1088; - mul r2[6u32] r1086 into r1089; - ternary r1088 r1089 0field into r1090; - add r1085 r1090 into r1091; - mul r1086 12field into r1092; - sub r4 1u8 into r1093; - lt 7u8 r1093 into r1094; - mul r2[7u32] r1092 into r1095; - ternary r1094 r1095 0field into r1096; - add r1091 r1096 into r1097; - mul r1092 12field into r1098; - sub r4 1u8 into r1099; - lt 8u8 r1099 into r1100; - mul r2[8u32] r1098 into r1101; - ternary r1100 r1101 0field into r1102; - add r1097 r1102 into r1103; - mul r1098 12field into r1104; - sub r4 1u8 into r1105; - lt 9u8 r1105 into r1106; - mul r2[9u32] r1104 into r1107; - ternary r1106 r1107 0field into r1108; - add r1103 r1108 into r1109; - mul r1104 12field into r1110; - sub r4 1u8 into r1111; - lt 10u8 r1111 into r1112; - mul r2[10u32] r1110 into r1113; - ternary r1112 r1113 0field into r1114; - add r1109 r1114 into r1115; - mul r1110 12field into r1116; - sub r4 1u8 into r1117; - lt 11u8 r1117 into r1118; - mul r2[11u32] r1116 into r1119; - ternary r1118 r1119 0field into r1120; - add r1115 r1120 into r1121; - mul r1116 12field into r1122; - sub r4 1u8 into r1123; - lt 12u8 r1123 into r1124; - mul r2[12u32] r1122 into r1125; - ternary r1124 r1125 0field into r1126; - add r1121 r1126 into r1127; - mul r1122 12field into r1128; - sub r4 1u8 into r1129; - lt 13u8 r1129 into r1130; - mul r2[13u32] r1128 into r1131; - ternary r1130 r1131 0field into r1132; - add r1127 r1132 into r1133; - mul r1128 12field into r1134; - sub r4 1u8 into r1135; - lt 14u8 r1135 into r1136; - mul r2[14u32] r1134 into r1137; - ternary r1136 r1137 0field into r1138; - add r1133 r1138 into r1139; - cast r1139 12field into r1140 as Share; - cast r3[11u32] r1140 1u64 into r1141 as ValidatorShareData; - mul 1field 13field into r1142; - sub r4 1u8 into r1143; - lt 0u8 r1143 into r1144; - mul r2[0u32] r1142 into r1145; - ternary r1144 r1145 0field into r1146; - add r0 r1146 into r1147; - mul r1142 13field into r1148; - sub r4 1u8 into r1149; - lt 1u8 r1149 into r1150; - mul r2[1u32] r1148 into r1151; - ternary r1150 r1151 0field into r1152; - add r1147 r1152 into r1153; - mul r1148 13field into r1154; - sub r4 1u8 into r1155; - lt 2u8 r1155 into r1156; - mul r2[2u32] r1154 into r1157; - ternary r1156 r1157 0field into r1158; - add r1153 r1158 into r1159; - mul r1154 13field into r1160; - sub r4 1u8 into r1161; - lt 3u8 r1161 into r1162; - mul r2[3u32] r1160 into r1163; - ternary r1162 r1163 0field into r1164; - add r1159 r1164 into r1165; - mul r1160 13field into r1166; - sub r4 1u8 into r1167; - lt 4u8 r1167 into r1168; - mul r2[4u32] r1166 into r1169; - ternary r1168 r1169 0field into r1170; - add r1165 r1170 into r1171; - mul r1166 13field into r1172; - sub r4 1u8 into r1173; - lt 5u8 r1173 into r1174; - mul r2[5u32] r1172 into r1175; - ternary r1174 r1175 0field into r1176; - add r1171 r1176 into r1177; - mul r1172 13field into r1178; - sub r4 1u8 into r1179; - lt 6u8 r1179 into r1180; - mul r2[6u32] r1178 into r1181; - ternary r1180 r1181 0field into r1182; - add r1177 r1182 into r1183; - mul r1178 13field into r1184; - sub r4 1u8 into r1185; - lt 7u8 r1185 into r1186; - mul r2[7u32] r1184 into r1187; - ternary r1186 r1187 0field into r1188; - add r1183 r1188 into r1189; - mul r1184 13field into r1190; - sub r4 1u8 into r1191; - lt 8u8 r1191 into r1192; - mul r2[8u32] r1190 into r1193; - ternary r1192 r1193 0field into r1194; - add r1189 r1194 into r1195; - mul r1190 13field into r1196; - sub r4 1u8 into r1197; - lt 9u8 r1197 into r1198; - mul r2[9u32] r1196 into r1199; - ternary r1198 r1199 0field into r1200; - add r1195 r1200 into r1201; - mul r1196 13field into r1202; - sub r4 1u8 into r1203; - lt 10u8 r1203 into r1204; - mul r2[10u32] r1202 into r1205; - ternary r1204 r1205 0field into r1206; - add r1201 r1206 into r1207; - mul r1202 13field into r1208; - sub r4 1u8 into r1209; - lt 11u8 r1209 into r1210; - mul r2[11u32] r1208 into r1211; - ternary r1210 r1211 0field into r1212; - add r1207 r1212 into r1213; - mul r1208 13field into r1214; - sub r4 1u8 into r1215; - lt 12u8 r1215 into r1216; - mul r2[12u32] r1214 into r1217; - ternary r1216 r1217 0field into r1218; - add r1213 r1218 into r1219; - mul r1214 13field into r1220; - sub r4 1u8 into r1221; - lt 13u8 r1221 into r1222; - mul r2[13u32] r1220 into r1223; - ternary r1222 r1223 0field into r1224; - add r1219 r1224 into r1225; - mul r1220 13field into r1226; - sub r4 1u8 into r1227; - lt 14u8 r1227 into r1228; - mul r2[14u32] r1226 into r1229; - ternary r1228 r1229 0field into r1230; - add r1225 r1230 into r1231; - cast r1231 13field into r1232 as Share; - cast r3[12u32] r1232 1u64 into r1233 as ValidatorShareData; - mul 1field 14field into r1234; - sub r4 1u8 into r1235; - lt 0u8 r1235 into r1236; - mul r2[0u32] r1234 into r1237; - ternary r1236 r1237 0field into r1238; - add r0 r1238 into r1239; - mul r1234 14field into r1240; - sub r4 1u8 into r1241; - lt 1u8 r1241 into r1242; - mul r2[1u32] r1240 into r1243; - ternary r1242 r1243 0field into r1244; - add r1239 r1244 into r1245; - mul r1240 14field into r1246; - sub r4 1u8 into r1247; - lt 2u8 r1247 into r1248; - mul r2[2u32] r1246 into r1249; - ternary r1248 r1249 0field into r1250; - add r1245 r1250 into r1251; - mul r1246 14field into r1252; - sub r4 1u8 into r1253; - lt 3u8 r1253 into r1254; - mul r2[3u32] r1252 into r1255; - ternary r1254 r1255 0field into r1256; - add r1251 r1256 into r1257; - mul r1252 14field into r1258; - sub r4 1u8 into r1259; - lt 4u8 r1259 into r1260; - mul r2[4u32] r1258 into r1261; - ternary r1260 r1261 0field into r1262; - add r1257 r1262 into r1263; - mul r1258 14field into r1264; - sub r4 1u8 into r1265; - lt 5u8 r1265 into r1266; - mul r2[5u32] r1264 into r1267; - ternary r1266 r1267 0field into r1268; - add r1263 r1268 into r1269; - mul r1264 14field into r1270; - sub r4 1u8 into r1271; - lt 6u8 r1271 into r1272; - mul r2[6u32] r1270 into r1273; - ternary r1272 r1273 0field into r1274; - add r1269 r1274 into r1275; - mul r1270 14field into r1276; - sub r4 1u8 into r1277; - lt 7u8 r1277 into r1278; - mul r2[7u32] r1276 into r1279; - ternary r1278 r1279 0field into r1280; - add r1275 r1280 into r1281; - mul r1276 14field into r1282; - sub r4 1u8 into r1283; - lt 8u8 r1283 into r1284; - mul r2[8u32] r1282 into r1285; - ternary r1284 r1285 0field into r1286; - add r1281 r1286 into r1287; - mul r1282 14field into r1288; - sub r4 1u8 into r1289; - lt 9u8 r1289 into r1290; - mul r2[9u32] r1288 into r1291; - ternary r1290 r1291 0field into r1292; - add r1287 r1292 into r1293; - mul r1288 14field into r1294; - sub r4 1u8 into r1295; - lt 10u8 r1295 into r1296; - mul r2[10u32] r1294 into r1297; - ternary r1296 r1297 0field into r1298; - add r1293 r1298 into r1299; - mul r1294 14field into r1300; - sub r4 1u8 into r1301; - lt 11u8 r1301 into r1302; - mul r2[11u32] r1300 into r1303; - ternary r1302 r1303 0field into r1304; - add r1299 r1304 into r1305; - mul r1300 14field into r1306; - sub r4 1u8 into r1307; - lt 12u8 r1307 into r1308; - mul r2[12u32] r1306 into r1309; - ternary r1308 r1309 0field into r1310; - add r1305 r1310 into r1311; - mul r1306 14field into r1312; - sub r4 1u8 into r1313; - lt 13u8 r1313 into r1314; - mul r2[13u32] r1312 into r1315; - ternary r1314 r1315 0field into r1316; - add r1311 r1316 into r1317; - mul r1312 14field into r1318; - sub r4 1u8 into r1319; - lt 14u8 r1319 into r1320; - mul r2[14u32] r1318 into r1321; - ternary r1320 r1321 0field into r1322; - add r1317 r1322 into r1323; - cast r1323 14field into r1324 as Share; - cast r3[13u32] r1324 1u64 into r1325 as ValidatorShareData; - mul 1field 15field into r1326; - sub r4 1u8 into r1327; - lt 0u8 r1327 into r1328; - mul r2[0u32] r1326 into r1329; - ternary r1328 r1329 0field into r1330; - add r0 r1330 into r1331; - mul r1326 15field into r1332; - sub r4 1u8 into r1333; - lt 1u8 r1333 into r1334; - mul r2[1u32] r1332 into r1335; - ternary r1334 r1335 0field into r1336; - add r1331 r1336 into r1337; - mul r1332 15field into r1338; - sub r4 1u8 into r1339; - lt 2u8 r1339 into r1340; - mul r2[2u32] r1338 into r1341; - ternary r1340 r1341 0field into r1342; - add r1337 r1342 into r1343; - mul r1338 15field into r1344; - sub r4 1u8 into r1345; - lt 3u8 r1345 into r1346; - mul r2[3u32] r1344 into r1347; - ternary r1346 r1347 0field into r1348; - add r1343 r1348 into r1349; - mul r1344 15field into r1350; - sub r4 1u8 into r1351; - lt 4u8 r1351 into r1352; - mul r2[4u32] r1350 into r1353; - ternary r1352 r1353 0field into r1354; - add r1349 r1354 into r1355; - mul r1350 15field into r1356; - sub r4 1u8 into r1357; - lt 5u8 r1357 into r1358; - mul r2[5u32] r1356 into r1359; - ternary r1358 r1359 0field into r1360; - add r1355 r1360 into r1361; - mul r1356 15field into r1362; - sub r4 1u8 into r1363; - lt 6u8 r1363 into r1364; - mul r2[6u32] r1362 into r1365; - ternary r1364 r1365 0field into r1366; - add r1361 r1366 into r1367; - mul r1362 15field into r1368; - sub r4 1u8 into r1369; - lt 7u8 r1369 into r1370; - mul r2[7u32] r1368 into r1371; - ternary r1370 r1371 0field into r1372; - add r1367 r1372 into r1373; - mul r1368 15field into r1374; - sub r4 1u8 into r1375; - lt 8u8 r1375 into r1376; - mul r2[8u32] r1374 into r1377; - ternary r1376 r1377 0field into r1378; - add r1373 r1378 into r1379; - mul r1374 15field into r1380; - sub r4 1u8 into r1381; - lt 9u8 r1381 into r1382; - mul r2[9u32] r1380 into r1383; - ternary r1382 r1383 0field into r1384; - add r1379 r1384 into r1385; - mul r1380 15field into r1386; - sub r4 1u8 into r1387; - lt 10u8 r1387 into r1388; - mul r2[10u32] r1386 into r1389; - ternary r1388 r1389 0field into r1390; - add r1385 r1390 into r1391; - mul r1386 15field into r1392; - sub r4 1u8 into r1393; - lt 11u8 r1393 into r1394; - mul r2[11u32] r1392 into r1395; - ternary r1394 r1395 0field into r1396; - add r1391 r1396 into r1397; - mul r1392 15field into r1398; - sub r4 1u8 into r1399; - lt 12u8 r1399 into r1400; - mul r2[12u32] r1398 into r1401; - ternary r1400 r1401 0field into r1402; - add r1397 r1402 into r1403; - mul r1398 15field into r1404; - sub r4 1u8 into r1405; - lt 13u8 r1405 into r1406; - mul r2[13u32] r1404 into r1407; - ternary r1406 r1407 0field into r1408; - add r1403 r1408 into r1409; - mul r1404 15field into r1410; - sub r4 1u8 into r1411; - lt 14u8 r1411 into r1412; - mul r2[14u32] r1410 into r1413; - ternary r1412 r1413 0field into r1414; - add r1409 r1414 into r1415; - cast r1415 15field into r1416 as Share; - cast r3[14u32] r1416 1u64 into r1417 as ValidatorShareData; - mul 1field 16field into r1418; - sub r4 1u8 into r1419; - lt 0u8 r1419 into r1420; - mul r2[0u32] r1418 into r1421; - ternary r1420 r1421 0field into r1422; - add r0 r1422 into r1423; - mul r1418 16field into r1424; - sub r4 1u8 into r1425; - lt 1u8 r1425 into r1426; - mul r2[1u32] r1424 into r1427; - ternary r1426 r1427 0field into r1428; - add r1423 r1428 into r1429; - mul r1424 16field into r1430; - sub r4 1u8 into r1431; - lt 2u8 r1431 into r1432; - mul r2[2u32] r1430 into r1433; - ternary r1432 r1433 0field into r1434; - add r1429 r1434 into r1435; - mul r1430 16field into r1436; - sub r4 1u8 into r1437; - lt 3u8 r1437 into r1438; - mul r2[3u32] r1436 into r1439; - ternary r1438 r1439 0field into r1440; - add r1435 r1440 into r1441; - mul r1436 16field into r1442; - sub r4 1u8 into r1443; - lt 4u8 r1443 into r1444; - mul r2[4u32] r1442 into r1445; - ternary r1444 r1445 0field into r1446; - add r1441 r1446 into r1447; - mul r1442 16field into r1448; - sub r4 1u8 into r1449; - lt 5u8 r1449 into r1450; - mul r2[5u32] r1448 into r1451; - ternary r1450 r1451 0field into r1452; - add r1447 r1452 into r1453; - mul r1448 16field into r1454; - sub r4 1u8 into r1455; - lt 6u8 r1455 into r1456; - mul r2[6u32] r1454 into r1457; - ternary r1456 r1457 0field into r1458; - add r1453 r1458 into r1459; - mul r1454 16field into r1460; - sub r4 1u8 into r1461; - lt 7u8 r1461 into r1462; - mul r2[7u32] r1460 into r1463; - ternary r1462 r1463 0field into r1464; - add r1459 r1464 into r1465; - mul r1460 16field into r1466; - sub r4 1u8 into r1467; - lt 8u8 r1467 into r1468; - mul r2[8u32] r1466 into r1469; - ternary r1468 r1469 0field into r1470; - add r1465 r1470 into r1471; - mul r1466 16field into r1472; - sub r4 1u8 into r1473; - lt 9u8 r1473 into r1474; - mul r2[9u32] r1472 into r1475; - ternary r1474 r1475 0field into r1476; - add r1471 r1476 into r1477; - mul r1472 16field into r1478; - sub r4 1u8 into r1479; - lt 10u8 r1479 into r1480; - mul r2[10u32] r1478 into r1481; - ternary r1480 r1481 0field into r1482; - add r1477 r1482 into r1483; - mul r1478 16field into r1484; - sub r4 1u8 into r1485; - lt 11u8 r1485 into r1486; - mul r2[11u32] r1484 into r1487; - ternary r1486 r1487 0field into r1488; - add r1483 r1488 into r1489; - mul r1484 16field into r1490; - sub r4 1u8 into r1491; - lt 12u8 r1491 into r1492; - mul r2[12u32] r1490 into r1493; - ternary r1492 r1493 0field into r1494; - add r1489 r1494 into r1495; - mul r1490 16field into r1496; - sub r4 1u8 into r1497; - lt 13u8 r1497 into r1498; - mul r2[13u32] r1496 into r1499; - ternary r1498 r1499 0field into r1500; - add r1495 r1500 into r1501; - mul r1496 16field into r1502; - sub r4 1u8 into r1503; - lt 14u8 r1503 into r1504; - mul r2[14u32] r1502 into r1505; - ternary r1504 r1505 0field into r1506; - add r1501 r1506 into r1507; - cast r1507 16field into r1508 as Share; - cast r3[15u32] r1508 1u64 into r1509 as ValidatorShareData; - cast r129 r221 r313 r405 r497 r589 r681 r773 r865 r957 r1049 r1141 r1233 r1325 r1417 r1509 into r1510 as [ValidatorShareData; 16u32]; - call dcp_validator_shares.aleo/submit_shares_to_validators r1510 r36 into r1511 r1512 r1513 r1514 r1515 r1516 r1517 r1518 r1519 r1520 r1521 r1522 r1523 r1524 r1525 r1526; - call dcp_core_protocol.aleo/custody_data_as_program r37 r3 into r1527; - async custody_data_as_program r1527 into r1528; - output r1528 as data_custody_protocol.aleo/custody_data_as_program.future; + input r5 as scalar.private; + is.eq r2[0u32] 0field into r6; + or false r6 into r7; + is.eq r2[1u32] 0field into r8; + or r7 r8 into r9; + is.eq r2[2u32] 0field into r10; + or r9 r10 into r11; + is.eq r2[3u32] 0field into r12; + or r11 r12 into r13; + is.eq r2[4u32] 0field into r14; + or r13 r14 into r15; + is.eq r2[5u32] 0field into r16; + or r15 r16 into r17; + is.eq r2[6u32] 0field into r18; + or r17 r18 into r19; + is.eq r2[7u32] 0field into r20; + or r19 r20 into r21; + is.eq r2[8u32] 0field into r22; + or r21 r22 into r23; + is.eq r2[9u32] 0field into r24; + or r23 r24 into r25; + is.eq r2[10u32] 0field into r26; + or r25 r26 into r27; + is.eq r2[11u32] 0field into r28; + or r27 r28 into r29; + is.eq r2[12u32] 0field into r30; + or r29 r30 into r31; + is.eq r2[13u32] 0field into r32; + or r31 r32 into r33; + is.eq r2[14u32] 0field into r34; + or r33 r34 into r35; + not r35 into r36; + assert.eq r36 true; + cast true r0 true into r37 as Operation; + hash.bhp256 r37 into r38 as field; + commit.bhp256 r38 r5 into r39 as field; + cast self.caller r1 r4 into r40 as Custody; + hash.bhp256 r40 into r41 as field; + mul 1field 1field into r42; + sub r4 1u8 into r43; + lt 0u8 r43 into r44; + mul r2[0u32] r42 into r45; + ternary r44 r45 0field into r46; + add r0 r46 into r47; + mul r42 1field into r48; + sub r4 1u8 into r49; + lt 1u8 r49 into r50; + mul r2[1u32] r48 into r51; + ternary r50 r51 0field into r52; + add r47 r52 into r53; + mul r48 1field into r54; + sub r4 1u8 into r55; + lt 2u8 r55 into r56; + mul r2[2u32] r54 into r57; + ternary r56 r57 0field into r58; + add r53 r58 into r59; + mul r54 1field into r60; + sub r4 1u8 into r61; + lt 3u8 r61 into r62; + mul r2[3u32] r60 into r63; + ternary r62 r63 0field into r64; + add r59 r64 into r65; + mul r60 1field into r66; + sub r4 1u8 into r67; + lt 4u8 r67 into r68; + mul r2[4u32] r66 into r69; + ternary r68 r69 0field into r70; + add r65 r70 into r71; + mul r66 1field into r72; + sub r4 1u8 into r73; + lt 5u8 r73 into r74; + mul r2[5u32] r72 into r75; + ternary r74 r75 0field into r76; + add r71 r76 into r77; + mul r72 1field into r78; + sub r4 1u8 into r79; + lt 6u8 r79 into r80; + mul r2[6u32] r78 into r81; + ternary r80 r81 0field into r82; + add r77 r82 into r83; + mul r78 1field into r84; + sub r4 1u8 into r85; + lt 7u8 r85 into r86; + mul r2[7u32] r84 into r87; + ternary r86 r87 0field into r88; + add r83 r88 into r89; + mul r84 1field into r90; + sub r4 1u8 into r91; + lt 8u8 r91 into r92; + mul r2[8u32] r90 into r93; + ternary r92 r93 0field into r94; + add r89 r94 into r95; + mul r90 1field into r96; + sub r4 1u8 into r97; + lt 9u8 r97 into r98; + mul r2[9u32] r96 into r99; + ternary r98 r99 0field into r100; + add r95 r100 into r101; + mul r96 1field into r102; + sub r4 1u8 into r103; + lt 10u8 r103 into r104; + mul r2[10u32] r102 into r105; + ternary r104 r105 0field into r106; + add r101 r106 into r107; + mul r102 1field into r108; + sub r4 1u8 into r109; + lt 11u8 r109 into r110; + mul r2[11u32] r108 into r111; + ternary r110 r111 0field into r112; + add r107 r112 into r113; + mul r108 1field into r114; + sub r4 1u8 into r115; + lt 12u8 r115 into r116; + mul r2[12u32] r114 into r117; + ternary r116 r117 0field into r118; + add r113 r118 into r119; + mul r114 1field into r120; + sub r4 1u8 into r121; + lt 13u8 r121 into r122; + mul r2[13u32] r120 into r123; + ternary r122 r123 0field into r124; + add r119 r124 into r125; + mul r120 1field into r126; + sub r4 1u8 into r127; + lt 14u8 r127 into r128; + mul r2[14u32] r126 into r129; + ternary r128 r129 0field into r130; + add r125 r130 into r131; + cast r131 1field into r132 as Share; + cast r3[0u32] r132 into r133 as ValidatorShareData; + mul 1field 2field into r134; + sub r4 1u8 into r135; + lt 0u8 r135 into r136; + mul r2[0u32] r134 into r137; + ternary r136 r137 0field into r138; + add r0 r138 into r139; + mul r134 2field into r140; + sub r4 1u8 into r141; + lt 1u8 r141 into r142; + mul r2[1u32] r140 into r143; + ternary r142 r143 0field into r144; + add r139 r144 into r145; + mul r140 2field into r146; + sub r4 1u8 into r147; + lt 2u8 r147 into r148; + mul r2[2u32] r146 into r149; + ternary r148 r149 0field into r150; + add r145 r150 into r151; + mul r146 2field into r152; + sub r4 1u8 into r153; + lt 3u8 r153 into r154; + mul r2[3u32] r152 into r155; + ternary r154 r155 0field into r156; + add r151 r156 into r157; + mul r152 2field into r158; + sub r4 1u8 into r159; + lt 4u8 r159 into r160; + mul r2[4u32] r158 into r161; + ternary r160 r161 0field into r162; + add r157 r162 into r163; + mul r158 2field into r164; + sub r4 1u8 into r165; + lt 5u8 r165 into r166; + mul r2[5u32] r164 into r167; + ternary r166 r167 0field into r168; + add r163 r168 into r169; + mul r164 2field into r170; + sub r4 1u8 into r171; + lt 6u8 r171 into r172; + mul r2[6u32] r170 into r173; + ternary r172 r173 0field into r174; + add r169 r174 into r175; + mul r170 2field into r176; + sub r4 1u8 into r177; + lt 7u8 r177 into r178; + mul r2[7u32] r176 into r179; + ternary r178 r179 0field into r180; + add r175 r180 into r181; + mul r176 2field into r182; + sub r4 1u8 into r183; + lt 8u8 r183 into r184; + mul r2[8u32] r182 into r185; + ternary r184 r185 0field into r186; + add r181 r186 into r187; + mul r182 2field into r188; + sub r4 1u8 into r189; + lt 9u8 r189 into r190; + mul r2[9u32] r188 into r191; + ternary r190 r191 0field into r192; + add r187 r192 into r193; + mul r188 2field into r194; + sub r4 1u8 into r195; + lt 10u8 r195 into r196; + mul r2[10u32] r194 into r197; + ternary r196 r197 0field into r198; + add r193 r198 into r199; + mul r194 2field into r200; + sub r4 1u8 into r201; + lt 11u8 r201 into r202; + mul r2[11u32] r200 into r203; + ternary r202 r203 0field into r204; + add r199 r204 into r205; + mul r200 2field into r206; + sub r4 1u8 into r207; + lt 12u8 r207 into r208; + mul r2[12u32] r206 into r209; + ternary r208 r209 0field into r210; + add r205 r210 into r211; + mul r206 2field into r212; + sub r4 1u8 into r213; + lt 13u8 r213 into r214; + mul r2[13u32] r212 into r215; + ternary r214 r215 0field into r216; + add r211 r216 into r217; + mul r212 2field into r218; + sub r4 1u8 into r219; + lt 14u8 r219 into r220; + mul r2[14u32] r218 into r221; + ternary r220 r221 0field into r222; + add r217 r222 into r223; + cast r223 2field into r224 as Share; + cast r3[1u32] r224 into r225 as ValidatorShareData; + mul 1field 3field into r226; + sub r4 1u8 into r227; + lt 0u8 r227 into r228; + mul r2[0u32] r226 into r229; + ternary r228 r229 0field into r230; + add r0 r230 into r231; + mul r226 3field into r232; + sub r4 1u8 into r233; + lt 1u8 r233 into r234; + mul r2[1u32] r232 into r235; + ternary r234 r235 0field into r236; + add r231 r236 into r237; + mul r232 3field into r238; + sub r4 1u8 into r239; + lt 2u8 r239 into r240; + mul r2[2u32] r238 into r241; + ternary r240 r241 0field into r242; + add r237 r242 into r243; + mul r238 3field into r244; + sub r4 1u8 into r245; + lt 3u8 r245 into r246; + mul r2[3u32] r244 into r247; + ternary r246 r247 0field into r248; + add r243 r248 into r249; + mul r244 3field into r250; + sub r4 1u8 into r251; + lt 4u8 r251 into r252; + mul r2[4u32] r250 into r253; + ternary r252 r253 0field into r254; + add r249 r254 into r255; + mul r250 3field into r256; + sub r4 1u8 into r257; + lt 5u8 r257 into r258; + mul r2[5u32] r256 into r259; + ternary r258 r259 0field into r260; + add r255 r260 into r261; + mul r256 3field into r262; + sub r4 1u8 into r263; + lt 6u8 r263 into r264; + mul r2[6u32] r262 into r265; + ternary r264 r265 0field into r266; + add r261 r266 into r267; + mul r262 3field into r268; + sub r4 1u8 into r269; + lt 7u8 r269 into r270; + mul r2[7u32] r268 into r271; + ternary r270 r271 0field into r272; + add r267 r272 into r273; + mul r268 3field into r274; + sub r4 1u8 into r275; + lt 8u8 r275 into r276; + mul r2[8u32] r274 into r277; + ternary r276 r277 0field into r278; + add r273 r278 into r279; + mul r274 3field into r280; + sub r4 1u8 into r281; + lt 9u8 r281 into r282; + mul r2[9u32] r280 into r283; + ternary r282 r283 0field into r284; + add r279 r284 into r285; + mul r280 3field into r286; + sub r4 1u8 into r287; + lt 10u8 r287 into r288; + mul r2[10u32] r286 into r289; + ternary r288 r289 0field into r290; + add r285 r290 into r291; + mul r286 3field into r292; + sub r4 1u8 into r293; + lt 11u8 r293 into r294; + mul r2[11u32] r292 into r295; + ternary r294 r295 0field into r296; + add r291 r296 into r297; + mul r292 3field into r298; + sub r4 1u8 into r299; + lt 12u8 r299 into r300; + mul r2[12u32] r298 into r301; + ternary r300 r301 0field into r302; + add r297 r302 into r303; + mul r298 3field into r304; + sub r4 1u8 into r305; + lt 13u8 r305 into r306; + mul r2[13u32] r304 into r307; + ternary r306 r307 0field into r308; + add r303 r308 into r309; + mul r304 3field into r310; + sub r4 1u8 into r311; + lt 14u8 r311 into r312; + mul r2[14u32] r310 into r313; + ternary r312 r313 0field into r314; + add r309 r314 into r315; + cast r315 3field into r316 as Share; + cast r3[2u32] r316 into r317 as ValidatorShareData; + mul 1field 4field into r318; + sub r4 1u8 into r319; + lt 0u8 r319 into r320; + mul r2[0u32] r318 into r321; + ternary r320 r321 0field into r322; + add r0 r322 into r323; + mul r318 4field into r324; + sub r4 1u8 into r325; + lt 1u8 r325 into r326; + mul r2[1u32] r324 into r327; + ternary r326 r327 0field into r328; + add r323 r328 into r329; + mul r324 4field into r330; + sub r4 1u8 into r331; + lt 2u8 r331 into r332; + mul r2[2u32] r330 into r333; + ternary r332 r333 0field into r334; + add r329 r334 into r335; + mul r330 4field into r336; + sub r4 1u8 into r337; + lt 3u8 r337 into r338; + mul r2[3u32] r336 into r339; + ternary r338 r339 0field into r340; + add r335 r340 into r341; + mul r336 4field into r342; + sub r4 1u8 into r343; + lt 4u8 r343 into r344; + mul r2[4u32] r342 into r345; + ternary r344 r345 0field into r346; + add r341 r346 into r347; + mul r342 4field into r348; + sub r4 1u8 into r349; + lt 5u8 r349 into r350; + mul r2[5u32] r348 into r351; + ternary r350 r351 0field into r352; + add r347 r352 into r353; + mul r348 4field into r354; + sub r4 1u8 into r355; + lt 6u8 r355 into r356; + mul r2[6u32] r354 into r357; + ternary r356 r357 0field into r358; + add r353 r358 into r359; + mul r354 4field into r360; + sub r4 1u8 into r361; + lt 7u8 r361 into r362; + mul r2[7u32] r360 into r363; + ternary r362 r363 0field into r364; + add r359 r364 into r365; + mul r360 4field into r366; + sub r4 1u8 into r367; + lt 8u8 r367 into r368; + mul r2[8u32] r366 into r369; + ternary r368 r369 0field into r370; + add r365 r370 into r371; + mul r366 4field into r372; + sub r4 1u8 into r373; + lt 9u8 r373 into r374; + mul r2[9u32] r372 into r375; + ternary r374 r375 0field into r376; + add r371 r376 into r377; + mul r372 4field into r378; + sub r4 1u8 into r379; + lt 10u8 r379 into r380; + mul r2[10u32] r378 into r381; + ternary r380 r381 0field into r382; + add r377 r382 into r383; + mul r378 4field into r384; + sub r4 1u8 into r385; + lt 11u8 r385 into r386; + mul r2[11u32] r384 into r387; + ternary r386 r387 0field into r388; + add r383 r388 into r389; + mul r384 4field into r390; + sub r4 1u8 into r391; + lt 12u8 r391 into r392; + mul r2[12u32] r390 into r393; + ternary r392 r393 0field into r394; + add r389 r394 into r395; + mul r390 4field into r396; + sub r4 1u8 into r397; + lt 13u8 r397 into r398; + mul r2[13u32] r396 into r399; + ternary r398 r399 0field into r400; + add r395 r400 into r401; + mul r396 4field into r402; + sub r4 1u8 into r403; + lt 14u8 r403 into r404; + mul r2[14u32] r402 into r405; + ternary r404 r405 0field into r406; + add r401 r406 into r407; + cast r407 4field into r408 as Share; + cast r3[3u32] r408 into r409 as ValidatorShareData; + mul 1field 5field into r410; + sub r4 1u8 into r411; + lt 0u8 r411 into r412; + mul r2[0u32] r410 into r413; + ternary r412 r413 0field into r414; + add r0 r414 into r415; + mul r410 5field into r416; + sub r4 1u8 into r417; + lt 1u8 r417 into r418; + mul r2[1u32] r416 into r419; + ternary r418 r419 0field into r420; + add r415 r420 into r421; + mul r416 5field into r422; + sub r4 1u8 into r423; + lt 2u8 r423 into r424; + mul r2[2u32] r422 into r425; + ternary r424 r425 0field into r426; + add r421 r426 into r427; + mul r422 5field into r428; + sub r4 1u8 into r429; + lt 3u8 r429 into r430; + mul r2[3u32] r428 into r431; + ternary r430 r431 0field into r432; + add r427 r432 into r433; + mul r428 5field into r434; + sub r4 1u8 into r435; + lt 4u8 r435 into r436; + mul r2[4u32] r434 into r437; + ternary r436 r437 0field into r438; + add r433 r438 into r439; + mul r434 5field into r440; + sub r4 1u8 into r441; + lt 5u8 r441 into r442; + mul r2[5u32] r440 into r443; + ternary r442 r443 0field into r444; + add r439 r444 into r445; + mul r440 5field into r446; + sub r4 1u8 into r447; + lt 6u8 r447 into r448; + mul r2[6u32] r446 into r449; + ternary r448 r449 0field into r450; + add r445 r450 into r451; + mul r446 5field into r452; + sub r4 1u8 into r453; + lt 7u8 r453 into r454; + mul r2[7u32] r452 into r455; + ternary r454 r455 0field into r456; + add r451 r456 into r457; + mul r452 5field into r458; + sub r4 1u8 into r459; + lt 8u8 r459 into r460; + mul r2[8u32] r458 into r461; + ternary r460 r461 0field into r462; + add r457 r462 into r463; + mul r458 5field into r464; + sub r4 1u8 into r465; + lt 9u8 r465 into r466; + mul r2[9u32] r464 into r467; + ternary r466 r467 0field into r468; + add r463 r468 into r469; + mul r464 5field into r470; + sub r4 1u8 into r471; + lt 10u8 r471 into r472; + mul r2[10u32] r470 into r473; + ternary r472 r473 0field into r474; + add r469 r474 into r475; + mul r470 5field into r476; + sub r4 1u8 into r477; + lt 11u8 r477 into r478; + mul r2[11u32] r476 into r479; + ternary r478 r479 0field into r480; + add r475 r480 into r481; + mul r476 5field into r482; + sub r4 1u8 into r483; + lt 12u8 r483 into r484; + mul r2[12u32] r482 into r485; + ternary r484 r485 0field into r486; + add r481 r486 into r487; + mul r482 5field into r488; + sub r4 1u8 into r489; + lt 13u8 r489 into r490; + mul r2[13u32] r488 into r491; + ternary r490 r491 0field into r492; + add r487 r492 into r493; + mul r488 5field into r494; + sub r4 1u8 into r495; + lt 14u8 r495 into r496; + mul r2[14u32] r494 into r497; + ternary r496 r497 0field into r498; + add r493 r498 into r499; + cast r499 5field into r500 as Share; + cast r3[4u32] r500 into r501 as ValidatorShareData; + mul 1field 6field into r502; + sub r4 1u8 into r503; + lt 0u8 r503 into r504; + mul r2[0u32] r502 into r505; + ternary r504 r505 0field into r506; + add r0 r506 into r507; + mul r502 6field into r508; + sub r4 1u8 into r509; + lt 1u8 r509 into r510; + mul r2[1u32] r508 into r511; + ternary r510 r511 0field into r512; + add r507 r512 into r513; + mul r508 6field into r514; + sub r4 1u8 into r515; + lt 2u8 r515 into r516; + mul r2[2u32] r514 into r517; + ternary r516 r517 0field into r518; + add r513 r518 into r519; + mul r514 6field into r520; + sub r4 1u8 into r521; + lt 3u8 r521 into r522; + mul r2[3u32] r520 into r523; + ternary r522 r523 0field into r524; + add r519 r524 into r525; + mul r520 6field into r526; + sub r4 1u8 into r527; + lt 4u8 r527 into r528; + mul r2[4u32] r526 into r529; + ternary r528 r529 0field into r530; + add r525 r530 into r531; + mul r526 6field into r532; + sub r4 1u8 into r533; + lt 5u8 r533 into r534; + mul r2[5u32] r532 into r535; + ternary r534 r535 0field into r536; + add r531 r536 into r537; + mul r532 6field into r538; + sub r4 1u8 into r539; + lt 6u8 r539 into r540; + mul r2[6u32] r538 into r541; + ternary r540 r541 0field into r542; + add r537 r542 into r543; + mul r538 6field into r544; + sub r4 1u8 into r545; + lt 7u8 r545 into r546; + mul r2[7u32] r544 into r547; + ternary r546 r547 0field into r548; + add r543 r548 into r549; + mul r544 6field into r550; + sub r4 1u8 into r551; + lt 8u8 r551 into r552; + mul r2[8u32] r550 into r553; + ternary r552 r553 0field into r554; + add r549 r554 into r555; + mul r550 6field into r556; + sub r4 1u8 into r557; + lt 9u8 r557 into r558; + mul r2[9u32] r556 into r559; + ternary r558 r559 0field into r560; + add r555 r560 into r561; + mul r556 6field into r562; + sub r4 1u8 into r563; + lt 10u8 r563 into r564; + mul r2[10u32] r562 into r565; + ternary r564 r565 0field into r566; + add r561 r566 into r567; + mul r562 6field into r568; + sub r4 1u8 into r569; + lt 11u8 r569 into r570; + mul r2[11u32] r568 into r571; + ternary r570 r571 0field into r572; + add r567 r572 into r573; + mul r568 6field into r574; + sub r4 1u8 into r575; + lt 12u8 r575 into r576; + mul r2[12u32] r574 into r577; + ternary r576 r577 0field into r578; + add r573 r578 into r579; + mul r574 6field into r580; + sub r4 1u8 into r581; + lt 13u8 r581 into r582; + mul r2[13u32] r580 into r583; + ternary r582 r583 0field into r584; + add r579 r584 into r585; + mul r580 6field into r586; + sub r4 1u8 into r587; + lt 14u8 r587 into r588; + mul r2[14u32] r586 into r589; + ternary r588 r589 0field into r590; + add r585 r590 into r591; + cast r591 6field into r592 as Share; + cast r3[5u32] r592 into r593 as ValidatorShareData; + mul 1field 7field into r594; + sub r4 1u8 into r595; + lt 0u8 r595 into r596; + mul r2[0u32] r594 into r597; + ternary r596 r597 0field into r598; + add r0 r598 into r599; + mul r594 7field into r600; + sub r4 1u8 into r601; + lt 1u8 r601 into r602; + mul r2[1u32] r600 into r603; + ternary r602 r603 0field into r604; + add r599 r604 into r605; + mul r600 7field into r606; + sub r4 1u8 into r607; + lt 2u8 r607 into r608; + mul r2[2u32] r606 into r609; + ternary r608 r609 0field into r610; + add r605 r610 into r611; + mul r606 7field into r612; + sub r4 1u8 into r613; + lt 3u8 r613 into r614; + mul r2[3u32] r612 into r615; + ternary r614 r615 0field into r616; + add r611 r616 into r617; + mul r612 7field into r618; + sub r4 1u8 into r619; + lt 4u8 r619 into r620; + mul r2[4u32] r618 into r621; + ternary r620 r621 0field into r622; + add r617 r622 into r623; + mul r618 7field into r624; + sub r4 1u8 into r625; + lt 5u8 r625 into r626; + mul r2[5u32] r624 into r627; + ternary r626 r627 0field into r628; + add r623 r628 into r629; + mul r624 7field into r630; + sub r4 1u8 into r631; + lt 6u8 r631 into r632; + mul r2[6u32] r630 into r633; + ternary r632 r633 0field into r634; + add r629 r634 into r635; + mul r630 7field into r636; + sub r4 1u8 into r637; + lt 7u8 r637 into r638; + mul r2[7u32] r636 into r639; + ternary r638 r639 0field into r640; + add r635 r640 into r641; + mul r636 7field into r642; + sub r4 1u8 into r643; + lt 8u8 r643 into r644; + mul r2[8u32] r642 into r645; + ternary r644 r645 0field into r646; + add r641 r646 into r647; + mul r642 7field into r648; + sub r4 1u8 into r649; + lt 9u8 r649 into r650; + mul r2[9u32] r648 into r651; + ternary r650 r651 0field into r652; + add r647 r652 into r653; + mul r648 7field into r654; + sub r4 1u8 into r655; + lt 10u8 r655 into r656; + mul r2[10u32] r654 into r657; + ternary r656 r657 0field into r658; + add r653 r658 into r659; + mul r654 7field into r660; + sub r4 1u8 into r661; + lt 11u8 r661 into r662; + mul r2[11u32] r660 into r663; + ternary r662 r663 0field into r664; + add r659 r664 into r665; + mul r660 7field into r666; + sub r4 1u8 into r667; + lt 12u8 r667 into r668; + mul r2[12u32] r666 into r669; + ternary r668 r669 0field into r670; + add r665 r670 into r671; + mul r666 7field into r672; + sub r4 1u8 into r673; + lt 13u8 r673 into r674; + mul r2[13u32] r672 into r675; + ternary r674 r675 0field into r676; + add r671 r676 into r677; + mul r672 7field into r678; + sub r4 1u8 into r679; + lt 14u8 r679 into r680; + mul r2[14u32] r678 into r681; + ternary r680 r681 0field into r682; + add r677 r682 into r683; + cast r683 7field into r684 as Share; + cast r3[6u32] r684 into r685 as ValidatorShareData; + mul 1field 8field into r686; + sub r4 1u8 into r687; + lt 0u8 r687 into r688; + mul r2[0u32] r686 into r689; + ternary r688 r689 0field into r690; + add r0 r690 into r691; + mul r686 8field into r692; + sub r4 1u8 into r693; + lt 1u8 r693 into r694; + mul r2[1u32] r692 into r695; + ternary r694 r695 0field into r696; + add r691 r696 into r697; + mul r692 8field into r698; + sub r4 1u8 into r699; + lt 2u8 r699 into r700; + mul r2[2u32] r698 into r701; + ternary r700 r701 0field into r702; + add r697 r702 into r703; + mul r698 8field into r704; + sub r4 1u8 into r705; + lt 3u8 r705 into r706; + mul r2[3u32] r704 into r707; + ternary r706 r707 0field into r708; + add r703 r708 into r709; + mul r704 8field into r710; + sub r4 1u8 into r711; + lt 4u8 r711 into r712; + mul r2[4u32] r710 into r713; + ternary r712 r713 0field into r714; + add r709 r714 into r715; + mul r710 8field into r716; + sub r4 1u8 into r717; + lt 5u8 r717 into r718; + mul r2[5u32] r716 into r719; + ternary r718 r719 0field into r720; + add r715 r720 into r721; + mul r716 8field into r722; + sub r4 1u8 into r723; + lt 6u8 r723 into r724; + mul r2[6u32] r722 into r725; + ternary r724 r725 0field into r726; + add r721 r726 into r727; + mul r722 8field into r728; + sub r4 1u8 into r729; + lt 7u8 r729 into r730; + mul r2[7u32] r728 into r731; + ternary r730 r731 0field into r732; + add r727 r732 into r733; + mul r728 8field into r734; + sub r4 1u8 into r735; + lt 8u8 r735 into r736; + mul r2[8u32] r734 into r737; + ternary r736 r737 0field into r738; + add r733 r738 into r739; + mul r734 8field into r740; + sub r4 1u8 into r741; + lt 9u8 r741 into r742; + mul r2[9u32] r740 into r743; + ternary r742 r743 0field into r744; + add r739 r744 into r745; + mul r740 8field into r746; + sub r4 1u8 into r747; + lt 10u8 r747 into r748; + mul r2[10u32] r746 into r749; + ternary r748 r749 0field into r750; + add r745 r750 into r751; + mul r746 8field into r752; + sub r4 1u8 into r753; + lt 11u8 r753 into r754; + mul r2[11u32] r752 into r755; + ternary r754 r755 0field into r756; + add r751 r756 into r757; + mul r752 8field into r758; + sub r4 1u8 into r759; + lt 12u8 r759 into r760; + mul r2[12u32] r758 into r761; + ternary r760 r761 0field into r762; + add r757 r762 into r763; + mul r758 8field into r764; + sub r4 1u8 into r765; + lt 13u8 r765 into r766; + mul r2[13u32] r764 into r767; + ternary r766 r767 0field into r768; + add r763 r768 into r769; + mul r764 8field into r770; + sub r4 1u8 into r771; + lt 14u8 r771 into r772; + mul r2[14u32] r770 into r773; + ternary r772 r773 0field into r774; + add r769 r774 into r775; + cast r775 8field into r776 as Share; + cast r3[7u32] r776 into r777 as ValidatorShareData; + mul 1field 9field into r778; + sub r4 1u8 into r779; + lt 0u8 r779 into r780; + mul r2[0u32] r778 into r781; + ternary r780 r781 0field into r782; + add r0 r782 into r783; + mul r778 9field into r784; + sub r4 1u8 into r785; + lt 1u8 r785 into r786; + mul r2[1u32] r784 into r787; + ternary r786 r787 0field into r788; + add r783 r788 into r789; + mul r784 9field into r790; + sub r4 1u8 into r791; + lt 2u8 r791 into r792; + mul r2[2u32] r790 into r793; + ternary r792 r793 0field into r794; + add r789 r794 into r795; + mul r790 9field into r796; + sub r4 1u8 into r797; + lt 3u8 r797 into r798; + mul r2[3u32] r796 into r799; + ternary r798 r799 0field into r800; + add r795 r800 into r801; + mul r796 9field into r802; + sub r4 1u8 into r803; + lt 4u8 r803 into r804; + mul r2[4u32] r802 into r805; + ternary r804 r805 0field into r806; + add r801 r806 into r807; + mul r802 9field into r808; + sub r4 1u8 into r809; + lt 5u8 r809 into r810; + mul r2[5u32] r808 into r811; + ternary r810 r811 0field into r812; + add r807 r812 into r813; + mul r808 9field into r814; + sub r4 1u8 into r815; + lt 6u8 r815 into r816; + mul r2[6u32] r814 into r817; + ternary r816 r817 0field into r818; + add r813 r818 into r819; + mul r814 9field into r820; + sub r4 1u8 into r821; + lt 7u8 r821 into r822; + mul r2[7u32] r820 into r823; + ternary r822 r823 0field into r824; + add r819 r824 into r825; + mul r820 9field into r826; + sub r4 1u8 into r827; + lt 8u8 r827 into r828; + mul r2[8u32] r826 into r829; + ternary r828 r829 0field into r830; + add r825 r830 into r831; + mul r826 9field into r832; + sub r4 1u8 into r833; + lt 9u8 r833 into r834; + mul r2[9u32] r832 into r835; + ternary r834 r835 0field into r836; + add r831 r836 into r837; + mul r832 9field into r838; + sub r4 1u8 into r839; + lt 10u8 r839 into r840; + mul r2[10u32] r838 into r841; + ternary r840 r841 0field into r842; + add r837 r842 into r843; + mul r838 9field into r844; + sub r4 1u8 into r845; + lt 11u8 r845 into r846; + mul r2[11u32] r844 into r847; + ternary r846 r847 0field into r848; + add r843 r848 into r849; + mul r844 9field into r850; + sub r4 1u8 into r851; + lt 12u8 r851 into r852; + mul r2[12u32] r850 into r853; + ternary r852 r853 0field into r854; + add r849 r854 into r855; + mul r850 9field into r856; + sub r4 1u8 into r857; + lt 13u8 r857 into r858; + mul r2[13u32] r856 into r859; + ternary r858 r859 0field into r860; + add r855 r860 into r861; + mul r856 9field into r862; + sub r4 1u8 into r863; + lt 14u8 r863 into r864; + mul r2[14u32] r862 into r865; + ternary r864 r865 0field into r866; + add r861 r866 into r867; + cast r867 9field into r868 as Share; + cast r3[8u32] r868 into r869 as ValidatorShareData; + mul 1field 10field into r870; + sub r4 1u8 into r871; + lt 0u8 r871 into r872; + mul r2[0u32] r870 into r873; + ternary r872 r873 0field into r874; + add r0 r874 into r875; + mul r870 10field into r876; + sub r4 1u8 into r877; + lt 1u8 r877 into r878; + mul r2[1u32] r876 into r879; + ternary r878 r879 0field into r880; + add r875 r880 into r881; + mul r876 10field into r882; + sub r4 1u8 into r883; + lt 2u8 r883 into r884; + mul r2[2u32] r882 into r885; + ternary r884 r885 0field into r886; + add r881 r886 into r887; + mul r882 10field into r888; + sub r4 1u8 into r889; + lt 3u8 r889 into r890; + mul r2[3u32] r888 into r891; + ternary r890 r891 0field into r892; + add r887 r892 into r893; + mul r888 10field into r894; + sub r4 1u8 into r895; + lt 4u8 r895 into r896; + mul r2[4u32] r894 into r897; + ternary r896 r897 0field into r898; + add r893 r898 into r899; + mul r894 10field into r900; + sub r4 1u8 into r901; + lt 5u8 r901 into r902; + mul r2[5u32] r900 into r903; + ternary r902 r903 0field into r904; + add r899 r904 into r905; + mul r900 10field into r906; + sub r4 1u8 into r907; + lt 6u8 r907 into r908; + mul r2[6u32] r906 into r909; + ternary r908 r909 0field into r910; + add r905 r910 into r911; + mul r906 10field into r912; + sub r4 1u8 into r913; + lt 7u8 r913 into r914; + mul r2[7u32] r912 into r915; + ternary r914 r915 0field into r916; + add r911 r916 into r917; + mul r912 10field into r918; + sub r4 1u8 into r919; + lt 8u8 r919 into r920; + mul r2[8u32] r918 into r921; + ternary r920 r921 0field into r922; + add r917 r922 into r923; + mul r918 10field into r924; + sub r4 1u8 into r925; + lt 9u8 r925 into r926; + mul r2[9u32] r924 into r927; + ternary r926 r927 0field into r928; + add r923 r928 into r929; + mul r924 10field into r930; + sub r4 1u8 into r931; + lt 10u8 r931 into r932; + mul r2[10u32] r930 into r933; + ternary r932 r933 0field into r934; + add r929 r934 into r935; + mul r930 10field into r936; + sub r4 1u8 into r937; + lt 11u8 r937 into r938; + mul r2[11u32] r936 into r939; + ternary r938 r939 0field into r940; + add r935 r940 into r941; + mul r936 10field into r942; + sub r4 1u8 into r943; + lt 12u8 r943 into r944; + mul r2[12u32] r942 into r945; + ternary r944 r945 0field into r946; + add r941 r946 into r947; + mul r942 10field into r948; + sub r4 1u8 into r949; + lt 13u8 r949 into r950; + mul r2[13u32] r948 into r951; + ternary r950 r951 0field into r952; + add r947 r952 into r953; + mul r948 10field into r954; + sub r4 1u8 into r955; + lt 14u8 r955 into r956; + mul r2[14u32] r954 into r957; + ternary r956 r957 0field into r958; + add r953 r958 into r959; + cast r959 10field into r960 as Share; + cast r3[9u32] r960 into r961 as ValidatorShareData; + mul 1field 11field into r962; + sub r4 1u8 into r963; + lt 0u8 r963 into r964; + mul r2[0u32] r962 into r965; + ternary r964 r965 0field into r966; + add r0 r966 into r967; + mul r962 11field into r968; + sub r4 1u8 into r969; + lt 1u8 r969 into r970; + mul r2[1u32] r968 into r971; + ternary r970 r971 0field into r972; + add r967 r972 into r973; + mul r968 11field into r974; + sub r4 1u8 into r975; + lt 2u8 r975 into r976; + mul r2[2u32] r974 into r977; + ternary r976 r977 0field into r978; + add r973 r978 into r979; + mul r974 11field into r980; + sub r4 1u8 into r981; + lt 3u8 r981 into r982; + mul r2[3u32] r980 into r983; + ternary r982 r983 0field into r984; + add r979 r984 into r985; + mul r980 11field into r986; + sub r4 1u8 into r987; + lt 4u8 r987 into r988; + mul r2[4u32] r986 into r989; + ternary r988 r989 0field into r990; + add r985 r990 into r991; + mul r986 11field into r992; + sub r4 1u8 into r993; + lt 5u8 r993 into r994; + mul r2[5u32] r992 into r995; + ternary r994 r995 0field into r996; + add r991 r996 into r997; + mul r992 11field into r998; + sub r4 1u8 into r999; + lt 6u8 r999 into r1000; + mul r2[6u32] r998 into r1001; + ternary r1000 r1001 0field into r1002; + add r997 r1002 into r1003; + mul r998 11field into r1004; + sub r4 1u8 into r1005; + lt 7u8 r1005 into r1006; + mul r2[7u32] r1004 into r1007; + ternary r1006 r1007 0field into r1008; + add r1003 r1008 into r1009; + mul r1004 11field into r1010; + sub r4 1u8 into r1011; + lt 8u8 r1011 into r1012; + mul r2[8u32] r1010 into r1013; + ternary r1012 r1013 0field into r1014; + add r1009 r1014 into r1015; + mul r1010 11field into r1016; + sub r4 1u8 into r1017; + lt 9u8 r1017 into r1018; + mul r2[9u32] r1016 into r1019; + ternary r1018 r1019 0field into r1020; + add r1015 r1020 into r1021; + mul r1016 11field into r1022; + sub r4 1u8 into r1023; + lt 10u8 r1023 into r1024; + mul r2[10u32] r1022 into r1025; + ternary r1024 r1025 0field into r1026; + add r1021 r1026 into r1027; + mul r1022 11field into r1028; + sub r4 1u8 into r1029; + lt 11u8 r1029 into r1030; + mul r2[11u32] r1028 into r1031; + ternary r1030 r1031 0field into r1032; + add r1027 r1032 into r1033; + mul r1028 11field into r1034; + sub r4 1u8 into r1035; + lt 12u8 r1035 into r1036; + mul r2[12u32] r1034 into r1037; + ternary r1036 r1037 0field into r1038; + add r1033 r1038 into r1039; + mul r1034 11field into r1040; + sub r4 1u8 into r1041; + lt 13u8 r1041 into r1042; + mul r2[13u32] r1040 into r1043; + ternary r1042 r1043 0field into r1044; + add r1039 r1044 into r1045; + mul r1040 11field into r1046; + sub r4 1u8 into r1047; + lt 14u8 r1047 into r1048; + mul r2[14u32] r1046 into r1049; + ternary r1048 r1049 0field into r1050; + add r1045 r1050 into r1051; + cast r1051 11field into r1052 as Share; + cast r3[10u32] r1052 into r1053 as ValidatorShareData; + mul 1field 12field into r1054; + sub r4 1u8 into r1055; + lt 0u8 r1055 into r1056; + mul r2[0u32] r1054 into r1057; + ternary r1056 r1057 0field into r1058; + add r0 r1058 into r1059; + mul r1054 12field into r1060; + sub r4 1u8 into r1061; + lt 1u8 r1061 into r1062; + mul r2[1u32] r1060 into r1063; + ternary r1062 r1063 0field into r1064; + add r1059 r1064 into r1065; + mul r1060 12field into r1066; + sub r4 1u8 into r1067; + lt 2u8 r1067 into r1068; + mul r2[2u32] r1066 into r1069; + ternary r1068 r1069 0field into r1070; + add r1065 r1070 into r1071; + mul r1066 12field into r1072; + sub r4 1u8 into r1073; + lt 3u8 r1073 into r1074; + mul r2[3u32] r1072 into r1075; + ternary r1074 r1075 0field into r1076; + add r1071 r1076 into r1077; + mul r1072 12field into r1078; + sub r4 1u8 into r1079; + lt 4u8 r1079 into r1080; + mul r2[4u32] r1078 into r1081; + ternary r1080 r1081 0field into r1082; + add r1077 r1082 into r1083; + mul r1078 12field into r1084; + sub r4 1u8 into r1085; + lt 5u8 r1085 into r1086; + mul r2[5u32] r1084 into r1087; + ternary r1086 r1087 0field into r1088; + add r1083 r1088 into r1089; + mul r1084 12field into r1090; + sub r4 1u8 into r1091; + lt 6u8 r1091 into r1092; + mul r2[6u32] r1090 into r1093; + ternary r1092 r1093 0field into r1094; + add r1089 r1094 into r1095; + mul r1090 12field into r1096; + sub r4 1u8 into r1097; + lt 7u8 r1097 into r1098; + mul r2[7u32] r1096 into r1099; + ternary r1098 r1099 0field into r1100; + add r1095 r1100 into r1101; + mul r1096 12field into r1102; + sub r4 1u8 into r1103; + lt 8u8 r1103 into r1104; + mul r2[8u32] r1102 into r1105; + ternary r1104 r1105 0field into r1106; + add r1101 r1106 into r1107; + mul r1102 12field into r1108; + sub r4 1u8 into r1109; + lt 9u8 r1109 into r1110; + mul r2[9u32] r1108 into r1111; + ternary r1110 r1111 0field into r1112; + add r1107 r1112 into r1113; + mul r1108 12field into r1114; + sub r4 1u8 into r1115; + lt 10u8 r1115 into r1116; + mul r2[10u32] r1114 into r1117; + ternary r1116 r1117 0field into r1118; + add r1113 r1118 into r1119; + mul r1114 12field into r1120; + sub r4 1u8 into r1121; + lt 11u8 r1121 into r1122; + mul r2[11u32] r1120 into r1123; + ternary r1122 r1123 0field into r1124; + add r1119 r1124 into r1125; + mul r1120 12field into r1126; + sub r4 1u8 into r1127; + lt 12u8 r1127 into r1128; + mul r2[12u32] r1126 into r1129; + ternary r1128 r1129 0field into r1130; + add r1125 r1130 into r1131; + mul r1126 12field into r1132; + sub r4 1u8 into r1133; + lt 13u8 r1133 into r1134; + mul r2[13u32] r1132 into r1135; + ternary r1134 r1135 0field into r1136; + add r1131 r1136 into r1137; + mul r1132 12field into r1138; + sub r4 1u8 into r1139; + lt 14u8 r1139 into r1140; + mul r2[14u32] r1138 into r1141; + ternary r1140 r1141 0field into r1142; + add r1137 r1142 into r1143; + cast r1143 12field into r1144 as Share; + cast r3[11u32] r1144 into r1145 as ValidatorShareData; + mul 1field 13field into r1146; + sub r4 1u8 into r1147; + lt 0u8 r1147 into r1148; + mul r2[0u32] r1146 into r1149; + ternary r1148 r1149 0field into r1150; + add r0 r1150 into r1151; + mul r1146 13field into r1152; + sub r4 1u8 into r1153; + lt 1u8 r1153 into r1154; + mul r2[1u32] r1152 into r1155; + ternary r1154 r1155 0field into r1156; + add r1151 r1156 into r1157; + mul r1152 13field into r1158; + sub r4 1u8 into r1159; + lt 2u8 r1159 into r1160; + mul r2[2u32] r1158 into r1161; + ternary r1160 r1161 0field into r1162; + add r1157 r1162 into r1163; + mul r1158 13field into r1164; + sub r4 1u8 into r1165; + lt 3u8 r1165 into r1166; + mul r2[3u32] r1164 into r1167; + ternary r1166 r1167 0field into r1168; + add r1163 r1168 into r1169; + mul r1164 13field into r1170; + sub r4 1u8 into r1171; + lt 4u8 r1171 into r1172; + mul r2[4u32] r1170 into r1173; + ternary r1172 r1173 0field into r1174; + add r1169 r1174 into r1175; + mul r1170 13field into r1176; + sub r4 1u8 into r1177; + lt 5u8 r1177 into r1178; + mul r2[5u32] r1176 into r1179; + ternary r1178 r1179 0field into r1180; + add r1175 r1180 into r1181; + mul r1176 13field into r1182; + sub r4 1u8 into r1183; + lt 6u8 r1183 into r1184; + mul r2[6u32] r1182 into r1185; + ternary r1184 r1185 0field into r1186; + add r1181 r1186 into r1187; + mul r1182 13field into r1188; + sub r4 1u8 into r1189; + lt 7u8 r1189 into r1190; + mul r2[7u32] r1188 into r1191; + ternary r1190 r1191 0field into r1192; + add r1187 r1192 into r1193; + mul r1188 13field into r1194; + sub r4 1u8 into r1195; + lt 8u8 r1195 into r1196; + mul r2[8u32] r1194 into r1197; + ternary r1196 r1197 0field into r1198; + add r1193 r1198 into r1199; + mul r1194 13field into r1200; + sub r4 1u8 into r1201; + lt 9u8 r1201 into r1202; + mul r2[9u32] r1200 into r1203; + ternary r1202 r1203 0field into r1204; + add r1199 r1204 into r1205; + mul r1200 13field into r1206; + sub r4 1u8 into r1207; + lt 10u8 r1207 into r1208; + mul r2[10u32] r1206 into r1209; + ternary r1208 r1209 0field into r1210; + add r1205 r1210 into r1211; + mul r1206 13field into r1212; + sub r4 1u8 into r1213; + lt 11u8 r1213 into r1214; + mul r2[11u32] r1212 into r1215; + ternary r1214 r1215 0field into r1216; + add r1211 r1216 into r1217; + mul r1212 13field into r1218; + sub r4 1u8 into r1219; + lt 12u8 r1219 into r1220; + mul r2[12u32] r1218 into r1221; + ternary r1220 r1221 0field into r1222; + add r1217 r1222 into r1223; + mul r1218 13field into r1224; + sub r4 1u8 into r1225; + lt 13u8 r1225 into r1226; + mul r2[13u32] r1224 into r1227; + ternary r1226 r1227 0field into r1228; + add r1223 r1228 into r1229; + mul r1224 13field into r1230; + sub r4 1u8 into r1231; + lt 14u8 r1231 into r1232; + mul r2[14u32] r1230 into r1233; + ternary r1232 r1233 0field into r1234; + add r1229 r1234 into r1235; + cast r1235 13field into r1236 as Share; + cast r3[12u32] r1236 into r1237 as ValidatorShareData; + mul 1field 14field into r1238; + sub r4 1u8 into r1239; + lt 0u8 r1239 into r1240; + mul r2[0u32] r1238 into r1241; + ternary r1240 r1241 0field into r1242; + add r0 r1242 into r1243; + mul r1238 14field into r1244; + sub r4 1u8 into r1245; + lt 1u8 r1245 into r1246; + mul r2[1u32] r1244 into r1247; + ternary r1246 r1247 0field into r1248; + add r1243 r1248 into r1249; + mul r1244 14field into r1250; + sub r4 1u8 into r1251; + lt 2u8 r1251 into r1252; + mul r2[2u32] r1250 into r1253; + ternary r1252 r1253 0field into r1254; + add r1249 r1254 into r1255; + mul r1250 14field into r1256; + sub r4 1u8 into r1257; + lt 3u8 r1257 into r1258; + mul r2[3u32] r1256 into r1259; + ternary r1258 r1259 0field into r1260; + add r1255 r1260 into r1261; + mul r1256 14field into r1262; + sub r4 1u8 into r1263; + lt 4u8 r1263 into r1264; + mul r2[4u32] r1262 into r1265; + ternary r1264 r1265 0field into r1266; + add r1261 r1266 into r1267; + mul r1262 14field into r1268; + sub r4 1u8 into r1269; + lt 5u8 r1269 into r1270; + mul r2[5u32] r1268 into r1271; + ternary r1270 r1271 0field into r1272; + add r1267 r1272 into r1273; + mul r1268 14field into r1274; + sub r4 1u8 into r1275; + lt 6u8 r1275 into r1276; + mul r2[6u32] r1274 into r1277; + ternary r1276 r1277 0field into r1278; + add r1273 r1278 into r1279; + mul r1274 14field into r1280; + sub r4 1u8 into r1281; + lt 7u8 r1281 into r1282; + mul r2[7u32] r1280 into r1283; + ternary r1282 r1283 0field into r1284; + add r1279 r1284 into r1285; + mul r1280 14field into r1286; + sub r4 1u8 into r1287; + lt 8u8 r1287 into r1288; + mul r2[8u32] r1286 into r1289; + ternary r1288 r1289 0field into r1290; + add r1285 r1290 into r1291; + mul r1286 14field into r1292; + sub r4 1u8 into r1293; + lt 9u8 r1293 into r1294; + mul r2[9u32] r1292 into r1295; + ternary r1294 r1295 0field into r1296; + add r1291 r1296 into r1297; + mul r1292 14field into r1298; + sub r4 1u8 into r1299; + lt 10u8 r1299 into r1300; + mul r2[10u32] r1298 into r1301; + ternary r1300 r1301 0field into r1302; + add r1297 r1302 into r1303; + mul r1298 14field into r1304; + sub r4 1u8 into r1305; + lt 11u8 r1305 into r1306; + mul r2[11u32] r1304 into r1307; + ternary r1306 r1307 0field into r1308; + add r1303 r1308 into r1309; + mul r1304 14field into r1310; + sub r4 1u8 into r1311; + lt 12u8 r1311 into r1312; + mul r2[12u32] r1310 into r1313; + ternary r1312 r1313 0field into r1314; + add r1309 r1314 into r1315; + mul r1310 14field into r1316; + sub r4 1u8 into r1317; + lt 13u8 r1317 into r1318; + mul r2[13u32] r1316 into r1319; + ternary r1318 r1319 0field into r1320; + add r1315 r1320 into r1321; + mul r1316 14field into r1322; + sub r4 1u8 into r1323; + lt 14u8 r1323 into r1324; + mul r2[14u32] r1322 into r1325; + ternary r1324 r1325 0field into r1326; + add r1321 r1326 into r1327; + cast r1327 14field into r1328 as Share; + cast r3[13u32] r1328 into r1329 as ValidatorShareData; + mul 1field 15field into r1330; + sub r4 1u8 into r1331; + lt 0u8 r1331 into r1332; + mul r2[0u32] r1330 into r1333; + ternary r1332 r1333 0field into r1334; + add r0 r1334 into r1335; + mul r1330 15field into r1336; + sub r4 1u8 into r1337; + lt 1u8 r1337 into r1338; + mul r2[1u32] r1336 into r1339; + ternary r1338 r1339 0field into r1340; + add r1335 r1340 into r1341; + mul r1336 15field into r1342; + sub r4 1u8 into r1343; + lt 2u8 r1343 into r1344; + mul r2[2u32] r1342 into r1345; + ternary r1344 r1345 0field into r1346; + add r1341 r1346 into r1347; + mul r1342 15field into r1348; + sub r4 1u8 into r1349; + lt 3u8 r1349 into r1350; + mul r2[3u32] r1348 into r1351; + ternary r1350 r1351 0field into r1352; + add r1347 r1352 into r1353; + mul r1348 15field into r1354; + sub r4 1u8 into r1355; + lt 4u8 r1355 into r1356; + mul r2[4u32] r1354 into r1357; + ternary r1356 r1357 0field into r1358; + add r1353 r1358 into r1359; + mul r1354 15field into r1360; + sub r4 1u8 into r1361; + lt 5u8 r1361 into r1362; + mul r2[5u32] r1360 into r1363; + ternary r1362 r1363 0field into r1364; + add r1359 r1364 into r1365; + mul r1360 15field into r1366; + sub r4 1u8 into r1367; + lt 6u8 r1367 into r1368; + mul r2[6u32] r1366 into r1369; + ternary r1368 r1369 0field into r1370; + add r1365 r1370 into r1371; + mul r1366 15field into r1372; + sub r4 1u8 into r1373; + lt 7u8 r1373 into r1374; + mul r2[7u32] r1372 into r1375; + ternary r1374 r1375 0field into r1376; + add r1371 r1376 into r1377; + mul r1372 15field into r1378; + sub r4 1u8 into r1379; + lt 8u8 r1379 into r1380; + mul r2[8u32] r1378 into r1381; + ternary r1380 r1381 0field into r1382; + add r1377 r1382 into r1383; + mul r1378 15field into r1384; + sub r4 1u8 into r1385; + lt 9u8 r1385 into r1386; + mul r2[9u32] r1384 into r1387; + ternary r1386 r1387 0field into r1388; + add r1383 r1388 into r1389; + mul r1384 15field into r1390; + sub r4 1u8 into r1391; + lt 10u8 r1391 into r1392; + mul r2[10u32] r1390 into r1393; + ternary r1392 r1393 0field into r1394; + add r1389 r1394 into r1395; + mul r1390 15field into r1396; + sub r4 1u8 into r1397; + lt 11u8 r1397 into r1398; + mul r2[11u32] r1396 into r1399; + ternary r1398 r1399 0field into r1400; + add r1395 r1400 into r1401; + mul r1396 15field into r1402; + sub r4 1u8 into r1403; + lt 12u8 r1403 into r1404; + mul r2[12u32] r1402 into r1405; + ternary r1404 r1405 0field into r1406; + add r1401 r1406 into r1407; + mul r1402 15field into r1408; + sub r4 1u8 into r1409; + lt 13u8 r1409 into r1410; + mul r2[13u32] r1408 into r1411; + ternary r1410 r1411 0field into r1412; + add r1407 r1412 into r1413; + mul r1408 15field into r1414; + sub r4 1u8 into r1415; + lt 14u8 r1415 into r1416; + mul r2[14u32] r1414 into r1417; + ternary r1416 r1417 0field into r1418; + add r1413 r1418 into r1419; + cast r1419 15field into r1420 as Share; + cast r3[14u32] r1420 into r1421 as ValidatorShareData; + mul 1field 16field into r1422; + sub r4 1u8 into r1423; + lt 0u8 r1423 into r1424; + mul r2[0u32] r1422 into r1425; + ternary r1424 r1425 0field into r1426; + add r0 r1426 into r1427; + mul r1422 16field into r1428; + sub r4 1u8 into r1429; + lt 1u8 r1429 into r1430; + mul r2[1u32] r1428 into r1431; + ternary r1430 r1431 0field into r1432; + add r1427 r1432 into r1433; + mul r1428 16field into r1434; + sub r4 1u8 into r1435; + lt 2u8 r1435 into r1436; + mul r2[2u32] r1434 into r1437; + ternary r1436 r1437 0field into r1438; + add r1433 r1438 into r1439; + mul r1434 16field into r1440; + sub r4 1u8 into r1441; + lt 3u8 r1441 into r1442; + mul r2[3u32] r1440 into r1443; + ternary r1442 r1443 0field into r1444; + add r1439 r1444 into r1445; + mul r1440 16field into r1446; + sub r4 1u8 into r1447; + lt 4u8 r1447 into r1448; + mul r2[4u32] r1446 into r1449; + ternary r1448 r1449 0field into r1450; + add r1445 r1450 into r1451; + mul r1446 16field into r1452; + sub r4 1u8 into r1453; + lt 5u8 r1453 into r1454; + mul r2[5u32] r1452 into r1455; + ternary r1454 r1455 0field into r1456; + add r1451 r1456 into r1457; + mul r1452 16field into r1458; + sub r4 1u8 into r1459; + lt 6u8 r1459 into r1460; + mul r2[6u32] r1458 into r1461; + ternary r1460 r1461 0field into r1462; + add r1457 r1462 into r1463; + mul r1458 16field into r1464; + sub r4 1u8 into r1465; + lt 7u8 r1465 into r1466; + mul r2[7u32] r1464 into r1467; + ternary r1466 r1467 0field into r1468; + add r1463 r1468 into r1469; + mul r1464 16field into r1470; + sub r4 1u8 into r1471; + lt 8u8 r1471 into r1472; + mul r2[8u32] r1470 into r1473; + ternary r1472 r1473 0field into r1474; + add r1469 r1474 into r1475; + mul r1470 16field into r1476; + sub r4 1u8 into r1477; + lt 9u8 r1477 into r1478; + mul r2[9u32] r1476 into r1479; + ternary r1478 r1479 0field into r1480; + add r1475 r1480 into r1481; + mul r1476 16field into r1482; + sub r4 1u8 into r1483; + lt 10u8 r1483 into r1484; + mul r2[10u32] r1482 into r1485; + ternary r1484 r1485 0field into r1486; + add r1481 r1486 into r1487; + mul r1482 16field into r1488; + sub r4 1u8 into r1489; + lt 11u8 r1489 into r1490; + mul r2[11u32] r1488 into r1491; + ternary r1490 r1491 0field into r1492; + add r1487 r1492 into r1493; + mul r1488 16field into r1494; + sub r4 1u8 into r1495; + lt 12u8 r1495 into r1496; + mul r2[12u32] r1494 into r1497; + ternary r1496 r1497 0field into r1498; + add r1493 r1498 into r1499; + mul r1494 16field into r1500; + sub r4 1u8 into r1501; + lt 13u8 r1501 into r1502; + mul r2[13u32] r1500 into r1503; + ternary r1502 r1503 0field into r1504; + add r1499 r1504 into r1505; + mul r1500 16field into r1506; + sub r4 1u8 into r1507; + lt 14u8 r1507 into r1508; + mul r2[14u32] r1506 into r1509; + ternary r1508 r1509 0field into r1510; + add r1505 r1510 into r1511; + cast r1511 16field into r1512 as Share; + cast r3[15u32] r1512 into r1513 as ValidatorShareData; + cast r133 r225 r317 r409 r501 r593 r685 r777 r869 r961 r1053 r1145 r1237 r1329 r1421 r1513 into r1514 as [ValidatorShareData; 16u32]; + call dcp_validator_shares.aleo/submit_shares_to_validators r1514 r40 r39 true into r1515 r1516 r1517 r1518 r1519 r1520 r1521 r1522 r1523 r1524 r1525 r1526 r1527 r1528 r1529 r1530; + call dcp_core_protocol.aleo/custody_data_as_program r41 r3 r39 into r1531; + async add_private r1531 into r1532; + output r1532 as data_custody_protocol.aleo/add_private.future; -finalize custody_data_as_program: +finalize add_private: input r0 as dcp_core_protocol.aleo/custody_data_as_program.future; await r0; -function request_data_as_program: +function add_or_mul_public: input r0 as field.private; - input r1 as address.private; - input r2 as u8.private; - input r3 as u64.public; - input r4 as [address; 16u32].public; - input r5 as u64.private; - input r6 as credits.aleo/credits.record; - assert.neq self.caller self.signer; - cast self.caller r0 r2 into r7 as Custody; + input r1 as boolean.private; + input r2 as field.private; + input r3 as [address; 16u32].public; + input r4 as u8.private; + cast r1 r0 false into r5 as Operation; + hash.bhp256 r5 into r6 as field; + cast self.caller r2 r4 into r7 as Custody; hash.bhp256 r7 into r8 as field; - cast r4[0u32] r4[1u32] r4[2u32] r4[3u32] r4[4u32] r4[5u32] r4[6u32] r4[7u32] r4[8u32] r4[9u32] r4[10u32] r4[11u32] r4[12u32] r4[13u32] r4[14u32] r4[15u32] into r9 as [address; 16u32]; - call dcp_withdraw_requests.aleo/submit_requests_to_validators r9 r8 r1 r5 r3 into r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25; - cast 16u8 into r26 as u64; - mul r26 r5 into r27; - call credits.aleo/transfer_private_to_public r6 dcp_fee_management.aleo r27 into r28 r29; - call dcp_core_protocol.aleo/request_data_as_program r8 r4 r3 into r30; - async request_data_as_program r30 r29 into r31; - output r28 as credits.aleo/credits.record; - output r31 as data_custody_protocol.aleo/request_data_as_program.future; + cast r0 1field into r9 as Share; + cast r3[0u32] r9 into r10 as ValidatorShareData; + cast r0 2field into r11 as Share; + cast r3[1u32] r11 into r12 as ValidatorShareData; + cast r0 3field into r13 as Share; + cast r3[2u32] r13 into r14 as ValidatorShareData; + cast r0 4field into r15 as Share; + cast r3[3u32] r15 into r16 as ValidatorShareData; + cast r0 5field into r17 as Share; + cast r3[4u32] r17 into r18 as ValidatorShareData; + cast r0 6field into r19 as Share; + cast r3[5u32] r19 into r20 as ValidatorShareData; + cast r0 7field into r21 as Share; + cast r3[6u32] r21 into r22 as ValidatorShareData; + cast r0 8field into r23 as Share; + cast r3[7u32] r23 into r24 as ValidatorShareData; + cast r0 9field into r25 as Share; + cast r3[8u32] r25 into r26 as ValidatorShareData; + cast r0 10field into r27 as Share; + cast r3[9u32] r27 into r28 as ValidatorShareData; + cast r0 11field into r29 as Share; + cast r3[10u32] r29 into r30 as ValidatorShareData; + cast r0 12field into r31 as Share; + cast r3[11u32] r31 into r32 as ValidatorShareData; + cast r0 13field into r33 as Share; + cast r3[12u32] r33 into r34 as ValidatorShareData; + cast r0 14field into r35 as Share; + cast r3[13u32] r35 into r36 as ValidatorShareData; + cast r0 15field into r37 as Share; + cast r3[14u32] r37 into r38 as ValidatorShareData; + cast r0 16field into r39 as Share; + cast r3[15u32] r39 into r40 as ValidatorShareData; + cast r10 r12 r14 r16 r18 r20 r22 r24 r26 r28 r30 r32 r34 r36 r38 r40 into r41 as [ValidatorShareData; 16u32]; + call dcp_validator_shares.aleo/submit_shares_to_validators r41 r7 r6 r1 into r42 r43 r44 r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57; + call dcp_core_protocol.aleo/custody_data_as_program r8 r3 r6 into r58; + async add_or_mul_public r58 into r59; + output r59 as data_custody_protocol.aleo/add_or_mul_public.future; -finalize request_data_as_program: - input r0 as dcp_core_protocol.aleo/request_data_as_program.future; - input r1 as credits.aleo/transfer_private_to_public.future; +finalize add_or_mul_public: + input r0 as dcp_core_protocol.aleo/custody_data_as_program.future; await r0; - await r1; + + diff --git a/programs/data_custody_protocol/program.json b/programs/data_custody_protocol/program.json index e29c740..61d0b28 100644 --- a/programs/data_custody_protocol/program.json +++ b/programs/data_custody_protocol/program.json @@ -17,10 +17,10 @@ "path": "../dcp_validator_shares" }, { - "name": "dcp_withdraw_requests.aleo", + "name": "dcp_open_requests.aleo", "location": "local", "network": null, - "path": "../dcp_withdraw_requests" + "path": "../dcp_open_requests" } ] } \ No newline at end of file diff --git a/programs/data_custody_protocol/src/main.leo b/programs/data_custody_protocol/src/main.leo index 4fc8c9b..1bc4235 100644 --- a/programs/data_custody_protocol/src/main.leo +++ b/programs/data_custody_protocol/src/main.leo @@ -6,21 +6,38 @@ import dcp_core_protocol.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import credits.aleo; program data_custody_protocol.aleo { const MAX_VALIDATORS: u8 = 16u8; const MAX_VALIDATORS_MINUS_1: u8 = 15u8; const VALIDATORS_PER_BATCH: u8 = 16u8; - // 1 block every 5s ? - const INCENTIVE_TTL: u32 = 120u32; // 10min - const HEIGHT_RANGE: u32 = 60u32; // 5min + + // 1 block every 5s + const INCENTIVE_TTL: u32 = 180u32; // blocks, ~15min + const HEIGHT_MARGIN: u32 = 60u32; // blocks, ~5min + + + struct Operation { + is_addition: bool, + operand_value: field, + is_operand_private: bool + } inline hash_custody(custody: Custody) -> field { return BHP256::hash_to_field(custody); } + inline compute_trace(operation: Operation, obfuscator: scalar) -> field { + let operation_hash: field = BHP256::hash_to_field(operation); + return ( + operation.is_operand_private ? + BHP256::commit_to_field(operation_hash, obfuscator) : + operation_hash + ); + } + inline evaluate_polynomial( coefficients: [field; 15], // MAX_VALIDATORS_MINUS_1 threshold: u8, @@ -44,194 +61,398 @@ program data_custody_protocol.aleo { return result; } + /* + const address_gen: group = + 522678458525321116977504528531602186870683848189190546523208313015552693483group; + inline viewkey_to_address(view_key: scalar) -> address { + return (view_key * address_gen) as address; + } + ... + + let secret: field = data_view_key as field; + let data_address: address = viewkey_to_address(data_view_key); + let custody_key: field = BHP256::commit_to_field( + data_address, data_address_obfuscator + ); + */ + + async transition add_private( + private value: field, + private custody_key: field, + private coefficients: [field; 15], // MAX_VALIDATORS_MINUS_1 + public validators: [address; 16], // MAX_VALIDATORS + private threshold: u8, // <= MAX_VALIDATORS + private obfuscator: scalar + ) -> Future { + assert(is_some_coefficient_zero(coefficients).not()); -/* - const address_gen: group = 522678458525321116977504528531602186870683848189190546523208313015552693483group; - inline viewkey_to_address(view_key: scalar) -> address { - return (view_key * address_gen) as address; + let operation: Operation = Operation { + is_addition: true, + operand_value: value, + is_operand_private: true + }; + + let operation_hash: field = BHP256::hash_to_field(operation); + let operation_trace: field = BHP256::commit_to_field( + operation_hash, obfuscator + ); + + let custody: Custody = Custody { + origin: self.caller, + custody_key: custody_key, + threshold: threshold + }; + let custody_hash: field = hash_custody(custody); + + let index_0: field = 1field; + let validator_share_0: ValidatorShareData = ValidatorShareData { + validator: validators[0u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_0, value), + index: index_0 + } + }; + + let index_1: field = 2field; + let validator_share_1: ValidatorShareData = ValidatorShareData { + validator: validators[1u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_1, value), + index: index_1 + } + }; + + let index_2: field = 3field; + let validator_share_2: ValidatorShareData = ValidatorShareData { + validator: validators[2u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_2, value), + index: index_2 + } + }; + + let index_3: field = 4field; + let validator_share_3: ValidatorShareData = ValidatorShareData { + validator: validators[3u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_3, value), + index: index_3 + } + }; + + let index_4: field = 5field; + let validator_share_4: ValidatorShareData = ValidatorShareData { + validator: validators[4u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_4, value), + index: index_4 + } + }; + + let index_5: field = 6field; + let validator_share_5: ValidatorShareData = ValidatorShareData { + validator: validators[5u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_5, value), + index: index_5 + } + }; + + let index_6: field = 7field; + let validator_share_6: ValidatorShareData = ValidatorShareData { + validator: validators[6u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_6, value), + index: index_6 + } + }; + + let index_7: field = 8field; + let validator_share_7: ValidatorShareData = ValidatorShareData { + validator: validators[7u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_7, value), + index: index_7 + } + }; + + let index_8: field = 9field; + let validator_share_8: ValidatorShareData = ValidatorShareData { + validator: validators[8u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_8, value), + index: index_8 + } + }; + + let index_9: field = 10field; + let validator_share_9: ValidatorShareData = ValidatorShareData { + validator: validators[9u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_9, value), + index: index_9 + } + }; + + let index_10: field = 11field; + let validator_share_10: ValidatorShareData = ValidatorShareData { + validator: validators[10u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_10, value), + index: index_10 + } + }; + + let index_11: field = 12field; + let validator_share_11: ValidatorShareData = ValidatorShareData { + validator: validators[11u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_11, value), + index: index_11 + } + }; + + let index_12: field = 13field; + let validator_share_12: ValidatorShareData = ValidatorShareData { + validator: validators[12u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_12, value), + index: index_12 + } + }; + + let index_13: field = 14field; + let validator_share_13: ValidatorShareData = ValidatorShareData { + validator: validators[13u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_13, value), + index: index_13 + } + }; + + let index_14: field = 15field; + let validator_share_14: ValidatorShareData = ValidatorShareData { + validator: validators[14u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_14, value), + index: index_14 + } + }; + + let index_15: field = 16field; + let validator_share_15: ValidatorShareData = ValidatorShareData { + validator: validators[15u8], + share: Share { + share_val: evaluate_polynomial(coefficients, threshold, index_15, value), + index: index_15 + } + }; + + let validator_shares: [ValidatorShareData; 16] = [ // VALIDATORS_PER_BATCH + validator_share_0, + validator_share_1, + validator_share_2, + validator_share_3, + validator_share_4, + validator_share_5, + validator_share_6, + validator_share_7, + validator_share_8, + validator_share_9, + validator_share_10, + validator_share_11, + validator_share_12, + validator_share_13, + validator_share_14, + validator_share_15, + ]; + dcp_validator_shares.aleo/submit_shares_to_validators( + validator_shares, + custody, + operation_trace, + true + ); + + let protocol_core_future: Future = dcp_core_protocol.aleo/custody_data_as_program( + custody_hash, + validators, + operation_trace + ); + + return finalize_add_private( + protocol_core_future + ); } - ... - - let secret: field = data_view_key as field; - let data_address: address = viewkey_to_address(data_view_key); - let custody_key: field = BHP256::commit_to_field(data_address, data_address_obfuscator); -*/ + async function finalize_add_private( + protocol_core_future: Future + ){ + protocol_core_future.await(); + } + - async transition custody_data_as_program( - private secret: field, + async transition add_or_mul_public( + private value: field, + private is_addition: bool, private custody_key: field, - private coefficients: [field; 15], // MAX_VALIDATORS_MINUS_1 public validators: [address; 16], // MAX_VALIDATORS private threshold: u8, // <= MAX_VALIDATORS ) -> Future { - assert_neq(self.caller, self.signer); - assert(is_some_coefficient_zero(coefficients).not()); + let operation: Operation = Operation { + is_addition: is_addition, + operand_value: value, + is_operand_private: false + }; + let operation_trace: field = BHP256::hash_to_field(operation); - let custodied_data: Custody = Custody { + let custody: Custody = Custody { origin: self.caller, custody_key: custody_key, threshold: threshold }; - let custody_hash: field = hash_custody(custodied_data); + let custody_hash: field = hash_custody(custody); let index_0: field = 1field; let validator_share_0: ValidatorShareData = ValidatorShareData { validator: validators[0u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_0, secret), + share_val: value, index: index_0 - }, - weight: 1u64 + } }; let index_1: field = 2field; let validator_share_1: ValidatorShareData = ValidatorShareData { validator: validators[1u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_1, secret), + share_val: value, index: index_1 - }, - weight: 1u64 + } }; let index_2: field = 3field; let validator_share_2: ValidatorShareData = ValidatorShareData { validator: validators[2u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_2, secret), + share_val: value, index: index_2 - }, - weight: 1u64 + } }; let index_3: field = 4field; let validator_share_3: ValidatorShareData = ValidatorShareData { validator: validators[3u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_3, secret), + share_val: value, index: index_3 - }, - weight: 1u64 + } }; let index_4: field = 5field; let validator_share_4: ValidatorShareData = ValidatorShareData { validator: validators[4u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_4, secret), + share_val: value, index: index_4 - }, - weight: 1u64 + } }; let index_5: field = 6field; let validator_share_5: ValidatorShareData = ValidatorShareData { validator: validators[5u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_5, secret), + share_val: value, index: index_5 - }, - weight: 1u64 + } }; let index_6: field = 7field; let validator_share_6: ValidatorShareData = ValidatorShareData { validator: validators[6u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_6, secret), + share_val: value, index: index_6 - }, - weight: 1u64 + } }; let index_7: field = 8field; let validator_share_7: ValidatorShareData = ValidatorShareData { validator: validators[7u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_7, secret), + share_val: value, index: index_7 - }, - weight: 1u64 + } }; let index_8: field = 9field; let validator_share_8: ValidatorShareData = ValidatorShareData { validator: validators[8u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_8, secret), + share_val: value, index: index_8 - }, - weight: 1u64 + } }; let index_9: field = 10field; let validator_share_9: ValidatorShareData = ValidatorShareData { validator: validators[9u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_9, secret), + share_val: value, index: index_9 - }, - weight: 1u64 + } }; let index_10: field = 11field; let validator_share_10: ValidatorShareData = ValidatorShareData { validator: validators[10u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_10, secret), + share_val: value, index: index_10 - }, - weight: 1u64 + } }; let index_11: field = 12field; let validator_share_11: ValidatorShareData = ValidatorShareData { validator: validators[11u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_11, secret), + share_val: value, index: index_11 - }, - weight: 1u64 + } }; let index_12: field = 13field; let validator_share_12: ValidatorShareData = ValidatorShareData { validator: validators[12u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_12, secret), + share_val: value, index: index_12 - }, - weight: 1u64 + } }; let index_13: field = 14field; let validator_share_13: ValidatorShareData = ValidatorShareData { validator: validators[13u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_13, secret), + share_val: value, index: index_13 - }, - weight: 1u64 + } }; let index_14: field = 15field; let validator_share_14: ValidatorShareData = ValidatorShareData { validator: validators[14u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_14, secret), + share_val: value, index: index_14 - }, - weight: 1u64 + } }; let index_15: field = 16field; let validator_share_15: ValidatorShareData = ValidatorShareData { validator: validators[15u8], share: Share { - share_val: evaluate_polynomial(coefficients, threshold, index_15, secret), + share_val: value, index: index_15 - }, - weight: 1u64 + } }; let validator_shares: [ValidatorShareData; 16] = [ // VALIDATORS_PER_BATCH @@ -254,42 +475,44 @@ program data_custody_protocol.aleo { ]; dcp_validator_shares.aleo/submit_shares_to_validators( validator_shares, - custodied_data + custody, + operation_trace, + is_addition ); let protocol_core_future: Future = dcp_core_protocol.aleo/custody_data_as_program( custody_hash, - validators + validators, + operation_trace ); - return finalize_custody_data_as_program( + return finalize_add_or_mul_public( protocol_core_future ); } - async function finalize_custody_data_as_program( + async function finalize_add_or_mul_public( protocol_core_future: Future ){ protocol_core_future.await(); } - async transition request_data_as_program( + async transition request_open( private custody_key: field, private to: address, private threshold: u8, - public expected_weight: u64, + public custody_trace: field, public validators: [address; 16], // MAX_VALIDATORS private validator_fee: u64, private protocol_fee_record: credits.aleo/credits, - public current_height: u32 + public transaction_geneneration_height: u32 ) -> (credits.aleo/credits, Future) { - assert_neq(self.caller, self.signer); - let custodied_data: Custody = Custody { + let custody: Custody = Custody { origin: self.caller, custody_key: custody_key, threshold: threshold }; - let custody_hash: field = hash_custody(custodied_data); + let custody_hash: field = hash_custody(custody); let validators_0: [address; 16] = [ // VALIDATORS_PER_BATCH validators[0u8], @@ -310,13 +533,13 @@ program data_custody_protocol.aleo { validators[15u8] ]; // Submit batch 1 - dcp_withdraw_requests.aleo/submit_requests_to_validators( + dcp_open_requests.aleo/submit_requests_to_validators( validators_0, custody_hash, to, validator_fee, - expected_weight, - current_height + INCENTIVE_TTL + custody_trace, + transaction_geneneration_height + HEIGHT_MARGIN + INCENTIVE_TTL ); let protocol_fee_amount: u64 = (MAX_VALIDATORS as u64) * validator_fee; @@ -329,39 +552,38 @@ program data_custody_protocol.aleo { protocol_fee_amount, ); - let protocol_core_future: Future = dcp_core_protocol.aleo/request_data_as_program( + let protocol_core_future: Future = dcp_core_protocol.aleo/request_open( custody_hash, validators, - expected_weight + custody_trace ); - let request_data_as_program_future: Future = finalize_request_data_as_program( - current_height, + let request_open_future: Future = finalize_request_open( + transaction_geneneration_height, protocol_core_future, lock_fee_future ); - return (protocol_fee_change, request_data_as_program_future); + return (protocol_fee_change, request_open_future); } - async function finalize_request_data_as_program( - pretended_current_height: u32 + async function finalize_request_open( + pretended_geneneration_height: u32, protocol_core_future: Future, lock_fee_future: Future ){ let actual_height: u32 = block.height; - assert(pretended_current_height <= actual_height); - assert(actual_height <= pretended_current_height + HEIGHT_RANGE); + assert(pretended_geneneration_height <= actual_height); + assert(actual_height <= pretended_geneneration_height + HEIGHT_MARGIN); /* - -------|------------------|---------------------|------------|--------> - tx gen height finalize exec height Max accepted Incentive dies - <--------------------------------------> - HEIGHT_RANGE - <----------------------------------------------------> - INCENTIVE_TTL + -------|----------------|---------------------|------------------|----> + TX gen height Actual TX height Max accepted TX height Incentive dies + <------------------------------------> + HEIGHT_MARGIN + <-----------------> + INCENTIVE_TTL */ protocol_core_future.await(); lock_fee_future.await(); } } - diff --git a/programs/dcp_withdraw_requests/.gitignore b/programs/dcp_beaver_triples/.gitignore similarity index 100% rename from programs/dcp_withdraw_requests/.gitignore rename to programs/dcp_beaver_triples/.gitignore diff --git a/programs/dcp_withdraw_requests/program.json b/programs/dcp_beaver_triples/program.json similarity index 67% rename from programs/dcp_withdraw_requests/program.json rename to programs/dcp_beaver_triples/program.json index a31dcd5..d8e8498 100644 --- a/programs/dcp_withdraw_requests/program.json +++ b/programs/dcp_beaver_triples/program.json @@ -1,5 +1,5 @@ { - "program": "dcp_withdraw_requests.aleo", + "program": "dcp_beaver_triples.aleo", "version": "0.1.0", "description": "", "license": "MIT", diff --git a/programs/dcp_beaver_triples/src/main.leo b/programs/dcp_beaver_triples/src/main.leo new file mode 100644 index 0000000..0720d69 --- /dev/null +++ b/programs/dcp_beaver_triples/src/main.leo @@ -0,0 +1,7 @@ +// The 'dcp_beaver_triples' program. +program dcp_beaver_triples.aleo { + transition main(public a: u32, b: u32) -> u32 { + let c: u32 = a + b; + return c; + } +} diff --git a/programs/dcp_core_protocol/build/imports/dcp_fee_management.aleo b/programs/dcp_core_protocol/build/imports/dcp_fee_management.aleo index ffc7c7f..52153ca 100644 --- a/programs/dcp_core_protocol/build/imports/dcp_fee_management.aleo +++ b/programs/dcp_core_protocol/build/imports/dcp_fee_management.aleo @@ -5,26 +5,33 @@ program dcp_fee_management.aleo; record Fee: owner as address.private; microcredits as u64.private; + expire as u32.private; function mint_fee: input r0 as address.public; input r1 as u64.private; + input r2 as u32.private; assert.eq self.caller dcp_core_protocol.aleo; - cast r0 r1 into r2 as Fee.record; - output r2 as Fee.record; + cast r0 r1 r2 into r3 as Fee.record; + output r3 as Fee.record; function burn_fee: input r0 as Fee.record; call credits.aleo/transfer_public r0.owner r0.microcredits into r1; - async burn_fee r1 into r2; + async burn_fee r1 r0.expire into r2; output r2 as dcp_fee_management.aleo/burn_fee.future; finalize burn_fee: input r0 as credits.aleo/transfer_public.future; + input r1 as u32.public; await r0; + gte r1 block.height into r2; + assert.eq r2 true; + + @@ -32,5 +39,7 @@ function join_fee: input r0 as Fee.record; input r1 as Fee.record; add r0.microcredits r1.microcredits into r2; - cast r0.owner r2 into r3 as Fee.record; - output r3 as Fee.record; + lt r0.expire r1.expire into r3; + ternary r3 r0.expire r1.expire into r4; + cast r0.owner r2 r4 into r5 as Fee.record; + output r5 as Fee.record; diff --git a/programs/dcp_core_protocol/build/imports/dcp_open_requests.aleo b/programs/dcp_core_protocol/build/imports/dcp_open_requests.aleo new file mode 100644 index 0000000..20d8a15 --- /dev/null +++ b/programs/dcp_core_protocol/build/imports/dcp_open_requests.aleo @@ -0,0 +1,56 @@ +program dcp_open_requests.aleo; + +record OpenRequest: + owner as address.private; + custody_hash as field.private; + to as address.private; + fee_amount as u64.private; + custody_trace as field.private; + expire as u32.private; + + +function submit_requests_to_validators: + input r0 as [address; 16u32].public; + input r1 as field.public; + input r2 as address.private; + input r3 as u64.private; + input r4 as field.public; + input r5 as u32.public; + assert.eq self.caller data_custody_protocol.aleo; + cast r0[0u32] r1 r2 r3 r4 r5 into r6 as OpenRequest.record; + cast r0[1u32] r1 r2 r3 r4 r5 into r7 as OpenRequest.record; + cast r0[2u32] r1 r2 r3 r4 r5 into r8 as OpenRequest.record; + cast r0[3u32] r1 r2 r3 r4 r5 into r9 as OpenRequest.record; + cast r0[4u32] r1 r2 r3 r4 r5 into r10 as OpenRequest.record; + cast r0[5u32] r1 r2 r3 r4 r5 into r11 as OpenRequest.record; + cast r0[6u32] r1 r2 r3 r4 r5 into r12 as OpenRequest.record; + cast r0[7u32] r1 r2 r3 r4 r5 into r13 as OpenRequest.record; + cast r0[8u32] r1 r2 r3 r4 r5 into r14 as OpenRequest.record; + cast r0[9u32] r1 r2 r3 r4 r5 into r15 as OpenRequest.record; + cast r0[10u32] r1 r2 r3 r4 r5 into r16 as OpenRequest.record; + cast r0[11u32] r1 r2 r3 r4 r5 into r17 as OpenRequest.record; + cast r0[12u32] r1 r2 r3 r4 r5 into r18 as OpenRequest.record; + cast r0[13u32] r1 r2 r3 r4 r5 into r19 as OpenRequest.record; + cast r0[14u32] r1 r2 r3 r4 r5 into r20 as OpenRequest.record; + cast r0[15u32] r1 r2 r3 r4 r5 into r21 as OpenRequest.record; + output r6 as OpenRequest.record; + output r7 as OpenRequest.record; + output r8 as OpenRequest.record; + output r9 as OpenRequest.record; + output r10 as OpenRequest.record; + output r11 as OpenRequest.record; + output r12 as OpenRequest.record; + output r13 as OpenRequest.record; + output r14 as OpenRequest.record; + output r15 as OpenRequest.record; + output r16 as OpenRequest.record; + output r17 as OpenRequest.record; + output r18 as OpenRequest.record; + output r19 as OpenRequest.record; + output r20 as OpenRequest.record; + output r21 as OpenRequest.record; + + +function spend_open_request: + input r0 as OpenRequest.record; + assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/dcp_core_protocol/build/imports/dcp_validator_shares.aleo b/programs/dcp_core_protocol/build/imports/dcp_validator_shares.aleo index 4ec6922..604611c 100644 --- a/programs/dcp_core_protocol/build/imports/dcp_validator_shares.aleo +++ b/programs/dcp_core_protocol/build/imports/dcp_validator_shares.aleo @@ -12,37 +12,37 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; record ValidatorShare: owner as address.private; share as Share.private; custody as Custody.private; - weight as u64.private; + custody_trace as field.private; + is_addition as boolean.private; function submit_shares_to_validators: input r0 as [ValidatorShareData; 16u32].private; input r1 as Custody.private; + input r2 as field.private; + input r3 as boolean.private; assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32].validator r0[0u32].share r1 r0[0u32].weight into r2 as ValidatorShare.record; - cast r0[1u32].validator r0[1u32].share r1 r0[1u32].weight into r3 as ValidatorShare.record; - cast r0[2u32].validator r0[2u32].share r1 r0[2u32].weight into r4 as ValidatorShare.record; - cast r0[3u32].validator r0[3u32].share r1 r0[3u32].weight into r5 as ValidatorShare.record; - cast r0[4u32].validator r0[4u32].share r1 r0[4u32].weight into r6 as ValidatorShare.record; - cast r0[5u32].validator r0[5u32].share r1 r0[5u32].weight into r7 as ValidatorShare.record; - cast r0[6u32].validator r0[6u32].share r1 r0[6u32].weight into r8 as ValidatorShare.record; - cast r0[7u32].validator r0[7u32].share r1 r0[7u32].weight into r9 as ValidatorShare.record; - cast r0[8u32].validator r0[8u32].share r1 r0[8u32].weight into r10 as ValidatorShare.record; - cast r0[9u32].validator r0[9u32].share r1 r0[9u32].weight into r11 as ValidatorShare.record; - cast r0[10u32].validator r0[10u32].share r1 r0[10u32].weight into r12 as ValidatorShare.record; - cast r0[11u32].validator r0[11u32].share r1 r0[11u32].weight into r13 as ValidatorShare.record; - cast r0[12u32].validator r0[12u32].share r1 r0[12u32].weight into r14 as ValidatorShare.record; - cast r0[13u32].validator r0[13u32].share r1 r0[13u32].weight into r15 as ValidatorShare.record; - cast r0[14u32].validator r0[14u32].share r1 r0[14u32].weight into r16 as ValidatorShare.record; - cast r0[15u32].validator r0[15u32].share r1 r0[15u32].weight into r17 as ValidatorShare.record; - output r2 as ValidatorShare.record; - output r3 as ValidatorShare.record; + cast r0[0u32].validator r0[0u32].share r1 r2 r3 into r4 as ValidatorShare.record; + cast r0[1u32].validator r0[1u32].share r1 r2 r3 into r5 as ValidatorShare.record; + cast r0[2u32].validator r0[2u32].share r1 r2 r3 into r6 as ValidatorShare.record; + cast r0[3u32].validator r0[3u32].share r1 r2 r3 into r7 as ValidatorShare.record; + cast r0[4u32].validator r0[4u32].share r1 r2 r3 into r8 as ValidatorShare.record; + cast r0[5u32].validator r0[5u32].share r1 r2 r3 into r9 as ValidatorShare.record; + cast r0[6u32].validator r0[6u32].share r1 r2 r3 into r10 as ValidatorShare.record; + cast r0[7u32].validator r0[7u32].share r1 r2 r3 into r11 as ValidatorShare.record; + cast r0[8u32].validator r0[8u32].share r1 r2 r3 into r12 as ValidatorShare.record; + cast r0[9u32].validator r0[9u32].share r1 r2 r3 into r13 as ValidatorShare.record; + cast r0[10u32].validator r0[10u32].share r1 r2 r3 into r14 as ValidatorShare.record; + cast r0[11u32].validator r0[11u32].share r1 r2 r3 into r15 as ValidatorShare.record; + cast r0[12u32].validator r0[12u32].share r1 r2 r3 into r16 as ValidatorShare.record; + cast r0[13u32].validator r0[13u32].share r1 r2 r3 into r17 as ValidatorShare.record; + cast r0[14u32].validator r0[14u32].share r1 r2 r3 into r18 as ValidatorShare.record; + cast r0[15u32].validator r0[15u32].share r1 r2 r3 into r19 as ValidatorShare.record; output r4 as ValidatorShare.record; output r5 as ValidatorShare.record; output r6 as ValidatorShare.record; @@ -57,6 +57,10 @@ function submit_shares_to_validators: output r15 as ValidatorShare.record; output r16 as ValidatorShare.record; output r17 as ValidatorShare.record; + output r18 as ValidatorShare.record; + output r19 as ValidatorShare.record; + + function join_shares_as_validator: @@ -67,7 +71,10 @@ function join_shares_as_validator: is.eq r0.share.index r1.share.index into r3; assert.eq r3 true; add r0.share.share_val r1.share.share_val into r4; - cast r4 r0.share.index into r5 as Share; - add r0.weight r1.weight into r6; - cast self.signer r5 r0.custody r6 into r7 as ValidatorShare.record; - output r7 as ValidatorShare.record; + mul r0.share.share_val r1.share.share_val into r5; + ternary r1.is_addition r4 r5 into r6; + cast r6 r0.share.index into r7 as Share; + cast r0.custody_trace r1.custody_trace into r8 as [field; 2u32]; + hash.bhp256 r8 into r9 as field; + cast self.signer r7 r0.custody r9 r1.is_addition into r10 as ValidatorShare.record; + output r10 as ValidatorShare.record; diff --git a/programs/dcp_core_protocol/build/imports/dcp_withdraw_requests.aleo b/programs/dcp_core_protocol/build/imports/dcp_withdraw_requests.aleo deleted file mode 100644 index 9c9b144..0000000 --- a/programs/dcp_core_protocol/build/imports/dcp_withdraw_requests.aleo +++ /dev/null @@ -1,54 +0,0 @@ -program dcp_withdraw_requests.aleo; - -record WithdrawRequest: - owner as address.private; - custody_hash as field.private; - to as address.private; - fee_amount as u64.private; - expected_weight as u64.private; - - -function submit_requests_to_validators: - input r0 as [address; 16u32].public; - input r1 as field.public; - input r2 as address.private; - input r3 as u64.private; - input r4 as u64.public; - assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32] r1 r2 r3 r4 into r5 as WithdrawRequest.record; - cast r0[1u32] r1 r2 r3 r4 into r6 as WithdrawRequest.record; - cast r0[2u32] r1 r2 r3 r4 into r7 as WithdrawRequest.record; - cast r0[3u32] r1 r2 r3 r4 into r8 as WithdrawRequest.record; - cast r0[4u32] r1 r2 r3 r4 into r9 as WithdrawRequest.record; - cast r0[5u32] r1 r2 r3 r4 into r10 as WithdrawRequest.record; - cast r0[6u32] r1 r2 r3 r4 into r11 as WithdrawRequest.record; - cast r0[7u32] r1 r2 r3 r4 into r12 as WithdrawRequest.record; - cast r0[8u32] r1 r2 r3 r4 into r13 as WithdrawRequest.record; - cast r0[9u32] r1 r2 r3 r4 into r14 as WithdrawRequest.record; - cast r0[10u32] r1 r2 r3 r4 into r15 as WithdrawRequest.record; - cast r0[11u32] r1 r2 r3 r4 into r16 as WithdrawRequest.record; - cast r0[12u32] r1 r2 r3 r4 into r17 as WithdrawRequest.record; - cast r0[13u32] r1 r2 r3 r4 into r18 as WithdrawRequest.record; - cast r0[14u32] r1 r2 r3 r4 into r19 as WithdrawRequest.record; - cast r0[15u32] r1 r2 r3 r4 into r20 as WithdrawRequest.record; - output r5 as WithdrawRequest.record; - output r6 as WithdrawRequest.record; - output r7 as WithdrawRequest.record; - output r8 as WithdrawRequest.record; - output r9 as WithdrawRequest.record; - output r10 as WithdrawRequest.record; - output r11 as WithdrawRequest.record; - output r12 as WithdrawRequest.record; - output r13 as WithdrawRequest.record; - output r14 as WithdrawRequest.record; - output r15 as WithdrawRequest.record; - output r16 as WithdrawRequest.record; - output r17 as WithdrawRequest.record; - output r18 as WithdrawRequest.record; - output r19 as WithdrawRequest.record; - output r20 as WithdrawRequest.record; - - -function spend_withdraw_request: - input r0 as WithdrawRequest.record; - assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/dcp_core_protocol/build/main.aleo b/programs/dcp_core_protocol/build/main.aleo index 53d4db7..c78e878 100644 --- a/programs/dcp_core_protocol/build/main.aleo +++ b/programs/dcp_core_protocol/build/main.aleo @@ -1,6 +1,6 @@ import credits.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import dcp_fee_management.aleo; program dcp_core_protocol.aleo; @@ -17,7 +17,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -29,7 +28,7 @@ struct Proposal: struct CustodyState: validator_set_index as u64; - expected_weight as u64; + custody_trace as field; record DestinationShare: owner as address.private; @@ -339,45 +338,51 @@ finalize accept_proposal: + + function custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async custody_data_as_program r0 r1 into r2; - output r2 as dcp_core_protocol.aleo/custody_data_as_program.future; + async custody_data_as_program r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/custody_data_as_program.future; finalize custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; - cast 0u64 0u64 into r2 as CustodyState; - get.or_use custodies[r0] r2 into r3; - get validator_sets_length[true] into r4; - is.eq r3.expected_weight 0u64 into r5; - sub r4 1u64 into r6; - ternary r5 r6 r3.validator_set_index into r7; - get validator_sets[r7] into r8; - assert.eq r1 r8; - add r3.expected_weight 1u64 into r9; - cast r7 r9 into r10 as CustodyState; - set r10 into custodies[r0]; + input r2 as field.public; + cast 0u64 r2 into r3 as CustodyState; + get.or_use custodies[r0] r3 into r4; + get validator_sets_length[true] into r5; + is.eq r4.custody_trace r2 into r6; + sub r5 1u64 into r7; + ternary r6 r7 r4.validator_set_index into r8; + get validator_sets[r8] into r9; + assert.eq r1 r9; + cast r4.custody_trace r2 into r10 as [field; 2u32]; + hash.bhp256 r10 into r11 as field; + ternary r6 r2 r11 into r12; + cast r8 r12 into r13 as CustodyState; + set r13 into custodies[r0]; -function request_data_as_program: +function request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async request_data_as_program r0 r1 r2 into r3; - output r3 as dcp_core_protocol.aleo/request_data_as_program.future; + async request_open r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/request_open.future; -finalize request_data_as_program: +finalize request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; get custodies[r0] into r3; - assert.eq r2 r3.expected_weight; + assert.eq r2 r3.custody_trace; get validator_sets[r3.validator_set_index] into r4; assert.eq r1 r4; @@ -387,13 +392,13 @@ finalize request_data_as_program: function process_request_as_validator: input r0 as dcp_validator_shares.aleo/ValidatorShare.record; - input r1 as dcp_withdraw_requests.aleo/WithdrawRequest.record; + input r1 as dcp_open_requests.aleo/OpenRequest.record; hash.bhp256 r0.custody into r2 as field; assert.eq r1.custody_hash r2; cast r1.to r0.share r0.custody into r3 as DestinationShare.record; - call dcp_withdraw_requests.aleo/spend_withdraw_request r1; - call dcp_fee_management.aleo/mint_fee self.caller r1.fee_amount into r4; - assert.eq r1.expected_weight r0.weight; + call dcp_open_requests.aleo/spend_open_request r1; + call dcp_fee_management.aleo/mint_fee self.caller r1.fee_amount r1.expire into r4; + assert.eq r1.custody_trace r0.custody_trace; output r3 as DestinationShare.record; output r4 as dcp_fee_management.aleo/Fee.record; diff --git a/programs/dcp_core_protocol/program.json b/programs/dcp_core_protocol/program.json index dea1fb9..869b575 100644 --- a/programs/dcp_core_protocol/program.json +++ b/programs/dcp_core_protocol/program.json @@ -17,10 +17,10 @@ "path": "../dcp_validator_shares" }, { - "name": "dcp_withdraw_requests.aleo", + "name": "dcp_open_requests.aleo", "location": "local", "network": null, - "path": "../dcp_withdraw_requests" + "path": "../dcp_open_requests" }, { "name": "dcp_fee_management.aleo", diff --git a/programs/dcp_core_protocol/src/main.leo b/programs/dcp_core_protocol/src/main.leo index 1b9c742..75f098e 100644 --- a/programs/dcp_core_protocol/src/main.leo +++ b/programs/dcp_core_protocol/src/main.leo @@ -16,7 +16,7 @@ */ import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import dcp_fee_management.aleo; program dcp_core_protocol.aleo { @@ -24,7 +24,6 @@ program dcp_core_protocol.aleo { const ZERO_ADDRESS: address = aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc; const MAX_VALIDATORS: u8 = 16u8; - struct Proposal { validators: [address; 16], // MAX_VALIDATORS threshold: u8, @@ -33,13 +32,13 @@ program dcp_core_protocol.aleo { struct CustodyState { validator_set_index: u64, - expected_weight: u64 + custody_trace: field } struct Custody { origin: address, custody_key: field, - threshold: u8, + threshold: u8 } struct Share { @@ -49,8 +48,7 @@ program dcp_core_protocol.aleo { struct ValidatorShareData { validator: address, - share: Share, - weight: u64 + share: Share } @@ -79,10 +77,13 @@ program dcp_core_protocol.aleo { mapping custodies: field => CustodyState; // hash(Custody) => CustodyState - inline hash_proposal(proposal: Proposal) -> field { return BHP256::hash_to_field(proposal); } + + inline hash_tuple(traces: [field; 2]) -> field{ + return BHP256::hash_to_field(traces); + } inline is_address_in_array( @@ -313,27 +314,33 @@ program dcp_core_protocol.aleo { async transition custody_data_as_program( public custody_hash: field, public validators: [address; 16], // MAX_VALIDATORS + public operation_trace: field ) -> Future { assert_eq(self.caller, data_custody_protocol.aleo); return finalize_custody_data_as_program( custody_hash, validators, + operation_trace ); } async function finalize_custody_data_as_program( custody_hash: field, validators: [address; 16], // MAX_VALIDATORS + operation_trace: field ){ let default_custody_state: CustodyState = CustodyState { validator_set_index: 0u64, - expected_weight: 0u64 + custody_trace: operation_trace }; let custody_state: CustodyState = custodies.get_or_use( custody_hash, default_custody_state ); let validator_sets_len: u64 = validator_sets_length.get(true); - let validator_set_index: u64 = (custody_state.expected_weight == 0u64) ? + let first_custody: bool = ( + custody_state.custody_trace == operation_trace + ); + let validator_set_index: u64 = first_custody ? (validator_sets_len - 1u64) : custody_state.validator_set_index; let validator_set: [address; 16] = validator_sets.get( @@ -341,63 +348,69 @@ program dcp_core_protocol.aleo { ); // MAX_VALIDATORS assert_eq(validators, validator_set); + let new_custody_trace: field = first_custody ? + operation_trace : + hash_tuple([ + custody_state.custody_trace, + operation_trace + ]); + let new_custody_state: CustodyState = CustodyState { validator_set_index: validator_set_index, - expected_weight: custody_state.expected_weight + 1u64 + custody_trace: new_custody_trace }; custodies.set(custody_hash, new_custody_state); } - async transition request_data_as_program( + async transition request_open( public custody_hash: field, public validators: [address; 16], // MAX_VALIDATORS - public expected_weight: u64 + public custody_trace: field ) -> Future { assert_eq(self.caller, data_custody_protocol.aleo); - return finalize_request_data_as_program( + return finalize_request_open( custody_hash, validators, - expected_weight + custody_trace ); } - async function finalize_request_data_as_program( + async function finalize_request_open( custody_hash: field, validators: [address; 16], // MAX_VALIDATORS - expected_weight: u64 + custody_trace: field ){ let custody_state: CustodyState = custodies.get(custody_hash); - assert_eq(expected_weight, custody_state.expected_weight); + assert_eq(custody_trace, custody_state.custody_trace); let validator_set: [address; 16] = validator_sets.get( custody_state.validator_set_index ); // MAX_VALIDATORS - assert_eq(validators, validator_set); } transition process_request_as_validator( validator_share: dcp_validator_shares.aleo/ValidatorShare, - withdraw_request: dcp_withdraw_requests.aleo/WithdrawRequest, + open_request: dcp_open_requests.aleo/OpenRequest, ) -> (DestinationShare, dcp_fee_management.aleo/Fee) { let custody_hash: field = hash_custody(validator_share.custody); - assert_eq(withdraw_request.custody_hash, custody_hash); + assert_eq(open_request.custody_hash, custody_hash); let destination_share: DestinationShare = DestinationShare { - owner: withdraw_request.to, + owner: open_request.to, share: validator_share.share, custody: validator_share.custody }; - dcp_withdraw_requests.aleo/spend_withdraw_request(withdraw_request); + dcp_open_requests.aleo/spend_open_request(open_request); let fee: dcp_fee_management.aleo/Fee = dcp_fee_management.aleo/mint_fee( self.caller, - withdraw_request.fee_amount, - withdraw_request.expire + open_request.fee_amount, + open_request.expire ); - assert_eq(withdraw_request.expected_weight, validator_share.weight); + assert_eq(open_request.custody_trace, validator_share.custody_trace); return (destination_share, fee); } diff --git a/programs/dcp_fee_management/build/main.aleo b/programs/dcp_fee_management/build/main.aleo index ffc7c7f..52153ca 100644 --- a/programs/dcp_fee_management/build/main.aleo +++ b/programs/dcp_fee_management/build/main.aleo @@ -5,26 +5,33 @@ program dcp_fee_management.aleo; record Fee: owner as address.private; microcredits as u64.private; + expire as u32.private; function mint_fee: input r0 as address.public; input r1 as u64.private; + input r2 as u32.private; assert.eq self.caller dcp_core_protocol.aleo; - cast r0 r1 into r2 as Fee.record; - output r2 as Fee.record; + cast r0 r1 r2 into r3 as Fee.record; + output r3 as Fee.record; function burn_fee: input r0 as Fee.record; call credits.aleo/transfer_public r0.owner r0.microcredits into r1; - async burn_fee r1 into r2; + async burn_fee r1 r0.expire into r2; output r2 as dcp_fee_management.aleo/burn_fee.future; finalize burn_fee: input r0 as credits.aleo/transfer_public.future; + input r1 as u32.public; await r0; + gte r1 block.height into r2; + assert.eq r2 true; + + @@ -32,5 +39,7 @@ function join_fee: input r0 as Fee.record; input r1 as Fee.record; add r0.microcredits r1.microcredits into r2; - cast r0.owner r2 into r3 as Fee.record; - output r3 as Fee.record; + lt r0.expire r1.expire into r3; + ternary r3 r0.expire r1.expire into r4; + cast r0.owner r2 r4 into r5 as Fee.record; + output r5 as Fee.record; diff --git a/programs/dcp_fee_management/src/main.leo b/programs/dcp_fee_management/src/main.leo index 69deef9..990adfa 100644 --- a/programs/dcp_fee_management/src/main.leo +++ b/programs/dcp_fee_management/src/main.leo @@ -48,7 +48,7 @@ program dcp_fee_management.aleo { return Fee{ owner: fee_0.owner, microcredits: fee_0.microcredits + fee_1.microcredits, - expire: min_u32(fee_0.expire, fee_2.expire) + expire: min_u32(fee_0.expire, fee_1.expire) }; } } diff --git a/programs/dcp_hash_custody_offchain/build/README.md b/programs/dcp_hash_custody_offchain/build/README.md index e1c15e3..72486da 100644 --- a/programs/dcp_hash_custody_offchain/build/README.md +++ b/programs/dcp_hash_custody_offchain/build/README.md @@ -3,13 +3,11 @@ ## Build Guide To compile this Aleo program, run: - ```bash snarkvm build ``` To execute this Aleo program, run: - ```bash snarkvm run hello ``` diff --git a/programs/dcp_hash_custody_offchain/build/program.json b/programs/dcp_hash_custody_offchain/build/program.json index 0a92c24..e226675 100644 --- a/programs/dcp_hash_custody_offchain/build/program.json +++ b/programs/dcp_hash_custody_offchain/build/program.json @@ -1,6 +1,6 @@ { - "program": "dcp_hash_custody_offchain.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT" -} \ No newline at end of file + "program": "dcp_hash_custody_offchain.aleo", + "version": "0.0.0", + "description": "", + "license": "MIT" +} diff --git a/programs/dcp_open_requests/.gitignore b/programs/dcp_open_requests/.gitignore new file mode 100644 index 0000000..f721f7f --- /dev/null +++ b/programs/dcp_open_requests/.gitignore @@ -0,0 +1,5 @@ +.env +*.avm +*.prover +*.verifier +outputs/ diff --git a/programs/dcp_withdraw_requests/build/README.md b/programs/dcp_open_requests/build/README.md similarity index 83% rename from programs/dcp_withdraw_requests/build/README.md rename to programs/dcp_open_requests/build/README.md index 8bf1e17..b6a6193 100644 --- a/programs/dcp_withdraw_requests/build/README.md +++ b/programs/dcp_open_requests/build/README.md @@ -1,4 +1,4 @@ -# dcp_withdraw_requests.aleo +# dcp_open_requests.aleo ## Build Guide diff --git a/programs/dcp_open_requests/build/main.aleo b/programs/dcp_open_requests/build/main.aleo new file mode 100644 index 0000000..20d8a15 --- /dev/null +++ b/programs/dcp_open_requests/build/main.aleo @@ -0,0 +1,56 @@ +program dcp_open_requests.aleo; + +record OpenRequest: + owner as address.private; + custody_hash as field.private; + to as address.private; + fee_amount as u64.private; + custody_trace as field.private; + expire as u32.private; + + +function submit_requests_to_validators: + input r0 as [address; 16u32].public; + input r1 as field.public; + input r2 as address.private; + input r3 as u64.private; + input r4 as field.public; + input r5 as u32.public; + assert.eq self.caller data_custody_protocol.aleo; + cast r0[0u32] r1 r2 r3 r4 r5 into r6 as OpenRequest.record; + cast r0[1u32] r1 r2 r3 r4 r5 into r7 as OpenRequest.record; + cast r0[2u32] r1 r2 r3 r4 r5 into r8 as OpenRequest.record; + cast r0[3u32] r1 r2 r3 r4 r5 into r9 as OpenRequest.record; + cast r0[4u32] r1 r2 r3 r4 r5 into r10 as OpenRequest.record; + cast r0[5u32] r1 r2 r3 r4 r5 into r11 as OpenRequest.record; + cast r0[6u32] r1 r2 r3 r4 r5 into r12 as OpenRequest.record; + cast r0[7u32] r1 r2 r3 r4 r5 into r13 as OpenRequest.record; + cast r0[8u32] r1 r2 r3 r4 r5 into r14 as OpenRequest.record; + cast r0[9u32] r1 r2 r3 r4 r5 into r15 as OpenRequest.record; + cast r0[10u32] r1 r2 r3 r4 r5 into r16 as OpenRequest.record; + cast r0[11u32] r1 r2 r3 r4 r5 into r17 as OpenRequest.record; + cast r0[12u32] r1 r2 r3 r4 r5 into r18 as OpenRequest.record; + cast r0[13u32] r1 r2 r3 r4 r5 into r19 as OpenRequest.record; + cast r0[14u32] r1 r2 r3 r4 r5 into r20 as OpenRequest.record; + cast r0[15u32] r1 r2 r3 r4 r5 into r21 as OpenRequest.record; + output r6 as OpenRequest.record; + output r7 as OpenRequest.record; + output r8 as OpenRequest.record; + output r9 as OpenRequest.record; + output r10 as OpenRequest.record; + output r11 as OpenRequest.record; + output r12 as OpenRequest.record; + output r13 as OpenRequest.record; + output r14 as OpenRequest.record; + output r15 as OpenRequest.record; + output r16 as OpenRequest.record; + output r17 as OpenRequest.record; + output r18 as OpenRequest.record; + output r19 as OpenRequest.record; + output r20 as OpenRequest.record; + output r21 as OpenRequest.record; + + +function spend_open_request: + input r0 as OpenRequest.record; + assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/dcp_withdraw_requests/build/program.json b/programs/dcp_open_requests/build/program.json similarity index 61% rename from programs/dcp_withdraw_requests/build/program.json rename to programs/dcp_open_requests/build/program.json index 661374c..89525ce 100644 --- a/programs/dcp_withdraw_requests/build/program.json +++ b/programs/dcp_open_requests/build/program.json @@ -1,5 +1,5 @@ { - "program": "dcp_withdraw_requests.aleo", + "program": "dcp_open_requests.aleo", "version": "0.0.0", "description": "", "license": "MIT" diff --git a/programs/dcp_open_requests/program.json b/programs/dcp_open_requests/program.json new file mode 100644 index 0000000..8e65878 --- /dev/null +++ b/programs/dcp_open_requests/program.json @@ -0,0 +1,7 @@ +{ + "program": "dcp_open_requests.aleo", + "version": "0.1.0", + "description": "", + "license": "MIT", + "dependencies": null +} \ No newline at end of file diff --git a/programs/dcp_withdraw_requests/src/main.leo b/programs/dcp_open_requests/src/main.leo similarity index 54% rename from programs/dcp_withdraw_requests/src/main.leo rename to programs/dcp_open_requests/src/main.leo index 11ac5bf..355ab7f 100644 --- a/programs/dcp_withdraw_requests/src/main.leo +++ b/programs/dcp_open_requests/src/main.leo @@ -1,12 +1,12 @@ -program dcp_withdraw_requests.aleo { - record WithdrawRequest { +program dcp_open_requests.aleo { + record OpenRequest { owner: address, custody_hash: field, to: address, fee_amount: u64, - expected_weight: u64, + custody_trace: field, expire: u32 } @@ -15,178 +15,178 @@ program dcp_withdraw_requests.aleo { public custody_hash: field, private to: address, private validator_fee_amount: u64, - public expected_weight: u64, + public custody_trace: field, public expire_height: u32 ) -> ( - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest, - WithdrawRequest + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest, + OpenRequest ){ assert_eq(self.caller, data_custody_protocol.aleo); - let withdraw_request_0: WithdrawRequest = WithdrawRequest { + let open_request_0: OpenRequest = OpenRequest { owner: validators[0u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_1: WithdrawRequest = WithdrawRequest { + let open_request_1: OpenRequest = OpenRequest { owner: validators[1u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_2: WithdrawRequest = WithdrawRequest { + let open_request_2: OpenRequest = OpenRequest { owner: validators[2u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_3: WithdrawRequest = WithdrawRequest { + let open_request_3: OpenRequest = OpenRequest { owner: validators[3u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_4: WithdrawRequest = WithdrawRequest { + let open_request_4: OpenRequest = OpenRequest { owner: validators[4u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_5: WithdrawRequest = WithdrawRequest { + let open_request_5: OpenRequest = OpenRequest { owner: validators[5u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_6: WithdrawRequest = WithdrawRequest { + let open_request_6: OpenRequest = OpenRequest { owner: validators[6u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_7: WithdrawRequest = WithdrawRequest { + let open_request_7: OpenRequest = OpenRequest { owner: validators[7u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_8: WithdrawRequest = WithdrawRequest { + let open_request_8: OpenRequest = OpenRequest { owner: validators[8u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_9: WithdrawRequest = WithdrawRequest { + let open_request_9: OpenRequest = OpenRequest { owner: validators[9u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_10: WithdrawRequest = WithdrawRequest { + let open_request_10: OpenRequest = OpenRequest { owner: validators[10u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_11: WithdrawRequest = WithdrawRequest { + let open_request_11: OpenRequest = OpenRequest { owner: validators[11u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_12: WithdrawRequest = WithdrawRequest { + let open_request_12: OpenRequest = OpenRequest { owner: validators[12u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_13: WithdrawRequest = WithdrawRequest { + let open_request_13: OpenRequest = OpenRequest { owner: validators[13u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_14: WithdrawRequest = WithdrawRequest { + let open_request_14: OpenRequest = OpenRequest { owner: validators[14u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; - let withdraw_request_15: WithdrawRequest = WithdrawRequest { + let open_request_15: OpenRequest = OpenRequest { owner: validators[15u8], custody_hash: custody_hash, to: to, fee_amount: validator_fee_amount, - expected_weight: expected_weight, + custody_trace: custody_trace, expire: expire_height }; return ( - withdraw_request_0, - withdraw_request_1, - withdraw_request_2, - withdraw_request_3, - withdraw_request_4, - withdraw_request_5, - withdraw_request_6, - withdraw_request_7, - withdraw_request_8, - withdraw_request_9, - withdraw_request_10, - withdraw_request_11, - withdraw_request_12, - withdraw_request_13, - withdraw_request_14, - withdraw_request_15, + open_request_0, + open_request_1, + open_request_2, + open_request_3, + open_request_4, + open_request_5, + open_request_6, + open_request_7, + open_request_8, + open_request_9, + open_request_10, + open_request_11, + open_request_12, + open_request_13, + open_request_14, + open_request_15, ); } - transition spend_withdraw_request(request: WithdrawRequest){ + transition spend_open_request(request: OpenRequest){ assert_eq(self.caller, dcp_core_protocol.aleo); } } diff --git a/programs/dcp_reconstruct_secret/build/imports/dcp_core_protocol.aleo b/programs/dcp_reconstruct_secret/build/imports/dcp_core_protocol.aleo index 9fe234d..eaa3a16 100644 --- a/programs/dcp_reconstruct_secret/build/imports/dcp_core_protocol.aleo +++ b/programs/dcp_reconstruct_secret/build/imports/dcp_core_protocol.aleo @@ -1,7 +1,7 @@ import credits.aleo; import dcp_fee_management.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; program dcp_core_protocol.aleo; @@ -18,7 +18,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; @@ -29,7 +28,7 @@ struct Proposal: struct CustodyState: validator_set_index as u64; - expected_weight as u64; + custody_trace as field; record DestinationShare: owner as address.private; @@ -339,50 +338,71 @@ finalize accept_proposal: + + function custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async custody_data_as_program r0 r1 into r2; - output r2 as dcp_core_protocol.aleo/custody_data_as_program.future; + async custody_data_as_program r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/custody_data_as_program.future; finalize custody_data_as_program: input r0 as field.public; input r1 as [address; 16u32].public; - cast 0u64 0u64 into r2 as CustodyState; - get.or_use custodies[r0] r2 into r3; - get validator_sets_length[true] into r4; - is.eq r3.expected_weight 0u64 into r5; - sub r4 1u64 into r6; - ternary r5 r6 r3.validator_set_index into r7; - get validator_sets[r7] into r8; - assert.eq r1 r8; - add r3.expected_weight 1u64 into r9; - cast r7 r9 into r10 as CustodyState; - set r10 into custodies[r0]; + input r2 as field.public; + cast 0u64 r2 into r3 as CustodyState; + get.or_use custodies[r0] r3 into r4; + get validator_sets_length[true] into r5; + is.eq r4.custody_trace r2 into r6; + sub r5 1u64 into r7; + ternary r6 r7 r4.validator_set_index into r8; + get validator_sets[r8] into r9; + assert.eq r1 r9; + cast r4.custody_trace r2 into r10 as [field; 2u32]; + hash.bhp256 r10 into r11 as field; + ternary r6 r2 r11 into r12; + cast r8 r12 into r13 as CustodyState; + set r13 into custodies[r0]; -function request_data_as_program: +function request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; assert.eq self.caller data_custody_protocol.aleo; - async request_data_as_program r0 r1 r2 into r3; - output r3 as dcp_core_protocol.aleo/request_data_as_program.future; + async request_open r0 r1 r2 into r3; + output r3 as dcp_core_protocol.aleo/request_open.future; -finalize request_data_as_program: +finalize request_open: input r0 as field.public; input r1 as [address; 16u32].public; - input r2 as u64.public; + input r2 as field.public; get custodies[r0] into r3; - assert.eq r2 r3.expected_weight; + assert.eq r2 r3.custody_trace; get validator_sets[r3.validator_set_index] into r4; assert.eq r1 r4; + + +function process_request_as_validator: + input r0 as dcp_validator_shares.aleo/ValidatorShare.record; + input r1 as dcp_open_requests.aleo/OpenRequest.record; + hash.bhp256 r0.custody into r2 as field; + assert.eq r1.custody_hash r2; + cast r1.to r0.share r0.custody into r3 as DestinationShare.record; + call dcp_open_requests.aleo/spend_open_request r1; + call dcp_fee_management.aleo/mint_fee self.caller r1.fee_amount r1.expire into r4; + assert.eq r1.custody_trace r0.custody_trace; + output r3 as DestinationShare.record; + output r4 as dcp_fee_management.aleo/Fee.record; + + function spend_destination_shares: input r0 as DestinationShare.record; input r1 as DestinationShare.record; @@ -407,5 +427,3 @@ function mint_null_destination_share: cast 0field 0field into r1 as Share; cast self.signer r1 r0 into r2 as DestinationShare.record; output r2 as DestinationShare.record; - - diff --git a/programs/dcp_reconstruct_secret/build/imports/dcp_fee_management.aleo b/programs/dcp_reconstruct_secret/build/imports/dcp_fee_management.aleo index ffc7c7f..52153ca 100644 --- a/programs/dcp_reconstruct_secret/build/imports/dcp_fee_management.aleo +++ b/programs/dcp_reconstruct_secret/build/imports/dcp_fee_management.aleo @@ -5,26 +5,33 @@ program dcp_fee_management.aleo; record Fee: owner as address.private; microcredits as u64.private; + expire as u32.private; function mint_fee: input r0 as address.public; input r1 as u64.private; + input r2 as u32.private; assert.eq self.caller dcp_core_protocol.aleo; - cast r0 r1 into r2 as Fee.record; - output r2 as Fee.record; + cast r0 r1 r2 into r3 as Fee.record; + output r3 as Fee.record; function burn_fee: input r0 as Fee.record; call credits.aleo/transfer_public r0.owner r0.microcredits into r1; - async burn_fee r1 into r2; + async burn_fee r1 r0.expire into r2; output r2 as dcp_fee_management.aleo/burn_fee.future; finalize burn_fee: input r0 as credits.aleo/transfer_public.future; + input r1 as u32.public; await r0; + gte r1 block.height into r2; + assert.eq r2 true; + + @@ -32,5 +39,7 @@ function join_fee: input r0 as Fee.record; input r1 as Fee.record; add r0.microcredits r1.microcredits into r2; - cast r0.owner r2 into r3 as Fee.record; - output r3 as Fee.record; + lt r0.expire r1.expire into r3; + ternary r3 r0.expire r1.expire into r4; + cast r0.owner r2 r4 into r5 as Fee.record; + output r5 as Fee.record; diff --git a/programs/dcp_reconstruct_secret/build/imports/dcp_open_requests.aleo b/programs/dcp_reconstruct_secret/build/imports/dcp_open_requests.aleo new file mode 100644 index 0000000..20d8a15 --- /dev/null +++ b/programs/dcp_reconstruct_secret/build/imports/dcp_open_requests.aleo @@ -0,0 +1,56 @@ +program dcp_open_requests.aleo; + +record OpenRequest: + owner as address.private; + custody_hash as field.private; + to as address.private; + fee_amount as u64.private; + custody_trace as field.private; + expire as u32.private; + + +function submit_requests_to_validators: + input r0 as [address; 16u32].public; + input r1 as field.public; + input r2 as address.private; + input r3 as u64.private; + input r4 as field.public; + input r5 as u32.public; + assert.eq self.caller data_custody_protocol.aleo; + cast r0[0u32] r1 r2 r3 r4 r5 into r6 as OpenRequest.record; + cast r0[1u32] r1 r2 r3 r4 r5 into r7 as OpenRequest.record; + cast r0[2u32] r1 r2 r3 r4 r5 into r8 as OpenRequest.record; + cast r0[3u32] r1 r2 r3 r4 r5 into r9 as OpenRequest.record; + cast r0[4u32] r1 r2 r3 r4 r5 into r10 as OpenRequest.record; + cast r0[5u32] r1 r2 r3 r4 r5 into r11 as OpenRequest.record; + cast r0[6u32] r1 r2 r3 r4 r5 into r12 as OpenRequest.record; + cast r0[7u32] r1 r2 r3 r4 r5 into r13 as OpenRequest.record; + cast r0[8u32] r1 r2 r3 r4 r5 into r14 as OpenRequest.record; + cast r0[9u32] r1 r2 r3 r4 r5 into r15 as OpenRequest.record; + cast r0[10u32] r1 r2 r3 r4 r5 into r16 as OpenRequest.record; + cast r0[11u32] r1 r2 r3 r4 r5 into r17 as OpenRequest.record; + cast r0[12u32] r1 r2 r3 r4 r5 into r18 as OpenRequest.record; + cast r0[13u32] r1 r2 r3 r4 r5 into r19 as OpenRequest.record; + cast r0[14u32] r1 r2 r3 r4 r5 into r20 as OpenRequest.record; + cast r0[15u32] r1 r2 r3 r4 r5 into r21 as OpenRequest.record; + output r6 as OpenRequest.record; + output r7 as OpenRequest.record; + output r8 as OpenRequest.record; + output r9 as OpenRequest.record; + output r10 as OpenRequest.record; + output r11 as OpenRequest.record; + output r12 as OpenRequest.record; + output r13 as OpenRequest.record; + output r14 as OpenRequest.record; + output r15 as OpenRequest.record; + output r16 as OpenRequest.record; + output r17 as OpenRequest.record; + output r18 as OpenRequest.record; + output r19 as OpenRequest.record; + output r20 as OpenRequest.record; + output r21 as OpenRequest.record; + + +function spend_open_request: + input r0 as OpenRequest.record; + assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/dcp_reconstruct_secret/build/imports/dcp_validator_shares.aleo b/programs/dcp_reconstruct_secret/build/imports/dcp_validator_shares.aleo index 4ec6922..604611c 100644 --- a/programs/dcp_reconstruct_secret/build/imports/dcp_validator_shares.aleo +++ b/programs/dcp_reconstruct_secret/build/imports/dcp_validator_shares.aleo @@ -12,37 +12,37 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; record ValidatorShare: owner as address.private; share as Share.private; custody as Custody.private; - weight as u64.private; + custody_trace as field.private; + is_addition as boolean.private; function submit_shares_to_validators: input r0 as [ValidatorShareData; 16u32].private; input r1 as Custody.private; + input r2 as field.private; + input r3 as boolean.private; assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32].validator r0[0u32].share r1 r0[0u32].weight into r2 as ValidatorShare.record; - cast r0[1u32].validator r0[1u32].share r1 r0[1u32].weight into r3 as ValidatorShare.record; - cast r0[2u32].validator r0[2u32].share r1 r0[2u32].weight into r4 as ValidatorShare.record; - cast r0[3u32].validator r0[3u32].share r1 r0[3u32].weight into r5 as ValidatorShare.record; - cast r0[4u32].validator r0[4u32].share r1 r0[4u32].weight into r6 as ValidatorShare.record; - cast r0[5u32].validator r0[5u32].share r1 r0[5u32].weight into r7 as ValidatorShare.record; - cast r0[6u32].validator r0[6u32].share r1 r0[6u32].weight into r8 as ValidatorShare.record; - cast r0[7u32].validator r0[7u32].share r1 r0[7u32].weight into r9 as ValidatorShare.record; - cast r0[8u32].validator r0[8u32].share r1 r0[8u32].weight into r10 as ValidatorShare.record; - cast r0[9u32].validator r0[9u32].share r1 r0[9u32].weight into r11 as ValidatorShare.record; - cast r0[10u32].validator r0[10u32].share r1 r0[10u32].weight into r12 as ValidatorShare.record; - cast r0[11u32].validator r0[11u32].share r1 r0[11u32].weight into r13 as ValidatorShare.record; - cast r0[12u32].validator r0[12u32].share r1 r0[12u32].weight into r14 as ValidatorShare.record; - cast r0[13u32].validator r0[13u32].share r1 r0[13u32].weight into r15 as ValidatorShare.record; - cast r0[14u32].validator r0[14u32].share r1 r0[14u32].weight into r16 as ValidatorShare.record; - cast r0[15u32].validator r0[15u32].share r1 r0[15u32].weight into r17 as ValidatorShare.record; - output r2 as ValidatorShare.record; - output r3 as ValidatorShare.record; + cast r0[0u32].validator r0[0u32].share r1 r2 r3 into r4 as ValidatorShare.record; + cast r0[1u32].validator r0[1u32].share r1 r2 r3 into r5 as ValidatorShare.record; + cast r0[2u32].validator r0[2u32].share r1 r2 r3 into r6 as ValidatorShare.record; + cast r0[3u32].validator r0[3u32].share r1 r2 r3 into r7 as ValidatorShare.record; + cast r0[4u32].validator r0[4u32].share r1 r2 r3 into r8 as ValidatorShare.record; + cast r0[5u32].validator r0[5u32].share r1 r2 r3 into r9 as ValidatorShare.record; + cast r0[6u32].validator r0[6u32].share r1 r2 r3 into r10 as ValidatorShare.record; + cast r0[7u32].validator r0[7u32].share r1 r2 r3 into r11 as ValidatorShare.record; + cast r0[8u32].validator r0[8u32].share r1 r2 r3 into r12 as ValidatorShare.record; + cast r0[9u32].validator r0[9u32].share r1 r2 r3 into r13 as ValidatorShare.record; + cast r0[10u32].validator r0[10u32].share r1 r2 r3 into r14 as ValidatorShare.record; + cast r0[11u32].validator r0[11u32].share r1 r2 r3 into r15 as ValidatorShare.record; + cast r0[12u32].validator r0[12u32].share r1 r2 r3 into r16 as ValidatorShare.record; + cast r0[13u32].validator r0[13u32].share r1 r2 r3 into r17 as ValidatorShare.record; + cast r0[14u32].validator r0[14u32].share r1 r2 r3 into r18 as ValidatorShare.record; + cast r0[15u32].validator r0[15u32].share r1 r2 r3 into r19 as ValidatorShare.record; output r4 as ValidatorShare.record; output r5 as ValidatorShare.record; output r6 as ValidatorShare.record; @@ -57,6 +57,10 @@ function submit_shares_to_validators: output r15 as ValidatorShare.record; output r16 as ValidatorShare.record; output r17 as ValidatorShare.record; + output r18 as ValidatorShare.record; + output r19 as ValidatorShare.record; + + function join_shares_as_validator: @@ -67,7 +71,10 @@ function join_shares_as_validator: is.eq r0.share.index r1.share.index into r3; assert.eq r3 true; add r0.share.share_val r1.share.share_val into r4; - cast r4 r0.share.index into r5 as Share; - add r0.weight r1.weight into r6; - cast self.signer r5 r0.custody r6 into r7 as ValidatorShare.record; - output r7 as ValidatorShare.record; + mul r0.share.share_val r1.share.share_val into r5; + ternary r1.is_addition r4 r5 into r6; + cast r6 r0.share.index into r7 as Share; + cast r0.custody_trace r1.custody_trace into r8 as [field; 2u32]; + hash.bhp256 r8 into r9 as field; + cast self.signer r7 r0.custody r9 r1.is_addition into r10 as ValidatorShare.record; + output r10 as ValidatorShare.record; diff --git a/programs/dcp_reconstruct_secret/build/imports/dcp_withdraw_requests.aleo b/programs/dcp_reconstruct_secret/build/imports/dcp_withdraw_requests.aleo deleted file mode 100644 index 9c9b144..0000000 --- a/programs/dcp_reconstruct_secret/build/imports/dcp_withdraw_requests.aleo +++ /dev/null @@ -1,54 +0,0 @@ -program dcp_withdraw_requests.aleo; - -record WithdrawRequest: - owner as address.private; - custody_hash as field.private; - to as address.private; - fee_amount as u64.private; - expected_weight as u64.private; - - -function submit_requests_to_validators: - input r0 as [address; 16u32].public; - input r1 as field.public; - input r2 as address.private; - input r3 as u64.private; - input r4 as u64.public; - assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32] r1 r2 r3 r4 into r5 as WithdrawRequest.record; - cast r0[1u32] r1 r2 r3 r4 into r6 as WithdrawRequest.record; - cast r0[2u32] r1 r2 r3 r4 into r7 as WithdrawRequest.record; - cast r0[3u32] r1 r2 r3 r4 into r8 as WithdrawRequest.record; - cast r0[4u32] r1 r2 r3 r4 into r9 as WithdrawRequest.record; - cast r0[5u32] r1 r2 r3 r4 into r10 as WithdrawRequest.record; - cast r0[6u32] r1 r2 r3 r4 into r11 as WithdrawRequest.record; - cast r0[7u32] r1 r2 r3 r4 into r12 as WithdrawRequest.record; - cast r0[8u32] r1 r2 r3 r4 into r13 as WithdrawRequest.record; - cast r0[9u32] r1 r2 r3 r4 into r14 as WithdrawRequest.record; - cast r0[10u32] r1 r2 r3 r4 into r15 as WithdrawRequest.record; - cast r0[11u32] r1 r2 r3 r4 into r16 as WithdrawRequest.record; - cast r0[12u32] r1 r2 r3 r4 into r17 as WithdrawRequest.record; - cast r0[13u32] r1 r2 r3 r4 into r18 as WithdrawRequest.record; - cast r0[14u32] r1 r2 r3 r4 into r19 as WithdrawRequest.record; - cast r0[15u32] r1 r2 r3 r4 into r20 as WithdrawRequest.record; - output r5 as WithdrawRequest.record; - output r6 as WithdrawRequest.record; - output r7 as WithdrawRequest.record; - output r8 as WithdrawRequest.record; - output r9 as WithdrawRequest.record; - output r10 as WithdrawRequest.record; - output r11 as WithdrawRequest.record; - output r12 as WithdrawRequest.record; - output r13 as WithdrawRequest.record; - output r14 as WithdrawRequest.record; - output r15 as WithdrawRequest.record; - output r16 as WithdrawRequest.record; - output r17 as WithdrawRequest.record; - output r18 as WithdrawRequest.record; - output r19 as WithdrawRequest.record; - output r20 as WithdrawRequest.record; - - -function spend_withdraw_request: - input r0 as WithdrawRequest.record; - assert.eq self.caller dcp_core_protocol.aleo; diff --git a/programs/dcp_reconstruct_secret/build/main.aleo b/programs/dcp_reconstruct_secret/build/main.aleo index 11c23d5..f7a95f9 100644 --- a/programs/dcp_reconstruct_secret/build/main.aleo +++ b/programs/dcp_reconstruct_secret/build/main.aleo @@ -1,6 +1,6 @@ import credits.aleo; import dcp_validator_shares.aleo; -import dcp_withdraw_requests.aleo; +import dcp_open_requests.aleo; import dcp_fee_management.aleo; import dcp_core_protocol.aleo; program dcp_reconstruct_secret.aleo; @@ -18,7 +18,6 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; diff --git a/programs/dcp_validator_shares/build/main.aleo b/programs/dcp_validator_shares/build/main.aleo index 4ec6922..604611c 100644 --- a/programs/dcp_validator_shares/build/main.aleo +++ b/programs/dcp_validator_shares/build/main.aleo @@ -12,37 +12,37 @@ struct Share: struct ValidatorShareData: validator as address; share as Share; - weight as u64; record ValidatorShare: owner as address.private; share as Share.private; custody as Custody.private; - weight as u64.private; + custody_trace as field.private; + is_addition as boolean.private; function submit_shares_to_validators: input r0 as [ValidatorShareData; 16u32].private; input r1 as Custody.private; + input r2 as field.private; + input r3 as boolean.private; assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32].validator r0[0u32].share r1 r0[0u32].weight into r2 as ValidatorShare.record; - cast r0[1u32].validator r0[1u32].share r1 r0[1u32].weight into r3 as ValidatorShare.record; - cast r0[2u32].validator r0[2u32].share r1 r0[2u32].weight into r4 as ValidatorShare.record; - cast r0[3u32].validator r0[3u32].share r1 r0[3u32].weight into r5 as ValidatorShare.record; - cast r0[4u32].validator r0[4u32].share r1 r0[4u32].weight into r6 as ValidatorShare.record; - cast r0[5u32].validator r0[5u32].share r1 r0[5u32].weight into r7 as ValidatorShare.record; - cast r0[6u32].validator r0[6u32].share r1 r0[6u32].weight into r8 as ValidatorShare.record; - cast r0[7u32].validator r0[7u32].share r1 r0[7u32].weight into r9 as ValidatorShare.record; - cast r0[8u32].validator r0[8u32].share r1 r0[8u32].weight into r10 as ValidatorShare.record; - cast r0[9u32].validator r0[9u32].share r1 r0[9u32].weight into r11 as ValidatorShare.record; - cast r0[10u32].validator r0[10u32].share r1 r0[10u32].weight into r12 as ValidatorShare.record; - cast r0[11u32].validator r0[11u32].share r1 r0[11u32].weight into r13 as ValidatorShare.record; - cast r0[12u32].validator r0[12u32].share r1 r0[12u32].weight into r14 as ValidatorShare.record; - cast r0[13u32].validator r0[13u32].share r1 r0[13u32].weight into r15 as ValidatorShare.record; - cast r0[14u32].validator r0[14u32].share r1 r0[14u32].weight into r16 as ValidatorShare.record; - cast r0[15u32].validator r0[15u32].share r1 r0[15u32].weight into r17 as ValidatorShare.record; - output r2 as ValidatorShare.record; - output r3 as ValidatorShare.record; + cast r0[0u32].validator r0[0u32].share r1 r2 r3 into r4 as ValidatorShare.record; + cast r0[1u32].validator r0[1u32].share r1 r2 r3 into r5 as ValidatorShare.record; + cast r0[2u32].validator r0[2u32].share r1 r2 r3 into r6 as ValidatorShare.record; + cast r0[3u32].validator r0[3u32].share r1 r2 r3 into r7 as ValidatorShare.record; + cast r0[4u32].validator r0[4u32].share r1 r2 r3 into r8 as ValidatorShare.record; + cast r0[5u32].validator r0[5u32].share r1 r2 r3 into r9 as ValidatorShare.record; + cast r0[6u32].validator r0[6u32].share r1 r2 r3 into r10 as ValidatorShare.record; + cast r0[7u32].validator r0[7u32].share r1 r2 r3 into r11 as ValidatorShare.record; + cast r0[8u32].validator r0[8u32].share r1 r2 r3 into r12 as ValidatorShare.record; + cast r0[9u32].validator r0[9u32].share r1 r2 r3 into r13 as ValidatorShare.record; + cast r0[10u32].validator r0[10u32].share r1 r2 r3 into r14 as ValidatorShare.record; + cast r0[11u32].validator r0[11u32].share r1 r2 r3 into r15 as ValidatorShare.record; + cast r0[12u32].validator r0[12u32].share r1 r2 r3 into r16 as ValidatorShare.record; + cast r0[13u32].validator r0[13u32].share r1 r2 r3 into r17 as ValidatorShare.record; + cast r0[14u32].validator r0[14u32].share r1 r2 r3 into r18 as ValidatorShare.record; + cast r0[15u32].validator r0[15u32].share r1 r2 r3 into r19 as ValidatorShare.record; output r4 as ValidatorShare.record; output r5 as ValidatorShare.record; output r6 as ValidatorShare.record; @@ -57,6 +57,10 @@ function submit_shares_to_validators: output r15 as ValidatorShare.record; output r16 as ValidatorShare.record; output r17 as ValidatorShare.record; + output r18 as ValidatorShare.record; + output r19 as ValidatorShare.record; + + function join_shares_as_validator: @@ -67,7 +71,10 @@ function join_shares_as_validator: is.eq r0.share.index r1.share.index into r3; assert.eq r3 true; add r0.share.share_val r1.share.share_val into r4; - cast r4 r0.share.index into r5 as Share; - add r0.weight r1.weight into r6; - cast self.signer r5 r0.custody r6 into r7 as ValidatorShare.record; - output r7 as ValidatorShare.record; + mul r0.share.share_val r1.share.share_val into r5; + ternary r1.is_addition r4 r5 into r6; + cast r6 r0.share.index into r7 as Share; + cast r0.custody_trace r1.custody_trace into r8 as [field; 2u32]; + hash.bhp256 r8 into r9 as field; + cast self.signer r7 r0.custody r9 r1.is_addition into r10 as ValidatorShare.record; + output r10 as ValidatorShare.record; diff --git a/programs/dcp_validator_shares/src/main.leo b/programs/dcp_validator_shares/src/main.leo index c820c1c..05e0bda 100644 --- a/programs/dcp_validator_shares/src/main.leo +++ b/programs/dcp_validator_shares/src/main.leo @@ -13,20 +13,26 @@ program dcp_validator_shares.aleo { struct ValidatorShareData { validator: address, - share: Share, - weight: u64 + share: Share } record ValidatorShare { owner: address, share: Share, custody: Custody, - weight: u64 + custody_trace: field, + is_addition: bool + } + + inline hash_tuple(traces: [field; 2]) -> field{ + return BHP256::hash_to_field(traces); } transition submit_shares_to_validators( private validator_shares: [ValidatorShareData; 16], - private custodied_data: Custody, + private custody: Custody, + private custody_trace: field, + private is_addition: bool, ) -> ( ValidatorShare, ValidatorShare, @@ -50,98 +56,114 @@ program dcp_validator_shares.aleo { let validator_share_0: ValidatorShare = ValidatorShare { owner: validator_shares[0u8].validator, share: validator_shares[0u8].share, - custody: custodied_data, - weight: validator_shares[0u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_1: ValidatorShare = ValidatorShare { owner: validator_shares[1u8].validator, share: validator_shares[1u8].share, - custody: custodied_data, - weight: validator_shares[1u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_2: ValidatorShare = ValidatorShare { owner: validator_shares[2u8].validator, share: validator_shares[2u8].share, - custody: custodied_data, - weight: validator_shares[2u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_3: ValidatorShare = ValidatorShare { owner: validator_shares[3u8].validator, share: validator_shares[3u8].share, - custody: custodied_data, - weight: validator_shares[3u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_4: ValidatorShare = ValidatorShare { owner: validator_shares[4u8].validator, share: validator_shares[4u8].share, - custody: custodied_data, - weight: validator_shares[4u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_5: ValidatorShare = ValidatorShare { owner: validator_shares[5u8].validator, share: validator_shares[5u8].share, - custody: custodied_data, - weight: validator_shares[5u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_6: ValidatorShare = ValidatorShare { owner: validator_shares[6u8].validator, share: validator_shares[6u8].share, - custody: custodied_data, - weight: validator_shares[6u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_7: ValidatorShare = ValidatorShare { owner: validator_shares[7u8].validator, share: validator_shares[7u8].share, - custody: custodied_data, - weight: validator_shares[7u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_8: ValidatorShare = ValidatorShare { owner: validator_shares[8u8].validator, share: validator_shares[8u8].share, - custody: custodied_data, - weight: validator_shares[8u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_9: ValidatorShare = ValidatorShare { owner: validator_shares[9u8].validator, share: validator_shares[9u8].share, - custody: custodied_data, - weight: validator_shares[9u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_10: ValidatorShare = ValidatorShare { owner: validator_shares[10u8].validator, share: validator_shares[10u8].share, - custody: custodied_data, - weight: validator_shares[10u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_11: ValidatorShare = ValidatorShare { owner: validator_shares[11u8].validator, share: validator_shares[11u8].share, - custody: custodied_data, - weight: validator_shares[11u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_12: ValidatorShare = ValidatorShare { owner: validator_shares[12u8].validator, share: validator_shares[12u8].share, - custody: custodied_data, - weight: validator_shares[12u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_13: ValidatorShare = ValidatorShare { owner: validator_shares[13u8].validator, share: validator_shares[13u8].share, - custody: custodied_data, - weight: validator_shares[13u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_14: ValidatorShare = ValidatorShare { owner: validator_shares[14u8].validator, share: validator_shares[14u8].share, - custody: custodied_data, - weight: validator_shares[14u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; let validator_share_15: ValidatorShare = ValidatorShare { owner: validator_shares[15u8].validator, share: validator_shares[15u8].share, - custody: custodied_data, - weight: validator_shares[15u8].weight + custody: custody, + custody_trace: custody_trace, + is_addition: is_addition }; return ( @@ -172,19 +194,33 @@ program dcp_validator_shares.aleo { assert(validator_share_0.custody == validator_share_1.custody); assert(validator_share_0.share.index == validator_share_1.share.index); - let out_share: Share = Share { - share_val: ( - validator_share_0.share.share_val + let new_share_val: field = ( + validator_share_1.is_addition ? + ( + validator_share_0.share.share_val + validator_share_1.share.share_val - ), + ) : + ( + validator_share_0.share.share_val + * validator_share_1.share.share_val + ) + ); + let out_share: Share = Share { + share_val: new_share_val, index: validator_share_0.share.index, }; + let custody_trace: field = hash_tuple([ + validator_share_0.custody_trace, + validator_share_1.custody_trace + ]); + return ValidatorShare { owner: self.signer, share: out_share, custody: validator_share_0.custody, - weight: validator_share_0.weight + validator_share_1.weight + custody_trace: custody_trace, + is_addition: validator_share_1.is_addition }; } } diff --git a/programs/dcp_withdraw_requests/build/main.aleo b/programs/dcp_withdraw_requests/build/main.aleo deleted file mode 100644 index 9c9b144..0000000 --- a/programs/dcp_withdraw_requests/build/main.aleo +++ /dev/null @@ -1,54 +0,0 @@ -program dcp_withdraw_requests.aleo; - -record WithdrawRequest: - owner as address.private; - custody_hash as field.private; - to as address.private; - fee_amount as u64.private; - expected_weight as u64.private; - - -function submit_requests_to_validators: - input r0 as [address; 16u32].public; - input r1 as field.public; - input r2 as address.private; - input r3 as u64.private; - input r4 as u64.public; - assert.eq self.caller data_custody_protocol.aleo; - cast r0[0u32] r1 r2 r3 r4 into r5 as WithdrawRequest.record; - cast r0[1u32] r1 r2 r3 r4 into r6 as WithdrawRequest.record; - cast r0[2u32] r1 r2 r3 r4 into r7 as WithdrawRequest.record; - cast r0[3u32] r1 r2 r3 r4 into r8 as WithdrawRequest.record; - cast r0[4u32] r1 r2 r3 r4 into r9 as WithdrawRequest.record; - cast r0[5u32] r1 r2 r3 r4 into r10 as WithdrawRequest.record; - cast r0[6u32] r1 r2 r3 r4 into r11 as WithdrawRequest.record; - cast r0[7u32] r1 r2 r3 r4 into r12 as WithdrawRequest.record; - cast r0[8u32] r1 r2 r3 r4 into r13 as WithdrawRequest.record; - cast r0[9u32] r1 r2 r3 r4 into r14 as WithdrawRequest.record; - cast r0[10u32] r1 r2 r3 r4 into r15 as WithdrawRequest.record; - cast r0[11u32] r1 r2 r3 r4 into r16 as WithdrawRequest.record; - cast r0[12u32] r1 r2 r3 r4 into r17 as WithdrawRequest.record; - cast r0[13u32] r1 r2 r3 r4 into r18 as WithdrawRequest.record; - cast r0[14u32] r1 r2 r3 r4 into r19 as WithdrawRequest.record; - cast r0[15u32] r1 r2 r3 r4 into r20 as WithdrawRequest.record; - output r5 as WithdrawRequest.record; - output r6 as WithdrawRequest.record; - output r7 as WithdrawRequest.record; - output r8 as WithdrawRequest.record; - output r9 as WithdrawRequest.record; - output r10 as WithdrawRequest.record; - output r11 as WithdrawRequest.record; - output r12 as WithdrawRequest.record; - output r13 as WithdrawRequest.record; - output r14 as WithdrawRequest.record; - output r15 as WithdrawRequest.record; - output r16 as WithdrawRequest.record; - output r17 as WithdrawRequest.record; - output r18 as WithdrawRequest.record; - output r19 as WithdrawRequest.record; - output r20 as WithdrawRequest.record; - - -function spend_withdraw_request: - input r0 as WithdrawRequest.record; - assert.eq self.caller dcp_core_protocol.aleo; diff --git a/validators/run-validator/config/db.js b/validators/run-validator/config/db.js index cc00bfb..3921eef 100644 --- a/validators/run-validator/config/db.js +++ b/validators/run-validator/config/db.js @@ -31,7 +31,7 @@ record ValidatorShare { } -record WithdrawRequest { +record OpenRequest { owner: address, custody_hash: field, to: address, diff --git a/validators/run-validator/config/programs.js b/validators/run-validator/config/programs.js index 90e0392..a044aa5 100644 --- a/validators/run-validator/config/programs.js +++ b/validators/run-validator/config/programs.js @@ -1,12 +1,12 @@ // Programs variable names export const share_record = "dcp_validator_shares.aleo/ValidatorShare"; -export const request_record = "dcp_withdraw_requests.aleo/WithdrawRequest"; +export const request_record = "dcp_open_requests.aleo/OpenRequest"; export const sstv_function = "dcp_validator_shares.aleo/submit_shares_to_validators"; export const jsav_function = "dcp_validator_shares.aleo/join_shares_as_validator"; -export const srtv_function = "dcp_withdraw_requests.aleo/submit_requests_to_validators"; -export const swr_function = "dcp_withdraw_requests.aleo/spend_withdraw_request"; +export const srtv_function = "dcp_open_requests.aleo/submit_requests_to_validators"; +export const swr_function = "dcp_open_requests.aleo/spend_open_request"; export const process_request_function = "dcp_core_protocol.aleo/process_request_as_validator"; diff --git a/validators/run-validator/lib/sync.js b/validators/run-validator/lib/sync.js index a109527..23518a1 100644 --- a/validators/run-validator/lib/sync.js +++ b/validators/run-validator/lib/sync.js @@ -317,13 +317,13 @@ const sync_swr_transitions = async ( - inputs[1]: ValidatorShare - outputs[0]: ValidatorShare - (dcp_withdraw_requests.aleo, submit_requests_to_validators) - - outputs[0]: WithdrawRequest - - outputs[1]: WithdrawRequest + (dcp_open_requests.aleo, submit_requests_to_validators) + - outputs[0]: OpenRequest + - outputs[1]: OpenRequest ... - - outputs[15]: WithdrawRequest + - outputs[15]: OpenRequest - (dcp_withdraw_requests.aleo, spend_withdraw_request) - - inputs[0]: WithdrawRequest + (dcp_open_requests.aleo, spend_open_request) + - inputs[0]: OpenRequest */