-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Making contracts memory-safe
#711
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
Merged
Merged
Changes from 55 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
22ee559
Hardhat config updated
remedcu 47c9adf
Memory Safe Contracts Written
remedcu 5ee3905
Tests Updated
remedcu 8753bc7
Guidelines Updated
remedcu d9a6f0c
safe-memory tag added
remedcu ebf89bb
solhint tags added for inline assembly
remedcu 5cd5e53
SafeProxy assembly updated
remedcu d9cd9bb
Tests updated for coverage changes
remedcu 4995c3d
solc 0.8.19
remedcu e287ca7
solcover updated with optimizer config
remedcu 7444b95
fmt command added to package.json
remedcu c74ef15
solc reverted back to 0.7.6
remedcu a1a7ce6
Tests updated for coverage gas issue
remedcu e32f08e
console.logs for checking added
remedcu 3a7bf79
Increased gas for a test with coverage
remedcu 6481742
solc 0.8.19
remedcu c85784a
applyHarness updated
remedcu 24d5abe
certora applyHarness update
remedcu 5c23638
Reverting back to 0.7.6
remedcu f715936
Merge pull request #718 from safe-global/optimizer-enabled-with-origi…
remedcu 7dbd1fe
SecuredTokenTransfer made to use free memory instead of scratch space
remedcu 32ce306
viaIR: false in sample env
remedcu 539f2fd
viaIR: false in sample env
remedcu aa7738a
Merge branch 'optimizer-enabled' of https://github.com/safe-global/sa…
remedcu 534e3f4
Optimization commented and memory-safe edited
remedcu 9166949
Review based safe-memory changes
remedcu 771c969
Remove in assembly of FallbackManager
remedcu 830bfc5
Using data size directly
remedcu 62dcd4a
Using scratch space for in SecuredTokenTransfer
remedcu 149f7e2
removed
remedcu 0586ca8
Test based changes reverted
remedcu d052266
Comment reinstated
remedcu e55d181
Comment reinstated at the correct place
remedcu 9c80418
Slight optimization in ModuleManager
remedcu fbef92b
Comment typo updated
remedcu 625d96d
Version Overrides for old OZ files
remedcu b723796
Updating old compiler versions to default one
remedcu edc2910
Updated harness patch
remedcu 9740605
SafeProxy using scratch space initially
remedcu 0bdca8a
Updated harness patch
remedcu 1cce1e9
Certora Harness Restored
remedcu 5d2df08
EOF for .env.sample
remedcu 5919110
Sigleton -> Singleton typo fixed
remedcu 76a48cc
.env.sample updation
remedcu 50e3d0c
harness timestamp restored
remedcu 81a0fc4
Test Token pragma raised
remedcu 082c7af
solcover and .env updated
remedcu bc16a01
Using scratch space for call result boolean
remedcu d9069e2
Guidelines Updated
remedcu 36280d3
solhint inline assembly comment
remedcu d3f6010
SafeProxy memory-safety reverted
remedcu 6b25caf
Multisend* memory-safety revert
remedcu c53fdc7
Using returndatasize directly
remedcu cd87eb0
DelegateCaller memory-safe revert and using returndatasize
remedcu 7c51578
SafeProxy all changes reverted
remedcu 0d24013
Using returndatasize through memory (revert)
remedcu 6230350
contract.ts memory-safe tagging reverted
remedcu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,16 +123,14 @@ abstract contract ModuleManager is SelfAuthorized, Executor, GuardManager { | |
| /// @solidity memory-safe-assembly | ||
| assembly { | ||
| // Load free memory location | ||
| let ptr := mload(0x40) | ||
| returnData := mload(0x40) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a good catch sir
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eagle-eyes! |
||
| // We allocate memory for the return data by setting the free memory location to | ||
| // current free memory location + data size + 32 bytes for data size value | ||
| mstore(0x40, add(ptr, add(returndatasize(), 0x20))) | ||
| mstore(0x40, add(returnData, add(returndatasize(), 0x20))) | ||
| // Store the size | ||
| mstore(ptr, returndatasize()) | ||
| mstore(returnData, returndatasize()) | ||
| // Store the data | ||
| returndatacopy(add(ptr, 0x20), 0, returndatasize()) | ||
| // Point the return data to the correct memory location | ||
| returnData := ptr | ||
| returndatacopy(add(returnData, 0x20), 0, returndatasize()) | ||
| } | ||
| /* solhint-enable no-inline-assembly */ | ||
| } | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.