Skip to content

changed weak ordering implementation in sort.slice#1414

Merged
bestbeforetoday merged 1 commit intohyperledger:mainfrom
rootp1:fix/issue-1413
May 5, 2026
Merged

changed weak ordering implementation in sort.slice#1414
bestbeforetoday merged 1 commit intohyperledger:mainfrom
rootp1:fix/issue-1413

Conversation

@rootp1
Copy link
Copy Markdown
Contributor

@rootp1 rootp1 commented May 4, 2026

  1. The original code compared the To (recipient) strings when the numeric IDs were different, and fell back to comparing IDs when they were the same. This was completely backwards and broke Go's strict weak ordering. We fixed it to accurately compare IDs first, and properly fallback to the To string on identical IDs.
  2. successfully implemented a unit test checking identical IDs for different To strings (and vice-versa) to explicitly assert that the Go map randomness is predictably flattened to an identically ordered sequence on every peer simulation.
  3. Since token-erc-1155 currently only contains chaincode-go, there are no Javascript/Java/Typescript counterparts requiring this identical fix in this repository.

Closes #1413

Signed-off-by: rootp1 <arnav.iitr@gmail.com>
@rootp1 rootp1 requested a review from a team as a code owner May 4, 2026 22:57
Copy link
Copy Markdown
Member

@bestbeforetoday bestbeforetoday left a comment

Choose a reason for hiding this comment

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

Thank you for this fix and the clear unit test to confirm the correct behaviour.

@bestbeforetoday bestbeforetoday merged commit d999452 into hyperledger:main May 5, 2026
52 of 57 checks passed
@rootp1
Copy link
Copy Markdown
Contributor Author

rootp1 commented May 5, 2026

Thank you for this fix and the clear unit test to confirm the correct behaviour.

Thankyou for the appreciation @bestbeforetoday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERC-1155 multi recipient transfer can produce non deterministic endorsements

2 participants