AA-130 L-11: Unrestrained revert reason (#200)

* AA-130 L-11: Unrestrained revert reason [core]

add prefix to revert reason from account (or paymaster)

---------

Co-authored-by: shahafn <shahaflol@gmail.com>
This commit is contained in:
Dror Tirosh
2023-02-09 00:04:01 +02:00
committed by GitHub
parent 4004ebf1fa
commit 3d8f4508b2
4 changed files with 12 additions and 12 deletions

View File

@@ -410,7 +410,7 @@ contract EntryPoint is IEntryPoint, StakeManager {
returns (uint256 _sigTimeRange) {
sigTimeRange = _sigTimeRange;
} catch Error(string memory revertReason) {
revert FailedOp(opIndex, address(0), revertReason);
revert FailedOp(opIndex, address(0), string.concat("AA23 reverted: ", revertReason));
} catch {
revert FailedOp(opIndex, address(0), "AA23 reverted (or OOG)");
}
@@ -452,7 +452,7 @@ contract EntryPoint is IEntryPoint, StakeManager {
context = _context;
sigTimeRange = _sigTimeRange;
} catch Error(string memory revertReason) {
revert FailedOp(opIndex, paymaster, revertReason);
revert FailedOp(opIndex, paymaster, string.concat("AA33 reverted: ", revertReason));
} catch {
revert FailedOp(opIndex, paymaster, "AA33 reverted (or OOG)");
}

View File

@@ -14,22 +14,22 @@
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple │ 10 │ 470509 │ │ ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple - diff from previous │ 11 │ │ 43744 │ 12699
║ simple - diff from previous │ 11 │ │ 43768 │ 12723
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple paymaster │ 1 │ 84411 │ │ ║
║ simple paymaster │ 1 │ 84387 │ │ ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple paymaster with diff │ 2 │ │ 42598 │ 11553 ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple paymaster │ 10 │ 467966 │ │ ║
║ simple paymaster │ 10 │ 467834 │ │ ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple paymaster with diff │ 11 │ │ 42770 │ 11725
║ simple paymaster with diff │ 11 │ │ 42746 │ 11701
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ big tx 5k │ 1 │ 179846 │ │ ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ big tx - diff from previous │ 2 │ │ 144922 │ 17627
║ big tx - diff from previous │ 2 │ │ 144898 │ 17603
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ big tx 5k │ 10 │ 1489641 │ │ ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ big tx - diff from previous │ 11 │ │ 146463 │ 19168
║ big tx - diff from previous │ 11 │ │ 146427 │ 19132
╚════════════════════════════════╧═══════╧═══════════════╧════════════════╧═════════════════════╝

View File

@@ -232,8 +232,8 @@ describe('EntryPoint', function () {
it('should fail if validateUserOp fails', async () => {
// using wrong nonce
const op = await fillAndSign({ sender: account.address, nonce: 1234 }, accountOwner, entryPoint)
await expect(entryPoint.callStatic.simulateValidation(op).catch(rethrow())).to
.revertedWith('invalid nonce')
await expect(entryPoint.callStatic.simulateValidation(op)).to
.revertedWith('AA23 reverted: account: invalid nonce')
})
it('should report signature failure without revert', async () => {

View File

@@ -104,10 +104,10 @@ describe('EntryPoint with paymaster', function () {
}, accountOwner, entryPoint)
await expect(entryPoint.callStatic.handleOps([op], beneficiaryAddress, {
gasLimit: 1e7
}).catch(rethrow())).to.revertedWith('TokenPaymaster: no balance')
})).to.revertedWith('AA33 reverted: TokenPaymaster: no balance')
await expect(entryPoint.handleOps([op], beneficiaryAddress, {
gasLimit: 1e7
}).catch(rethrow())).to.revertedWith('TokenPaymaster: no balance')
})).to.revertedWith('AA33 reverted: TokenPaymaster: no balance')
})
})