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

Temp remove post op cost and add tests #6

Merged

Conversation

ShivaanshK
Copy link
Contributor

No description provided.

@@ -155,15 +145,19 @@ contract BiconomySponsorshipPaymaster is
function withdrawTo(address payable withdrawAddress, uint256 amount) external override nonReentrant {
if (withdrawAddress == address(0)) revert CanNotWithdrawToZeroAddress();
uint256 currentBalance = paymasterIdBalances[msg.sender];
require(amount <= currentBalance, "Sponsorship Paymaster: Insufficient funds to withdraw from gas tank");
if (amount > currentBalance) {
revert InsufficientFundsInGasTank();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure to add test cases

abi.decode(context, (address, uint32, bytes32));

uint256 balToDeduct = actualGasCost + postopCost * actualUserOpFeePerGas;
uint256 adjustedGasCost = (actualGasCost * dynamicAdjustment) / PRICE_DENOMINATOR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamicAdjustment can be worded better.


uint256 maxFeePerGas = userOp.unpackMaxFeePerGas();
if (priceMarkup > 2e6 || priceMarkup == 0) {
revert InvalidPriceMarkup();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure these are caught properly all the way bubbled up to entry point.
by writing negative test cases

"Sponsorship Paymaster: paymasterId does not have enough deposit"
);
if (effectiveCost > paymasterIdBalances[paymasterId]) {
revert InsufficientFundsForPaymasterId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write a test that catches this from entrypoint handleOps execution.

Copy link
Contributor

@livingrockrises livingrockrises left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review i

Copy link
Contributor

@livingrockrises livingrockrises left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving as discussed

@livingrockrises livingrockrises merged commit 31a4ea1 into feat/paymaster-foundry-tests Jul 8, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants