FC library test fc_crypto/rand_test randomly fails #331

Closed
opened 2022-03-23 22:35:29 +00:00 by serkixenos · 6 comments
serkixenos commented 2022-03-23 22:35:29 +00:00 (Migrated from gitlab.com)

https://gitlab.com/PBSA/peerplays/-/jobs/2240145334

/home/gitlab-runner/builds/JN7Eq9yZ/0/PBSA/peerplays/libraries/fc/tests/crypto/rand_test.cpp(24): error: in "fc_crypto/rand_test": check rc < E + sigma has failed
1757317ms th_a       json_tests.cpp:354            operator()           ] 15 unknown_host_exception: Unknown Host
WTF?
    {}
    th_a  json_tests.cpp:353 operator()
1757317ms th_a       json_tests.cpp:360            operator()           ] 15 unknown_host_exception: Unknown Host
WTF?
    {}
    th_a  json_tests.cpp:359 operator()
1757317ms th_a       json_tests.cpp:360            operator()           ] biggie: ["ERROR_WHILE_CONVERTING_VALUE_TO_STRING"] 
1757319ms th_a       json_tests.cpp:366            operator()           ] 15 unknown_host_exception: Unknown Host
WTF?
    {}
    th_a  json_tests.cpp:365 operator()
1757319ms th_a       json_tests.cpp:366            operator()           ] biggie: ["ERROR_WHILE_CONVERTING_VALUE_TO_STRING"] 
1771049ms th_a       task_cancel.cpp:245           test_method          ] 9 canceled_exception: Canceled
task simple_task canceled before starting
    {"description":"simple_task"}
    th_a  task.cpp:46 run_impl
1771052ms th_a       real128_test.cpp:50           test_method          ] ten: 10. two: 2. twenty: 20. 
1771052ms th_a       real128_test.cpp:51           test_method          ] real128("12345.6789"): 12345.6789 
1771052ms th_a       real128_test.cpp:52           test_method          ] ten/3*3: 9.999999999999999999 
1771054ms th_a       serialization_test.cpp:54     operator()           ] Creating nested object with 100 level(s)
1771055ms th_a       serialization_test.cpp:59     operator()           ] Creating level 100
1771055ms th_a       serialization_test.cpp:54     operator()           ] Creating nested object with 150 level(s)
1771056ms th_a       serialization_test.cpp:59     operator()           ] Creating level 100
1771057ms th_a       serialization_test.cpp:54     operator()           ] Creating nested object with 150 level(s)
1771057ms th_a       serialization_test.cpp:59     operator()           ] Creating level 100
*** 1 failure is detected in the test module "AllTests"
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1
https://gitlab.com/PBSA/peerplays/-/jobs/2240145334 ``` /home/gitlab-runner/builds/JN7Eq9yZ/0/PBSA/peerplays/libraries/fc/tests/crypto/rand_test.cpp(24): error: in "fc_crypto/rand_test": check rc < E + sigma has failed 1757317ms th_a json_tests.cpp:354 operator() ] 15 unknown_host_exception: Unknown Host WTF? {} th_a json_tests.cpp:353 operator() 1757317ms th_a json_tests.cpp:360 operator() ] 15 unknown_host_exception: Unknown Host WTF? {} th_a json_tests.cpp:359 operator() 1757317ms th_a json_tests.cpp:360 operator() ] biggie: ["ERROR_WHILE_CONVERTING_VALUE_TO_STRING"] 1757319ms th_a json_tests.cpp:366 operator() ] 15 unknown_host_exception: Unknown Host WTF? {} th_a json_tests.cpp:365 operator() 1757319ms th_a json_tests.cpp:366 operator() ] biggie: ["ERROR_WHILE_CONVERTING_VALUE_TO_STRING"] 1771049ms th_a task_cancel.cpp:245 test_method ] 9 canceled_exception: Canceled task simple_task canceled before starting {"description":"simple_task"} th_a task.cpp:46 run_impl 1771052ms th_a real128_test.cpp:50 test_method ] ten: 10. two: 2. twenty: 20. 1771052ms th_a real128_test.cpp:51 test_method ] real128("12345.6789"): 12345.6789 1771052ms th_a real128_test.cpp:52 test_method ] ten/3*3: 9.999999999999999999 1771054ms th_a serialization_test.cpp:54 operator() ] Creating nested object with 100 level(s) 1771055ms th_a serialization_test.cpp:59 operator() ] Creating level 100 1771055ms th_a serialization_test.cpp:54 operator() ] Creating nested object with 150 level(s) 1771056ms th_a serialization_test.cpp:59 operator() ] Creating level 100 1771057ms th_a serialization_test.cpp:54 operator() ] Creating nested object with 150 level(s) 1771057ms th_a serialization_test.cpp:59 operator() ] Creating level 100 *** 1 failure is detected in the test module "AllTests" Cleaning up project directory and file based variables 00:00 ERROR: Job failed: exit status 1 ```
serkixenos commented 2022-03-23 22:35:51 +00:00 (Migrated from gitlab.com)

assigned to @pavel.baykov

assigned to @pavel.baykov
pavel.baykov commented 2022-03-25 21:47:49 +00:00 (Migrated from gitlab.com)

if look deeper at the test it’s clear that E is always 513, because it depends only from length (128 * 8 )
zc + oc == 8 * len, by definition
sigma == 15.97 always constant because calculates from constants

rc is the number of different bits in the value, total number of bits is 8 * len == 1024, that’s why it was failing, maximum rc value == total number of bits

but anyway this test nothing to do with randomness

if look deeper at the test it’s clear that E is always 513, because it depends only from length (128 * 8 ) zc + oc == 8 * len, by definition sigma == 15.97 always constant because calculates from constants rc is the number of different bits in the value, total number of bits is 8 * len == 1024, that’s why it was failing, maximum rc value == total number of bits but anyway this test nothing to do with randomness
pavel.baykov commented 2022-03-25 21:49:08 +00:00 (Migrated from gitlab.com)

checked Bitcoin, Ethereum and Solana code,
i think good implementation in Bitcoin:
af7b077973/src/random.h
also have boost tests

checked Bitcoin, Ethereum and Solana code, i think good implementation in Bitcoin: https://github.com/bitcoin/bitcoin/blob/af7b077973526e5cfc4f909349e020fe36013ced/src/random.h also have boost tests
pavel.baykov commented 2022-03-25 21:49:43 +00:00 (Migrated from gitlab.com)

fixed test, will pass all the time :)

fixed test, will pass all the time :)
pavel.baykov commented 2022-04-05 12:33:41 +00:00 (Migrated from gitlab.com)

peerplays code base have different sources of random generators

  1. fc::rand_bytes
  2. hash_ctr_rng
  3. Random generator from time database::update_witness_schedule()

and unit test mentioned above covered only fc::rand_bytes

peerplays code base have different sources of random generators 1. fc::rand_bytes 2. hash_ctr_rng 3. Random generator from time database::update_witness_schedule() and unit test mentioned above covered only fc::rand_bytes
serkixenos commented 2022-04-05 22:45:28 +00:00 (Migrated from gitlab.com)

For test, we will observe CI/CD logs for errors.

For test, we will observe CI/CD logs for errors.
serkixenos (Migrated from gitlab.com) closed this issue 2022-04-05 22:45:29 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#331
No description provided.