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

don't revert the estimation if earlier in the queue reverts #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions src/EntryPointSimulations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ contract EntryPointSimulations is EntryPoint, IEntryPointSimulations {
_simulationOnlyValidations(userOp);
(
uint256 validationData,
uint256 paymasterValidationData,
// uint256 paymasterVerificationGasLimit
uint256 paymasterValidationData, // uint256 paymasterVerificationGasLimit

) = _validatePrepayment(0, userOp, outOpInfo);

_validateAccountAndPaymasterValidationData(
Expand Down Expand Up @@ -118,7 +118,9 @@ contract EntryPointSimulations is EntryPoint, IEntryPointSimulations {
function simulateValidationBulk(
PackedUserOperation[] calldata userOps
) public returns (ValidationResult[] memory) {
ValidationResult[] memory results = new ValidationResult[](userOps.length);
ValidationResult[] memory results = new ValidationResult[](
userOps.length
);

for (uint256 i = 0; i < userOps.length; i++) {
ValidationResult memory result = simulateValidation(userOps[i]);
Expand Down Expand Up @@ -225,11 +227,39 @@ contract EntryPointSimulations is EntryPoint, IEntryPointSimulations {
PackedUserOperation[] calldata ops
) public returns (ExecutionResult[] memory) {
ExecutionResult[] memory results = new ExecutionResult[](ops.length);
uint256 resultsIndex = 0;

for (uint256 i = 0; i < ops.length; i++) {
ExecutionResult memory result = simulateHandleOp(ops[i]);
(bool success, bytes memory returnData) = address(this).call(
abi.encodeWithSignature(
"simulateHandleOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,address,address,bytes))",
ops[i]
)
);

results[i] = result;
if (success) {
ExecutionResult memory execResult = abi.decode(
returnData,
(ExecutionResult)
);
results[resultsIndex++] = execResult;
}

// revert only at last as we are estimating only the last call
if (i == ops.length - 1) {
if (returnData.length > 0) {
assembly {
// Revert using the original error data, propagating the exact revert reason
revert(add(returnData, 0x20), mload(returnData))
}
} else {
// If there's no revert reason, we can use a generic message
revert("simulateHandleOp failed without a revert reason");
}
}

// ExecutionResult memory result = simulateHandleOp(ops[i]);
// results[i] = result;
}

return results;
Expand Down
Loading