• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-modules / 7045450570
85%

Build:
DEFAULT BRANCH: master
Ran 30 Nov 2023 10:54AM UTC
Jobs 1
Files 3
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Nov 2023 10:53AM UTC coverage: 100.0%. Remained the same
7045450570

push

github

web-flow
Sign Full User Operation Data (#177)

This PR adjusts the Safe module to sign **all** of the `UserOperation`
struct data instead of the reduced set of fields it was originally
signing. Namely, this means that the `SafeOp` EIP-712 struct needs to
also include the fields:

* `initCode`: ensures that initialisation works exactly as the user
specified
* `paymasterAndData`: ensures that user operations are tied to specific
paymaster calls

Unfortunately, this required some non-trivial changes to the module code
in order to accommodate all of these fields. Namely:
- `SafeOp` field order was changed to match that of the `UserOperation`.
This was done for two reasons:
1. Make it clearer and easier to verify that all `UserOperation` fields
are accounted for
2. Allows for more efficient encoding of `SafeOp` for computing the
signing message when copying from a `UserOperation calldata`. While we
don’t make use of this in the code, I believe it is a nice property to
have.
- `getOperationHash` now takes a `UserOperation calldata` instead of all
user operation fields (because of the Solidity “stack too deep”
limitation).


https://github.com/safe-global/safe-modules/pull/177/commits/<a class=hub.com/safe-global/safe-modules/commit/b3e1785548477343f6c2a9f048585d6bf20d6100">b3e178554
contains other versions of possible implementations for computing the
signing message for the Safe operation, namely:
1. Using assembly and `calldatacopy` to setup the `SafeOp` struct in
memory for hashing, this is the most efficient by around 310 gas
compared to the current implementation, but has a lot of magic and is
not easy to understand, hence it was not used.
([code](https://github.com/safe-global/safe-modules/blob/b3e1785548477343f6c2a9f048585d6bf20d6100/4337/contracts/Safe4337Module.sol#L168-L214))
2. Encoding values into a `uint256[14] memory`, while this requires
slightly less boiler plate, it is not as easy to understand (IMO) and
was less gas-efficient.
([code](https://github.com/safe-global/safe-m... (continued)

22 of 22 branches covered (100.0%)

Branch coverage included in aggregate %.

14 of 14 new or added lines in 1 file covered. (100.0%)

33 of 33 relevant lines covered (100.0%)

25.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7045450570.1 30 Nov 2023 10:54AM UTC 3
100.0
GitHub Action Run
Source Files on build 7045450570
  • Tree
  • List 3
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • c366d822 on github
  • Prev Build on master (#7003971952)
  • Next Build on master (#7046488895)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc