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

Incorporate ParitySharesNamespace and TailPaddingNamespace into IsReserved function #2138

Closed
staheri14 opened this issue Jul 20, 2023 · 3 comments · Fixed by #2194
Closed
Assignees
Labels
proposal item is not yet actionable and is suggesting a change that must first be agreed upon

Comments

@staheri14
Copy link
Contributor

Proposal

The IsReserved function currently only checks for namespaces that are less than the maximum reserved namespace. However, according to the specifications, the ParitySharesNamespace and TailPaddingNamespace are also considered reserved namespaces. Therefore, conceptually, it is expected that the IsReserved function should take these two namespaces into account when verifying a namespace.

Note that the current implementation ensures that IsParityShares and IsTailPadding are called alongside the IsReserved when needed, however, incorporating these two checks inside the IsReserved function is a more clear approach.

@staheri14 staheri14 added proposal item is not yet actionable and is suggesting a change that must first be agreed upon namespace audit labels Jul 20, 2023
@staheri14 staheri14 self-assigned this Jul 20, 2023
@rootulp
Copy link
Collaborator

rootulp commented Jul 30, 2023

Agreed, I think it makes sense to have one function (i.e. IsReserved) that determines if a namespace is reserved for protocol use. On a related note I think we should consider renaming

// MaxReservedNamespace is lexicographically the largest namespace that is
// reserved for protocol use.
MaxReservedNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 255})
because after we implement the change to include tail padding and parity as "reserved" namespaces, the MaxReservedNamespace is not the the largest namespace that is reserved for protocol use.

@staheri14
Copy link
Contributor Author

staheri14 commented Aug 1, 2023

@rootulp Could you please provide some insight into the intended usage of the namespace constants (e.g., MaxReservedNamespace, TailPaddingNamespace, and ParitySharesNamespace) declared in the celestia-app/pkg/namespace/consts.go file? Currently, they appear to be utilized exclusively in tests and for verifying whether a namespace is reserved or not. Are there any anticipated external uses for these constants?

Update: TailPaddingNamespace, and ParitySharesNamespace are actually used in other places. So my question is more about MaxReservedNamespace usage.

@rootulp
Copy link
Collaborator

rootulp commented Aug 1, 2023

They are used outside of tests. I expect they will be use externally by clients but I don't think celestia-app strictly needs to export them as long as they are defined in the specs and external clients can re-define them (if they need them).

MaxReservedNamespace is used to determine if a blob namespace is valid (see here, here). I don't expect other use cases for MaxReservedNamespace.

staheri14 added a commit that referenced this issue Aug 3, 2023
…to IsReserved function (#2194)

## Overview
Closes ##2138
This PR also addresses the concerns raised in the
[comment](#2138 (comment))
by introducing a distinction between two types of reserved namespaces.
Namespaces within the range [0-255] are now identified as "Primary
Reserved Namespaces," while any other reserved namespaces beyond this
range are categorized as "Non-Primary Reserved Namespaces." Hopefully,
this differentiation provides better clarity and organization regarding
namespace allocation and usage within the code.

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
rootulp pushed a commit that referenced this issue Aug 14, 2023
…to IsReserved function (#2194)

Closes ##2138
This PR also addresses the concerns raised in the
[comment](#2138 (comment))
by introducing a distinction between two types of reserved namespaces.
Namespaces within the range [0-255] are now identified as "Primary
Reserved Namespaces," while any other reserved namespaces beyond this
range are categorized as "Non-Primary Reserved Namespaces." Hopefully,
this differentiation provides better clarity and organization regarding
namespace allocation and usage within the code.

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
mergify bot pushed a commit that referenced this issue Sep 5, 2023
…to IsReserved function (#2194)

## Overview
Closes ##2138
This PR also addresses the concerns raised in the
[comment](#2138 (comment))
by introducing a distinction between two types of reserved namespaces.
Namespaces within the range [0-255] are now identified as "Primary
Reserved Namespaces," while any other reserved namespaces beyond this
range are categorized as "Non-Primary Reserved Namespaces." Hopefully,
this differentiation provides better clarity and organization regarding
namespace allocation and usage within the code.

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords

(cherry picked from commit b3b8611)

# Conflicts:
#	pkg/namespace/consts.go
#	pkg/namespace/namespace.go
#	specs/src/specs/namespace.md
cmwaters pushed a commit to celestiaorg/go-square that referenced this issue Dec 14, 2023
…to IsReserved function (#2194)

## Overview
Closes #celestiaorg/celestia-app#2138
This PR also addresses the concerns raised in the
[comment](celestiaorg/celestia-app#2138 (comment))
by introducing a distinction between two types of reserved namespaces.
Namespaces within the range [0-255] are now identified as "Primary
Reserved Namespaces," while any other reserved namespaces beyond this
range are categorized as "Non-Primary Reserved Namespaces." Hopefully,
this differentiation provides better clarity and organization regarding
namespace allocation and usage within the code.

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
0xchainlover pushed a commit to celestia-org/celestia-app that referenced this issue Aug 1, 2024
…to IsReserved function (#2194)

## Overview
Closes #celestiaorg/celestia-app#2138
This PR also addresses the concerns raised in the
[comment](celestiaorg/celestia-app#2138 (comment))
by introducing a distinction between two types of reserved namespaces.
Namespaces within the range [0-255] are now identified as "Primary
Reserved Namespaces," while any other reserved namespaces beyond this
range are categorized as "Non-Primary Reserved Namespaces." Hopefully,
this differentiation provides better clarity and organization regarding
namespace allocation and usage within the code.

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal item is not yet actionable and is suggesting a change that must first be agreed upon
Projects
None yet
2 participants