-
Notifications
You must be signed in to change notification settings - Fork 465
Update MAP + add validation to assetDataUtils #1964
Update MAP + add validation to assetDataUtils #1964
Conversation
@@ -90,7 +90,10 @@ contract MultiAssetProxy is | |||
// offset to assetData. | |||
|
|||
// Load offset to `assetData` | |||
let assetDataOffset := calldataload(4) | |||
let assetDataOffset := add(calldataload(4), 4) |
There was a problem hiding this comment.
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 👍
There was a problem hiding this 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
).
There was a problem hiding this 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) | ||
) | ||
) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
19b24df
to
05d50b6
Compare
Description
This includes the MAP code that is currently deployed to mainnet.
Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.