Skip to content

Conversation

@Mikelle
Copy link
Contributor

@Mikelle Mikelle commented Jul 12, 2024

Closes: #233

@Mikelle Mikelle requested review from ckartik and shaspitz July 12, 2024 18:07
@Mikelle Mikelle self-assigned this Jul 12, 2024
Copy link
Contributor

@shaspitz shaspitz left a comment

Choose a reason for hiding this comment

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

Looks solid! Just a few comments

) internal pure returns (string memory) {
bytes memory HEXCHARS = "0123456789abcdef";
bytes memory _string = new bytes(64);
for (uint8 i = 0; i < 32; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (uint8 i = 0; i < 32; i++) {
for (uint8 i = 0; i < 32; ++i) {

) public pure returns (string memory) {
bytes memory HEXCHARS = "0123456789abcdef";
bytes memory _string = new bytes(_bytes.length * 2);
for (uint256 i = 0; i < _bytes.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (uint256 i = 0; i < _bytes.length; i++) {
for (uint256 i = 0; i < _bytes.length; ++i) {


// Check if the dispatch timestamp is within the allowed dispatch window
require(dispatchTimestamp > minTime, "Invalid dispatch timestamp");
require(dispatchTimestamp >= minTime, "Invalid dispatch timestamp");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change of behavior intentional? After clarifying with the auditors their stance is When inside the require statements, non-strict inequalities (>=, <=) are usually costlier than strict equalities (>, <).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did it, after reading this quote:

When inside the “if/require” statements, non-strict inequalities (>=, <=) are
usually cheaper than the strict equalities (>, <).

Thank you for clarifying, I will return it back

@Mikelle Mikelle merged commit b99958a into main Jul 15, 2024
@Mikelle Mikelle deleted the fix/233/smart-contracts-improvements branch July 15, 2024 14:15
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.

Go through mev-commit smart contracts and do optimizations

3 participants