Documentation

QedShareCli.FastCombine

A memory-light recoverSecret for the executable #

recoverSecret (in Pipeline) is written for the proofs: every share it reads keeps its payload as a List GF256, and the text of a share is turned into lists of characters while it is read. A list costs 24 bytes of memory per element, so a 1 MiB secret needed about 35 MB per share: 700 MB for 20 shares.

recoverSecretBytes reads each share straight into a PackedRecord (decodePacked), whose payload is a ByteArray (1 byte per byte). The checks, the interpolation (combineBytes), the tag and token check (untagBytes) and the odd-share-out hint all work on byte arrays, and the secret is returned as a byte array. Nothing as long as the secret is ever a list.

recoverSecretBytes_eq proves that it returns exactly what recoverSecret returns, for every input: the same secret (as a byte array), or the same error. So everything proven about recoverSecret holds for what the executable runs.

recoverSecretBytes is recoverPacked on the shares read by decodePacked. The executable calls recoverPacked on shares it has read that way file by file, so the text of a share is released as soon as it is read, before the next file is opened.

oddOneOut on packed records (oddOneOutPacked_eq).

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Rebuild the secret from labelled shares that were already read (each a packed record, or the error from reading it), on byte arrays throughout. The first share that could not be read is the error.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Read labelled share strings into packed records (decodePacked).

      Equations
      Instances For

        Rebuild the secret from labelled share strings, on byte arrays throughout. Returns exactly what recoverSecret returns, as a byte array (recoverSecretBytes_eq).

        Equations
        Instances For

          verifyShares on shares that were already read (verifyPacked_decodeAll).

          Equations
          Instances For
            def QedShare.Cli.verifyReportBytes (inputs : List (String × String)) (secretLen : Nat) :

            verifyReport, reading the first share with decodePacked (verifyReportBytes_eq).

            Equations
            Instances For

              recoverSecretBytes = recoverSecret #

              theorem QedShare.Cli.mapM_pack (inputs : List (String × String)) :
              List.mapM (fun (x : String × String) => match x with | (label, s) => do let __do_lift ← decodePacked label s pure (label, __do_lift)) inputs = Except.map (List.map fun (lr : String × Encoding.ShareRecord) => (lr.fst, packRecord lr.snd)) (List.mapM (fun (x : String × String) => match x with | (label, s) => do let __do_lift ← decodeShare label s pure (label, __do_lift)) inputs)

              Reading each share into a packed record gives the packed list of the records read.

              theorem QedShare.Cli.eraseIdx_map' {α β : Type} (f : α → β) (l : List α) (i : Nat) :

              Removing position i commutes with map.

              theorem QedShare.Cli.oddOneOutPacked_eq (k : Nat) (fmt : Encoding.Fmt) (labelled : List (String × Encoding.ShareRecord)) :
              oddOneOutPacked k fmt (List.map (fun (lr : String × Encoding.ShareRecord) => (lr.fst, packRecord lr.snd)) labelled) = oddOneOut k fmt labelled

              oddOneOutPacked names the share oddOneOut names.

              theorem QedShare.Cli.mapM_decodeAll (inputs : List (String × String)) :
              List.mapM (fun (x : String × Except String PackedRecord) => match x with | (label, d) => do let __do_lift ← d pure (label, __do_lift)) (decodeAll inputs) = List.mapM (fun (x : String × String) => match x with | (label, s) => do let __do_lift ← decodePacked label s pure (label, __do_lift)) inputs

              Reading the shares first and then taking the first error is reading them one by one.

              The memory-light path computes exactly recoverSecret. For every input, recoverSecretBytes returns what recoverSecret returns: the same secret, as a byte array, or the same error.

              theorem QedShare.Cli.verifyReportBytes_eq (inputs : List (String × String)) (secretLen : Nat) :
              verifyReportBytes inputs secretLen = verifyReport inputs secretLen

              verifyReportBytes is verifyReport.

              verifySharesBytes returns exactly what verifyShares returns.

              verifyPacked on the shares as read is verifyShares.