Skip to content

Change slab size related variables from uint64 to uint32#586

Merged
fxamacker merged 1 commit intomainfrom
fxamacker/change-slab-size-int-type
Oct 15, 2025
Merged

Change slab size related variables from uint64 to uint32#586
fxamacker merged 1 commit intomainfrom
fxamacker/change-slab-size-int-type

Conversation

@fxamacker
Copy link
Member

Currently, we use frequent type casting when comparing slab size with target slab size, because
some slab size related variables, such as targetThreshold, minThreshold, maxThreshold, are uint64, but ArraySlabHeader.size and MapSlabHeader.size are uint32.

This PR refactors slab size related variables to use uint32 to simplify code and be explicit about the supported max slab size (math.MaxUint32).

This PR also modifies some exported function parameters and return types to be consistent with the changes. So client software needs to modify code calling the updated functions.


  • 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

Currently, some slab size related variables, such as targetThreshold,
minThreshold, maxThreshold, are uint64.  However, ArraySlabHeader.size
and MapSlabHeader.size are uint32.  This causes frequent type casting
when comparing slab size with target slab size.

This commit refactors slab size related variables to use uint32 to
simplify code and be explicit about the supported max slab size
(math.MaxUint32).

This commit also modifies some exported function return types to
be consistent.
@fxamacker fxamacker self-assigned this Oct 14, 2025
@fxamacker fxamacker requested a review from turbolent as a code owner October 14, 2025 14:20
@fxamacker fxamacker added improvement api breaking change changes to API that can break programs using Atree's API Technical Debt labels Oct 14, 2025
@turbolent
Copy link
Member

Nice! Is this only a breaking change in the API, or is it also a breaking change for the stored data?

@fxamacker
Copy link
Member Author

Nice! Is this only a breaking change in the API, or is it also a breaking change for the stored data?

@turbolent This is only API breaking change. No changes to the stored data.

@fxamacker
Copy link
Member Author

I renamed "breaking change" label to "api breaking change". We also have "storage breaking change" as a separate label.

@fxamacker fxamacker merged commit ab3d661 into main Oct 15, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api breaking change changes to API that can break programs using Atree's API improvement Technical Debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants