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

Add functions to check availablility of CBOR tag numbers #434

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

fxamacker
Copy link
Member

This PR:

  • Adds IsCBORTagNumberRangeAvailable()
  • Adds ReservedCBORTagNumberRange()
  • Reserves CBOR tag numbers [240, 255] for atree internal use

IsCBORTagNumberRangeAvailable() checks if specified range of CBOR tag numbers can be used to encode elements managed by atree containers.

ReservedCBORTagNumberRange() returns minTagNum and maxTagNum of the range of CBOR tag numbers reserved by atree.

Currently, Atree and Cadence uses CBOR tag numbers:

  • Atree: 246 to 255
  • Cadence: 128 to 230 to encode internal Cadence values

This PR reserves CBOR tag numbers [240, 255] for atree internal use. Applications must use unreserved CBOR tag numbers to encode elements managed by atree containers.

When a new tag number is needed, Atree will use higher tag number first from its reserved range. By contrast, Cadence will use lower tag numbers first from its own (different) reserved range. This allows Atree and Cadence more flexibility in case we need to revisit the allocation of adjacent unused ranges for Atree and Cadence.


  • Targeted PR against main branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

This commit:
* Adds IsCBORTagNumberRangeAvailable()
* Adds ReservedCBORTagNumberRange()
* Reserves CBOR tag numbers [240, 255] for atree internal use

IsCBORTagNumberRangeAvailable() checks if specified range of
CBOR tag numbers can be used to encode elements managed by
atree containers.

ReservedCBORTagNumberRange() returns minTagNum and maxTagNum
of the range of CBOR tag numbers reserved by atree.

Currently, Atree and Cadence uses CBOR tag numbers:
* Atree: 246 to 255
* Cadence: 128 to 230 to encode internal Cadence values

This commit reserves CBOR tag numbers [240, 255] for atree
internal use. Applications must use unreserved CBOR tag
numbers to encode elements managed by atree containers.

When a new tag number is needed, Atree will use higher tag number
first from its reserved range.  By contrast, Cadence will use
lower tag numbers first from its own (different) reserved range.
This allows Atree and Cadence more flexibility in case we need to
revisit the allocation of adjacent unused ranges for Atree and
Cadence.
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

@fxamacker fxamacker merged commit 5be1546 into main Aug 15, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants