Comments (3)
I tried moving the CompatibilityFallbackHandler:checkSignatures(bytes32,bytes memory,bytes memory)
to Safe.sol
and though it increased the bytecode size by around 400, it still is slightly less than the limit of 24KB.
Change made in Safe.sol
:
function checkSignatures(bytes32 dataHash, bytes memory signatures) public view {
checkSignatures(dataHash, "", signatures);
}
function checkSignatures(bytes32 dataHash, bytes memory /* IGNORED */, bytes memory signatures) public view {
// Load threshold to avoid multiple storage loads
uint256 _threshold = threshold;
// Check that a threshold is set
require(_threshold > 0, "GS001");
checkNSignatures(msg.sender, dataHash, signatures, _threshold);
}
Updated size (using npx hardhat codesize
):
Safe 23666 bytes (limit is 24576)
SafeL2 24508 bytes (limit is 24576)
I checked these changes on the last commit (using git rev-parse HEAD
):
69caefcda788f2f6b0b154d50d010897560c8deb
from safe-smart-account.
I think we removed everything that could be removed. I don't think it's possible. Is it a significant overhead for the consumers to update to the new method?
from safe-smart-account.
I have some tiny ideas that might add up to something meaningful:
Use uint256
for v
internally. AFAIR, uintN
will mask on every access (so each of the if
branches) - if we keep it a uint256
until we need to cast it to a uint8
, then we might save some bytes
Generally speaking, there are a few instances of bytes memory
that may possible be converted to bytes calldata
. Needs further analysis.
We have some array accesses that I think generate Solidity bounds checks, but aren’t needed. For example:
Some view methods can move to the FallbackHandler
implementation. For example:
At an extreme, even the getOwners*
and getModules*
view methods can also be moved there.
Anyway - don’t know if we should do it or not, we just might be able to squeeze it in if we try really hard.
Is it a significant overhead for the consumers to update to the new method?
It is just annoying for modules like the 4337 one, where we would need to keep a v1.4.1 version and a v1.5.0 version (or pay the additional gas of going over the fallback handler).
from safe-smart-account.
Related Issues (20)
- ,
- [Safe 1.5.0] `execTransactionFromModuleReturnData` Will Return Guard `returndata` HOT 3
- Provide developer utils for foundry
- Fallback function could be made payable.
- Evaluate strategies for reducing Safe code size
- Provide a way to identify whether a contract is a SAFE. HOT 1
- Expose revert message when internal transaction fails and `safeTxGas`/`gasPrice` are 0
- ProviderError: not enough gas supplied for intrinsic gas costs HOT 2
- Rename the repo to `safe-smart-account` HOT 5
- Technical background for `onlyNonceZero` in `SafeToL2Migration`? HOT 6
- JSON Mix Up
- Figure out why Safe can't compile on 0.8 with IR optimizations HOT 2
- Imports Ordering for Contracts HOT 2
- Using `returndatasize()` directly in assembly HOT 1
- Compilation fails with solc 0.8.23 HOT 4
- LZ's `sendFrom()` produces insufficient gas error in tx simulation HOT 1
- zksync branch doesn't seem to contain correct zksync deployment scripts
- Signature verification does not enforce a maximum size on the signature bytes
- Split Guard into Module and Transaction Guard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safe-smart-account.