Skip to content
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

Gas optimizations #277

Merged
merged 7 commits into from
Mar 18, 2021
Merged

Gas optimizations #277

merged 7 commits into from
Mar 18, 2021

Conversation

rmeissner
Copy link
Member

@rmeissner rmeissner commented Mar 17, 2021

  • Replace revert strings with error codes
  • Extract simulateDelegatecall into CompatibilityFallbackHandler
  • Update dependencies
  • Make benchmark success optional

@rmeissner rmeissner requested a review from Uxio0 March 17, 2021 11:59
@rmeissner rmeissner force-pushed the feature/gas_refactorings branch from ff7c725 to b5b4168 Compare March 17, 2021 13:29
@rmeissner rmeissner marked this pull request as ready for review March 17, 2021 13:33
@@ -9,6 +9,8 @@ import "../GnosisSafe.sol";
/// @title Compatibility Fallback Handler - fallback handler to provider compatibility between pre 1.3.0 and 1.3.0+ Safe contracts
/// @author Richard Meissner - <[email protected]>
contract CompatibilityFallbackHandler is DefaultCallbackHandler, ISignatureValidator {
bytes4 internal constant SIMULATE_SELECTOR = bytes4(keccak256("simulate(address,bytes)"));
Copy link
Member

Choose a reason for hiding this comment

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

Why not hardcoded? It's already translated by the compiler? Then why on other places we are using the hardcoded version of a keccak256 hash

Copy link
Member Author

Choose a reason for hiding this comment

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

Runtime gas costs are not affected only the deployment gas costs ... and I did not care about them here (as the contract is far from the limit). This way it would be easier to adjust if necessary.

@@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0;

import "../handler/HandlerContext.sol";
contract TestHandler is HandlerContext {
function dudududu() external returns (address sender, address manager) {
function dudududu() external view returns (address sender, address manager) {
Copy link
Member

Choose a reason for hiding this comment

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

@rmeissner rmeissner merged commit bace2da into development Mar 18, 2021
@rmeissner rmeissner deleted the feature/gas_refactorings branch March 18, 2021 10:19
Uxio0 pushed a commit that referenced this pull request May 6, 2021
Saw-mon-and-Natalie pushed a commit to Saw-mon-and-Natalie/safe-contracts that referenced this pull request Nov 1, 2023
fdarian pushed a commit to fdarian/safe-contracts that referenced this pull request Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants