Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue in the market system where the
offer.counter
value experienced collisions due to the use of a bitwise AND operation with a 16-bit mask (& 0xFFFF
). When theid
value exceeded multiples of 65,536 (e.g., 65,536, 131,072), the result would reset to0
, causing incorrect behavior. The fix introduces a transformation using the XOR operator (^ 0xABCDEF
) before applying the mask to distribute the values more uniformly and avoid collisions.Behaviour
Actual
When the
id
value in the market system reaches a multiple of 65,536, theoffer.counter
resets to0
due to the bitwise AND mask (& 0xFFFF
). This causes collisions and incorrect behavior in market offers.Expected
The
offer.counter
should maintain unique values for differentid
inputs, even when they are multiples of 65,536. No collisions should occur.Type of change
Please delete options that are not relevant.
How Has This Been Tested
The following tests were performed to verify the fix:
id
values close to and exceeding multiples of 65,536. Verified thatoffer.counter
values were unique and no collisions occurred.Checklist