Problem running discovery test

has anyone experienced a similar issue?
discovery test:

(node:188041) UnhandledPromiseRejectionWarning: Error: SyntaxError: await is only valid in async function
at Object.run (~/.nvm/versions/node/v10.16.0/lib/node_modules/@enigmampc/discovery-cli/node_modules/truffle-migrate/index.js:92:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:188041) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:188041) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

1 Like

hey @berlin ,

I’m not getting that error. I’m on node v10.16 too. I wonder, did you perform these steps prior to discovery test?

  1. discovery start
  2. discovery compile
  3. discovery migrate

I’m wondering if an exception is getting thrown because the network’s not running or the contracts haven’t been deployed.

I’m working with a fresh project after doing a discovery init … that might not be your case?

I’m able to run the tests though I had to modify the migrations/2_deploy_contract.js script to reflect where I’m running it from (the project directory). The boilerplate code in there was trying to write the secret contract address to a .txt file under ../test/simple_addition.txt. That file is used by the tests. If you run into that issue, either run the migration from within the migrations folder or change the deploy script to write to test/simple_addition.txt.

2 Likes

I’d reiterate what @laura said – and add that while we did have some problem with specific node versions, it doesn’t look like that is the issue with your setup. cc @adi to have a look when possible!

I did discovery start
discovery compile works fine.

discovery migrate return errors. as you can see the node version is v10.16.0.

iscovery migrate
(node:50876) UnhandledPromiseRejectionWarning: Error: Error: Cannot find module ‘/home/berlion/enigma/millionaires_problem_demo/build/enigma_contracts/EnigmaSimulation.json’
at Object.run (~/.nvm/versions/node/v10.16.0/lib/node_modules/@enigmampc/discovery-cli/node_modules/truffle-migrate/index.js:92:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:50876) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:50876) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can you post the output of discovery start?

1 Like

contract_1 | eth_blockNumber
km_1 | [:loud_sound: ] Blocks @ previous: 59, current: 69, next: 69 [:loud_sound: ]
km_1 | [☼ ] New epoch found [☼ ]
contract_1 | eth_call
km_1 | Evaluating nonce/seed based on EpochState: None
km_1 | Calling enclave set_worker_params with nonce/seed: “0000000000000000000000000000000000000000000000000000000000000000”/“0000000000000000000000000000000000000000000000000000000000000000”
km_1 | Creating new epoch with nonce 0x4
km_1 | Generated random seed: 0xfbe05fef14411af9d415109677ab7ed9e4e1ab933ded269a0b0060d4f43f64ec
km_1 | [+] Home dir is /root
km_1 | Back from Ocall: /root/.enigma
km_1 | Sealed document: “/root/.enigma/epoch/epoch-marker-0x4.sealed” written successfully.
km_1 | Sealed the epoch marker: “/root/.enigma/epoch/epoch-marker-0x4.sealed”
km_1 | Inserting epoch: Epoch { nonce: 0x4, seed: 0xfbe05fef14411af9d415109677ab7ed9e4e1ab933ded269a0b0060d4f43f64ec, worker_params: InputWorkerParams { block_number: 0x45, workers: [0x37309a48780b4d61c52f1f34bff251211692501d], stakes: [0x14f46b0400] } } in cache
km_1 | Cache reached its capacity of 2, removed first epoch: Epoch { nonce: 0x2, seed: 0xa874b2e91b014c9fd0371aa58c52a2cd5f155ddbed02984a84ef0c8394c8ac33, worker_params: InputWorkerParams { block_number: 0x2f, workers: [0x37309a48780b4d61c52f1f34bff251211692501d], stakes: [0x14f46b0400] } }
km_1 | Initial epoch stored successfully
km_1 | Signed the message : 0x0000000000000020fbe05fef14411af9d415109677ab7ed9e4e1ab933ded269a0b0060d4f43f64ec000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000001000000000000001437309a48780b4d61c52f1f34bff251211692501d0000000000000001000000000000002000000000000000000000000000000000000000000000000000000014f46b0400
km_1 | Worker parameters set successfully
km_1 | Storing unconfirmed EpochState: EpochState { seed: 113926960848373448755109078733534589077824229898968590719195632933470736442604, sig: Bytes([76, 190, 21, 129, 155, 175, 109, 198, 197, 112, 38, 139, 142, 127, 23, 174, 80, 198, 204, 73, 153, 101, 11, 149, 247, 183, 131, 140, 40, 112, 191, 110, 47, 88, 194, 92, 36, 116, 88, 100, 155, 135, 109, 244, 150, 183, 147, 75, 217, 77, 137, 161, 9, 234, 101, 74, 60, 145, 210, 121, 128, 244, 102, 112, 28]), nonce: 4, confirmed_state: None }
km_1 | Removed first EpochState of capped list: EpochState { seed: 76194747616864314377049694001220301190165377653889951835690490603270610398259, sig: Bytes([216, 213, 184, 156, 27, 66, 175, 139, 176, 56, 9, 8, 218, 221, 44, 192, 69, 229, 157, 242, 16, 57, 238, 197, 136, 102, 103, 132, 159, 165, 218, 181, 96, 1, 99, 132, 201, 121, 137, 41, 64, 217, 213, 172, 201, 131, 188, 89, 8, 16, 59, 93, 187, 225, 124, 77, 99, 174, 230, 122, 103, 45, 218, 54, 28]), nonce: 2, confirmed_state: Some(ConfirmedEpochState { selected_workers: {}, block_number: 48 }) }
km_1 | Saving EpochState list to disk: [EpochState { seed: 102578385430240499359755171564776448924079354198089600661851821999323302169227, sig: Bytes([118, 112, 182, 92, 82, 98, 74, 5, 96, 171, 35, 81, 51, 78, 184, 227, 109, 230, 187, 241, 238, 75, 24, 83, 83, 1, 218, 157, 10, 95, 69, 61, 39, 199, 242, 219, 131, 216, 205, 12, 63, 218, 110, 131, 249, 191, 3, 145, 145, 95, 135, 21, 246, 62, 31, 28, 79, 112, 29, 212, 104, 57, 214, 227, 27]), nonce: 3, confirmed_state: Some(ConfirmedEpochState { selected_workers: {}, block_number: 59 }) }, EpochState { seed: 113926960848373448755109078733534589077824229898968590719195632933470736442604, sig: Bytes([76, 190, 21, 129, 155, 175, 109, 198, 197, 112, 38, 139, 142, 127, 23, 174, 80, 198, 204, 73, 153, 101, 11, 149, 247, 183, 131, 140, 40, 112, 191, 110, 47, 88, 194, 92, 36, 116, 88, 100, 155, 135, 109, 244, 150, 183, 147, 75, 217, 77, 137, 161, 9, 234, 101, 74, 60, 145, 210, 121, 128, 244, 102, 112, 28]), nonce: 4, confirmed_state: None }]
km_1 | [+] Home dir is /root
km_1 | [+] Home dir is /root
km_1 | Saved EpochState list: Ok("/root/.enigma/epoch/epoch-state.msgpack")
km_1 | Waiting for setWorkerParams(69, 113926960848373448755109078733534589077824229898968590719195632933470736442604, Bytes([76, 190, 21, 129, 155, 175, 109, 198, 197, 112, 38, 139, 142, 127, 23, 174, 80, 198, 204, 73, 153, 101, 11, 149, 247, 183, 131, 140, 40, 112, 191, 110, 47, 88, 194, 92, 36, 116, 88, 100, 155, 135, 109, 244, 150, 183, 147, 75, 217, 77, 137, 161, 9, 234, 101, 74, 60, 145, 210, 121, 128, 244, 102, 112, 28]))
contract_1 | eth_sendTransaction
contract_1 |
contract_1 | Transaction: 0x53512a05b69fbe16fd792c702738a2222124a8ee470cc56883ba645b66357287
contract_1 | Gas usage: 318860
contract_1 | Block Number: 70
contract_1 | Block Time: Wed Jul 31 2019 17:52:23 GMT+0000 (Coordinated Universal Time)
contract_1 |
contract_1 | eth_getTransactionReceipt
km_1 | Got get_state_keys request: StateKeyRequest { data: StringWrapper(“83a46461746181a752657175657374c0a269649cccdf55ccc3cc94cccaccbcccfcccfa0773ccc237a67075626b6579dc0040ccc819ccf0ccf0ccfc2bccbe64ccf164ccf3cc9dccbfcce475ccf52dcccc16ccef67ccdb37494f4d6accedccf30120cc940119ccbf01cced5accc525ccce433accb5211917ccbcccfaccfbccacccafccabccfeccc5cc8ccc87045e3c36305f12”), sig: StringWrapper(“8bcfa0e802d8134a4e456a8e5038e8e2976d9f43b4062282fd4fef754766d2dd3a2a73d579b4532232a268008c65398e09b91fcca3299fa4faa8b89d6dea9ab31b”), block_number: None }
p2p_1 | [Wed Jul 31 2019 17:52:23 GMT+0000 (Coordinated Universal Time)] DEBUG Connecting to principal node: http://172.23.0.5:3040
p2p_1 | [Wed Jul 31 2019 17:52:23 GMT+0000 (Coordinated Universal Time)] ERROR Failed Principal node connection: -32603 - Unable to get keys: Operation not allowed while the EpochState is transitioning. Current state = UNCONFIRMED
km_1 | Got the receipt: Receipt { transaction_hash: 0x53512a05b69fbe16fd792c702738a2222124a8ee470cc56883ba645b66357287, transaction_index: 0, block_hash: Some(0x4fdebb1b32d4fcc21ec9c00fd883f7a82c79c8ab22e6c07ba53b9947afe43803), block_number: Some(70), cumulative_gas_used: 318860, gas_used: Some(318860), contract_address: None, logs: [Log { address: 0x59d3631c86bbe35ef041872d502f218a39fba150, topics: [0x4ac4fa4588e2c6fdaec0f375ac3b33fab7b69895fbb538347f8adb03164c5ddd], data: Bytes([251, 224, 95, 239, 20, 65, 26, 249, 212, 21, 16, 150, 119, 171, 126, 217, 228, 225, 171, 147, 61, 237, 38, 154, 11, 0, 96, 212, 244, 63, 100, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 48, 154, 72, 120, 11, 77, 97, 197, 47, 31, 52, 191, 242, 81, 33, 22, 146, 80, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 244, 107, 4, 0]), block_hash: Some(0x4fdebb1b32d4fcc21ec9c00fd883f7a82c79c8ab22e6c07ba53b9947afe43803), block_number: Some(70), transaction_hash: Some(0x53512a05b69fbe16fd792c702738a2222124a8ee470cc56883ba645b66357287), transaction_index: Some(0), log_index: Some(0), transaction_log_index: None, log_type: None, removed: None }], status: Some(1), logs_bloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000 }
km_1 | Parsed the WorkersParameterized event: Log { params: [LogParam { name: “seed”, value: Uint(113926960848373448755109078733534589077824229898968590719195632933470736442604) }, LogParam { name: “firstBlockNumber”, value: Uint(70) }, LogParam { name: “inclusionBlockNumber”, value: Uint(69) }, LogParam { name: “workers”, value: Array([Address(0x37309a48780b4d61c52f1f34bff251211692501d)]) }, LogParam { name: “stakes”, value: Array([Uint(90000000000)]) }, LogParam { name: “nonce”, value: Uint(4) }] }
contract_1 | eth_call
km_1 | The secret contract count: 0
contract_1 | eth_call
km_1 | The secret contract addresses:
km_1 | Confirmed epoch with worker params: InputWorkerParams { block_number: 69, workers: [0x37309a48780b4d61c52f1f34bff251211692501d], stakes: [90000000000] }
km_1 | Storing confirmed EpochState: EpochState { seed: 113926960848373448755109078733534589077824229898968590719195632933470736442604, sig: Bytes([76, 190, 21, 129, 155, 175, 109, 198, 197, 112, 38, 139, 142, 127, 23, 174, 80, 198, 204, 73, 153, 101, 11, 149, 247, 183, 131, 140, 40, 112, 191, 110, 47, 88, 194, 92, 36, 116, 88, 100, 155, 135, 109, 244, 150, 183, 147, 75, 217, 77, 137, 161, 9, 234, 101, 74, 60, 145, 210, 121, 128, 244, 102, 112, 28]), nonce: 4, confirmed_state: Some(ConfirmedEpochState { selected_workers: {}, block_number: 70 }) }
km_1 | Saving EpochState list to disk: [EpochState { seed: 102578385430240499359755171564776448924079354198089600661851821999323302169227, sig: Bytes([118, 112, 182, 92, 82, 98, 74, 5, 96, 171, 35, 81, 51, 78, 184, 227, 109, 230, 187, 241, 238, 75, 24, 83, 83, 1, 218, 157, 10, 95, 69, 61, 39, 199, 242, 219, 131, 216, 205, 12, 63, 218, 110, 131, 249, 191, 3, 145, 145, 95, 135, 21, 246, 62, 31, 28, 79, 112, 29, 212, 104, 57, 214, 227, 27]), nonce: 3, confirmed_state: Some(ConfirmedEpochState { selected_workers: {}, block_number: 59 }) }, EpochState { seed: 113926960848373448755109078733534589077824229898968590719195632933470736442604, sig: Bytes([76, 190, 21, 129, 155, 175, 109, 198, 197, 112, 38, 139, 142, 127, 23, 174, 80, 198, 204, 73, 153, 101, 11, 149, 247, 183, 131, 140, 40, 112, 191, 110, 47, 88, 194, 92, 36, 116, 88, 100, 155, 135, 109, 244, 150, 183, 147, 75, 217, 77, 137, 161, 9, 234, 101, 74, 60, 145, 210, 121, 128, 244, 102, 112, 28]), nonce: 4, confirmed_state: Some(ConfirmedEpochState { selected_workers: {}, block_number: 70 }) }]
km_1 | [+] Home dir is /root
km_1 | [+] Home dir is /root
km_1 | Saved EpochState list: Ok("/root/.enigma/epoch/epoch-state.msgpack")
contract_1 | eth_blockNumber
km_1 | [:loud_sound: ] Blocks @ previous: 70, current: 70, next: 80 [:loud_sound: ]
km_1 | [:hourglass_flowing_sand: ] Epoch still active [:hourglass_flowing_sand: ]
contract_1 | eth_blockNumber
km_1 | [:loud_sound: ] Blocks @ previous: 70, current: 70, next: 80 [:loud_sound: ]

updated error from discovery migrate:
node:51180) UnhandledPromiseRejectionWarning: Error: Error: Cannot find module ‘/home/berlion/enigma/millionaires_problem_demo/build/enigma_contracts/EnigmaSimulation.json’
at Object.run (/home/berlion/.nvm/versions/node/v10.16.0/lib/node_modules/@enigmampc/discovery-cli/node_modules/truffle-migrate/index.js:92:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:51180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:51180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

when you ran discovery init did you specify HW for SGX hardware mode or SW for software mode? I believe the EnigmaSimulation.json is for SW mode and since it can’t be found I’m thinking it wasn’t generated due to the mode chosen during init.

I specified sw as indicated in the instruction.

I couldn’t see the entire log of your post for the output of discovery start but at a certain point the command displays:

Compiling your contracts ...

One of the lines should say:
Compiling ./contracts/EnigmaSimulation.sol

That’s what causes the EnigmaSimulation.json to get generated under the build/enigma_contracts dir.

Can you confirm that the json file is missing from that directory? If it is, can you do another discovery start and post the relevant output here, where the contract compiling messages are displayed?

I resolved the issue.

  • I reinitialized discovery to get the the ./contracts/EnigmaSimulation.sol.
  • The location of the file ‘millionaires_problem.txt’ which contains the contact address needs to be changes in deployment and the test scripts.
2 Likes

Awesome!

Yes, I saw that issue as well. I’ll relay that to the team.

Thanks, @berlin!

1 Like

I had the same initial problem (await is only valid in async function) then I realized the code to add in 2_deploy_contracts.js must be added inside of module.exports = async function(deployer, network, accounts) {}

1 Like

If you launch discovery migrate or discovery test from the root folder, you must edit 2_deploy_contracts.js and in the function deploySecretContracts, replace '../test' by './test' in writeFile

For the record, the above issue has been addressed in https://github.com/enigmampc/discovery-cli/pull/6, and a new version 0.0.20 has been released that includes the above changes. It will be fixed in any future installations.

2 Likes