Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

[3.0] Upgrade exchange-forwarder to solidity ^0.5.5 and unpin deps #1732

Merged
merged 12 commits into from
Mar 27, 2019

Conversation

dorothy-zbornak
Copy link
Contributor

@dorothy-zbornak dorothy-zbornak commented Mar 25, 2019

Description

Just a simple update of the exchange-forwarder contracts to solidity ^0.5.5, while also unpinning its dependencies. This is a prereq for some other PRs coming down the line.

This PR depends on #1736

Testing instructions

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • Add new entries to the relevant CHANGELOG.jsons.

Copy link
Contributor

@hysz hysz left a comment

Choose a reason for hiding this comment

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

Looks good! Left a couple comments, but no changes required.

@@ -175,7 +176,7 @@ contract MixinExchangeWrapper is
addFillResults(totalFillResults, singleFillResults);

// Stop execution if the entire amount of makerAsset has been bought
uint256 makerAssetFilledAmount = totalFillResults.makerAssetFilledAmount;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, how come this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solidity now implements C99-style scoping rules for function local variables, that is, variables can only be used after they have been declared and only in the same or nested scopes. Variables declared in the initialization block of a for loop are valid at any point inside the loop.

https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

// ERC20 asset proxy: 0xf47261b.
mstore(add(assetData, 32), 0xf47261b000000000000000000000000000000000000000000000000000000000)
// Then we encode parameter 1, the token address.
mstore(add(assetData, 36), address)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note -- when storing a payload ≤ 32 bytes we typically apply a mask to zero out the unused portion of the word. What we have here is probably okay since (i) assetData is allocated with new directly above, and (ii) historically the compiler has been very liberal with masks so it probably applies one to address. That said, neither (i) nor (ii) completely guarantee the word will be zeroed out.

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 can make this change, np.

merklejerk and others added 6 commits March 26, 2019 14:50
Unpin `exchange-forwarder` deps.
…on will silently cause your constructors to not run, and a function that takes an `address` is NOT the same as one that takes an `address payable`.
@dorothy-zbornak dorothy-zbornak force-pushed the feature/contracts/3.0/exchange-forwarder-0.5.5 branch from 82bf53e to b3907b1 Compare March 26, 2019 19:14
Correct changelog for `contracts/exchange-forwarder` after rebase.
@abandeali1 abandeali1 merged commit 0fb55a3 into 3.0 Mar 27, 2019
dorothy-zbornak added a commit that referenced this pull request Apr 26, 2019
@dekz dekz added this to the v3 development milestone Jun 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants