Add onlyBootloader check to Paymaster.sol - #14
Open
Smeagol1907 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The base
Paymastercontract'svalidateAndPayForPaymasterTransaction()did not restrict the caller to the bootloader, unlike the pattern used elsewhere for ZKsync paymasters (e.g. checkingmsg.sender == BOOTLOADER_FORMAL_ADDRESS).Since this function sends
requiredETH(derived entirely from the caller-supplied_transactionfields) to the bootloader address on every call, anyone could call it directly and drain the paymaster's ETH balance by supplying an arbitrarily largegasLimit/maxFeePerGas, without going through a real transaction.Added a
NotFromBootloadererror and a check at the top ofvalidateAndPayForPaymasterTransaction()that reverts unlessmsg.sender == BOOTLOADER_FORMAL_ADDRESS, consistent with how other Abstract paymasters guard this entrypoint.This contract is currently undocumented in the README and may not be in active use, so flagging as a hardening fix rather than a live exploit report.
PR-Codex overview
This PR introduces a new error handling mechanism in the
Paymastercontract to ensure that only the bootloader can initiate certain transactions, enhancing security and validation.Detailed summary
NotFromBootloader()to handle unauthorized calls.msg.senderis not theBOOTLOADER_FORMAL_ADDRESS.