-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve _getV3RelayHash method #779
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Reinis-FRP
reviewed
Nov 28, 2024
contracts/SpokePool.sol
Outdated
relayData.depositId, | ||
relayData.fillDeadline, | ||
relayData.exclusivityDeadline, | ||
relayData.message.length > 0 ? keccak256(relayData.message) : bytes32(0), |
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.
we can also use _hashNonEmptyMessage, or that adds overhead?
Reinis-FRP
approved these changes
Nov 28, 2024
md0x
approved these changes
Nov 28, 2024
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
nicholaspai
approved these changes
Dec 2, 2024
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 will definitely require offchain bot changes. Lgtm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR re-works the
_getV3RelayHash
method.The internal
_getV3RelayHash
method has been updated & simplified. Previously, the internal relay hash was the hashed concatenation of all relay message props. Now, the relay hash is the hashed concatenation of all props, except the message field is first hashed. this makes the relay hash([…relayPropsExceptForMessage,hash(message)])
. This change was made as the recent update toFilledV3Relay
event sees this event no longer emitting the full message, but rather now just themessageHash
. given this event change, the previous method for finding v3RelayHashes meant that off-chain actors could not re-compute the relayhash using just off-chainFilledV3Relay
event data but would rather need to find associated deposits to find the corresponding message to find the relayHash.Gas comparison:
Comparison of fills with no Message field ("0x")
Old: 111308
New: 111236
saving: 72
Comparison of fill with 1kb message field ("0x"+"69".repeat(512))
Old: 123987
New: 122837
Saving: 1150
Comparison of fill with 10kb message field ("0x"+"69".repeat(10240))
Old: 316828
New: 293517
Saving: 23311