Skip to content

♻️ 1155 changes#89

Merged
transmissions11 merged 1 commit intotransmissions11:audit-fixesfrom
RagePit:1155-changes
Dec 28, 2021
Merged

♻️ 1155 changes#89
transmissions11 merged 1 commit intotransmissions11:audit-fixesfrom
RagePit:1155-changes

Conversation

@RagePit
Copy link
Copy Markdown
Contributor

@RagePit RagePit commented Dec 28, 2021

Optimized the unchecked{} portions of 1155. Included test gas usage above some of the blocks.

safeTransferFrom and safeBatchTransferFrom needs to have the -= as a checked operation to prevent an attacker from underflowing their balance since we aren't verifying the balance implicitly.

https://github.com/RagePit/solmate-1155 for quick underflow demo

I'm a git and sol noob so would appreciate pointing out mistakes I made

Comment on lines +35 to +38
//if ids array has any dupes amounts will not be correct
for (uint256 j = 0; j < i; j++) {
if (ids[i] == ids[j]) return;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These shit for fuzzing times but will fail with dupes otherwise. Could use a better test solution or just ignore the fails

@transmissions11 transmissions11 changed the title 1155 changes ♻️ 1155 changes Dec 28, 2021
@transmissions11 transmissions11 merged commit 683e9a1 into transmissions11:audit-fixes Dec 28, 2021
@transmissions11
Copy link
Copy Markdown
Owner

thx!

@RagePit RagePit deleted the 1155-changes branch December 28, 2021 23:35
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.

2 participants