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

Update MAP + add validation to assetDataUtils #1964

Merged
merged 5 commits into from
Jul 17, 2019

Conversation

abandeali1
Copy link
Member

Description

This includes the MAP code that is currently deployed to mainnet.

Testing instructions

Types of changes

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.

@coveralls
Copy link

coveralls commented Jul 16, 2019

Coverage Status

Coverage decreased (-0.1%) to 83.206% when pulling 05d50b6 on feature/contracts/consistentErrorCodes into 9dbc9a8 on development.

@@ -90,7 +90,10 @@ contract MultiAssetProxy is
// offset to assetData.

// Load offset to `assetData`
let assetDataOffset := calldataload(4)
let assetDataOffset := add(calldataload(4), 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

This was a good call. It really cleaned up the buffer arithmetic 👍

Copy link
Contributor

@dorothy-zbornak dorothy-zbornak 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 for our use case. The checks should be reliable so long as this contract isn't directly called (otherwise the caller can fib assetDataLength).

Copy link
Contributor

@jalextowle jalextowle left a comment

Choose a reason for hiding this comment

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

This looks good for the most part. It does seem like we can have more stringent input validation on the calldata and the nestedAssetData though. After reviewing a couple times, I don't see any glaring issues with either, but it might be good to include a few more sanity checks.

nestedAssetDataOffset,
add(nestedAssetDataElementOffset, 100)
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like there is a gas efficiency reason for not asserting that nestedAssetDataContentsStart + nestedAssetDataLen <= assetDataEnd, but I wonder if it would be worth it to include it just to ensure that the nestedAssetData is in 1:1 correspondence with the data that is actually sent.

Copy link
Member Author

Choose a reason for hiding this comment

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

In general I'm all for extra validation, but I primarily want to get this exact version merged since it is the one deployed to mainnet.

Copy link
Contributor

@jalextowle jalextowle 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 to me.

@abandeali1 abandeali1 force-pushed the feature/contracts/consistentErrorCodes branch from 19b24df to 05d50b6 Compare July 17, 2019 16:38
@abandeali1 abandeali1 merged commit c4d9ef9 into development Jul 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants