usnistgov / ESV-Server

Entropy Source Validation Protocol and Server specifications
13 stars 12 forks source link

Fixes "submit" run type. Adds entropy-source-metadata.json template. #49

Closed HLRichardson-Git closed 3 months ago

HLRichardson-Git commented 3 months ago

Recently I had to use this client to submit some samples for a ESV in progress. In using this client I ran into some issues with the 'submit' run type.

First was that on line 203 the call for the runner_data was missing the restartSampleSize variable.

Second also on line 203 the runner_data function call was passing rawNoiseSampleSize. This value is a list, not a value. So when the trace is followed and df_upload_raw is called. The check on line 62 from thread_functions.py if(sampleSize != -1) was comparing if a list is equal to -1. This lead to always doing:

files= { 
            'dataFile': (os.path.basename(raw_noise),open(raw_noise,'rb'),'application/octet-stream'),
            'DataFileSampleSize': sampleSize }

Which passed a list instead of the intended sampleSize integer. This lead to a parsing error on line 70 from thread_functions.py and threw an error.

To fix this I added the restartSampleSize argument to the runner_data call on line 203 of client.py. Secondly I copied what was done in the full run type and used the responseCount variable already present to pass: rawNoiseSampleSize[responseCount], restartSampleSize[responseCount] which passes the values of the rawNoiseSampleSize and restartSampleSize for the respective respone instead of the list of sample sizes.

I tested this with:

Additionally I added a template for the jsons/entropy-source-metadata.json . Documentation for this addition was not added.

andrewmccaffreynist commented 3 months ago

Thanks for this report and the fix! I am reviewing it and will make the necessary merges after some local testing.

andrewmccaffreynist commented 3 months ago

I've tested this and everything looks good. Thank you for catching this and submitting the fix! Look for the correction in our next release.