Skip to content

Properly describe hashed bin delegation in the specification #210

Open

Description

@joshuagl

Hashed bin delegation is not well documented in the specification. One of the better/more frequently referenced descriptions is in PEP 458.

We might add this to the ~new repository operations section of the specification.

Originally posted by @joshuagl in theupdateframework/taps#148 (review)

Activity

  1. lukpueh commented on Feb 18, 2022

    @lukpueh
    Member

    Maybe an inspirational resource for the repository side:
    I recently wrote an excessively commented hashed bin delegation example implementation using the python-tuf Metadata API: theupdateframewok/python-tuf...hashed_bin_delegation.py

  2. lukpueh commented on Feb 18, 2022

    @lukpueh
    Member

    Feature request:
    When describing this in the spec, It would be great to also describe how to choose an appropriate number of bins, given an expected number of target files.

  3. lukpueh commented on Apr 11, 2023

    @lukpueh
    Member

    Feature request: When describing this in the spec, It would be great to also describe how to choose an appropriate number of bins, given an expected number of target files.

    I think the optimal "load factor" is what we are looking for here.

  4. lukpueh commented on Oct 18, 2023

    @lukpueh
    Member

    I think the optimal "load factor" is what we are looking for here.

    This is nonsense, the load factor is related to the cost of retrieving a value from a hash table, which is a completely different optimisation problem than what we are interested in.

  5. lukpueh commented on Oct 18, 2023

    @lukpueh
    Member

    I spent some more thought on how to find the optimal number of bins for a given number of target files, and came up with the following simple problem definition:

    for a chosen 'number of targets'
    we want the optimal 'number of bins' (a power of 2)
    where 'size of snapshot metadata' + 'size of a single bin metadata' is minimal
    

    For snapshot and bin metadata sizes we only need to consider those parts that change for different numbers of targets and bins:

    'size of snapshot metadata' =  'size of a single bin meta entry ' * 'number of bins'
    'size of a single bin metadata' = 'size of a single target file meta entry' * ceil('number of targets' / 'number of bins')
    

    Someone with mad math skills can maybe solve this using a fancy (discrete?) optimisation technique.

    Until then we can use this script or this Google sheet.

  6. trishankatdatadog commented on Oct 19, 2023

    @trishankatdatadog
    Contributor

    Good Q, Lukas. I think a simple objective to optimise is simply sizeof(snapshot) == sizeof(targets+delegations). Hopefully a Python numerical optimiser can help to find the values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions