Skip to content

Commit

Permalink
assembly: use if instead of mul
Browse files Browse the repository at this point in the history
use if success { ... }  instead of mul(success,....)

also, for EntryPointSimulations:
- had to reduce code size (so cleared simulation-unrelated
"supportsInterface")
- fixed maxgap
  • Loading branch information
drortirosh committed Feb 9, 2025
1 parent 057e4a3 commit 1a09a5f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions contracts/core/EntryPoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,11 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
uint256 dataSize;
assembly ("memory-safe"){
let success := call(gasLimit, sender, 0, add(callData, 0x20), mload(callData), 0, 32)
dataSize := mul(returndatasize(), success)
validationData := mload(0)
if success {
// ignore returndatasize, in case of revert
dataSize := returndatasize()
validationData := mload(0)
}
}
restoreFreePtr(saveFreePtr);
if (dataSize != 32) {
Expand Down
3 changes: 3 additions & 0 deletions contracts/core/EntryPointSimulations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,7 @@ contract EntryPointSimulations is EntryPoint, IEntryPointSimulations {
return __domainSeparatorV4;
}

function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return false;
}
}
2 changes: 1 addition & 1 deletion test/entrypointsimulations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ describe('EntryPointSimulations', function () {
describe(`compare to execution ${withPaymaster} paymaster`, () => {
let execVgl: number
let execPmVgl: number
const diff = 500
const diff = 600
before(async () => {
execPmVgl = withPaymaster === 'without' ? 0 : await findUserOpWithMin(async n => userOpWithGas(1e6, n), false, entryPoint, 1, 500000)
execVgl = await findUserOpWithMin(async n => userOpWithGas(n, execPmVgl), false, entryPoint, 1, 500000)
Expand Down

0 comments on commit 1a09a5f

Please sign in to comment.