lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Add validation to `get_custody_columns` and improve error handling

Open jimmygchen opened this issue 5 months ago • 0 comments

Issue Addressed

This PR addresses two issues:

  • Add validation to get_custody_columns to prevent infinite loop when supplied custody subnet count is invalid (> total number of data column subnets).
    • NOTE: This isn't possible currently as we always check the inputs before calling this function. However, we ran into this issue in the spec tests and this check will also be required when we add MetaDataV3 support
  • Refactor error handling of network_globals.custody_columns to the caller site (see @pawanjay176's comment here)

Additional Info

There are some changes to behaviour now due to the added validation and the added flexibility with error handling:

scenario our enr peer enr
missing or unable to decode csc in ENR error level logging and fallback to custody_requirement (2) debug level logging and fallback to custody_requirement (2)
error computing custody subnets / columns error level logging and return columns for the default custody_requirement (2) debug level logging and return columns for the default custody_requirement (2)

Notes

  • WIP - I haven't finished implementing the error handling - still need to put in some more thoughts - I might simplify this PR to retain existing behaviour
    • Do we penalise peer if the custody column count is invalid? I think it's ok not to, as long as they can serve us column data for the minimal custody requirement - if they can't then they'll be penalised anyway.

jimmygchen avatar Aug 27 '24 06:08 jimmygchen