Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIP 109 boost by device type #798

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Commits on Sep 6, 2024

  1. Configuration menu
    Copy the full SHA
    9abbab8 View commit details
    Browse the repository at this point in the history
  2. Refactor to use BoostedHexes methods

    Making the internal member hexes private will make it easier to change
    the implementation when device type is introduced.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    3836e93 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ed652e2 View commit details
    Browse the repository at this point in the history
  4. Add boosted hexes ability to accumulate multipliers

    A cell can be boosted more than once.
    Old boosts will retain device_type of ::All.
    
    Any boost matching the device_type accumulates into the multiplier.
    ex: 3 boost with a multiplier of 10, will multiply by 30.
    michaeldjeffrey committed Sep 6, 2024
    1 Configuration menu
    Copy the full SHA
    303aab1 View commit details
    Browse the repository at this point in the history
  5. Add device_type to BoostedHexInfo from db

    The device_type column is assumed to be a jsonb, because the device_type
    column for the `mobile_hotspot_infos` table is an enum, and a jsonb
    field.
    
    It's nullable, which will represent boosting a hex for ALL device types.
    
    Otherwise, a camelcase value mapping to the DeviceTypeV0 in
    helium-program-library.
    https://github.com/helium/helium-program-library/blob/master/programs/hexboosting/src/state.rs
    
    This is different from the snake_case values used with protobufs.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    fef2d67 View commit details
    Browse the repository at this point in the history
  6. Rename to clarify try_into target type

    With type hints enabled, `hex` shows up as a `BoostedHex` going into a
    function that expects `BoostedHex`. Renaming to `hex_proto` will
    hopefully clear up the need for the type casting.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    4107d20 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c9b07d8 View commit details
    Browse the repository at this point in the history
  8. Add test for accumulating hex boosts

    This test uses a single type of radio to reduce adding noise to rewards
    by factors other than hex boosting.
    
    The first pass of the test calculates rewards for 2 radios with no
    boosted hexes to prove they are in equal standing.
    
    The second pass boosts only the hex for single radio, but with multiple
    BoostedHexDeviceType's to ensure they accumulate.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    87fd3ca View commit details
    Browse the repository at this point in the history
  9. use BoostedHexDeviceType proto enum

    There was not enough custom functionality to warrant owning a
    BoostedHexDeviceType enum of our own.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    e926d43 View commit details
    Browse the repository at this point in the history
  10. Mobile Config filter Boosted Hexes (#801)

    * Refactor to use BoostedHexes methods
    
    Making the internal member hexes private will make it easier to change
    the implementation when device type is introduced.
    
    * Add device type to boosted hex info
    
    * refactor metadata_db tests to make test clearer
    
    also makes it easier to add new tests
    
    * remove expired boosted hexes when streaming from db
    
    * ensure no tests are written with expired boosted hexes
    
    * optimize by computing end_ts in db query
    
    Thanks for the query help Brian!
    
    By precomputing the end timestamp of a boosted hex, we can not have to
    stream all the hexes out of the db just to throw them away.
    
    * fixup after rebase
    
    - remove unused imports
    - remove old refactor return types
    
    * make boosted hex test function more explicit
    
    If the expired check had been made a global check, the ability to use
    BoostedHexes for modified hexes would have broken at runtime.
    
    The attempt here is to make very explicit during testing how to meet the
    same contract as the database queries for boosted hexes. I think there
    are still some cracks, but we can narrow in on those as we find them.
    For now, I think naming test constructor functions is a good start.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    8dea91e View commit details
    Browse the repository at this point in the history
  11. add test to ensure boosts only apply to single device types

    There is another test for same device types across hexes.
    This test is for different types in the same hex.
    
    The 2nd unboosted hex serves the purpose of giving us a relative
    baseline so we don't need to hardcode values into the test.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    bbb1209 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    19898b7 View commit details
    Browse the repository at this point in the history
  13. update hex boosting tests for radio_reward_v2

    It becomes more difficult to compare ratios with radio_reward_v2 because
    boosted rewards are scaled. In many of the test we were hoping to have
    nice ratios (1:10) of poc_rewards. However, this was mostly because a
    radio would have received 0 boosted_rewards. Checking that ratio is
    impossible.
    
    We can however check the coverage_points (now that they mean points, and
    not rewards) for the expected ratio, and rely on other tests to ensure
    we're calculating poc_reward amount correctly.
    michaeldjeffrey committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    7f448a7 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    33f0f88 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    a9229e4 View commit details
    Browse the repository at this point in the history